StopMotion - libgphoto2 integration

This commit is contained in:
manongjohn 2022-08-13 16:13:21 -04:00
parent ddbd6ab197
commit 9713d2faf5
81 changed files with 7507 additions and 710 deletions

View file

@ -47,6 +47,11 @@ jobs:
export CC="ccache ${{ matrix.cc }}"
export CXX="ccache ${{ matrix.cxx }}"
ci-scripts/linux/tahoma-buildlibmypaint.sh
- name: Build libgphoto2
run: |
export CC="ccache ${{ matrix.cc }}"
export CXX="ccache ${{ matrix.cxx }}"
ci-scripts/linux/tahoma-buildlibgphoto2.sh
- name: Build Tahoma2D
run: |
export CC="ccache ${{ matrix.cc }}"

View file

@ -47,6 +47,10 @@ jobs:
run: |
export PATH="/usr/local/opt/ccache/libexec:$PATH"
ci-scripts/osx/tahoma-buildopencv.sh
- name: Build libgphoto2
run: |
export PATH="/usr/local/opt/ccache/libexec:$PATH"
ci-scripts/osx/tahoma-buildlibgphoto2.sh
- name: Build Tahoma2D
run: |
export PATH="/usr/local/opt/ccache/libexec:$PATH"

2
ci-scripts/linux/tahoma-build.sh Executable file → Normal file
View file

@ -13,7 +13,9 @@ cd build
source /opt/qt515/bin/qt515-env.sh
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
cmake ../sources \
-DWITH_GPHOTO2:BOOL=ON \
-DWITH_SYSTEM_SUPERLU=ON
make -j7

View file

@ -0,0 +1,23 @@
#!/bin/bash
cd thirdparty
echo ">>> Cloning libgphoto2"
git clone https://github.com/tahoma2d/libgphoto2.git libgphoto2_src
cd libgphoto2_src
echo "*" >| .gitignore
git checkout tahoma2d-version
echo ">>> Configuring libgphoto2"
autoreconf --install --symlink
./configure --prefix=/usr/local
echo ">>> Making libgphoto2"
make
echo ">>> Installing libgphoto2"
sudo make install
cd ..

View file

@ -61,6 +61,14 @@ then
chmod 755 -R Tahoma2D/rhubarb
fi
echo ">>> Copying libghoto2 supporting directories"
cp -r /usr/local/lib/libgphoto2 appdir/usr/lib
cp -r /usr/local/lib/libgphoto2_port appdir/usr/lib
rm appdir/usr/lib/libgphoto2/print-camera-list
find appdir/usr/lib/libgphoto2* -name *.la -exec rm -f {} \;
find appdir/usr/lib/libgphoto2* -name *.so -exec patchelf --set-rpath '$ORIGIN/../..' {} \;
echo ">>> Creating Tahoma2D/Tahoma2D.AppImage"
if [ ! -f linuxdeployqt*.AppImage ]
@ -78,6 +86,11 @@ export LD_LIBRARY_PATH=appdir/usr/lib/tahoma2d
-executable=appdir/usr/bin/tconverter \
-executable=appdir/usr/bin/tfarmcontroller \
-executable=appdir/usr/bin/tfarmserver
rm appdir/AppRun
cp ../sources/scripts/AppRun appdir
chmod 775 appdir/AppRun
./linuxdeployqt*.AppImage appdir/usr/bin/Tahoma2D -appimage
mv Tahoma2D*.AppImage Tahoma2D/Tahoma2D.AppImage

View file

@ -5,7 +5,7 @@ sudo apt-get install -y cmake liblzo2-dev liblz4-dev libfreetype6-dev libpng-dev
# Removed: libopenjpeg-dev
sudo apt-get install -y nasm yasm libgnutls28-dev libunistring-dev libass-dev libbluray-dev libmp3lame-dev libopus-dev libsnappy-dev libtheora-dev libvorbis-dev libvpx-dev libwebp-dev libxml2-dev libfontconfig1-dev libfreetype6-dev libopencore-amrnb-dev libopencore-amrwb-dev libspeex-dev libsoxr-dev libopenjp2-7-dev
sudo apt-get install -y python3-pip
sudo apt install -y build-essential libgirepository1.0-dev autotools-dev intltool gettext libtool
sudo apt-get install -y build-essential libgirepository1.0-dev autotools-dev intltool gettext libtool patchelf
pip3 install --upgrade pip
pip3 install numpy

View file

@ -27,9 +27,9 @@ then
export CANON_FLAG=-DWITH_CANON=ON
fi
export MACOSX_DEPLOYMENT_TARGET=10.13
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/jpeg-turbo/lib/pkgconfig"
cmake ../sources $CANON_FLAG \
-DWITH_GPHOTO2=ON \
-DQT_PATH=$USEQTLIB \
-DTIFF_INCLUDE_DIR=../../thirdparty/tiff-4.2.0/libtiff/ \
-DSUPERLU_INCLUDE_DIR=../../thirdparty/superlu/SuperLU_4.1/include/

View file

@ -0,0 +1,23 @@
#!/bin/bash
cd thirdparty
echo ">>> Cloning libgphoto2"
git clone https://github.com/tahoma2d/libgphoto2.git libgphoto2_src
cd libgphoto2_src
echo "*" >| .gitignore
git checkout tahoma2d-version
echo ">>> Configuring libgphoto2"
autoreconf --install --symlink
./configure --prefix=/usr/local
echo ">>> Making libgphoto2"
make
echo ">>> Installing libgphoto2"
sudo make install
cd ..

View file

@ -50,17 +50,25 @@ then
chmod -R 755 $TOONZDIR/Tahoma2D.app/rhubarb
fi
if [ ! -d $TOONZDIR/Tahoma2D.app/Contents/Frameworks ]
then
mkdir $TOONZDIR/Tahoma2D.app/Contents/Frameworks
fi
if [ -d thirdparty/canon/Framework ]
then
echo ">>> Copying canon framework to $TOONZDIR/Tahoma2D.app/Contents/Frameworks/EDSDK.Framework"
if [ ! -d $TOONZDIR/Tahoma2D.app/Contents/Frameworks ]
then
mkdir $TOONZDIR/Tahoma2D.app/Contents/Frameworks
fi
cp -R thirdparty/canon/Framework/ $TOONZDIR/Tahoma2D.app/Contents/Frameworks
chmod -R 755 $TOONZDIR/Tahoma2D.app/Contents/Frameworks/EDSDK.framework
fi
echo ">>> Copying libghoto2 supporting directories"
cp -R /usr/local/lib/libgphoto2 $TOONZDIR/Tahoma2D.app/Contents/Frameworks
cp -R /usr/local/lib/libgphoto2_port $TOONZDIR/Tahoma2D.app/Contents/Frameworks
rm $TOONZDIR/Tahoma2D.app/Contents/Frameworks/libgphoto2/print-camera-list
find $TOONZDIR/Tahoma2D.app/Contents/Frameworks/libgphoto2* -name *.la -exec rm -f {} \;
echo ">>> Configuring Tahoma2D.app for deployment"
$QTDIR/bin/macdeployqt $TOONZDIR/Tahoma2D.app -verbose=0 -always-overwrite \
@ -73,7 +81,7 @@ $QTDIR/bin/macdeployqt $TOONZDIR/Tahoma2D.app -verbose=0 -always-overwrite \
-executable=$TOONZDIR/Tahoma2D.app/Contents/MacOS/tfarmserver
echo ">>> Correcting library paths"
for X in `find $TOONZDIR/Tahoma2D.app/Contents -type f -name *.dylib -exec otool -l {} \; | grep -e "^toonz" -e"name \/usr\/local" | sed -e"s/://" -e"s/ (.*$//" -e"s/^ *name //"`
for X in `find $TOONZDIR/Tahoma2D.app/Contents -type f '(' -name *.dylib -o -name *.so ')' -exec otool -l {} \; | grep -e "^toonz" -e"name \/usr\/local" | sed -e"s/://" -e"s/ (.*$//" -e"s/^ *name //"`
do
Z=`echo $X | cut -c 1-1`
if [ "$Z" != "/" ]
@ -82,10 +90,22 @@ do
else
Y=`basename $X`
W=`basename $LIBFILE`
if [ -f $TOONZDIR/Tahoma2D.app/Contents/Frameworks/$Y -a "$Y" != "$W" ]
if [ ! -f $TOONZDIR/Tahoma2D.app/Contents/Frameworks/$Y ]
then
echo "Copying $X to Frameworks"
cp $X $TOONZDIR/Tahoma2D.app/Contents/Frameworks
chmod 644 $TOONZDIR/Tahoma2D.app/Contents/Frameworks/$Y
fi
if [ "$Y" != "$W" ]
then
echo "Fixing $X in $LIBFILE"
install_name_tool -change $X @executable_path/../Frameworks/$Y $LIBFILE
FIXCHECK=`otool -D $LIBFILE | grep -e"\/usr\/local"`
if [ "$FIXCHECK" == "$X" ]
then
echo " Fixed ID!"
install_name_tool -id @executable_path/../Frameworks/$Y $LIBFILE
fi
fi
fi
done

View file

@ -7,4 +7,4 @@ brew unlink nghttp2
brew install boost qt@5 clang-format glew lz4 lzo libmypaint jpeg-turbo nasm yasm fontconfig freetype gnutls lame libass libbluray libsoxr libvorbis libvpx opencore-amr openh264 openjpeg opus rav1e sdl2 snappy speex tesseract theora webp xvid xz
#brew install dav1d
brew install meson ninja
brew install automake autoconf gettext pkg-config libtool libusb-compat gd libexif

View file

@ -25,10 +25,13 @@ IF EXIST D:\a\tahoma2d\tahoma2d\thirdparty\qt\5.9\msvc2019_64 (
set WITH_CANON=N
IF EXIST ..\..\thirdparty\canon\Header set WITH_CANON=Y
set WITH_GPHOTO2=N
IF EXIST ..\..\thirdparty\libgphoto2\include set WITH_GPHOTO2=Y
set WITH_CRASHRPT=N
IF EXIST ..\..\thirdparty\crashrpt\include set WITH_CRASHRPT=Y
cmake ..\sources -G %MSVCVERSION% -Ax64 -DQT_PATH=%QT_PATH% -DBOOST_ROOT=%BOOST_ROOT% -DOpenCV_DIR=%OPENCV_DIR% -DWITH_CANON=%WITH_CANON% -DWITH_CRASHRPT=%WITH_CRASHRPT%
cmake ..\sources -G %MSVCVERSION% -Ax64 -DQT_PATH=%QT_PATH% -DBOOST_ROOT=%BOOST_ROOT% -DOpenCV_DIR=%OPENCV_DIR% -DWITH_CANON=%WITH_CANON% -DWITH_GPHOTO2=%WITH_GPHOTO2% -DWITH_CRASHRPT=%WITH_CRASHRPT%
IF EXIST C:\ProgramData\chocolatey\bin\cl.exe (

View file

@ -32,6 +32,12 @@ IF EXIST ..\..\thirdparty\canon\Header (
copy /Y ..\..\thirdparty\canon\Dll\EdsImage.dll Tahoma2D
)
IF EXIST ..\..\thirdparty\libgphoto2\include (
xcopy /Y /E ..\..\thirdparty\libgphoto2\bin\camlibs Tahoma2D\tahomastuff
xcopy /Y /E ..\..\thirdparty\libgphoto2\bin\iolibs Tahoma2D\tahomastuff
copy /Y ..\..\thirdparty\libgphoto2\bin\*.* Tahoma2D\tahomastuff
)
IF EXIST ..\..\thirdparty\crashrpt\include (
copy /Y ..\..\thirdparty\apps\crashrpt\CrashRpt1500.dll Tahoma2D
copy /Y ..\..\thirdparty\apps\crashrpt\CrashSender1500.exe Tahoma2D

View file

@ -0,0 +1,506 @@
libgphoto2 library
-----------------------------------------------------------------------
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright © 1991, 1999 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright © <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View file

@ -0,0 +1,12 @@
Tahoma2D uses a modified version of libgphoto2.
- Windows version was modified to allow building with MSVC 2019 using a modified
MSVC project taken from https://github.com/vividos/RemotePhotoTool.
- OSX version was modified to allow relocation of camlib/iolibs directories relative
to libgphoto2/libgphoto2_port dylibs, post build, to allow for packaging and portability.
- Linux version has no changes
Modified source can be found at https://github.com/tahoma2d/libgphoto2 under
the `tahoma2d-version` branch.

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b99af8d1b5db501d51c98ea6c90668198269c44b1c49e2d91d21254a41011512
size 139776

Binary file not shown.

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dcbb0910b8e5a57fefcabd993c815906460f0d64424932a30b7083b55ea6fc1f
size 2064

Binary file not shown.

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cf2dc953d26edb85c32d8ed54c7c27ff07bd2cb63b008a42fd13641def484079
size 881664

Binary file not shown.

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:76425341db0df1d16177de4037b83c1afbbe4220897329a286ce844c1e8dc821
size 2052

Binary file not shown.

BIN
thirdparty/libgphoto2/bin/compat.pdb vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6e7112dc29f022f5a06d6fcc1525e9f2efb6c1260df233965bbf97c9e5e7fbf3
size 11264

Binary file not shown.

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fcf15f411427f8f43db3df2bb78f6522a31fa8f6115516558d0d204c8648284a
size 2200

Binary file not shown.

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:100b348fc5d969066bb2c695fed5c1091fa313d06e1155bb0852d5afabba14f6
size 35328

Binary file not shown.

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8ffa05edb05c8d54084ac7b3a801a0a55bb9be6d83726c92cc5cac2038279340
size 2244

Binary file not shown.

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:08491f209e4c7fcf49ce622d27f9211fd7d6d66c18f92490027e7cd77ffdb282
size 11776

Binary file not shown.

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6a1d05c9c0a8ebb963fb20d34aa40ccc423e7d88cc4d843212f0b75de9a8050b
size 2216

Binary file not shown.

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2c99b16018528f01e3d439ceae8b5751b809aae2fbae518657a5a72c0cf3ccf3
size 141824

BIN
thirdparty/libgphoto2/bin/libgphoto2.pdb vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:abf9a381af54681242826b215d0490eb42f5514c34f040b83f5c4b2871e407b7
size 43520

Binary file not shown.

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1dac95d1eafcba057cf3df73dcf419bc14f4167ef4ac92fe1f8fdcab4278b6f4
size 161280

BIN
thirdparty/libgphoto2/bin/libusb-1.0.pdb vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,208 @@
/** \file gphoto2-abilities-list.h
* \brief List of supported camera models including their abilities.
*
* \author Copyright 2000 Scott Fritzinger
*
* \par
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* \par
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* \par
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef LIBGPHOTO2_GPHOTO2_ABILITIES_LIST_H
#define LIBGPHOTO2_GPHOTO2_ABILITIES_LIST_H
#include <gphoto2/gphoto2-context.h>
#include <gphoto2/gphoto2-list.h>
#include <gphoto2/gphoto2-port-info-list.h>
#include <gphoto2/gphoto2-port-log.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* Current implementation status of the camera driver.
*/
typedef enum {
GP_DRIVER_STATUS_PRODUCTION, /**< Driver is production ready. */
GP_DRIVER_STATUS_TESTING, /**< Driver is beta quality. */
GP_DRIVER_STATUS_EXPERIMENTAL, /**< Driver is alpha quality and might even not work. */
GP_DRIVER_STATUS_DEPRECATED /**< Driver is no longer recommended to use and will be removed. */
} CameraDriverStatus;
/**
* Type of the device represented. Currently we have Still Cameras
* and MTP Audio Players.
*/
typedef enum {
GP_DEVICE_STILL_CAMERA = 0, /**< Traditional still camera */
GP_DEVICE_AUDIO_PLAYER = 1 << 0 /**< Audio player */
} GphotoDeviceType;
/**
* A bitmask of remote control related operations of the device.
* Some drivers might support additional dynamic capabilities (like the PTP driver).
*/
typedef enum {
GP_OPERATION_NONE = 0, /**< No remote control operation supported. */
GP_OPERATION_CAPTURE_IMAGE = 1 << 0, /**< Capturing images supported. */
GP_OPERATION_CAPTURE_VIDEO = 1 << 1, /**< Capturing videos supported. */
GP_OPERATION_CAPTURE_AUDIO = 1 << 2, /**< Capturing audio supported. */
GP_OPERATION_CAPTURE_PREVIEW = 1 << 3, /**< Capturing image previews supported. */
GP_OPERATION_CONFIG = 1 << 4, /**< Camera and Driver configuration supported. */
GP_OPERATION_TRIGGER_CAPTURE = 1 << 5 /**< Camera can trigger capture and wait for events. */
} CameraOperation;
/**
* A bitmask of image related operations of the device.
*/
typedef enum {
GP_FILE_OPERATION_NONE = 0, /**< No special file operations, just download. */
GP_FILE_OPERATION_DELETE = 1 << 1, /**< Deletion of files is possible. */
GP_FILE_OPERATION_PREVIEW = 1 << 3, /**< Previewing viewfinder content is possible. */
GP_FILE_OPERATION_RAW = 1 << 4, /**< Raw retrieval is possible (used by non-JPEG cameras) */
GP_FILE_OPERATION_AUDIO = 1 << 5, /**< Audio retrieval is possible. */
GP_FILE_OPERATION_EXIF = 1 << 6 /**< EXIF retrieval is possible. */
} CameraFileOperation;
/**
* A bitmask of filesystem related operations of the device.
*/
typedef enum {
GP_FOLDER_OPERATION_NONE = 0, /**< No special filesystem operation. */
GP_FOLDER_OPERATION_DELETE_ALL = 1 << 0, /**< Deletion of all files on the device. */
GP_FOLDER_OPERATION_PUT_FILE = 1 << 1, /**< Upload of files to the device possible. */
GP_FOLDER_OPERATION_MAKE_DIR = 1 << 2, /**< Making directories on the device possible. */
GP_FOLDER_OPERATION_REMOVE_DIR = 1 << 3 /**< Removing directories from the device possible. */
} CameraFolderOperation;
#ifdef _GPHOTO2_INTERNAL_CODE
/* enum CameraOperation */
extern const StringFlagItem gpi_camera_operation_map[];
/* enum CameraFileOperation */
extern const StringFlagItem gpi_file_operation_map[];
/* enum CameraFolderOperation */
extern const StringFlagItem gpi_folder_operation_map[];
/* enum GphotoDeviceType */
extern const StringFlagItem gpi_gphoto_device_type_map[];
/* enum CameraDriverStatus */
extern const StringFlagItem gpi_camera_driver_status_map[];
#endif /* _GPHOTO2_INTERNAL_CODE */
/**
* \brief Describes the properties of a specific camera.
*
* The internals of this structures are used extensively by the
* camlibs, but the status regarding use by frontends is questionable.
*/
typedef struct {
char model [128]; /**< \brief name of camera model */
CameraDriverStatus status; /**< \brief driver quality */
/** \brief Supported port types. */
GPPortType port;
/** \brief Supported serial port speeds (terminated with a value of 0). */
int speed [64];
/* Supported operations */
CameraOperation operations; /**< \brief Camera operation funcs */
CameraFileOperation file_operations; /**< \brief Camera file op funcs */
CameraFolderOperation folder_operations;/**< \brief Camera folder op funcs */
int usb_vendor; /**< \brief USB Vendor D */
int usb_product; /**< \brief USB Product ID */
int usb_class; /**< \brief USB device class */
int usb_subclass; /**< \brief USB device subclass */
int usb_protocol; /**< \brief USB device protocol */
/* For core use */
char library [1024]; /**< \brief (Internal) library filename */
char id [1024]; /**< \brief (Internal) camera ID name */
GphotoDeviceType device_type; /**< \brief Device type. */
/** Reserved space to use in the future w/out changing the
* struct size */
int reserved2; /**< reserved space \internal */
int reserved3; /**< reserved space \internal */
int reserved4; /**< reserved space \internal */
int reserved5; /**< reserved space \internal */
int reserved6; /**< reserved space \internal */
int reserved7; /**< reserved space \internal */
int reserved8; /**< reserved space \internal */
} CameraAbilities;
/**
* \brief List of supported camera models including their abilities
*
* The internals of this list are hidden - use the access functions.
*/
typedef struct _CameraAbilitiesList CameraAbilitiesList;
int gp_abilities_list_new (CameraAbilitiesList **list);
int gp_abilities_list_free (CameraAbilitiesList *list);
int gp_abilities_list_load (CameraAbilitiesList *list, GPContext *context);
int gp_abilities_list_load_dir (CameraAbilitiesList *list, const char *dir, GPContext *context);
int gp_abilities_list_reset (CameraAbilitiesList *list);
int gp_abilities_list_detect (CameraAbilitiesList *list,
GPPortInfoList *info_list, CameraList *l,
GPContext *context);
int gp_abilities_list_append (CameraAbilitiesList *list,
CameraAbilities abilities);
int gp_abilities_list_count (CameraAbilitiesList *list);
int gp_abilities_list_lookup_model (CameraAbilitiesList *list,
const char *model);
int gp_abilities_list_get_abilities (CameraAbilitiesList *list, int index,
CameraAbilities *abilities);
const char *gp_message_codeset (const char *);
int gp_init_localedir (const char *localedir);
/**
* Name of the environment variable which may contain the path where
* to look for the camlibs. If this environment variable is not defined,
* use the compiled-in default constant.
*
* \internal Internal use only.
*/
#ifdef _GPHOTO2_INTERNAL_CODE
#define CAMLIBDIR_ENV "CAMLIBS"
#endif /* _GPHOTO2_INTERNAL_CODE */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* !defined(LIBGPHOTO2_GPHOTO2_ABILITIES_LIST_H) */

View file

@ -0,0 +1,484 @@
/** \file
*
* \brief Implement Camera object representing a camera attached to the system.
*
* \author Copyright 2000 Scott Fritzinger
*
* \note
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* \note
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* \note
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef LIBGPHOTO2_GPHOTO2_CAMERA_H
#define LIBGPHOTO2_GPHOTO2_CAMERA_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* \brief Object representing a camera attached to the system.
*
* A Camera object represents a specific instance of a (physical of
* virtual) camera attached to the system.
*
* The abilities of this type of camera are stored in a CameraAbility
* object.
*
* The details of the Camera object are internal.
*/
typedef struct _Camera Camera;
#ifdef __cplusplus
}
#endif /* __cplusplus */
#include <gphoto2/gphoto2-abilities-list.h>
#include <gphoto2/gphoto2-port.h>
#include <gphoto2/gphoto2-widget.h>
#include <gphoto2/gphoto2-filesys.h>
#include <gphoto2/gphoto2-result.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* \brief CameraText structure used in various functions.
*
* A text structure containing translated text returned
* by various functions (about, manual, summary). You should
* not assume a size.
*/
typedef struct {
char text [32 * 1024]; /**< \brief Character string containing the translated text. */
} CameraText;
/**
* \brief A structure created by the capture operation.
*
* A structure containing the folder and filename of an object
* after a successful capture and is passed as reference to the
* gp_camera_capture() function.
*/
typedef struct {
char name [128]; /**< \brief Name of the captured file. */
char folder [1024]; /**< \brief Name of the folder of the captured file. */
} CameraFilePath;
/**
* \brief Type of the capture to do.
*
* Specifies the type of capture the user wants to do with the
* gp_camera_capture() function.
*/
typedef enum {
GP_CAPTURE_IMAGE, /**< \brief Capture an image. */
GP_CAPTURE_MOVIE, /**< \brief Capture a movie. */
GP_CAPTURE_SOUND /**< \brief Capture audio. */
} CameraCaptureType;
/**
* \brief Specify what event we received from the camera.
*
* Used by gp_camera_wait_for_event() to specify what
* event happened on the camera.
*
*/
typedef enum {
GP_EVENT_UNKNOWN, /**< unknown and unhandled event. argument is a char* or NULL */
GP_EVENT_TIMEOUT, /**< timeout, no arguments */
GP_EVENT_FILE_ADDED, /**< CameraFilePath* = file path on camfs */
GP_EVENT_FOLDER_ADDED, /**< CameraFilePath* = folder on camfs */
GP_EVENT_CAPTURE_COMPLETE, /**< last capture is complete */
GP_EVENT_FILE_CHANGED /**< CameraFilePath* = file path on camfs */
} CameraEventType;
/**
* \name Camera object member functions
*
* These functions must be implemented by a camlib and the camlib's
* camera_init() function will add them to a Camera object.
*
* @{
*/
/**
* \brief The camera exit function
*
* \param camera the current camera
* \param context a #GPContext
*
* This functions is called in the camera driver for closing the camera
* connection. It should do the necessary cleanups of the internal camera
* state, free allocated private structures and similar.
*
* The driver does not need to close the #GPPort, this is done by libgphoto2
* itself.
*
* Implement this function if you need to any of this stuff, otherwise leave
* it out.
*
* \returns a gphoto error code
*/
typedef int (*CameraExitFunc) (Camera *camera, GPContext *context);
/**
* \brief Get a configuration tree for the camera and its driver
*
* \param camera the current camera
* \param widget pointer to store the toplevel widget of the tree
* \param context the active #GPContext
*
* A camera driver can support configuration of either its own behaviour
* or the camera device itself. To allow a flexible driver framework,
* the camera driver provides a generic configuration widget tree to the
* frontend, which then renders it, allows user input and sends it back
* via the #CameraSetConfigFunc function to have the driver configure itself
* or the camera.
*
* If you do not have configuration ability, there is no need to specify this
* function.
*
* \returns a gphoto error code
*/
typedef int (*CameraGetConfigFunc) (Camera *camera, CameraWidget **widget,
GPContext *context);
/**
* \brief Get a configuration widget for a specific configuration
*
* \param camera the current camera
* \param name the name of the widget
* \param widget pointer to store the toplevel widget of the tree
* \param context the active #GPContext
*
* A camera driver can support configuration of either its own behaviour
* or the camera device itself. To allow a flexible driver framework,
* the camera driver provides a generic configuration widget tree to the
* frontend, which then renders it, allows user input and sends it back
* via the #CameraSetConfigFunc function to have the driver configure itself
* or the camera.
*
* This specific function retrieves one specific named entry, and not the full
* tree to allow for querying specific settings faster.
*
* If you do not have configuration ability, there is no need to specify this
* function.
*
* \returns a gphoto error code
*/
typedef int (*CameraGetSingleConfigFunc) (Camera *camera, const char *name, CameraWidget **widget,
GPContext *context);
/**
* \brief List all configuration widgets for a specific configuration
*
* \param camera the current camera
* \param list the list of widgets available
* \param context the active #GPContext
*
* A camera driver can support configuration of either its own behaviour
* or the camera device itself. To allow a flexible driver framework,
* the camera driver provides a generic configuration widget tree to the
* frontend, which then renders it, allows user input and sends it back
* via the #CameraSetConfigFunc function to have the driver configure itself
* or the camera.
*
* This specific function retrieves all the available configuration values in a flat list.
*
* This is different than the GetConfigFunc, which returns a configuration tree.
*
* If you do not have configuration ability, there is no need to specify this
* function.
*
* \returns a gphoto error code
*/
typedef int (*CameraListConfigFunc) (Camera *camera, CameraList *list, GPContext *context);
/**
* \brief Set the configuration in the camera
*
* \param camera the current camera
* \param widget the configuration widget tree that was changed
* \param context the active #GPContext
*
* This function is called in the driver after the configuration is set.
* It is called directly after setting the value and might called multiple
* times (or never) after just one #CameraGetConfigFunc.
*
* \returns a gphoto error code
*/
typedef int (*CameraSetConfigFunc) (Camera *camera, CameraWidget *widget,
GPContext *context);
/**
* \brief Set a single configuration variable in the camera
*
* \param camera the current camera
* \param name the widget to set
* \param widget the configuration widget tree that was changed
* \param context the active #GPContext
*
* This function is called in the driver after the configuration value is set.
*
* \returns a gphoto error code
*/
typedef int (*CameraSetSingleConfigFunc) (Camera *camera, const char *name, CameraWidget *widget,
GPContext *context);
typedef int (*CameraCaptureFunc) (Camera *camera, CameraCaptureType type,
CameraFilePath *path, GPContext *context);
typedef int (*CameraTriggerCaptureFunc) (Camera *camera, GPContext *context);
typedef int (*CameraCapturePreviewFunc) (Camera *camera, CameraFile *file,
GPContext *context);
typedef int (*CameraSummaryFunc) (Camera *camera, CameraText *text,
GPContext *context);
typedef int (*CameraManualFunc) (Camera *camera, CameraText *text,
GPContext *context);
typedef int (*CameraAboutFunc) (Camera *camera, CameraText *text,
GPContext *context);
typedef int (*CameraWaitForEvent) (Camera *camera, int timeout,
CameraEventType *eventtype, void **eventdata,
GPContext *context);
/**@}*/
/**
* \param camera a \ref Camera object
* \param context a \ref GPContext object
* \return a gphoto2 error code
*
* Implement this function in the camera driver if the camera needs to
* be initialized before or reset the after each access from
* libgphoto2.
*
* For example, you would probably set the speed to the highest one
* right before downloading an image, and reset it to the default speed
* afterwards so that other programs will not be affected by this speed
* change.
*/
typedef int (*CameraPrePostFunc) (Camera *camera, GPContext *context);
/**
* \brief Various camera specific functions.
*
* This structure contains various pointers to functions that apply to
* the camera itself, and not the filesystem (which is handled by the
* filesystem functions). Set the ones you want to provide, leave the rest
* unset.
*
* This structure should only used by the driver itself, the frontend
* should use the gp_camera_xxx wrapper functions for it, who handle
* opening and locking around those hooks.
*/
typedef struct _CameraFunctions {
CameraPrePostFunc pre_func; /**< \brief Function called before each camera operation. */
CameraPrePostFunc post_func; /**< \brief Function called after each camera operation. */
CameraExitFunc exit; /**< \brief Function called on closing the camera. */
/* Configuration */
CameraGetConfigFunc get_config; /**< \brief Called for requesting the configuration widgets. */
CameraSetConfigFunc set_config; /**< \brief Called after a configuration was changed */
CameraListConfigFunc list_config; /**< \brief Called for listing the available configuration widgets. */
CameraGetSingleConfigFunc get_single_config; /**< \brief Called for requesteing a single widget. */
CameraSetSingleConfigFunc set_single_config; /**< \brief Called for setting a single configuration widget. */
/* Capturing */
CameraCaptureFunc capture; /**< \brief Remote control the camera to capture */
CameraTriggerCaptureFunc trigger_capture;/**< \brief Remote control the camera to trigger capture */
CameraCapturePreviewFunc capture_preview;/**< \brief Preview viewfinder content. */
/* Textual information */
CameraSummaryFunc summary; /**< \brief Give a summary about the current camera status, translated. */
CameraManualFunc manual; /**< \brief Give a brief manual about any specific items a user has to know, translated. */
CameraAboutFunc about; /**< \brief A little About text, including authors and credits. */
/* Event Interface */
CameraWaitForEvent wait_for_event; /**< \brief Wait for a specific event from the camera */
/* Reserved space to use in the future without changing the struct size */
void *reserved1; /**< \brief reserved for future use */
void *reserved2; /**< \brief reserved for future use */
void *reserved3; /**< \brief reserved for future use */
void *reserved4; /**< \brief reserved for future use */
void *reserved5; /**< \brief reserved for future use */
void *reserved6; /**< \brief reserved for future use */
void *reserved7; /**< \brief reserved for future use */
void *reserved8; /**< \brief reserved for future use */
} CameraFunctions;
typedef struct _CameraPrivateLibrary CameraPrivateLibrary;
typedef struct _CameraPrivateCore CameraPrivateCore;
struct _Camera {
/** \name Those should be accessed only by the camera driver.
* @{ */
GPPort *port;
CameraFilesystem *fs;
CameraFunctions *functions;
/**@}*/
CameraPrivateLibrary *pl; /**< Private data of camera libraries. */
CameraPrivateCore *pc; /**< Private data of the core of gphoto2. */
};
/** Create a new camera device. */
int gp_camera_new (Camera **camera);
/** \name Preparing initialization
* @{
*/
int gp_camera_set_abilities (Camera *camera, CameraAbilities abilities);
int gp_camera_get_abilities (Camera *camera, CameraAbilities *abilities);
int gp_camera_set_port_info (Camera *camera, GPPortInfo info);
int gp_camera_get_port_info (Camera *camera, GPPortInfo *info);
/**@}*/
/**
* \name camera speed
*
* You normally don't use that. If you do, you prevent the camera driver
* from selecting the optimal speed.
*
* @{
*/
int gp_camera_set_port_speed (Camera *camera, int speed);
int gp_camera_get_port_speed (Camera *camera);
/**@}*/
/** \name Initialization
* @{
*/
int gp_camera_autodetect (CameraList *list, GPContext *context);
int gp_camera_init (Camera *camera, GPContext *context);
int gp_camera_exit (Camera *camera, GPContext *context);
/**@}*/
/** \name Operations on cameras
* @{
*/
int gp_camera_ref (Camera *camera);
int gp_camera_unref (Camera *camera);
int gp_camera_free (Camera *camera);
int gp_camera_get_config (Camera *camera, CameraWidget **window,
GPContext *context);
int gp_camera_list_config (Camera *camera, CameraList *list,
GPContext *context);
int gp_camera_get_single_config (Camera *camera, const char *name, CameraWidget **widget,
GPContext *context);
int gp_camera_set_config (Camera *camera, CameraWidget *window,
GPContext *context);
int gp_camera_set_single_config (Camera *camera, const char *name, CameraWidget *widget,
GPContext *context);
int gp_camera_get_summary (Camera *camera, CameraText *summary,
GPContext *context);
int gp_camera_get_manual (Camera *camera, CameraText *manual,
GPContext *context);
int gp_camera_get_about (Camera *camera, CameraText *about,
GPContext *context);
int gp_camera_capture (Camera *camera, CameraCaptureType type,
CameraFilePath *path, GPContext *context);
int gp_camera_trigger_capture (Camera *camera, GPContext *context);
int gp_camera_capture_preview (Camera *camera, CameraFile *file,
GPContext *context);
int gp_camera_wait_for_event (Camera *camera, int timeout,
CameraEventType *eventtype, void **eventdata,
GPContext *context);
int gp_camera_get_storageinfo (Camera *camera, CameraStorageInformation**,
int *, GPContext *context);
/**@}*/
/** \name Operations on folders
* @{
*/
int gp_camera_folder_list_files (Camera *camera, const char *folder,
CameraList *list, GPContext *context);
int gp_camera_folder_list_folders (Camera *camera, const char *folder,
CameraList *list, GPContext *context);
int gp_camera_folder_delete_all (Camera *camera, const char *folder,
GPContext *context);
int gp_camera_folder_put_file (Camera *camera,
const char *folder, const char *filename,
CameraFileType type,
CameraFile *file, GPContext *context);
int gp_camera_folder_make_dir (Camera *camera, const char *folder,
const char *name, GPContext *context);
int gp_camera_folder_remove_dir (Camera *camera, const char *folder,
const char *name, GPContext *context);
/**@}*/
/** \name Operations on files
* @{
*/
int gp_camera_file_get_info (Camera *camera, const char *folder,
const char *file, CameraFileInfo *info,
GPContext *context);
int gp_camera_file_set_info (Camera *camera, const char *folder,
const char *file, CameraFileInfo info,
GPContext *context);
int gp_camera_file_get (Camera *camera, const char *folder,
const char *file, CameraFileType type,
CameraFile *camera_file, GPContext *context);
int gp_camera_file_read (Camera *camera, const char *folder, const char *file,
CameraFileType type,
uint64_t offset, char *buf, uint64_t *size,
GPContext *context);
int gp_camera_file_delete (Camera *camera, const char *folder,
const char *file, GPContext *context);
/**@}*/
/**
* \name Some cameras need 'keep-alive-messages'.
* @{
*/
typedef int (* CameraTimeoutFunc) (Camera *camera,
GPContext *context);
typedef unsigned int (* CameraTimeoutStartFunc) (Camera *camera,
unsigned int timeout,
CameraTimeoutFunc func,
void *data);
typedef void (* CameraTimeoutStopFunc) (Camera *camera,
unsigned int id, void *data);
void gp_camera_set_timeout_funcs (Camera *camera,
CameraTimeoutStartFunc start_func,
CameraTimeoutStopFunc stop_func,
void *data);
int gp_camera_start_timeout (Camera *camera, unsigned int timeout,
CameraTimeoutFunc func);
void gp_camera_stop_timeout (Camera *camera, unsigned int id);
/**@}*/
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* !defined(LIBGPHOTO2_GPHOTO2_CAMERA_H) */

View file

@ -0,0 +1,138 @@
/** \file
* \brief Context callback operation functions.
*
* \author Copyright 2001 Lutz Mueller <lutz@users.sourceforge.net>
*
* \note
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* \note
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* \note
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef LIBGPHOTO2_GPHOTO2_CONTEXT_H
#define LIBGPHOTO2_GPHOTO2_CONTEXT_H
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* \brief The gphoto context structure.
*
* This structure allows callback handling, passing error contexts back,
* progress handling and download cancellation and similar things.
* It is usually passed around the functions.
*/
typedef struct _GPContext GPContext;
GPContext *gp_context_new (void);
void gp_context_ref (GPContext *context);
void gp_context_unref (GPContext *context);
/**
* \brief Return codes that can be returned by progress handling.
*
* An application can return special values back to the libgphoto2
* progress callback handling functions. If "Cancel" is selected,
* libgphoto2 and the camera driver will try to cancel transfer.
*/
typedef enum _GPContextFeedback {
GP_CONTEXT_FEEDBACK_OK, /**< Everything ok... proceed. */
GP_CONTEXT_FEEDBACK_CANCEL /**< Please cancel the current transfer if possible. */
} GPContextFeedback;
/* Functions */
typedef void (* GPContextIdleFunc) (GPContext *context, void *data);
typedef void (* GPContextErrorFunc) (GPContext *context, const char *text, void *data);
typedef void (* GPContextStatusFunc) (GPContext *context, const char *text, void *data);
typedef void (* GPContextMessageFunc) (GPContext *context, const char *text, void *data);
typedef GPContextFeedback (* GPContextQuestionFunc) (GPContext *context,
const char *text, void *data);
typedef GPContextFeedback (* GPContextCancelFunc) (GPContext *context,
void *data);
typedef unsigned int (* GPContextProgressStartFunc) (GPContext *context,
float target,
const char *text,
void *data);
typedef void (* GPContextProgressUpdateFunc) (GPContext *context,
unsigned int id,
float current,
void *data);
typedef void (* GPContextProgressStopFunc) (GPContext *context,
unsigned int id,
void *data);
/* Setting those functions (frontends) */
void gp_context_set_idle_func (GPContext *context,
GPContextIdleFunc func, void *data);
void gp_context_set_progress_funcs (GPContext *context,
GPContextProgressStartFunc start_func,
GPContextProgressUpdateFunc update_func,
GPContextProgressStopFunc stop_func,
void *data);
void gp_context_set_error_func (GPContext *context,
GPContextErrorFunc func, void *data);
void gp_context_set_status_func (GPContext *context,
GPContextStatusFunc func, void *data);
void gp_context_set_question_func (GPContext *context,
GPContextQuestionFunc func, void *data);
void gp_context_set_cancel_func (GPContext *context,
GPContextCancelFunc func, void *data);
void gp_context_set_message_func (GPContext *context,
GPContextMessageFunc func, void *data);
/* Calling those functions (backends) */
void gp_context_idle (GPContext *context);
void gp_context_error (GPContext *context, const char *format, ...)
#ifdef __GNUC__
__attribute__((__format__(printf,2,3)))
#endif
;
void gp_context_status (GPContext *context, const char *format, ...)
#ifdef __GNUC__
__attribute__((__format__(printf,2,3)))
#endif
;
void gp_context_message (GPContext *context, const char *format, ...)
#ifdef __GNUC__
__attribute__((__format__(printf,2,3)))
#endif
;
GPContextFeedback gp_context_question (GPContext *context, const char *format,
...)
#ifdef __GNUC__
__attribute__((__format__(printf,2,3)))
#endif
;
GPContextFeedback gp_context_cancel (GPContext *context);
unsigned int gp_context_progress_start (GPContext *context, float target,
const char *format, ...)
#ifdef __GNUC__
__attribute__((__format__(printf,3,4)))
#endif
;
void gp_context_progress_update (GPContext *context, unsigned int id,
float current);
void gp_context_progress_stop (GPContext *context, unsigned int id);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* !defined(LIBGPHOTO2_GPHOTO2_CONTEXT_H) */

View file

@ -0,0 +1,177 @@
/** \file
* \brief Abstracted gphoto2 file operations.
*
* \author Copyright 2000 Scott Fritzinger
* \author Copyright 2008-2009 Marcus Meissner
*
* \note
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* \note
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* \note
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef LIBGPHOTO2_GPHOTO2_FILE_H
#define LIBGPHOTO2_GPHOTO2_FILE_H
#include <time.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define GP_MIME_TXT "text/plain"
#define GP_MIME_WAV "audio/wav"
#define GP_MIME_RAW "image/x-raw"
#define GP_MIME_PNG "image/png"
#define GP_MIME_PGM "image/x-portable-graymap"
#define GP_MIME_PPM "image/x-portable-pixmap"
#define GP_MIME_PNM "image/x-portable-anymap"
#define GP_MIME_JPEG "image/jpeg"
#define GP_MIME_TIFF "image/tiff"
#define GP_MIME_BMP "image/bmp"
#define GP_MIME_QUICKTIME "video/quicktime"
#define GP_MIME_AVI "video/x-msvideo"
#define GP_MIME_CRW "image/x-canon-raw"
#define GP_MIME_CR2 "image/x-canon-cr2"
#define GP_MIME_CR3 "image/x-canon-cr3"
#define GP_MIME_NEF "image/x-nikon-nef"
#define GP_MIME_UNKNOWN "application/octet-stream"
#define GP_MIME_EXIF "application/x-exif"
#define GP_MIME_MP3 "audio/mpeg"
#define GP_MIME_OGG "application/ogg"
#define GP_MIME_WMA "audio/x-wma"
#define GP_MIME_ASF "audio/x-asf"
#define GP_MIME_MPEG "video/mpeg"
#define GP_MIME_AVCHD "video/mp2t"
#define GP_MIME_RW2 "image/x-panasonic-raw2"
#define GP_MIME_ARW "image/x-sony-arw"
/**
* \brief The type of view on the specified file.
*
* Specifies the file of the current file, usually passed
* to the gp_camera_file_get() and gp_camera_file_put()
* functions. This is useful for multiple views of one
* file, like that an single image file has "raw", "normal",
* "exif" and "preview" views, or a media file has "normal"
* and "metadata" file views.
*/
typedef enum {
GP_FILE_TYPE_PREVIEW, /**< A preview of an image. */
GP_FILE_TYPE_NORMAL, /**< The regular normal data of a file. */
GP_FILE_TYPE_RAW, /**< The raw mode of a file, for instance the raw bayer data for cameras
* where postprocessing is done in the driver. The RAW files of modern
* DSLRs are GP_FILE_TYPE_NORMAL usually. */
GP_FILE_TYPE_AUDIO, /**< The audio view of a file. Perhaps an embedded comment or similar. */
GP_FILE_TYPE_EXIF, /**< The embedded EXIF data of an image. */
GP_FILE_TYPE_METADATA /**< The metadata of a file, like Metadata of files on MTP devices. */
} CameraFileType;
/**
* \brief File storage type.
*
* The file storage type. Only used internally for now, but might
* be exposed later on. See gp_file_new() and gp_file_new_from_fd().
*/
typedef enum {
GP_FILE_ACCESSTYPE_MEMORY, /**< File is in system memory. */
GP_FILE_ACCESSTYPE_FD, /**< File is associated with a UNIX filedescriptor. */
GP_FILE_ACCESSTYPE_HANDLER /**< File is associated with a programmatic handler. */
} CameraFileAccessType;
/* FIXME: api might be unstable. function return gphoto results codes. */
typedef struct _CameraFileHandler {
int (*size) (void*priv, uint64_t *size); /* only for read? */
int (*read) (void*priv, unsigned char *data, uint64_t *len);
int (*write) (void*priv, unsigned char *data, uint64_t *len);
/* FIXME: should we have both read/write methods? */
/* FIXME: how to finish method, due to LRU it might be longlived. */
} CameraFileHandler;
/*! \struct CameraFile
* \brief File structure.
*
* The internals of the CameraFile struct are private, please use
* the accessor functions.
*/
typedef struct _CameraFile CameraFile;
int gp_file_new (CameraFile **file);
int gp_file_new_from_fd (CameraFile **file, int fd);
int gp_file_new_from_handler (CameraFile **file, CameraFileHandler *handler, void*priv);
int gp_file_ref (CameraFile *file);
int gp_file_unref (CameraFile *file);
int gp_file_free (CameraFile *file);
int gp_file_set_name (CameraFile *file, const char *name);
int gp_file_get_name (CameraFile *file, const char **name);
int gp_file_set_mime_type (CameraFile *file, const char *mime_type);
int gp_file_get_mime_type (CameraFile *file, const char **mime_type);
int gp_file_set_mtime (CameraFile *file, time_t mtime);
int gp_file_get_mtime (CameraFile *file, time_t *mtime);
int gp_file_detect_mime_type (CameraFile *file);
int gp_file_adjust_name_for_mime_type (CameraFile *file);
int gp_file_get_name_by_type (CameraFile *file, const char *basename, CameraFileType type, char **newname);
int gp_file_set_data_and_size (CameraFile*, char *data,
unsigned long int size);
int gp_file_get_data_and_size (CameraFile*, const char **data,
unsigned long int *size);
/* "Do not use those"
*
* These functions probably were originally intended for internal use only.
* However, due to
* - the lack of good documentation
* - this being the obvious way to save a file
* - the fact that libgphoto2 has been exporting all its internal
* symbols for years (until 2005-06)
* - our in-house frontends gphoto2 and gtkam using them
* a number of external frontends started to use these functions, as
* of 2005-06:
* - digikam
* - f-spot
* - gthumb
* But a few frontends can live without it (and thus are likely to
* use the correct API):
* - flphoto
* - kamera
*
* So we're going to phase these functions out over the next year or
* so, going the GTK way of keeping the ABI but breaking the API. So
* we'll continue to export functionally equivalent functions, but the
* header files will not contain definitions for you to use any more.
*/
int gp_file_open (CameraFile *file, const char *filename);
int gp_file_save (CameraFile *file, const char *filename);
int gp_file_clean (CameraFile *file);
int gp_file_copy (CameraFile *destination, CameraFile *source);
/* These are for use by camera drivers only */
int gp_file_append (CameraFile*, const char *data,
unsigned long int size);
int gp_file_slurp (CameraFile*, char *data,
size_t size, size_t *readlen);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* !defined(LIBGPHOTO2_GPHOTO2_FILE_H) */

View file

@ -0,0 +1,387 @@
/** \file
* \brief Filesystem related operations and declarations.
*
* \author Copyright 2000 Scott Fritzinger
* \author Copyright 2008-2009 Marcus Meissner
*
* \note
* Contributions:
* Lutz Mueller <lutz@users.sf.net> (2001)
*
* \note
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* \note
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* \note
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef LIBGPHOTO2_GPHOTO2_FILESYS_H
#define LIBGPHOTO2_GPHOTO2_FILESYS_H
#include <time.h>
#include <stdint.h>
#include <gphoto2/gphoto2-context.h>
#include <gphoto2/gphoto2-list.h>
#include <gphoto2/gphoto2-file.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* \brief Bitmask on what fields are set in the CameraFileInfo structure.
*
* Bitmask to mark up which fields are set in the CameraFileInfo
* structure. The other fields might be uninitialized.
* If you set information via gp_camera_file_set_info() you
* need to set those flags. If you retrieve information via
* gp_camera_file_get_info() you need to check those flags.
* They are separate for both "normal" and "preview" parts
* and are mostly image related.
*/
typedef enum {
GP_FILE_INFO_NONE = 0, /**< \brief No fields set. */
GP_FILE_INFO_TYPE = 1 << 0, /**< \brief The MIME type is set. */
GP_FILE_INFO_SIZE = 1 << 2, /**< \brief The filesize is set. */
GP_FILE_INFO_WIDTH = 1 << 3, /**< \brief The width is set. */
GP_FILE_INFO_HEIGHT = 1 << 4, /**< \brief The height is set. */
GP_FILE_INFO_PERMISSIONS = 1 << 5, /**< \brief The access permissions are set. */
GP_FILE_INFO_STATUS = 1 << 6, /**< \brief The status is set (downloaded). */
GP_FILE_INFO_MTIME = 1 << 7, /**< \brief The modification time is set. */
GP_FILE_INFO_ALL = 0xFF /**< \brief All possible fields set. Internal. */
} CameraFileInfoFields;
/**
* \brief Bitmask containing the file permission flags.
*
* Possible flag values of the permission entry in the file information.
*/
typedef enum {
GP_FILE_PERM_NONE = 0, /**< \brief No permissions. */
GP_FILE_PERM_READ = 1 << 0, /**< \brief Read permissions. */
GP_FILE_PERM_DELETE = 1 << 1, /**< \brief Write permissions */
GP_FILE_PERM_ALL = 0xFF /**< \brief Internal. */
} CameraFilePermissions;
/**
* \brief Possible status values.
*
* Bitmask of possible stati. Currently only download is supported.
*/
typedef enum {
GP_FILE_STATUS_NOT_DOWNLOADED, /**< File is not downloaded. */
GP_FILE_STATUS_DOWNLOADED /**< File is already downloaded. */
} CameraFileStatus;
/**
* \brief File information of a regular file.
*
* Contains information a regular file with fields being
* set depending on the bitmask in the fields member.
*/
typedef struct _CameraFileInfoFile {
CameraFileInfoFields fields; /**< \brief Bitmask containing the set members. */
CameraFileStatus status; /**< \brief Status of the file. */
uint64_t size; /**< \brief Size of the file. */
char type[64]; /**< \brief MIME type of the file. */
uint32_t width; /**< \brief Height of the file. */
uint32_t height; /**< \brief Width of the file. */
CameraFilePermissions permissions;/**< \brief Permissions of the file. */
time_t mtime; /**< \brief Modification time of the file. */
} CameraFileInfoFile;
/**
* \brief File information of a preview file.
*
* Contains information of a preview file with fields being
* set depending on the bitmask in the fields member.
*/
typedef struct _CameraFileInfoPreview {
CameraFileInfoFields fields; /**< \brief Bitmask containing the set members. */
CameraFileStatus status; /**< \brief Status of the preview. */
uint64_t size; /**< \brief Size of the preview. */
char type[64]; /**< \brief MIME type of the preview. */
uint32_t width; /**< \brief Width of the preview. */
uint32_t height; /**< \brief Height of the preview. */
} CameraFileInfoPreview;
/**
* \brief File information of an audio file.
*
* Contains information of an audio file with fields being
* set depending on the bitmask in the fields member.
*/
typedef struct _CameraFileInfoAudio {
CameraFileInfoFields fields; /**< \brief Bitmask containing the set members. */
CameraFileStatus status; /**< \brief Status of the preview file. */
uint64_t size; /**< \brief Size of the audio file. */
char type[64]; /**< \brief MIME type of the audio file. */
} CameraFileInfoAudio;
/**
* \brief File information structure.
*
* Contains the normal, preview and audio file information structures
* for a specific file.
*/
typedef struct _CameraFileInfo {
CameraFileInfoPreview preview;
CameraFileInfoFile file;
CameraFileInfoAudio audio;
} CameraFileInfo;
/**
* \brief Storage information flags.
*
* Bitmask to specify which entries of the filesystem
* storage information is set.
*/
typedef enum {
GP_STORAGEINFO_BASE = (1<<0), /**< \brief The base directory.
* Usually / if just 1 storage is attached.
*/
GP_STORAGEINFO_LABEL = (1<<1), /**< \brief Label of the filesystem.
* Could also be a DOS label.
*/
GP_STORAGEINFO_DESCRIPTION = (1<<2), /**< \brief More verbose description. */
GP_STORAGEINFO_ACCESS = (1<<3), /**< \brief Access permissions. */
GP_STORAGEINFO_STORAGETYPE = (1<<4), /**< \brief Hardware type. */
GP_STORAGEINFO_FILESYSTEMTYPE = (1<<5), /**< \brief Filesystem type. */
GP_STORAGEINFO_MAXCAPACITY = (1<<6), /**< \brief Maximum capacity in kbytes */
GP_STORAGEINFO_FREESPACEKBYTES = (1<<7), /**< \brief Free space in kbytes. */
GP_STORAGEINFO_FREESPACEIMAGES = (1<<8) /**< \brief Free space in images. */
} CameraStorageInfoFields;
/**
* \brief Hardware storage types.
*
* Type of hardware this storage is on. The types and values
* are the same as the PTP standard uses (PTP_ST_xxx).
*/
typedef enum {
GP_STORAGEINFO_ST_UNKNOWN = 0, /**< \brief Unknown storage type. */
GP_STORAGEINFO_ST_FIXED_ROM = 1, /**< \brief A fixed ROM storage. */
GP_STORAGEINFO_ST_REMOVABLE_ROM = 2, /**< \brief A removable ROM storage. */
GP_STORAGEINFO_ST_FIXED_RAM = 3, /**< \brief A fixed RAM storage. (e.g. SDRAM) */
GP_STORAGEINFO_ST_REMOVABLE_RAM = 4 /**< \brief A removable RAM storage. (any kind of cards etc) */
} CameraStorageType;
/**
* \brief Storage access modes.
*
* The modes we can access the storage with. Uses the same
* types and values as the PTP standard (PTP_AC_xxx).
*/
typedef enum {
GP_STORAGEINFO_AC_READWRITE = 0, /**< \brief Storage is Read / Write. */
GP_STORAGEINFO_AC_READONLY = 1, /**< \brief Storage is Ready Only. */
GP_STORAGEINFO_AC_READONLY_WITH_DELETE = 2 /**< \brief Storage is Ready Only, but allows Delete.*/
} CameraStorageAccessType;
/**
* \brief Filesystem hierarchy types.
*
* The type of the filesystem hierarchy the devices uses.
* Same types and values as the PTP standard defines (PTP_FST_xxx).
*/
typedef enum {
GP_STORAGEINFO_FST_UNDEFINED = 0, /**< \brief Undefined or unknown filesystem hierarchy. */
GP_STORAGEINFO_FST_GENERICFLAT = 1, /**< \brief Generic flat storage (all in 1 directory). */
GP_STORAGEINFO_FST_GENERICHIERARCHICAL = 2, /**< \brief Generic tree hierarchy. */
GP_STORAGEINFO_FST_DCF = 3 /**< \brief DCIM style storage. */
} CameraStorageFilesystemType;
/**
* \brief Storage information structue.
*
* This structure contains the information of a specific camera storage.
* Only the members as specified by the \a fields member are valid.
*/
typedef struct _CameraStorageInformation {
CameraStorageInfoFields fields; /**< \brief Bitmask of struct members that are specified. */
char basedir[256]; /**< \brief Basedirectory of the storage. Will be "/" if just 1 storage on the camera. */
char label[256]; /**< \brief Label of the storage. Similar to DOS label. */
char description[256];/**< \brief Description of the storage. */
CameraStorageType type; /**< \brief Hardware type of the storage. */
CameraStorageFilesystemType fstype; /**< \brief Hierarchy type of the filesystem. */
CameraStorageAccessType access; /**< \brief Access permissions. */
uint64_t capacitykbytes; /**< \brief Total capacity in kbytes. */
uint64_t freekbytes; /**< \brief Free space in kbytes. */
uint64_t freeimages; /**< \brief Free space in images (guessed by camera). */
} CameraStorageInformation;
/**
* \brief Filesystem structure, only exposed to camera drivers.
*
* Internal structure, contents not exposed to frontends. Camera
* drivers get these passed to filesystem related functions and
* are supposed to use it only via the accessor functions.
*/
typedef struct _CameraFilesystem CameraFilesystem;
int gp_filesystem_new (CameraFilesystem **fs);
int gp_filesystem_free (CameraFilesystem *fs);
/* Manual editing */
int gp_filesystem_append (CameraFilesystem *fs, const char *folder,
const char *filename, GPContext *context);
int gp_filesystem_set_info_noop (CameraFilesystem *fs,
const char *folder, const char *filename,
CameraFileInfo info, GPContext *context);
int gp_filesystem_set_info_dirty (CameraFilesystem *fs,
const char *folder, const char *filename,
GPContext *context);
int gp_filesystem_set_file_noop (CameraFilesystem *fs,
const char *folder, const char *filename,
CameraFileType type,
CameraFile *file, GPContext *context);
int gp_filesystem_delete_file_noop (CameraFilesystem *fs, const char *folder,
const char *filename, GPContext *context);
int gp_filesystem_reset (CameraFilesystem *fs);
/* Information retrieval */
int gp_filesystem_count (CameraFilesystem *fs, const char *folder,
GPContext *context);
int gp_filesystem_name (CameraFilesystem *fs, const char *folder,
int filenumber, const char **filename,
GPContext *context);
int gp_filesystem_get_folder (CameraFilesystem *fs, const char *filename,
char **folder, GPContext *context);
int gp_filesystem_number (CameraFilesystem *fs, const char *folder,
const char *filename, GPContext *context);
/* Listings */
typedef int (*CameraFilesystemListFunc) (CameraFilesystem *fs,
const char *folder, CameraList *list,
void *data, GPContext *context);
int gp_filesystem_list_files (CameraFilesystem *fs, const char *folder,
CameraList *list, GPContext *context);
int gp_filesystem_list_folders (CameraFilesystem *fs, const char *folder,
CameraList *list, GPContext *context);
/* File information */
typedef int (*CameraFilesystemSetInfoFunc) (CameraFilesystem *fs,
const char *folder,
const char *filename,
CameraFileInfo info, void *data,
GPContext *context);
typedef int (*CameraFilesystemGetInfoFunc) (CameraFilesystem *fs,
const char *folder,
const char *filename,
CameraFileInfo *info, void *data,
GPContext *context);
int gp_filesystem_get_info (CameraFilesystem *fs, const char *folder,
const char *filename, CameraFileInfo *info,
GPContext *context);
int gp_filesystem_set_info (CameraFilesystem *fs, const char *folder,
const char *filename, CameraFileInfo info,
GPContext *context);
/* Files */
typedef int (*CameraFilesystemGetFileFunc) (CameraFilesystem *fs,
const char *folder,
const char *filename,
CameraFileType type,
CameraFile *file, void *data,
GPContext *context);
typedef int (*CameraFilesystemReadFileFunc) (CameraFilesystem *fs,
const char *folder,
const char *filename,
CameraFileType type,
uint64_t offset,
char *buf,
uint64_t *size,
void *data,
GPContext *context);
typedef int (*CameraFilesystemDeleteFileFunc) (CameraFilesystem *fs,
const char *folder,
const char *filename,
void *data, GPContext *context);
int gp_filesystem_get_file (CameraFilesystem *fs, const char *folder,
const char *filename, CameraFileType type,
CameraFile *file, GPContext *context);
int gp_filesystem_read_file (CameraFilesystem *fs, const char *folder,
const char *filename, CameraFileType type,
uint64_t offset, char *buf, uint64_t *size,
GPContext *context);
int gp_filesystem_delete_file (CameraFilesystem *fs, const char *folder,
const char *filename, GPContext *context);
/* Folders */
typedef int (*CameraFilesystemPutFileFunc) (CameraFilesystem *fs,
const char *folder,
const char *filename,
CameraFileType type,
CameraFile *file,
void *data,
GPContext *context);
typedef int (*CameraFilesystemDeleteAllFunc) (CameraFilesystem *fs,
const char *folder, void *data,
GPContext *context);
typedef int (*CameraFilesystemDirFunc) (CameraFilesystem *fs,
const char *folder,
const char *name, void *data,
GPContext *context);
typedef int (*CameraFilesystemStorageInfoFunc) (CameraFilesystem *fs,
CameraStorageInformation **,
int *nrofstorageinformations,
void *data, GPContext *context);
int gp_filesystem_get_storageinfo (CameraFilesystem *fs,
CameraStorageInformation **,
int *nrofstorageinformations,
GPContext *context);
typedef struct _CameraFilesystemFuncs CameraFilesystemFuncs;
struct _CameraFilesystemFuncs {
CameraFilesystemListFunc file_list_func;
CameraFilesystemListFunc folder_list_func;
CameraFilesystemPutFileFunc put_file_func;
CameraFilesystemDeleteAllFunc delete_all_func;
CameraFilesystemGetInfoFunc get_info_func;
CameraFilesystemSetInfoFunc set_info_func;
CameraFilesystemDirFunc make_dir_func;
CameraFilesystemDirFunc remove_dir_func;
CameraFilesystemGetFileFunc get_file_func;
CameraFilesystemReadFileFunc read_file_func;
CameraFilesystemDeleteFileFunc del_file_func;
CameraFilesystemStorageInfoFunc storage_info_func;
/* for later use. Remove one if you add a new function */
void *unused[31];
};
int gp_filesystem_set_funcs (CameraFilesystem *fs,
CameraFilesystemFuncs *funcs,
void *data);
int gp_filesystem_put_file (CameraFilesystem *fs, const char *folder, const char *filename,
CameraFileType type, CameraFile *file, GPContext *context);
int gp_filesystem_delete_all (CameraFilesystem *fs, const char *folder,
GPContext *context);
int gp_filesystem_make_dir (CameraFilesystem *fs, const char *folder,
const char *name, GPContext *context);
int gp_filesystem_remove_dir (CameraFilesystem *fs, const char *folder,
const char *name, GPContext *context);
/* For debugging */
int gp_filesystem_dump (CameraFilesystem *fs);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* !defined(LIBGPHOTO2_GPHOTO2_FILESYS_H) */

View file

@ -0,0 +1,80 @@
/** \file
* \brief Camery driver header.
*
* \author Copyright 2000 Scott Fritzinger
*
* \note
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* \note
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* \note
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef LIBGPHOTO2_GPHOTO2_LIBRARY_H
#define LIBGPHOTO2_GPHOTO2_LIBRARY_H
#include <gphoto2/gphoto2-abilities-list.h>
#include <gphoto2/gphoto2-camera.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* \brief Returns a unique id for the camera driver.
*
* \param id a #CameraText
* \return a gphoto2 error code
*
**/
typedef int (* CameraLibraryIdFunc) (CameraText *id);
/**
* \brief Adds the abilities of the supported models to the supplied list.
*
* \param list a #CameraAbilitiesList
* \return a gphoto2 error code
*
**/
typedef int (* CameraLibraryAbilitiesFunc) (CameraAbilitiesList *list);
/**
* \brief Initializes the camera.
*
* \param camera a #Camera
* \param context a #GPContext
* \return a gphoto2 error code
*
* The camera driver will establish a first connection
* to the camera and configure the camera variable (i.e. using
* #gp_filesystem_set_list_funcs or #gp_port_get_settings).
*
**/
typedef int (* CameraLibraryInitFunc) (Camera *camera, GPContext *context);
/*
* If you want to write a camera library, you need to implement
* the following three functions. Everything else should be declared
* as static.
*/
int camera_id (CameraText *id);
int camera_abilities (CameraAbilitiesList *list);
int camera_init (Camera *camera, GPContext *context);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* !defined(LIBGPHOTO2_GPHOTO2_LIBRARY_H) */

View file

@ -0,0 +1,93 @@
/** \file gphoto2-list.h
*
* Lists of files, folders, cameras, etc.
*
* \author Copyright 2001 Scott Fritzinger
*
* \note
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* \note
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* \note
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef LIBGPHOTO2_GPHOTO2_LIST_H
#define LIBGPHOTO2_GPHOTO2_LIST_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* \brief A generic list
*
* This structure provides a list with \a name:value pairs that is used in various
* parts of libgphoto2. Its details are internal, please use the
* gp_list_xxx accessor functions.
*
* Usage pattern for CameraList for users external of
* libgphoto2, such as libgphoto2 frontends:
*
* \code
* CameraList *list;
* gp_list_new (&list);
* init_list_somehow (list);
* for (i=0; i < gp_list_count(list); i++) {
* char *name, *value;
* gp_list_get_name (list, i, &name);
* gp_list_get_name (list, i, &value);
* do_something_with (name, value);
* }
* gp_list_free (list);
* \endcode
*
* Please do NOT directly instantiate a CameraList object like this:
* \code
* CameraList foo; // DO NOT DO THIS
* \endcode
*
* Please do NOT directly access the structure members like this:
* \code
* list->entry[i].name // DO NOT DO THIS
* \endcode
*/
typedef struct _CameraList CameraList;
int gp_list_new (CameraList **list);
int gp_list_ref (CameraList *list);
int gp_list_unref (CameraList *list);
int gp_list_free (CameraList *list);
int gp_list_count (CameraList *list);
int gp_list_append (CameraList *list,
const char *name, const char *value);
int gp_list_reset (CameraList *list);
int gp_list_sort (CameraList *list);
int gp_list_find_by_name (CameraList *list, int *index, const char *name);
int gp_list_get_name (CameraList *list, int index, const char **name);
int gp_list_get_value (CameraList *list, int index, const char **value);
int gp_list_set_name (CameraList *list, int index, const char *name);
int gp_list_set_value (CameraList *list, int index, const char *value);
int gp_list_populate (CameraList *list, const char *format, int count);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* !defined(LIBGPHOTO2_GPHOTO2_LIST_H) */

View file

@ -0,0 +1,116 @@
/** \file
*
* \author Copyright 2001 Lutz Mueller <lutz@users.sf.net>
*
* \par License
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* \par
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* \par
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef LIBGPHOTO2_GPHOTO2_PORT_INFO_LIST_H
#define LIBGPHOTO2_GPHOTO2_PORT_INFO_LIST_H
/**
* \brief The gphoto port type.
*
* Enumeration specifying the port type.
* The enum is providing bitmasks, but most code uses it as
* just the one specific values.
*/
typedef enum {
GP_PORT_NONE = 0, /**< \brief No specific type associated. */
GP_PORT_SERIAL = 1 << 0, /**< \brief Serial port. */
GP_PORT_USB = 1 << 2, /**< \brief USB port. */
GP_PORT_DISK = 1 << 3, /**< \brief Disk / local mountpoint port. */
GP_PORT_PTPIP = 1 << 4, /**< \brief PTP/IP port. */
GP_PORT_USB_DISK_DIRECT = 1 << 5, /**< \brief Direct IO to an usb mass storage device. */
GP_PORT_USB_SCSI = 1 << 6, /**< \brief USB Mass Storage raw SCSI port. */
GP_PORT_IP = 1 << 7 /**< \brief generic IP address port. */
} GPPortType;
/**
* \brief Information about the current port.
*
* Specific information about the current port. Usually taken from the
* "--port=XXXX" setting from the frontend.
*
* This is not to be confused with the driver configurable port settings
* in \ref GPPortSettings.
*/
struct _GPPortInfo;
typedef struct _GPPortInfo *GPPortInfo;
#include <gphoto2/gphoto2-port.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#ifdef _GPHOTO2_INTERNAL_CODE
#include <gphoto2/gphoto2-port-log.h>
extern const StringFlagItem gpi_gphoto_port_type_map[];
#endif
int gp_port_info_new (GPPortInfo *info);
int gp_port_info_get_name (GPPortInfo info, char **name);
int gp_port_info_set_name (GPPortInfo info, const char *name);
int gp_port_info_get_path (GPPortInfo info, char **path);
int gp_port_info_set_path (GPPortInfo info, const char *path);
int gp_port_info_get_type (GPPortInfo info, GPPortType *type);
int gp_port_info_set_type (GPPortInfo info, const GPPortType type);
int gp_port_info_get_library_filename (GPPortInfo info, char **lib);
int gp_port_info_set_library_filename (GPPortInfo info, char *lib);
/* Internals are private */
typedef struct _GPPortInfoList GPPortInfoList;
int gp_port_info_list_new (GPPortInfoList **list);
int gp_port_info_list_free (GPPortInfoList *list);
int gp_port_info_list_append (GPPortInfoList *list, GPPortInfo info);
int gp_port_info_list_load (GPPortInfoList *list);
int gp_port_info_list_count (GPPortInfoList *list);
int gp_port_info_list_lookup_path (GPPortInfoList *list, const char *path);
int gp_port_info_list_lookup_name (GPPortInfoList *list, const char *name);
int gp_port_info_list_get_info (GPPortInfoList *list, int n, GPPortInfo *info);
const char *gp_port_message_codeset (const char*);
int gp_port_init_localedir (const char *localedir);
/**
* Name of the environment variable which may contain the path where
* to look for the IO libs. If this environment variable is not defined,
* use the compiled-in default constant.
*
* \internal Internal use only.
*/
#ifdef _GPHOTO2_INTERNAL_CODE
#define IOLIBDIR_ENV "IOLIBS"
#endif /* _GPHOTO2_INTERNAL_CODE */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* !defined(LIBGPHOTO2_GPHOTO2_PORT_INFO_LIST_H) */

View file

@ -0,0 +1,103 @@
/** \file gphoto2-port-library.h
*
* \author Copyright 2001 Lutz Mueller <lutz@users.sf.net>
*
* \par License
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* \par
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* \par
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef LIBGPHOTO2_GPHOTO2_PORT_LIBRARY_H
#define LIBGPHOTO2_GPHOTO2_PORT_LIBRARY_H
#include <gphoto2/gphoto2-port-info-list.h>
#include <gphoto2/gphoto2-port.h>
/**
* \brief The port operations
*
* These operations are to be implemented and set by the port library,
* which drives the lowlevel protocol (serial, usb, etc.).
*
* They are acessed using the accessor functions, like gp_port_open(),
* gp_port_read() and gp_port_write().
*/
typedef struct _GPPortOperations {
int (*init) (GPPort *);
int (*exit) (GPPort *);
int (*open) (GPPort *);
int (*close) (GPPort *);
int (*read) (GPPort *, char *, int);
int (*check_int)(GPPort *, char *, int, int);
int (*write) (GPPort *, const char *, int);
int (*update) (GPPort *);
/* Pointers to devices. Please note these are stubbed so there is
no need to #ifdef GP_PORT_* anymore. */
/* for serial devices */
int (*get_pin) (GPPort *, GPPin, GPLevel*);
int (*set_pin) (GPPort *, GPPin, GPLevel);
int (*send_break)(GPPort *, int);
int (*flush) (GPPort *, int);
/* for USB devices */
int (*find_device)(GPPort * dev, int idvendor, int idproduct);
int (*find_device_by_class)(GPPort * dev, int class, int subclass, int protocol);
int (*clear_halt) (GPPort * dev, int ep);
int (*msg_write) (GPPort * dev, int request, int value, int index,
char *bytes, int size);
int (*msg_read) (GPPort * dev, int request, int value, int index,
char *bytes, int size);
int (*msg_interface_write) (GPPort * dev, int request,
int value, int index, char *bytes, int size);
int (*msg_interface_read) (GPPort * dev, int request,
int value, int index, char *bytes, int size);
int (*msg_class_write) (GPPort * dev, int request,
int value, int index, char *bytes, int size);
int (*msg_class_read) (GPPort * dev, int request,
int value, int index, char *bytes, int size);
/* For USB disk direct IO devices */
int (*seek) (GPPort * dev, int offset, int whence);
/* For USB Mass Storage raw SCSI ports */
int (*send_scsi_cmd) (GPPort *port, int to_dev,
char *cmd, int cmd_size,
char *sense, int sense_size,
char *data, int data_size);
int (*reset) (GPPort *);
} GPPortOperations;
typedef GPPortType (* GPPortLibraryType) (void);
typedef int (* GPPortLibraryList) (GPPortInfoList *list);
typedef GPPortOperations *(* GPPortLibraryOperations) (void);
/*
* If you want to write an io library, you need to implement the following
* functions. Everything else in your io library should be declared static.
*/
GPPortType gp_port_library_type (void);
int gp_port_library_list (GPPortInfoList *list);
GPPortOperations *gp_port_library_operations (void);
#endif /* !defined(LIBGPHOTO2_GPHOTO2_PORT_LIBRARY_H) */

View file

@ -0,0 +1,247 @@
/** \file gphoto2-port-log.h
*
* Copyright 2001 Lutz Mueller <lutz@users.sf.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef LIBGPHOTO2_GPHOTO2_PORT_LOG_H
#define LIBGPHOTO2_GPHOTO2_PORT_LOG_H
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* \brief Logging level
* Specifies the logging severity level.
*/
typedef enum {
GP_LOG_ERROR = 0, /**< \brief Log message is an error information. */
GP_LOG_VERBOSE = 1, /**< \brief Log message is an verbose debug information. */
GP_LOG_DEBUG = 2, /**< \brief Log message is an debug information. */
GP_LOG_DATA = 3 /**< \brief Log message is a data hex dump. */
} GPLogLevel;
/**
* GP_LOG_ALL:
*
* Used by frontends if they want to be sure their
* callback function receives all messages. Defined
* as the highest debug level. Can make frontend code
* more understandable and extension of log levels
* easier.
**/
#define GP_LOG_ALL GP_LOG_DATA
/**
* \brief Logging function hook
*
* This is the function frontends can use to receive logging information
* from the libgphoto2 framework. It is set using gp_log_add_func() and
* removed using gp_log_remove_func() and will then receive the logging
* messages of the level specified.
*
* \param level the log level of the passed message, as set by the camera driver or libgphoto2
* \param domain the logging domain as set by the camera driver, or libgphoto2 function
* \param str the logmessage, without linefeed
* \param data the caller private data that was passed to gp_log_add_func()
*/
typedef void (* GPLogFunc) (GPLogLevel level, const char *domain, const char *str, void *data);
#ifndef DISABLE_DEBUGGING
int gp_log_add_func (GPLogLevel level, GPLogFunc func, void *data);
int gp_log_remove_func (int id);
/* Logging */
void gp_log (GPLogLevel level, const char *domain,
const char *format, ...)
#ifdef __GNUC__
__attribute__((__format__(printf,3,4)))
#endif
;
void gp_log_with_source_location(
GPLogLevel level, const char *file, int line, const char *func,
const char *format, ...)
#ifdef __GNUC__
__attribute__((__format__(printf,5,6)))
#endif
;
void gp_logv (GPLogLevel level, const char *domain, const char *format,
va_list args)
#ifdef __GNUC__
__attribute__((__format__(printf,3,0)))
#endif
;
void gp_log_data (const char *domain, const char *data, unsigned int size,
const char *format, ...)
#ifdef __GNUC__
__attribute__((__format__(printf,4,5)))
#endif
;
/*
* GP_DEBUG:
* msg: message to log
* params: params to message
*
* Logs message at log level #GP_LOG_DEBUG by calling #gp_log() with
* an automatically generated domain
* You have to define GP_MODULE as "mymod" for your module
* mymod before using #GP_DEBUG().
*/
#ifdef _GPHOTO2_INTERNAL_CODE
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || _MSC_VER
#define GP_DEBUG(...) \
gp_log(GP_LOG_DEBUG, GP_MODULE "/" __FILE__, __VA_ARGS__)
/*
* GP_LOG_D/E:
* simple helper macros for convenient and consistent logging of error
* and debug messages including information about the source location.
*/
#define GP_LOG_D(...) gp_log(GP_LOG_DEBUG, __func__, __VA_ARGS__)
#define GP_LOG_E(...) gp_log_with_source_location(GP_LOG_ERROR, __FILE__, __LINE__, __func__, __VA_ARGS__)
#define GP_LOG_DATA(DATA, SIZE, MSG, ...) gp_log_data(__func__, DATA, SIZE, MSG, ##__VA_ARGS__)
#elif defined(__GNUC__) && __GNUC__ >= 2
#define GP_DEBUG(msg, params...) \
gp_log(GP_LOG_DEBUG, GP_MODULE "/" __FILE__, msg, ##params)
/*
* GP_LOG_D/E:
* simple helper macros for convenient and consistent logging of error
* and debug messages including information about the source location.
*/
#define GP_LOG_D(...) gp_log(GP_LOG_DEBUG, __func__, __VA_ARGS__)
#define GP_LOG_E(...) gp_log_with_source_location(GP_LOG_ERROR, __FILE__, __LINE__, __func__, __VA_ARGS__)
#define GP_LOG_DATA(DATA, SIZE, MSG, ...) gp_log_data(__func__, DATA, SIZE, MSG, ##__VA_ARGS__)
#else
# ifdef __GNUC__
# warning Disabling GP_DEBUG because variadic macros are not allowed
# endif
#define GP_DEBUG (void)
#define GP_LOG_D(...) /* no-op */
#define GP_LOG_E(...) /* no-op */
#define GP_LOG_DATA(DATA, SIZE, ...) /* no-op */
#endif
#endif /* _GPHOTO2_INTERNAL_CODE */
#else /* DISABLE_DEBUGGING */
/* Stub these functions out if debugging is disabled */
#define gp_log_add_func(level, func, data) (0)
#define gp_log_remove_func(id) (0)
#define gp_log(level, domain, format, args...) /**/
#define gp_log_with_source_location(level, file, line, func, format, ...)
#define gp_logv(level, domain, format, args) /**/
#define gp_log_data(domain, data, size) /**/
#ifdef _GPHOTO2_INTERNAL_CODE
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define GP_DEBUG(...) /* no-op */
#define GP_LOG_D(...) /* no-op */
#define GP_LOG_E(...) /* no-op */
#define GP_LOG_DATA(DATA, SIZE, ...) /* no-op */
#elif defined(__GNUC__)
#define GP_DEBUG(msg, params...) /* no-op */
#define GP_LOG_D(...) /* no-op */
#define GP_LOG_E(...) /* no-op */
#define GP_LOG_DATA(DATA, SIZE, ...) /* no-op */
#else
#define GP_DEBUG (void)
#define GP_LOG_D (void /* no-op */
#define GP_LOG_E (void) /* no-op */
#define GP_LOG_DATA(void) /* no-op */
#endif
#endif /* _GPHOTO2_INTERNAL_CODE */
#endif /* DISABLE_DEBUGGING */
#ifdef _GPHOTO2_INTERNAL_CODE
typedef struct StringFlagItem {
char *str;
unsigned int flag;
} StringFlagItem;
typedef void (*string_item_func) (const char *str, void *data);
const char *
gpi_enum_to_string(const unsigned int _enum,
const StringFlagItem *map);
int
gpi_string_to_enum(const char *str,
unsigned int *result,
const StringFlagItem *map);
void
gpi_flags_to_string_list(const unsigned int flags,
const StringFlagItem *map,
string_item_func func, void *data);
int
gpi_string_or_to_flags(const char *str,
unsigned int *flags,
const StringFlagItem *map);
unsigned int
gpi_string_to_flag(const char *str,
const StringFlagItem *map);
unsigned int
gpi_string_list_to_flags(const char *str[],
const StringFlagItem *map);
/* Allocates a sufficiently large buffer and interpolates the format
* string with the proveded va_list args. The returned memory has to
* be freed by the caller. */
char*
gpi_vsnprintf (const char* format, va_list args);
#define C_MEM(MEM) do {\
if ((MEM) == NULL) {\
GP_LOG_E ("Out of memory: '%s' failed.", #MEM);\
return GP_ERROR_NO_MEMORY;\
}\
} while(0)
#define C_PARAMS(PARAMS) do {\
if (!(PARAMS)) {\
GP_LOG_E ("Invalid parameters: '%s' is NULL/FALSE.", #PARAMS);\
return GP_ERROR_BAD_PARAMETERS;\
}\
} while(0)
#define C_PARAMS_MSG(PARAMS, MSG, ...) do {\
if (!(PARAMS)) {\
GP_LOG_E ("Invalid parameters: " #MSG " ('%s' is NULL/FALSE.)", ##__VA_ARGS__, #PARAMS);\
return GP_ERROR_BAD_PARAMETERS;\
}\
} while(0)
#endif /* _GPHOTO2_INTERNAL_CODE */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* !defined(LIBGPHOTO2_GPHOTO2_PORT_LOG_H) */

View file

@ -0,0 +1,149 @@
/** \file gphoto2-port-log.h
*
* Copyright 2001 Lutz Mueller <lutz@users.sf.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef LIBGPHOTO2_GPHOTO2_PORT_PORTABILITY_H
#define LIBGPHOTO2_GPHOTO2_PORT_PORTABILITY_H
#ifdef _GPHOTO2_INTERNAL_CODE
#if defined(WIN32) && !defined(__WINESRC__)
/************************************************************************
* Begin Windows definitions (but not during WINE compilation)
************************************************************************/
# include <windows.h>
/* done by mingw/wine headers ... defined to struct ... tsaes*/
#undef interface
# include <sys/types.h>
# include <sys/stat.h>
# include <string.h>
# include <stdio.h>
# include <direct.h>
# ifndef IOLIBS
# define IOLIBS "."
# endif
# define strcasecmp _stricmp
# ifndef snprintf
# define snprintf _snprintf
# endif
#define __func__ __FUNCTION__
#ifndef _SSIZE_T_DEFINED
typedef SSIZE_T ssize_t;
#endif
/* Work-around for readdir() */
typedef struct {
HANDLE handle;
int got_first;
WIN32_FIND_DATA search;
char dir[1024];
char drive[32][2];
int drive_count;
int drive_index;
} GPPORTWINDIR;
/* Directory-oriented functions */
# define gp_system_dir GPPORTWINDIR *
# define gp_system_dirent WIN32_FIND_DATA *
# define gp_system_dir_delim '\\'
# define sleep(x) usleep((x) * 1000 * 1000)
/************************************************************************
* End WIN32 definitions
************************************************************************/
#else
/************************************************************************
* Begin POSIX/XOPEN definitions
************************************************************************/
/* yummy. :) */
/* XOPEN needed for usleep */
#ifndef _XOPEN_SOURCE
# define _XOPEN_SOURCE 500
#else
# if ((_XOPEN_SOURCE - 0) < 500)
# undef _XOPEN_SOURCE
# define _XOPEN_SOURCE 500
# endif
#endif
/* for nanosleep */
# ifndef _POSIX_C_SOURCE
# define _POSIX_C_SOURCE 199309
# endif
# include <time.h>
# include <strings.h>
# include <sys/types.h>
# include <dirent.h>
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
# include <sys/stat.h>
# include <unistd.h>
/* Directory-oriented functions */
/** A system directory handle */
# define gp_system_dir DIR *
/** A system directory entry */
# define gp_system_dirent struct dirent *
/** The directory delimiter character on this platform. */
# define gp_system_dir_delim '/'
/************************************************************************
* End POSIX/XOPEN definitions
************************************************************************/
#endif /* else */
/************************************************************************
* Begin platform independent portability functions
************************************************************************/
int gp_system_mkdir (const char *dirname);
int gp_system_rmdir (const char *dirname);
gp_system_dir gp_system_opendir (const char *dirname);
gp_system_dirent gp_system_readdir (gp_system_dir d);
const char* gp_system_filename (gp_system_dirent de);
int gp_system_closedir (gp_system_dir dir);
int gp_system_is_file (const char *filename);
int gp_system_is_dir (const char *dirname);
/************************************************************************
* End platform independent portability functions
************************************************************************/
#endif /* _GPHOTO2_INTERNAL_CODE */
#endif /* !defined(LIBGPHOTO2_GPHOTO2_PORT_PORTABILITY_H) */
/* end of file */

View file

@ -0,0 +1,133 @@
/** \file gphoto2-port-result.h
*
* Copyright 2001 Lutz Mueller <lutz@users.sf.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef LIBGPHOTO2_GPHOTO2_PORT_RESULT_H
#define LIBGPHOTO2_GPHOTO2_PORT_RESULT_H
/* Return values. gphoto2-port should only return values from 0 to -99 */
/**
* \brief Everything is OK
*
* Note that this is also the value 0, and every error is negative (lower).
*/
#define GP_OK 0
/**
* \brief Generic Error
*/
#define GP_ERROR -1
/**
* \brief Bad parameters passed
*/
#define GP_ERROR_BAD_PARAMETERS -2
/**
* \brief Out of memory
*/
#define GP_ERROR_NO_MEMORY -3
/**
* \brief Error in the camera driver
*/
#define GP_ERROR_LIBRARY -4
/**
* \brief Unknown libgphoto2 port passed
*/
#define GP_ERROR_UNKNOWN_PORT -5
/**
* \brief Functionality not supported
*/
#define GP_ERROR_NOT_SUPPORTED -6
/**
* \brief Generic I/O error
*/
#define GP_ERROR_IO -7
/**
* \brief Buffer overflow of internal structure
*/
#define GP_ERROR_FIXED_LIMIT_EXCEEDED -8
/**
* \brief Operation timed out
*/
#define GP_ERROR_TIMEOUT -10
/**
* \brief Serial ports not supported
*/
#define GP_ERROR_IO_SUPPORTED_SERIAL -20
/**
* \brief USB ports not supported
*/
#define GP_ERROR_IO_SUPPORTED_USB -21
/**
* \brief Error initializing I/O
*/
#define GP_ERROR_IO_INIT -31
/**
* \brief I/O during read
*/
#define GP_ERROR_IO_READ -34
/**
* \brief I/O during write
*/
#define GP_ERROR_IO_WRITE -35
/**
* \brief I/O during update of settings
*/
#define GP_ERROR_IO_UPDATE -37
/**
* \brief Specified serial speed not possible.
*/
#define GP_ERROR_IO_SERIAL_SPEED -41
/**
* \brief Error during USB Clear HALT
*/
#define GP_ERROR_IO_USB_CLEAR_HALT -51
/**
* \brief Error when trying to find USB device
*/
#define GP_ERROR_IO_USB_FIND -52
/**
* \brief Error when trying to claim the USB device
*/
#define GP_ERROR_IO_USB_CLAIM -53
/**
* \brief Error when trying to lock the device
*/
#define GP_ERROR_IO_LOCK -60
/**
* \brief Unspecified error when talking to HAL
*/
#define GP_ERROR_HAL -70
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
const char *gp_port_result_as_string (int result);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* !defined(LIBGPHOTO2_GPHOTO2_PORT_RESULT_H) */

View file

@ -0,0 +1,48 @@
/** \file gphoto2-port-version.h
*
* Copyright 2002 Hans Ulrich Niedermann <gp@n-dimensional.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef LIBGPHOTO2_GPHOTO2_PORT_VERSION_H
#define LIBGPHOTO2_GPHOTO2_PORT_VERSION_H
typedef enum {
GP_VERSION_SHORT = 0,
GP_VERSION_VERBOSE = 1
} GPVersionVerbosity;
#ifdef __cplusplus
extern "C" {
#endif
typedef const char **(*GPVersionFunc)(GPVersionVerbosity verbose);
const char **gp_port_library_version(GPVersionVerbosity verbose);
#ifdef __cplusplus
}
#endif
#endif /* !defined(LIBGPHOTO2_GPHOTO2_PORT_VERSION_H) */
/*
* Local Variables:
* c-file-style:"linux"
* indent-tabs-mode:t
* End:
*/

View file

@ -0,0 +1,256 @@
/** \file
*
* \author Copyright 2001 Lutz Mueller <lutz@users.sf.net>
*
* \par License
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* \par
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* \par
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef LIBGPHOTO2_GPHOTO2_PORT_H
#define LIBGPHOTO2_GPHOTO2_PORT_H
#include <gphoto2/gphoto2-port-info-list.h>
/* For portability */
#include <gphoto2/gphoto2-port-portability.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#ifndef TRUE
#define TRUE (0==0)
#endif
#ifndef FALSE
#define FALSE (1==0)
#endif
/**
* \brief Serial parity
*
* Parity of the serial port.
*/
typedef enum _GPPortSerialParity
{
GP_PORT_SERIAL_PARITY_OFF = 0, /**< \brief Parity is off (disabled) */
GP_PORT_SERIAL_PARITY_EVEN, /**< \brief Parity is even. */
GP_PORT_SERIAL_PARITY_ODD /**< \brief Parity is odd. */
} GPPortSerialParity;
/** \brief Maximum length of receive buffer */
#define GP_PORT_MAX_BUF_LEN 4096
/**
* \brief Port settings for serial ports.
*/
typedef struct _GPPortSettingsSerial {
char port[128]; /**< The portname (/dev/ttyX)*/
int speed; /**< The baudrate of the device. */
int bits; /**< How many bits data. */
GPPortSerialParity parity; /**< parity data, see GP_PORT_SERIAL_PARITY_
defines */
int stopbits; /**< How many stop bits are used. */
} GPPortSettingsSerial;
/**
* \brief Port settings for USB ports.
*/
#ifdef interface
#undef interface
#define _RESTORE_INTERFACE
#endif
typedef struct _GPPortSettingsUSB {
int inep; /**< \brief Bulk IN endpoint used. */
int outep; /**< \brief Bulk OUT endpoint used. */
int intep; /**< \brief Interrupt endpoint used. */
int config; /**< \brief USB bConfigurationValue used. */
int interface; /**< \brief USB Interface number used. */
int altsetting; /**< \brief USB Alternative Setting used. */
int maxpacketsize; /**< \brief Maximum USB packetsize of the IN endpoint. (r/o) */
/* must be last to avoid binary incompatibility.
* luckily we just need to make sure this struct does not
* get larger than _GPPortSettingsSerial. */
char port[64]; /**< \brief USB Portname. Specific to lowlevel USB. */
} GPPortSettingsUSB;
#ifdef _RESTORE_INTERFACE
#define interface __STRUCT__
#undef _RESTORE_INTERFACE
#endif
/**
* \brief Port settings for USB mass storage direct IO ports.
*/
typedef struct _GPPortSettingsUsbDiskDirect {
char path[128]; /**< /brief The ports device node path (/dev/sdX)*/
} GPPortSettingsUsbDiskDirect;
/**
* \brief Port settings for USB Mass Storage raw SCSI ports.
*/
typedef struct _GPPortSettingsUsbScsi {
char path[128]; /**< /brief The ports device node path (/dev/sg#)*/
} GPPortSettingsUsbScsi;
/**
* \brief Union of port settings.
*
* This contains a shared union of possible settings for ports needing
* them.
*/
typedef union _GPPortSettings {
GPPortSettingsSerial serial; /**< \brief Serial specific settings */
GPPortSettingsUSB usb; /**< \brief USB specific settings */
GPPortSettingsUsbDiskDirect usbdiskdirect; /**< \brief usb disk direct port specific settings */
GPPortSettingsUsbScsi usbscsi; /**< \brief usb scsi port specific settings */
} GPPortSettings;
enum {
GP_PORT_USB_ENDPOINT_IN, /**< \brief USB bulk IN ep */
GP_PORT_USB_ENDPOINT_OUT, /**< \brief USB bulk OUT ep */
GP_PORT_USB_ENDPOINT_INT /**< \brief USB Interrupt ep */
};
typedef struct _GPPortPrivateLibrary GPPortPrivateLibrary;
typedef struct _GPPortPrivateCore GPPortPrivateCore;
/**
* \brief The GPhoto port structure.
*
* This structure tracks the physical connection of the device.
* It can correspond the various methods of lowlevel access, serial
* usb and others and abstracts them as much as possible.
*
* Frontends should consider this structure opaque and only use accessor
* functions.
*
* Camera drivers should only access the type and pl members directly,
* and use accessor functions for the rest.
*/
typedef struct _GPPort {
/* For your convenience */
GPPortType type; /**< \brief Actual type of this port */
GPPortSettings settings; /**< \brief Current port settings. */
GPPortSettings settings_pending;/**< \brief Settings to be committed. */
int timeout; /**< \brief Port timeout in milliseconds. */
GPPortPrivateLibrary *pl; /**< \brief Camera driver private data pointer. */
GPPortPrivateCore *pc; /**< \brief Port library private data pointer. */
} GPPort;
int gp_port_new (GPPort **port);
int gp_port_free (GPPort *port);
int gp_port_set_info (GPPort *port, GPPortInfo info);
int gp_port_get_info (GPPort *port, GPPortInfo *info);
int gp_port_open (GPPort *port);
int gp_port_close (GPPort *port);
int gp_port_reset (GPPort *port);
int gp_port_write (GPPort *port, const char *data, int size);
int gp_port_read (GPPort *port, char *data, int size);
int gp_port_check_int (GPPort *port, char *data, int size);
int gp_port_check_int_fast (GPPort *port, char *data, int size);
int gp_port_get_timeout (GPPort *port, int *timeout);
int gp_port_set_timeout (GPPort *port, int timeout);
int gp_port_set_settings (GPPort *port, GPPortSettings settings);
int gp_port_get_settings (GPPort *port, GPPortSettings *settings);
/**
* \brief Serial pins.
*
* A number of serial pins to trigger and pull. This is necessary
* for some devices that have more than just the regular 3 or 4 wires.
*/
typedef enum _GPPin {
GP_PIN_RTS, /**< \brief RTS line */
GP_PIN_DTR, /**< \brief DTR line */
GP_PIN_CTS, /**< \brief CTS line */
GP_PIN_DSR, /**< \brief DSR line */
GP_PIN_CD, /**< \brief Carrier Detect line */
GP_PIN_RING /**< \brief RING (Modem) line */
} GPPin;
/**
* \brief Level to pull specific lines.
*
* The level on which to pull some of the serial lines.
*/
typedef enum _GPLevel {
GP_LEVEL_LOW = 0, /**< \brief Pull to low (0V) */
GP_LEVEL_HIGH = 1 /**< \brief Pull to high (nV) */
} GPLevel;
int gp_port_get_pin (GPPort *port, GPPin pin, GPLevel *level);
int gp_port_set_pin (GPPort *port, GPPin pin, GPLevel level);
int gp_port_send_break (GPPort *port, int duration);
int gp_port_flush (GPPort *port, int direction);
int gp_port_usb_find_device (GPPort *port, int idvendor, int idproduct);
int gp_port_usb_find_device_by_class (GPPort *port, int mainclass, int subclass, int protocol);
int gp_port_usb_clear_halt (GPPort *port, int ep);
int gp_port_usb_msg_write (GPPort *port, int request, int value,
int index, char *bytes, int size);
int gp_port_usb_msg_read (GPPort *port, int request, int value,
int index, char *bytes, int size);
int gp_port_usb_msg_interface_write (GPPort *port, int request,
int value, int index, char *bytes, int size);
int gp_port_usb_msg_interface_read (GPPort *port, int request,
int value, int index, char *bytes, int size);
int gp_port_usb_msg_class_write (GPPort *port, int request,
int value, int index, char *bytes, int size);
int gp_port_usb_msg_class_read (GPPort *port, int request,
int value, int index, char *bytes, int size);
int gp_port_seek (GPPort *port, int offset, int whence);
int gp_port_send_scsi_cmd (GPPort *port, int to_dev,
char *cmd, int cmd_size,
char *sense, int sense_size,
char *data, int data_size);
/* Error reporting */
int gp_port_set_error (GPPort *port, const char *format, ...)
#ifdef __GNUC__
__attribute__((__format__(printf,2,3)))
#endif
;
const char *gp_port_get_error (GPPort *port);
/* DEPRECATED */
/** \deprecated internal typedef */
typedef GPPort gp_port;
/** \deprecated internal typedef */
typedef GPPortSettings gp_port_settings;
/** \deprecated internal define */
#define PIN_CTS GP_PIN_CTS
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* !defined(LIBGPHOTO2_GPHOTO2_PORT_H) */

View file

@ -0,0 +1,141 @@
/** \file
*
* \author Copyright 2000 Scott Fritzinger
*
* \note
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* \note
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* \note
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef LIBGPHOTO2_GPHOTO2_RESULT_H
#define LIBGPHOTO2_GPHOTO2_RESULT_H
/* Additional error codes are defined here */
#include <gphoto2/gphoto2-port-result.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* \brief Corrupted data received
*
* Data is corrupt. This error is reported by camera drivers if corrupted
* data has been received that can not be automatically handled. Normally,
* drivers will do everything possible to automatically recover from this
* error.
**/
#define GP_ERROR_CORRUPTED_DATA -102 /* Corrupted data */
/**
* \brief File already exists
*
* An operation failed because a file existed. This error is reported for
* example when the user tries to create a file that already exists.
**/
#define GP_ERROR_FILE_EXISTS -103
/**
* \brief Specified camera model was not found
*
* The specified model could not be found. This error is reported when
* the user specified a model that does not seem to be supported by
* any driver.
**/
#define GP_ERROR_MODEL_NOT_FOUND -105
/**
* \brief Specified directory was not found
*
* The specified directory could not be found. This error is reported when
* the user specified a directory that is non-existent.
**/
#define GP_ERROR_DIRECTORY_NOT_FOUND -107
/**
* \brief Specified file was not found
*
* The specified file could not be found. This error is reported when
* the user wants to access a file that is non-existent.
**/
#define GP_ERROR_FILE_NOT_FOUND -108
/**
* \brief Specified directory already exists
*
* The specified directory already exists. This error is reported for example
* when the user wants to create a directory that already exists.
**/
#define GP_ERROR_DIRECTORY_EXISTS -109
/**
* \brief The camera is already busy
*
* Camera I/O or a command is in progress.
**/
#define GP_ERROR_CAMERA_BUSY -110
/**
* \brief Path is not absolute
*
* The specified path is not absolute. This error is reported when the user
* specifies paths that are not absolute, i.e. paths like "path/to/directory".
* As a rule of thumb, in gphoto2, there is nothing like relative paths.
**/
#define GP_ERROR_PATH_NOT_ABSOLUTE -111
/**
* \brief Cancellation successful.
*
* A cancellation requestion by the frontend via progress callback and
* GP_CONTEXT_FEEDBACK_CANCEL was successful and the transfer has been aborted.
*/
#define GP_ERROR_CANCEL -112
/**
* \brief Unspecified camera error
*
* The camera reported some kind of error. This can be either a
* photographic error, such as failure to autofocus, underexposure, or
* violating storage permission, anything else that stops the camera
* from performing the operation.
*/
#define GP_ERROR_CAMERA_ERROR -113
/**
* \brief Unspecified failure of the operating system
*
* There was some sort of OS error in communicating with the camera,
* e.g. lack of permission for an operation.
*/
#define GP_ERROR_OS_FAILURE -114
/**
* \brief Not enough space
*
* There was not enough free space when uploading a file.
*/
#define GP_ERROR_NO_SPACE -115
const char *gp_result_as_string (int result);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* !defined(LIBGPHOTO2_GPHOTO2_RESULT_H) */

View file

@ -0,0 +1,38 @@
/** \file
*
* \author Copyright 2000 Scott Fritzinger
*
* \note
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* \note
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* \note
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef LIBGPHOTO2_GPHOTO2_SETTING_H
#define LIBGPHOTO2_GPHOTO2_SETTING_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
int gp_setting_set (char *id, char *key, char *value);
int gp_setting_get (char *id, char *key, char *value);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* !defined(LIBGPHOTO2_GPHOTO2_SETTING_H) */

View file

@ -0,0 +1,39 @@
/** \file
*
* \author Copyright 2002 Hans Ulrich Niedermann <gp@n-dimensional.de>
*
* \note
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* \note
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* \note
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef LIBGPHOTO2_GPHOTO2_VERSION_H
#define LIBGPHOTO2_GPHOTO2_VERSION_H
#include <gphoto2/gphoto2-port-version.h>
#ifdef __cplusplus
extern "C" {
#endif
const char **gp_library_version(GPVersionVerbosity verbose);
#ifdef __cplusplus
}
#endif
#endif /* !defined(LIBGPHOTO2_GPHOTO2_VERSION_H) */

View file

@ -0,0 +1,133 @@
/** \file
*
* \author Copyright 2000 Scott Fritzinger
*
* \note
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* \note
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* \note
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef LIBGPHOTO2_GPHOTO2_WIDGET_H
#define LIBGPHOTO2_GPHOTO2_WIDGET_H
#include <gphoto2/gphoto2-context.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** \brief internal structure please use the accessors. */
typedef struct _CameraWidget CameraWidget;
#ifdef __cplusplus
}
#endif /* __cplusplus */
#include <gphoto2/gphoto2-camera.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* \brief Type of the widget to be created.
*
* The actual widget type we want to create. The type of the value
* it supports depends on this type.
*/
typedef enum { /* Value (get/set): */
GP_WIDGET_WINDOW, /**< \brief Window widget
* This is the toplevel configuration widget. It should likely contain multiple #GP_WIDGET_SECTION entries.
*/
GP_WIDGET_SECTION, /**< \brief Section widget (think Tab) */
GP_WIDGET_TEXT, /**< \brief Text widget. */ /* char * */
GP_WIDGET_RANGE, /**< \brief Slider widget. */ /* float */
GP_WIDGET_TOGGLE, /**< \brief Toggle widget (think check box) */ /* int */
GP_WIDGET_RADIO, /**< \brief Radio button widget. */ /* char * */
GP_WIDGET_MENU, /**< \brief Menu widget (same as RADIO). */ /* char * */
GP_WIDGET_BUTTON, /**< \brief Button press widget. */ /* CameraWidgetCallback */
GP_WIDGET_DATE /**< \brief Date entering widget. */ /* int */
} CameraWidgetType;
/**
* \brief Callback handler for Button widgets.
*/
typedef int (* CameraWidgetCallback) (Camera *, CameraWidget *, GPContext *);
int gp_widget_new (CameraWidgetType type, const char *label,
CameraWidget **widget);
int gp_widget_free (CameraWidget *widget);
int gp_widget_ref (CameraWidget *widget);
int gp_widget_unref (CameraWidget *widget);
int gp_widget_append (CameraWidget *widget, CameraWidget *child);
int gp_widget_prepend (CameraWidget *widget, CameraWidget *child);
int gp_widget_count_children (CameraWidget *widget);
int gp_widget_get_child (CameraWidget *widget, int child_number,
CameraWidget **child);
/* Retrieve Widgets */
int gp_widget_get_child_by_label (CameraWidget *widget,
const char *label,
CameraWidget **child);
int gp_widget_get_child_by_id (CameraWidget *widget, int id,
CameraWidget **child);
int gp_widget_get_child_by_name (CameraWidget *widget,
const char *name,
CameraWidget **child);
int gp_widget_get_root (CameraWidget *widget,
CameraWidget **root);
int gp_widget_get_parent (CameraWidget *widget,
CameraWidget **parent);
int gp_widget_set_value (CameraWidget *widget, const void *value);
int gp_widget_get_value (CameraWidget *widget, void *value);
int gp_widget_set_name (CameraWidget *widget, const char *name);
int gp_widget_get_name (CameraWidget *widget, const char **name);
int gp_widget_set_info (CameraWidget *widget, const char *info);
int gp_widget_get_info (CameraWidget *widget, const char **info);
int gp_widget_get_id (CameraWidget *widget, int *id);
int gp_widget_get_type (CameraWidget *widget, CameraWidgetType *type);
int gp_widget_get_label (CameraWidget *widget, const char **label);
int gp_widget_set_range (CameraWidget *range,
float low, float high, float increment);
int gp_widget_get_range (CameraWidget *range,
float *min, float *max, float *increment);
int gp_widget_add_choice (CameraWidget *widget, const char *choice);
int gp_widget_count_choices (CameraWidget *widget);
int gp_widget_get_choice (CameraWidget *widget, int choice_number,
const char **choice);
int gp_widget_changed (CameraWidget *widget);
int gp_widget_set_changed (CameraWidget *widget, int changed);
int gp_widget_set_readonly (CameraWidget *widget, int readonly);
int gp_widget_get_readonly (CameraWidget *widget, int *readonly);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* !defined(LIBGPHOTO2_GPHOTO2_WIDGET_H) */

View file

@ -0,0 +1,50 @@
/** \file
* \brief Convenience header for gphoto2
*
* \author Copyright 2001 Lutz Mueller <lutz@users.sf.net>
*
* \note
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* \note
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* \note
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef LIBGPHOTO2_GPHOTO2_H
#define LIBGPHOTO2_GPHOTO2_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef WIN32
#ifndef CAMLIBS
#define CAMLIBS "."
#endif
#endif
#include <gphoto2/gphoto2-port.h>
#include <gphoto2/gphoto2-port-log.h>
#include <gphoto2/gphoto2-port-result.h>
#include <gphoto2/gphoto2-file.h>
#include <gphoto2/gphoto2-library.h>
#include <gphoto2/gphoto2-setting.h>
#ifdef __cplusplus
}
#endif
#endif /* !defined(LIBGPHOTO2_GPHOTO2_H) */

3
thirdparty/libgphoto2/lib/compat.lib vendored Normal file
View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5025eb63955e6e6d519201cdaed07cdd643986bb252a4def291024df0aeb18dc
size 286818

BIN
thirdparty/libgphoto2/lib/libgphoto2.exp vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6c609ae08ac863b9f2a8882d42aa909a11d3166a9a335c7195b939779846865a
size 41162

Binary file not shown.

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0037541e5c2f83f806ff5d78486262d7c1d27ffaf3515858f0e2ba292a4726d6
size 18208

View file

@ -108,6 +108,7 @@ endif()
option(WITH_SYSTEM_LZO "Use the system LZO library instead of 'thirdpary'" ${_init_SYSTEM_LZO})
option(WITH_SYSTEM_SUPERLU "Use the system SuperLU library instead of 'thirdpary'" ${_init_SYSTEM_SUPERLU})
option(WITH_CANON "Build with Canon DSLR support - Requires Canon SDK" OFF)
option(WITH_GPHOTO2 "Build with Libgphoto2" OFF)
option(WITH_TRANSLATION "Generate translation projects as well" ON)
option(WITH_CRASHRPT "Build CrashRpt support - Requires CrashRpt Library" OFF)
option(WITH_WINTAB "(Windows only) Build with customized Qt with WinTab support. https://github.com/shun-iwasawa/qt5/releases/tag/v5.15.2_wintab" OFF)
@ -287,6 +288,12 @@ if(BUILD_ENV_MSVC)
${SDKROOT}/crashrpt/include
)
endif()
if(WITH_GPHOTO2)
include_directories(
${SDKROOT}/libgphoto2/include
)
endif()
endif()
if(BUILD_ENV_MSVC)
@ -394,6 +401,12 @@ if(BUILD_ENV_MSVC)
if(WITH_CRASHRPT)
set(CRASHRPT_LIB ${SDKROOT}/crashrpt/CrashRpt1500.lib)
endif()
if(WITH_GPHOTO2)
set(GPHOTO2_LIB ${SDKROOT}/libgphoto2/lib/libgphoto2.lib)
set(GPHOTO2_PORT_LIB ${SDKROOT}/libgphoto2/lib/libgphoto2_port.lib)
set(GPHOTO2_COMPAT_LIB ${SDKROOT}/libgphoto2/lib/compat.lib)
endif()
elseif(BUILD_ENV_APPLE)
find_library(GLUT_LIB GLUT)
find_library(GL_LIB OpenGL)
@ -455,6 +468,12 @@ elseif(BUILD_ENV_APPLE)
endif()
endif()
if(WITH_GPHOTO2)
find_library(GPHOTO2_LIB gphoto2)
message("**************** gphoto2 lib:" ${GPHOTO2_LIB})
find_library(GPHOTO2_PORT_LIB gphoto2_port)
message("**************** gphoto2_port lib:" ${GPHOTO2_PORT_LIB})
endif()
elseif(BUILD_ENV_UNIXLIKE)
if(BUILD_TARGET_WIN)
find_library(GL_LIB opengl32)
@ -521,6 +540,13 @@ elseif(BUILD_ENV_UNIXLIKE)
find_library(TURBOJPEG_LIB turbojpeg)
message("**************** turbojpeg lib:" ${TURBOJPEG_LIB})
if(WITH_GPHOTO2)
find_library(GPHOTO2_LIB gphoto2)
message("**************** gphoto2 lib:" ${GPHOTO2_LIB})
find_library(GPHOTO2_PORT_LIB gphoto2_port)
message("**************** gphoto2_port lib:" ${GPHOTO2_PORT_LIB})
endif()
endif()

View file

@ -0,0 +1,14 @@
#!/bin/bash
DIR="`dirname \"$0\"`"
DIR="`( cd \"$DIR\" && readlink -f $(pwd) )`"
echo "DIR: $DIR"
export APPDIR=$DIR
export CAMLIBS=`find $APPDIR/usr/lib/libgphoto2 -mindepth 1 -type d`
echo "CAMLIBS: $CAMLIBS"
export IOLIBS=`find $APPDIR/usr/lib/libgphoto2_port -mindepth 1 -type d`
echo "IOLIBS: $IOLIBS"
$APPDIR/usr/bin/Tahoma2D

View file

@ -90,6 +90,8 @@ EdsError Canon::releaseCameraList() {
//-----------------------------------------------------------------
int Canon::getCameraCount() {
m_count = 0;
if (m_cameraList == NULL) {
getCameraList();
}
@ -102,9 +104,9 @@ int Canon::getCameraCount() {
m_sessionOpen = false;
}
}
return m_count;
} else
return -1;
}
return m_count;
}
//-----------------------------------------------------------------
@ -158,7 +160,7 @@ void Canon::resetCanon(bool liveViewOpen) {
if (m_sessionOpen && getCameraCount() > 0) {
if (liveViewOpen) {
endCanonLiveView();
endLiveView();
}
closeCameraSession();
}
@ -1056,7 +1058,7 @@ void Canon::extendCameraOnTime() {
//-----------------------------------------------------------------
EdsError Canon::startCanonLiveView() {
EdsError Canon::startLiveView() {
if (m_camera && m_sessionOpen) {
EdsError err = EDS_ERR_OK;
// Get the output device for the live view image
@ -1083,7 +1085,7 @@ EdsError Canon::startCanonLiveView() {
//-----------------------------------------------------------------
EdsError Canon::endCanonLiveView() {
EdsError Canon::endLiveView() {
EdsError err = EDS_ERR_OK;
// Get the output device for the live view image
EdsUInt32 device;

View file

@ -85,7 +85,6 @@ public:
EdsUInt32 m_liveViewZoom = 1;
bool m_isSDKLoaded = false;
bool m_sessionOpen = false;
bool m_zooming = false;
std::string m_cameraName;
TPoint m_liveViewZoomOffset = TPoint(0, 0);
bool m_liveViewZoomReadyToPick = true;
@ -97,6 +96,7 @@ public:
#endif
TDimension m_proxyImageDimensions = TDimension(0, 0);
bool m_converterSucceeded = false;
bool m_zooming = false;
bool m_pickLiveViewZoom = false;
TDimension m_fullImageDimensions = TDimension(0, 0);
int m_liveViewExposureOffset = 0;
@ -104,6 +104,10 @@ public:
QString m_displayedShutterSpeed;
QString m_imageQuality;
cv::Mat m_canonImage;
int m_canonIndex = -1;
void setCanonIndex(int index) { m_canonIndex = index; }
int getCanonIndex() { return m_canonIndex; }
bool m_useCalibration;
cv::Mat m_calibrationMapX, m_calibrationMapY;
@ -135,8 +139,8 @@ public:
EdsError closeCameraSession();
bool downloadImage(EdsBaseRef object);
EdsError takePicture();
EdsError startCanonLiveView();
EdsError endCanonLiveView();
EdsError startLiveView();
EdsError endLiveView();
bool downloadEVFData();
QStringList getIsoOptions() { return m_isoOptions; }
QStringList getShutterSpeedOptions() { return m_shutterSpeedOptions; }

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,257 @@
#pragma once
#ifndef GPHOTOCAM_H
#define GPHOTOCAM_H
#ifdef WITH_GPHOTO2
#include <gphoto2/gphoto2.h>
#endif
#include "opencv2/opencv.hpp"
#include "traster.h"
#include <QObject>
#include <QThread>
#include <QTimer>
typedef struct {
const char *modeKey;
const char *batteryLevelKey;
const char *shutterSpeedKey;
const char *apertureKey;
const char *isoKey;
const char *whiteBalanceKey;
const char *pictureStyleKey;
const char *imageQualityKey;
const char *imageSizeKey;
const char *exposureCompensationKey;
const char *colorTemperatureKey;
const char *manualFocusDriveKey;
const char *afPositionKey;
const char *viewfinderKey;
const char *focusPointKey;
} GPConfigKeys;
const struct {
QString manufacturer;
GPConfigKeys keys;
} cameraConfigKeys[] = {
// Canon
{"Canon",
{"autoexposuremode", "batterylevel", "shutterspeed", "aperture", "iso",
"whitebalance", "picturestyle", "imageformat", 0, "exposurecompensation",
"colorTemperature", "manualfocusdrive", "eoszoomposition", "viewfinder",
"focusinfo"}},
// Nikon
{"Nikon",
{"expprogram", "Battery Level", "shutterspeed", "f-number", "iso",
"whitebalance", 0, "imagequality", "imagesize", "exposurecompensation", 0,
"manualfocusdrive", "changeafarea", "viewfinder", "changeafarea"}},
{0,
{"expprogram", 0, "shutterspeed", "f-number", "iso", "whitebalance", 0,
"imagequality", "imagesize", "exposurecompensation", 0, "manualfocusdrive",
0, "viewfinder", 0}}};
//-----------------------------------------------------------------
class GPhotoCam : public QObject {
Q_OBJECT
public:
static GPhotoCam *instance() {
static GPhotoCam _instance;
return &_instance;
};
private:
#ifdef WITH_GPHOTO2
GPContext *m_gpContext;
#endif
private:
QStringList m_apertureOptions, m_shutterSpeedOptions, m_isoOptions,
m_exposureOptions, m_whiteBalanceOptions, m_colorTempOptions,
m_imageQualityOptions, m_imageSizeOptions, m_pictureStyleOptions,
m_manualFocusRange;
GPConfigKeys m_configKeys;
public:
GPhotoCam();
~GPhotoCam();
int m_count;
int m_gphotoIndex;
bool m_sessionOpen;
QTimer *m_eventTimer;
bool m_capturePreview;
bool m_captureImage;
bool m_exitRequested;
bool m_previewImageReady;
QString m_cameraName;
QString m_cameraManufacturer;
QString m_cameraModel;
#ifdef WITH_GPHOTO2
CameraFile *m_previewFile;
CameraAbilitiesList *m_cameraListMaster;
GPPortInfoList *m_portInfoList;
CameraList *m_cameraListDetected;
Camera *m_camera;
GPPortInfo m_portInfo;
CameraFilePath *m_cameraImageFilePath;
#endif
TDimension m_proxyImageDimensions = TDimension(0, 0);
TDimension m_fullImageDimensions = TDimension(0, 0);
int m_liveViewExposureOffset = 0;
QString m_realShutterSpeed;
QString m_displayedShutterSpeed;
QString m_displayedAperture;
QString m_displayedIso;
bool m_converterSucceeded, l_quitLoop;
cv::Mat m_gPhotoImage;
bool m_zooming = false;
bool m_pickLiveViewZoom = false;
bool m_liveViewZoomReadyToPick = true;
int m_liveViewZoom = 1;
TPointD m_liveViewZoomPickPoint = TPointD(0.0, 0.0);
TPoint m_calculatedZoomPoint = TPoint(0, 0);
TPoint m_finalZoomPoint = TPoint(0, 0);
TPoint m_zoomRectDimensions = TPoint(0, 0);
TRect m_zoomRect = TRect(0, 0, 0, 0);
void setGphotoIndex(int index) { m_gphotoIndex = index; }
int getGphotoIndex() { return m_gphotoIndex; }
bool m_useCalibration;
cv::Mat m_calibrationMapX, m_calibrationMapY;
void enableCalibration(bool useCalibration) {
m_useCalibration = useCalibration;
}
void setCalibration(cv::Mat calibrationMapX, cv::Mat calibrationMapY) {
m_calibrationMapX = calibrationMapX;
m_calibrationMapY = calibrationMapY;
};
cv::Mat getGPhotoImage() { return m_gPhotoImage; }
int getCameraCount();
void resetGphotocam(bool liveViewOpen);
bool isCanon() { return m_cameraManufacturer.contains("Canon"); };
bool isNikon() { return m_cameraManufacturer.contains("Nikon"); };
void loadCameraConfigKeys(QString manufacturer);
#ifdef WITH_GPHOTO2
bool initializeCamera();
bool getCamera(int index);
bool releaseCamera();
QString getCameraName(int index);
bool openCameraSession();
bool closeCameraSession();
void closeAll();
bool startLiveView();
bool endLiveView();
bool getGPhotocamImage();
bool takePicture();
QString getMode();
QString getCurrentBatteryLevel();
bool downloadImage();
QStringList getApertureOptions() { return m_apertureOptions; }
QStringList getShutterSpeedOptions() { return m_shutterSpeedOptions; }
QStringList getIsoOptions() { return m_isoOptions; }
QStringList getExposureOptions() { return m_exposureOptions; }
QStringList getWhiteBalanceOptions() { return m_whiteBalanceOptions; }
QStringList getColorTemperatureOptions() { return m_colorTempOptions; }
QStringList getImageQualityOptions() { return m_imageQualityOptions; }
QStringList getImageSizeOptions() { return m_imageSizeOptions; }
QStringList getPictureStyleOptions() { return m_pictureStyleOptions; }
QStringList getManualFocusRange() { return m_manualFocusRange; }
QStringList getCameraConfigList(const char *key);
QString getCameraConfigValue(const char *key);
bool setCameraConfigValue(const char *key, QString value);
bool getAvailableApertures();
bool getAvailableShutterSpeeds();
bool getAvailableIso();
bool getAvailableExposureCompensations();
bool getAvailableWhiteBalances();
bool getAvailableImageQualities();
bool getAvailableImageSizes();
bool getAvailablePictureStyles();
bool getAvailableColorTemperatures();
bool getManualFocusRangeData();
QString getCurrentAperture();
QString getCurrentShutterSpeed();
QString getCurrentIso();
QString getCurrentExposureCompensation();
QString getCurrentWhiteBalance();
QString getCurrentColorTemperature();
QString getCurrentImageQuality();
QString getCurrentImageSize();
QString getCurrentPictureStyle();
int getCurrentLiveViewOffset();
bool setAperture(QString aperture);
bool setShutterSpeed(QString shutterSpeed, bool withOffset = true);
bool setIso(QString iso);
bool setExposureCompensation(QString exposure);
bool setWhiteBalance(QString whiteBalance);
bool setColorTemperature(QString colorTemp);
bool setImageQuality(QString imageQuality);
bool setImageSize(QString imageSize);
bool setPictureStyle(QString pictureStyle);
bool setManualFocus(int value);
void setLiveViewOffset(int offset);
bool zoomLiveView();
void calculateZoomPoint();
void makeZoomPoint(TPointD pos);
void toggleZoomPicking();
bool setZoomPoint();
bool focusNear();
bool focusFar();
bool focusNear2();
bool focusFar2();
bool focusNear3();
bool focusFar3();
#endif
public slots:
void onTimeout();
void onImageReady(const bool &);
void onFinished();
signals:
void newGPhotocamImageReady();
void modeChanged();
void batteryChanged();
void apertureChangedSignal(QString);
void isoChangedSignal(QString);
void shutterSpeedChangedSignal(QString);
void exposureChangedSignal(QString);
void whiteBalanceChangedSignal(QString);
void imageQualityChangedSignal(QString);
void imageSizeChangedSignal(QString);
void pictureStyleChangedSignal(QString);
void colorTemperatureChangedSignal(QString);
void liveViewOffsetChangedSignal(int);
void focusCheckToggled(bool);
void pickFocusCheckToggled(bool);
};
#endif // GPHOTOCAM_H

View file

@ -9,26 +9,34 @@ JpgConverter::JpgConverter() {}
JpgConverter::~JpgConverter() {}
#ifdef WITH_CANON
void JpgConverter::setStream(EdsStreamRef stream) { m_stream = stream; }
#endif
void JpgConverter::setDataPtr(unsigned char* dataPtr, unsigned long dataSize) {
m_dataPtr = dataPtr;
m_dataSize = dataSize;
}
void JpgConverter::convertFromJpg() {
#ifdef MACOSX
UInt64 mySize = 0;
#else
unsigned __int64 mySize = 0;
#ifdef WITH_CANON
if (m_stream) {
EdsError err = EdsGetPointer(m_stream, (EdsVoid**)&m_dataPtr);
err = EdsGetLength(m_stream, &m_dataSize);
}
#endif
unsigned char* data = NULL;
EdsError err = EdsGetPointer(m_stream, (EdsVoid**)&data);
err = EdsGetLength(m_stream, &mySize);
if (!m_dataPtr) {
emit(imageReady(false));
return;
}
int width, height, pixelFormat;
int inSubsamp, inColorspace;
tjhandle tjInstance = NULL;
unsigned char* imgBuf = NULL;
tjInstance = tjInitDecompress();
tjDecompressHeader3(tjInstance, data, mySize, &width, &height, &inSubsamp,
&inColorspace);
tjDecompressHeader3(tjInstance, m_dataPtr, m_dataSize, &width, &height,
&inSubsamp, &inColorspace);
if (width < 0 || height < 0) {
emit(imageReady(false));
@ -51,7 +59,7 @@ void JpgConverter::convertFromJpg() {
tempWidth = TJSCALED(width, scalingFactor);
tempHeight = TJSCALED(height, scalingFactor);
}
tjDecompress2(tjInstance, data, mySize, imgBuf, width,
tjDecompress2(tjInstance, m_dataPtr, m_dataSize, imgBuf, width,
width * tjPixelSize[pixelFormat], height, pixelFormat, flags);
m_finalImage = TRaster32P(width, height);
@ -65,18 +73,18 @@ void JpgConverter::convertFromJpg() {
tjDestroy(tjInstance);
tjInstance = NULL;
#ifdef WITH_CANON
if (m_stream != NULL) {
EdsRelease(m_stream);
m_stream = NULL;
}
data = NULL;
#endif
m_dataPtr = NULL;
emit(imageReady(true));
}
void JpgConverter::run() { convertFromJpg(); }
#endif
//-----------------------------------------------------------------------------
void JpgConverter::saveJpg(TRaster32P image, TFilePath path) {

View file

@ -32,6 +32,16 @@ class JpgConverter : public QThread {
#ifdef WITH_CANON
EdsStreamRef m_stream;
#endif
#ifdef MACOSX
UInt64 m_dataSize = 0;
#elif defined(LINUX)
unsigned long long m_dataSize = 0;
#else
unsigned __int64 m_dataSize = 0;
#endif
unsigned char* m_dataPtr = NULL;
TRaster32P m_finalImage;
// bool m_scale = false;
int m_scaleWidth = 0;
@ -43,19 +53,18 @@ public:
static bool loadJpg(TFilePath path, TRaster32P& image);
#ifdef WITH_CANON
void setStream(EdsStreamRef stream);
// void setScale(bool scale) { m_scale = scale; }
// void setScale(bool scale) { m_scale = scale; }
#endif
void setDataPtr(unsigned char* dataPtr, unsigned long dataSize);
void setScaleWidth(bool scaleWidth) { m_scaleWidth = scaleWidth; }
TRaster32P getImage() { return m_finalImage; }
void convertFromJpg();
protected:
void run() override;
#endif
signals:
void imageReady(bool);
};
//#endif
#endif // JPGCONVERTER_H

File diff suppressed because it is too large Load diff

View file

@ -23,6 +23,7 @@
#include "canon.h"
#include "stopmotionserial.h"
#include "stopmotionlight.h"
#include "gphotocam.h"
#include "toonz/namebuilder.h"
#include "toonz/txshsimplelevel.h"
@ -51,6 +52,8 @@ public:
enum ASPECT_RATIO { FOUR_THREE = 0, THREE_TWO, SIXTEEN_NINE, OTHER_RATIO };
enum CameraType { None = 0, Web, CanonDSLR, GPhoto };
class StopMotion : public QObject { // Singleton
Q_OBJECT
@ -98,10 +101,13 @@ public:
Webcam* m_webcam;
Canon* m_canon;
GPhotoCam* m_gphotocam;
StopMotionSerial* m_serial;
StopMotionLight* m_light;
bool m_usingWebcam = false;
CameraType m_currentCameraType = CameraType::None;
int m_currentCameraTypeIndex = -1;
bool m_placeOnXSheet = true;
bool m_alwaysLiveView = false;
bool m_userCalledPause = false;
@ -175,7 +181,7 @@ public:
std::string getTEnvCameraResolution();
void setTEnvCameraResolution(std::string resolution);
void disconnectAllCameras();
void changeCameras(int index);
void changeCameras(int comboIndex, CameraType cameraType, int cameraIndex);
void refreshCameraList();
// commands
@ -236,6 +242,16 @@ public:
void saveTestShot();
void saveTestXml(TFilePath testsXml, int number);
bool isPickLiveViewZoom();
bool isZooming();
bool isLiveViewZoomReadyToPick();
void makeZoomPoint(TPointD pickPos);
TRect getZoomRect();
void toggleZoomPicking();
void calculateZoomPoint();
void setZoomPoint();
void adjustLiveViewZoomPickPoint(int x, int y);
public slots:
// timers
void onTimeout();
@ -252,12 +268,12 @@ public slots:
signals:
// camera stuff
void cameraChanged(QString);
void newCameraSelected(int, bool);
void newCameraSelected(int);
void webcamResolutionsChanged();
void newWebcamResolutionSelected(int);
void updateCameraList(QString);
void changeCameraIndex(int);
void updateStopMotionControls(bool);
void updateStopMotionControls();
// live view and images
void newLiveViewImageReady();

File diff suppressed because it is too large Load diff

View file

@ -85,7 +85,7 @@ class FrameNumberLineEdit : public DVGui::LineEdit,
QString m_textOnFocusIn;
public:
FrameNumberLineEdit(QWidget* parent = 0, TFrameId fId = TFrameId(1),
FrameNumberLineEdit(QWidget *parent = 0, TFrameId fId = TFrameId(1),
bool acceptLetter = true);
~FrameNumberLineEdit() {}
@ -194,18 +194,18 @@ class StopMotionController final : public QWidget {
*m_focusFar3Button, *m_captureFilterSettingsBtn, *m_testLightsButton;
QHBoxLayout *m_focusAndZoomLayout;
QLabel *m_frameInfoLabel, *m_cameraSettingsLabel, *m_cameraModeLabel,
*m_resolutionLabel, *m_cameraStatusLabel,
*m_apertureLabel, *m_kelvinValueLabel, *m_isoLabel, *m_shutterSpeedLabel,
*m_webcamLabel, *m_liveViewCompensationLabel;
*m_resolutionLabel, *m_cameraStatusLabel, *m_apertureLabel,
*m_kelvinValueLabel, *m_isoLabel, *m_shutterSpeedLabel, *m_webcamLabel,
*m_liveViewCompensationLabel;
QToolButton *m_previousLevelButton, *m_previousFrameButton,
*m_previousXSheetFrameButton;
QSlider *m_apertureSlider, *m_shutterSpeedSlider, *m_isoSlider,
*m_kelvinSlider, *m_webcamFocusSlider, *m_webcamWhiteBalanceSlider,
*m_webcamExposureSlider, *m_webcamBrightnessSlider,
*m_webcamContrastSlider, *m_webcamGainSlider, *m_webcamSaturationSlider,
*m_liveViewCompensationSlider;
*m_liveViewCompensationSlider, *m_manualFocusSlider;
QComboBox *m_cameraListCombo, *m_exposureCombo, *m_fileTypeCombo,
*m_whiteBalanceCombo, *m_resolutionCombo, *m_imageQualityCombo,
*m_whiteBalanceCombo, *m_resolutionCombo, *m_imageQualityCombo, *m_imageSizeCombo,
*m_pictureStyleCombo, *m_controlDeviceCombo, *m_captureFramesCombo,
*m_colorTypeCombo;
LevelNameLineEdit *m_levelNameEdit;
@ -343,7 +343,7 @@ protected slots:
void onShowSceneOn2Changed(bool);
void onShowSceneOn3Changed(bool);
// canon stuff
// DSLR stuff
void onApertureChanged(int index);
void onShutterSpeedChanged(int index);
void onIsoChanged(int index);
@ -351,8 +351,10 @@ protected slots:
void onWhiteBalanceChanged(int index);
void onColorTemperatureChanged(int index);
void onImageQualityChanged(int index);
void onImageSizeChanged(int index);
void onPictureStyleChanged(int index);
void onLiveViewCompensationChanged(int index);
void onManualFocusChanged(int index);
void onZoomPressed();
void onPickZoomPressed();
void onFocusNear();
@ -368,6 +370,7 @@ protected slots:
void onWhiteBalanceChangedSignal(QString);
void onColorTemperatureChangedSignal(QString);
void onImageQualityChangedSignal(QString);
void onImageSizeChangedSignal(QString);
void onPictureStyleChangedSignal(QString);
void onLiveViewCompensationChangedSignal(int);
void refreshApertureList();
@ -377,8 +380,10 @@ protected slots:
void refreshWhiteBalanceList();
void refreshColorTemperatureList();
void refreshImageQualityList();
void refreshImageSizeList();
void refreshPictureStyleList();
void refreshMode();
void refreshManualFocusRange();
void onFocusCheckToggled(bool on);
void onPickFocusCheckToggled(bool on);
void onAlwaysUseLiveViewImagesButtonClicked();
@ -406,9 +411,9 @@ protected slots:
void onUseNumpadSignal(bool);
void onDrawBeneathSignal(bool);
void onLiveViewChanged(bool);
void onNewCameraSelected(int, bool);
void onNewCameraSelected(int);
void onCameraIndexChanged(int);
void onUpdateStopMotionControls(bool);
void onUpdateStopMotionControls();
// webcam
void onWebcamResolutionsChanged();

View file

@ -132,6 +132,7 @@ set(MOC_HEADERS
../stopmotion/canon.h
../stopmotion/stopmotionserial.h
../stopmotion/stopmotionlight.h
../stopmotion/gphotocam.h
cameracapturelevelcontrol.h
navtageditorpopup.h
)
@ -369,6 +370,7 @@ set(SOURCES
../stopmotion/canon.cpp
../stopmotion/stopmotionserial.cpp
../stopmotion/stopmotionlight.cpp
../stopmotion/gphotocam.cpp
cameracapturelevelcontrol.cpp
navtageditorpopup.cpp
)
@ -438,6 +440,10 @@ if (WITH_CRASHRPT)
add_definitions(-DWITH_CRASHRPT)
endif()
if (WITH_GPHOTO2)
add_definitions(-DWITH_GPHOTO2)
endif()
if (WITH_WINTAB AND BUILD_TARGET_WIN AND (PLATFORM EQUAL 64))
add_definitions(-DWITH_WINTAB)
endif()
@ -468,6 +474,10 @@ if(BUILD_ENV_MSVC)
set(EXTRA_LIBS ${EXTRA_LIBS} ${CRASHRPT_LIB})
endif()
if(WITH_GPHOTO2)
set(EXTRA_LIBS ${EXTRA_LIBS} ${GPHOTO2_LIB} ${GPHOTO2_PORT_LIB} ${GPHOTO2_COMPAT_LIB})
endif()
target_link_libraries(Tahoma2D
Qt5::WinMain Qt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Svg Qt5::Xml
Qt5::Script Qt5::Widgets Qt5::PrintSupport Qt5::Multimedia Qt5::SerialPort
@ -482,6 +492,10 @@ elseif(BUILD_ENV_APPLE AND WITH_CANON)
#
set(EXTRA_LIBS ${EXTRA_LIBS} "$<TARGET_FILE:tnzstdfx>" "$<TARGET_FILE:tfarm>")
if(WITH_GPHOTO2)
set(EXTRA_LIBS ${EXTRA_LIBS} ${GPHOTO2_LIB} ${GPHOTO2_PORT_LIB})
endif()
add_dependencies(Tahoma2D tnzcore tnzbase toonzlib colorfx tnzext image sound toonzqt tnztools tnzstdfx tfarm)
target_link_libraries(Tahoma2D
@ -499,6 +513,10 @@ elseif(BUILD_ENV_APPLE)
#
set(EXTRA_LIBS ${EXTRA_LIBS} "$<TARGET_FILE:tnzstdfx>" "$<TARGET_FILE:tfarm>")
if(WITH_GPHOTO2)
set(EXTRA_LIBS ${EXTRA_LIBS} ${GPHOTO2_LIB} ${GPHOTO2_PORT_LIB})
endif()
add_dependencies(Tahoma2D tnzcore tnzbase toonzlib colorfx tnzext image sound toonzqt tnztools tnzstdfx tfarm)
target_link_libraries(Tahoma2D
@ -516,6 +534,10 @@ elseif(BUILD_ENV_UNIXLIKE)
set(EXTRA_LIBS ${EXTRA_LIBS} ${Boost_LIBRARIES} ${OPENBLAS_LIB})
if(WITH_GPHOTO2)
set(EXTRA_LIBS ${EXTRA_LIBS} ${GPHOTO2_LIB} ${GPHOTO2_PORT_LIB})
endif()
if(BUILD_TARGET_WIN)
set(EXTRA_LIBS ${EXTRA_LIBS} Qt5::WinMain -lstrmiids -mwindows)
endif()

View file

@ -3073,12 +3073,10 @@ void MainWindow::defineActions() {
QT_TR_NOOP("Lower Stop Motion Opacity"), "");
createStopMotionAction(MI_StopMotionToggleLiveView,
QT_TR_NOOP("Toggle Stop Motion Live View"), "");
#ifdef WITH_CANON
createStopMotionAction(MI_StopMotionToggleZoom,
QT_TR_NOOP("Toggle Stop Motion Zoom"), "");
createStopMotionAction(MI_StopMotionPickFocusCheck,
QT_TR_NOOP("Pick Focus Check Location"), "");
#endif
createStopMotionAction(MI_StopMotionLowerSubsampling,
QT_TR_NOOP("Lower Stop Motion Level Subsampling"), "");
createStopMotionAction(MI_StopMotionRaiseSubsampling,

View file

@ -1204,7 +1204,7 @@ void SceneViewer::onNewStopMotionImageReady() {
m_stopMotionImage->setDpi(m_stopMotion->m_liveViewDpi.x,
m_stopMotion->m_liveViewDpi.y);
m_hasStopMotionImage = true;
if (m_stopMotion->m_canon->m_pickLiveViewZoom) {
if (m_stopMotion->isPickLiveViewZoom()) {
setToolCursor(this, ToolCursor::ZoomCursor);
}
onSceneChanged();
@ -1713,7 +1713,6 @@ void SceneViewer::drawOverlay() {
glPopMatrix();
}
#ifdef WITH_CANON
if (m_stopMotion->m_liveViewStatus == StopMotion::LiveViewOpen &&
app->getCurrentFrame()->getFrame() ==
m_stopMotion->getXSheetFrameNumber() - 1) {
@ -1726,12 +1725,11 @@ void SceneViewer::drawOverlay() {
}
// draw Stop Motion Zoom Box
if (m_stopMotion->m_liveViewStatus == 2 &&
m_stopMotion->m_canon->m_pickLiveViewZoom) {
if (m_stopMotion->m_liveViewStatus == 2 && m_stopMotion->isPickLiveViewZoom()) {
glPushMatrix();
tglMultMatrix(m_drawCameraAff);
m_pixelSize = sqrt(tglGetPixelSize2()) * getDevPixRatio();
TRect rect = m_stopMotion->m_canon->m_zoomRect;
TRect rect = m_stopMotion->getZoomRect();
glColor3d(1.0, 0.0, 0.0);
@ -1747,8 +1745,6 @@ void SceneViewer::drawOverlay() {
glPopMatrix();
}
#endif
// safe area
if (safeAreaToggle.getStatus() && m_drawEditingLevel == false &&
!is3DView()) {
@ -2176,11 +2172,9 @@ void SceneViewer::drawScene() {
m_stopMotionImage->getDpi(dpiX, dpiY);
smPlayer.m_dpiAff = TScale(Stage::inch / dpiX, Stage::inch / dpiY);
bool hide_opacity = false;
#ifdef WITH_CANON
hide_opacity = m_stopMotion->m_canon->m_zooming ||
m_stopMotion->m_canon->m_pickLiveViewZoom ||
hide_opacity = m_stopMotion->isZooming() ||
m_stopMotion->isPickLiveViewZoom() ||
!m_hasStopMotionLineUpImage;
#endif
smPlayer.m_opacity = hide_opacity ? 255.0 : m_stopMotion->getOpacity();
smPlayer.m_sl = m_stopMotion->m_sl;
args.m_liveViewImage = m_stopMotionImage;
@ -2293,11 +2287,9 @@ void SceneViewer::drawScene() {
m_stopMotionImage->getDpi(dpiX, dpiY);
smPlayer.m_dpiAff = TScale(Stage::inch / dpiX, Stage::inch / dpiY);
bool hide_opacity = false;
#ifdef WITH_CANON
hide_opacity = m_stopMotion->m_canon->m_zooming ||
m_stopMotion->m_canon->m_pickLiveViewZoom ||
hide_opacity = m_stopMotion->isZooming()||
m_stopMotion->isPickLiveViewZoom() ||
!m_hasStopMotionLineUpImage;
#endif
smPlayer.m_opacity =
hide_opacity ? 255.0 : m_stopMotion->getOpacity();
smPlayer.m_sl = m_stopMotion->m_sl;

View file

@ -654,15 +654,13 @@ void SceneViewer::onMove(const TMouseEvent &event) {
return;
}
#ifdef WITH_CANON
TPointD pickPos = winToWorld(curPos);
// grab screen picking for stop motion live view zoom
if ((event.buttons() & Qt::LeftButton) &&
StopMotion::instance()->m_canon->m_pickLiveViewZoom) {
StopMotion::instance()->m_canon->makeZoomPoint(pickPos);
StopMotion::instance()->isPickLiveViewZoom()) {
StopMotion::instance()->makeZoomPoint(pickPos);
return;
}
#endif
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
if (!tool || !tool->isEnabled()) {
@ -709,10 +707,9 @@ void SceneViewer::onMove(const TMouseEvent &event) {
}
if (!cursorSet) setToolCursor(this, tool->getCursorId());
#ifdef WITH_CANON
if (StopMotion::instance()->m_canon->m_pickLiveViewZoom)
if (StopMotion::instance()->isPickLiveViewZoom())
setToolCursor(this, ToolCursor::ZoomCursor);
#endif
m_pos = curPos;
m_tabletMove = false;
m_toolSwitched = false;
@ -840,14 +837,12 @@ void SceneViewer::onPress(const TMouseEvent &event) {
if (m_freezedStatus != NO_FREEZED) return;
#ifdef WITH_CANON
TPointD pickPos = winToWorld(m_pos);
// grab screen picking for stop motion live view zoom
if (StopMotion::instance()->m_canon->m_pickLiveViewZoom) {
StopMotion::instance()->m_canon->makeZoomPoint(pickPos);
if (StopMotion::instance()->isPickLiveViewZoom()) {
StopMotion::instance()->makeZoomPoint(pickPos);
return;
}
#endif
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
if (!tool || !tool->isEnabled()) {
@ -961,12 +956,12 @@ void SceneViewer::onRelease(const TMouseEvent &event) {
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
bool canonJumpToQuit = false;
#ifdef WITH_CANON
// Stop if we're picking live view for StopMotion
if (StopMotion::instance()->m_canon->m_pickLiveViewZoom) {
if (StopMotion::instance()->isPickLiveViewZoom()) {
canonJumpToQuit = true;
}
#endif
if (canonJumpToQuit) {
doQuit();
return;
@ -1366,41 +1361,38 @@ bool SceneViewer::event(QEvent *e) {
if (e->type() == QEvent::KeyPress) {
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(e);
key = keyEvent->key();
#ifdef WITH_CANON
if ((m_stopMotion->m_canon->m_pickLiveViewZoom ||
m_stopMotion->m_canon->m_zooming) &&
if ((m_stopMotion->isPickLiveViewZoom() ||
m_stopMotion->isZooming()) &&
(key == Qt::Key_Left || key == Qt::Key_Right || key == Qt::Key_Up ||
key == Qt::Key_Down || key == Qt::Key_2 || key == Qt::Key_4 ||
key == Qt::Key_6 || key == Qt::Key_8)) {
if (m_stopMotion->m_canon->m_liveViewZoomReadyToPick == true) {
if (m_stopMotion->isLiveViewZoomReadyToPick()) {
if (key == Qt::Key_Left || key == Qt::Key_4) {
m_stopMotion->m_canon->m_liveViewZoomPickPoint.x -= 10;
m_stopMotion->adjustLiveViewZoomPickPoint(-10, 0);
}
if (key == Qt::Key_Right || key == Qt::Key_6) {
m_stopMotion->m_canon->m_liveViewZoomPickPoint.x += 10;
m_stopMotion->adjustLiveViewZoomPickPoint(10, 0);
}
if (key == Qt::Key_Up || key == Qt::Key_8) {
m_stopMotion->m_canon->m_liveViewZoomPickPoint.y += 10;
m_stopMotion->adjustLiveViewZoomPickPoint(0, 10);
}
if (key == Qt::Key_Down || key == Qt::Key_2) {
m_stopMotion->m_canon->m_liveViewZoomPickPoint.y -= 10;
m_stopMotion->adjustLiveViewZoomPickPoint(0, -10);
}
if (m_stopMotion->m_canon->m_zooming) {
m_stopMotion->m_canon->setZoomPoint();
if (m_stopMotion->isZooming()) {
m_stopMotion->setZoomPoint();
}
}
m_stopMotion->m_canon->calculateZoomPoint();
m_stopMotion->calculateZoomPoint();
e->accept();
return true;
} else if (m_stopMotion->m_canon->m_pickLiveViewZoom &&
} else if (m_stopMotion->isPickLiveViewZoom() &&
(key == Qt::Key_Escape || key == Qt::Key_Enter ||
key == Qt::Key_Return)) {
m_stopMotion->m_canon->toggleZoomPicking();
m_stopMotion->toggleZoomPicking();
e->accept();
return true;
} else
#endif
if (m_stopMotion->m_liveViewStatus == 2 &&
} else if (m_stopMotion->m_liveViewStatus == 2 &&
(key == Qt::Key_Enter || key == Qt::Key_Return)) {
m_stopMotion->captureImage();
e->accept();