Import Upstream version 2.2.5

This commit is contained in:
Lu zhiping 2022-06-27 15:33:12 +08:00
commit 65425af1d8
127 changed files with 83503 additions and 0 deletions

109
AUTHORS Normal file
View File

@ -0,0 +1,109 @@
This is the list of individuals who have contributed to libdc1394.
If your name should have been here please contact the maintainer.
Christophe Achard
AgBr
Amadio Lou
Shane Anderson
Simon Andersson
Peter Antoniac
Samuel Audet
Vladimir Avdonin
D. Bahadir
Alexis Ballier
Matthias Barkhoff
Robin Beitra
Etienne Bieber
Blaise
Argentum Brom
Benedict Brown
Maya Cakmak
Tim Canham
Jim Cassidy
Paul Chavent
Hugo Costelha
danalien
Damien Delannay
Kristoffer Delforge
Dan Dennedy
Salvatore Desiano
Peter De Schrijver
Desmond
Frederic Devernay
Damien Douxchamps
Daniel Drake
Damien Dusha
Irv Elshoff
David Ergo
Tim Evers
Dirk Farin
Chris French
Christoph Ganser
Kero van Gelder
Georg Glock
Andy Gotz
Martin Gramatke
Brant Gurganus
Tony Hague
Matthias Hanel
Robert Harle
Olaf Hering
Kristian Høgsberg
Yves Jaeger
Per Dalgas Jakobsen
Olaf Kaehler
Ferenc Kahlesz
Satofumi Kamimura
Kevin A
Kurt Konolige
Matwey Kornilov
Seemant Kulleen
William Lachance
Phil Lamoreaux
Joshua Lamorie
Aidan Lane
Jeremy Leibs
Rudi Leitgeb
Artem Lenskiy
Mike Lundy
Jason Meltzer
Clement Menier
Li Ming
David Moore
Jack Morisson
Yumi Morita
Mark Munte
Don Murray
Audun Jan Myrhol
Markus Niebel
Obelix
Mikael Olenfalk
Robert Olsen
Yasutoshi Onishi
Thomas Passot
Martin Peris
Alain Perrier
Gord Peters
Rodolphe Pineau
Chris Rankin
Karl Regier
Stefan Richter
Matt Robinson
Diego Ruiz
Johann Schoonees
James Sherman
Jon Schewe
Stian Skjelstad
Fabien Spindler
John Stanley
Alex Stewart
Andrew Straw
Aravind Sundaresan
Toshiyuki Umeda
Chris Urmson
Jarod Wilson
Thomas Woellert
Jonathan Wonders
Daniel Westhoff
Boris Zingerman

504
COPYING Normal file
View File

@ -0,0 +1,504 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 (C) <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 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!

1896
ChangeLog Normal file

File diff suppressed because it is too large Load Diff

1304
Doxyfile.in Normal file

File diff suppressed because it is too large Load Diff

370
INSTALL Normal file
View File

@ -0,0 +1,370 @@
Installation Instructions
*************************
Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without warranty of any kind.
Basic Installation
==================
Briefly, the shell command `./configure && make && make install'
should configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package. Some packages provide this
`INSTALL' file but do not implement all of the features documented
below. The lack of an optional feature in a given package is not
necessarily a bug. More recommendations for GNU packages can be found
in *note Makefile Conventions: (standards)Makefile Conventions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You need `configure.ac' if
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
Running `configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package, generally using the just-built uninstalled binaries.
4. Type `make install' to install the programs and any data files and
documentation. When installing into a prefix owned by root, it is
recommended that the package be configured and built as a regular
user, and only the `make install' phase executed with root
privileges.
5. Optionally, type `make installcheck' to repeat any self-tests, but
this time using the binaries in their final installed location.
This target does not install anything. Running this target as a
regular user, particularly if the prior `make install' required
root privileges, verifies that the installation completed
correctly.
6. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
7. Often, you can also type `make uninstall' to remove the installed
files again. In practice, not all packages have tested that
uninstallation works correctly, even though it is required by the
GNU Coding Standards.
8. Some packages, particularly those that use Automake, provide `make
distcheck', which can by used by developers to test that all other
targets like `make install' and `make uninstall' work correctly.
This target is generally not run by end users.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. Run `./configure --help'
for details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'. This
is known as a "VPATH" build.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
installed the package for one architecture, use `make distclean' before
reconfiguring for another architecture.
On MacOS X 10.5 and later systems, you can create libraries and
executables that work on multiple system types--known as "fat" or
"universal" binaries--by specifying multiple `-arch' options to the
compiler but only a single `-arch' option to the preprocessor. Like
this:
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CPP="gcc -E" CXXCPP="g++ -E"
This is not guaranteed to produce working output in all cases, you
may have to build one architecture at a time and combine the results
using the `lipo' tool if you have problems.
Installation Names
==================
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX', where PREFIX must be an
absolute file name.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them. In general, the
default for these options is expressed in terms of `${prefix}', so that
specifying just `--prefix' will affect all of the other directory
specifications that were not explicitly provided.
The most portable way to affect installation locations is to pass the
correct locations to `configure'; however, many packages provide one or
both of the following shortcuts of passing variable assignments to the
`make install' command line to change installation locations without
having to reconfigure or recompile.
The first method involves providing an override variable for each
affected directory. For example, `make install
prefix=/alternate/directory' will choose an alternate location for all
directory configuration variables that were expressed in terms of
`${prefix}'. Any directories that were specified during `configure',
but not in terms of `${prefix}', must each be overridden at install
time for the entire installation to be relocated. The approach of
makefile variable overrides for each directory variable is required by
the GNU Coding Standards, and ideally causes no recompilation.
However, some platforms have known limitations with the semantics of
shared libraries that end up requiring recompilation when using this
method, particularly noticeable in packages that use GNU Libtool.
The second method involves providing the `DESTDIR' variable. For
example, `make install DESTDIR=/alternate/directory' will prepend
`/alternate/directory' before all installation names. The approach of
`DESTDIR' overrides is not required by the GNU Coding Standards, and
does not work on platforms that have drive letters. On the other hand,
it does better at avoiding recompilation issues, and works well even
when some directory options were not specified in terms of `${prefix}'
at `configure' time.
Optional Features
=================
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Some packages offer the ability to configure how verbose the
execution of `make' will be. For these packages, running `./configure
--enable-silent-rules' sets the default to minimal output, which can be
overridden with `make V=1'; while running `./configure
--disable-silent-rules' sets the default to verbose, which can be
overridden with `make V=0'.
Particular systems
==================
On HP-UX, the default C compiler is not ANSI C compatible. If GNU
CC is not installed, it is recommended to use the following options in
order to use an ANSI C compiler:
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
HP-UX `make' updates targets which have the same time stamps as
their prerequisites, which makes it generally unusable when shipped
generated files such as `configure' are involved. Use GNU `make'
instead.
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
a workaround. If GNU CC is not installed, it is therefore recommended
to try
./configure CC="cc"
and if that doesn't work, try
./configure CC="cc -nodtk"
On Solaris, don't put `/usr/ucb' early in your `PATH'. This
directory contains several dysfunctional programs; working variants of
these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
in your `PATH', put it _after_ `/usr/bin'.
On Haiku, software installed for all users goes in `/boot/common',
not `/usr/local'. It is recommended to use the following options:
./configure --prefix=/boot/common
Specifying the System Type
==========================
There may be some features `configure' cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
_same_ architectures, `configure' can figure that out, but if it prints
a message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS
KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf limitation. Until the limitation is lifted, you can use
this workaround:
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
`configure' recognizes the following options to control how it
operates.
`--help'
`-h'
Print a summary of all of the options to `configure', and exit.
`--help=short'
`--help=recursive'
Print a summary of the options unique to this package's
`configure', and exit. The `short' variant lists options used
only in the top level, while the `recursive' variant lists options
also present in any nested packages.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--prefix=DIR'
Use DIR as the installation prefix. *note Installation Names::
for more details, including other options available for fine-tuning
the installation locations.
`--no-create'
`-n'
Run the configure checks, but stop before creating any output
files.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

125
INSTALL-windows Normal file
View File

@ -0,0 +1,125 @@
Installation instructions for the Windows platform
---------------------------------------------------
(Note: this could go in the main INSTALL file)
The instructions are rather long; they detail what I had to go through
install libdc1394. It's not very difficult though. If you have
problems or comments about these instructions, please contact the
mailing list libdc1394-devel@lists.sf.net. The mailing list is
private, but you can send messages even if you are not a member; you
will just have to wait for moderation on your first message.
0. Unplug all 1394 cameras on your system.
Windows tries to be smart but more often than not it isn't. Don't give
it something to chew on ;)
1. Install MinGW and Msys
Use the project's installer to install both MinGW and Msys
http://sourceforge.net/projects/mingw/files/Installer/mingw-get/
2. CMU driver installation
This windows version of libdc1394 uses the CMU 1394 driver at its
core. For this reason you should first download and install this
driver.
** Attention: if you have a Point Grey driver installed on your
computer (FlyCapture,...), you should first remove it
thouroughly. Verify after its removal that the camera is not
recognized as a Point Grey camera anymore, but as an "Imaging
Device" (in the device manager). Any attempt to use the CMU driver
and/or libdc1394 will fail if Windows is still complaining about
the missing "pgrcam.sys" file, among others. Verify that no file in
windows/inf/ refers to pgrcam.sys and check the following
directories for PGR files: /Windows/System32/drivers,
/Windows/System32/DRVSTORE and /Windows/System32/ReinstallBackups.
Editing the registry may be necessary too (augh!).
Get the CMU driver at http://www.cs.cmu.edu/~iwan/1394/
We recommend you use the installer "1394camera646-unsigned.exe", as
this is the version on which this library is based.
After the installer has run, you may need to tell Windows to use the
CMU driver. Plug a camera, verify that the CMU demo app sees it and
that you can get a live feed. If not, go to the hardware manager and
check the driver status of your camera. If drivers are not attached to
it, you must use the "have disk" option and point Windows to the
location of the INF file, normally c:\Program Files\CMU\1394Camera
\Driver. Don't let Windows look for drivers on its own. After you have
confirmed that the drivers used by the camera are the CMU drivers,
re-test using the CMU demo app.
Note 1: in the CMU demo app, you need to reset the camera before you
can control it.
Note 2: the CMU app sometimes fails to start a Format_7 stream. I
recommend that you start by selecting a standard video mode
(e.g. 640x480 MONO)
Note 3: on 64bit systems, the CMU driver is installed in c:\Program
Files (x86)\CMU\1394Camera\Driver (note the extra "(x86)")
Once the CMU stuff is working fine, run the Msys shell and copy the
library files and headers to your mingw system:
cp /Program\ Files/CMU/1394Camera/lib/1394camera.lib /mingw/lib/lib1394camera.a
cp /Program\ Files/CMU/1394Camera/include/1394camapi.h /mingw/include/
cp /Program\ Files/CMU/1394Camera/include/1394common.h /mingw/include/
Tip 1: Use slashes ("/") when working in Msys, not backslashes ("\")
Tip 2: Installation should be done in the /mingw directory, NOT the
msys directory.
3. SDL installation (optional)
A new example program is being used to test the windows platform:
dc1394_iso. This program requires SDL, so if you want to compile it
you should install SDL first.
Get SDL at http://www.libsdl.org/release/SDL-1.2.14.tar.gz
Don't use 1.2.15, the files are buggy (this may have been fixed
recently). Put the tarball in your Msys home, usually something like
c:/mingw/msys/1.0/home/<username>/
tar -xvzf SDL-1.2.14.tar.gz
cd SDL-1.2.14
./configure --prefix=/mingw/
make
make install
4. libdc1394 (at last!)
If you reed this, you already have the tarball or GIT snapshot. Put it
alongside the SDL library in your Msys home directory (see above), and
again:
tar -xvzf libdc1394.tar.gz
cd libdc1394
./configure --prefix=/mingw/
make
make install
To test the library, run dc1394_iso.exe. If your camera does not
support the modes hardcoded in that example, you may need to adjust
some #define statements in dc1394_iso.c
Note: when using Msys, stderr is not dumped on the terminal but in a
file. If you run the example from the directory of its location, the
output file should be ./.libs/stderr.txt
If you get a nice live video, congratulations! If not, please contact
the mailing list (libdc1394-devel@lists.sf.net).
Damien & Satofumi

17
Makefile.am Normal file
View File

@ -0,0 +1,17 @@
# process this file with automake to create a Makefile.in
SUBDIRS = dc1394
if MAKE_EXAMPLES
SUBDIRS += examples
endif
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure config.h.in \
stamp-h.in
EXTRA_DIST = libdc1394-2.pc.in Doxyfile.in INSTALL-windows README-windows
# Doxygen part
MOSTLYCLEANFILES = $(DX_CLEANFILES)
include $(top_srcdir)/aminclude.am
# pkg-config part
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libdc1394-2.pc

1063
Makefile.in Normal file

File diff suppressed because it is too large Load Diff

167
NEWS Normal file
View File

@ -0,0 +1,167 @@
Release information and news:
-----------------------------
-- 2.2.5
- Improve thread-safty of capture stop/dequeue functions.
-- 2.2.4
- Add USB IDs for some Point Grey cameras
- Re-activate the EdgeSense debayering algorithm (patent has expired)
- USB-captured frames now have a valid timestamp
- Look for USB enpoints on all interfaces
-- 2.2.3
- Add USB IDs for some Point Grey cameras
-- 2.2.1
- all files are now under the LGPL2 license
- Don't expose internal symbols
- Randomize read/write retry times on all platforms (use DC1394_SLOW_DOWN)
- Minor bug fixes
- Support POLL and WAIT capture on Windows.
-- 2.2.0
- Bug fixes:
- minor memory leak in Juju
- New Windows stack
- Add two USB cameras from Point Grey
-- 2.1.4
- Bug fixes:
- Allow image buffers to be editable by client apps on Linux juju
- Correct error in downsample bayer function
- Rename poorly named externally-visible symbol usb_init
- Fix misc. compilation errors
-- 2.1.3:
- Bug fixes:
- Fix for usb writes larger than 1 quadlet
- On MAC OS, add needed frameworks to link line
- Update firewire-{cdev,constants}.h to latest version and license
- Change dequeue/enqueue to return error code if usb transfer has error
- dc1394/conversions.h: Fix typo in DC1394_STEREO_METHOD_MIN define
-- 2.1.2:
- Fix broken ABI caused by new Format7 modes in release 2.1.1.
Reverted for now.
-- 2.1.1:
- New features on Juju platform:
- Added timestamp support and implemented dc1394_read_cycle_timer
function (requires kernel 2.6.24+).
- Implemented dc1394_camera_set_broadcast, dc1394_camera_get_broadcast,
and automatic isochronous channel/bandwidth allocation (requires
kernel 2.6.30+).
- New features for all platforms:
- Added new Format7 modes for IIDC 1.32
- Added missing documentation
- Bug fixes:
- Fix missing frames on Juju when host controller is OHCI 1.0
and packets-per-frame is not a multiple of 8.
- Fix wrong return value of dc1394_deinterlace_stereo_frames
- Fixed bad initializations and build options (from Mike Lundy)
- More robust /dev/fw* detection (from Stefan Richter)
- Fixed memory allocation in AdaptBuffer functions (from Damien Dusha)
-- 2.1.0:
- New features:
- USB support for Point Grey Chameleon and Firefly MV
- Platform selection at run-time instead of compile-time (juju, linux,
etc.)
- Bug fixes:
- Correct some bad math in the bayer conversion functions
- Juju: Retry busy transactions
- Linux: Remove bad includes from headers
-- 2.0.3:
- Bug fixes:
- Crash on Mac OS 10.4
- Bad data in mixed x86_64/i386 environments with Juju
- Wrong return value from dc1394_trigger_get_polarity()
- Incomplete results from dc1394_deinterlace_stereo_frames()
- Compilation fixes when downloading from SVN
-- 2.0.2:
- New functions on all platforms:
dc1394_camera_get_node
dc1394_capture_is_frame_corrupt
- New function on Linux video1394 only:
dc1394_camera_get_linux_port
- New example program to capture PVN sequences.
- Bug fixes on Linux Juju:
- Better retry timeouts
- Fix manual isochronous channel allocation
- Bug fixes on Mac OS:
- Auto detection of bad or skipped packets (used for
dc1394_capture_is_frame_corrupt)
- Bug fixes on Linux video1394:
- Fix select() with multiple cameras on the same controller
- Handle EINTR return code properly in dc1394_capture_dequeue
- Better error detection if camera enumeration fails
- Documentation improvements
-- 2.0.1:
- Fixed broken dc1394/dc1394.h include file when compiling externally.
- Fix iSight camera under Mac OS X.
- Removed the "edge-sense" bayer demosaic algorithm out of patent concern.
-- 2.0.0: THE release, ready for distribution. Documentation is still
missing, but will eventually be completed.
-- (various RCs): many interface changes
-- 2.0.0-rc6:
Yes, more changes. We are waiting for one last big change before the
release of 2.0.0 so this may be the last RC.
-- 2.0.0-rc5:
More interface changes, PIO support, cleanup and fixes.
-- 2.0.0-rc4:
Intermediate release that includes a.o. the new capture API, better
support for AVT cameras, conversion functions that work on the new
video buffer struct, etc...
-- 2.0.0-rc3:
The major addition of this version is the compatibility with Mac OSX
(Yeah!) There's a bunch of fixes and additions here and there too.
-- 2.0.0-rc2:
Fixed serious problems in the camera detection
-- 2.0.0-rc1:
This is the first RC release. Enjoy or send bug reports to the list.
-- 2.0.0-pre7:
Many significant changes.
-- 2.0.0-pre6:
Don't package anything before a final release (or at least a release
candidate), _please_. These PRE versions have an API that will change
and are not suitable for packages. This should be the last PRE release.
If there is no problem with it we will switch to release candidates (RC)
soon.
-- 2.0.0-pre5:
The development continues... Besides bug fixes, the most notable
improvement is the capture structure that is now hidden in the camera
struct.
-- 2.0.0-pre4:
bug fixes
-- 2.0.0-pre3:
This release appears to be fully functional. It can be used but has not
been extensively tested.
-- 2.0.0-pre2:
Same warning as pre1
-- 2.0.0-pre1:
A lot of changes, see the changelog for more details. This version breaks
almost all compatibility with the main trunk. Known not to work properly.
You have been warned ;-) This is just a CVS snapshot of the Version_2_0
branch.
(Older news about versions 0.x and 1.x of the library can be found in the
respective 0.x and 1.x packages)

75
README Normal file
View File

@ -0,0 +1,75 @@
1394-Based Digital Camera Control Library
=========================================
1. About the 1394-Based Digital Camera Control Library
This library provides functionality to control any camera that conforms to the
1394-Based Digital Camera Specification written by the 1394 Trade Association
(http://www.1394ta.com). The specs can be downloaded for free here:
http://damien.douxchamps.net/ieee1394/libdc1394/iidc_specifications.php.
On Linux, Libdc1394 utilizes the lowlevel functionality provided by libraw1394
to communicate with the camera. When compiled for the legacy Linux stack,
Libdc1394 also uses the video1394 kernel module for the DMA capture of the
video flow.
The library is originally designed to work on Linux and was ported to OSX by
David Moore in 2006. A Windows version is in the works.
2. Copyleft
The 1394-Based Digital Camera Control Library is licensed under the Lesser
General Public License (short LGPL, see file COPYING in the source
distribution). Other files in the source archives not belonging to but being
part of the build procedure of libraw1394 are under their own licenses, as
stated at the top of the individual files.
3. API documentation
A basic description of each function can be found on libdc1394 website:
http://damien.douxchamps.net/ieee1394/libdc1394/ You can also find information
for all functions in the various header files dc1394/*.h. There are sample
programs in the examples/ directory which can be helpful for learning. For a
more comprehensive demonstration of the features of libdc1394, review the
Coriander application source code, available at
http://damien.douxchamps.net/ieee1394/coriander/ or read the IIDC
specifications.
4. Maintainer
The maintainer of the 1394-Based Digital Camera Control Library is currently
Damien Douxchamps. Send suggestions, bug reports and fixes to the mailing
list libdc1394-devel@lists.sf.net. Subscription to the list is encouraged, but
not necessary (non-subscribers are moderated). See the file AUTHORS for a
complete list of contributors.
5. Quick installation guide
To compile and install libdc1394 from a release tarball simply do the
following:
./configure
make
make install
Obviously, you need to be root when executing the last statement if you wish to
do a system-wide installation. To compile and install libdc1394 from a git
source tree do the following:
autoreconf -i -s
./configure
make
make install
Details on getting a source tree from the git repository is beyond the scope of
this small readme but the following command should give you the latest trunk:
git clone git://libdc1394.git.sourceforge.net/gitroot/libdc1394/libdc1394
--
2000-01-13 Gord Peters
2008-01-05 Damien Douxchamps

15
README-windows Normal file
View File

@ -0,0 +1,15 @@
This implementation uses a library of CMU 1394 Digital Camera Library.
http://www.cs.cmu.edu/~iwan/1394/
This implementation is tested on MinGW (mingw-get-inst-20110802.exe)
Known limitations:
- a lot of functionalities are untested. Please participate in the
effort and report bugs on the mailing list libdc1394-devel@lists.sf.net.
- the timestamps normally available in each dc1394video_frame_t are
NULL on windows. The CMU driver does not return this information
yet, because they have problem to get it from the Windows kernel
(google/grep for DESCRIPTOR_TIME_STAMP_ON_COMPLETION).

468
acinclude.m4 Normal file
View File

@ -0,0 +1,468 @@
# This file is part of Autoconf. -*- Autoconf -*-
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
#
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
# ----------------------------------
AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=m4_default([$1], [0.9.0])
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
fi[]dnl
])# PKG_PROG_PKG_CONFIG
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
#
# Check to see whether a particular set of modules exists. Similar
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
#
#
# Similar to PKG_CHECK_MODULES, make sure that the first instance of
# this or PKG_CHECK_MODULES is called, or make sure to call
# PKG_CHECK_EXISTS manually
# --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_EXISTS],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
if test -n "$PKG_CONFIG" && \
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
m4_ifval([$2], [$2], [:])
m4_ifvaln([$3], [else
$3])dnl
fi])
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
# ---------------------------------------------
m4_define([_PKG_CONFIG],
[if test -n "$$1"; then
pkg_cv_[]$1="$$1"
elif test -n "$PKG_CONFIG"; then
PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
[pkg_failed=yes])
else
pkg_failed=untried
fi[]dnl
])# _PKG_CONFIG
# _PKG_SHORT_ERRORS_SUPPORTED
# -----------------------------
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi[]dnl
])# _PKG_SHORT_ERRORS_SUPPORTED
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
# [ACTION-IF-NOT-FOUND])
#
#
# Note that if there is a possibility the first call to
# PKG_CHECK_MODULES might not happen, you should be sure to include an
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
#
#
# --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_MODULES],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no
AC_MSG_CHECKING([for $1])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
else
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
ifelse([$4], , [AC_MSG_ERROR(dnl
[Package requirements ($2) were not met:
$$1_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
_PKG_TEXT
])],
[AC_MSG_RESULT([no])
$4])
elif test $pkg_failed = untried; then
ifelse([$4], , [AC_MSG_FAILURE(dnl
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
_PKG_TEXT
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
[$4])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes])
ifelse([$3], , :, [$3])
fi[]dnl
])# PKG_CHECK_MODULES
# Copyright (C) 2004 Oren Ben-Kiki
# This file is distributed under the same terms as the Autoconf macro files.
# Generate automatic documentation using Doxygen. Works in concert with the
# aminclude.m4 file and a compatible doxygen configuration file. Defines the
# following public macros:
#
# DX_???_FEATURE(ON|OFF) - control the default setting fo a Doxygen feature.
# Supported features are 'DOXYGEN' itself, 'DOT' for generating graphics,
# 'HTML' for plain HTML, 'CHM' for compressed HTML help (for MS users), 'CHI'
# for generating a seperate .chi file by the .chm file, and 'MAN', 'RTF',
# 'XML', 'PDF' and 'PS' for the appropriate output formats. The environment
# variable DOXYGEN_PAPER_SIZE may be specified to override the default 'a4wide'
# paper size.
#
# By default, HTML, PDF and PS documentation is generated as this seems to be
# the most popular and portable combination. MAN pages created by Doxygen are
# usually problematic, though by picking an appropriate subset and doing some
# massaging they might be better than nothing. CHM and RTF are specific for MS
# (note that you can't generate both HTML and CHM at the same time). The XML is
# rather useless unless you apply specialized post-processing to it.
#
# The macro mainly controls the default state of the feature. The use can
# override the default by specifying --enable or --disable. The macros ensure
# that contradictory flags are not given (e.g., --enable-doxygen-html and
# --enable-doxygen-chm, --enable-doxygen-anything with --disable-doxygen, etc.)
# Finally, each feature will be automatically disabled (with a warning) if the
# required programs are missing.
#
# Once all the feature defaults have been specified, call DX_INIT_DOXYGEN with
# the following parameters: a one-word name for the project for use as a
# filename base etc., an optional configuration file name (the default is
# 'Doxyfile', the same as Doxygen's default), and an optional output directory
# name (the default is 'doxygen-doc').
## ----------##
## Defaults. ##
## ----------##
DX_ENV=""
AC_DEFUN([DX_FEATURE_doc], ON)
AC_DEFUN([DX_FEATURE_dot], OFF)
AC_DEFUN([DX_FEATURE_man], OFF)
AC_DEFUN([DX_FEATURE_html], OFF)
AC_DEFUN([DX_FEATURE_chm], OFF)
AC_DEFUN([DX_FEATURE_chi], OFF)
AC_DEFUN([DX_FEATURE_rtf], OFF)
AC_DEFUN([DX_FEATURE_xml], OFF)
AC_DEFUN([DX_FEATURE_pdf], OFF)
AC_DEFUN([DX_FEATURE_ps], OFF)
## --------------- ##
## Private macros. ##
## --------------- ##
# DX_ENV_APPEND(VARIABLE, VALUE)
# ------------------------------
# Append VARIABLE="VALUE" to DX_ENV for invoking doxygen.
AC_DEFUN([DX_ENV_APPEND], [AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])])
# DX_DIRNAME_EXPR
# ---------------
# Expand into a shell expression prints the directory part of a path.
AC_DEFUN([DX_DIRNAME_EXPR],
[[expr ".$1" : '\(\.\)[^/]*$' \| "x$1" : 'x\(.*\)/[^/]*$']])
# DX_IF_FEATURE(FEATURE, IF-ON, IF-OFF)
# -------------------------------------
# Expands according to the M4 (static) status of the feature.
AC_DEFUN([DX_IF_FEATURE], [ifelse(DX_FEATURE_$1, ON, [$2], [$3])])
# DX_REQUIRE_PROG(VARIABLE, PROGRAM)
# ----------------------------------
# Require the specified program to be found for the DX_CURRENT_FEATURE to work.
AC_DEFUN([DX_REQUIRE_PROG], [
AC_PATH_TOOL([$1], [$2])
if test "$DX_FLAG_[]DX_CURRENT_FEATURE$$1" = 1; then
AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION])
AC_SUBST([DX_FLAG_]DX_CURRENT_FEATURE, 0)
fi
])
# DX_TEST_FEATURE(FEATURE)
# ------------------------
# Expand to a shell expression testing whether the feature is active.
AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1])
# DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE)
# -------------------------------------------------
# Verify that a required features has the right state before trying to turn on
# the DX_CURRENT_FEATURE.
AC_DEFUN([DX_CHECK_DEPEND], [
test "$DX_FLAG_$1" = "$2" \
|| AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1,
requires, contradicts) doxygen-DX_CURRENT_FEATURE])
])
# DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE)
# ----------------------------------------------------------
# Turn off the DX_CURRENT_FEATURE if the required feature is off.
AC_DEFUN([DX_CLEAR_DEPEND], [
test "$DX_FLAG_$1" = "$2" || AC_SUBST([DX_FLAG_]DX_CURRENT_FEATURE, 0)
])
# DX_FEATURE_ARG(FEATURE, DESCRIPTION,
# CHECK_DEPEND, CLEAR_DEPEND,
# REQUIRE, DO-IF-ON, DO-IF-OFF)
# --------------------------------------------
# Parse the command-line option controlling a feature. CHECK_DEPEND is called
# if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND),
# otherwise CLEAR_DEPEND is called to turn off the default state if a required
# feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional
# requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and
# DO-IF-ON or DO-IF-OFF are called according to the final state of the feature.
AC_DEFUN([DX_ARG_ABLE], [
AC_DEFUN([DX_CURRENT_FEATURE], [$1])
AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2])
AC_ARG_ENABLE(doxygen-$1,
[AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1],
[--enable-doxygen-$1]),
DX_IF_FEATURE([$1], [don't $2], [$2]))],
[
case "$enableval" in
#(
y|Y|yes|Yes|YES)
AC_SUBST([DX_FLAG_$1], 1)
$3
;; #(
n|N|no|No|NO)
AC_SUBST([DX_FLAG_$1], 0)
;; #(
*)
AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1])
;;
esac
], [
AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)])
$4
])
if DX_TEST_FEATURE([$1]); then
$5
:
fi
if DX_TEST_FEATURE([$1]); then
AM_CONDITIONAL(DX_COND_$1, :)
$6
:
else
AM_CONDITIONAL(DX_COND_$1, false)
$7
:
fi
])
## -------------- ##
## Public macros. ##
## -------------- ##
# DX_XXX_FEATURE(DEFAULT_STATE)
# -----------------------------
AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([doc], [$1])])
AC_DEFUN([DX_MAN_FEATURE], [AC_DEFUN([DX_FEATURE_man], [$1])])
AC_DEFUN([DX_HTML_FEATURE], [AC_DEFUN([DX_FEATURE_html], [$1])])
AC_DEFUN([DX_CHM_FEATURE], [AC_DEFUN([DX_FEATURE_chm], [$1])])
AC_DEFUN([DX_CHI_FEATURE], [AC_DEFUN([DX_FEATURE_chi], [$1])])
AC_DEFUN([DX_RTF_FEATURE], [AC_DEFUN([DX_FEATURE_rtf], [$1])])
AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])])
AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])])
AC_DEFUN([DX_PDF_FEATURE], [AC_DEFUN([DX_FEATURE_pdf], [$1])])
AC_DEFUN([DX_PS_FEATURE], [AC_DEFUN([DX_FEATURE_ps], [$1])])
# DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR])
# ---------------------------------------------------------
# PROJECT also serves as the base name for the documentation files.
# The default CONFIG-FILE is "Doxyfile" and OUTPUT-DOC-DIR is "doc".
AC_DEFUN([DX_INIT_DOXYGEN], [
# Files:
AC_SUBST([DX_PROJECT], [$1])
AC_SUBST([DX_CONFIG], [ifelse([$2], [], Doxyfile, [$2])])
AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doc, [$3])])
# Environment variables used inside Doxyfile.in:
DX_ENV_APPEND(SRCDIR, $srcdir)
DX_ENV_APPEND(PROJECT, $DX_PROJECT)
DX_ENV_APPEND(DOCDIR, $DX_DOCDIR)
DX_ENV_APPEND(VERSION, $PACKAGE_VERSION)
# Doxygen itself:
DX_ARG_ABLE(doc, [generate any doxygen documentation (requires doxygen package)],
[],
[],
[DX_REQUIRE_PROG([DX_DOXYGEN], doxygen)
DX_REQUIRE_PROG([DX_PERL], perl)],
[DX_ENV_APPEND(PERL_PATH, $DX_PERL)])
# Dot for graphics:
DX_ARG_ABLE(dot, [generate graphics for doxygen documentation (requires doxygen package)],
[DX_CHECK_DEPEND(doc, 1)],
[DX_CLEAR_DEPEND(doc, 1)],
[DX_REQUIRE_PROG([DX_DOT], dot)],
[DX_ENV_APPEND(HAVE_DOT, YES)
DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])],
[DX_ENV_APPEND(HAVE_DOT, NO)])
# Man pages generation:
DX_ARG_ABLE(man, [generate doxygen manual pages (requires doxygen package)],
[DX_CHECK_DEPEND(doc, 1)],
[DX_CLEAR_DEPEND(doc, 1)],
[],
[DX_ENV_APPEND(GENERATE_MAN, YES)],
[DX_ENV_APPEND(GENERATE_MAN, NO)])
# RTF file generation:
DX_ARG_ABLE(rtf, [generate doxygen RTF documentation (requires doxygen package)],
[DX_CHECK_DEPEND(doc, 1)],
[DX_CLEAR_DEPEND(doc, 1)],
[],
[DX_ENV_APPEND(GENERATE_RTF, YES)],
[DX_ENV_APPEND(GENERATE_RTF, NO)])
# XML file generation:
DX_ARG_ABLE(xml, [generate doxygen XML documentation (requires doxygen package)],
[DX_CHECK_DEPEND(doc, 1)],
[DX_CLEAR_DEPEND(doc, 1)],
[],
[DX_ENV_APPEND(GENERATE_XML, YES)],
[DX_ENV_APPEND(GENERATE_XML, NO)])
# (Compressed) HTML help generation:
DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation (requires doxygen package)],
[DX_CHECK_DEPEND(doc, 1)],
[DX_CLEAR_DEPEND(doc, 1)],
[DX_REQUIRE_PROG([DX_HHC], hhc)],
[DX_ENV_APPEND(HHC_PATH, $DX_HHC)
DX_ENV_APPEND(GENERATE_HTML, YES)
DX_ENV_APPEND(GENERATE_HTMLHELP, YES)],
[DX_ENV_APPEND(GENERATE_HTMLHELP, NO)])
# Seperate CHI file generation.
DX_ARG_ABLE(chi, [generate doxygen seperate compressed HTML help index file (requires doxygen package)],
[DX_CHECK_DEPEND(chm, 1)],
[DX_CLEAR_DEPEND(chm, 1)],
[],
[DX_ENV_APPEND(GENERATE_CHI, YES)],
[DX_ENV_APPEND(GENERATE_CHI, NO)])
# Plain HTML pages generation:
DX_ARG_ABLE(html, [generate doxygen plain HTML documentation (requires doxygen package)],
[DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)],
[DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)],
[],
[DX_ENV_APPEND(GENERATE_HTML, YES)],
[DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)])
# PostScript file generation:
DX_ARG_ABLE(ps, [generate doxygen PostScript documentation (requires doxygen and latex packages)],
[DX_CHECK_DEPEND(doc, 1)],
[DX_CLEAR_DEPEND(doc, 1)],
[DX_REQUIRE_PROG([DX_LATEX], latex)
DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
DX_REQUIRE_PROG([DX_DVIPS], dvips)
DX_REQUIRE_PROG([DX_EGREP], egrep)])
# PDF file generation:
DX_ARG_ABLE(pdf, [generate doxygen PDF documentation (requires doxygen and pdflatex packages)],
[DX_CHECK_DEPEND(doc, 1)],
[DX_CLEAR_DEPEND(doc, 1)],
[DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex)
DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
DX_REQUIRE_PROG([DX_EGREP], egrep)])
# LaTeX generation for PS and/or PDF:
if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then
AM_CONDITIONAL(DX_COND_latex, :)
DX_ENV_APPEND(GENERATE_LATEX, YES)
else
AM_CONDITIONAL(DX_COND_latex, false)
DX_ENV_APPEND(GENERATE_LATEX, NO)
fi
# Paper size for PS and/or PDF:
AC_ARG_VAR(DOXYGEN_PAPER_SIZE,
[a4wide (default), a4, letter, legal or executive])
case "$DOXYGEN_PAPER_SIZE" in
#(
"")
AC_SUBST(DOXYGEN_PAPER_SIZE, "")
;; #(
a4wide|a4|letter|legal|executive)
DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE)
;; #(
*)
AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE'])
;;
esac
#For debugging:
#echo DX_FLAG_doc=$DX_FLAG_doc
#echo DX_FLAG_dot=$DX_FLAG_dot
#echo DX_FLAG_man=$DX_FLAG_man
#echo DX_FLAG_html=$DX_FLAG_html
#echo DX_FLAG_chm=$DX_FLAG_chm
#echo DX_FLAG_chi=$DX_FLAG_chi
#echo DX_FLAG_rtf=$DX_FLAG_rtf
#echo DX_FLAG_xml=$DX_FLAG_xml
#echo DX_FLAG_pdf=$DX_FLAG_pdf
#echo DX_FLAG_ps=$DX_FLAG_ps
#echo DX_ENV=$DX_ENV
])

1401
aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

183
aminclude.am Normal file
View File

@ -0,0 +1,183 @@
# Copyright (C) 2004 Oren Ben-Kiki
# This file is distributed under the same terms as the Automake macro files.
# Generate automatic documentation using Doxygen. Goals and variables values
# are controlled by the various DX_COND_??? conditionals set by autoconf.
#
# The provided goals are:
# doc: Generate all doxygen documentation.
# doxygen-run: Run doxygen, which will generate some of the documentation
# (HTML, CHM, CHI, MAN, RTF, XML) but will not do the post
# processing required for the rest of it (PS, PDF, and some MAN).
# doxygen-man: Rename some doxygen generated man pages.
# doxygen-ps: Generate doxygen PostScript documentation.
# doxygen-pdf: Generate doxygen PDF documentation.
#
# Note that by default these are not integrated into the automake goals. If
# doxygen is used to generate man pages, you can achieve this integration by
# setting man3_MANS to the list of man pages generated and then adding the
# dependency:
#
# $(man3_MANS): doc
#
# This will cause make to run doxygen and generate all the documentation.
#
# The following variable is intended for use in Makefile.am:
#
# DX_CLEANFILES = everything to clean.
#
# This is usually added to MOSTLYCLEANFILES.
## --------------------------------- ##
## Format-independent Doxygen rules. ##
## --------------------------------- ##
if DX_COND_doc
## ------------------------------- ##
## Rules specific for HTML output. ##
## ------------------------------- ##
if DX_COND_html
DX_CLEAN_HTML = @DX_DOCDIR@/html
endif DX_COND_html
## ------------------------------ ##
## Rules specific for CHM output. ##
## ------------------------------ ##
if DX_COND_chm
DX_CLEAN_CHM = @DX_DOCDIR@/chm
if DX_COND_chi
DX_CLEAN_CHI = @DX_DOCDIR@/@PACKAGE@.chi
endif DX_COND_chi
endif DX_COND_chm
## ------------------------------ ##
## Rules specific for MAN output. ##
## ------------------------------ ##
if DX_COND_man
DX_CLEAN_MAN = @DX_DOCDIR@/man
DX_MANS = $(DX_CLEAN_MAN)/man3
man3_MANS = $(DX_MANS)/control.h.3 $(DX_MANS)/conversions.h.3 \
$(DX_MANS)/register.h.3 $(DX_MANS)/utils.h.3
$(man3_MANS): doc
endif DX_COND_man
## ------------------------------ ##
## Rules specific for RTF output. ##
## ------------------------------ ##
if DX_COND_rtf
DX_CLEAN_RTF = @DX_DOCDIR@/rtf
endif DX_COND_rtf
## ------------------------------ ##
## Rules specific for XML output. ##
## ------------------------------ ##
if DX_COND_xml
DX_CLEAN_XML = @DX_DOCDIR@/xml
endif DX_COND_xml
## ----------------------------- ##
## Rules specific for PS output. ##
## ----------------------------- ##
if DX_COND_ps
DX_CLEAN_PS = @DX_DOCDIR@/@PACKAGE@.ps
DX_PS_GOAL = doxygen-ps
doxygen-ps: @DX_DOCDIR@/@PACKAGE@.ps
@DX_DOCDIR@/@PACKAGE@.ps: @DX_DOCDIR@/@PACKAGE@.tag
cd @DX_DOCDIR@/latex; \
rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
$(DX_LATEX) refman.tex; \
$(MAKEINDEX_PATH) refman.idx; \
$(DX_LATEX) refman.tex; \
countdown=5; \
while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
refman.log > /dev/null 2>&1 \
&& test $$countdown -gt 0; do \
$(DX_LATEX) refman.tex; \
countdown=`expr $$countdown - 1`; \
done; \
$(DX_DVIPS) -o ../@PACKAGE@.ps refman.dvi
endif DX_COND_ps
## ------------------------------ ##
## Rules specific for PDF output. ##
## ------------------------------ ##
if DX_COND_pdf
DX_CLEAN_PDF = @DX_DOCDIR@/@PACKAGE@.pdf
DX_PDF_GOAL = doxygen-pdf
doxygen-pdf: @DX_DOCDIR@/@PACKAGE@.pdf
@DX_DOCDIR@/@PACKAGE@.pdf: @DX_DOCDIR@/@PACKAGE@.tag
cd @DX_DOCDIR@/latex; \
rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
$(DX_PDFLATEX) refman.tex; \
$(DX_MAKEINDEX) refman.idx; \
$(DX_PDFLATEX) refman.tex; \
countdown=5; \
while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
refman.log > /dev/null 2>&1 \
&& test $$countdown -gt 0; do \
$(DX_PDFLATEX) refman.tex; \
countdown=`expr $$countdown - 1`; \
done; \
mv refman.pdf ../@PACKAGE@.pdf
endif DX_COND_pdf
## ------------------------------------------------- ##
## Rules specific for LaTeX (shared for PS and PDF). ##
## ------------------------------------------------- ##
if DX_COND_latex
DX_CLEAN_LATEX = @DX_DOCDIR@/latex
endif DX_COND_latex
.PHONY: doxygen-run doc $(DX_PS_GOAL) $(DX_PDF_GOAL)
.INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
doxygen-run: @DX_DOCDIR@/@PACKAGE@.tag
doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
@DX_DOCDIR@/@PACKAGE@.tag: $(DX_CONFIG) $(pkginclude_HEADERS)
rm -rf @DX_DOCDIR@
$(DX_ENV) $(DX_DOXYGEN) $(srcdir)/$(DX_CONFIG)
DX_CLEANFILES = \
@DX_DOCDIR@/@PACKAGE@.tag \
-r $(DX_CLEAN_HTML) $(DX_CLEAN_CHM) $(DX_CLEAN_CHI) $(DX_CLEAN_MAN) \
$(DX_CLEAN_RTF) $(DX_CLEAN_XML) $(DX_CLEAN_PS) $(DX_CLEAN_PDF) \
$(DX_CLEAN_LATEX) $(DX_DOCDIR)
endif DX_COND_doc

270
ar-lib Executable file
View File

@ -0,0 +1,270 @@
#! /bin/sh
# Wrapper for Microsoft lib.exe
me=ar-lib
scriptversion=2012-03-01.08; # UTC
# Copyright (C) 2010-2013 Free Software Foundation, Inc.
# Written by Peter Rosin <peda@lysator.liu.se>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
# func_error message
func_error ()
{
echo "$me: $1" 1>&2
exit 1
}
file_conv=
# func_file_conv build_file
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv in
mingw)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin)
file=`cygpath -m "$file" || echo "$file"`
;;
wine)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_at_file at_file operation archive
# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE
# for each of them.
# When interpreting the content of the @FILE, do NOT use func_file_conv,
# since the user would need to supply preconverted file names to
# binutils ar, at least for MinGW.
func_at_file ()
{
operation=$2
archive=$3
at_file_contents=`cat "$1"`
eval set x "$at_file_contents"
shift
for member
do
$AR -NOLOGO $operation:"$member" "$archive" || exit $?
done
}
case $1 in
'')
func_error "no command. Try '$0 --help' for more information."
;;
-h | --h*)
cat <<EOF
Usage: $me [--help] [--version] PROGRAM ACTION ARCHIVE [MEMBER...]
Members may be specified in a file named with @FILE.
EOF
exit $?
;;
-v | --v*)
echo "$me, version $scriptversion"
exit $?
;;
esac
if test $# -lt 3; then
func_error "you must specify a program, an action and an archive"
fi
AR=$1
shift
while :
do
if test $# -lt 2; then
func_error "you must specify a program, an action and an archive"
fi
case $1 in
-lib | -LIB \
| -ltcg | -LTCG \
| -machine* | -MACHINE* \
| -subsystem* | -SUBSYSTEM* \
| -verbose | -VERBOSE \
| -wx* | -WX* )
AR="$AR $1"
shift
;;
*)
action=$1
shift
break
;;
esac
done
orig_archive=$1
shift
func_file_conv "$orig_archive"
archive=$file
# strip leading dash in $action
action=${action#-}
delete=
extract=
list=
quick=
replace=
index=
create=
while test -n "$action"
do
case $action in
d*) delete=yes ;;
x*) extract=yes ;;
t*) list=yes ;;
q*) quick=yes ;;
r*) replace=yes ;;
s*) index=yes ;;
S*) ;; # the index is always updated implicitly
c*) create=yes ;;
u*) ;; # TODO: don't ignore the update modifier
v*) ;; # TODO: don't ignore the verbose modifier
*)
func_error "unknown action specified"
;;
esac
action=${action#?}
done
case $delete$extract$list$quick$replace,$index in
yes,* | ,yes)
;;
yesyes*)
func_error "more than one action specified"
;;
*)
func_error "no action specified"
;;
esac
if test -n "$delete"; then
if test ! -f "$orig_archive"; then
func_error "archive not found"
fi
for member
do
case $1 in
@*)
func_at_file "${1#@}" -REMOVE "$archive"
;;
*)
func_file_conv "$1"
$AR -NOLOGO -REMOVE:"$file" "$archive" || exit $?
;;
esac
done
elif test -n "$extract"; then
if test ! -f "$orig_archive"; then
func_error "archive not found"
fi
if test $# -gt 0; then
for member
do
case $1 in
@*)
func_at_file "${1#@}" -EXTRACT "$archive"
;;
*)
func_file_conv "$1"
$AR -NOLOGO -EXTRACT:"$file" "$archive" || exit $?
;;
esac
done
else
$AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
do
$AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
done
fi
elif test -n "$quick$replace"; then
if test ! -f "$orig_archive"; then
if test -z "$create"; then
echo "$me: creating $orig_archive"
fi
orig_archive=
else
orig_archive=$archive
fi
for member
do
case $1 in
@*)
func_file_conv "${1#@}"
set x "$@" "@$file"
;;
*)
func_file_conv "$1"
set x "$@" "$file"
;;
esac
shift
shift
done
if test -n "$orig_archive"; then
$AR -NOLOGO -OUT:"$archive" "$orig_archive" "$@" || exit $?
else
$AR -NOLOGO -OUT:"$archive" "$@" || exit $?
fi
elif test -n "$list"; then
if test ! -f "$orig_archive"; then
func_error "archive not found"
fi
$AR -NOLOGO -LIST "$archive" || exit $?
fi

27
ax_check_framework.m4 Normal file
View File

@ -0,0 +1,27 @@
# Macro to test for OS X Frameworks.
# Taken from: http://lists.apple.com/archives/unix-porting/2009/Jan/msg00029.html
# Retrieved on 24-10-2013.
# Original Author: Peter O'Gorman.
#
# Example Usage:
# AX_CHECK_FRAMEWORK([IOKit])
# Defines:
# HAVE_FRAMEWORK_IOKIT in config.h
# And substitutes in your Makefiles.
# FRAMEWORK_IOKIT="-framework IOKit"
m4_defun([AX_CHECK_FRAMEWORK],
[AC_CACHE_CHECK([if -framework ]$1[ works],[my_cv_framework_]$1,
[save_LIBS="$LIBS"
LIBS="$LIBS -framework ]$1["
AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
[my_cv_framework_]$1[=yes],
[my_cv_framework_]$1[=no])
])
LIBS="$save_LIBS"
if test "$my_cv_framework_]$1["="yes"; then
AC_DEFINE(AS_TR_CPP([HAVE_FRAMEWORK_]$1),1,
[Define if you have the ] $1 [ framework])
AS_TR_CPP([FRAMEWORK_]$1)="-framework ]$1["
AC_SUBST([FRAMEWORK_]AS_TR_CPP($1))
fi])

347
compile Executable file
View File

@ -0,0 +1,347 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

1558
config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

130
config.h.in Normal file
View File

@ -0,0 +1,130 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the IOKit framework */
#undef HAVE_FRAMEWORK_IOKIT
/* Define to 1 if you have the `getpagesize' function. */
#undef HAVE_GETPAGESIZE
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Defined if lib1394camera present */
#undef HAVE_LIB1394CAMERA
/* Defined if libraw1394 is present */
#undef HAVE_LIBRAW1394
/* SDL library */
#undef HAVE_LIBSDL
/* Defined if libusb is present */
#undef HAVE_LIBUSB
/* Defined if compiled for Linux */
#undef HAVE_LINUX
/* Defined if IOKit framework is present */
#undef HAVE_MACOSX
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* OpenGL library */
#undef HAVE_OPENGL
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define to 1 if you have the <sys/mman.h> header file. */
#undef HAVE_SYS_MMAN_H
/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Defined if compiled for Windows */
#undef HAVE_WINDOWS
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
/* Define to 1 if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING
/* Define to the equivalent of the C99 'restrict' keyword, or to
nothing if this is not supported. Do not define if restrict is
supported directly. */
#undef restrict
/* Work around a bug in Sun C++: it does not support _Restrict or
__restrict__, even though the corresponding Sun C compiler ends up with
"#define restrict _Restrict" or "#define restrict __restrict__" in the
previous line. Perhaps some future version of Sun C++ will work with
restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
#if defined __SUNPRO_CC && !defined __RESTRICT
# define _Restrict
# define __restrict__
#endif
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t

1791
config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

19223
configure vendored Executable file

File diff suppressed because it is too large Load Diff

236
configure.ac Normal file
View File

@ -0,0 +1,236 @@
# process this file with autoconf to get a configure script
AC_PREREQ([2.6.0])
AC_INIT([libdc1394],[2.2.5],[libdc1394-devel@lists.sf.net])
AC_CONFIG_SRCDIR([dc1394/control.c])
AC_CONFIG_MACRO_DIR([m4])
m4_include([ax_check_framework.m4])
AC_CANONICAL_SYSTEM
case "$host" in
*-*-cygwin* | *-*-mingw*)
AC_LIBTOOL_WIN32_DLL
;;
esac
#
DX_HTML_FEATURE(OFF)
DX_CHM_FEATURE(OFF)
DX_CHI_FEATURE(OFF)
DX_MAN_FEATURE(OFF)
DX_RTF_FEATURE(OFF)
DX_XML_FEATURE(OFF)
DX_PDF_FEATURE(OFF)
DX_PS_FEATURE(OFF)
#
DX_INIT_DOXYGEN([libdc1394], [Doxyfile.in])
#
AM_PROG_AR
AM_INIT_AUTOMAKE([--warnings=all 1.9.6])
AC_CONFIG_HEADERS([config.h])
AC_PROG_CC
AC_PROG_LIBTOOL
AM_PROG_CC_C_O
PKG_PROG_PKG_CONFIG
# check if the 'restrict' prefix is supported
AC_C_RESTRICT
AC_CHECK_LIB(m, pow, [ LIBS="-lm $LIBS" ], [])
PKG_CHECK_MODULES(LIBUSB, [libusb-1.0],
[AC_DEFINE(HAVE_LIBUSB,[],[Defined if libusb is present])],
[AC_MSG_WARN([libusb-1.0 not found])])
MIN_SDL_VERSION=1.2.4
AH_TEMPLATE(HAVE_LIBSDL, [SDL library])
AM_PATH_SDL($MIN_SDL_VERSION, [AC_DEFINE(HAVE_LIBSDL) HAVE_LIBSDL="yes"])
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)
case "$host" in
*-*-linux*)
have_linux=true
AC_DEFINE(HAVE_LINUX,[],[Defined if compiled for Linux])
# Check for the new version of libraw1394 first since they might have both
# installed and we want to use the newest version
AC_CHECK_LIB(raw1394, raw1394_channel_modify,
[AC_DEFINE(HAVE_LIBRAW1394,[],[Defined if libraw1394 is present]) libraw1394=true],
[AC_MSG_WARN(libraw1394 not found or too old. Please upgrade to 1.2.0 or a more recent version.)])
;;
*-*-darwin*)
AX_CHECK_FRAMEWORK([IOKit])
if test x$my_cv_framework_IOKit = xyes; then
AC_DEFINE(HAVE_MACOSX,[],[Defined if IOKit framework is present])
have_macosx=true
fi
platform_LDFLAGS="-framework CoreServices -framework CoreFoundation -framework IOKit"
AC_SUBST(platform_LDFLAGS)
;;
*-*-cygwin* | *-*-mingw*)
have_windows=true
AC_DEFINE(HAVE_WINDOWS,[],[Defined if compiled for Windows])
AC_CHECK_LIB(1394camera, GetCmdrVersion,
[AC_DEFINE(HAVE_LIB1394CAMERA,[],[Defined if lib1394camera present]) lib1394camera=true],
[AC_MSG_ERROR(lib1394camera not found or too old. Please upgrade to 6.4.5 or a more recent version.)])
platform_LDFLAGS="-Wl,--export-all -no-undefined -l1394camera -lsetupapi -lws2_32"
AC_SUBST(platform_LDFLAGS)
;;
esac
AH_TEMPLATE(HAVE_OPENGL, [OpenGL library])
case "$host" in
*-*-linux* | *-*-darwin*)
AC_CHECK_LIB(GL, main, [AC_DEFINE(HAVE_OPENGL) have_opengl="yes"])
;;
*-*-cygwin* | *-*-mingw*)
AC_CHECK_LIB(opengl32, main, [AC_DEFINE(HAVE_OPENGL) have_opengl="yes"])
;;
esac
AM_CONDITIONAL(HAVE_LINUX, test x$have_linux = xtrue)
AM_CONDITIONAL(HAVE_MACOSX, test x$have_macosx = xtrue)
AM_CONDITIONAL(HAVE_WINDOWS, test x$have_windows = xtrue)
AM_CONDITIONAL(HAVE_LIBRAW1394, test x$libraw1394 = xtrue)
AM_CONDITIONAL(HAVE_LIBUSB, test "x$LIBUSB_LIBS" != "x")
AM_CONDITIONAL(HAVE_LIBSDL, test "x$SDL_LIBS" != "x")
AM_CONDITIONAL(HAVE_OPENGL, test "x$have_opengl" != "x")
AC_CHECK_HEADER([linux/videodev.h], [have_videodev=true])
AM_CONDITIONAL(HAVE_VIDEODEV, test x$have_videodev = xtrue)
AC_ARG_ENABLE([examples], [AS_HELP_STRING([--disable-examples], [don't build example programs])], [build_examples=$enableval], [build_examples=true])
AM_CONDITIONAL(MAKE_EXAMPLES, test x$build_examples = xtrue)
# check for Xv extensions (necessary for examples/dc1394_multiview)
# imported from Coriander
AC_DEFUN([AC_CHECK_XV],[
AC_SUBST(XV_CFLAGS)
AC_SUBST(XV_LIBS)
AC_MSG_CHECKING(for Xv extensions)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <X11/Xlib.h>
#include <X11/extensions/Xvlib.h>]], [[
int main(void) { (void) XvGetPortAttribute(0, 0, 0, 0); return 0; }
]])],[xv=yes],[xv=no])
AC_MSG_RESULT($xv)
if test x$xv = xyes; then
XV_LIBS="-lXv -lXext"
XV_CFLAGS=""
fi
AM_CONDITIONAL(HAVE_XV, test x$xv = xyes)
])
AC_CHECK_XV
AC_HEADER_STDC
AC_CHECK_HEADERS(stdint.h fcntl.h sys/ioctl.h unistd.h sys/mman.h netinet/in.h)
AC_PATH_XTRA
AC_TYPE_SIZE_T
AC_FUNC_MMAP
dnl ---------------------------------------------------------------------------
dnl When making a release:
dnl 1. If the library source code has changed at all since the last release,
dnl then increment REVISION.
dnl 2. If the interface (ABI) has been modified since the last release,
dnl increment CURRENT, and set REVISION to 0.
dnl 3. If the interface changes consist solely of additions, increment AGE.
dnl 4. If the interface has removed or changed elements, set AGE to 0.
dnl ---------------------------------------------------------------------------
lt_current=24
lt_revision=1
lt_age=2
AC_SUBST(lt_current)
AC_SUBST(lt_revision)
AC_SUBST(lt_age)
pkgincludedir='$(includedir)/dc1394'
AC_SUBST(pkgincludedir)
dnl AX_CFLAGS_WARN_ALL(CFLAGS)
CFLAGS="-Wall -Wunused -std=gnu99 $CFLAGS"
dnl for pedantic compilation, try to add "-pedantic" to the above string
AC_CONFIG_FILES([ \
Makefile \
libdc1394-2.pc \
dc1394/Makefile \
dc1394/linux/Makefile \
dc1394/juju/Makefile \
dc1394/macosx/Makefile \
dc1394/windows/Makefile \
dc1394/usb/Makefile \
dc1394/vendor/Makefile \
examples/Makefile \
])
AC_OUTPUT
LINUXMSG="Disabled (Linux not detected)"
RAW1394MSG="Disabled (libraw1394 not found)"
MACOSXMSG="Disabled (Mac OS not detected)"
WINDOWSMSG="Disabled (Windows not detected)"
USBMSG="Disabled (libusb-1.0 not found)"
if test x$have_linux = xtrue; then
if test x$libraw1394 = xtrue; then
RAW1394MSG="Enabled"
fi
LINUXMSG="Enabled"
fi
if test x$have_macosx = xtrue; then
MACOSXMSG="Enabled"
fi
if test x$have_windows = xtrue; then
WINDOWSMSG="Enabled"
fi
if test "x$LIBUSB_LIBS" != "x"; then
USBMSG="Enabled"
fi
EXAMPLESMSG="No"
SDLEXAMPLESMSG="No"
XVEXAMPLESMSG="No"
VIDEXAMPLESMSG="No"
if test x$build_examples = xtrue; then
EXAMPLESMSG="Yes"
if test x$have_opengl = xyes; then
if test "x$SDL_LIBS" != "x"; then
SDLEXAMPLESMSG="Yes"
fi
fi
if test x$xv = xyes; then
XVEXAMPLESMSG="Yes"
fi
if test x$have_videodev = xtrue; then
VIDEXAMPLESMSG="Yes"
fi
fi
echo "
Configuration (libdc1394):
Linux support: ${LINUXMSG}"
if test "x$LINUXMSG" = "xEnabled"; then
echo " Legacy drivers (libraw1394): ${RAW1394MSG}"
fi
echo " Mac OS X support: ${MACOSXMSG}
Windows support: ${WINDOWSMSG}
IIDC-over-USB support: ${USBMSG}
Build examples: ${EXAMPLESMSG}"
if test "x$EXAMPLESMSG" = xYes; then
echo " Build SDL/OpenGL examples: ${SDLEXAMPLESMSG}
Build XV examples: ${XVEXAMPLESMSG}
Build V4L examples: ${VIDEXAMPLESMSG}"
fi
dnl extra newline:
echo ""

75
dc1394/Makefile.am Normal file
View File

@ -0,0 +1,75 @@
MAINTAINERCLEANFILES = Makefile.in
lib_LTLIBRARIES = libdc1394.la
SUBDIRS = linux juju macosx windows usb vendor
AM_CFLAGS = $(platform_CFLAGS) -I$(top_srcdir)
libdc1394_la_LDFLAGS = $(platform_LDFLAGS) \
-version-info @lt_current@:@lt_revision@:@lt_age@ \
-export-symbols-regex '^dc1394_'
libdc1394_la_SOURCES = \
control.c \
control.h \
enumeration.c \
platform.h \
capture.c \
offsets.h \
format7.c \
register.c \
register.h \
utils.c \
utils.h \
internal.c \
internal.h \
conversions.c \
conversions.h \
bayer.c \
log.c \
log.h \
iso.c \
iso.h
if HAVE_LINUX
if HAVE_LIBRAW1394
LINUX_LIBADD = linux/libdc1394-linux.la
endif
JUJU_LIBADD = juju/libdc1394-juju.la
endif
if HAVE_MACOSX
libdc1394_la_SOURCES += macosx.c
MACOSX_LIBADD = macosx/libdc1394-macosx.la
endif
if HAVE_WINDOWS
WINDOWS_LIBADD = windows/libdc1394-windows.la
endif
if HAVE_LIBUSB
USB_LIBADD = usb/libdc1394-usb.la
endif
libdc1394_la_LIBADD = \
$(LINUX_LIBADD) \
$(JUJU_LIBADD) \
$(MACOSX_LIBADD) \
$(WINDOWS_LIBADD) \
$(USB_LIBADD) \
vendor/libdc1394-vendor.la
# headers to be installed
pkginclude_HEADERS = \
dc1394.h \
types.h \
camera.h \
control.h \
capture.h \
video.h \
format7.h \
utils.h \
conversions.h \
register.h \
log.h \
iso.h
if HAVE_MACOSX
pkginclude_HEADERS += macosx.h
endif

872
dc1394/Makefile.in Normal file
View File

@ -0,0 +1,872 @@
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
@HAVE_MACOSX_TRUE@am__append_1 = macosx.c
@HAVE_MACOSX_TRUE@am__append_2 = macosx.h
subdir = dc1394
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp $(am__pkginclude_HEADERS_DIST)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/ax_check_framework.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgincludedir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libdc1394_la_DEPENDENCIES = $(LINUX_LIBADD) $(JUJU_LIBADD) \
$(MACOSX_LIBADD) $(WINDOWS_LIBADD) $(USB_LIBADD) \
vendor/libdc1394-vendor.la
am__libdc1394_la_SOURCES_DIST = control.c control.h enumeration.c \
platform.h capture.c offsets.h format7.c register.c register.h \
utils.c utils.h internal.c internal.h conversions.c \
conversions.h bayer.c log.c log.h iso.c iso.h macosx.c
@HAVE_MACOSX_TRUE@am__objects_1 = macosx.lo
am_libdc1394_la_OBJECTS = control.lo enumeration.lo capture.lo \
format7.lo register.lo utils.lo internal.lo conversions.lo \
bayer.lo log.lo iso.lo $(am__objects_1)
libdc1394_la_OBJECTS = $(am_libdc1394_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
libdc1394_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(libdc1394_la_LDFLAGS) $(LDFLAGS) -o $@
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(libdc1394_la_SOURCES)
DIST_SOURCES = $(am__libdc1394_la_SOURCES_DIST)
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
install-data-recursive install-dvi-recursive \
install-exec-recursive install-html-recursive \
install-info-recursive install-pdf-recursive \
install-ps-recursive install-recursive installcheck-recursive \
installdirs-recursive pdf-recursive ps-recursive \
tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__pkginclude_HEADERS_DIST = dc1394.h types.h camera.h control.h \
capture.h video.h format7.h utils.h conversions.h register.h \
log.h iso.h macosx.h
HEADERS = $(pkginclude_HEADERS)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
am__recursive_targets = \
$(RECURSIVE_TARGETS) \
$(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
distdir
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
pkgincludedir = @pkgincludedir@
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
DX_CONFIG = @DX_CONFIG@
DX_DOCDIR = @DX_DOCDIR@
DX_DOT = @DX_DOT@
DX_DOXYGEN = @DX_DOXYGEN@
DX_DVIPS = @DX_DVIPS@
DX_EGREP = @DX_EGREP@
DX_ENV = @DX_ENV@
DX_FLAG_chi = @DX_FLAG_chi@
DX_FLAG_chm = @DX_FLAG_chm@
DX_FLAG_doc = @DX_FLAG_doc@
DX_FLAG_dot = @DX_FLAG_dot@
DX_FLAG_html = @DX_FLAG_html@
DX_FLAG_man = @DX_FLAG_man@
DX_FLAG_pdf = @DX_FLAG_pdf@
DX_FLAG_ps = @DX_FLAG_ps@
DX_FLAG_rtf = @DX_FLAG_rtf@
DX_FLAG_xml = @DX_FLAG_xml@
DX_HHC = @DX_HHC@
DX_LATEX = @DX_LATEX@
DX_MAKEINDEX = @DX_MAKEINDEX@
DX_PDFLATEX = @DX_PDFLATEX@
DX_PERL = @DX_PERL@
DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FRAMEWORK_IOKIT = @FRAMEWORK_IOKIT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
LIBUSB_LIBS = @LIBUSB_LIBS@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
SDL_CONFIG = @SDL_CONFIG@
SDL_LIBS = @SDL_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
XMKMF = @XMKMF@
XV_CFLAGS = @XV_CFLAGS@
XV_LIBS = @XV_LIBS@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_age = @lt_age@
lt_current = @lt_current@
lt_revision = @lt_revision@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
platform_LDFLAGS = @platform_LDFLAGS@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
MAINTAINERCLEANFILES = Makefile.in
lib_LTLIBRARIES = libdc1394.la
SUBDIRS = linux juju macosx windows usb vendor
AM_CFLAGS = $(platform_CFLAGS) -I$(top_srcdir)
libdc1394_la_LDFLAGS = $(platform_LDFLAGS) \
-version-info @lt_current@:@lt_revision@:@lt_age@ \
-export-symbols-regex '^dc1394_'
libdc1394_la_SOURCES = control.c control.h enumeration.c platform.h \
capture.c offsets.h format7.c register.c register.h utils.c \
utils.h internal.c internal.h conversions.c conversions.h \
bayer.c log.c log.h iso.c iso.h $(am__append_1)
@HAVE_LIBRAW1394_TRUE@@HAVE_LINUX_TRUE@LINUX_LIBADD = linux/libdc1394-linux.la
@HAVE_LINUX_TRUE@JUJU_LIBADD = juju/libdc1394-juju.la
@HAVE_MACOSX_TRUE@MACOSX_LIBADD = macosx/libdc1394-macosx.la
@HAVE_WINDOWS_TRUE@WINDOWS_LIBADD = windows/libdc1394-windows.la
@HAVE_LIBUSB_TRUE@USB_LIBADD = usb/libdc1394-usb.la
libdc1394_la_LIBADD = \
$(LINUX_LIBADD) \
$(JUJU_LIBADD) \
$(MACOSX_LIBADD) \
$(WINDOWS_LIBADD) \
$(USB_LIBADD) \
vendor/libdc1394-vendor.la
# headers to be installed
pkginclude_HEADERS = dc1394.h types.h camera.h control.h capture.h \
video.h format7.h utils.h conversions.h register.h log.h iso.h \
$(am__append_2)
all: all-recursive
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu dc1394/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu dc1394/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
list2="$$list2 $$p"; \
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
for p in $$list; do \
$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
libdc1394.la: $(libdc1394_la_OBJECTS) $(libdc1394_la_DEPENDENCIES) $(EXTRA_libdc1394_la_DEPENDENCIES)
$(AM_V_CCLD)$(libdc1394_la_LINK) -rpath $(libdir) $(libdc1394_la_OBJECTS) $(libdc1394_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bayer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/capture.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/control.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conversions.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enumeration.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/format7.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/internal.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/macosx.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/register.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-pkgincludeHEADERS: $(pkginclude_HEADERS)
@$(NORMAL_INSTALL)
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \
$(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
done
uninstall-pkgincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
# This directory's subdirectories are mostly independent; you can cd
# into them and run 'make' without going through this Makefile.
# To change the values of 'make' variables: instead of editing Makefiles,
# (1) if the variable is set in 'config.status', edit 'config.status'
# (which will cause the Makefiles to be regenerated when you run 'make');
# (2) otherwise, pass the desired values on the 'make' command line.
$(am__recursive_targets):
@fail=; \
if $(am__make_keepgoing); then \
failcom='fail=yes'; \
else \
failcom='exit 1'; \
fi; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-recursive
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-recursive
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-recursive
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
$(am__make_dryrun) \
|| test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-recursive
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-recursive
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am: install-pkgincludeHEADERS
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am: install-libLTLIBRARIES
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-libLTLIBRARIES uninstall-pkgincludeHEADERS
.MAKE: $(am__recursive_targets) install-am install-strip
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
check-am clean clean-generic clean-libLTLIBRARIES \
clean-libtool cscopelist-am ctags ctags-am distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am \
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
install-pkgincludeHEADERS install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
uninstall-am uninstall-libLTLIBRARIES \
uninstall-pkgincludeHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

2720
dc1394/bayer.c Normal file

File diff suppressed because it is too large Load Diff

251
dc1394/camera.h Normal file
View File

@ -0,0 +1,251 @@
/*
* 1394-Based Digital Camera Control Library
*
* Written by Damien Douxchamps <ddouxchamps@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.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
*/
#include <dc1394/log.h>
#include <stdio.h>
#ifndef __DC1394_CAMERA_H__
#define __DC1394_CAMERA_H__
/*! \file dc1394/camera.h
\brief Basic system and camera functions
\author Damien Douxchamps: coding
\author Peter Antoniac: documentation maintainer
More details soon
*/
/**
* List of IIDC versions
*
* Currently, the following versions exist: 1.04, 1.20, PTGREY, 1.30 and 1.31 (1.32 coming soon)
* Observing other versions means that there's a bug crawling somewhere.
*/
typedef enum {
DC1394_IIDC_VERSION_1_04 = 544,
DC1394_IIDC_VERSION_1_20,
DC1394_IIDC_VERSION_PTGREY,
DC1394_IIDC_VERSION_1_30,
DC1394_IIDC_VERSION_1_31,
DC1394_IIDC_VERSION_1_32,
DC1394_IIDC_VERSION_1_33,
DC1394_IIDC_VERSION_1_34,
DC1394_IIDC_VERSION_1_35,
DC1394_IIDC_VERSION_1_36,
DC1394_IIDC_VERSION_1_37,
DC1394_IIDC_VERSION_1_38,
DC1394_IIDC_VERSION_1_39
} dc1394iidc_version_t;
#define DC1394_IIDC_VERSION_MIN DC1394_IIDC_VERSION_1_04
#define DC1394_IIDC_VERSION_MAX DC1394_IIDC_VERSION_1_39
#define DC1394_IIDC_VERSION_NUM (DC1394_IIDC_VERSION_MAX - DC1394_IIDC_VERSION_MIN + 1)
/**
* Enumeration of power classes
*
* This is currently not used in libdc1394.
*/
typedef enum {
DC1394_POWER_CLASS_NONE=608,
DC1394_POWER_CLASS_PROV_MIN_15W,
DC1394_POWER_CLASS_PROV_MIN_30W,
DC1394_POWER_CLASS_PROV_MIN_45W,
DC1394_POWER_CLASS_USES_MAX_1W,
DC1394_POWER_CLASS_USES_MAX_3W,
DC1394_POWER_CLASS_USES_MAX_6W,
DC1394_POWER_CLASS_USES_MAX_10W
} dc1394power_class_t;
#define DC1394_POWER_CLASS_MIN DC1394_POWER_CLASS_NONE
#define DC1394_POWER_CLASS_MAX DC1394_POWER_CLASS_USES_MAX_10W
#define DC1394_POWER_CLASS_NUM (DC1394_POWER_CLASS_MAX - DC1394_POWER_CLASS_MIN + 1)
/**
* Enumeration of PHY delays
*
* This is currently not used in libdc1394.
*/
typedef enum {
DC1394_PHY_DELAY_MAX_144_NS=640,
DC1394_PHY_DELAY_UNKNOWN_0,
DC1394_PHY_DELAY_UNKNOWN_1,
DC1394_PHY_DELAY_UNKNOWN_2
} dc1394phy_delay_t;
#define DC1394_PHY_DELAY_MIN DC1394_PHY_DELAY_MAX_144_NS
#define DC1394_PHY_DELAY_MAX DC1394_PHY_DELAY_UNKNOWN_0
#define DC1394_PHY_DELAY_NUM (DC1394_PHY_DELAY_MAX - DC1394_PHY_DELAY_MIN + 1)
/**
* Camera structure
*
* This structure represents the camera in libdc1394. It contains a number of useful static information, such as model/vendor names,
* a few capabilities, some ROM offsets, a unique identifier, etc...
*/
typedef struct __dc1394_camera
{
/* system/firmware information */
uint64_t guid;
int unit;
uint32_t unit_spec_ID;
uint32_t unit_sw_version;
uint32_t unit_sub_sw_version;
uint32_t command_registers_base;
uint32_t unit_directory;
uint32_t unit_dependent_directory;
uint64_t advanced_features_csr;
uint64_t PIO_control_csr;
uint64_t SIO_control_csr;
uint64_t strobe_control_csr;
uint64_t format7_csr[DC1394_VIDEO_MODE_FORMAT7_NUM];
dc1394iidc_version_t iidc_version;
char * vendor;
char * model;
uint32_t vendor_id;
uint32_t model_id;
dc1394bool_t bmode_capable;
dc1394bool_t one_shot_capable;
dc1394bool_t multi_shot_capable;
dc1394bool_t can_switch_on_off;
dc1394bool_t has_vmode_error_status;
dc1394bool_t has_feature_error_status;
int max_mem_channel;
/* not used, for future use: */
uint32_t flags;
} dc1394camera_t;
/**
* A unique identifier for a functional camera unit
*
* Since a single camera can contain several functional units (think stereo cameras), the GUID is not enough to identify an IIDC camera.
* The unit number must also be used, hence this struct.
*/
typedef struct
{
uint16_t unit;
uint64_t guid;
} dc1394camera_id_t;
/**
* A list of cameras
*
* Usually returned by dc1394_camera_eumerate().
*/
typedef struct __dc1394camera_list_t
{
uint32_t num;
dc1394camera_id_t *ids;
} dc1394camera_list_t;
typedef struct __dc1394_t dc1394_t;
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************
General system functions
***************************************************************************/
/**
* Creates a new context in which cameras can be searched and used. This should be called before using any other libdc1394 function.
*/
dc1394_t* dc1394_new (void);
/**
* Liberates a context. Last function to use in your program. After this, no libdc1394 function can be used.
*/
void dc1394_free (dc1394_t *dc1394);
/**
* Sets and gets the broadcast flag of a camera. If the broadcast flag is set,
* all devices on the bus will execute the command. Useful to sync ISO start
* commands or setting a bunch of cameras at the same time. Broadcast only works
* with identical devices (brand/model). If the devices are not identical your
* mileage may vary. Some cameras may not answer broadcast commands at all. Also,
* this only works with cameras on the SAME bus (IOW, the same port).
*/
dc1394error_t dc1394_camera_set_broadcast(dc1394camera_t *camera, dc1394bool_t pwr);
dc1394error_t dc1394_camera_get_broadcast(dc1394camera_t *camera, dc1394bool_t *pwr);
/**
* Resets the IEEE1394 bus which camera is attached to. Calling this function is
* "rude" to other devices because it causes them to re-enumerate on the bus and
* may cause a temporary disruption in their current activities. Thus, use it
* sparingly. Its primary use is if a program shuts down uncleanly and needs to
* free leftover ISO channels or bandwidth. A bus reset will free those things
* as a side effect.
*/
dc1394error_t dc1394_reset_bus(dc1394camera_t *camera);
dc1394error_t dc1394_read_cycle_timer (dc1394camera_t * camera,
uint32_t * cycle_timer, uint64_t * local_time);
/**
* Gets the IEEE 1394 node ID of the camera.
*/
dc1394error_t dc1394_camera_get_node(dc1394camera_t *camera, uint32_t *node,
uint32_t * generation);
/***************************************************************************
Camera functions
***************************************************************************/
/**
* Returns the list of cameras available on the computer. If present, multiple cards will be probed
*/
dc1394error_t dc1394_camera_enumerate(dc1394_t *dc1394, dc1394camera_list_t **list);
/**
* Frees the memory allocated in dc1394_enumerate_cameras for the camera list
*/
void dc1394_camera_free_list(dc1394camera_list_t *list);
/**
* Create a new camera based on a GUID (Global Unique IDentifier)
*/
dc1394camera_t * dc1394_camera_new(dc1394_t *dc1394, uint64_t guid);
/**
* Create a new camera based on a GUID and a unit number (for multi-unit cameras)
*/
dc1394camera_t * dc1394_camera_new_unit(dc1394_t *dc1394, uint64_t guid, int unit);
/**
* Frees a camera structure
*/
void dc1394_camera_free(dc1394camera_t *camera);
/**
* Print various camera information, such as GUID, vendor, model, supported IIDC specs, etc...
*/
dc1394error_t dc1394_camera_print_info(dc1394camera_t *camera, FILE *fd);
/**
* Returns a pointer to a string identifying the platform for the cameras. Platforms strings are:
* juju, linux, macosx, windows, usb
*/
dc1394error_t dc1394_camera_get_platform_string(dc1394camera_t *camera, const char **platform);
#ifdef __cplusplus
}
#endif
#endif

102
dc1394/capture.c Normal file
View File

@ -0,0 +1,102 @@
/*
* 1394-Based Digital Camera Control Library
*
* Written by David Moore <dcm@acm.org>
*
* 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
*/
#include <stdio.h>
#include "control.h"
#include "platform.h"
#include "internal.h"
dc1394error_t
dc1394_capture_setup (dc1394camera_t *camera, uint32_t num_dma_buffers,
uint32_t flags)
{
dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
const platform_dispatch_t * d = cpriv->platform->dispatch;
if (!d->capture_setup)
return DC1394_FUNCTION_NOT_SUPPORTED;
return d->capture_setup (cpriv->pcam, num_dma_buffers, flags);
}
dc1394error_t
dc1394_capture_stop (dc1394camera_t *camera)
{
dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
const platform_dispatch_t * d = cpriv->platform->dispatch;
if (!d->capture_stop)
return DC1394_FUNCTION_NOT_SUPPORTED;
return d->capture_stop (cpriv->pcam);
}
int
dc1394_capture_get_fileno (dc1394camera_t * camera)
{
dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
const platform_dispatch_t * d = cpriv->platform->dispatch;
if (!d->capture_get_fileno)
return DC1394_FUNCTION_NOT_SUPPORTED;
return d->capture_get_fileno (cpriv->pcam);
}
dc1394error_t
dc1394_capture_dequeue (dc1394camera_t * camera, dc1394capture_policy_t policy,
dc1394video_frame_t **frame)
{
dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
const platform_dispatch_t * d = cpriv->platform->dispatch;
if (!d->capture_dequeue)
return DC1394_FUNCTION_NOT_SUPPORTED;
return d->capture_dequeue (cpriv->pcam, policy, frame);
}
dc1394error_t
dc1394_capture_enqueue (dc1394camera_t * camera, dc1394video_frame_t * frame)
{
dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
const platform_dispatch_t * d = cpriv->platform->dispatch;
if (!d->capture_enqueue)
return DC1394_FUNCTION_NOT_SUPPORTED;
return d->capture_enqueue (cpriv->pcam, frame);
}
dc1394bool_t
dc1394_capture_is_frame_corrupt (dc1394camera_t * camera,
dc1394video_frame_t * frame)
{
dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
if (!frame)
return DC1394_TRUE;
const platform_dispatch_t * d = cpriv->platform->dispatch;
if (!d->capture_is_frame_corrupt)
return DC1394_FALSE;
return d->capture_is_frame_corrupt (cpriv->pcam, frame);
}
void
dc1394_capture_set_callback (dc1394camera_t * camera,
dc1394capture_callback_t callback, void * user_data)
{
dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
const platform_dispatch_t * d = cpriv->platform->dispatch;
if (!d->capture_set_callback)
return;
d->capture_set_callback (cpriv->pcam, callback, user_data);
}

120
dc1394/capture.h Normal file
View File

@ -0,0 +1,120 @@
/*
* 1394-Based Digital Camera Control Library
*
* Written by Damien Douxchamps <ddouxchamps@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.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
*/
#include <dc1394/log.h>
#include <dc1394/video.h>
#ifndef __DC1394_CAPTURE_H__
#define __DC1394_CAPTURE_H__
/*! \file dc1394/capture.h
\brief Capture functions
\author Damien Douxchamps: coding
\author Peter Antoniac: documentation maintainer
More details soon
*/
/**
* The capture policy.
*
* Can be blocking (wait for a frame forever) or polling (returns if no frames is in the ring buffer)
*/
typedef enum {
DC1394_CAPTURE_POLICY_WAIT=672,
DC1394_CAPTURE_POLICY_POLL
} dc1394capture_policy_t;
#define DC1394_CAPTURE_POLICY_MIN DC1394_CAPTURE_POLICY_WAIT
#define DC1394_CAPTURE_POLICY_MAX DC1394_CAPTURE_POLICY_POLL
#define DC1394_CAPTURE_POLICY_NUM (DC1394_CAPTURE_POLICY_MAX - DC1394_CAPTURE_POLICY_MIN + 1)
/**
* typedef for the callback param for dc1394_capture_set_callback
*/
typedef void (*dc1394capture_callback_t)(dc1394camera_t *, void *);
/**
* Capture flags. Currently limited to switching automatic functions on/off: channel allocation, bandwidth allocation and automatic
* starting of ISO transmission
*/
#define DC1394_CAPTURE_FLAGS_CHANNEL_ALLOC 0x00000001U
#define DC1394_CAPTURE_FLAGS_BANDWIDTH_ALLOC 0x00000002U
#define DC1394_CAPTURE_FLAGS_DEFAULT 0x00000004U /* a reasonable default value: do bandwidth and channel allocation */
#define DC1394_CAPTURE_FLAGS_AUTO_ISO 0x00000008U /* automatically start iso before capture and stop it after */
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************
Capture Functions
***************************************************************************/
/**
* Setup the capture, using a ring buffer of a certain size (num_dma_buffers) and certain options (flags)
*/
dc1394error_t dc1394_capture_setup(dc1394camera_t *camera, uint32_t num_dma_buffers, uint32_t flags);
/**
* Stop the capture
*/
dc1394error_t dc1394_capture_stop(dc1394camera_t *camera);
/**
* Gets a file descriptor to be used for select(). Must be called after dc1394_capture_setup().
*/
int dc1394_capture_get_fileno (dc1394camera_t * camera);
/**
* Captures a video frame. The returned struct contains the image buffer, among others. This image buffer SHALL NOT be freed, as it represents an area
* in the memory that belongs to the system.
*/
dc1394error_t dc1394_capture_dequeue(dc1394camera_t * camera, dc1394capture_policy_t policy, dc1394video_frame_t **frame);
/**
* Returns a frame to the ring buffer once it has been used.
*/
dc1394error_t dc1394_capture_enqueue(dc1394camera_t * camera, dc1394video_frame_t * frame);
/**
* Returns DC1394_TRUE if the given frame (previously dequeued) has been
* detected to be corrupt (missing data, corrupted data, overrun buffer, etc.).
* Note that certain types of corruption may go undetected in which case
* DC1394_FALSE will be returned. The ability to detect corruption also
* varies between platforms. Note that corrupt frames still need to be
* enqueued with dc1394_capture_enqueue() when no longer needed by the user.
*/
dc1394bool_t dc1394_capture_is_frame_corrupt (dc1394camera_t * camera,
dc1394video_frame_t * frame);
/**
* Set a callback if supported by the platform (OS X only for now).
*/
void dc1394_capture_set_callback (dc1394camera_t * camera,
dc1394capture_callback_t callback, void * user_data);
#ifdef __cplusplus
}
#endif
#endif

2202
dc1394/control.c Normal file

File diff suppressed because it is too large Load Diff

456
dc1394/control.h Normal file
View File

@ -0,0 +1,456 @@
/*
* 1394-Based Digital Camera Control Library
*
* Generic camera control functions
*
* Written by Damien Douxchamps <ddouxchamps@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.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
*/
#include <dc1394/log.h>
#ifndef __DC1394_CONTROL_H__
#define __DC1394_CONTROL_H__
/*! \file dc1394/control.h
\brief Diverse controls of camera features
\author Gord Peters: main writer
\author Chris Urmson: some additions
\author Damien Douxchamps: some additions
\author Peter Antoniac: documentation maintainer
\author Rudolf Leitgeb: documentation writer
This is the main include file of the library. It lists most of the library
functions, enumerations and data structures.
*/
/**
* Enumeration of trigger modes
*/
typedef enum {
DC1394_TRIGGER_MODE_0= 384,
DC1394_TRIGGER_MODE_1,
DC1394_TRIGGER_MODE_2,
DC1394_TRIGGER_MODE_3,
DC1394_TRIGGER_MODE_4,
DC1394_TRIGGER_MODE_5,
DC1394_TRIGGER_MODE_14,
DC1394_TRIGGER_MODE_15
} dc1394trigger_mode_t;
#define DC1394_TRIGGER_MODE_MIN DC1394_TRIGGER_MODE_0
#define DC1394_TRIGGER_MODE_MAX DC1394_TRIGGER_MODE_15
#define DC1394_TRIGGER_MODE_NUM (DC1394_TRIGGER_MODE_MAX - DC1394_TRIGGER_MODE_MIN + 1)
/**
* Enumeration of camera features
*/
typedef enum {
DC1394_FEATURE_BRIGHTNESS= 416,
DC1394_FEATURE_EXPOSURE,
DC1394_FEATURE_SHARPNESS,
DC1394_FEATURE_WHITE_BALANCE,
DC1394_FEATURE_HUE,
DC1394_FEATURE_SATURATION,
DC1394_FEATURE_GAMMA,
DC1394_FEATURE_SHUTTER,
DC1394_FEATURE_GAIN,
DC1394_FEATURE_IRIS,
DC1394_FEATURE_FOCUS,
DC1394_FEATURE_TEMPERATURE,
DC1394_FEATURE_TRIGGER,
DC1394_FEATURE_TRIGGER_DELAY,
DC1394_FEATURE_WHITE_SHADING,
DC1394_FEATURE_FRAME_RATE,
DC1394_FEATURE_ZOOM,
DC1394_FEATURE_PAN,
DC1394_FEATURE_TILT,
DC1394_FEATURE_OPTICAL_FILTER,
DC1394_FEATURE_CAPTURE_SIZE,
DC1394_FEATURE_CAPTURE_QUALITY
} dc1394feature_t;
#define DC1394_FEATURE_MIN DC1394_FEATURE_BRIGHTNESS
#define DC1394_FEATURE_MAX DC1394_FEATURE_CAPTURE_QUALITY
#define DC1394_FEATURE_NUM (DC1394_FEATURE_MAX - DC1394_FEATURE_MIN + 1)
/**
* Enumeration of trigger sources
*/
typedef enum {
DC1394_TRIGGER_SOURCE_0= 576,
DC1394_TRIGGER_SOURCE_1,
DC1394_TRIGGER_SOURCE_2,
DC1394_TRIGGER_SOURCE_3,
DC1394_TRIGGER_SOURCE_SOFTWARE
} dc1394trigger_source_t;
#define DC1394_TRIGGER_SOURCE_MIN DC1394_TRIGGER_SOURCE_0
#define DC1394_TRIGGER_SOURCE_MAX DC1394_TRIGGER_SOURCE_SOFTWARE
#define DC1394_TRIGGER_SOURCE_NUM (DC1394_TRIGGER_SOURCE_MAX - DC1394_TRIGGER_SOURCE_MIN + 1)
/**
* External trigger polarity
*/
typedef enum {
DC1394_TRIGGER_ACTIVE_LOW= 704,
DC1394_TRIGGER_ACTIVE_HIGH
} dc1394trigger_polarity_t;
#define DC1394_TRIGGER_ACTIVE_MIN DC1394_TRIGGER_ACTIVE_LOW
#define DC1394_TRIGGER_ACTIVE_MAX DC1394_TRIGGER_ACTIVE_HIGH
#define DC1394_TRIGGER_ACTIVE_NUM (DC1394_TRIGGER_ACTIVE_MAX - DC1394_TRIGGER_ACTIVE_MIN + 1)
/**
* Control modes for a feature (excl. absolute control)
*/
typedef enum {
DC1394_FEATURE_MODE_MANUAL= 736,
DC1394_FEATURE_MODE_AUTO,
DC1394_FEATURE_MODE_ONE_PUSH_AUTO
} dc1394feature_mode_t;
#define DC1394_FEATURE_MODE_MIN DC1394_FEATURE_MODE_MANUAL
#define DC1394_FEATURE_MODE_MAX DC1394_FEATURE_MODE_ONE_PUSH_AUTO
#define DC1394_FEATURE_MODE_NUM (DC1394_FEATURE_MODE_MAX - DC1394_FEATURE_MODE_MIN + 1)
/**
* List of feature modes
*/
typedef struct
{
uint32_t num;
dc1394feature_mode_t modes[DC1394_FEATURE_MODE_NUM];
} dc1394feature_modes_t;
/**
* List of trigger modes
*/
typedef struct
{
uint32_t num;
dc1394trigger_mode_t modes[DC1394_TRIGGER_MODE_NUM];
} dc1394trigger_modes_t;
/**
* List of trigger sources
*/
typedef struct
{
uint32_t num;
dc1394trigger_source_t sources[DC1394_TRIGGER_SOURCE_NUM];
} dc1394trigger_sources_t;
/**
* A structure containing all information about a feature.
*
* Some fields are only valid for some features (e.g. trigger, white balance,...)
*/
typedef struct __dc1394feature_info_t_struct
{
dc1394feature_t id;
dc1394bool_t available;
dc1394bool_t absolute_capable;
dc1394bool_t readout_capable;
dc1394bool_t on_off_capable;
dc1394bool_t polarity_capable;
dc1394switch_t is_on;
dc1394feature_mode_t current_mode;
dc1394feature_modes_t modes;
dc1394trigger_modes_t trigger_modes;
dc1394trigger_mode_t trigger_mode;
dc1394trigger_polarity_t trigger_polarity;
dc1394trigger_sources_t trigger_sources;
dc1394trigger_source_t trigger_source;
uint32_t min;
uint32_t max;
uint32_t value;
uint32_t BU_value;
uint32_t RV_value;
uint32_t B_value;
uint32_t R_value;
uint32_t G_value;
uint32_t target_value;
dc1394switch_t abs_control;
float abs_value;
float abs_max;
float abs_min;
} dc1394feature_info_t;
/**
* The list of features
*/
typedef struct __dc1394featureset_t
{
dc1394feature_info_t feature[DC1394_FEATURE_NUM];
} dc1394featureset_t;
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************
Features
***************************************************************************/
/**
* Collects the available features for the camera described by node and stores them in features.
*/
dc1394error_t dc1394_feature_get_all(dc1394camera_t *camera, dc1394featureset_t *features);
/**
* Stores the bounds and options associated with the feature described by feature->feature_id
*/
dc1394error_t dc1394_feature_get(dc1394camera_t *camera, dc1394feature_info_t *feature);
/**
* Displays the bounds and options of the given feature
*/
dc1394error_t dc1394_feature_print(dc1394feature_info_t *feature, FILE *fd);
/**
* Displays the bounds and options of every feature supported by the camera
*/
dc1394error_t dc1394_feature_print_all(dc1394featureset_t *features, FILE *fd);
/**
* Gets the whitebalance values
*/
dc1394error_t dc1394_feature_whitebalance_get_value(dc1394camera_t *camera, uint32_t *u_b_value, uint32_t *v_r_value);
/**
* Sets the whitebalance values
*/
dc1394error_t dc1394_feature_whitebalance_set_value(dc1394camera_t *camera, uint32_t u_b_value, uint32_t v_r_value);
/**
* Gets the temperature values (target and current)
*/
dc1394error_t dc1394_feature_temperature_get_value(dc1394camera_t *camera, uint32_t *target_temperature, uint32_t *temperature);
/**
* Sets the temperature values (target only) FIXME: COULD BE DROPPED? already in the standard feature_set_value()?
*/
dc1394error_t dc1394_feature_temperature_set_value(dc1394camera_t *camera, uint32_t target_temperature);
/**
* Gets the white shading values
*/
dc1394error_t dc1394_feature_whiteshading_get_value(dc1394camera_t *camera, uint32_t *r_value, uint32_t *g_value, uint32_t *b_value);
/**
* Sets the white shading values
*/
dc1394error_t dc1394_feature_whiteshading_set_value(dc1394camera_t *camera, uint32_t r_value, uint32_t g_value, uint32_t b_value);
/**
* Gets the value of a feature
*/
dc1394error_t dc1394_feature_get_value(dc1394camera_t *camera, dc1394feature_t feature, uint32_t *value);
/**
* Sets the value of a feature
*/
dc1394error_t dc1394_feature_set_value(dc1394camera_t *camera, dc1394feature_t feature, uint32_t value);
/**
* Tells whether a feature is present or not
*/
dc1394error_t dc1394_feature_is_present(dc1394camera_t *camera, dc1394feature_t feature, dc1394bool_t *value);
/**
* Tells whether a feature is readable or not
*/
dc1394error_t dc1394_feature_is_readable(dc1394camera_t *camera, dc1394feature_t feature, dc1394bool_t *value);
/**
* Gets the boundaries of a feature
*/
dc1394error_t dc1394_feature_get_boundaries(dc1394camera_t *camera, dc1394feature_t feature, uint32_t *min, uint32_t *max);
/**
* Tells whether a feature is switcheable or not (ON/OFF)
*/
dc1394error_t dc1394_feature_is_switchable(dc1394camera_t *camera, dc1394feature_t feature, dc1394bool_t *value);
/**
* Gets the power status of a feature (ON or OFF)
*/
dc1394error_t dc1394_feature_get_power(dc1394camera_t *camera, dc1394feature_t feature, dc1394switch_t *pwr);
/**
* Sets the power status of a feature (ON or OFF)
*/
dc1394error_t dc1394_feature_set_power(dc1394camera_t *camera, dc1394feature_t feature, dc1394switch_t pwr);
/**
* Gets the list of control modes for a feature (manual, auto, etc...)
*/
dc1394error_t dc1394_feature_get_modes(dc1394camera_t *camera, dc1394feature_t feature, dc1394feature_modes_t *modes);
/**
* Gets the current control modes for a feature
*/
dc1394error_t dc1394_feature_get_mode(dc1394camera_t *camera, dc1394feature_t feature, dc1394feature_mode_t *mode);
/**
* Sets the current control modes for a feature
*/
dc1394error_t dc1394_feature_set_mode(dc1394camera_t *camera, dc1394feature_t feature, dc1394feature_mode_t mode);
/**
* Tells whether a feature can be controlled in absolute mode
*/
dc1394error_t dc1394_feature_has_absolute_control(dc1394camera_t *camera, dc1394feature_t feature, dc1394bool_t *value);
/**
* Gets the absolute boundaries of a feature
*/
dc1394error_t dc1394_feature_get_absolute_boundaries(dc1394camera_t *camera, dc1394feature_t feature, float *min, float *max);
/**
* Gets the absolute value of a feature
*/
dc1394error_t dc1394_feature_get_absolute_value(dc1394camera_t *camera, dc1394feature_t feature, float *value);
/**
* Sets the absolute value of a feature
*/
dc1394error_t dc1394_feature_set_absolute_value(dc1394camera_t *camera, dc1394feature_t feature, float value);
/**
* Gets the status of absolute control of a feature
*/
dc1394error_t dc1394_feature_get_absolute_control(dc1394camera_t *camera, dc1394feature_t feature, dc1394switch_t *pwr);
/**
* Sets the feature in absolute control mode (ON/OFF)
*/
dc1394error_t dc1394_feature_set_absolute_control(dc1394camera_t *camera, dc1394feature_t feature, dc1394switch_t pwr);
/***************************************************************************
Trigger
***************************************************************************/
/**
* Sets the polarity of the external trigger
*/
dc1394error_t dc1394_external_trigger_set_polarity(dc1394camera_t *camera, dc1394trigger_polarity_t polarity);
/**
* Gets the polarity of the external trigger
*/
dc1394error_t dc1394_external_trigger_get_polarity(dc1394camera_t *camera, dc1394trigger_polarity_t *polarity);
/**
* Tells whether the external trigger can change its polarity or not.
*/
dc1394error_t dc1394_external_trigger_has_polarity(dc1394camera_t *camera, dc1394bool_t *polarity_capable);
/**
* Switch between internal and external trigger
*/
dc1394error_t dc1394_external_trigger_set_power(dc1394camera_t *camera, dc1394switch_t pwr);
/**
* Gets the status of the external trigger
*/
dc1394error_t dc1394_external_trigger_get_power(dc1394camera_t *camera, dc1394switch_t *pwr);
/**
* Sets the external trigger mode
*/
dc1394error_t dc1394_external_trigger_set_mode(dc1394camera_t *camera, dc1394trigger_mode_t mode);
/**
* Gets the external trigger mode
*/
dc1394error_t dc1394_external_trigger_get_mode(dc1394camera_t *camera, dc1394trigger_mode_t *mode);
/**
* Sets the external trigger source
*/
dc1394error_t dc1394_external_trigger_set_source(dc1394camera_t *camera, dc1394trigger_source_t source);
/**
* Gets the external trigger source
*/
dc1394error_t dc1394_external_trigger_get_source(dc1394camera_t *camera, dc1394trigger_source_t *source);
/**
* Gets the list of available external trigger source
*/
dc1394error_t dc1394_external_trigger_get_supported_sources(dc1394camera_t *camera, dc1394trigger_sources_t *sources);
/**
* Turn software trigger on or off
*/
dc1394error_t dc1394_software_trigger_set_power(dc1394camera_t *camera, dc1394switch_t pwr);
/**
* Gets the state of software trigger
*/
dc1394error_t dc1394_software_trigger_get_power(dc1394camera_t *camera, dc1394switch_t *pwr);
/***************************************************************************
PIO, SIO and Strobe Functions
***************************************************************************/
/**
* Sends a quadlet on the PIO (output)
*/
dc1394error_t dc1394_pio_set(dc1394camera_t *camera, uint32_t value);
/**
* Gets the current quadlet at the PIO (input)
*/
dc1394error_t dc1394_pio_get(dc1394camera_t *camera, uint32_t *value);
/***************************************************************************
Other functionalities
***************************************************************************/
/**
* reset a camera to factory default settings
*/
dc1394error_t dc1394_camera_reset(dc1394camera_t *camera);
/**
* turn a camera on or off
*/
dc1394error_t dc1394_camera_set_power(dc1394camera_t *camera, dc1394switch_t pwr);
/**
* Download a camera setup from the memory.
*/
dc1394error_t dc1394_memory_busy(dc1394camera_t *camera, dc1394bool_t *value);
/**
* Uploads a camera setup in the memory.
*
* Note that this operation can only be performed a certain number of
* times for a given camera, as it requires reprogramming of an EEPROM.
*/
dc1394error_t dc1394_memory_save(dc1394camera_t *camera, uint32_t channel);
/**
* Tells whether the writing of the camera setup in memory is finished or not.
*/
dc1394error_t dc1394_memory_load(dc1394camera_t *camera, uint32_t channel);
#ifdef __cplusplus
}
#endif
#endif /* __DC1394_CONTROL_H__ */

1002
dc1394/conversions.c Normal file

File diff suppressed because it is too large Load Diff

220
dc1394/conversions.h Normal file
View File

@ -0,0 +1,220 @@
/*
* 1394-Based Digital Camera Control Library
*
* Color conversion functions, including Bayer pattern decoding
*
* Written by Damien Douxchamps and Frederic Devernay
*
* 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
*/
#include <dc1394/log.h>
#ifndef __DC1394_CONVERSIONS_H__
#define __DC1394_CONVERSIONS_H__
/*! \file dc1394/conversions.h
\brief functions to convert video formats
\author Damien Douxchamps: coding
\author Frederic Devernay: coding
\author Peter Antoniac: documentation maintainer
More details soon
*/
#define restrict __restrict
/**
* A list of de-mosaicing techniques for Bayer-patterns.
*
* The speed of the techniques can vary greatly, as well as their quality.
*/
typedef enum {
DC1394_BAYER_METHOD_NEAREST=0,
DC1394_BAYER_METHOD_SIMPLE,
DC1394_BAYER_METHOD_BILINEAR,
DC1394_BAYER_METHOD_HQLINEAR,
DC1394_BAYER_METHOD_DOWNSAMPLE,
DC1394_BAYER_METHOD_EDGESENSE,
DC1394_BAYER_METHOD_VNG,
DC1394_BAYER_METHOD_AHD
} dc1394bayer_method_t;
#define DC1394_BAYER_METHOD_MIN DC1394_BAYER_METHOD_NEAREST
#define DC1394_BAYER_METHOD_MAX DC1394_BAYER_METHOD_AHD
#define DC1394_BAYER_METHOD_NUM (DC1394_BAYER_METHOD_MAX-DC1394_BAYER_METHOD_MIN+1)
/**
* A list of known stereo-in-normal-video modes used by manufacturers like Point Grey Research and Videre Design.
*/
typedef enum {
DC1394_STEREO_METHOD_INTERLACED=0,
DC1394_STEREO_METHOD_FIELD
} dc1394stereo_method_t;
#define DC1394_STEREO_METHOD_MIN DC1394_STEREO_METHOD_INTERLACED
#define DC1394_STEREO_METHOD_MAX DC1394_STEREO_METHOD_FIELD
#define DC1394_STEREO_METHOD_NUM (DC1394_STEREO_METHOD_MAX-DC1394_STEREO_METHOD_MIN+1)
// color conversion functions from Bart Nabbe.
// corrected by Damien: bad coeficients in YUV2RGB
#define YUV2RGB(y, u, v, r, g, b) {\
r = y + ((v*1436) >> 10);\
g = y - ((u*352 + v*731) >> 10);\
b = y + ((u*1814) >> 10);\
r = r < 0 ? 0 : r;\
g = g < 0 ? 0 : g;\
b = b < 0 ? 0 : b;\
r = r > 255 ? 255 : r;\
g = g > 255 ? 255 : g;\
b = b > 255 ? 255 : b; }
#define RGB2YUV(r, g, b, y, u, v) {\
y = (306*r + 601*g + 117*b) >> 10;\
u = ((-172*r - 340*g + 512*b) >> 10) + 128;\
v = ((512*r - 429*g - 83*b) >> 10) + 128;\
y = y < 0 ? 0 : y;\
u = u < 0 ? 0 : u;\
v = v < 0 ? 0 : v;\
y = y > 255 ? 255 : y;\
u = u > 255 ? 255 : u;\
v = v > 255 ? 255 : v; }
#ifdef __cplusplus
extern "C" {
#endif
/**********************************************************************
* CONVERSION FUNCTIONS TO YUV422, MONO8 and RGB8
**********************************************************************/
/**
* Converts an image buffer to YUV422
*/
dc1394error_t
dc1394_convert_to_YUV422(uint8_t *src, uint8_t *dest, uint32_t width, uint32_t height, uint32_t byte_order,
dc1394color_coding_t source_coding, uint32_t bits);
/**
* Converts an image buffer to MONO8
*/
dc1394error_t
dc1394_convert_to_MONO8(uint8_t *src, uint8_t *dest, uint32_t width, uint32_t height, uint32_t byte_order,
dc1394color_coding_t source_coding, uint32_t bits);
/**
* Converts an image buffer to RGB8
*/
dc1394error_t
dc1394_convert_to_RGB8(uint8_t *src, uint8_t *dest, uint32_t width, uint32_t height, uint32_t byte_order,
dc1394color_coding_t source_coding, uint32_t bits);
/**********************************************************************
* CONVERSION FUNCTIONS FOR STEREO IMAGES
**********************************************************************/
/**
* changes a 16bit stereo image (8bit/channel) into two 8bit images on top of each other
*/
dc1394error_t
dc1394_deinterlace_stereo(uint8_t *src, uint8_t *dest, uint32_t width, uint32_t height);
/************************************************************************************************
* *
* Color conversion functions for cameras that can output raw Bayer pattern images (color *
* codings DC1394_COLOR_CODING_RAW8 and DC1394_COLOR_CODING_RAW16). *
* *
* Credits and sources: *
* - Nearest Neighbor : OpenCV library *
* - Bilinear : OpenCV library *
* - HQLinear : High-Quality Linear Interpolation For Demosaicing Of Bayer-Patterned *
* Color Images, by Henrique S. Malvar, Li-wei He, and Ross Cutler, *
* in Proceedings of the ICASSP'04 Conference. *
* - Edge Sense II : Laroche, Claude A. "Apparatus and method for adaptively interpolating *
* a full color image utilizing chrominance gradients" *
* U.S. Patent 5,373,322. Based on the code found on the website *
* http://www-ise.stanford.edu/~tingchen/ Converted to C and adapted to *
* all four elementary patterns. *
* - Downsample : "Known to the Ancients" *
* - Simple : Implemented from the information found in the manual of Allied Vision *
* Technologies (AVT) cameras. *
* - VNG : Variable Number of Gradients, a method described in *
* http://www-ise.stanford.edu/~tingchen/algodep/vargra.html *
* Sources import from DCRAW by Frederic Devernay. DCRAW is a RAW *
* converter program by Dave Coffin. URL: *
* http://www.cybercom.net/~dcoffin/dcraw/ *
* - AHD : Adaptive Homogeneity-Directed Demosaicing Algorithm, by K. Hirakawa *
* and T.W. Parks, IEEE Transactions on Image Processing, Vol. 14, Nr. 3, *
* March 2005, pp. 360 - 369. *
* *
************************************************************************************************/
/**
* Perform de-mosaicing on an 8-bit image buffer
*/
dc1394error_t
dc1394_bayer_decoding_8bit(const uint8_t *bayer, uint8_t *rgb,
uint32_t width, uint32_t height, dc1394color_filter_t tile,
dc1394bayer_method_t method);
/**
* Perform de-mosaicing on an 16-bit image buffer
*/
dc1394error_t
dc1394_bayer_decoding_16bit(const uint16_t *bayer, uint16_t *rgb,
uint32_t width, uint32_t height, dc1394color_filter_t tile,
dc1394bayer_method_t method, uint32_t bits);
/**********************************************************************************
* Frame based conversions
**********************************************************************************/
/**
* Converts the format of a video frame.
*
* To set the format of the output, simply set the values of the corresponding fields in the output frame
*/
dc1394error_t
dc1394_convert_frames(dc1394video_frame_t *in, dc1394video_frame_t *out);
/**
* De-mosaicing of a Bayer-encoded video frame
*
* To set the format of the output, simply set the values of the corresponding fields in the output frame
* @param in is a pointer to the bayer video frame that is to be converted
* @param out is a pointer to the frame to be converted to. If there is memory allocated to the image field,
* then it will be adjusted accordingly by this function. If there is no memory allocated to the image
* field, then ensure that out->image == NULL and out->allocated_image_bytes == 0
* @param method is the bayer method to interpolate the frame.
*/
dc1394error_t
dc1394_debayer_frames(dc1394video_frame_t *in, dc1394video_frame_t *out, dc1394bayer_method_t method);
/**
* De-interlacing of stereo data for cideo frames
*
* To set the format of the output, simply set the values of the corresponding fields in the output frame
*/
dc1394error_t
dc1394_deinterlace_stereo_frames(dc1394video_frame_t *in, dc1394video_frame_t *out, dc1394stereo_method_t method);
#ifdef __cplusplus
}
#endif
#endif /* _DC1394_CONVERSIONS_H */

57
dc1394/dc1394.h Normal file
View File

@ -0,0 +1,57 @@
/*
* 1394-Based Digital Camera Control Library
*
* Written by
* Gord Peters <GordPeters@smarttech.com>,
* Chris Urmson <curmson@ri.cmu.edu>
* Damien Douxchamps <ddouxchamps@users.sf.net>
* Dan Dennedy <ddennedy@users.sf.net>
* David Moore <dcm@acm.org>
* ... and many ohters (see the AUTHORS file)
*
* Copyright (C) 2000-2001 SMART Technologies Inc.
* Copyright (C) 2001-2004 Universite catholique de Louvain
* Copyright (C) 2000 Carnegie Mellon University
* Copyright (C) 2006- Massachussets Institute of Technology
* Copyright (C) 2004- Nara Institute of Science and Technology
* All files are also Copyright (C) their respective author(s)
*
* 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
*/
#ifndef __DC1394_H__
#define __DC1394_H__
/*! \file dc1394/dc1394.h
\brief Main include file, which include all others.
More details soon
*/
/* Include all public header files:*/
#include <dc1394/types.h>
#include <dc1394/camera.h>
#include <dc1394/control.h>
#include <dc1394/capture.h>
#include <dc1394/conversions.h>
#include <dc1394/format7.h>
#include <dc1394/iso.h>
#include <dc1394/log.h>
#include <dc1394/register.h>
#include <dc1394/video.h>
#include <dc1394/utils.h>
#endif

313
dc1394/enumeration.c Normal file
View File

@ -0,0 +1,313 @@
/*
* 1394-Based Digital Camera Control Library
*
* Written by David Moore <dcm@acm.org>
*
* 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
*/
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <string.h>
#include <dc1394/control.h>
#include "internal.h"
#include "platform.h"
#include "log.h"
static void
destroy_camera_info (camera_info_t * info)
{
free (info->vendor);
free (info->model);
}
static int
add_camera (dc1394_t * d, camera_info_t * info)
{
int n = d->num_cameras;
dc1394_log_debug ("Adding camera %"PRIx64":%d %x:%x (%s:%s)",
info->guid, info->unit, info->vendor_id, info->model_id,
info->vendor, info->model);
/* For now, exclude duplicate cameras caused by seeing the same camera
* on different busses. A better solution is to let the user choose
* between these different versions of the same camera, which will require
* a new API in the future. */
int i;
for (i = 0; i < n; i++) {
if (d->cameras[i].guid == info->guid
&& d->cameras[i].unit == info->unit) {
dc1394_log_debug ("Rejected camera %"PRIx64" as duplicate",
info->unit);
destroy_camera_info (info);
return 0;
}
}
d->cameras = realloc (d->cameras, (n + 1) * sizeof (camera_info_t));
memcpy (d->cameras + n, info, sizeof (camera_info_t));
d->num_cameras = n + 1;
return 0;
}
static char *
parse_leaf (uint32_t offset, uint32_t * quads, int num_quads)
{
if (offset >= num_quads)
return NULL;
int num_entries = quads[offset] >> 16;
if (offset + num_entries >= num_quads)
return NULL;
uint32_t * dquads = quads + offset + 1;
char * str = malloc ((num_entries - 1) * 4 + 1);
int i;
for (i = 0; i < num_entries - 2; i++) {
uint32_t q = dquads[i+2];
str[4*i+0] = q >> 24;
str[4*i+1] = (q >> 16) & 0xff;
str[4*i+2] = (q >> 8) & 0xff;
str[4*i+3] = q & 0xff;
}
str[4*i] = '\0';
return str;
}
static int
identify_unit (dc1394_t * d, platform_info_t * platform,
platform_device_t * dev, uint64_t guid,
uint32_t offset, uint32_t * quads, int num_quads, int unit_num,
uint32_t vendor_id)
{
if (offset >= num_quads)
return -1;
int num_entries = quads[offset] >> 16;
if (offset + num_entries >= num_quads)
return -1;
camera_info_t info;
memset (&info, 0, sizeof (camera_info_t));
info.guid = guid;
info.unit = unit_num;
info.device = dev;
info.vendor_id = vendor_id;
info.unit_directory = offset;
info.platform = platform;
uint32_t * dquads = quads + offset + 1;
int i;
for (i = 0; i < num_entries; i++) {
uint32_t q = dquads[i];
if ((q >> 24) == 0x12)
info.unit_spec_ID = q & 0xffffff;
if ((q >> 24) == 0x13)
info.unit_sw_version = q & 0xffffff;
if ((q >> 24) == 0xD4)
info.unit_dependent_directory = (q & 0xffffff) + offset + i + 1;
if ((q >> 24) == 0x17)
info.model_id = q & 0xffffff;
}
/*
Note on Point Grey (PG) cameras:
Although not always advertised, PG cameras are 'sometimes' compatible
with IIDC specs. This is especially the case with PG stereo products.
The following modifications have been tested with a stereo head
(BumbleBee). Most other cameras should be compatible, please consider
contributing to the lib if your PG camera is not recognized.
PG cams sometimes have a Unit_Spec_ID of 0xB09D, instead of the
0xA02D of classic IIDC cameras. Also, their software revision differs.
I could only get a 1.14 version from my BumbleBee but other versions
might exist.
As PG is regularly providing firmware updates you might also install
the latest one in your camera for an increased compatibility.
Damien
(updated 2005-04-30)
*/
if ((info.unit_spec_ID != 0xA02D) &&
(info.unit_spec_ID != 0xB09D))
return -1;
if (!info.unit_dependent_directory)
return -1;
if (info.unit_dependent_directory >= num_quads)
goto done;
num_entries = quads[info.unit_dependent_directory] >> 16;
if (info.unit_dependent_directory + num_entries >= num_quads)
goto done;
dquads = quads + info.unit_dependent_directory + 1;
for (i = 0; i < num_entries; i++) {
uint32_t q = dquads[i];
if ((q >> 24) == 0x81)
info.vendor = parse_leaf ((q & 0xffffff) +
info.unit_dependent_directory + 1 + i,
quads, num_quads);
if ((q >> 24) == 0x82)
info.model = parse_leaf ((q & 0xffffff) +
info.unit_dependent_directory + 1 + i,
quads, num_quads);
}
done:
info.unit_directory = info.unit_directory * 4 + 0x400;
info.unit_dependent_directory = info.unit_dependent_directory * 4 + 0x400;
return add_camera (d, &info);
}
static int
identify_camera (dc1394_t * d, platform_info_t * platform,
platform_device_t * dev)
{
uint64_t guid;
uint32_t quads[256];
int num_quads = 256;
if (platform->dispatch->device_get_config_rom (dev, quads,
&num_quads) < 0) {
dc1394_log_warning ("Failed to get config ROM from %s device",
platform->name);
return -1;
}
dc1394_log_debug ("Got %d quads of config ROM", num_quads);
if (num_quads < 7)
return -1;
/* Require 4 quadlets in the bus info block */
if ((quads[0] >> 24) != 0x4) {
dc1394_log_debug ("Expected 4 quadlets in bus info block, got %d",
quads[0] >> 24);
return -1;
}
/* Require "1394" as the bus identity */
if (quads[1] != 0x31333934)
return -1;
guid = ((uint64_t)quads[3] << 32) | quads[4];
int num_entries = quads[5] >> 16;
if (num_quads < num_entries + 6)
return -1;
int unit = 0;
uint32_t vendor_id = 0;
int i;
for (i = 0; i < num_entries; i++) {
uint32_t q = quads[6+i];
if ((q >> 24) == 0x03)
vendor_id = q & 0xffffff;
if ((q >> 24) == 0xD1) {
uint32_t offset = (q & 0xffffff) + 6 + i;
identify_unit (d, platform, dev, guid, offset, quads, num_quads,
unit++, vendor_id);
}
}
return 0;
}
void
free_enumeration (dc1394_t * d)
{
int i;
for (i = 0; i < d->num_platforms; i++) {
platform_info_t * p = d->platforms + i;
if (p->device_list)
p->dispatch->free_device_list (p->device_list);
p->device_list = NULL;
}
for (i = 0; i < d->num_cameras; i++)
destroy_camera_info (d->cameras + i);
free (d->cameras);
d->num_cameras = 0;
d->cameras = NULL;
}
int
refresh_enumeration (dc1394_t * d)
{
free_enumeration (d);
dc1394_log_debug ("Enumerating cameras...");
int i;
for (i = 0; i < d->num_platforms; i++) {
platform_info_t * p = d->platforms + i;
if (!p->p)
continue;
dc1394_log_debug("Enumerating platform %s", p->name);
p->device_list = p->dispatch->get_device_list (p->p);
if (!p->device_list) {
dc1394_log_warning("Platform %s failed to get device list",
p->name);
continue;
}
platform_device_t ** list = p->device_list->devices;
int j;
dc1394_log_debug ("Platform %s has %d device(s)",
p->name, p->device_list->num_devices);
for (j = 0; j < p->device_list->num_devices; j++)
if (identify_camera (d, p, list[j]) < 0)
dc1394_log_debug ("Failed to identify %s device %d",
p->name, j);
}
return 0;
}
dc1394error_t
dc1394_camera_enumerate (dc1394_t * d, dc1394camera_list_t **list)
{
if (refresh_enumeration (d) < 0)
return DC1394_FAILURE;
dc1394camera_list_t * l;
l = calloc (1, sizeof (dc1394camera_list_t));
*list = l;
if (d->num_cameras == 0)
return DC1394_SUCCESS;
l->ids = malloc (d->num_cameras * sizeof (dc1394camera_id_t));
l->num = 0;
int i;
for (i = 0; i < d->num_cameras; i++) {
l->ids[i].guid = d->cameras[i].guid;
l->ids[i].unit = d->cameras[i].unit;
l->num++;
}
return DC1394_SUCCESS;
}
/*
Free a list of cameras returned by dc1394_enumerate_cameras()
*/
void
dc1394_camera_free_list (dc1394camera_list_t *list)
{
if (list)
free (list->ids);
list->ids = NULL;
free (list);
}

963
dc1394/format7.c Normal file
View File

@ -0,0 +1,963 @@
/*
* 1394-Based Digital Camera Control Library
*
* Format_7 functions
*
* Written by Damien Douxchamps <ddouxchamps@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.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
*/
#include <unistd.h>
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#include <errno.h>
#include <stdlib.h>
#include "control.h"
#include "internal.h"
#include "register.h"
#include "offsets.h"
#include "utils.h"
#include "config.h"
#include "log.h"
#ifdef __MINGW32__
#include <unistd.h>
#endif
/*==========================================================================
* This function implements the handshaking available (and sometimes required)
* on some cameras that comply with the IIDC specs v1.30. Thanks to Yasutoshi
* Onishi for his feedback and info.
*==========================================================================*/
dc1394error_t
dc1394_format7_get_value_setting(dc1394camera_t *camera, dc1394video_mode_t video_mode,
uint32_t *present, uint32_t *setting1,
uint32_t *err_flag1, uint32_t *err_flag2)
{
dc1394error_t err;
uint32_t value;
if (camera->iidc_version<DC1394_IIDC_VERSION_1_30) {
*present=0;
return DC1394_SUCCESS;
}
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
err=dc1394_get_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_VALUE_SETTING, &value);
DC1394_ERR_RTN(err, "could note get value setting");
*present= (uint32_t) ( value & 0x80000000UL ) >> 31;
*setting1= (uint32_t) ( value & 0x40000000UL ) >> 30;
*err_flag1= (uint32_t) ( value & 0x00800000UL ) >> 23;
*err_flag2= (uint32_t) ( value & 0x00400000UL ) >> 22;
return err;
}
int
dc1394_format7_set_value_setting(dc1394camera_t *camera, dc1394video_mode_t video_mode)
{
int err;
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
err=dc1394_set_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_VALUE_SETTING, (uint32_t)0x40000000UL);
DC1394_ERR_RTN(err, "Could not set value setting");
return err;
}
dc1394error_t
_dc1394_v130_handshake(dc1394camera_t *camera, dc1394video_mode_t video_mode)
{
uint32_t setting_1, err_flag1, err_flag2, v130handshake;
uint32_t exit_loop;
dc1394error_t err;
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
if (camera->iidc_version >= DC1394_IIDC_VERSION_1_30) {
// We don't use > because 114 is for ptgrey cameras which are not 1.30 but 1.20
err=dc1394_format7_get_value_setting(camera, video_mode, &v130handshake, &setting_1, &err_flag1, &err_flag2);
DC1394_ERR_RTN(err, "Unable to read value setting register");
}
else {
v130handshake=0;
return DC1394_SUCCESS;
}
if (v130handshake==1) {
// we should use advanced IIDC v1.30 handshaking.
// set value setting to 1
err=dc1394_format7_set_value_setting(camera, video_mode);
DC1394_ERR_RTN(err, "Unable to set value setting register");
// wait for value setting to clear:
exit_loop=0;
while (!exit_loop) { // WARNING: there is no timeout in this loop yet.
err=dc1394_format7_get_value_setting(camera, video_mode, &v130handshake, &setting_1, &err_flag1, &err_flag2);
DC1394_ERR_RTN(err, "Unable to read value setting register");
exit_loop=(setting_1==0);
usleep(0);
}
if (err_flag1>0) {
err=DC1394_FORMAT7_ERROR_FLAG_1;
DC1394_ERR_RTN(err, "invalid image position, size, color coding or ISO speed");
}
/*
// This seems to make problems. Remove for now.
if (err_flag2>0) {
err=DC1394_FORMAT7_ERROR_FLAG_2;
DC1394_ERR_RTN(err, "proposed packet size is not a valid value");
}
*/
// packet size... registers are ready for reading.
}
return err;
}
dc1394error_t
_dc1394_format7_set_image_position(dc1394camera_t *camera,
dc1394video_mode_t video_mode, uint32_t left,
uint32_t top)
{
dc1394error_t err;
// it is allowed to change the image position even if capture is running.
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
err=dc1394_set_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_IMAGE_POSITION, (uint32_t)((left << 16) | top));
DC1394_ERR_RTN(err, "Format7 image position setting failure");
return err;
}
dc1394error_t
_dc1394_format7_set_image_size(dc1394camera_t *camera,
dc1394video_mode_t video_mode, uint32_t width,
uint32_t height)
{
dc1394error_t err;
dc1394video_mode_t mode;
err=dc1394_video_get_mode(camera,&mode);
DC1394_ERR_RTN(err,"Could not get current video mode");
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
err=dc1394_set_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_IMAGE_SIZE, (uint32_t)((width << 16) | height));
DC1394_ERR_RTN(err, "Format7 image size setting failure");
return err;
}
dc1394error_t
_dc1394_format7_set_color_coding(dc1394camera_t *camera,
dc1394video_mode_t video_mode, dc1394color_coding_t color_coding)
{
dc1394error_t err;
dc1394video_mode_t mode;
if ( (color_coding<DC1394_COLOR_CODING_MIN) || (color_coding>DC1394_COLOR_CODING_MAX) )
return DC1394_INVALID_COLOR_CODING;
err=dc1394_video_get_mode(camera,&mode);
DC1394_ERR_RTN(err,"Could not get current video mode");
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
color_coding-= DC1394_COLOR_CODING_MIN;
color_coding=color_coding<<24;
err=dc1394_set_format7_register(camera, video_mode,REG_CAMERA_FORMAT7_COLOR_CODING_ID, (uint32_t)color_coding);
DC1394_ERR_RTN(err, "Format7 color coding setting failure");
// IIDC v1.30 handshaking:
//err=_dc1394_v130_handshake(camera, video_mode);
//DC1394_ERR_RTN(err, "F7 handshake failure");
return err;
}
dc1394error_t
_dc1394_format7_set_packet_size(dc1394camera_t *camera,
dc1394video_mode_t video_mode,
uint32_t packet_size)
{
dc1394error_t err;
dc1394video_mode_t mode;
err=dc1394_video_get_mode(camera,&mode);
DC1394_ERR_RTN(err,"Could not get current video mode");
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
err=dc1394_set_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_BYTE_PER_PACKET, (uint32_t)(packet_size) << 16 );
DC1394_ERR_RTN(err, "Format7 packet size setting failure");
// IIDC v1.30 handshaking:
//err=_dc1394_v130_handshake(camera, video_mode);
//DC1394_ERR_RTN(err, "F7 handshake failure");
return err;
}
/**********************/
/* External functions */
/**********************/
dc1394error_t
dc1394_format7_get_max_image_size(dc1394camera_t *camera,
dc1394video_mode_t video_mode,
uint32_t *horizontal_size,
uint32_t *vertical_size)
{
dc1394error_t err;
uint32_t value;
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
err=dc1394_get_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_MAX_IMAGE_SIZE_INQ, &value);
DC1394_ERR_RTN(err, "Could not get max image sizes");
*horizontal_size = (uint32_t) ( value & 0xFFFF0000UL ) >> 16;
*vertical_size= (uint32_t) ( value & 0x0000FFFFUL );
return err;
}
dc1394error_t
dc1394_format7_get_unit_size(dc1394camera_t *camera,
dc1394video_mode_t video_mode,
uint32_t *horizontal_unit,
uint32_t *vertical_unit)
{
dc1394error_t err;
uint32_t value;
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
err=dc1394_get_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_UNIT_SIZE_INQ, &value);
DC1394_ERR_RTN(err, "Could not get unit sizes");
*horizontal_unit = (uint32_t) ( value & 0xFFFF0000UL ) >> 16;
*vertical_unit= (uint32_t) ( value & 0x0000FFFFUL );
return err;
}
dc1394error_t
dc1394_format7_get_image_position(dc1394camera_t *camera,
dc1394video_mode_t video_mode,
uint32_t *left_position,
uint32_t *top_position)
{
dc1394error_t err;
uint32_t value;
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
err=dc1394_get_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_IMAGE_POSITION, &value);
DC1394_ERR_RTN(err, "Could not get image position");
*left_position = (uint32_t) ( value & 0xFFFF0000UL ) >> 16;
*top_position= (uint32_t) ( value & 0x0000FFFFUL );
return err;
}
dc1394error_t
dc1394_format7_get_image_size(dc1394camera_t *camera,
dc1394video_mode_t video_mode,
uint32_t *width,
uint32_t *height)
{
dc1394error_t err;
uint32_t value;
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
err=dc1394_get_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_IMAGE_SIZE, &value);
DC1394_ERR_RTN(err, "could not get current image size");
*width= (uint32_t) ( value & 0xFFFF0000UL ) >> 16;
*height = (uint32_t) ( value & 0x0000FFFFUL );
return err;
}
dc1394error_t
dc1394_format7_get_color_coding(dc1394camera_t *camera,
dc1394video_mode_t video_mode,
dc1394color_coding_t *color_coding)
{
dc1394error_t err;
uint32_t value;
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
err=dc1394_get_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_COLOR_CODING_ID, &value);
DC1394_ERR_RTN(err, "Could not get current color_id");
value=value>>24;
*color_coding= (uint32_t)value+DC1394_COLOR_CODING_MIN;
return err;
}
dc1394error_t
dc1394_format7_get_color_codings(dc1394camera_t *camera,
dc1394video_mode_t video_mode,
dc1394color_codings_t *color_codings)
{
dc1394error_t err;
int i;
uint32_t value;
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
err=dc1394_get_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_COLOR_CODING_INQ, &value);
DC1394_ERR_RTN(err, "Could not get available color codings");
color_codings->num=0;
for (i=0;i<DC1394_COLOR_CODING_NUM;i++) {
if ((value & (0x1 << (31-i))) > 0) {
color_codings->codings[color_codings->num]=i+DC1394_COLOR_CODING_MIN;
color_codings->num++;
}
}
return err;
}
dc1394error_t
dc1394_format7_get_pixel_number(dc1394camera_t *camera,
dc1394video_mode_t video_mode,
uint32_t *pixnum)
{
dc1394error_t err;
uint32_t value;
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
err=dc1394_get_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_PIXEL_NUMBER_INQ, &value);
DC1394_ERR_RTN(err, "Could not get pixel number");
*pixnum= (uint32_t) value;
return err;
}
dc1394error_t
dc1394_format7_get_total_bytes(dc1394camera_t *camera,
dc1394video_mode_t video_mode,
uint64_t *total_bytes)
{
dc1394error_t err;
uint64_t value_hi, value_lo;
uint32_t value;
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
err=dc1394_get_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_TOTAL_BYTES_HI_INQ, &value);
DC1394_ERR_RTN(err, "Could not get total bytes - LSB");
value_hi=value;
err=dc1394_get_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_TOTAL_BYTES_LO_INQ, &value);
DC1394_ERR_RTN(err, "Could not get total bytes - MSB");
value_lo=value;
*total_bytes= (value_lo | ( value_hi << 32) );
return err;
}
dc1394error_t
dc1394_format7_get_packet_parameters(dc1394camera_t *camera,
dc1394video_mode_t video_mode, uint32_t *unit_bytes,
uint32_t *max_bytes)
{
dc1394error_t err;
uint32_t value;
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
err= dc1394_get_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_PACKET_PARA_INQ, &value);
DC1394_ERR_RTN(err, "Could not get F7 packet parameters");
*unit_bytes= (uint32_t) ( value & 0xFFFF0000UL ) >> 16;
*max_bytes= (uint32_t) ( value & 0x0000FFFFUL );
return err;
}
dc1394error_t
dc1394_format7_get_packet_size(dc1394camera_t *camera,
dc1394video_mode_t video_mode,
uint32_t *packet_size)
{
dc1394error_t err;
uint32_t value;
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
err=dc1394_get_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_BYTE_PER_PACKET, &value);
DC1394_ERR_RTN(err, "Could not get packet size");
*packet_size= (uint32_t) ( value & 0xFFFF0000UL ) >> 16;
if (*packet_size==0) {
dc1394_log_error("packet size is zero. This should not happen.");
return DC1394_FAILURE;
}
return err;
}
dc1394error_t
dc1394_format7_set_image_position(dc1394camera_t *camera,
dc1394video_mode_t video_mode, uint32_t left,
uint32_t top)
{
dc1394error_t err=_dc1394_format7_set_image_position(camera, video_mode, left, top);
DC1394_ERR_RTN(err, "Format7 image position setting failure");
// IIDC v1.30 handshaking:
err=_dc1394_v130_handshake(camera, video_mode);
DC1394_ERR_RTN(err, "F7 handshake failure");
return err;
}
dc1394error_t
dc1394_format7_set_image_size(dc1394camera_t *camera,
dc1394video_mode_t video_mode, uint32_t width,
uint32_t height)
{
dc1394error_t err=_dc1394_format7_set_image_size(camera, video_mode, width, height);
DC1394_ERR_RTN(err, "Format7 image size setting failure");
// IIDC v1.30 handshaking:
err=_dc1394_v130_handshake(camera, video_mode);
DC1394_ERR_RTN(err, "F7 handshake failure");
return err;
}
dc1394error_t
dc1394_format7_set_color_coding(dc1394camera_t *camera,
dc1394video_mode_t video_mode, dc1394color_coding_t color_coding)
{
dc1394error_t err=_dc1394_format7_set_color_coding(camera, video_mode, color_coding);
DC1394_ERR_RTN(err, "Format7 color_coding setting failure");
// IIDC v1.30 handshaking:
err=_dc1394_v130_handshake(camera, video_mode);
DC1394_ERR_RTN(err, "F7 handshake failure");
return err;
}
dc1394error_t
dc1394_format7_set_packet_size(dc1394camera_t *camera,
dc1394video_mode_t video_mode,
uint32_t packet_bytes)
{
dc1394error_t err=_dc1394_format7_set_packet_size(camera, video_mode, packet_bytes);
DC1394_ERR_RTN(err, "Format7 packet size setting failure");
// IIDC v1.30 handshaking:
err=_dc1394_v130_handshake(camera, video_mode);
DC1394_ERR_RTN(err, "F7 handshake failure");
return err;
}
dc1394error_t
dc1394_format7_get_recommended_packet_size(dc1394camera_t *camera,
dc1394video_mode_t video_mode, uint32_t *packet_size)
{
dc1394error_t err;
uint32_t value;
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
err= dc1394_get_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_BYTE_PER_PACKET, &value);
DC1394_ERR_RTN(err, "Could not get recommended BPP");
*packet_size= (uint32_t) ( value & 0x0000FFFFUL );
return err;
}
dc1394error_t
dc1394_format7_get_packets_per_frame(dc1394camera_t *camera,
dc1394video_mode_t video_mode, uint32_t *ppf)
{
dc1394error_t err;
uint32_t value;
uint32_t packet_size;
uint64_t total_bytes;
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
*ppf = 0;
if (camera->iidc_version>=DC1394_IIDC_VERSION_1_30) {
err= dc1394_get_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_PACKET_PER_FRAME_INQ, &value);
DC1394_ERR_RTN(err, "Could not get the number of packets per frame");
*ppf= (uint32_t) (value);
}
/* Perform computation according to 4.9.7 in the IIDC spec for cameras that do
* not support PACKET_PER_FRAME_INQ */
if (*ppf == 0) {
// return an estimate, NOT TAKING ANY PADDING INTO ACCOUNT
err=dc1394_format7_get_packet_size(camera, video_mode, &packet_size);
DC1394_ERR_RTN(err, "Could not get BPP");
if (packet_size==0) {
return DC1394_FAILURE;
}
err=dc1394_format7_get_total_bytes(camera, video_mode, &total_bytes);
DC1394_ERR_RTN(err, "Could not get total number of bytes");
if (total_bytes%packet_size!=0)
*ppf=total_bytes/packet_size+1;
else
*ppf=total_bytes/packet_size;
return err;
}
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_format7_get_unit_position(dc1394camera_t *camera,
dc1394video_mode_t video_mode,
uint32_t *horizontal_pos,
uint32_t *vertical_pos)
{
dc1394error_t err;
uint32_t value;
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
if (camera->iidc_version>=DC1394_IIDC_VERSION_1_30) {
err = dc1394_get_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_UNIT_POSITION_INQ, &value);
DC1394_ERR_RTN(err, "Could not get unit position");
}
else {
// if version is not 1.30, use the UNIT_SIZE_INQ register
err = dc1394_get_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_UNIT_SIZE_INQ, &value);
DC1394_ERR_RTN(err, "Could not get unit size");
}
*horizontal_pos = (uint32_t) (( value & 0xFFFF0000UL )>>16);
*vertical_pos = (uint32_t) ( value & 0x0000FFFFUL );
return err;
}
dc1394error_t
dc1394_format7_get_frame_interval(dc1394camera_t *camera, dc1394video_mode_t video_mode, float *interval)
{
dc1394error_t err;
uint32_t value;
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
err=dc1394_get_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_FRAME_INTERVAL_INQ, &value);
DC1394_ERR_RTN(err, "Could not get frame interval");
*interval=value;
return err;
}
dc1394error_t
dc1394_format7_get_data_depth(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *data_depth)
{
dc1394error_t err;
uint32_t value;
dc1394color_coding_t coding;
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
*data_depth = 0;
if (camera->iidc_version >= DC1394_IIDC_VERSION_1_31) {
err=dc1394_get_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_DATA_DEPTH_INQ, &value);
DC1394_ERR_RTN(err, "Could not get format7 data depth");
*data_depth=value >> 24;
}
/* For cameras that do not have the DATA_DEPTH_INQ register, perform a
* sane default. */
if (*data_depth == 0) {
err = dc1394_get_color_coding_from_video_mode (camera, video_mode, &coding);
DC1394_ERR_RTN(err, "Could not get color coding");
err = dc1394_get_color_coding_data_depth (coding, data_depth);
DC1394_ERR_RTN(err, "Could not get data depth from color coding");
return err;
}
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_format7_get_color_filter(dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394color_filter_t *color_filter)
{
dc1394error_t err;
uint32_t value;
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
if (camera->iidc_version<DC1394_IIDC_VERSION_1_31)
return DC1394_FUNCTION_NOT_SUPPORTED;
err=dc1394_get_format7_register(camera, video_mode, REG_CAMERA_FORMAT7_COLOR_FILTER_ID, &value);
DC1394_ERR_RTN(err, "Could not get color filter ID");
*color_filter= (value >> 24)+DC1394_COLOR_FILTER_MIN;
return err;
}
dc1394error_t
dc1394_format7_get_mode_info(dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394format7mode_t *f7_mode)
{
dc1394error_t err=DC1394_SUCCESS;
if (!dc1394_is_video_mode_scalable(video_mode))
return DC1394_INVALID_VIDEO_MODE;
if (f7_mode->present>0) { // check for mode presence before query
err=dc1394_format7_get_max_image_size(camera,video_mode,&f7_mode->max_size_x,&f7_mode->max_size_y);
DC1394_ERR_RTN(err,"Got a problem querying format7 max image size");
err=dc1394_format7_get_unit_size(camera,video_mode,&f7_mode->unit_size_x,&f7_mode->unit_size_y);
DC1394_ERR_RTN(err,"Got a problem querying format7 unit size");
err=dc1394_format7_get_unit_position(camera,video_mode,&f7_mode->unit_pos_x,&f7_mode->unit_pos_y);
if (err!=DC1394_SUCCESS) {
//DC1394_ERR_RTN(err,"Got a problem querying format7 unit position");
// unit position might not be supported, hence a softer check is implemented
f7_mode->unit_pos_x=0;
f7_mode->unit_pos_y=0;
}
err=dc1394_format7_get_image_position(camera,video_mode,&f7_mode->pos_x,&f7_mode->pos_y);
DC1394_ERR_RTN(err,"Got a problem querying format7 image position");
err=dc1394_format7_get_image_size(camera,video_mode,&f7_mode->size_x,&f7_mode->size_y);
DC1394_ERR_RTN(err,"Got a problem querying format7 image size");
err=dc1394_format7_get_packet_size(camera,video_mode,&f7_mode->packet_size);
DC1394_ERR_RTN(err,"Got a problem querying format7 packet_size");
if (f7_mode->packet_size==0) {
// sometimes a camera will not set the bpp register until a valid image size
// has been set after boot. If BPP is zero, we therefor
// try again after setting the image size to the maximum size.
err=dc1394_format7_set_image_position(camera,video_mode,0,0);
DC1394_ERR_RTN(err,"Got a problem setting format7 image position");
err=dc1394_format7_set_image_size(camera,video_mode,f7_mode->max_size_x,f7_mode->max_size_y);
DC1394_ERR_RTN(err,"Got a problem setting format7 image size");
// maybe we should also force a color coding here.
err=dc1394_format7_get_packet_size(camera,video_mode,&f7_mode->packet_size);
DC1394_ERR_RTN(err,"Got a problem querying format7 packet size");
}
err=dc1394_format7_get_packet_parameters(camera,video_mode,&f7_mode->unit_packet_size,&f7_mode->max_packet_size);
DC1394_ERR_RTN(err,"Got a problem querying format7 packet parameters");
err=dc1394_format7_get_pixel_number(camera,video_mode,&f7_mode->pixnum);
DC1394_ERR_RTN(err,"Got a problem querying format7 pixel number");
err=dc1394_format7_get_total_bytes(camera,video_mode,&f7_mode->total_bytes);
DC1394_ERR_RTN(err,"Got a problem querying format7 total bytes per frame");
err=dc1394_format7_get_color_coding(camera,video_mode,&f7_mode->color_coding);
DC1394_ERR_RTN(err,"Got a problem querying format7 color coding ID");
err=dc1394_format7_get_color_codings(camera,video_mode,&f7_mode->color_codings);
DC1394_ERR_RTN(err,"Got a problem querying format7 color coding");
// WARNING: this requires to set the format7 mode!!
if (camera->iidc_version >= DC1394_IIDC_VERSION_1_31) {
err=dc1394_format7_get_color_filter(camera,video_mode,&f7_mode->color_filter);
DC1394_ERR_RTN(err,"Got a problem querying format7 bayer pattern");
}
else {
f7_mode->color_filter = 0;
}
}
return err;
}
dc1394error_t
dc1394_format7_get_modeset(dc1394camera_t *camera, dc1394format7modeset_t *info)
{
dc1394error_t err;
int i;
dc1394video_modes_t modes;
for (i=0;i<DC1394_VIDEO_MODE_FORMAT7_NUM;i++) {
info->mode[i].present=0;
}
err=dc1394_video_get_supported_modes(camera, &modes);
DC1394_ERR_RTN(err,"Could not query supported formats");
// find a mode which is F7:
for (i=0;i<modes.num;i++) {
if (dc1394_is_video_mode_scalable(modes.modes[i])) {
info->mode[modes.modes[i]-DC1394_VIDEO_MODE_FORMAT7_MIN].present= 1;
dc1394_format7_get_mode_info(camera, modes.modes[i], &info->mode[modes.modes[i]-DC1394_VIDEO_MODE_FORMAT7_MIN]);
}
}
return err;
}
dc1394error_t
dc1394_format7_set_roi(dc1394camera_t *camera,
dc1394video_mode_t video_mode,
dc1394color_coding_t color_coding,
int32_t packet_size,
int32_t left, int32_t top,
int32_t width, int32_t height)
{
uint32_t unit_bytes, max_bytes;
uint32_t recom_packet_size;
uint32_t camera_left = 0;
uint32_t camera_top = 0;
uint32_t camera_width = 0;
uint32_t camera_height = 0;
uint32_t max_width = 0;
uint32_t max_height = 0;
uint32_t uint_packet_size=0;
dc1394error_t err;
// ===========================================================
// COLOR CODING
// ===========================================================
// deal with color coding early as it may have an effect on max bpp, sizes, etc...
if (color_coding==DC1394_QUERY_FROM_CAMERA) {
err=dc1394_format7_get_color_coding(camera, video_mode, &color_coding);
DC1394_ERR_RTN(err, "Unable to get color_coding");
}
else {
if (color_coding<0) {
// error: other auto modes not supported
return DC1394_INVALID_ARGUMENT_VALUE;
}
// set color coding
err=_dc1394_format7_set_color_coding(camera, video_mode, color_coding);
DC1394_ERR_RTN(err, "Unable to set color_coding");
// do handshaking to be sure that the value is now effective
err=_dc1394_v130_handshake(camera, video_mode);
DC1394_ERR_RTN(err, "Handshaking failed after setting color_coding");
}
// ===========================================================
// POSITION AND SIZE
// ===========================================================
// we do this together as they influence each other. Only one hadshaking at the end.
if ( width == DC1394_QUERY_FROM_CAMERA || height == DC1394_QUERY_FROM_CAMERA) {
err=dc1394_format7_get_image_size(camera, video_mode, &camera_width, &camera_height);
DC1394_ERR_RTN(err, "Unable to query image size");
/* Idea from Ralf Ebeling: we should check if the image sizes are > 0.
If == 0, we use the maximum size available */
if (width == DC1394_QUERY_FROM_CAMERA) {
if (camera_width>0)
width = camera_width;
else
width = DC1394_USE_MAX_AVAIL;
}
if (height == DC1394_QUERY_FROM_CAMERA) {
if (camera_height>0)
height = camera_height;
else
height = DC1394_USE_MAX_AVAIL;
}
}
if ( left == DC1394_QUERY_FROM_CAMERA || top == DC1394_QUERY_FROM_CAMERA) {
err=dc1394_format7_get_image_position(camera, video_mode, &camera_left, &camera_top);
DC1394_ERR_RTN(err, "Unable to query image position");
if( left == DC1394_QUERY_FROM_CAMERA)
left = camera_left;
if( top == DC1394_QUERY_FROM_CAMERA)
top = camera_top;
}
if ( width == DC1394_USE_MAX_AVAIL || height == DC1394_USE_MAX_AVAIL) {
err=dc1394_format7_get_max_image_size(camera, video_mode, &max_width, &max_height);
DC1394_ERR_RTN(err, "Unable to query max image size");
if( width == DC1394_USE_MAX_AVAIL)
width = max_width - left;
if( height == DC1394_USE_MAX_AVAIL)
height = max_height - top;
}
if ((left<0)||(top<0)) {
// error: other auto modes not supported
return DC1394_INVALID_ARGUMENT_VALUE;
}
/* First set image position to (0,0) to allow the size/position to change
without passing through an impossible state. The order of the operations is
1) set position to (0,0), 2) set size 3) set position. Other orders may fail
to properly set the camera, even if the pos/size couple if OK. */
err=_dc1394_format7_set_image_position(camera, video_mode, 0,0);
DC1394_ERR_RTN(err, "Unable to set image position");
err=_dc1394_format7_set_image_size(camera, video_mode, width, height);
DC1394_ERR_RTN(err, "Unable to set format 7 image size");
err=_dc1394_format7_set_image_position(camera, video_mode, left, top);
DC1394_ERR_RTN(err, "Unable to set format 7 image position");
// do handshaking to be sure that the value is now effective
err=_dc1394_v130_handshake(camera, video_mode);
DC1394_ERR_RTN(err, "Handshaking failed after setting size and position");
// ===========================================================
// PACKET SIZE
// ===========================================================
if (packet_size==DC1394_QUERY_FROM_CAMERA) {
err=dc1394_format7_get_packet_size(camera, video_mode, &uint_packet_size);
DC1394_ERR_RTN(err, "Unable to get F7 packet size");
packet_size=uint_packet_size;
}
switch (packet_size) {
case DC1394_USE_RECOMMENDED:
err=dc1394_format7_get_recommended_packet_size(camera, video_mode, &recom_packet_size);
DC1394_ERR_RTN(err, "Recommended packet size inq error");
if (recom_packet_size>0) {
packet_size=recom_packet_size;
}
else { // recom. bpp asked, but register is 0. IGNORED
err=dc1394_format7_get_packet_parameters(camera, video_mode, &unit_bytes, &max_bytes); /* PACKET_PARA_INQ */
DC1394_ERR_RTN(err, "Packet para inq error");
dc1394_log_warning("Recommended packet size asked, but register is zero for mode %d. Falling back to MAX packet size", video_mode);
packet_size=max_bytes;
}
break;
case DC1394_USE_MAX_AVAIL:
err=dc1394_format7_get_packet_parameters(camera, video_mode, &unit_bytes, &max_bytes); /* PACKET_PARA_INQ */
DC1394_ERR_RTN(err, "Packet para inq error");
packet_size = max_bytes;
break;
case DC1394_QUERY_FROM_CAMERA:
// if we wanted QUERY_FROM_CAMERA, the QUERY_FROM_CAMERA value has been overwritten by
// the current value at the beginning of the program. It is thus not possible to reach this code fragment.
dc1394_log_error("Packet size error: we should not reach this code region");
break;
default:
err=dc1394_format7_get_packet_parameters(camera, video_mode, &unit_bytes, &max_bytes); /* PACKET_PARA_INQ */
DC1394_ERR_RTN(err, "Packet para inq error");
// we have to take several tricks into account here:
// 1) BPP could be zero, in which case it becomes MAX_BPP
// 2) UNIT_BYTES could also be zero, in which case we force it to MAX_BPP.
// This actually further forces BPP to be set to MAX_BPP too.
if (unit_bytes==0) {
unit_bytes=max_bytes;
}
if (packet_size > max_bytes) {
packet_size = max_bytes;
}
else {
if (packet_size < unit_bytes) {
packet_size = unit_bytes;
}
}
packet_size-=packet_size % unit_bytes;
break;
}
// set bpp:
err=_dc1394_format7_set_packet_size(camera, video_mode, packet_size);
DC1394_ERR_RTN(err, "Unable to set format 7 packet_size");
// IIDC v1.30 handshaking:
err=_dc1394_v130_handshake(camera, video_mode);
DC1394_ERR_RTN(err, "F7 handshake failure");
return err;
}
dc1394error_t
dc1394_format7_get_roi(dc1394camera_t *camera,
dc1394video_mode_t video_mode,
dc1394color_coding_t *color_coding,
uint32_t *packet_size,
uint32_t *left, uint32_t *top,
uint32_t *width, uint32_t *height)
{
dc1394error_t err;
err=dc1394_format7_get_color_coding(camera, video_mode, color_coding);
DC1394_ERR_RTN(err, "Unable to get color_coding");
err=dc1394_format7_get_packet_size(camera, video_mode, packet_size);
DC1394_ERR_RTN(err, "Unable to get F7 bpp");
err=dc1394_format7_get_image_position(camera, video_mode, left, top);
DC1394_ERR_RTN(err, "Unable to get image position");
err=dc1394_format7_get_image_size(camera, video_mode, width, height);
DC1394_ERR_RTN(err, "Unable to get image size");
return err;
}

231
dc1394/format7.h Normal file
View File

@ -0,0 +1,231 @@
/*
* 1394-Based Digital Camera Control Library
*
* Format_7 functions
*
* Written by Damien Douxchamps <ddouxchamps@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.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
*/
#include <dc1394/log.h>
#include <dc1394/video.h>
#ifndef __DC1394_FORMAT7_H__
#define __DC1394_FORMAT7_H__
/*! \file dc1394/format7.h
\brief Functions to control Format_7 (aka scalable format, ROI)
More details soon
*/
/**
* A struct containing information about a mode of Format_7, the scalable image format.
*/
typedef struct __dc1394format7mode_t
{
dc1394bool_t present;
uint32_t size_x;
uint32_t size_y;
uint32_t max_size_x;
uint32_t max_size_y;
uint32_t pos_x;
uint32_t pos_y;
uint32_t unit_size_x;
uint32_t unit_size_y;
uint32_t unit_pos_x;
uint32_t unit_pos_y;
dc1394color_codings_t color_codings;
dc1394color_coding_t color_coding;
uint32_t pixnum;
uint32_t packet_size; /* in bytes */
uint32_t unit_packet_size;
uint32_t max_packet_size;
uint64_t total_bytes;
dc1394color_filter_t color_filter;
} dc1394format7mode_t;
/**
* A struct containing the list of Format_7 modes.
* FIXME: this may become very big if format_7 pages are used in IIDC 1.32. It would be better to use a "num" and an allocated list.
*/
typedef struct __dc1394format7modeset_t
{
dc1394format7mode_t mode[DC1394_VIDEO_MODE_FORMAT7_NUM];
} dc1394format7modeset_t;
/* Parameter flags for dc1394_setup_format7_capture() */
#define DC1394_QUERY_FROM_CAMERA -1
#define DC1394_USE_MAX_AVAIL -2
#define DC1394_USE_RECOMMENDED -3
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************
Format_7 (scalable image format)
***************************************************************************/
/* image size */
/**
* Gets the maximal image size for a given mode.
*/
dc1394error_t dc1394_format7_get_max_image_size(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *h_size,uint32_t *v_size);
/**
* Gets the unit sizes for a given mode. The image size can only be a multiple of the unit size, and cannot be smaller than it.
*/
dc1394error_t dc1394_format7_get_unit_size(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *h_unit, uint32_t *v_unit);
/**
* Gets the current image size.
*/
dc1394error_t dc1394_format7_get_image_size(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *width, uint32_t *height);
/**
* Sets the current image size
*/
dc1394error_t dc1394_format7_set_image_size(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t width, uint32_t height);
/* image position */
/**
* Gets the current image position
*/
dc1394error_t dc1394_format7_get_image_position(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *left, uint32_t *top);
/**
* Sets the current image position
*/
dc1394error_t dc1394_format7_set_image_position(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t left, uint32_t top);
/**
* Gets the unit positions for a given mode. The image position can only be a multiple of the unit position (zero is acceptable).
*/
dc1394error_t dc1394_format7_get_unit_position(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *h_unit_pos, uint32_t *v_unit_pos);
/* color coding */
/**
* Gets the current color coding
*/
dc1394error_t dc1394_format7_get_color_coding(dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394color_coding_t *color_coding);
/**
* Gets the list of color codings available for this mode
*/
dc1394error_t dc1394_format7_get_color_codings(dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394color_codings_t *codings);
/**
* Sets the current color coding
*/
dc1394error_t dc1394_format7_set_color_coding(dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394color_coding_t color_coding);
/**
* Gets the current color filter
*/
dc1394error_t dc1394_format7_get_color_filter(dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394color_filter_t *color_filter);
/* packet */
/**
* Get the parameters of the packet size: its maximal size and its unit size. The packet size is always a multiple of the unit bytes and cannot be zero.
*/
dc1394error_t dc1394_format7_get_packet_parameters(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *unit_bytes, uint32_t *max_bytes);
/**
* Gets the current packet size
*/
dc1394error_t dc1394_format7_get_packet_size(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *packet_size);
/**
* Sets the current packet size
*/
dc1394error_t dc1394_format7_set_packet_size(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t packet_size);
/**
* Gets the recommended packet size. Ignore if zero.
*/
dc1394error_t dc1394_format7_get_recommended_packet_size(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *packet_size);
/**
* Gets the number of packets per frame.
*/
dc1394error_t dc1394_format7_get_packets_per_frame(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *ppf);
/* other */
/**
* Gets the data depth (e.g. 12, 13, 14 bits/pixel)
*/
dc1394error_t dc1394_format7_get_data_depth(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *data_depth);
/**
* Gets the frame interval in float format
*/
dc1394error_t dc1394_format7_get_frame_interval(dc1394camera_t *camera, dc1394video_mode_t video_mode, float *interval);
/**
* Gets the number of pixels per image frame
*/
dc1394error_t dc1394_format7_get_pixel_number(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *pixnum);
/**
* Get the total number of bytes per frame. This includes padding (to reach an entire number of packets)
*/
dc1394error_t dc1394_format7_get_total_bytes(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint64_t *total_bytes);
/* These functions get the properties of (one or all) format7 mode(s) */
/**
* Gets the properties of all Format_7 modes supported by the camera.
*/
dc1394error_t dc1394_format7_get_modeset(dc1394camera_t *camera, dc1394format7modeset_t *info);
/**
* Gets the properties of a Format_7 mode
*/
dc1394error_t dc1394_format7_get_mode_info(dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394format7mode_t *f7_mode);
/**
* Joint function that fully sets a certain ROI taking all parameters into account.
* Note that this function does not SWITCH to the video mode passed as argument, it mearly sets it
*/
dc1394error_t dc1394_format7_set_roi(dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394color_coding_t color_coding,
int32_t packet_size, int32_t left, int32_t top, int32_t width, int32_t height);
/**
* Joint function that fully gets a certain ROI taking all parameters into account.
*/
dc1394error_t dc1394_format7_get_roi(dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394color_coding_t *color_coding,
uint32_t *packet_size, uint32_t *left, uint32_t *top, uint32_t *width, uint32_t *height);
#ifdef __cplusplus
}
#endif
#endif

290
dc1394/internal.c Normal file
View File

@ -0,0 +1,290 @@
/*
* 1394-Based Digital Camera Control Library
*
* Internal functions
*
* Written by Damien Douxchamps <ddouxchamps@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.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
*/
#include "internal.h"
#include "utils.h"
#include "log.h"
#include "register.h"
/*
These arrays define how many image quadlets there
are in a packet given a mode and a frame rate
This is defined in the 1394 digital camera spec
*/
const int quadlets_per_packet_format_0[56] = {
-1, -1, 15, 30, 60, 120, 240, 480,
10, 20, 40, 80, 160, 320, 640, 1280,
30, 60, 120, 240, 480, 960, 1920, 3840,
40, 80, 160, 320, 640, 1280, 2560, 5120,
60, 120, 240, 480, 960, 1920, 3840, 7680,
20, 40, 80, 160, 320, 640, 1280, 2560,
40, 80, 160, 320, 640, 1280, 2560, 5120
};
const int quadlets_per_packet_format_1[64] = {
-1, 125, 250, 500, 1000, 2000, 4000, 8000,
-1, -1, 375, 750, 1500, 3000, 6000, -1,
-1, -1, 125, 250, 500, 1000, 2000, 4000,
96, 192, 384, 768, 1536, 3072, 6144, -1,
144, 288, 576, 1152, 2304, 4608, -1, -1,
48, 96, 192, 384, 768, 1536, 3073, 6144,
-1, 125, 250, 500, 1000, 2000, 4000, 8000,
96, 192, 384, 768, 1536, 3072, 6144, -1
};
const int quadlets_per_packet_format_2[64] = {
160, 320, 640, 1280, 2560, 5120, -1, -1,
240, 480, 960, 1920, 3840, 7680, -1, -1,
80, 160, 320, 640, 1280, 2560, 5120, -1,
250, 500, 1000, 2000, 4000, 8000, -1, -1,
375, 750, 1500, 3000, 6000, -1, -1, -1,
125, 250, 500, 1000, 2000, 4000, 8000, -1,
160, 320, 640, 1280, 2560, 5120, -1, -1,
250, 500, 1000, 2000, 4000, 8000, -1, -1
};
/********************************************************
get_quadlets_per_packet
This routine reports the number of useful image quadlets
per packet
*********************************************************/
dc1394error_t
get_quadlets_per_packet(dc1394video_mode_t mode, dc1394framerate_t frame_rate, uint32_t *qpp) // ERROR handling to be updated
{
uint32_t mode_index;
uint32_t frame_rate_index= frame_rate - DC1394_FRAMERATE_MIN;
uint32_t format;
dc1394error_t err;
err=get_format_from_mode(mode, &format);
DC1394_ERR_RTN(err,"Invalid mode ID");
switch(format) {
case DC1394_FORMAT0:
mode_index= mode - DC1394_VIDEO_MODE_FORMAT0_MIN;
if ( ((mode >= DC1394_VIDEO_MODE_FORMAT0_MIN) && (mode <= DC1394_VIDEO_MODE_FORMAT0_MAX)) &&
((frame_rate >= DC1394_FRAMERATE_MIN) && (frame_rate <= DC1394_FRAMERATE_MAX)) ) {
*qpp=quadlets_per_packet_format_0[DC1394_FRAMERATE_NUM*mode_index+frame_rate_index];
}
else {
err=DC1394_INVALID_VIDEO_MODE;
DC1394_ERR_RTN(err,"Invalid framerate or mode");
}
return DC1394_SUCCESS;
case DC1394_FORMAT1:
mode_index= mode - DC1394_VIDEO_MODE_FORMAT1_MIN;
if ( ((mode >= DC1394_VIDEO_MODE_FORMAT1_MIN) && (mode <= DC1394_VIDEO_MODE_FORMAT1_MAX)) &&
((frame_rate >= DC1394_FRAMERATE_MIN) && (frame_rate <= DC1394_FRAMERATE_MAX)) ) {
*qpp=quadlets_per_packet_format_1[DC1394_FRAMERATE_NUM*mode_index+frame_rate_index];
}
else {
err=DC1394_INVALID_VIDEO_MODE;
DC1394_ERR_RTN(err,"Invalid framerate or mode");
}
return DC1394_SUCCESS;
case DC1394_FORMAT2:
mode_index= mode - DC1394_VIDEO_MODE_FORMAT2_MIN;
if ( ((mode >= DC1394_VIDEO_MODE_FORMAT2_MIN) && (mode <= DC1394_VIDEO_MODE_FORMAT2_MAX)) &&
((frame_rate >= DC1394_FRAMERATE_MIN) && (frame_rate <= DC1394_FRAMERATE_MAX)) ) {
*qpp=quadlets_per_packet_format_2[DC1394_FRAMERATE_NUM*mode_index+frame_rate_index];
}
else {
err=DC1394_INVALID_VIDEO_MODE;
DC1394_ERR_RTN(err,"Invalid framerate or mode");
}
return DC1394_SUCCESS;
case DC1394_FORMAT6:
case DC1394_FORMAT7:
err=DC1394_INVALID_VIDEO_FORMAT;
DC1394_ERR_RTN(err,"Format 6 and 7 don't have qpp");
break;
}
return DC1394_FAILURE;
}
/**********************************************************
get_quadlets_from_format
This routine reports the number of quadlets that make up a
frame given the format and mode
***********************************************************/
dc1394error_t
get_quadlets_from_format(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *quads)
{
uint32_t w, h, color_coding;
uint32_t bpp;
dc1394error_t err;
err=dc1394_get_image_size_from_video_mode(camera, video_mode, &w, &h);
DC1394_ERR_RTN(err, "Invalid mode ID");
err=dc1394_get_color_coding_from_video_mode(camera, video_mode, &color_coding);
DC1394_ERR_RTN(err, "Invalid mode ID");
err=dc1394_get_color_coding_bit_size(color_coding, &bpp);
DC1394_ERR_RTN(err, "Invalid color mode ID");
*quads=(w*h*bpp)/32;
return err;
}
dc1394bool_t
is_feature_bit_set(uint32_t value, dc1394feature_t feature)
{
if (feature >= DC1394_FEATURE_ZOOM) {
if (feature >= DC1394_FEATURE_CAPTURE_SIZE) {
feature+= 12;
}
feature-= DC1394_FEATURE_ZOOM;
}
else {
feature-= DC1394_FEATURE_MIN;
}
value&=(0x80000000UL >> feature);
if (value>0)
return DC1394_TRUE;
else
return DC1394_FALSE;
}
dc1394error_t
get_format_from_mode(dc1394video_mode_t mode, uint32_t *format)
{
dc1394error_t err=DC1394_SUCCESS;
if ((mode>=DC1394_VIDEO_MODE_FORMAT0_MIN)&&(mode<=DC1394_VIDEO_MODE_FORMAT0_MAX)) {
*format=DC1394_FORMAT0;
}
else if ((mode>=DC1394_VIDEO_MODE_FORMAT1_MIN)&&(mode<=DC1394_VIDEO_MODE_FORMAT1_MAX)) {
*format=DC1394_FORMAT1;
}
else if ((mode>=DC1394_VIDEO_MODE_FORMAT2_MIN)&&(mode<=DC1394_VIDEO_MODE_FORMAT2_MAX)) {
*format=DC1394_FORMAT2;
}
else if ((mode>=DC1394_VIDEO_MODE_FORMAT6_MIN)&&(mode<=DC1394_VIDEO_MODE_FORMAT6_MAX)) {
*format=DC1394_FORMAT6;
}
else if ((mode>=DC1394_VIDEO_MODE_FORMAT7_MIN)&&(mode<=DC1394_VIDEO_MODE_FORMAT7_MAX)) {
*format=DC1394_FORMAT7;
}
else {
err=DC1394_INVALID_VIDEO_MODE;
DC1394_ERR_RTN(err, "The supplied mode does not correspond to any format");
}
return err;
}
dc1394error_t
capture_basic_setup (dc1394camera_t * camera, dc1394video_frame_t * frame)
{
dc1394error_t err;
uint32_t bpp;
dc1394video_mode_t video_mode;
dc1394framerate_t framerate;
frame->camera = camera;
err=dc1394_video_get_mode(camera,&video_mode);
DC1394_ERR_RTN(err, "Unable to get current video mode");
frame->video_mode = video_mode;
err=dc1394_get_image_size_from_video_mode(camera, video_mode, frame->size, frame->size + 1);
DC1394_ERR_RTN(err,"Could not get width/height from format/mode");
if (dc1394_is_video_mode_scalable(video_mode)==DC1394_TRUE) {
err=dc1394_format7_get_packet_size(camera, video_mode,
&frame->packet_size);
DC1394_ERR_RTN(err, "Unable to get format 7 bytes per packet");
err=dc1394_format7_get_packets_per_frame(camera, video_mode,
&frame->packets_per_frame);
DC1394_ERR_RTN(err, "Unable to get format 7 packets per frame");
err = dc1394_format7_get_image_position (camera, video_mode,
frame->position, frame->position + 1);
DC1394_ERR_RTN(err, "Unable to get format 7 image position");
dc1394_format7_get_color_filter (camera, video_mode, &frame->color_filter);
}
else {
err=dc1394_video_get_framerate(camera,&framerate);
DC1394_ERR_RTN(err, "Unable to get current video framerate");
err=get_quadlets_per_packet(video_mode, framerate, &frame->packet_size);
DC1394_ERR_RTN(err, "Unable to get quadlets per packet");
frame->packet_size *= 4;
err= get_quadlets_from_format(camera, video_mode, &frame->packets_per_frame);
DC1394_ERR_RTN(err,"Could not get quadlets per frame");
frame->packets_per_frame /= frame->packet_size/4;
frame->position[0] = 0;
frame->position[1] = 0;
frame->color_filter = 0;
}
dc1394_log_debug("Mode %d, %dx%d, packet size %d, "
"packets per frame %d\n",
frame->video_mode, frame->size[0], frame->size[1],
frame->packet_size, frame->packets_per_frame);
if ((frame->packet_size <=0 )||
(frame->packets_per_frame <= 0)) {
return DC1394_FAILURE;
}
frame->yuv_byte_order = DC1394_BYTE_ORDER_UYVY;
frame->total_bytes = frame->packets_per_frame * frame->packet_size;
err = dc1394_get_color_coding_from_video_mode (camera, video_mode, &frame->color_coding);
DC1394_ERR_RTN(err, "Unable to get color coding");
frame->data_depth=0; // to avoid valgrind warnings
err = dc1394_video_get_data_depth (camera, &frame->data_depth);
DC1394_ERR_RTN(err, "Unable to get data depth");
err = dc1394_get_color_coding_bit_size (frame->color_coding, &bpp);
DC1394_ERR_RTN(err, "Unable to get bytes per pixel");
frame->stride = (bpp * frame->size[0])/8;
frame->image_bytes = frame->size[1] * frame->stride;
frame->padding_bytes = frame->total_bytes - frame->image_bytes;
frame->little_endian=0; // not used before 1.32 is out.
frame->data_in_padding=0; // not used before 1.32 is out.
return DC1394_SUCCESS;
}

191
dc1394/internal.h Normal file
View File

@ -0,0 +1,191 @@
/*
* 1394-Based Digital Camera Control Library
*
* Internal functions
*
* Written by Damien Douxchamps <ddouxchamps@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.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
*/
#ifndef __DC1394_INTERNAL_H__
#define __DC1394_INTERNAL_H__
#include "config.h"
#include "offsets.h"
#include "platform.h"
typedef struct _platform_info_t {
const platform_dispatch_t * dispatch;
const char * name;
platform_device_list_t * device_list;
platform_t * p;
} platform_info_t;
typedef struct _dc1394camera_priv_t {
dc1394camera_t camera;
platform_camera_t * pcam;
platform_info_t * platform;
uint64_t allocated_channels;
int allocated_bandwidth;
int iso_persist;
} dc1394camera_priv_t;
#define DC1394_CAMERA_PRIV(c) ((dc1394camera_priv_t *)c)
typedef struct _camera_info_t {
uint64_t guid;
int unit;
uint32_t unit_directory;
uint32_t unit_dependent_directory;
uint32_t unit_spec_ID;
uint32_t unit_sw_version;
char * vendor;
char * model;
uint32_t vendor_id;
uint32_t model_id;
platform_device_t * device;
platform_info_t * platform;
} camera_info_t;
struct __dc1394_t {
int num_platforms;
platform_info_t * platforms;
int num_cameras;
camera_info_t * cameras;
};
void juju_init(dc1394_t *d);
void linux_init(dc1394_t *d);
void macosx_init(dc1394_t *d);
void windows_init(dc1394_t *d);
void dc1394_usb_init(dc1394_t *d);
void register_platform (dc1394_t * d, const platform_dispatch_t * dispatch,
const char * name);
void free_enumeration (dc1394_t * d);
int refresh_enumeration (dc1394_t * d);
/* Definitions which application developers shouldn't care about */
#define CONFIG_ROM_BASE 0xFFFFF0000000ULL
#define DC1394_FEATURE_ON 0x80000000UL
#define DC1394_FEATURE_OFF 0x00000000UL
/* Maximum number of write/read retries */
#define DC1394_MAX_RETRIES 20
/* Maximum number of ISO channels */
/* Note that the maximum currently supported by a chipset is 8 so that 16 is already
a conservative number. A typical number of channels supported is 4. (TI chipset)
However, 1394b allows for more channels, hence we use 64 as the limit */
#define DC1394_NUM_ISO_CHANNELS 64
/* A hard compiled factor that makes sure async read and writes don't happen
too fast */
/* Toshiyuki Umeda: use randomize timings to avoid locking indefinitely.
If several thread are used the seed will be the same and the wait will therefor be
identical. A call to srand(getpid()) should be performed after calling the
raw1394_new_handle but I (Damien) not sure this would solve the problem as the handle
creation might have happened in the creating (as opposed to created) thread.*/
#define DC1394_SLOW_DOWN ((rand()%20)+10)
/* Maximum number of characters in vendor and model strings */
#define MAX_CHARS 256
// Format_0
#define DC1394_VIDEO_MODE_FORMAT0_MIN DC1394_VIDEO_MODE_160x120_YUV444
#define DC1394_VIDEO_MODE_FORMAT0_MAX DC1394_VIDEO_MODE_640x480_MONO16
#define DC1394_VIDEO_MODE_FORMAT0_NUM (DC1394_VIDEO_MODE_FORMAT0_MAX - DC1394_VIDEO_MODE_FORMAT0_MIN + 1)
// Format_1
#define DC1394_VIDEO_MODE_FORMAT1_MIN DC1394_VIDEO_MODE_800x600_YUV422
#define DC1394_VIDEO_MODE_FORMAT1_MAX DC1394_VIDEO_MODE_1024x768_MONO16
#define DC1394_VIDEO_MODE_FORMAT1_NUM (DC1394_VIDEO_MODE_FORMAT1_MAX - DC1394_VIDEO_MODE_FORMAT1_MIN + 1)
// Format_2
#define DC1394_VIDEO_MODE_FORMAT2_MIN DC1394_VIDEO_MODE_1280x960_YUV422
#define DC1394_VIDEO_MODE_FORMAT2_MAX DC1394_VIDEO_MODE_1600x1200_MONO16
#define DC1394_VIDEO_MODE_FORMAT2_NUM (DC1394_VIDEO_MODE_FORMAT2_MAX - DC1394_VIDEO_MODE_FORMAT2_MIN + 1)
// Format_6
#define DC1394_VIDEO_MODE_FORMAT6_MIN DC1394_VIDEO_MODE_EXIF
#define DC1394_VIDEO_MODE_FORMAT6_MAX DC1394_VIDEO_MODE_EXIF
#define DC1394_VIDEO_MODE_FORMAT6_NUM (DC1394_VIDEO_MODE_FORMAT6_MAX - DC1394_VIDEO_MODE_FORMAT6_MIN + 1)
/* Enumeration of camera image formats */
/* This could disappear from the API I think.*/
enum {
DC1394_FORMAT0= 384,
DC1394_FORMAT1,
DC1394_FORMAT2,
DC1394_FORMAT6=390,
DC1394_FORMAT7
};
#define DC1394_FORMAT_MIN DC1394_FORMAT0
#define DC1394_FORMAT_MAX DC1394_FORMAT7
//#define DC1394_FORMAT_NUM (DC1394_FORMAT_MAX - DC1394_FORMAT_MIN + 1)
/* DANGER: FORMAT_NUM should be 5!! FORMAT_NUM is therefor undefined to avoid problems */
#define FEATURE_TO_VALUE_OFFSET(feature, offset) \
{ \
if ( (feature > DC1394_FEATURE_MAX) || (feature < DC1394_FEATURE_MIN) ) \
return DC1394_FAILURE; \
else if (feature < DC1394_FEATURE_ZOOM) \
offset= REG_CAMERA_FEATURE_HI_BASE+(feature - DC1394_FEATURE_MIN)*0x04U; \
else if (feature >= DC1394_FEATURE_CAPTURE_SIZE) \
offset= REG_CAMERA_FEATURE_LO_BASE +(feature+12-DC1394_FEATURE_ZOOM)*0x04U;\
else \
offset= REG_CAMERA_FEATURE_LO_BASE +(feature-DC1394_FEATURE_ZOOM)*0x04U; \
}
#define FEATURE_TO_INQUIRY_OFFSET(feature, offset) \
{ \
if ( (feature > DC1394_FEATURE_MAX) || (feature < DC1394_FEATURE_MIN) ) \
return DC1394_FAILURE; \
else if (feature < DC1394_FEATURE_ZOOM) \
offset= REG_CAMERA_FEATURE_HI_BASE_INQ+(feature - DC1394_FEATURE_MIN)*0x04U; \
else if (feature >= DC1394_FEATURE_CAPTURE_SIZE) \
offset= REG_CAMERA_FEATURE_LO_BASE_INQ +(feature+12-DC1394_FEATURE_ZOOM)*0x04U;\
else \
offset= REG_CAMERA_FEATURE_LO_BASE_INQ +(feature-DC1394_FEATURE_ZOOM)*0x04U; \
}
/* Internal functions required by two different source files */
dc1394error_t
get_quadlets_per_packet(uint32_t mode, uint32_t frame_rate, uint32_t *qpp);
dc1394error_t
get_quadlets_from_format(dc1394camera_t *camera, uint32_t mode, uint32_t *quads);
dc1394error_t
get_format_from_mode(uint32_t mode, uint32_t *format);
dc1394bool_t
is_feature_bit_set(uint32_t value, uint32_t feature);
/*
dc1394bool_t
_dc1394_iidc_check_video_mode(dc1394camera_t *camera, dc1394video_mode_t *mode);
*/
dc1394error_t capture_basic_setup (dc1394camera_t * camera, dc1394video_frame_t * frame);
#endif /* _DC1394_INTERNAL_H */

132
dc1394/iso.c Normal file
View File

@ -0,0 +1,132 @@
/*
* 1394-Based Digital Camera Control Library
*
* Functions for the manual allocations of ISO ressources.
*
* Written by David Moore <dcm@acm.org>
*
* 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
*/
#include "iso.h"
#include "platform.h"
#include "internal.h"
dc1394error_t
dc1394_iso_set_persist (dc1394camera_t * camera)
{
dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
const platform_dispatch_t * d = cpriv->platform->dispatch;
if (!d->iso_set_persist)
return DC1394_FUNCTION_NOT_SUPPORTED;
dc1394error_t err;
if ((err = d->iso_set_persist (cpriv->pcam)) != DC1394_SUCCESS)
return err;
cpriv->iso_persist = 1;
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_iso_allocate_channel (dc1394camera_t * camera,
uint64_t channels_allowed, int * channel)
{
dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
dc1394error_t err;
const platform_dispatch_t * d = cpriv->platform->dispatch;
if (!d->iso_allocate_channel)
return DC1394_FUNCTION_NOT_SUPPORTED;
if (channels_allowed == 0) {
if (camera->bmode_capable)
channels_allowed = ~((uint64_t)0);
else
channels_allowed = 0xffff;
}
if ((err = d->iso_allocate_channel (cpriv->pcam, channels_allowed,
channel)) != DC1394_SUCCESS)
return err;
cpriv->allocated_channels |= ((uint64_t)1 << *channel);
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_iso_release_channel (dc1394camera_t * camera, int channel)
{
dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
const platform_dispatch_t * d = cpriv->platform->dispatch;
if (!d->iso_release_channel)
return DC1394_FUNCTION_NOT_SUPPORTED;
dc1394error_t err;
if ((err = d->iso_release_channel (cpriv->pcam, channel))
!= DC1394_SUCCESS)
return err;
cpriv->allocated_channels &= ~((uint64_t)1 << channel);
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_iso_allocate_bandwidth (dc1394camera_t * camera, int bandwidth_units)
{
dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
const platform_dispatch_t * d = cpriv->platform->dispatch;
if (!d->iso_allocate_bandwidth)
return DC1394_FUNCTION_NOT_SUPPORTED;
dc1394error_t err;
if ((err = d->iso_allocate_bandwidth (cpriv->pcam, bandwidth_units))
!= DC1394_SUCCESS)
return err;
cpriv->allocated_bandwidth += bandwidth_units;
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_iso_release_bandwidth (dc1394camera_t * camera, int bandwidth_units)
{
dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
const platform_dispatch_t * d = cpriv->platform->dispatch;
if (!d->iso_release_bandwidth)
return DC1394_FUNCTION_NOT_SUPPORTED;
dc1394error_t err;
if ((err = d->iso_release_bandwidth (cpriv->pcam, bandwidth_units))
!= DC1394_SUCCESS)
return err;
cpriv->allocated_bandwidth -= bandwidth_units;
if (cpriv->allocated_bandwidth < 0)
cpriv->allocated_bandwidth = 0;
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_iso_release_all (dc1394camera_t * camera)
{
dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
int i;
for (i = 0; i < 64; i++)
if (cpriv->allocated_channels & ((uint64_t)1 << i))
dc1394_iso_release_channel (camera, i);
if (cpriv->allocated_bandwidth)
dc1394_iso_release_bandwidth (camera, cpriv->allocated_bandwidth);
if (cpriv->allocated_bandwidth || cpriv->allocated_channels)
return DC1394_FAILURE;
return DC1394_SUCCESS;
}

167
dc1394/iso.h Normal file
View File

@ -0,0 +1,167 @@
/*
* 1394-Based Digital Camera Control Library
*
* Functions for the manual allocations of ISO ressources.
*
* Written by David Moore <dcm@acm.org>
*
* 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
*/
#ifndef __DC1394_ISO_H__
#define __DC1394_ISO_H__
/*! \file dc1394/iso.h
\brief Functions to manually manage the ISO resources (channels and bandwidth)
\author Damien Douxchamps: coding
\author Peter Antoniac: documentation maintainer
More details soon
*/
#include <dc1394/log.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* dc1394_iso_set_persist
* @param camera A camera handle.
*
* Calling this function will cause isochronous channel and bandwidth
* allocations to persist beyond the lifetime of this dc1394camera_t
* instance. Normally (when this function is not called), any allocations
* would be automatically released upon freeing this camera or a
* premature shutdown of the application (if possible). For this function
* to be used, it must be called prior to any allocations or an error will
* be returned.
*
* @return \a DC1394_SUCCESS if the operation succeeded.
* \a DC1394_FUNCTION_NOT_SUPPORTED if the current platform/driver does not
* allow persistent allocations.
*/
dc1394error_t dc1394_iso_set_persist (dc1394camera_t * camera);
/**
* dc1394_iso_allocate_channel:
* @param camera A camera handle.
* @param channels_allowed A bitmask of acceptable channels for the allocation.
* The LSB corresponds to channel 0 and the MSB corresponds to channel
* 63. Only channels whose bit is set will be considered for the allocation.
* If \a channels_allowed = 0, the complete set of channels supported by
* this camera will be considered for the allocation.
* @param channel The allocated channel number is returned here.
*
* Allocates an isochronous channel. This
* function may be called multiple times, each time allocating an additional
* channel. The channel is automatically re-allocated if there is a bus
* reset. The channel is automatically released when this dc1394camera_t
* is freed or if the application shuts down prematurely. If the channel
* needs to persist beyond the lifetime of this application, call
* \a dc1394_iso_set_persist() first. Note that this function does _not_
* automatically program @a camera to use the allocated channel for isochronous
* streaming. You must do that manually using \a dc1394_video_set_iso_channel().
*
* @return \a DC1394_SUCCESS if the operation succeeded. The allocated
* channel is stored in \a channel. \a DC1394_FUNCTION_NOT_SUPPORTED if the
* current driver/platform does not allow channel allocation.
* \a DC1394_NO_ISO_CHANNEL if none of the requested channels are available.
*/
dc1394error_t dc1394_iso_allocate_channel (dc1394camera_t * camera,
uint64_t channels_allowed, int * channel);
/**
* dc1394_iso_release_channel:
* @param camera A camera handle.
* @param channel The channel number to release.
*
* Releases a previously allocated channel. It is acceptable to release
* channels that were allocated by a different process or host. If
* attempting to release a channel that is already released, the function
* will succeed.
*
* @return \a DC1394_SUCCESS if the operation succeeded.
* \a DC1394_FUNCTION_NOT_SUPPORTED if the current driver/platform does not
* allow channel release.
*/
dc1394error_t dc1394_iso_release_channel (dc1394camera_t * camera,
int channel);
/**
* dc1394_iso_allocate_bandwidth:
* @param camera A camera handle.
* @param bandwidth_units The number of isochronous bandwidth units to allocate.
*
* Allocates isochronous bandwidth. This functions allocates bandwidth
* _in addition_ to any previous allocations. It may be called multiple
* times. The bandwidth is automatically re-allocated if there is a bus
* reset. The bandwidth is automatically released if this camera is freed
* or the application shuts down prematurely. If the bandwidth needs to
* persist beyond the lifetime of this application, call
* \a dc1394_iso_set_persist() first.
*
* @return \a DC1394_SUCCESS if the operation succeeded.
* \a DC1394_FUNCTION_NOT_SUPPORTED if the current driver/platform does not
* allow bandwidth allocation. \a DC1394_NO_BANDWIDTH if there is not enough
* available bandwidth to support the allocation. In this case,
* no bandwidth is allocated.
*/
dc1394error_t dc1394_iso_allocate_bandwidth (dc1394camera_t * camera,
int bandwidth_units);
/**
* dc1394_iso_release_bandwidth:
* @param camera A camera handle.
* @param bandwidth_units The number of isochronous bandwidth units to free.
*
* Releases previously allocated isochronous bandwidth. Each \a dc1394camera_t
* keeps track of a running total of bandwidth that has been allocated.
* Released bandwidth is subtracted from this total for the sake of
* automatic re-allocation and automatic release on shutdown. It is also
* acceptable for a camera to release more bandwidth than it has allocated
* (to clean up for another process for example). In this case, the
* running total of bandwidth is not affected. It is acceptable to
* release more bandwidth than is allocated in total for the bus. In this
* case, all bandwidth is released and the function succeeds.
*
* @return \a DC1394_SUCCESS if the operation succeeded.
* \a DC1394_FUNCTION_NOT_SUPPORTED if the current driver/platform does not
* allow bandwidth release.
*/
dc1394error_t dc1394_iso_release_bandwidth (dc1394camera_t * camera,
int bandwidth_units);
/**
* dc1394_iso_release_all:
* @param camera A camera handle.
*
* Releases all channels and bandwidth that have been previously allocated
* for this dc1394camera_t. Note that this information can only be tracked
* per process, and there is no knowledge of allocations for this camera
* by previous processes. To release resources in such a case, the manual
* release functions \a dc1394_iso_release_channel() and
* \a dc1394_iso_release_bandwidth() must be used.
*
* @return \a DC1394_SUCCESS if the operation succeeded. \a DC1394_FAILURE
* if some resources were not able to be released.
*/
dc1394error_t dc1394_iso_release_all (dc1394camera_t * camera);
#ifdef __cplusplus
}
#endif
#endif

17
dc1394/juju/Makefile.am Normal file
View File

@ -0,0 +1,17 @@
pkgjujuincludedir = $(pkgincludedir)/juju
if HAVE_LINUX
noinst_LTLIBRARIES = libdc1394-juju.la
# headers to be installed
pkgjujuinclude_HEADERS =
endif
AM_CFLAGS = -I$(top_srcdir) -I$(top_srcdir)/dc1394
libdc1394_juju_la_SOURCES = \
control.c \
capture.c \
juju.h \
firewire-cdev.h \
firewire-constants.h

687
dc1394/juju/Makefile.in Normal file
View File

@ -0,0 +1,687 @@
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = dc1394/juju
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp $(pkgjujuinclude_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/ax_check_framework.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libdc1394_juju_la_LIBADD =
am_libdc1394_juju_la_OBJECTS = control.lo capture.lo
libdc1394_juju_la_OBJECTS = $(am_libdc1394_juju_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
@HAVE_LINUX_TRUE@am_libdc1394_juju_la_rpath =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(libdc1394_juju_la_SOURCES)
DIST_SOURCES = $(libdc1394_juju_la_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(pkgjujuincludedir)"
HEADERS = $(pkgjujuinclude_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
pkgincludedir = @pkgincludedir@
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
DX_CONFIG = @DX_CONFIG@
DX_DOCDIR = @DX_DOCDIR@
DX_DOT = @DX_DOT@
DX_DOXYGEN = @DX_DOXYGEN@
DX_DVIPS = @DX_DVIPS@
DX_EGREP = @DX_EGREP@
DX_ENV = @DX_ENV@
DX_FLAG_chi = @DX_FLAG_chi@
DX_FLAG_chm = @DX_FLAG_chm@
DX_FLAG_doc = @DX_FLAG_doc@
DX_FLAG_dot = @DX_FLAG_dot@
DX_FLAG_html = @DX_FLAG_html@
DX_FLAG_man = @DX_FLAG_man@
DX_FLAG_pdf = @DX_FLAG_pdf@
DX_FLAG_ps = @DX_FLAG_ps@
DX_FLAG_rtf = @DX_FLAG_rtf@
DX_FLAG_xml = @DX_FLAG_xml@
DX_HHC = @DX_HHC@
DX_LATEX = @DX_LATEX@
DX_MAKEINDEX = @DX_MAKEINDEX@
DX_PDFLATEX = @DX_PDFLATEX@
DX_PERL = @DX_PERL@
DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FRAMEWORK_IOKIT = @FRAMEWORK_IOKIT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
LIBUSB_LIBS = @LIBUSB_LIBS@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
SDL_CONFIG = @SDL_CONFIG@
SDL_LIBS = @SDL_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
XMKMF = @XMKMF@
XV_CFLAGS = @XV_CFLAGS@
XV_LIBS = @XV_LIBS@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_age = @lt_age@
lt_current = @lt_current@
lt_revision = @lt_revision@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
platform_LDFLAGS = @platform_LDFLAGS@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
pkgjujuincludedir = $(pkgincludedir)/juju
@HAVE_LINUX_TRUE@noinst_LTLIBRARIES = libdc1394-juju.la
# headers to be installed
@HAVE_LINUX_TRUE@pkgjujuinclude_HEADERS =
AM_CFLAGS = -I$(top_srcdir) -I$(top_srcdir)/dc1394
libdc1394_juju_la_SOURCES = \
control.c \
capture.c \
juju.h \
firewire-cdev.h \
firewire-constants.h
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu dc1394/juju/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu dc1394/juju/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
libdc1394-juju.la: $(libdc1394_juju_la_OBJECTS) $(libdc1394_juju_la_DEPENDENCIES) $(EXTRA_libdc1394_juju_la_DEPENDENCIES)
$(AM_V_CCLD)$(LINK) $(am_libdc1394_juju_la_rpath) $(libdc1394_juju_la_OBJECTS) $(libdc1394_juju_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/capture.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/control.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-pkgjujuincludeHEADERS: $(pkgjujuinclude_HEADERS)
@$(NORMAL_INSTALL)
@list='$(pkgjujuinclude_HEADERS)'; test -n "$(pkgjujuincludedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(pkgjujuincludedir)'"; \
$(MKDIR_P) "$(DESTDIR)$(pkgjujuincludedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgjujuincludedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgjujuincludedir)" || exit $$?; \
done
uninstall-pkgjujuincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(pkgjujuinclude_HEADERS)'; test -n "$(pkgjujuincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(pkgjujuincludedir)'; $(am__uninstall_files_from_dir)
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(pkgjujuincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-pkgjujuincludeHEADERS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-pkgjujuincludeHEADERS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-pkgjujuincludeHEADERS install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
uninstall-pkgjujuincludeHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

422
dc1394/juju/capture.c Normal file
View File

@ -0,0 +1,422 @@
/*
* 1394-Based Digital Camera Control Library
*
* Juju backend for dc1394
*
* Written by Kristian Hoegsberg <krh@bitplanet.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.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
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <errno.h>
#include <poll.h>
#include <inttypes.h>
#include "juju/juju.h"
#define ptr_to_u64(p) ((__u64)(unsigned long)(p))
#define u64_to_ptr(p) ((void *)(unsigned long)(p))
static dc1394error_t
init_frame(platform_camera_t *craw, int index, dc1394video_frame_t *proto)
{
int N = 8; /* Number of iso packets per fw_cdev_iso_packet. */
struct juju_frame *f = craw->frames + index;
size_t total;
int i, count;
memcpy (&f->frame, proto, sizeof f->frame);
f->frame.image = craw->buffer + index * proto->total_bytes;
f->frame.id = index;
count = (proto->packets_per_frame + N - 1) / N;
f->size = count * sizeof *f->packets;
f->packets = malloc(f->size);
if (f->packets == NULL)
return DC1394_MEMORY_ALLOCATION_FAILURE;
memset(f->packets, 0, f->size);
total = proto->packets_per_frame;
for (i = 0; i < count; i++) {
if (total < N)
N = total;
f->packets[i].control = FW_CDEV_ISO_HEADER_LENGTH(craw->header_size * N)
| FW_CDEV_ISO_PAYLOAD_LENGTH(proto->packet_size * N);
total -= N;
}
f->packets[0].control |= FW_CDEV_ISO_SKIP;
f->packets[i - 1].control |= FW_CDEV_ISO_INTERRUPT;
return DC1394_SUCCESS;
}
static void
release_frame(platform_camera_t *craw, int index)
{
struct juju_frame *f = craw->frames + index;
free(f->packets);
}
dc1394error_t
queue_frame (platform_camera_t *craw, int index)
{
struct juju_frame *f = craw->frames + index;
struct fw_cdev_queue_iso queue;
int retval;
queue.size = f->size;
queue.data = ptr_to_u64(f->frame.image);
queue.packets = ptr_to_u64(f->packets);
queue.handle = craw->iso_handle;
retval = ioctl(craw->iso_fd, FW_CDEV_IOC_QUEUE_ISO, &queue);
if (retval < 0) {
dc1394_log_error("queue_iso failed; %m");
return DC1394_IOCTL_FAILURE;
}
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_juju_capture_setup(platform_camera_t *craw, uint32_t num_dma_buffers,
uint32_t flags)
{
struct fw_cdev_create_iso_context create;
struct fw_cdev_start_iso start_iso;
dc1394error_t err;
dc1394video_frame_t proto;
int i, j, retval;
dc1394camera_t * camera = craw->camera;
if (flags & DC1394_CAPTURE_FLAGS_DEFAULT)
flags = DC1394_CAPTURE_FLAGS_CHANNEL_ALLOC |
DC1394_CAPTURE_FLAGS_BANDWIDTH_ALLOC;
craw->flags = flags;
// if capture is already set, abort
if (craw->capture_is_set>0)
return DC1394_CAPTURE_IS_RUNNING;
// if auto iso is requested, stop ISO (if necessary)
if (flags & DC1394_CAPTURE_FLAGS_AUTO_ISO) {
dc1394switch_t is_iso_on;
dc1394_video_get_transmission(camera, &is_iso_on);
if (is_iso_on == DC1394_ON) {
err=dc1394_video_set_transmission(camera, DC1394_OFF);
DC1394_ERR_RTN(err,"Could not stop ISO!");
}
}
if (capture_basic_setup(camera, &proto) != DC1394_SUCCESS) {
dc1394_log_error("basic setup failed");
return DC1394_FAILURE;
}
if (flags & (DC1394_CAPTURE_FLAGS_CHANNEL_ALLOC |
DC1394_CAPTURE_FLAGS_BANDWIDTH_ALLOC)) {
uint64_t channels_allowed = 0;
unsigned int bandwidth_units = 0;
int channel;
if (flags & DC1394_CAPTURE_FLAGS_CHANNEL_ALLOC)
channels_allowed = 0xffff;
if (flags & DC1394_CAPTURE_FLAGS_BANDWIDTH_ALLOC)
dc1394_video_get_bandwidth_usage (camera, &bandwidth_units);
err = juju_iso_allocate (craw, channels_allowed,
bandwidth_units, &craw->capture_iso_resource);
if (err == DC1394_SUCCESS) {
channel = craw->capture_iso_resource->channel;
} else if (err == DC1394_FUNCTION_NOT_SUPPORTED) {
channel = craw->node_id & 0x3f;
dc1394_log_warning ("iso allocation not available in this kernel, "
"using channel %d...", channel);
} else {
dc1394_log_error ("juju: Failed to allocate iso resources");
return err;
}
if (dc1394_video_set_iso_channel (camera, channel) != DC1394_SUCCESS)
return DC1394_NO_ISO_CHANNEL;
}
if (dc1394_video_get_iso_channel (camera, &craw->iso_channel)
!= DC1394_SUCCESS)
return DC1394_FAILURE;
dc1394_log_debug ("juju: Receiving from iso channel %d", craw->iso_channel);
craw->iso_fd = open(craw->filename, O_RDWR);
if (craw->iso_fd < 0) {
dc1394_log_error("error opening file: %s", strerror (errno));
return DC1394_FAILURE;
}
create.type = FW_CDEV_ISO_CONTEXT_RECEIVE;
create.header_size = craw->header_size;
create.channel = craw->iso_channel;
// create.speed = SCODE_400; // not necessary: ignored by kernel for ISO reception.
err = DC1394_IOCTL_FAILURE;
if (ioctl(craw->iso_fd, FW_CDEV_IOC_CREATE_ISO_CONTEXT, &create) < 0) {
dc1394_log_error("failed to create iso context");
goto error_fd;
}
craw->iso_handle = create.handle;
craw->num_frames = num_dma_buffers;
craw->current = -1;
craw->buffer_size = proto.total_bytes * num_dma_buffers;
craw->buffer =
mmap(NULL, craw->buffer_size, PROT_READ | PROT_WRITE , MAP_SHARED, craw->iso_fd, 0);
err = DC1394_IOCTL_FAILURE;
if (craw->buffer == MAP_FAILED)
goto error_fd;
err = DC1394_MEMORY_ALLOCATION_FAILURE;
craw->frames = malloc (num_dma_buffers * sizeof *craw->frames);
if (craw->frames == NULL)
goto error_mmap;
for (i = 0; i < num_dma_buffers; i++) {
err = init_frame(craw, i, &proto);
if (err != DC1394_SUCCESS) {
dc1394_log_error("error initing frames");
break;
}
}
if (err != DC1394_SUCCESS) {
for (j = 0; j < i; j++)
release_frame(craw, j);
goto error_mmap;
}
for (i = 0; i < num_dma_buffers; i++) {
err = queue_frame(craw, i);
if (err != DC1394_SUCCESS) {
dc1394_log_error("error queuing");
goto error_frames;
}
}
craw->packets_per_frame = proto.packets_per_frame; // HPK 20161209
// starting from here we use the ISO channel so we set the flag in
// the camera struct:
craw->capture_is_set = 1;
start_iso.cycle = -1;
start_iso.tags = FW_CDEV_ISO_CONTEXT_MATCH_ALL_TAGS;
start_iso.sync = 1;
start_iso.handle = craw->iso_handle;
retval = ioctl(craw->iso_fd, FW_CDEV_IOC_START_ISO, &start_iso);
err = DC1394_IOCTL_FAILURE;
if (retval < 0) {
dc1394_log_error("error starting iso");
goto error_frames;
}
// if auto iso is requested, start ISO
if (flags & DC1394_CAPTURE_FLAGS_AUTO_ISO) {
err=dc1394_video_set_transmission(camera, DC1394_ON);
DC1394_ERR_RTN(err,"Could not start ISO!");
craw->iso_auto_started=1;
}
return DC1394_SUCCESS;
error_frames:
for (i = 0; i < num_dma_buffers; i++)
release_frame(craw, i);
error_mmap:
munmap(craw->buffer, craw->buffer_size);
error_fd:
close(craw->iso_fd);
return err;
}
dc1394error_t
dc1394_juju_capture_stop(platform_camera_t *craw)
{
dc1394camera_t * camera = craw->camera;
struct fw_cdev_stop_iso stop;
int i;
if (craw->capture_is_set == 0)
return DC1394_CAPTURE_IS_NOT_SET;
stop.handle = craw->iso_handle;
if (ioctl(craw->iso_fd, FW_CDEV_IOC_STOP_ISO, &stop) < 0)
return DC1394_IOCTL_FAILURE;
munmap(craw->buffer, craw->buffer_size);
close(craw->iso_fd);
for (i = 0; i<craw->num_frames; i++)
release_frame(craw, i);
free (craw->frames);
craw->frames = NULL;
craw->capture_is_set = 0;
if (craw->capture_iso_resource) {
if (juju_iso_deallocate (craw, craw->capture_iso_resource) < 0)
dc1394_log_warning ("juju: Failed to deallocate iso resources");
craw->capture_iso_resource = NULL;
}
// stop ISO if it was started automatically
if (craw->iso_auto_started>0) {
dc1394error_t err=dc1394_video_set_transmission(camera, DC1394_OFF);
DC1394_ERR_RTN(err,"Could not stop ISO!");
craw->iso_auto_started=0;
}
return DC1394_SUCCESS;
}
static uint32_t
bus_time_to_usec (uint32_t bus)
{
uint32_t sec = (bus & 0xe000000) >> 25;
uint32_t cycles = (bus & 0x1fff000) >> 12;
uint32_t subcycle = (bus & 0x0000fff);
return sec * 1000000 + cycles * 125 + subcycle * 125 / 3072;
}
dc1394error_t
dc1394_juju_capture_dequeue (platform_camera_t * craw,
dc1394capture_policy_t policy, dc1394video_frame_t **frame_return)
{
struct pollfd fds[1];
struct juju_frame *f;
int err, len;
struct fw_cdev_get_cycle_timer tm;
if(craw->frames==NULL || craw->capture_is_set==0) {
*frame_return=NULL;
return DC1394_CAPTURE_IS_NOT_SET;
}
struct {
struct fw_cdev_event_iso_interrupt i;
__u32 headers[craw->packets_per_frame*2 + 16]; // HPK 20161209
} iso;
if ( (policy<DC1394_CAPTURE_POLICY_MIN) || (policy>DC1394_CAPTURE_POLICY_MAX) )
return DC1394_INVALID_CAPTURE_POLICY;
// default: return NULL in case of failures or lack of frames
*frame_return=NULL;
fds[0].fd = craw->iso_fd;
fds[0].events = POLLIN;
while (1) {
err = poll(fds, 1, (policy == DC1394_CAPTURE_POLICY_POLL) ? 0 : -1);
if (err < 0) {
if (errno == EINTR)
continue;
dc1394_log_error("poll() failed for device %s.", craw->filename);
return DC1394_FAILURE;
} else if (err == 0) {
return DC1394_SUCCESS;
}
len = read (craw->iso_fd, &iso, sizeof iso);
if (len < 0) {
dc1394_log_error("Juju: dequeue failed to read a response: %m");
return DC1394_FAILURE;
}
if (iso.i.type == FW_CDEV_EVENT_ISO_INTERRUPT)
break;
}
craw->current = (craw->current + 1) % craw->num_frames;
f = craw->frames + craw->current;
dc1394_log_debug("Juju: got iso event, cycle 0x%04x, header_len %d",
iso.i.cycle, iso.i.header_length);
f->frame.frames_behind = 0;
f->frame.timestamp = 0;
/* Compute timestamp */
if (ioctl(craw->iso_fd, FW_CDEV_IOC_GET_CYCLE_TIMER, &tm) == 0) {
/* Current bus time in usec as retrieved by the ioctl */
uint32_t bus_time = bus_time_to_usec(tm.cycle_timer);
/* Bus time of the interrupt packet (end of frame) */
uint32_t dma_time = iso.i.cycle;
/* Estimated usec between start of frame and end of frame */
uint32_t diff =
(craw->frames[0].frame.packets_per_frame - 1) * 125;
/* If per-packet timestamps are available in the headers use them */
if (craw->header_size >= 8) {
uint8_t * b = (uint8_t *)(iso.i.header + 1);
/* Bus time of the first frame in the packet */
dma_time = (b[2] << 8) | b[3];
dc1394_log_debug("Juju: using cycle 0x%04x (diff was %d)",
dma_time, diff);
diff = 0;
}
/* Convert to usec */
dma_time = bus_time_to_usec(dma_time << 12);
/* Amount to subtract from local_time to get frame start time */
diff += (bus_time + 8000000 - dma_time) % 8000000;
dc1394_log_debug("Juju: frame latency %d us", diff);
f->frame.timestamp = tm.local_time - diff;
}
*frame_return = &f->frame;
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_juju_capture_enqueue (platform_camera_t * craw,
dc1394video_frame_t * frame)
{
dc1394camera_t * camera = craw->camera;
int err;
err = DC1394_INVALID_ARGUMENT_VALUE;
if (frame->camera != camera)
DC1394_ERR_RTN(err, "camera does not match frame's camera");
err = queue_frame (craw, frame->id);
DC1394_ERR_RTN(err, "Failed to queue frame");
return DC1394_SUCCESS;
}
int
dc1394_juju_capture_get_fileno (platform_camera_t * craw)
{
return craw->iso_fd;
}

696
dc1394/juju/control.c Normal file
View File

@ -0,0 +1,696 @@
/*
* 1394-Based Digital Camera Control Library
*
* Juju backend for dc1394
*
* Written by Kristian Hoegsberg <krh@bitplanet.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.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
*/
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <dirent.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <inttypes.h>
#include <arpa/inet.h>
#include "config.h"
#include "platform.h"
#include "internal.h"
#include "juju.h"
#define ptr_to_u64(p) ((__u64)(unsigned long)(p))
#define u64_to_ptr(p) ((void *)(unsigned long)(p))
static platform_t *
dc1394_juju_new (void)
{
DIR * dir;
struct dirent * de;
int num_devices = 0;
dir = opendir("/dev");
if (!dir) {
dc1394_log_error("Failed to create juju: opendir: %m");
return NULL;
}
while ((de = readdir(dir))) {
if (strncmp(de->d_name, "fw", 2) != 0)
continue;
dc1394_log_debug("Juju: Found /dev/%s", de->d_name);
num_devices++;
}
closedir(dir);
if (num_devices == 0) {
dc1394_log_debug("Juju: Found no devices /dev/fw*");
return NULL;
}
platform_t * p = calloc (1, sizeof (platform_t));
return p;
}
static void
dc1394_juju_free (platform_t * p)
{
free (p);
}
struct _platform_device_t {
uint32_t config_rom[256];
char filename[32];
};
static platform_device_list_t *
dc1394_juju_get_device_list (platform_t * p)
{
DIR * dir;
struct dirent * de;
platform_device_list_t * list;
uint32_t allocated_size = 64;
list = calloc (1, sizeof (platform_device_list_t));
if (!list)
return NULL;
list->devices = malloc(allocated_size * sizeof(platform_device_t *));
if (!list->devices) {
free (list);
return NULL;
}
dir = opendir("/dev");
if (dir == NULL) {
dc1394_log_error("opendir: %m");
free (list->devices);
free (list);
return NULL;
}
while ((de = readdir(dir))) {
char filename[32];
int fd;
platform_device_t * device;
struct fw_cdev_get_info get_info;
struct fw_cdev_event_bus_reset reset;
if (strncmp(de->d_name, "fw", 2) != 0 ||
de->d_name[2] < '0' || de->d_name[2] > '9')
continue;
snprintf(filename, sizeof filename, "/dev/%s", de->d_name);
fd = open(filename, O_RDWR);
if (fd < 0) {
dc1394_log_debug("Juju: Failed to open %s: %s", filename,
strerror (errno));
continue;
}
dc1394_log_debug("Juju: Opened %s successfully", filename);
device = malloc (sizeof (platform_device_t));
if (!device) {
close (fd);
continue;
}
get_info.version = FW_CDEV_VERSION;
get_info.rom = ptr_to_u64(&device->config_rom);
get_info.rom_length = 1024;
get_info.bus_reset = ptr_to_u64(&reset);
if (ioctl(fd, FW_CDEV_IOC_GET_INFO, &get_info) < 0) {
dc1394_log_error("GET_CONFIG_ROM failed for %s: %m",filename);
free (device);
close(fd);
continue;
}
close (fd);
strcpy (device->filename, filename);
list->devices[list->num_devices] = device;
list->num_devices++;
if (list->num_devices >= allocated_size) {
allocated_size += 64;
list->devices = realloc (list->devices, allocated_size * sizeof (platform_device_t *));
if (!list->devices)
return NULL;
}
}
closedir(dir);
return list;
}
static void
dc1394_juju_free_device_list (platform_device_list_t * d)
{
int i;
for (i = 0; i < d->num_devices; i++)
free (d->devices[i]);
free (d->devices);
free (d);
}
static int
dc1394_juju_device_get_config_rom (platform_device_t * device,
uint32_t * quads, int * num_quads)
{
if (*num_quads > 256)
*num_quads = 256;
memcpy (quads, device->config_rom, *num_quads * sizeof (uint32_t));
return 0;
}
static juju_iso_info *
add_iso_resource (platform_camera_t *cam)
{
juju_iso_info *res = calloc (1, sizeof (juju_iso_info));
if (!res)
return NULL;
res->next = cam->iso_resources;
cam->iso_resources = res;
return res;
}
static void
remove_iso_resource (platform_camera_t *cam, juju_iso_info * res)
{
juju_iso_info **ptr = &cam->iso_resources;
while (*ptr) {
if (*ptr == res) {
*ptr = res->next;
free (res);
return;
}
ptr = &(*ptr)->next;
}
}
static platform_camera_t *
dc1394_juju_camera_new (platform_t * p, platform_device_t * device, uint32_t unit_directory_offset)
{
int fd;
platform_camera_t * camera;
struct fw_cdev_get_info get_info;
struct fw_cdev_event_bus_reset reset;
fd = open(device->filename, O_RDWR);
if (fd < 0) {
dc1394_log_error("could not open device %s: %m", device->filename);
return NULL;
}
get_info.version = FW_CDEV_VERSION;
get_info.rom = 0;
get_info.rom_length = 0;
get_info.bus_reset = ptr_to_u64(&reset);
if (ioctl(fd, FW_CDEV_IOC_GET_INFO, &get_info) < 0) {
dc1394_log_error("IOC_GET_INFO failed for a device %s: %m",device->filename);
close(fd);
return NULL;
}
dc1394_log_debug("Juju: kernel API has version %d", get_info.version);
camera = calloc (1, sizeof (platform_camera_t));
camera->fd = fd;
camera->generation = reset.generation;
camera->node_id = reset.node_id;
strcpy (camera->filename, device->filename);
camera->header_size = 4;
if (get_info.version >= 2)
camera->header_size = 8;
camera->kernel_abi_version=get_info.version;
return camera;
}
static void dc1394_juju_camera_free (platform_camera_t * cam)
{
while (cam->iso_resources)
remove_iso_resource (cam, cam->iso_resources);
close (cam->fd);
free (cam);
}
static void
dc1394_juju_camera_set_parent (platform_camera_t * cam, dc1394camera_t * parent)
{
cam->camera = parent;
}
static dc1394error_t
dc1394_juju_camera_print_info (platform_camera_t * camera, FILE *fd)
{
fprintf(fd,"------ Camera platform-specific information ------\n");
fprintf(fd,"Device filename : %s\n", camera->filename);
return DC1394_SUCCESS;
}
#define MIN(a,b) ((a) < (b) ? (a) : (b))
typedef struct _juju_response_info {
int got_response;
uint32_t rcode;
uint32_t *data;
int num_quads;
int actual_num_quads;
} juju_response_info;
static int
juju_handle_event (platform_camera_t * cam)
{
union {
struct {
struct fw_cdev_event_response r;
__u32 buffer[cam->max_response_quads];
} response;
struct fw_cdev_event_bus_reset reset;
struct fw_cdev_event_iso_resource resource;
} u;
int len, i;
juju_response_info *resp_info;
juju_iso_info *iso_info;
len = read (cam->fd, &u, sizeof u);
if (len < 0) {
dc1394_log_error("juju: Read failed: %m");
return -1;
}
switch (u.reset.type) {
case FW_CDEV_EVENT_BUS_RESET:
cam->generation = u.reset.generation;
cam->node_id = u.reset.node_id;
dc1394_log_debug ("juju: Bus reset, gen %d, node 0x%x",
cam->generation, cam->node_id);
break;
case FW_CDEV_EVENT_RESPONSE:
if (!u.response.r.closure) {
dc1394_log_warning ("juju: Unsolicited response, rcode %x len %d",
u.response.r.rcode, u.response.r.length);
break;
}
resp_info = u64_to_ptr(u.response.r.closure);
resp_info->rcode = u.response.r.rcode;
resp_info->actual_num_quads = u.response.r.length/4;
resp_info->got_response = 1;
if (resp_info->rcode || !resp_info->data)
break;
if (cam->max_response_quads < resp_info->actual_num_quads) {
dc1394_log_error ("juju: read buffer too small, have %d needed %d",
cam->max_response_quads, resp_info->actual_num_quads);
break;
}
len = MIN(resp_info->actual_num_quads, resp_info->num_quads);
for (i = 0; i < len; i++)
resp_info->data[i] = ntohl (u.response.r.data[i]);
break;
case FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED:
if (!u.resource.closure) {
dc1394_log_warning ("juju: Spurious ISO allocation event: "
"handle %d, chan %d, bw %d", u.resource.handle,
u.resource.channel, u.resource.bandwidth);
break;
}
iso_info = u64_to_ptr(u.resource.closure);
if (iso_info->handle != u.resource.handle)
dc1394_log_warning ("juju: ISO alloc handle was %d, expected %d",
u.resource.handle, iso_info->handle);
dc1394_log_debug ("juju: Allocated handle %d: chan %d bw %d",
u.resource.handle, u.resource.channel, u.resource.bandwidth);
iso_info->got_alloc = 1;
iso_info->channel = u.resource.channel;
iso_info->bandwidth = u.resource.bandwidth;
break;
case FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED:
if (!u.resource.closure) {
dc1394_log_warning ("juju: Spurious ISO deallocation event: "
"handle %d, chan %d, bw %d", u.resource.handle,
u.resource.channel, u.resource.bandwidth);
break;
}
iso_info = u64_to_ptr(u.resource.closure);
if (iso_info->handle != u.resource.handle)
dc1394_log_warning ("juju: ISO dealloc handle was %d, expected %d",
u.resource.handle, iso_info->handle);
dc1394_log_debug ("juju: Deallocated handle %d: chan %d bw %d",
u.resource.handle, u.resource.channel, u.resource.bandwidth);
iso_info->got_dealloc = 1;
iso_info->channel = u.resource.channel;
iso_info->bandwidth = u.resource.bandwidth;
break;
default:
dc1394_log_warning ("juju: Unhandled event type %d",
u.reset.type);
break;
}
return 0;
}
static dc1394error_t
do_transaction(platform_camera_t * cam, int tcode, uint64_t offset,
const uint32_t * in, uint32_t * out, uint32_t num_quads)
{
struct fw_cdev_send_request request;
juju_response_info resp;
int i, len;
uint32_t in_buffer[in ? num_quads : 0];
int retry = DC1394_MAX_RETRIES;
for (i = 0; in && i < num_quads; i++)
in_buffer[i] = htonl (in[i]);
resp.data = out;
resp.num_quads = out ? num_quads : 0;
cam->max_response_quads = resp.num_quads;
request.closure = ptr_to_u64(&resp);
request.offset = CONFIG_ROM_BASE + offset;
request.data = ptr_to_u64(in_buffer);
request.length = num_quads * 4;
request.tcode = tcode;
while (retry > 0) {
int retval;
request.generation = cam->generation;
int iotype = FW_CDEV_IOC_SEND_REQUEST;
if (cam->broadcast_enabled && (tcode == TCODE_WRITE_BLOCK_REQUEST ||
tcode == TCODE_WRITE_QUADLET_REQUEST))
iotype = FW_CDEV_IOC_SEND_BROADCAST_REQUEST;
len = ioctl (cam->fd, iotype, &request);
if (len < 0) {
dc1394_log_error("juju: Send request failed: %m");
return DC1394_FAILURE;
}
resp.got_response = 0;
while (!resp.got_response)
if ((retval = juju_handle_event (cam)) < 0)
return retval;
if (resp.rcode == 0) {
if (resp.num_quads != resp.actual_num_quads)
dc1394_log_warning("juju: Expected response len %d, got %d",
resp.num_quads, resp.actual_num_quads);
return DC1394_SUCCESS;
}
if (resp.rcode != RCODE_BUSY
&& resp.rcode != RCODE_CONFLICT_ERROR
&& resp.rcode != RCODE_GENERATION) {
dc1394_log_debug ("juju: Response error, rcode 0x%x",
resp.rcode);
return DC1394_FAILURE;
}
/* retry if we get any of the rcodes listed above */
dc1394_log_debug("juju: retry rcode 0x%x tcode 0x%x offset %"PRIx64,
resp.rcode, tcode, offset);
usleep (DC1394_SLOW_DOWN);
retry--;
}
dc1394_log_error("juju: Max retries for tcode 0x%x, offset %"PRIx64,
tcode, offset);
return DC1394_FAILURE;
}
static dc1394error_t
dc1394_juju_camera_read (platform_camera_t * cam, uint64_t offset, uint32_t * quads, int num_quads)
{
int tcode;
if (num_quads > 1)
tcode = TCODE_READ_BLOCK_REQUEST;
else
tcode = TCODE_READ_QUADLET_REQUEST;
dc1394error_t err = do_transaction(cam, tcode, offset, NULL, quads, num_quads);
return err;
}
static dc1394error_t
dc1394_juju_camera_write (platform_camera_t * cam, uint64_t offset, const uint32_t * quads, int num_quads)
{
int tcode;
if (num_quads > 1)
tcode = TCODE_WRITE_BLOCK_REQUEST;
else
tcode = TCODE_WRITE_QUADLET_REQUEST;
return do_transaction(cam, tcode, offset, quads, NULL, num_quads);
}
static dc1394error_t
dc1394_juju_reset_bus (platform_camera_t * cam)
{
struct fw_cdev_initiate_bus_reset initiate;
initiate.type = FW_CDEV_SHORT_RESET;
if (ioctl (cam->fd, FW_CDEV_IOC_INITIATE_BUS_RESET, &initiate) == 0)
return DC1394_SUCCESS;
else
return DC1394_FAILURE;
}
static dc1394error_t
dc1394_juju_camera_get_node(platform_camera_t *cam, uint32_t *node,
uint32_t * generation)
{
if (node)
*node = cam->node_id & 0x3f; // mask out the bus ID
if (generation)
*generation = cam->generation;
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_juju_read_cycle_timer (platform_camera_t * cam,
uint32_t * cycle_timer, uint64_t * local_time)
{
struct fw_cdev_get_cycle_timer tm;
if (ioctl(cam->fd, FW_CDEV_IOC_GET_CYCLE_TIMER, &tm) < 0) {
if (errno == EINVAL)
return DC1394_FUNCTION_NOT_SUPPORTED;
dc1394_log_error("Juju: get_cycle_timer ioctl failed: %m");
return DC1394_FAILURE;
}
if (cycle_timer)
*cycle_timer = tm.cycle_timer;
if (local_time)
*local_time = tm.local_time;
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_juju_set_broadcast(platform_camera_t * craw, dc1394bool_t pwr)
{
if (pwr == DC1394_FALSE) {
craw->broadcast_enabled = 0;
return DC1394_SUCCESS;
}
if (craw->broadcast_enabled)
return DC1394_SUCCESS;
/* Test if the ioctl is available by sending a broadcast write to
* offset 0 that the kernel will always reject with EACCES if it is. */
struct fw_cdev_send_request request;
memset(&request, 0, sizeof(struct fw_cdev_send_request));
request.tcode = TCODE_WRITE_BLOCK_REQUEST;
if (ioctl(craw->fd, FW_CDEV_IOC_SEND_BROADCAST_REQUEST, &request) != -1) {
dc1394_log_error("Juju: broadcast test succeeded unexpectedly\n");
return DC1394_FUNCTION_NOT_SUPPORTED;
}
if (errno == EINVAL)
return DC1394_FUNCTION_NOT_SUPPORTED;
craw->broadcast_enabled = 1;
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_juju_get_broadcast(platform_camera_t * craw, dc1394bool_t *pwr)
{
if (craw->broadcast_enabled)
*pwr = DC1394_TRUE;
else
*pwr = DC1394_FALSE;
return DC1394_SUCCESS;
}
dc1394error_t
juju_iso_allocate (platform_camera_t *cam, uint64_t allowed_channels,
int bandwidth_units, juju_iso_info **out)
{
// Check kernel ABI version for ISO allocation support
if (cam->kernel_abi_version < 2)
return DC1394_FUNCTION_NOT_SUPPORTED;
juju_iso_info *res = add_iso_resource (cam);
if (!res)
return DC1394_MEMORY_ALLOCATION_FAILURE;
struct fw_cdev_allocate_iso_resource request = {
.closure = ptr_to_u64(res),
.channels = allowed_channels,
.bandwidth = bandwidth_units,
};
if (ioctl (cam->fd, FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE, &request) < 0) {
remove_iso_resource (cam, res);
if (errno == EINVAL)
return DC1394_INVALID_ARGUMENT_VALUE;
return DC1394_FAILURE;
}
res->handle = request.handle;
dc1394_log_debug ("juju: Attempting iso allocation: "
"handle %d, chan 0x%"PRIx64", bw %d", request.handle,
request.channels, request.bandwidth);
int ret;
while (!res->got_alloc)
if ((ret = juju_handle_event (cam)) < 0)
return ret;
if (allowed_channels && res->channel < 0) {
remove_iso_resource (cam, res);
return DC1394_NO_ISO_CHANNEL;
}
if (bandwidth_units && !res->bandwidth) {
remove_iso_resource (cam, res);
return DC1394_NO_BANDWIDTH;
}
if (out)
*out = res;
return DC1394_SUCCESS;
}
dc1394error_t
juju_iso_deallocate (platform_camera_t *cam, juju_iso_info * res)
{
// Check kernel ABI version for ISO allocation support
if (cam->kernel_abi_version < 2)
return DC1394_FUNCTION_NOT_SUPPORTED;
if (res->got_dealloc) {
dc1394_log_warning ("juju: ISO resource was already released");
remove_iso_resource (cam, res);
return DC1394_SUCCESS;
}
struct fw_cdev_allocate_iso_resource request = {
.handle = res->handle,
};
if (ioctl (cam->fd, FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE, &request) < 0) {
if (errno == EINVAL)
return DC1394_INVALID_ARGUMENT_VALUE;
return DC1394_FAILURE;
}
int ret;
while (!res->got_dealloc)
if ((ret = juju_handle_event (cam)) < 0)
return ret;
remove_iso_resource (cam, res);
return DC1394_SUCCESS;
}
#if 0
static dc1394error_t
dc1394_juju_iso_allocate_channel(platform_camera_t *cam, uint64_t allowed,
int *out_channel)
{
}
static dc1394error_t
dc1394_juju_iso_release_channel(platform_camera_t *cam, int channel)
{
}
static dc1394error_t
dc1394_juju_iso_allocate_bandwidth(platform_camera_t *cam, int units)
{
}
static dc1394error_t
dc1394_juju_iso_release_bandwidth(platform_camera_t *cam, int units)
{
}
#endif
static platform_dispatch_t
juju_dispatch = {
.platform_new = dc1394_juju_new,
.platform_free = dc1394_juju_free,
.get_device_list = dc1394_juju_get_device_list,
.free_device_list = dc1394_juju_free_device_list,
.device_get_config_rom = dc1394_juju_device_get_config_rom,
.camera_new = dc1394_juju_camera_new,
.camera_free = dc1394_juju_camera_free,
.camera_set_parent = dc1394_juju_camera_set_parent,
.camera_read = dc1394_juju_camera_read,
.camera_write = dc1394_juju_camera_write,
.reset_bus = dc1394_juju_reset_bus,
.camera_print_info = dc1394_juju_camera_print_info,
.camera_get_node = dc1394_juju_camera_get_node,
.read_cycle_timer = dc1394_juju_read_cycle_timer,
.set_broadcast = dc1394_juju_set_broadcast,
.get_broadcast = dc1394_juju_get_broadcast,
.capture_setup = dc1394_juju_capture_setup,
.capture_stop = dc1394_juju_capture_stop,
.capture_dequeue = dc1394_juju_capture_dequeue,
.capture_enqueue = dc1394_juju_capture_enqueue,
.capture_get_fileno = dc1394_juju_capture_get_fileno,
.capture_set_callback = NULL,
.capture_schedule_with_runloop = NULL,
//.iso_allocate_channel = dc1394_juju_iso_allocate_channel,
};
void
juju_init(dc1394_t * d)
{
register_platform (d, &juju_dispatch, "juju");
}

701
dc1394/juju/firewire-cdev.h Normal file
View File

@ -0,0 +1,701 @@
/*
* Char device interface.
*
* Copyright (C) 2005-2007 Kristian Hoegsberg <krh@bitplanet.net>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef _LINUX_FIREWIRE_CDEV_H
#define _LINUX_FIREWIRE_CDEV_H
#include <linux/ioctl.h>
#include <linux/types.h>
#include "firewire-constants.h"
#define FW_CDEV_EVENT_BUS_RESET 0x00
#define FW_CDEV_EVENT_RESPONSE 0x01
#define FW_CDEV_EVENT_REQUEST 0x02
#define FW_CDEV_EVENT_ISO_INTERRUPT 0x03
#define FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED 0x04
#define FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED 0x05
/**
* struct fw_cdev_event_common - Common part of all fw_cdev_event_ types
* @closure: For arbitrary use by userspace
* @type: Discriminates the fw_cdev_event_ types
*
* This struct may be used to access generic members of all fw_cdev_event_
* types regardless of the specific type.
*
* Data passed in the @closure field for a request will be returned in the
* corresponding event. It is big enough to hold a pointer on all platforms.
* The ioctl used to set @closure depends on the @type of event.
*/
struct fw_cdev_event_common {
__u64 closure;
__u32 type;
};
/**
* struct fw_cdev_event_bus_reset - Sent when a bus reset occurred
* @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_GET_INFO ioctl
* @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_BUS_RESET
* @node_id: New node ID of this node
* @local_node_id: Node ID of the local node, i.e. of the controller
* @bm_node_id: Node ID of the bus manager
* @irm_node_id: Node ID of the iso resource manager
* @root_node_id: Node ID of the root node
* @generation: New bus generation
*
* This event is sent when the bus the device belongs to goes through a bus
* reset. It provides information about the new bus configuration, such as
* new node ID for this device, new root ID, and others.
*/
struct fw_cdev_event_bus_reset {
__u64 closure;
__u32 type;
__u32 node_id;
__u32 local_node_id;
__u32 bm_node_id;
__u32 irm_node_id;
__u32 root_node_id;
__u32 generation;
};
/**
* struct fw_cdev_event_response - Sent when a response packet was received
* @closure: See &fw_cdev_event_common;
* set by %FW_CDEV_IOC_SEND_REQUEST ioctl
* @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_RESPONSE
* @rcode: Response code returned by the remote node
* @length: Data length, i.e. the response's payload size in bytes
* @data: Payload data, if any
*
* This event is sent when the stack receives a response to an outgoing request
* sent by %FW_CDEV_IOC_SEND_REQUEST ioctl. The payload data for responses
* carrying data (read and lock responses) follows immediately and can be
* accessed through the @data field.
*/
struct fw_cdev_event_response {
__u64 closure;
__u32 type;
__u32 rcode;
__u32 length;
__u32 data[0];
};
/**
* struct fw_cdev_event_request - Sent on incoming request to an address region
* @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl
* @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST
* @tcode: Transaction code of the incoming request
* @offset: The offset into the 48-bit per-node address space
* @handle: Reference to the kernel-side pending request
* @length: Data length, i.e. the request's payload size in bytes
* @data: Incoming data, if any
*
* This event is sent when the stack receives an incoming request to an address
* region registered using the %FW_CDEV_IOC_ALLOCATE ioctl. The request is
* guaranteed to be completely contained in the specified region. Userspace is
* responsible for sending the response by %FW_CDEV_IOC_SEND_RESPONSE ioctl,
* using the same @handle.
*
* The payload data for requests carrying data (write and lock requests)
* follows immediately and can be accessed through the @data field.
*/
struct fw_cdev_event_request {
__u64 closure;
__u32 type;
__u32 tcode;
__u64 offset;
__u32 handle;
__u32 length;
__u32 data[0];
};
/**
* struct fw_cdev_event_iso_interrupt - Sent when an iso packet was completed
* @closure: See &fw_cdev_event_common;
* set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl
* @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_ISO_INTERRUPT
* @cycle: Cycle counter of the interrupt packet
* @header_length: Total length of following headers, in bytes
* @header: Stripped headers, if any
*
* This event is sent when the controller has completed an &fw_cdev_iso_packet
* with the %FW_CDEV_ISO_INTERRUPT bit set. In the receive case, the headers
* stripped of all packets up until and including the interrupt packet are
* returned in the @header field. The amount of header data per packet is as
* specified at iso context creation by &fw_cdev_create_iso_context.header_size.
*
* In version 1 of this ABI, header data consisted of the 1394 isochronous
* packet header, followed by quadlets from the packet payload if
* &fw_cdev_create_iso_context.header_size > 4.
*
* In version 2 of this ABI, header data consist of the 1394 isochronous
* packet header, followed by a timestamp quadlet if
* &fw_cdev_create_iso_context.header_size > 4, followed by quadlets from the
* packet payload if &fw_cdev_create_iso_context.header_size > 8.
*
* Behaviour of ver. 1 of this ABI is no longer available since ABI ver. 2.
*
* Format of 1394 iso packet header: 16 bits len, 2 bits tag, 6 bits channel,
* 4 bits tcode, 4 bits sy, in big endian byte order. Format of timestamp:
* 16 bits invalid, 3 bits cycleSeconds, 13 bits cycleCount, in big endian byte
* order.
*/
struct fw_cdev_event_iso_interrupt {
__u64 closure;
__u32 type;
__u32 cycle;
__u32 header_length;
__u32 header[0];
};
/**
* struct fw_cdev_event_iso_resource - Iso resources were allocated or freed
* @closure: See &fw_cdev_event_common;
* set by %FW_CDEV_IOC_(DE)ALLOCATE_ISO_RESOURCE(_ONCE) ioctl
* @type: %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or
* %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED
* @handle: Reference by which an allocated resource can be deallocated
* @channel: Isochronous channel which was (de)allocated, if any
* @bandwidth: Bandwidth allocation units which were (de)allocated, if any
*
* An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event is sent after an isochronous
* resource was allocated at the IRM. The client has to check @channel and
* @bandwidth for whether the allocation actually succeeded.
*
* An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event is sent after an isochronous
* resource was deallocated at the IRM. It is also sent when automatic
* reallocation after a bus reset failed.
*
* @channel is <0 if no channel was (de)allocated or if reallocation failed.
* @bandwidth is 0 if no bandwidth was (de)allocated or if reallocation failed.
*/
struct fw_cdev_event_iso_resource {
__u64 closure;
__u32 type;
__u32 handle;
__s32 channel;
__s32 bandwidth;
};
/**
* union fw_cdev_event - Convenience union of fw_cdev_event_ types
* @common: Valid for all types
* @bus_reset: Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET
* @response: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE
* @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST
* @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT
* @iso_resource: Valid if @common.type ==
* %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or
* %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED
*
* Convenience union for userspace use. Events could be read(2) into an
* appropriately aligned char buffer and then cast to this union for further
* processing. Note that for a request, response or iso_interrupt event,
* the data[] or header[] may make the size of the full event larger than
* sizeof(union fw_cdev_event). Also note that if you attempt to read(2)
* an event into a buffer that is not large enough for it, the data that does
* not fit will be discarded so that the next read(2) will return a new event.
*/
union fw_cdev_event {
struct fw_cdev_event_common common;
struct fw_cdev_event_bus_reset bus_reset;
struct fw_cdev_event_response response;
struct fw_cdev_event_request request;
struct fw_cdev_event_iso_interrupt iso_interrupt;
struct fw_cdev_event_iso_resource iso_resource;
};
/* available since kernel version 2.6.22 */
#define FW_CDEV_IOC_GET_INFO _IOWR('#', 0x00, struct fw_cdev_get_info)
#define FW_CDEV_IOC_SEND_REQUEST _IOW('#', 0x01, struct fw_cdev_send_request)
#define FW_CDEV_IOC_ALLOCATE _IOWR('#', 0x02, struct fw_cdev_allocate)
#define FW_CDEV_IOC_DEALLOCATE _IOW('#', 0x03, struct fw_cdev_deallocate)
#define FW_CDEV_IOC_SEND_RESPONSE _IOW('#', 0x04, struct fw_cdev_send_response)
#define FW_CDEV_IOC_INITIATE_BUS_RESET _IOW('#', 0x05, struct fw_cdev_initiate_bus_reset)
#define FW_CDEV_IOC_ADD_DESCRIPTOR _IOWR('#', 0x06, struct fw_cdev_add_descriptor)
#define FW_CDEV_IOC_REMOVE_DESCRIPTOR _IOW('#', 0x07, struct fw_cdev_remove_descriptor)
#define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IOWR('#', 0x08, struct fw_cdev_create_iso_context)
#define FW_CDEV_IOC_QUEUE_ISO _IOWR('#', 0x09, struct fw_cdev_queue_iso)
#define FW_CDEV_IOC_START_ISO _IOW('#', 0x0a, struct fw_cdev_start_iso)
#define FW_CDEV_IOC_STOP_ISO _IOW('#', 0x0b, struct fw_cdev_stop_iso)
/* available since kernel version 2.6.24 */
#define FW_CDEV_IOC_GET_CYCLE_TIMER _IOR('#', 0x0c, struct fw_cdev_get_cycle_timer)
/* available since kernel version 2.6.30 */
#define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE _IOWR('#', 0x0d, struct fw_cdev_allocate_iso_resource)
#define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE _IOW('#', 0x0e, struct fw_cdev_deallocate)
#define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x0f, struct fw_cdev_allocate_iso_resource)
#define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x10, struct fw_cdev_allocate_iso_resource)
#define FW_CDEV_IOC_GET_SPEED _IO('#', 0x11) /* returns speed code */
#define FW_CDEV_IOC_SEND_BROADCAST_REQUEST _IOW('#', 0x12, struct fw_cdev_send_request)
#define FW_CDEV_IOC_SEND_STREAM_PACKET _IOW('#', 0x13, struct fw_cdev_send_stream_packet)
/* available since kernel version 2.6.34 */
#define FW_CDEV_IOC_GET_CYCLE_TIMER2 _IOWR('#', 0x14, struct fw_cdev_get_cycle_timer2)
/*
* FW_CDEV_VERSION History
* 1 (2.6.22) - initial version
* 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if
* &fw_cdev_create_iso_context.header_size is 8 or more
* (2.6.32) - added time stamp to xmit &fw_cdev_event_iso_interrupt
* (2.6.33) - IR has always packet-per-buffer semantics now, not one of
* dual-buffer or packet-per-buffer depending on hardware
* 3 (2.6.34) - made &fw_cdev_get_cycle_timer reliable
*/
#define FW_CDEV_VERSION 3
/**
* struct fw_cdev_get_info - General purpose information ioctl
* @version: The version field is just a running serial number.
* We never break backwards compatibility, but may add more
* structs and ioctls in later revisions.
* @rom_length: If @rom is non-zero, at most rom_length bytes of configuration
* ROM will be copied into that user space address. In either
* case, @rom_length is updated with the actual length of the
* configuration ROM.
* @rom: If non-zero, address of a buffer to be filled by a copy of the
* device's configuration ROM
* @bus_reset: If non-zero, address of a buffer to be filled by a
* &struct fw_cdev_event_bus_reset with the current state
* of the bus. This does not cause a bus reset to happen.
* @bus_reset_closure: Value of &closure in this and subsequent bus reset events
* @card: The index of the card this device belongs to
*/
struct fw_cdev_get_info {
__u32 version;
__u32 rom_length;
__u64 rom;
__u64 bus_reset;
__u64 bus_reset_closure;
__u32 card;
};
/**
* struct fw_cdev_send_request - Send an asynchronous request packet
* @tcode: Transaction code of the request
* @length: Length of outgoing payload, in bytes
* @offset: 48-bit offset at destination node
* @closure: Passed back to userspace in the response event
* @data: Userspace pointer to payload
* @generation: The bus generation where packet is valid
*
* Send a request to the device. This ioctl implements all outgoing requests.
* Both quadlet and block request specify the payload as a pointer to the data
* in the @data field. Once the transaction completes, the kernel writes an
* &fw_cdev_event_response event back. The @closure field is passed back to
* user space in the response event.
*/
struct fw_cdev_send_request {
__u32 tcode;
__u32 length;
__u64 offset;
__u64 closure;
__u64 data;
__u32 generation;
};
/**
* struct fw_cdev_send_response - Send an asynchronous response packet
* @rcode: Response code as determined by the userspace handler
* @length: Length of outgoing payload, in bytes
* @data: Userspace pointer to payload
* @handle: The handle from the &fw_cdev_event_request
*
* Send a response to an incoming request. By setting up an address range using
* the %FW_CDEV_IOC_ALLOCATE ioctl, userspace can listen for incoming requests. An
* incoming request will generate an %FW_CDEV_EVENT_REQUEST, and userspace must
* send a reply using this ioctl. The event has a handle to the kernel-side
* pending transaction, which should be used with this ioctl.
*/
struct fw_cdev_send_response {
__u32 rcode;
__u32 length;
__u64 data;
__u32 handle;
};
/**
* struct fw_cdev_allocate - Allocate a CSR address range
* @offset: Start offset of the address range
* @closure: To be passed back to userspace in request events
* @length: Length of the address range, in bytes
* @handle: Handle to the allocation, written by the kernel
*
* Allocate an address range in the 48-bit address space on the local node
* (the controller). This allows userspace to listen for requests with an
* offset within that address range. When the kernel receives a request
* within the range, an &fw_cdev_event_request event will be written back.
* The @closure field is passed back to userspace in the response event.
* The @handle field is an out parameter, returning a handle to the allocated
* range to be used for later deallocation of the range.
*
* The address range is allocated on all local nodes. The address allocation
* is exclusive except for the FCP command and response registers.
*/
struct fw_cdev_allocate {
__u64 offset;
__u64 closure;
__u32 length;
__u32 handle;
};
/**
* struct fw_cdev_deallocate - Free a CSR address range or isochronous resource
* @handle: Handle to the address range or iso resource, as returned by the
* kernel when the range or resource was allocated
*/
struct fw_cdev_deallocate {
__u32 handle;
};
#define FW_CDEV_LONG_RESET 0
#define FW_CDEV_SHORT_RESET 1
/**
* struct fw_cdev_initiate_bus_reset - Initiate a bus reset
* @type: %FW_CDEV_SHORT_RESET or %FW_CDEV_LONG_RESET
*
* Initiate a bus reset for the bus this device is on. The bus reset can be
* either the original (long) bus reset or the arbitrated (short) bus reset
* introduced in 1394a-2000.
*/
struct fw_cdev_initiate_bus_reset {
__u32 type; /* FW_CDEV_SHORT_RESET or FW_CDEV_LONG_RESET */
};
/**
* struct fw_cdev_add_descriptor - Add contents to the local node's config ROM
* @immediate: If non-zero, immediate key to insert before pointer
* @key: Upper 8 bits of root directory pointer
* @data: Userspace pointer to contents of descriptor block
* @length: Length of descriptor block data, in quadlets
* @handle: Handle to the descriptor, written by the kernel
*
* Add a descriptor block and optionally a preceding immediate key to the local
* node's configuration ROM.
*
* The @key field specifies the upper 8 bits of the descriptor root directory
* pointer and the @data and @length fields specify the contents. The @key
* should be of the form 0xXX000000. The offset part of the root directory entry
* will be filled in by the kernel.
*
* If not 0, the @immediate field specifies an immediate key which will be
* inserted before the root directory pointer.
*
* @immediate, @key, and @data array elements are CPU-endian quadlets.
*
* If successful, the kernel adds the descriptor and writes back a handle to the
* kernel-side object to be used for later removal of the descriptor block and
* immediate key.
*
* This ioctl affects the configuration ROMs of all local nodes.
* The ioctl only succeeds on device files which represent a local node.
*/
struct fw_cdev_add_descriptor {
__u32 immediate;
__u32 key;
__u64 data;
__u32 length;
__u32 handle;
};
/**
* struct fw_cdev_remove_descriptor - Remove contents from the configuration ROM
* @handle: Handle to the descriptor, as returned by the kernel when the
* descriptor was added
*
* Remove a descriptor block and accompanying immediate key from the local
* nodes' configuration ROMs.
*/
struct fw_cdev_remove_descriptor {
__u32 handle;
};
#define FW_CDEV_ISO_CONTEXT_TRANSMIT 0
#define FW_CDEV_ISO_CONTEXT_RECEIVE 1
/**
* struct fw_cdev_create_iso_context - Create a context for isochronous IO
* @type: %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE
* @header_size: Header size to strip for receive contexts
* @channel: Channel to bind to
* @speed: Speed for transmit contexts
* @closure: To be returned in &fw_cdev_event_iso_interrupt
* @handle: Handle to context, written back by kernel
*
* Prior to sending or receiving isochronous I/O, a context must be created.
* The context records information about the transmit or receive configuration
* and typically maps to an underlying hardware resource. A context is set up
* for either sending or receiving. It is bound to a specific isochronous
* channel.
*
* If a context was successfully created, the kernel writes back a handle to the
* context, which must be passed in for subsequent operations on that context.
*
* For receive contexts, @header_size must be at least 4 and must be a multiple
* of 4.
*
* Note that the effect of a @header_size > 4 depends on
* &fw_cdev_get_info.version, as documented at &fw_cdev_event_iso_interrupt.
*/
struct fw_cdev_create_iso_context {
__u32 type;
__u32 header_size;
__u32 channel;
__u32 speed;
__u64 closure;
__u32 handle;
};
#define FW_CDEV_ISO_PAYLOAD_LENGTH(v) (v)
#define FW_CDEV_ISO_INTERRUPT (1 << 16)
#define FW_CDEV_ISO_SKIP (1 << 17)
#define FW_CDEV_ISO_SYNC (1 << 17)
#define FW_CDEV_ISO_TAG(v) ((v) << 18)
#define FW_CDEV_ISO_SY(v) ((v) << 20)
#define FW_CDEV_ISO_HEADER_LENGTH(v) ((v) << 24)
/**
* struct fw_cdev_iso_packet - Isochronous packet
* @control: Contains the header length (8 uppermost bits), the sy field
* (4 bits), the tag field (2 bits), a sync flag (1 bit),
* a skip flag (1 bit), an interrupt flag (1 bit), and the
* payload length (16 lowermost bits)
* @header: Header and payload
*
* &struct fw_cdev_iso_packet is used to describe isochronous packet queues.
*
* Use the FW_CDEV_ISO_ macros to fill in @control.
*
* For transmit packets, the header length must be a multiple of 4 and specifies
* the numbers of bytes in @header that will be prepended to the packet's
* payload; these bytes are copied into the kernel and will not be accessed
* after the ioctl has returned. The sy and tag fields are copied to the iso
* packet header (these fields are specified by IEEE 1394a and IEC 61883-1).
* The skip flag specifies that no packet is to be sent in a frame; when using
* this, all other fields except the interrupt flag must be zero.
*
* For receive packets, the header length must be a multiple of the context's
* header size; if the header length is larger than the context's header size,
* multiple packets are queued for this entry. The sy and tag fields are
* ignored. If the sync flag is set, the context drops all packets until
* a packet with a matching sy field is received (the sync value to wait for is
* specified in the &fw_cdev_start_iso structure). The payload length defines
* how many payload bytes can be received for one packet (in addition to payload
* quadlets that have been defined as headers and are stripped and returned in
* the &fw_cdev_event_iso_interrupt structure). If more bytes are received, the
* additional bytes are dropped. If less bytes are received, the remaining
* bytes in this part of the payload buffer will not be written to, not even by
* the next packet, i.e., packets received in consecutive frames will not
* necessarily be consecutive in memory. If an entry has queued multiple
* packets, the payload length is divided equally among them.
*
* When a packet with the interrupt flag set has been completed, the
* &fw_cdev_event_iso_interrupt event will be sent. An entry that has queued
* multiple receive packets is completed when its last packet is completed.
*/
struct fw_cdev_iso_packet {
__u32 control;
__u32 header[0];
};
/**
* struct fw_cdev_queue_iso - Queue isochronous packets for I/O
* @packets: Userspace pointer to packet data
* @data: Pointer into mmap()'ed payload buffer
* @size: Size of packet data in bytes
* @handle: Isochronous context handle
*
* Queue a number of isochronous packets for reception or transmission.
* This ioctl takes a pointer to an array of &fw_cdev_iso_packet structs,
* which describe how to transmit from or receive into a contiguous region
* of a mmap()'ed payload buffer. As part of transmit packet descriptors,
* a series of headers can be supplied, which will be prepended to the
* payload during DMA.
*
* The kernel may or may not queue all packets, but will write back updated
* values of the @packets, @data and @size fields, so the ioctl can be
* resubmitted easily.
*/
struct fw_cdev_queue_iso {
__u64 packets;
__u64 data;
__u32 size;
__u32 handle;
};
#define FW_CDEV_ISO_CONTEXT_MATCH_TAG0 1
#define FW_CDEV_ISO_CONTEXT_MATCH_TAG1 2
#define FW_CDEV_ISO_CONTEXT_MATCH_TAG2 4
#define FW_CDEV_ISO_CONTEXT_MATCH_TAG3 8
#define FW_CDEV_ISO_CONTEXT_MATCH_ALL_TAGS 15
/**
* struct fw_cdev_start_iso - Start an isochronous transmission or reception
* @cycle: Cycle in which to start I/O. If @cycle is greater than or
* equal to 0, the I/O will start on that cycle.
* @sync: Determines the value to wait for for receive packets that have
* the %FW_CDEV_ISO_SYNC bit set
* @tags: Tag filter bit mask. Only valid for isochronous reception.
* Determines the tag values for which packets will be accepted.
* Use FW_CDEV_ISO_CONTEXT_MATCH_ macros to set @tags.
* @handle: Isochronous context handle within which to transmit or receive
*/
struct fw_cdev_start_iso {
__s32 cycle;
__u32 sync;
__u32 tags;
__u32 handle;
};
/**
* struct fw_cdev_stop_iso - Stop an isochronous transmission or reception
* @handle: Handle of isochronous context to stop
*/
struct fw_cdev_stop_iso {
__u32 handle;
};
/**
* struct fw_cdev_get_cycle_timer - read cycle timer register
* @local_time: system time, in microseconds since the Epoch
* @cycle_timer: Cycle Time register contents
*
* The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer
* and also the system clock (%CLOCK_REALTIME). This allows to express the
* receive time of an isochronous packet as a system time.
*
* @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and
* 12 bits cycleOffset, in host byte order. Cf. the Cycle Time register
* per IEEE 1394 or Isochronous Cycle Timer register per OHCI-1394.
*
* In version 1 and 2 of the ABI, this ioctl returned unreliable (non-
* monotonic) @cycle_timer values on certain controllers.
*/
struct fw_cdev_get_cycle_timer {
__u64 local_time;
__u32 cycle_timer;
};
/**
* struct fw_cdev_get_cycle_timer2 - read cycle timer register
* @tv_sec: system time, seconds
* @tv_nsec: system time, sub-seconds part in nanoseconds
* @clk_id: input parameter, clock from which to get the system time
* @cycle_timer: Cycle Time register contents
*
* The %FW_CDEV_IOC_GET_CYCLE_TIMER2 works like
* %FW_CDEV_IOC_GET_CYCLE_TIMER but lets you choose a clock like with POSIX'
* clock_gettime function. Supported @clk_id values are POSIX' %CLOCK_REALTIME
* and %CLOCK_MONOTONIC and Linux' %CLOCK_MONOTONIC_RAW.
*/
struct fw_cdev_get_cycle_timer2 {
__s64 tv_sec;
__s32 tv_nsec;
__s32 clk_id;
__u32 cycle_timer;
};
/**
* struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth
* @closure: Passed back to userspace in correponding iso resource events
* @channels: Isochronous channels of which one is to be (de)allocated
* @bandwidth: Isochronous bandwidth units to be (de)allocated
* @handle: Handle to the allocation, written by the kernel (only valid in
* case of %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctls)
*
* The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctl initiates allocation of an
* isochronous channel and/or of isochronous bandwidth at the isochronous
* resource manager (IRM). Only one of the channels specified in @channels is
* allocated. An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED is sent after
* communication with the IRM, indicating success or failure in the event data.
* The kernel will automatically reallocate the resources after bus resets.
* Should a reallocation fail, an %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event
* will be sent. The kernel will also automatically deallocate the resources
* when the file descriptor is closed.
*
* The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE ioctl can be used to initiate
* deallocation of resources which were allocated as described above.
* An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation.
*
* The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE ioctl is a variant of allocation
* without automatic re- or deallocation.
* An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event concludes this operation,
* indicating success or failure in its data.
*
* The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE ioctl works like
* %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE except that resources are freed
* instead of allocated.
* An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation.
*
* To summarize, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE allocates iso resources
* for the lifetime of the fd or @handle.
* In contrast, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE allocates iso resources
* for the duration of a bus generation.
*
* @channels is a host-endian bitfield with the least significant bit
* representing channel 0 and the most significant bit representing channel 63:
* 1ULL << c for each channel c that is a candidate for (de)allocation.
*
* @bandwidth is expressed in bandwidth allocation units, i.e. the time to send
* one quadlet of data (payload or header data) at speed S1600.
*/
struct fw_cdev_allocate_iso_resource {
__u64 closure;
__u64 channels;
__u32 bandwidth;
__u32 handle;
};
/**
* struct fw_cdev_send_stream_packet - send an asynchronous stream packet
* @length: Length of outgoing payload, in bytes
* @tag: Data format tag
* @channel: Isochronous channel to transmit to
* @sy: Synchronization code
* @closure: Passed back to userspace in the response event
* @data: Userspace pointer to payload
* @generation: The bus generation where packet is valid
* @speed: Speed to transmit at
*
* The %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl sends an asynchronous stream packet
* to every device which is listening to the specified channel. The kernel
* writes an &fw_cdev_event_response event which indicates success or failure of
* the transmission.
*/
struct fw_cdev_send_stream_packet {
__u32 length;
__u32 tag;
__u32 channel;
__u32 sy;
__u64 closure;
__u64 data;
__u32 generation;
__u32 speed;
};
#endif /* _LINUX_FIREWIRE_CDEV_H */

View File

@ -0,0 +1,92 @@
/*
* IEEE 1394 constants.
*
* Copyright (C) 2005-2007 Kristian Hoegsberg <krh@bitplanet.net>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef _LINUX_FIREWIRE_CONSTANTS_H
#define _LINUX_FIREWIRE_CONSTANTS_H
#define TCODE_WRITE_QUADLET_REQUEST 0x0
#define TCODE_WRITE_BLOCK_REQUEST 0x1
#define TCODE_WRITE_RESPONSE 0x2
#define TCODE_READ_QUADLET_REQUEST 0x4
#define TCODE_READ_BLOCK_REQUEST 0x5
#define TCODE_READ_QUADLET_RESPONSE 0x6
#define TCODE_READ_BLOCK_RESPONSE 0x7
#define TCODE_CYCLE_START 0x8
#define TCODE_LOCK_REQUEST 0x9
#define TCODE_STREAM_DATA 0xa
#define TCODE_LOCK_RESPONSE 0xb
#define EXTCODE_MASK_SWAP 0x1
#define EXTCODE_COMPARE_SWAP 0x2
#define EXTCODE_FETCH_ADD 0x3
#define EXTCODE_LITTLE_ADD 0x4
#define EXTCODE_BOUNDED_ADD 0x5
#define EXTCODE_WRAP_ADD 0x6
#define EXTCODE_VENDOR_DEPENDENT 0x7
/* Linux firewire-core (Juju) specific tcodes */
#define TCODE_LOCK_MASK_SWAP (0x10 | EXTCODE_MASK_SWAP)
#define TCODE_LOCK_COMPARE_SWAP (0x10 | EXTCODE_COMPARE_SWAP)
#define TCODE_LOCK_FETCH_ADD (0x10 | EXTCODE_FETCH_ADD)
#define TCODE_LOCK_LITTLE_ADD (0x10 | EXTCODE_LITTLE_ADD)
#define TCODE_LOCK_BOUNDED_ADD (0x10 | EXTCODE_BOUNDED_ADD)
#define TCODE_LOCK_WRAP_ADD (0x10 | EXTCODE_WRAP_ADD)
#define TCODE_LOCK_VENDOR_DEPENDENT (0x10 | EXTCODE_VENDOR_DEPENDENT)
#define RCODE_COMPLETE 0x0
#define RCODE_CONFLICT_ERROR 0x4
#define RCODE_DATA_ERROR 0x5
#define RCODE_TYPE_ERROR 0x6
#define RCODE_ADDRESS_ERROR 0x7
/* Linux firewire-core (Juju) specific rcodes */
#define RCODE_SEND_ERROR 0x10
#define RCODE_CANCELLED 0x11
#define RCODE_BUSY 0x12
#define RCODE_GENERATION 0x13
#define RCODE_NO_ACK 0x14
#define SCODE_100 0x0
#define SCODE_200 0x1
#define SCODE_400 0x2
#define SCODE_800 0x3
#define SCODE_1600 0x4
#define SCODE_3200 0x5
#define SCODE_BETA 0x3
#define ACK_COMPLETE 0x1
#define ACK_PENDING 0x2
#define ACK_BUSY_X 0x4
#define ACK_BUSY_A 0x5
#define ACK_BUSY_B 0x6
#define ACK_DATA_ERROR 0xd
#define ACK_TYPE_ERROR 0xe
#define RETRY_1 0x00
#define RETRY_X 0x01
#define RETRY_A 0x02
#define RETRY_B 0x03
#endif /* _LINUX_FIREWIRE_CONSTANTS_H */

107
dc1394/juju/juju.h Normal file
View File

@ -0,0 +1,107 @@
/*
* 1394-Based Digital Camera Control Library
*
* Juju backend for dc1394
*
* Written by Kristian Hoegsberg <krh@bitplanet.net>
* Maintained by David Moore <dcm@acm.org>
*
* 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
*/
#ifndef __DC1394_JUJU_H__
#define __DC1394_JUJU_H__
#include "firewire-cdev.h"
#include "config.h"
#include "internal.h"
#include "register.h"
#include "offsets.h"
struct _platform_t {
int dummy;
};
typedef struct _juju_iso_info {
int got_alloc;
int got_dealloc;
int handle;
int channel;
int bandwidth;
struct _juju_iso_info *next;
} juju_iso_info;
struct _platform_camera_t {
int fd;
char filename[32];
int generation;
uint32_t node_id;
unsigned int kernel_abi_version;
int max_response_quads;
juju_iso_info *iso_resources;
uint8_t header_size;
uint8_t broadcast_enabled;
dc1394camera_t * camera;
int iso_fd;
int iso_handle;
struct juju_frame * frames;
unsigned char * buffer;
size_t buffer_size;
uint32_t flags;
unsigned int num_frames;
int current;
unsigned int iso_channel;
int capture_is_set;
int iso_auto_started;
juju_iso_info *capture_iso_resource;
uint32_t packets_per_frame; // HPK 20161209
};
struct juju_frame {
dc1394video_frame_t frame;
size_t size;
struct fw_cdev_iso_packet *packets;
};
dc1394error_t
dc1394_juju_capture_setup(platform_camera_t *craw, uint32_t num_dma_buffers,
uint32_t flags);
dc1394error_t
dc1394_juju_capture_stop(platform_camera_t *craw);
dc1394error_t
dc1394_juju_capture_dequeue (platform_camera_t * craw,
dc1394capture_policy_t policy, dc1394video_frame_t **frame_return);
dc1394error_t
dc1394_juju_capture_enqueue (platform_camera_t * craw,
dc1394video_frame_t * frame);
int
dc1394_juju_capture_get_fileno (platform_camera_t * craw);
dc1394error_t
juju_iso_allocate (platform_camera_t *cam, uint64_t allowed_channels,
int bandwidth_units, juju_iso_info **out);
dc1394error_t
juju_iso_deallocate (platform_camera_t *cam, juju_iso_info * res);
#endif

21
dc1394/linux/Makefile.am Normal file
View File

@ -0,0 +1,21 @@
pkglinuxincludedir = $(pkgincludedir)/linux
if HAVE_LIBRAW1394
noinst_LTLIBRARIES = libdc1394-linux.la
# headers to be installed
pkglinuxinclude_HEADERS = \
capture.h \
control.h
endif
AM_CFLAGS =-I$(top_srcdir) -I$(top_srcdir)/dc1394
libdc1394_linux_la_LIBADD = -lraw1394
libdc1394_linux_la_SOURCES = \
control.c \
capture.c \
capture.h \
kernel-video1394.h \
linux.h

692
dc1394/linux/Makefile.in Normal file
View File

@ -0,0 +1,692 @@
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = dc1394/linux
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp $(am__pkglinuxinclude_HEADERS_DIST)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/ax_check_framework.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libdc1394_linux_la_DEPENDENCIES =
am_libdc1394_linux_la_OBJECTS = control.lo capture.lo
libdc1394_linux_la_OBJECTS = $(am_libdc1394_linux_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
@HAVE_LIBRAW1394_TRUE@am_libdc1394_linux_la_rpath =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(libdc1394_linux_la_SOURCES)
DIST_SOURCES = $(libdc1394_linux_la_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__pkglinuxinclude_HEADERS_DIST = capture.h control.h
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(pkglinuxincludedir)"
HEADERS = $(pkglinuxinclude_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
pkgincludedir = @pkgincludedir@
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
DX_CONFIG = @DX_CONFIG@
DX_DOCDIR = @DX_DOCDIR@
DX_DOT = @DX_DOT@
DX_DOXYGEN = @DX_DOXYGEN@
DX_DVIPS = @DX_DVIPS@
DX_EGREP = @DX_EGREP@
DX_ENV = @DX_ENV@
DX_FLAG_chi = @DX_FLAG_chi@
DX_FLAG_chm = @DX_FLAG_chm@
DX_FLAG_doc = @DX_FLAG_doc@
DX_FLAG_dot = @DX_FLAG_dot@
DX_FLAG_html = @DX_FLAG_html@
DX_FLAG_man = @DX_FLAG_man@
DX_FLAG_pdf = @DX_FLAG_pdf@
DX_FLAG_ps = @DX_FLAG_ps@
DX_FLAG_rtf = @DX_FLAG_rtf@
DX_FLAG_xml = @DX_FLAG_xml@
DX_HHC = @DX_HHC@
DX_LATEX = @DX_LATEX@
DX_MAKEINDEX = @DX_MAKEINDEX@
DX_PDFLATEX = @DX_PDFLATEX@
DX_PERL = @DX_PERL@
DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FRAMEWORK_IOKIT = @FRAMEWORK_IOKIT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
LIBUSB_LIBS = @LIBUSB_LIBS@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
SDL_CONFIG = @SDL_CONFIG@
SDL_LIBS = @SDL_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
XMKMF = @XMKMF@
XV_CFLAGS = @XV_CFLAGS@
XV_LIBS = @XV_LIBS@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_age = @lt_age@
lt_current = @lt_current@
lt_revision = @lt_revision@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
platform_LDFLAGS = @platform_LDFLAGS@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
pkglinuxincludedir = $(pkgincludedir)/linux
@HAVE_LIBRAW1394_TRUE@noinst_LTLIBRARIES = libdc1394-linux.la
# headers to be installed
@HAVE_LIBRAW1394_TRUE@pkglinuxinclude_HEADERS = \
@HAVE_LIBRAW1394_TRUE@ capture.h \
@HAVE_LIBRAW1394_TRUE@ control.h
AM_CFLAGS = -I$(top_srcdir) -I$(top_srcdir)/dc1394
libdc1394_linux_la_LIBADD = -lraw1394
libdc1394_linux_la_SOURCES = \
control.c \
capture.c \
capture.h \
kernel-video1394.h \
linux.h
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu dc1394/linux/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu dc1394/linux/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
libdc1394-linux.la: $(libdc1394_linux_la_OBJECTS) $(libdc1394_linux_la_DEPENDENCIES) $(EXTRA_libdc1394_linux_la_DEPENDENCIES)
$(AM_V_CCLD)$(LINK) $(am_libdc1394_linux_la_rpath) $(libdc1394_linux_la_OBJECTS) $(libdc1394_linux_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/capture.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/control.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-pkglinuxincludeHEADERS: $(pkglinuxinclude_HEADERS)
@$(NORMAL_INSTALL)
@list='$(pkglinuxinclude_HEADERS)'; test -n "$(pkglinuxincludedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(pkglinuxincludedir)'"; \
$(MKDIR_P) "$(DESTDIR)$(pkglinuxincludedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkglinuxincludedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(pkglinuxincludedir)" || exit $$?; \
done
uninstall-pkglinuxincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(pkglinuxinclude_HEADERS)'; test -n "$(pkglinuxincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(pkglinuxincludedir)'; $(am__uninstall_files_from_dir)
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(pkglinuxincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-pkglinuxincludeHEADERS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-pkglinuxincludeHEADERS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-pkglinuxincludeHEADERS install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
uninstall-pkglinuxincludeHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

468
dc1394/linux/capture.c Normal file
View File

@ -0,0 +1,468 @@
/*
* 1394-Based Digital Camera Control Library
*
* Camera Capture Code for Linux
*
* Written by
* Chris Urmson <curmson@ri.cmu.edu>
* Damien Douxchamps <ddouxchamps@users.sf.net>
* Dan Dennedy <ddennedy@users.sf.net>
* David Moore <dcm@acm.org>
*
* 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
*/
#include <libraw1394/raw1394.h>
#include <libraw1394/csr.h>
#include "config.h"
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#if HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
#include <unistd.h>
#include "kernel-video1394.h"
#include "linux.h"
#include "internal.h"
/**********************/
/* Internal functions */
/**********************/
dc1394error_t
open_dma_device(platform_camera_t * craw)
{
char filename[64];
struct stat statbuf;
// if the dma device file has been set manually, use that device name
if (craw->capture.dma_device_file!=NULL) {
if ( (craw->capture.dma_fd = open(craw->capture.dma_device_file,O_RDWR)) < 0 ) {
return DC1394_INVALID_VIDEO1394_DEVICE;
}
else {
return DC1394_SUCCESS;
}
}
// automatic mode: try to open several usual device files.
sprintf(filename,"/dev/video1394/%d",craw->port);
if ( stat (filename, &statbuf) == 0 &&
S_ISCHR (statbuf.st_mode) &&
(craw->capture.dma_fd = open(filename,O_RDWR)) >= 0 ) {
return DC1394_SUCCESS;
}
sprintf(filename,"/dev/video1394-%d",craw->port);
if ( stat (filename, &statbuf) == 0 &&
S_ISCHR (statbuf.st_mode) &&
(craw->capture.dma_fd = open(filename,O_RDWR)) >= 0 ) {
return DC1394_SUCCESS;
}
if (craw->port==0) {
sprintf(filename,"/dev/video1394");
if ( stat (filename, &statbuf) == 0 &&
S_ISCHR (statbuf.st_mode) &&
(craw->capture.dma_fd = open(filename,O_RDWR)) >= 0 ) {
return DC1394_SUCCESS;
}
}
return DC1394_FAILURE;
}
/*****************************************************
capture_linux_setup
This sets up the dma for the given camera.
capture_basic_setup must be called before
******************************************************/
static dc1394error_t
capture_linux_setup(platform_camera_t * craw, uint32_t num_dma_buffers)
{
struct video1394_mmap vmmap;
struct video1394_wait vwait;
uint32_t i;
dc1394video_frame_t * f;
memset(&vmmap, 0, sizeof(vmmap));
memset(&vwait, 0, sizeof(vwait));
if (open_dma_device(craw) != DC1394_SUCCESS) {
dc1394_log_warning("Could not open video1394 device file in /dev");
return DC1394_INVALID_VIDEO1394_DEVICE;
}
vmmap.sync_tag= 1;
vmmap.nb_buffers= num_dma_buffers;
vmmap.flags= VIDEO1394_SYNC_FRAMES;
vmmap.buf_size= craw->capture.frames[0].total_bytes; //number of bytes needed
vmmap.channel= craw->iso_channel;
/* tell the video1394 system that we want to listen to the given channel */
if (ioctl(craw->capture.dma_fd, VIDEO1394_IOC_LISTEN_CHANNEL, &vmmap) < 0) {
dc1394_log_error("VIDEO1394_IOC_LISTEN_CHANNEL ioctl failed: %s", strerror(errno));
close (craw->capture.dma_fd);
return DC1394_IOCTL_FAILURE;
}
// starting from here we use the ISO channel so we set the flag in the camera struct:
craw->capture_is_set=1;
craw->capture.dma_frame_size= vmmap.buf_size;
craw->capture.num_dma_buffers= vmmap.nb_buffers;
craw->capture.dma_last_buffer= -1;
vwait.channel= craw->iso_channel;
/* QUEUE the buffers */
for (i= 0; i < vmmap.nb_buffers; i++) {
vwait.buffer= i;
if (ioctl(craw->capture.dma_fd,VIDEO1394_IOC_LISTEN_QUEUE_BUFFER,&vwait) < 0) {
dc1394_log_error("VIDEO1394_IOC_LISTEN_QUEUE_BUFFER ioctl failed");
ioctl(craw->capture.dma_fd, VIDEO1394_IOC_UNLISTEN_CHANNEL, &(vwait.channel));
craw->capture_is_set=0;
close (craw->capture.dma_fd);
return DC1394_IOCTL_FAILURE;
}
}
craw->capture.dma_ring_buffer= mmap(0, vmmap.nb_buffers * vmmap.buf_size,
PROT_READ|PROT_WRITE,MAP_SHARED, craw->capture.dma_fd, 0);
/* make sure the ring buffer was allocated */
if (craw->capture.dma_ring_buffer == (uint8_t*)(-1)) {
dc1394_log_error("mmap failed!");
ioctl(craw->capture.dma_fd, VIDEO1394_IOC_UNLISTEN_CHANNEL, &vmmap.channel);
craw->capture_is_set=0;
close (craw->capture.dma_fd);
// This should be display if the user has low memory
if (vmmap.nb_buffers * vmmap.buf_size > sysconf (_SC_PAGESIZE) * sysconf (_SC_AVPHYS_PAGES)) {
dc1394_log_error("Unable to allocate DMA buffer.\nThe requested size (0x%ux or %ud MiB) is bigger than the available memory (0x%lux or %lud MiB).\nPlease free some memory before allocating the buffers",
vmmap.nb_buffers * vmmap.buf_size,
vmmap.nb_buffers * vmmap.buf_size/1048576,
sysconf (_SC_PAGESIZE) * sysconf (_SC_AVPHYS_PAGES),
sysconf (_SC_PAGESIZE) * sysconf (_SC_AVPHYS_PAGES)/1048576);
} else {
// if it's not low memory, then it's the vmalloc limit.
// VMALLOC_RESERVED not sufficient (default is 128MiB in recent kernels)
dc1394_log_error("Unable to allocate DMA buffer. The requested size (0x%x) may be larger than the usual default VMALLOC_RESERVED limit of 128MiB. To verify this, look for the following line in dmesg:\n'allocation failed: out of vmalloc space'\nIf you see this, reboot with the kernel boot parameter:\n'vmalloc=k'\nwhere k (in bytes) is larger than your requested DMA ring buffer size.\nNote that other processes share the vmalloc space so you may need a\nlarge amount of vmalloc memory.", vmmap.nb_buffers * vmmap.buf_size);
//}
}
return DC1394_IOCTL_FAILURE;
}
craw->capture.dma_buffer_size= vmmap.buf_size * vmmap.nb_buffers;
for (i = 0; i < num_dma_buffers; i++) {
f = craw->capture.frames + i;
if (i > 0)
memcpy (f, craw->capture.frames, sizeof (dc1394video_frame_t));
f->image = (unsigned char *)(craw->capture.dma_ring_buffer +
i * craw->capture.dma_frame_size);
f->id = i;
}
return DC1394_SUCCESS;
}
/* This function allows you to specify the DMA device filename manually. */
dc1394error_t
dc1394_capture_set_device_filename(dc1394camera_t* camera, char *filename)
{
dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
platform_camera_t * craw = cpriv->pcam;
if (craw->capture.dma_device_file==NULL) {
craw->capture.dma_device_file=(char*)malloc(64*sizeof(char));
if (craw->capture.dma_device_file==NULL)
return DC1394_MEMORY_ALLOCATION_FAILURE;
}
// note that the device filename is limited to 64 characters.
memcpy(craw->capture.dma_device_file,filename,64*sizeof(char));
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_linux_capture_setup(platform_camera_t *craw, uint32_t num_dma_buffers,
uint32_t flags)
{
dc1394camera_t * camera = craw->camera;
dc1394error_t err;
if (flags & DC1394_CAPTURE_FLAGS_DEFAULT)
flags = DC1394_CAPTURE_FLAGS_CHANNEL_ALLOC |
DC1394_CAPTURE_FLAGS_BANDWIDTH_ALLOC;
// if capture is already set, abort
if (craw->capture_is_set>0)
return DC1394_CAPTURE_IS_RUNNING;
craw->capture.flags=flags;
craw->allocated_channel = -1;
// if auto iso is requested, stop ISO (if necessary)
if (flags & DC1394_CAPTURE_FLAGS_AUTO_ISO) {
dc1394switch_t is_iso_on;
dc1394_video_get_transmission(camera, &is_iso_on);
if (is_iso_on == DC1394_ON) {
err=dc1394_video_set_transmission(camera, DC1394_OFF);
DC1394_ERR_RTN(err,"Could not stop ISO!");
}
}
// allocate channel/bandwidth if requested
if (flags & DC1394_CAPTURE_FLAGS_CHANNEL_ALLOC) {
if (dc1394_iso_allocate_channel (camera, 0, &craw->allocated_channel)
!= DC1394_SUCCESS)
goto fail;
if (dc1394_video_set_iso_channel (camera, craw->allocated_channel)
!= DC1394_SUCCESS)
goto fail;
}
if (flags & DC1394_CAPTURE_FLAGS_BANDWIDTH_ALLOC) {
unsigned int bandwidth_usage;
if (dc1394_video_get_bandwidth_usage (camera, &bandwidth_usage)
!= DC1394_SUCCESS)
goto fail;
if (dc1394_iso_allocate_bandwidth (camera, bandwidth_usage)
!= DC1394_SUCCESS)
goto fail;
craw->allocated_bandwidth = bandwidth_usage;
}
craw->capture.frames = malloc (num_dma_buffers * sizeof (dc1394video_frame_t));
err=capture_basic_setup(camera, craw->capture.frames);
if (err != DC1394_SUCCESS)
goto fail;
if (dc1394_video_get_iso_channel (camera, &craw->iso_channel)
!= DC1394_SUCCESS)
goto fail;
// the capture_is_set flag is set inside this function:
err=capture_linux_setup (craw, num_dma_buffers);
if (err != DC1394_SUCCESS)
goto fail;
// if auto iso is requested, start ISO
if (flags & DC1394_CAPTURE_FLAGS_AUTO_ISO) {
err=dc1394_video_set_transmission(camera, DC1394_ON);
DC1394_ERR_RTN(err,"Could not start ISO!");
craw->iso_auto_started=1;
}
return DC1394_SUCCESS;
fail:
// free resources if they were allocated
if (craw->allocated_channel >= 0) {
if (dc1394_iso_release_channel (camera, craw->allocated_channel)
!= DC1394_SUCCESS)
dc1394_log_warning("Warning: Could not free ISO channel");
}
if (craw->allocated_bandwidth) {
if (dc1394_iso_release_bandwidth (camera, craw->allocated_bandwidth)
!= DC1394_SUCCESS)
dc1394_log_warning("Warning: Could not free bandwidth");
}
craw->allocated_channel = -1;
craw->allocated_bandwidth = 0;
free (craw->capture.frames);
craw->capture.frames = NULL;
dc1394_log_error ("Error: Failed to setup DMA capture");
return DC1394_FAILURE;
}
/*****************************************************
CAPTURE_STOP
*****************************************************/
dc1394error_t
dc1394_linux_capture_stop(platform_camera_t *craw)
{
dc1394camera_t * camera = craw->camera;
int err;
if (craw->capture_is_set>0) {
// unlisten
if (ioctl(craw->capture.dma_fd, VIDEO1394_IOC_UNLISTEN_CHANNEL,
&(craw->iso_channel)) < 0)
return DC1394_IOCTL_FAILURE;
// release
if (craw->capture.dma_ring_buffer) {
munmap((void*)craw->capture.dma_ring_buffer,craw->capture.dma_buffer_size);
}
while (close(craw->capture.dma_fd) != 0) {
dc1394_log_debug("waiting for dma_fd to close");
sleep (1);
}
craw->capture.dma_fd = -1;
free (craw->capture.frames);
craw->capture.frames = NULL;
// this dma_device file is allocated by the strdup() function and can be freed here without problems.
free(craw->capture.dma_device_file);
craw->capture.dma_device_file=NULL;
// capture is not set anymore
craw->capture_is_set=0;
// free ressources if they were allocated
if (craw->allocated_channel >= 0) {
if (dc1394_iso_release_channel (camera, craw->allocated_channel)
!= DC1394_SUCCESS)
dc1394_log_warning("Warning: Could not free ISO channel");
}
if (craw->allocated_bandwidth) {
if (dc1394_iso_release_bandwidth (camera, craw->allocated_bandwidth)
!= DC1394_SUCCESS)
dc1394_log_warning("Warning: Could not free bandwidth");
}
craw->allocated_channel = -1;
craw->allocated_bandwidth = 0;
// stop ISO if it was started automatically
if (craw->iso_auto_started>0) {
err=dc1394_video_set_transmission(camera, DC1394_OFF);
DC1394_ERR_RTN(err,"Could not stop ISO!");
craw->iso_auto_started=0;
}
// free the additional capture handle
raw1394_destroy_handle(craw->capture.handle);
}
else {
return DC1394_CAPTURE_IS_NOT_SET;
}
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_linux_capture_dequeue (platform_camera_t * craw,
dc1394capture_policy_t policy,
dc1394video_frame_t **frame)
{
dc1394capture_t * capture = &(craw->capture);
struct video1394_wait vwait;
dc1394video_frame_t * frame_tmp;
int cb;
int result=-1;
if(craw->capture.frames==NULL || craw->capture_is_set==0) {
*frame=NULL;
return DC1394_CAPTURE_IS_NOT_SET;
}
if ( (policy<DC1394_CAPTURE_POLICY_MIN) || (policy>DC1394_CAPTURE_POLICY_MAX) )
return DC1394_INVALID_CAPTURE_POLICY;
// default: return NULL in case of failures or lack of frames
*frame=NULL;
memset(&vwait, 0, sizeof(vwait));
cb = (capture->dma_last_buffer + 1) % capture->num_dma_buffers;
frame_tmp = capture->frames + cb;
vwait.channel = craw->iso_channel;
vwait.buffer = cb;
switch (policy) {
case DC1394_CAPTURE_POLICY_POLL:
result=ioctl(capture->dma_fd, VIDEO1394_IOC_LISTEN_POLL_BUFFER, &vwait);
break;
case DC1394_CAPTURE_POLICY_WAIT:
default:
while (1) {
result=ioctl(capture->dma_fd, VIDEO1394_IOC_LISTEN_WAIT_BUFFER,
&vwait);
if (result == 0 || errno != EINTR)
break;
}
break;
}
if ( result != 0) {
if ((policy==DC1394_CAPTURE_POLICY_POLL) && (errno == EINTR)) {
// when no frames is present, just return
return DC1394_SUCCESS;
}
else {
dc1394_log_error("VIDEO1394_IOC_LISTEN_WAIT/POLL_BUFFER ioctl failed!");
return DC1394_IOCTL_FAILURE;
}
}
capture->dma_last_buffer = cb;
frame_tmp->frames_behind = vwait.buffer;
frame_tmp->timestamp = (uint64_t) vwait.filltime.tv_sec * 1000000 + vwait.filltime.tv_usec;
*frame=frame_tmp;
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_linux_capture_enqueue (platform_camera_t * craw,
dc1394video_frame_t * frame)
{
dc1394camera_t * camera = craw->camera;
struct video1394_wait vwait;
memset(&vwait, 0, sizeof(vwait));
if (frame->camera != camera) {
dc1394_log_error("camera does not match frame's camera");
return DC1394_INVALID_ARGUMENT_VALUE;
}
vwait.channel = craw->iso_channel;
vwait.buffer = frame->id;
if (ioctl(craw->capture.dma_fd, VIDEO1394_IOC_LISTEN_QUEUE_BUFFER, &vwait) < 0) {
dc1394_log_error("VIDEO1394_IOC_LISTEN_QUEUE_BUFFER ioctl failed!");
return DC1394_IOCTL_FAILURE;
}
return DC1394_SUCCESS;
}
int
dc1394_linux_capture_get_fileno (platform_camera_t * craw)
{
return craw->capture.dma_fd;
}

42
dc1394/linux/capture.h Normal file
View File

@ -0,0 +1,42 @@
/*
* 1394-Based Digital Camera Control Library
*
* Camera Capture headers for Linux
*
* Written by
* Chris Urmson <curmson@ri.cmu.edu>
* Damien Douxchamps <ddouxchamps@users.sf.net>
* Dan Dennedy <ddennedy@users.sf.net>
* David Moore <dcm@acm.org>
*
* 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
*/
#ifndef __DC1394_CAPTURE_LINUX_H__
#define __DC1394_CAPTURE_LINUX_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Set the DMA device filename manually. In most cases this is not necessary because the capture
functions probe common filenames such as /dev/video1394/x or /dev/video1394. */
dc1394error_t dc1394_capture_set_device_filename(dc1394camera_t* camera, char *filename);
#ifdef __cplusplus
}
#endif
#endif

496
dc1394/linux/control.c Normal file
View File

@ -0,0 +1,496 @@
/*
* 1394-Based Digital Camera Control Library
*
* Camera control code for Linux
*
* Written by
* Chris Urmson <curmson@ri.cmu.edu>
* Damien Douxchamps <ddouxchamps@users.sf.net>
* Dan Dennedy <ddennedy@users.sf.net>
* David Moore <dcm@acm.org>
*
* 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
*/
#include "config.h"
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <sys/time.h>
#include <arpa/inet.h>
#include "dc1394/internal.h"
#include "linux.h"
#include "offsets.h"
#include "types.h"
static int
is_device_available (const char * filename)
{
int fd;
struct stat sbuf;
if (!filename)
return 0;
if (stat (filename, &sbuf) < 0)
return 0;
fd = open (filename, O_RDWR);
if (fd < 0)
return 0;
close (fd);
dc1394_log_debug("linux: Found %s", filename);
return 1;
}
static platform_t *
dc1394_linux_new (void)
{
if (!is_device_available (getenv("RAW1394DEV")) &&
!is_device_available ("/dev/raw1394")) {
dc1394_log_debug("linux: Failed to open RAW1394DEV or /dev/raw1394");
return NULL;
}
platform_t * p = calloc (1, sizeof (platform_t));
return p;
}
static void
dc1394_linux_free (platform_t * p)
{
free (p);
}
struct _platform_device_t {
uint32_t config_rom[256];
int num_quads;
int port, node, generation;
};
static int
read_retry (struct raw1394_handle * handle, nodeid_t node, nodeaddr_t addr,
size_t length, quadlet_t * buffer)
{
int retry = DC1394_MAX_RETRIES;
while (retry > 0) {
if (raw1394_read (handle, node, addr, length, buffer) == 0)
return 0;
if (errno != EAGAIN)
return -1;
usleep (DC1394_SLOW_DOWN);
retry--;
}
return -1;
}
static platform_device_list_t *
dc1394_linux_get_device_list (platform_t * p)
{
platform_device_list_t * list;
uint32_t allocated_size = 64;
raw1394handle_t handle;
int num_ports, i;
handle = raw1394_new_handle ();
if (!handle)
return NULL;
num_ports = raw1394_get_port_info (handle, NULL, 0);
dc1394_log_debug ("linux: Found %d port(s)", num_ports);
raw1394_destroy_handle (handle);
list = calloc (1, sizeof (platform_device_list_t));
if (!list)
return NULL;
list->devices = malloc(allocated_size * sizeof(platform_device_t *));
if (!list->devices) {
free (list);
return NULL;
}
for (i = 0; i < num_ports; i++) {
int num_nodes, j;
handle = raw1394_new_handle_on_port (i);
if (!handle)
continue;
num_nodes = raw1394_get_nodecount (handle);
dc1394_log_debug ("linux: Port %d opened with %d node(s)",
i, num_nodes);
for (j = 0; j < num_nodes; j++) {
platform_device_t * device;
uint32_t quad;
int k;
if (read_retry (handle, 0xFFC0 | j, CONFIG_ROM_BASE + 0x400, 4, &quad) < 0)
continue;
device = malloc (sizeof (platform_device_t));
if (!device)
continue;
device->config_rom[0] = ntohl (quad);
device->port = i;
device->node = j;
device->generation = raw1394_get_generation (handle);
for (k = 1; k < 256; k++) {
if (read_retry (handle, 0xFFC0 | j, CONFIG_ROM_BASE + 0x400 + 4*k, 4, &quad) < 0)
break;
device->config_rom[k] = ntohl (quad);
}
device->num_quads = k;
list->devices[list->num_devices] = device;
list->num_devices++;
if (list->num_devices >= allocated_size) {
allocated_size += 64;
list->devices = realloc (list->devices, allocated_size * sizeof (platform_device_t *));
if (!list->devices)
return NULL;
}
}
raw1394_destroy_handle (handle);
}
return list;
}
static void
dc1394_linux_free_device_list (platform_device_list_t * d)
{
int i;
for (i = 0; i < d->num_devices; i++)
free (d->devices[i]);
free (d->devices);
free (d);
}
static int
dc1394_linux_device_get_config_rom (platform_device_t * device,
uint32_t * quads, int * num_quads)
{
if (*num_quads > device->num_quads)
*num_quads = device->num_quads;
memcpy (quads, device->config_rom, *num_quads * sizeof (uint32_t));
return 0;
}
static platform_camera_t *
dc1394_linux_camera_new (platform_t * p, platform_device_t * device, uint32_t unit_directory_offset)
{
platform_camera_t * camera;
raw1394handle_t handle;
handle = raw1394_new_handle_on_port (device->port);
if (!handle)
return NULL;
if (device->generation != raw1394_get_generation (handle)) {
dc1394_log_error("generation has changed since bus was scanned");
raw1394_destroy_handle (handle);
return NULL;
}
camera = calloc (1, sizeof (platform_camera_t));
camera->handle = handle;
camera->port = device->port;
camera->node = device->node;
camera->generation = device->generation;
return camera;
}
static void
dc1394_linux_camera_free (platform_camera_t * cam)
{
if (cam->capture.dma_device_file != NULL) {
free (cam->capture.dma_device_file);
cam->capture.dma_device_file = NULL;
}
raw1394_destroy_handle (cam->handle);
free (cam);
}
static void
dc1394_linux_camera_set_parent (platform_camera_t * cam,
dc1394camera_t * parent)
{
cam->camera = parent;
}
static dc1394error_t
dc1394_linux_camera_print_info (platform_camera_t * cam, FILE *fd)
{
fprintf(fd,"------ Camera platform-specific information ------\n");
fprintf(fd,"Handle : %p\n", cam->handle);
fprintf(fd,"Port : %d\n", cam->port);
fprintf(fd,"Node : %d\n", cam->node);
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_linux_camera_read (platform_camera_t * cam, uint64_t offset,
uint32_t * quads, int num_quads)
{
int i, retval, retry = DC1394_MAX_RETRIES;
/* retry a few times if necessary (addition by PDJ) */
while(retry--) {
#ifdef DC1394_DEBUG_LOWEST_LEVEL
fprintf(stderr,"get %d regs at 0x%llx : ",
num_quads, offset + CONFIG_ROM_BASE);
#endif
retval = raw1394_read (cam->handle, 0xffc0 | cam->node, offset + CONFIG_ROM_BASE, 4 * num_quads, quads);
#ifdef DC1394_DEBUG_LOWEST_LEVEL
fprintf(stderr,"0x%lx [...]\n", quads[0]);
#endif
if (!retval)
goto out;
else if (errno != EAGAIN)
return ( retval ? DC1394_RAW1394_FAILURE : DC1394_SUCCESS );
// usleep is executed only if the read fails!!!
usleep(DC1394_SLOW_DOWN);
}
out:
/* conditionally byte swap the value */
for (i = 0; i < num_quads; i++)
quads[i] = ntohl (quads[i]);
return ( retval ? DC1394_RAW1394_FAILURE : DC1394_SUCCESS );
}
static dc1394error_t
dc1394_linux_camera_write (platform_camera_t * cam, uint64_t offset,
const uint32_t * quads, int num_quads)
{
int i, retval, retry= DC1394_MAX_RETRIES;
uint32_t value[num_quads];
/* conditionally byte swap the value (addition by PDJ) */
for (i = 0; i < num_quads; i++)
value[i] = htonl (quads[i]);
/* retry a few times if necessary */
while(retry--) {
#ifdef DC1394_DEBUG_LOWEST_LEVEL
fprintf(stderr,"set %d regs at 0x%llx to value 0x%lx [...]\n",
num_quads, offset + CONFIG_ROM_BASE, value[0]);
#endif
retval = raw1394_write(cam->handle, 0xffc0 | cam->node, offset + CONFIG_ROM_BASE, 4 * num_quads, value);
if (!retval || (errno != EAGAIN))
return ( retval ? DC1394_RAW1394_FAILURE : DC1394_SUCCESS );
// usleep is executed only if the read fails!!!
usleep(DC1394_SLOW_DOWN);
}
return DC1394_RAW1394_FAILURE;
}
static dc1394error_t
dc1394_linux_reset_bus (platform_camera_t * cam)
{
if (raw1394_reset_bus (cam->handle) == 0)
return DC1394_SUCCESS;
else
return DC1394_FAILURE;
}
static dc1394error_t
dc1394_linux_read_cycle_timer (platform_camera_t * cam,
uint32_t * cycle_timer, uint64_t * local_time)
{
quadlet_t quad;
struct timeval tv;
if (raw1394_read (cam->handle, raw1394_get_local_id (cam->handle),
CSR_REGISTER_BASE + CSR_CYCLE_TIME, sizeof (quadlet_t), &quad) < 0)
return DC1394_FAILURE;
gettimeofday (&tv, NULL);
*cycle_timer = ntohl (quad);
*local_time = (uint64_t)tv.tv_sec * 1000000ULL + tv.tv_usec;
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_linux_set_broadcast(platform_camera_t * craw, dc1394bool_t pwr)
{
if (pwr==DC1394_TRUE) {
if (craw->broadcast_is_set==DC1394_FALSE) {
craw->backup_node_id=craw->node;
craw->node=63;
craw->broadcast_is_set=DC1394_TRUE;
}
}
else if (pwr==DC1394_FALSE) {
if (craw->broadcast_is_set==DC1394_TRUE) {
craw->node=craw->backup_node_id;
craw->broadcast_is_set=DC1394_FALSE;
}
}
else
return DC1394_INVALID_ARGUMENT_VALUE;
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_linux_get_broadcast(platform_camera_t * craw, dc1394bool_t *pwr)
{
*pwr=craw->broadcast_is_set;
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_linux_iso_set_persist (platform_camera_t * cam)
{
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_linux_iso_allocate_channel (platform_camera_t * cam, uint64_t channels_allowed, int * channel)
{
int i;
for (i = 0; i < 64; i++) {
if (!((channels_allowed >> i) & 1))
continue;
if (raw1394_channel_modify (cam->handle, i, RAW1394_MODIFY_ALLOC) == 0)
break;
}
if (i == 64) {
dc1394_log_error ("Error: Failed to allocate iso channel");
return DC1394_NO_ISO_CHANNEL;
}
*channel = i;
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_linux_iso_release_channel (platform_camera_t * cam, int channel)
{
if (raw1394_channel_modify (cam->handle, channel, RAW1394_MODIFY_FREE) < 0) {
dc1394_log_error("Error: Could not free iso channel");
return DC1394_FAILURE;
}
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_linux_iso_allocate_bandwidth (platform_camera_t * cam,
int bandwidth_units)
{
if (raw1394_bandwidth_modify (cam->handle, bandwidth_units, RAW1394_MODIFY_ALLOC) < 0) {
dc1394_log_error ("Error: Failed to allocate iso bandwidth");
return DC1394_NO_BANDWIDTH;
}
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_linux_iso_release_bandwidth (platform_camera_t * cam,
int bandwidth_units)
{
if (raw1394_bandwidth_modify (cam->handle, bandwidth_units, RAW1394_MODIFY_FREE) < 0) {
dc1394_log_error ("Error: Failed to free iso bandwidth");
return DC1394_FAILURE;
}
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_linux_camera_get_node(platform_camera_t *cam, uint32_t *node,
uint32_t * generation)
{
if (node)
*node = cam->node;
if (generation)
*generation = cam->generation;
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_camera_get_linux_port(dc1394camera_t *camera, uint32_t *port)
{
dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
platform_camera_t * craw = cpriv->pcam;
*port=craw->port;
return DC1394_SUCCESS;
}
static platform_dispatch_t
linux_dispatch = {
.platform_new = dc1394_linux_new,
.platform_free = dc1394_linux_free,
.get_device_list = dc1394_linux_get_device_list,
.free_device_list = dc1394_linux_free_device_list,
.device_get_config_rom = dc1394_linux_device_get_config_rom,
.camera_new = dc1394_linux_camera_new,
.camera_free = dc1394_linux_camera_free,
.camera_set_parent = dc1394_linux_camera_set_parent,
.camera_read = dc1394_linux_camera_read,
.camera_write = dc1394_linux_camera_write,
.reset_bus = dc1394_linux_reset_bus,
.camera_print_info = dc1394_linux_camera_print_info,
.camera_get_node = dc1394_linux_camera_get_node,
.set_broadcast = dc1394_linux_set_broadcast,
.get_broadcast = dc1394_linux_get_broadcast,
.read_cycle_timer = dc1394_linux_read_cycle_timer,
.capture_setup = dc1394_linux_capture_setup,
.capture_stop = dc1394_linux_capture_stop,
.capture_dequeue = dc1394_linux_capture_dequeue,
.capture_enqueue = dc1394_linux_capture_enqueue,
.capture_get_fileno = dc1394_linux_capture_get_fileno,
.capture_set_callback = NULL,
.capture_schedule_with_runloop = NULL,
.iso_set_persist = dc1394_linux_iso_set_persist,
.iso_allocate_channel = dc1394_linux_iso_allocate_channel,
.iso_release_channel = dc1394_linux_iso_release_channel,
.iso_allocate_bandwidth = dc1394_linux_iso_allocate_bandwidth,
.iso_release_bandwidth = dc1394_linux_iso_release_bandwidth,
};
void
linux_init(dc1394_t * d)
{
register_platform (d, &linux_dispatch, "linux");
}

37
dc1394/linux/control.h Normal file
View File

@ -0,0 +1,37 @@
/*
* 1394-Based Digital Camera Control Library
*
* Camera Control headers for Linux
*
* Written by Damien Douxchamps <ddouxchamps@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.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
*/
#ifndef __DC1394_CONTROL_LINUX_H__
#define __DC1394_CONTROL_LINUX_H__
#ifdef __cplusplus
extern "C" {
#endif
dc1394error_t
dc1394_camera_get_linux_port(dc1394camera_t *camera, uint32_t *port);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,76 @@
/*
* kernel-video1394.h - driver for OHCI 1394 boards
* Copyright (C)1999,2000 Sebastien Rougeaux <sebastien.rougeaux@anu.edu.au>
* Peter Schlaile <udbz@rz.uni-karlsruhe.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.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
*/
#ifndef __VIDEO_1394_H__
#define __VIDEO_1394_H__
#include <sys/ioctl.h>
#define VIDEO1394_DRIVER_NAME "video1394"
#define VIDEO1394_MAX_SIZE 0x4000000
enum {
VIDEO1394_BUFFER_FREE = 0,
VIDEO1394_BUFFER_QUEUED,
VIDEO1394_BUFFER_READY
};
#define VIDEO1394_SYNC_FRAMES 0x00000001
#define VIDEO1394_INCLUDE_ISO_HEADERS 0x00000002
#define VIDEO1394_VARIABLE_PACKET_SIZE 0x00000004
struct video1394_mmap {
int channel; /* -1 to find an open channel in LISTEN/TALK */
unsigned int sync_tag;
unsigned int nb_buffers;
unsigned int buf_size;
unsigned int packet_size; /* For VARIABLE_PACKET_SIZE:
Maximum packet size */
unsigned int fps;
unsigned int syt_offset;
unsigned int flags;
};
/* For TALK_QUEUE_BUFFER with VIDEO1394_VARIABLE_PACKET_SIZE use */
struct video1394_queue_variable {
unsigned int channel;
unsigned int buffer;
unsigned int* packet_sizes; /* Buffer of size:
buf_size / packet_size */
};
struct video1394_wait {
unsigned int channel;
unsigned int buffer;
struct timeval filltime; /* time of buffer full */
};
#define VIDEO1394_IOC_LISTEN_CHANNEL _IOWR('#', 0x10, struct video1394_mmap)
#define VIDEO1394_IOC_UNLISTEN_CHANNEL _IOW ('#', 0x11, int)
#define VIDEO1394_IOC_LISTEN_QUEUE_BUFFER _IOW ('#', 0x12, struct video1394_wait)
#define VIDEO1394_IOC_LISTEN_WAIT_BUFFER _IOWR('#', 0x13, struct video1394_wait)
#define VIDEO1394_IOC_TALK_CHANNEL _IOWR('#', 0x14, struct video1394_mmap)
#define VIDEO1394_IOC_UNTALK_CHANNEL _IOW ('#', 0x15, int)
#define VIDEO1394_IOC_TALK_QUEUE_BUFFER _IOW ('#', 0x16, size_t)
#define VIDEO1394_IOC_TALK_WAIT_BUFFER _IOW ('#', 0x17, struct video1394_wait)
#define VIDEO1394_IOC_LISTEN_POLL_BUFFER _IOWR('#', 0x18, struct video1394_wait)
#endif

93
dc1394/linux/linux.h Normal file
View File

@ -0,0 +1,93 @@
/*
* 1394-Based Digital Camera Control Library
*
* Linux specific type definitions
*
* Written by
* Damien Douxchamps <ddouxchamps@users.sf.net>
* David Moore <dcm@acm.org>
*
* 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
*/
#ifndef __DC1394_LINUX_H__
#define __DC1394_LINUX_H__
#include <libraw1394/raw1394.h>
#include <libraw1394/csr.h>
//#include "linux/raw1394support.h"
#include <dc1394/dc1394.h>
#include "internal.h"
struct _platform_t {
int dummy;
};
typedef struct __dc1394_capture
{
unsigned char *capture_buffer;
/* components needed for the DMA based video capture */
const unsigned char *dma_ring_buffer;
char *dma_device_file;
unsigned int dma_buffer_size;
unsigned int dma_frame_size;
unsigned int num_dma_buffers;
unsigned int dma_last_buffer;
int dma_fd;
raw1394handle_t handle;
uint32_t flags;
dc1394video_frame_t *frames;
} dc1394capture_t;
struct _platform_camera_t {
raw1394handle_t handle;
int node, port;
uint32_t generation;
dc1394camera_t * camera;
dc1394capture_t capture;
int capture_is_set;
int allocated_channel;
unsigned int allocated_bandwidth;
int iso_auto_started;
unsigned int iso_channel;
// for broadcast:
int backup_node_id;
dc1394bool_t broadcast_is_set;
};
dc1394error_t
dc1394_linux_capture_setup(platform_camera_t *craw, uint32_t num_dma_buffers,
uint32_t flags);
dc1394error_t
dc1394_linux_capture_stop(platform_camera_t *craw);
dc1394error_t
dc1394_linux_capture_dequeue (platform_camera_t * craw,
dc1394capture_policy_t policy, dc1394video_frame_t **frame_return);
dc1394error_t
dc1394_linux_capture_enqueue (platform_camera_t * craw,
dc1394video_frame_t * frame);
int
dc1394_linux_capture_get_fileno (platform_camera_t * craw);
#endif

137
dc1394/log.c Normal file
View File

@ -0,0 +1,137 @@
/*
* 1394-Based Digital Camera Control Library
*
* Error logging functions
*
* Written by Damien Douxchamps <ddouxchamps@users.sf.net> and
* Rudolf Leitgeb
*
* 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
*/
#include "log.h"
#include <stdarg.h>
#include <stdlib.h>
static void
default_errorlog_handler(dc1394log_t type, const char *message, void* user)
{
fprintf(stderr, "libdc1394 error: %s\n", message);
}
static void
default_warninglog_handler(dc1394log_t type, const char *message, void* user)
{
fprintf(stderr, "libdc1394 warning: %s\n", message);
}
static void
default_debuglog_handler(dc1394log_t type, const char *message, void* user)
{
static int log_enabled = -1;
if (log_enabled == -1) {
if (getenv("DC1394_DEBUG") == NULL )
log_enabled = 0;
else
log_enabled = 1;
}
if (log_enabled == 1)
fprintf(stderr, "libdc1394 debug: %s\n", message);
}
static void(*system_errorlog_handler)(dc1394log_t type, const char *message, void* user) = default_errorlog_handler;
static void(*system_warninglog_handler)(dc1394log_t type, const char *message, void* user) = default_warninglog_handler;
static void(*system_debuglog_handler)(dc1394log_t type, const char *message, void* user) = default_debuglog_handler;
static void *errorlog_data = NULL;
static void *warninglog_data = NULL;
static void *debuglog_data = NULL;
dc1394error_t
dc1394_log_register_handler(dc1394log_t type, void(*log_handler)(dc1394log_t type, const char *message, void* user), void* user) {
switch (type) {
case DC1394_LOG_ERROR:
system_errorlog_handler = log_handler;
errorlog_data=user;
return DC1394_SUCCESS;
case DC1394_LOG_WARNING:
system_warninglog_handler = log_handler;
warninglog_data=user;
return DC1394_SUCCESS;
case DC1394_LOG_DEBUG:
system_debuglog_handler = log_handler;
debuglog_data=user;
return DC1394_SUCCESS;
default:
return DC1394_INVALID_LOG_TYPE;
}
}
dc1394error_t
dc1394_log_set_default_handler(dc1394log_t type) {
switch (type) {
case DC1394_LOG_ERROR:
system_errorlog_handler = default_errorlog_handler;
errorlog_data=NULL;
return DC1394_SUCCESS;
case DC1394_LOG_WARNING:
system_warninglog_handler = default_warninglog_handler;
warninglog_data=NULL;
return DC1394_SUCCESS;
case DC1394_LOG_DEBUG:
system_debuglog_handler = default_debuglog_handler;
debuglog_data=NULL;
return DC1394_SUCCESS;
default:
return DC1394_INVALID_LOG_TYPE;
}
}
void dc1394_log_error(const char *format,...)
{
char string[1024];
if (system_errorlog_handler != NULL) {
va_list args;
va_start(args, format);
vsnprintf(string, sizeof(string), format, args);
system_errorlog_handler(DC1394_LOG_ERROR, string, errorlog_data);
}
}
void dc1394_log_warning(const char *format,...)
{
char string[1024];
if (system_warninglog_handler != NULL) {
va_list args;
va_start(args, format);
vsnprintf(string, sizeof(string), format, args);
system_warninglog_handler(DC1394_LOG_WARNING, string, warninglog_data);
}
}
void dc1394_log_debug(const char *format,...)
{
char string[1024];
if (system_debuglog_handler != NULL) {
va_list args;
va_start(args, format);
vsnprintf(string, sizeof(string), format, args);
system_debuglog_handler(DC1394_LOG_DEBUG, string, debuglog_data);
}
}

255
dc1394/log.h Normal file
View File

@ -0,0 +1,255 @@
/*
* 1394-Based Digital Camera Control Library
*
* Error logging functions
*
* Written by Damien Douxchamps <ddouxchamps@users.sf.net> and
* Rudolf Leitgeb
*
* 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
*/
/***************************************************************************
* logging facility for libdc1394
*
* These functions provide the logging of error, warning and debug messages
* They allow registering of custom logging functions or the use
* of the builtin loggers which redirect the output to stderr.
* Three log levels are supported:
* error: Indicates that an error has been detected which mandates
* shutdown of the program as soon as feasible
* warning: Indicates that something happened which prevents libdc1394
* from working but which could possibly be resolved by the
* application or the user: plugging in a camera, resetting the
* firewire bus, ....
* debug: A sort of way point for the library. This log level is supposed
* to report that a specific function has been entered or has
* passed a certain stage. This log level is turned off by default
* and may produce a lot of output during regular operation.
* The main purpose for this log level is for debugging libdc1394
* and for generating meaningful problem reports.
***************************************************************************/
#include <dc1394/dc1394.h>
#ifndef __DC1394_LOG_H__
#define __DC1394_LOG_H__
/*! \file dc1394/log.h
\brief Functions to log errors, warning and debug messages
\author Damien Douxchamps: coding
\author Rudolf Leitgeb: coding
\author Peter Antoniac: documentation maintainer
More details soon
*/
/**
* Error codes returned by most libdc1394 functions.
*
* General rule: 0 is success, negative denotes a problem.
*/
typedef enum {
DC1394_SUCCESS = 0,
DC1394_FAILURE = -1,
DC1394_NOT_A_CAMERA = -2,
DC1394_FUNCTION_NOT_SUPPORTED = -3,
DC1394_CAMERA_NOT_INITIALIZED = -4,
DC1394_MEMORY_ALLOCATION_FAILURE = -5,
DC1394_TAGGED_REGISTER_NOT_FOUND = -6,
DC1394_NO_ISO_CHANNEL = -7,
DC1394_NO_BANDWIDTH = -8,
DC1394_IOCTL_FAILURE = -9,
DC1394_CAPTURE_IS_NOT_SET = -10,
DC1394_CAPTURE_IS_RUNNING = -11,
DC1394_RAW1394_FAILURE = -12,
DC1394_FORMAT7_ERROR_FLAG_1 = -13,
DC1394_FORMAT7_ERROR_FLAG_2 = -14,
DC1394_INVALID_ARGUMENT_VALUE = -15,
DC1394_REQ_VALUE_OUTSIDE_RANGE = -16,
DC1394_INVALID_FEATURE = -17,
DC1394_INVALID_VIDEO_FORMAT = -18,
DC1394_INVALID_VIDEO_MODE = -19,
DC1394_INVALID_FRAMERATE = -20,
DC1394_INVALID_TRIGGER_MODE = -21,
DC1394_INVALID_TRIGGER_SOURCE = -22,
DC1394_INVALID_ISO_SPEED = -23,
DC1394_INVALID_IIDC_VERSION = -24,
DC1394_INVALID_COLOR_CODING = -25,
DC1394_INVALID_COLOR_FILTER = -26,
DC1394_INVALID_CAPTURE_POLICY = -27,
DC1394_INVALID_ERROR_CODE = -28,
DC1394_INVALID_BAYER_METHOD = -29,
DC1394_INVALID_VIDEO1394_DEVICE = -30,
DC1394_INVALID_OPERATION_MODE = -31,
DC1394_INVALID_TRIGGER_POLARITY = -32,
DC1394_INVALID_FEATURE_MODE = -33,
DC1394_INVALID_LOG_TYPE = -34,
DC1394_INVALID_BYTE_ORDER = -35,
DC1394_INVALID_STEREO_METHOD = -36,
DC1394_BASLER_NO_MORE_SFF_CHUNKS = -37,
DC1394_BASLER_CORRUPTED_SFF_CHUNK = -38,
DC1394_BASLER_UNKNOWN_SFF_CHUNK = -39
} dc1394error_t;
#define DC1394_ERROR_MIN DC1394_BASLER_UNKNOWN_SFF_CHUNK
#define DC1394_ERROR_MAX DC1394_SUCCESS
#define DC1394_ERROR_NUM (DC1394_ERROR_MAX-DC1394_ERROR_MIN+1)
/**
* Types of logging messages
*
* Three types exist:
* - ERROR for real, hard, unrecoverable errors that will result in the program terminating.
* - WARNING for things that have gone wrong, but are not requiring a termination of the program.
* - DEBUG for debug messages that can be very verbose but may help the developers to fix bugs.
*/
typedef enum {
DC1394_LOG_ERROR=768,
DC1394_LOG_WARNING,
DC1394_LOG_DEBUG
} dc1394log_t;
#define DC1394_LOG_MIN DC1394_LOG_ERROR
#define DC1394_LOG_MAX DC1394_LOG_DEBUG
#define DC1394_LOG_NUM (DC1394_LOG_MAX - DC1394_LOG_MIN + 1)
#if ! defined (_MSC_VER)
/* Error logging/checking macros. Logs an error string on stderr and exit current function
if error is positive. Neg errors are messages and are thus ignored */
/* Some macros to log errors, etc... conditionally */
#define DC1394_WRN(err,message) \
do { \
if ((err>0)||(err<=-DC1394_ERROR_NUM)) \
err=DC1394_INVALID_ERROR_CODE; \
\
if (err!=DC1394_SUCCESS) { \
dc1394_log_warning("%s: in %s (%s, line %d): %s\n", \
dc1394_error_get_string(err), \
__FUNCTION__, __FILE__, __LINE__, message); \
} \
} while (0);
#define DC1394_ERR(err,message) \
do { \
if ((err>0)||(err<=-DC1394_ERROR_NUM)) \
err=DC1394_INVALID_ERROR_CODE; \
\
if (err!=DC1394_SUCCESS) { \
dc1394_log_error("%s: in %s (%s, line %d): %s\n", \
dc1394_error_get_string(err), \
__FUNCTION__, __FILE__, __LINE__, message); \
return; \
} \
} while (0);
#define DC1394_ERR_RTN(err,message) \
do { \
if ((err>0)||(err<=-DC1394_ERROR_NUM)) \
err=DC1394_INVALID_ERROR_CODE; \
\
if (err!=DC1394_SUCCESS) { \
dc1394_log_error("%s: in %s (%s, line %d): %s\n", \
dc1394_error_get_string(err), \
__FUNCTION__, __FILE__, __LINE__, message); \
return err; \
} \
} while (0);
#define DC1394_ERR_CLN(err,cleanup,message) \
do { \
if ((err>0)||(err<=-DC1394_ERROR_NUM)) \
err=DC1394_INVALID_ERROR_CODE; \
\
if (err!=DC1394_SUCCESS) { \
dc1394_log_error("%s: in %s (%s, line %d): %s\n", \
dc1394_error_get_string(err), \
__FUNCTION__, __FILE__, __LINE__, message); \
cleanup; \
return; \
} \
} while (0);
#define DC1394_ERR_CLN_RTN(err,cleanup,message) \
do { \
if ((err>0)||(err<=-DC1394_ERROR_NUM)) \
err=DC1394_INVALID_ERROR_CODE; \
\
if (err!=DC1394_SUCCESS) { \
dc1394_log_error("%s: in %s (%s, line %d): %s\n", \
dc1394_error_get_string(err), \
__FUNCTION__, __FILE__, __LINE__, message); \
cleanup; \
return err; \
} \
} while (0);
#endif /* _MSC_VER */
#ifdef __cplusplus
extern "C" {
#endif
/**
* dc1394_log_register_handler: register log handler for reporting error, warning or debug statements
* Passing NULL as argument turns off this log level.
* @param [in] log_handler: pointer to a function which takes a character string as argument
* type: the type of log
* @param [in] type: message type (\a debug, \a err or \a warning)
* @param [in] message: log message
*/
dc1394error_t dc1394_log_register_handler(dc1394log_t type, void(*log_handler)(dc1394log_t type,
const char *message, void* user), void* user);
/**
* dc1394_log_set_default_handler: set the log handler to the default handler
* At boot time, debug logging is OFF (handler is NULL). Using this function for the debug statements
* will start logging of debug statements usng the default handler.
*/
dc1394error_t dc1394_log_set_default_handler(dc1394log_t type);
/**
* dc1394_log_error: logs a fatal error condition to the registered facility
* This function shall be invoked if a fatal error condition is encountered.
* The message passed as argument is delivered to the registered error reporting
* function registered before.
* @param [in] format,...: error message to be logged, multiple arguments allowed (printf style)
*/
void dc1394_log_error(const char *format,...);
/**
* dc1394_log_warning: logs a nonfatal error condition to the registered facility
* This function shall be invoked if a nonfatal error condition is encountered.
* The message passed as argument is delivered to the registered warning reporting
* function registered before.
* @param [in] format,...: warning message to be logged, multiple arguments allowed (printf style)
*/
void dc1394_log_warning(const char *format,...);
/**
* dc1394_log_debug: logs a debug statement to the registered facility
* This function shall be invoked if a debug statement is to be logged.
* The message passed as argument is delivered to the registered debug reporting
* function registered before ONLY IF the environment variable DC1394_DEBUG has been set before the
* program starts.
* @param [in] format,...: debug statement to be logged, multiple arguments allowed (printf style)
*/
void dc1394_log_debug(const char *format,...);
#ifdef __cplusplus
}
#endif
#endif

38
dc1394/macosx.c Normal file
View File

@ -0,0 +1,38 @@
/*
* 1394-Based Digital Camera Control Library
*
* Written by Rodolphe Pineau <pineau@rti-zone.org>
*
* 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
*/
#include <stdio.h>
#include "control.h"
#include "platform.h"
#include "internal.h"
#include "macosx.h"
#include <CoreFoundation/CoreFoundation.h>
int dc1394_capture_schedule_with_runloop (dc1394camera_t * camera,
CFRunLoopRef run_loop, CFStringRef run_loop_mode)
{
dc1394camera_priv_t * cpriv = DC1394_CAMERA_PRIV (camera);
const platform_dispatch_t * d = cpriv->platform->dispatch;
if (!d->capture_schedule_with_runloop)
return DC1394_FUNCTION_NOT_SUPPORTED;
return d->capture_schedule_with_runloop (cpriv->pcam, run_loop, run_loop_mode);
}

38
dc1394/macosx.h Normal file
View File

@ -0,0 +1,38 @@
/*
* 1394-Based Digital Camera Control Library
*
* Written by Rodolphe Pineau <pineau@rti-zone.org>
*
* 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
*/
#ifndef __DC1394_MACOSX_H__
#define __DC1394_MACOSX_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <mach/mach.h>
#include <CoreFoundation/CoreFoundation.h>
int dc1394_capture_schedule_with_runloop (dc1394camera_t * camera,
CFRunLoopRef run_loop, CFStringRef run_loop_mode);
#ifdef __cplusplus
}
#endif
#endif

16
dc1394/macosx/Makefile.am Normal file
View File

@ -0,0 +1,16 @@
pkgmacosxincludedir = $(pkgincludedir)/macosx
if HAVE_MACOSX
noinst_LTLIBRARIES = libdc1394-macosx.la
pkgmacosxinclude_HEADERS =
endif
AM_CFLAGS = -I..
libdc1394_macosx_la_LDFLAGS = -framework CoreFoundation $(FRAMEWORK_IOKIT)
libdc1394_macosx_la_SOURCES = \
control.c \
capture.c \
macosx.h

688
dc1394/macosx/Makefile.in Normal file
View File

@ -0,0 +1,688 @@
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = dc1394/macosx
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp $(pkgmacosxinclude_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/ax_check_framework.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libdc1394_macosx_la_LIBADD =
am_libdc1394_macosx_la_OBJECTS = control.lo capture.lo
libdc1394_macosx_la_OBJECTS = $(am_libdc1394_macosx_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
libdc1394_macosx_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(AM_CFLAGS) $(CFLAGS) $(libdc1394_macosx_la_LDFLAGS) \
$(LDFLAGS) -o $@
@HAVE_MACOSX_TRUE@am_libdc1394_macosx_la_rpath =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(libdc1394_macosx_la_SOURCES)
DIST_SOURCES = $(libdc1394_macosx_la_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(pkgmacosxincludedir)"
HEADERS = $(pkgmacosxinclude_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
pkgincludedir = @pkgincludedir@
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
DX_CONFIG = @DX_CONFIG@
DX_DOCDIR = @DX_DOCDIR@
DX_DOT = @DX_DOT@
DX_DOXYGEN = @DX_DOXYGEN@
DX_DVIPS = @DX_DVIPS@
DX_EGREP = @DX_EGREP@
DX_ENV = @DX_ENV@
DX_FLAG_chi = @DX_FLAG_chi@
DX_FLAG_chm = @DX_FLAG_chm@
DX_FLAG_doc = @DX_FLAG_doc@
DX_FLAG_dot = @DX_FLAG_dot@
DX_FLAG_html = @DX_FLAG_html@
DX_FLAG_man = @DX_FLAG_man@
DX_FLAG_pdf = @DX_FLAG_pdf@
DX_FLAG_ps = @DX_FLAG_ps@
DX_FLAG_rtf = @DX_FLAG_rtf@
DX_FLAG_xml = @DX_FLAG_xml@
DX_HHC = @DX_HHC@
DX_LATEX = @DX_LATEX@
DX_MAKEINDEX = @DX_MAKEINDEX@
DX_PDFLATEX = @DX_PDFLATEX@
DX_PERL = @DX_PERL@
DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FRAMEWORK_IOKIT = @FRAMEWORK_IOKIT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
LIBUSB_LIBS = @LIBUSB_LIBS@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
SDL_CONFIG = @SDL_CONFIG@
SDL_LIBS = @SDL_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
XMKMF = @XMKMF@
XV_CFLAGS = @XV_CFLAGS@
XV_LIBS = @XV_LIBS@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_age = @lt_age@
lt_current = @lt_current@
lt_revision = @lt_revision@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
platform_LDFLAGS = @platform_LDFLAGS@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
pkgmacosxincludedir = $(pkgincludedir)/macosx
@HAVE_MACOSX_TRUE@noinst_LTLIBRARIES = libdc1394-macosx.la
@HAVE_MACOSX_TRUE@pkgmacosxinclude_HEADERS =
AM_CFLAGS = -I..
libdc1394_macosx_la_LDFLAGS = -framework CoreFoundation $(FRAMEWORK_IOKIT)
libdc1394_macosx_la_SOURCES = \
control.c \
capture.c \
macosx.h
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu dc1394/macosx/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu dc1394/macosx/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
libdc1394-macosx.la: $(libdc1394_macosx_la_OBJECTS) $(libdc1394_macosx_la_DEPENDENCIES) $(EXTRA_libdc1394_macosx_la_DEPENDENCIES)
$(AM_V_CCLD)$(libdc1394_macosx_la_LINK) $(am_libdc1394_macosx_la_rpath) $(libdc1394_macosx_la_OBJECTS) $(libdc1394_macosx_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/capture.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/control.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-pkgmacosxincludeHEADERS: $(pkgmacosxinclude_HEADERS)
@$(NORMAL_INSTALL)
@list='$(pkgmacosxinclude_HEADERS)'; test -n "$(pkgmacosxincludedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(pkgmacosxincludedir)'"; \
$(MKDIR_P) "$(DESTDIR)$(pkgmacosxincludedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgmacosxincludedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgmacosxincludedir)" || exit $$?; \
done
uninstall-pkgmacosxincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(pkgmacosxinclude_HEADERS)'; test -n "$(pkgmacosxincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(pkgmacosxincludedir)'; $(am__uninstall_files_from_dir)
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(pkgmacosxincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-pkgmacosxincludeHEADERS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-pkgmacosxincludeHEADERS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-pkgmacosxincludeHEADERS install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
uninstall-pkgmacosxincludeHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

752
dc1394/macosx/capture.c Normal file
View File

@ -0,0 +1,752 @@
/*
* 1394-Based Digital Camera Control Library
*
* Mac OS X Digital Camera Capture Code
*
* Written by David Moore <dcm@acm.org>
*
* 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
*/
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <errno.h>
#include <mach/mach.h>
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/firewire/IOFireWireLib.h>
#include <IOKit/firewire/IOFireWireLibIsoch.h>
#include <CoreServices/CoreServices.h>
#include "config.h"
#include "internal.h"
#include "macosx/macosx.h"
/**********************/
/* Internal functions */
/**********************/
static IOReturn
supported_channels (IOFireWireLibIsochPortRef rem_port, IOFWSpeed * maxSpeed, UInt64 * chanSupported)
{
platform_camera_t * craw = (*rem_port)->GetRefCon (rem_port);
dc1394camera_t * camera = craw->camera;
dc1394capture_t * capture = &(craw->capture);
dc1394speed_t iso_speed;
uint32_t channel;
if (dc1394_video_get_iso_speed (camera, &iso_speed) == DC1394_SUCCESS) {
switch (iso_speed) {
case DC1394_ISO_SPEED_100:
*maxSpeed = kFWSpeed100MBit;
break;
case DC1394_ISO_SPEED_200:
*maxSpeed = kFWSpeed200MBit;
break;
case DC1394_ISO_SPEED_400:
*maxSpeed = kFWSpeed400MBit;
break;
default:
*maxSpeed = kFWSpeed800MBit;
break;
}
}
else {
dc1394_log_warning("could not get ISO speed, using 400 Mb");
*maxSpeed = kFWSpeed400MBit;
}
/* Only the first 16 channels are allowed */
*chanSupported = 0xFFFFULL << 48;
/* If automatic IRM allocation is turned off, we only allow the channel
* that has been already set in the camera. */
if (!capture->do_irm &&
dc1394_video_get_iso_channel (camera, &channel) == DC1394_SUCCESS) {
*chanSupported = 0x1ULL << (63-channel);
}
return kIOReturnSuccess;
}
static IOReturn
allocate_port (IOFireWireLibIsochPortRef rem_port, IOFWSpeed speed, UInt32 chan)
{
platform_camera_t * craw = (*rem_port)->GetRefCon (rem_port);
dc1394camera_t * camera = craw->camera;
craw->iso_channel_is_set = 1;
craw->iso_channel = chan;
dc1394_video_set_iso_channel(camera, craw->iso_channel);
return kIOReturnSuccess;
}
static IOReturn
finalize_callback (dc1394capture_t * capture)
{
CFRunLoopStop (CFRunLoopGetCurrent ());
return kIOReturnSuccess;
}
#ifndef MIN
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif
static void
callback (buffer_info * buffer, NuDCLRef dcl)
{
platform_camera_t * craw;
dc1394capture_t * capture;
UInt32 bus, dma_time, sec, cycle, bus_time;
int usec;
int i;
int corrupt = 0;
if (!buffer) {
dc1394_log_error("callback buffer is null");
return;
}
craw = buffer->craw;
capture = &(craw->capture);
if (buffer->status != BUFFER_EMPTY)
dc1394_log_error("buffer %d should have been empty",buffer->i);
/*
* We do this Notify() here in order to run the "update" step on the
* NuDCL program. This is done instead of AppendDCLUpdateList() because
* that function does not work properly on Mac OS 10.4, as explained
* here:
* http://lists.apple.com/archives/Firewire/2006/Aug/msg00002.html
*
* Also, the Notify() can only handle 30 DCLs at a time.
*/
for (i = 0; i < buffer->num_dcls; i += 30) {
(*capture->loc_port)->Notify (capture->loc_port,
kFWNuDCLUpdateNotification,
(void **) buffer->dcl_list + i,
MIN (buffer->num_dcls - i, 30));
}
for (i = 0; i < buffer->num_dcls; i++) {
int packet_size = capture->frames[buffer->i].packet_size;
if ((buffer->pkts[i].status & 0x1F) != 0x11) {
dc1394_log_warning ("packet %d had error status %x",
i, buffer->pkts[i].status);
corrupt = 1;
}
if ((buffer->pkts[i].header & 0x3) != 0 && i > 0) {
dc1394_log_warning ("packet %d had unexpected sync (%x)",
i, buffer->pkts[i].header);
corrupt = 1;
}
if ((buffer->pkts[i].header >> 16) != packet_size) {
dc1394_log_warning ("packet %d had wrong length (%x)",
i, buffer->pkts[i].header);
corrupt = 1;
}
}
(*craw->iface)->GetBusCycleTime (craw->iface, &bus, &bus_time);
gettimeofday (&buffer->filltime, NULL);
/* Get the bus timestamp of when the packet was received */
dma_time = buffer->pkts[0].timestamp;
sec = (dma_time & 0xe000000) >> 25;
cycle = (dma_time & 0x1fff000) >> 12;
/* convert to microseconds */
dma_time = sec * 1000000 + cycle * 125;
/* Get the bus timestamp right now */
sec = (bus_time & 0xe000000) >> 25;
cycle = (bus_time & 0x1fff000) >> 12;
/* convert to microseconds */
bus_time = sec * 1000000 + cycle * 125 + (bus_time & 0xfff) * 125 / 3072;
/* Compute how many usec ago the packet was received by comparing
* the current bus time to the timestamp of the first ISO packet */
usec = (bus_time + 8000000 - dma_time) % 8000000;
/* Subtract usec from the current clock time */
usec = buffer->filltime.tv_usec - usec;
while (usec < 0) {
buffer->filltime.tv_sec--;
usec += 1000000;
}
buffer->filltime.tv_usec = usec;
MPEnterCriticalRegion (capture->mutex, kDurationForever);
buffer->status = corrupt ? BUFFER_CORRUPT : BUFFER_FILLED;
capture->frames_ready++;
MPExitCriticalRegion (capture->mutex);
write (capture->notify_pipe[1], "+", 1);
}
static void
socket_callback_firewire (CFSocketRef s, CFSocketCallBackType type,
CFDataRef address, const void * data, void * info)
{
platform_camera_t * craw = info;
dc1394capture_t * capture = &(craw->capture);
if (capture->callback) {
capture->callback (craw->camera, capture->callback_user_data);
}
}
DCLCommand *
CreateDCLProgram (platform_camera_t * craw)
{
dc1394capture_t * capture = &(craw->capture);
IOVirtualRange * databuf = &(capture->databuf);
NuDCLRef dcl = NULL;
IOFireWireLibNuDCLPoolRef dcl_pool = capture->dcl_pool;
int packet_size = capture->frames[0].packet_size;
int ppf = capture->frames[0].packets_per_frame;
//int bytesperframe = capture->frames[0].total_bytes;
int i;
databuf->length = (capture->num_frames + 1) * packet_size * ppf +
capture->num_frames * ppf * sizeof (packet_info);
databuf->address = (IOVirtualAddress) mmap (NULL, databuf->length,
PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
if (!databuf->address || databuf->address == (IOVirtualAddress)-1) {
dc1394_log_error("mmap failed");
return NULL;
}
for (i = 0; i < capture->num_frames; i++) {
IOVirtualAddress frame_address = databuf->address +
i * packet_size * ppf;
IOVirtualAddress data_address = databuf->address +
(capture->num_frames + 1) * packet_size * ppf +
i * ppf * sizeof (packet_info);
buffer_info * buffer = capture->buffers + i;
dc1394video_frame_t * frame = capture->frames + i;
int j;
IOVirtualRange ranges[2] = {
{data_address, 4},
{frame_address, packet_size},
};
if (i > 0)
memcpy (frame, capture->frames, sizeof (dc1394video_frame_t));
frame->image = (unsigned char *) frame_address;
frame->id = i;
buffer->craw = craw;
buffer->i = i;
buffer->status = BUFFER_EMPTY;
buffer->num_dcls = ppf;
buffer->dcl_list = malloc (ppf * sizeof (NuDCLRef));
buffer->pkts = (packet_info *) data_address;
dcl = (*dcl_pool)->AllocateReceivePacket (dcl_pool, NULL,
4, 2, ranges);
(*dcl_pool)->SetDCLWaitControl (dcl, true);
(*dcl_pool)->SetDCLFlags (dcl, kNuDCLDynamic);
(*dcl_pool)->SetDCLStatusPtr (dcl, &buffer->pkts[0].status);
(*dcl_pool)->SetDCLTimeStampPtr (dcl, &buffer->pkts[0].timestamp);
buffer->dcl_list[0] = dcl;
for (j = 1; j < ppf; j++) {
ranges[0].address = (IOVirtualAddress) &buffer->pkts[j].header;
ranges[1].address += packet_size;
dcl = (*dcl_pool)->AllocateReceivePacket (dcl_pool, NULL,
4, 2, ranges);
(*dcl_pool)->SetDCLFlags (dcl, kNuDCLDynamic);
(*dcl_pool)->SetDCLStatusPtr (dcl, &buffer->pkts[j].status);
(*dcl_pool)->SetDCLTimeStampPtr (dcl, &buffer->pkts[j].timestamp);
buffer->dcl_list[j] = dcl;
}
#if 0
for (j = 0; j < ppf; j++)
(*dcl_pool)->AppendDCLUpdateList (dcl, buffer->dcl_list[j]);
#endif
(*dcl_pool)->SetDCLRefcon (dcl, capture->buffers + i);
(*dcl_pool)->SetDCLCallback (dcl, (NuDCLCallback) callback);
}
(*dcl_pool)->SetDCLBranch (dcl, capture->buffers[0].dcl_list[0]);
dcl = capture->buffers[capture->num_frames-1].dcl_list[0];
(*dcl_pool)->SetDCLBranch (dcl, dcl);
//(*dcl_pool)->PrintProgram (dcl_pool);
return (*dcl_pool)->GetProgram (dcl_pool);
}
OSStatus
servicing_thread (void * cam_ptr)
{
platform_camera_t * craw = cam_ptr;
IOFireWireLibDeviceRef d = craw->iface;
(*d)->AddCallbackDispatcherToRunLoopForMode (d, CFRunLoopGetCurrent (),
kCFRunLoopCommonModes);
(*d)->AddIsochCallbackDispatcherToRunLoopForMode (d, CFRunLoopGetCurrent (),
kCFRunLoopCommonModes);
MPSignalSemaphore(craw->capture.thread_init_semaphore);
CFRunLoopRun ();
return 0;
}
/*************************************************************
CAPTURE SETUP
**************************************************************/
dc1394error_t
dc1394_macosx_capture_setup(platform_camera_t *craw, uint32_t num_dma_buffers,
uint32_t flags)
{
dc1394capture_t * capture = &(craw->capture);
dc1394camera_t * camera = craw->camera;
dc1394error_t err;
IOReturn ret;
IOFireWireLibDeviceRef d = craw->iface;
IOFWSpeed speed;
IOFireWireLibIsochChannelRef chan;
IOFireWireLibRemoteIsochPortRef rem_port;
IOFireWireLibLocalIsochPortRef loc_port;
IOFireWireLibNuDCLPoolRef dcl_pool;
DCLCommand * dcl_program;
int frame_size;
int numdcls;
CFSocketContext socket_context = { 0, craw, NULL, NULL, NULL };
// if capture is already set, abort
if (craw->capture_is_set>0)
return DC1394_CAPTURE_IS_RUNNING;
craw->capture.flags=flags;
if (((flags & DC1394_CAPTURE_FLAGS_CHANNEL_ALLOC) &&
(flags & DC1394_CAPTURE_FLAGS_BANDWIDTH_ALLOC)) ||
(flags & DC1394_CAPTURE_FLAGS_DEFAULT))
craw->capture.do_irm = true;
else if (!(flags & DC1394_CAPTURE_FLAGS_CHANNEL_ALLOC) &&
!(flags & DC1394_CAPTURE_FLAGS_BANDWIDTH_ALLOC))
craw->capture.do_irm = false;
else {
err = DC1394_FAILURE;
DC1394_ERR_RTN (err, "Bandwidth and channel allocation must be enabled/disabled together in MacOSX");
}
// if auto iso is requested, stop ISO (if necessary)
if (flags & DC1394_CAPTURE_FLAGS_AUTO_ISO) {
dc1394switch_t is_iso_on;
dc1394_video_get_transmission(camera, &is_iso_on);
if (is_iso_on == DC1394_ON) {
err=dc1394_video_set_transmission(camera, DC1394_OFF);
DC1394_ERR_RTN(err,"Could not stop ISO!");
}
}
capture->frames = malloc (num_dma_buffers * sizeof (dc1394video_frame_t));
err = capture_basic_setup(camera, capture->frames);
if (err != DC1394_SUCCESS)
dc1394_capture_stop (camera);
DC1394_ERR_RTN (err,"Could not setup capture");
capture->num_frames = num_dma_buffers;
pipe (capture->notify_pipe);
capture->socket = CFSocketCreateWithNative (NULL, capture->notify_pipe[0],
kCFSocketReadCallBack, socket_callback_firewire, &socket_context);
/* Set flags so that the underlying fd is not closed with the socket */
CFSocketSetSocketFlags (capture->socket,
CFSocketGetSocketFlags (capture->socket) & ~kCFSocketCloseOnInvalidate);
capture->socket_source = CFSocketCreateRunLoopSource (NULL,
capture->socket, 0);
if (!capture->run_loop)
dc1394_macosx_capture_schedule_with_runloop (craw,
CFRunLoopGetCurrent (), kCFRunLoopCommonModes);
CFRunLoopAddSource (capture->run_loop, capture->socket_source,
capture->run_loop_mode);
MPCreateCriticalRegion (&capture->mutex);
MPCreateQueue (&capture->termination_queue);
MPCreateSemaphore (1, 0, &capture->thread_init_semaphore);
MPCreateTask (&servicing_thread, craw, 0, capture->termination_queue,
NULL, NULL, 0, &capture->task);
/* wait for thread to start */
MPWaitOnSemaphore (capture->thread_init_semaphore, kDurationForever);
MPDeleteSemaphore (capture->thread_init_semaphore);
capture->thread_init_semaphore = NULL;
(*d)->TurnOnNotification (d);
(*d)->GetSpeedToNode (d, craw->generation, &speed);
chan = (*d)->CreateIsochChannel (d, craw->capture.do_irm,
capture->frames[0].packet_size, speed,
CFUUIDGetUUIDBytes (kIOFireWireIsochChannelInterfaceID));
if (!chan) {
dc1394_macosx_capture_stop (craw);
dc1394_log_error("Could not create IsochChannelInterface");
return DC1394_FAILURE;
}
capture->chan = chan;
rem_port = (*d)->CreateRemoteIsochPort (d, true,
CFUUIDGetUUIDBytes (kIOFireWireRemoteIsochPortInterfaceID));
if (!rem_port) {
dc1394_macosx_capture_stop (craw);
dc1394_log_error("Could not create RemoteIsochPortInterface");
return DC1394_FAILURE;
}
capture->rem_port = rem_port;
(*rem_port)->SetAllocatePortHandler (rem_port, &allocate_port);
(*rem_port)->SetGetSupportedHandler (rem_port, &supported_channels);
(*rem_port)->SetRefCon ((IOFireWireLibIsochPortRef)rem_port, craw);
capture->buffers = malloc (capture->num_frames * sizeof (buffer_info));
capture->last_dequeued = capture->num_frames - 1;
capture->last_enqueued = capture->num_frames - 1;
frame_size = capture->frames[0].total_bytes;
//capture->frame_pages = ((frame_size - 1) / getpagesize()) + 1;
numdcls = capture->frames[0].packets_per_frame * capture->num_frames;
dcl_pool = (*d)->CreateNuDCLPool (d, numdcls,
CFUUIDGetUUIDBytes (kIOFireWireNuDCLPoolInterfaceID));
if (!dcl_pool) {
dc1394_macosx_capture_stop (craw);
dc1394_log_error("Could not create NuDCLPoolInterface");
return DC1394_FAILURE;
}
capture->dcl_pool = dcl_pool;
dcl_program = CreateDCLProgram (craw);
if (!dcl_program) {
dc1394_macosx_capture_stop (craw);
dc1394_log_error("Could not create DCL Program");
return DC1394_FAILURE;
}
loc_port = (*d)->CreateLocalIsochPort (d, false, dcl_program,
kFWDCLSyBitsEvent, 1, 1, nil, 0, &(capture->databuf), 1,
CFUUIDGetUUIDBytes (kIOFireWireLocalIsochPortInterfaceID));
if (!loc_port) {
dc1394_macosx_capture_stop (craw);
dc1394_log_error("Could not create LocalIsochPortInterface");
return DC1394_FAILURE;
}
capture->loc_port = loc_port;
(*loc_port)->SetRefCon ((IOFireWireLibIsochPortRef) loc_port, capture);
(*loc_port)->SetFinalizeCallback (loc_port,
(IOFireWireLibIsochPortFinalizeCallback) finalize_callback);
(*chan)->AddListener (chan, (IOFireWireLibIsochPortRef) loc_port);
(*chan)->SetTalker (chan, (IOFireWireLibIsochPortRef) rem_port);
if ((ret = (*chan)->AllocateChannel (chan)) != kIOReturnSuccess) {
dc1394_macosx_capture_stop (craw);
if (ret == kIOReturnNoSpace)
dc1394_log_error("Not enough iso bandwidth or channels are "
"available to begin capture");
else
dc1394_log_error("Could not allocate channel");
return DC1394_FAILURE;
}
capture->iso_is_allocated = 1;
if ((*chan)->Start (chan) != kIOReturnSuccess) {
dc1394_macosx_capture_stop (craw);
dc1394_log_error("Could not start channel");
return DC1394_FAILURE;
}
capture->iso_is_started = 1;
craw->capture_is_set=1;
// if auto iso is requested, start ISO
if (flags & DC1394_CAPTURE_FLAGS_AUTO_ISO) {
err=dc1394_video_set_transmission(camera, DC1394_ON);
DC1394_ERR_RTN(err,"Could not start ISO!");
craw->iso_auto_started=1;
}
return DC1394_SUCCESS;
}
/*****************************************************
CAPTURE_STOP
*****************************************************/
dc1394error_t
dc1394_macosx_capture_stop(platform_camera_t *craw)
{
dc1394camera_t * camera = craw->camera;
dc1394capture_t * capture = &(craw->capture);
IOVirtualRange * databuf = &(capture->databuf);
if (capture->iso_is_started) {
IOReturn res;
res = (*capture->chan)->Stop (capture->chan);
/* Wait for thread termination */
MPWaitOnQueue (capture->termination_queue, NULL, NULL, NULL,
kDurationForever);
}
else if (capture->task) {
dc1394_log_warning("Forcefully killing servicing task...");
MPTerminateTask (capture->task, 0);
MPWaitOnQueue (capture->termination_queue, NULL, NULL, NULL,
kDurationForever);
}
capture->task = NULL;
capture->iso_is_started = 0;
if (capture->iso_is_allocated)
(*capture->chan)->ReleaseChannel (capture->chan);
capture->iso_is_allocated = 0;
if (capture->chan)
(*capture->chan)->Release (capture->chan);
if (capture->loc_port)
(*capture->loc_port)->Release (capture->loc_port);
if (capture->rem_port)
(*capture->rem_port)->Release (capture->rem_port);
if (capture->dcl_pool)
(*capture->dcl_pool)->Release (capture->dcl_pool);
capture->chan = NULL;
capture->loc_port = NULL;
capture->rem_port = NULL;
capture->dcl_pool = NULL;
if (databuf->address)
munmap ((void *) databuf->address, databuf->length);
databuf->address = 0;
if (capture->buffers) {
int i;
for (i = 0; i < capture->num_frames; i++)
free (capture->buffers[i].dcl_list);
free (capture->buffers);
}
capture->buffers = NULL;
if (capture->termination_queue)
MPDeleteQueue (capture->termination_queue);
capture->termination_queue = NULL;
if (capture->socket_source) {
CFRunLoopRemoveSource (capture->run_loop, capture->socket_source,
capture->run_loop_mode);
CFRelease (capture->socket_source);
}
capture->socket_source = NULL;
if (capture->socket) {
CFSocketInvalidate (capture->socket);
CFRelease (capture->socket);
}
capture->socket = NULL;
if (capture->mutex)
MPDeleteCriticalRegion (capture->mutex);
capture->mutex = NULL;
if (capture->notify_pipe[0] != 0 || capture->notify_pipe[1] != 0) {
close (capture->notify_pipe[0]);
close (capture->notify_pipe[1]);
}
capture->notify_pipe[0] = capture->notify_pipe[1] = 0;
if (capture->frames)
free (capture->frames);
capture->frames = NULL;
craw->capture_is_set=0;
// stop ISO if it was started automatically
if (craw->iso_auto_started>0) {
dc1394error_t err=dc1394_video_set_transmission(camera, DC1394_OFF);
DC1394_ERR_RTN(err,"Could not stop ISO!");
craw->iso_auto_started=0;
}
return DC1394_SUCCESS;
}
/****************************************************
CAPTURE
*****************************************************/
#define NEXT_BUFFER(c,i) (((i) == -1) ? 0 : ((i)+1)%(c)->num_frames)
//#define PREV_BUFFER(c,i) (((i) == 0) ? (c)->num_frames-1 : ((i)-1))
dc1394error_t
dc1394_macosx_capture_dequeue (platform_camera_t * craw,
dc1394capture_policy_t policy,
dc1394video_frame_t **frame)
{
dc1394capture_t * capture = &(craw->capture);
int next = NEXT_BUFFER (capture, capture->last_dequeued);
buffer_info * buffer = capture->buffers + next;
dc1394video_frame_t * frame_tmp = capture->frames + next;
char ch;
if(craw->frames==NULL || craw->capture_is_set==0) {
*frame=NULL;
return DC1394_CAPTURE_IS_NOT_SET;
}
if ( (policy<DC1394_CAPTURE_POLICY_MIN) || (policy>DC1394_CAPTURE_POLICY_MAX) )
return DC1394_INVALID_CAPTURE_POLICY;
// default: return NULL in case of failures or lack of frames
*frame=NULL;
if (policy == DC1394_CAPTURE_POLICY_POLL) {
int status;
MPEnterCriticalRegion (capture->mutex, kDurationForever);
status = buffer->status;
MPExitCriticalRegion (capture->mutex);
if (status != BUFFER_FILLED && status != BUFFER_CORRUPT)
return DC1394_SUCCESS;
}
read (capture->notify_pipe[0], &ch, 1);
MPEnterCriticalRegion (capture->mutex, kDurationForever);
if (buffer->status != BUFFER_FILLED && buffer->status != BUFFER_CORRUPT) {
dc1394_log_error("expected filled buffer");
MPExitCriticalRegion (capture->mutex);
return DC1394_FAILURE;
}
capture->frames_ready--;
frame_tmp->frames_behind = capture->frames_ready;
MPExitCriticalRegion (capture->mutex);
capture->last_dequeued = next;
frame_tmp->timestamp = (uint64_t) buffer->filltime.tv_sec * 1000000 +
buffer->filltime.tv_usec;
*frame=frame_tmp;
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_macosx_capture_enqueue (platform_camera_t * craw,
dc1394video_frame_t * frame)
{
dc1394capture_t * capture = &(craw->capture);
dc1394camera_t * camera = craw->camera;
int last = capture->last_enqueued;
buffer_info * prev_buffer = capture->buffers + last;
buffer_info * buffer = capture->buffers + frame->id;
IOFireWireLibNuDCLPoolRef dcl_pool = capture->dcl_pool;
IOFireWireLibLocalIsochPortRef loc_port = capture->loc_port;
void * dcl_list[2];
if (frame->camera != camera) {
dc1394_log_error("camera does not match frame's camera");
return DC1394_INVALID_ARGUMENT_VALUE;
}
if (buffer->status != BUFFER_FILLED && buffer->status != BUFFER_CORRUPT)
return DC1394_FAILURE;
buffer->status = BUFFER_ENQUEUED;
buffer = NULL;
while (1) {
last = NEXT_BUFFER (capture, last);
if (capture->buffers[last].status != BUFFER_ENQUEUED)
break;
capture->last_enqueued = last;
buffer = capture->buffers + last;
buffer->status = BUFFER_EMPTY;
}
if (buffer) {
(*dcl_pool)->SetDCLBranch (buffer->dcl_list[0], buffer->dcl_list[0]);
(*dcl_pool)->SetDCLBranch (prev_buffer->dcl_list[0], prev_buffer->dcl_list[1]);
dcl_list[0] = prev_buffer->dcl_list[0];
dcl_list[1] = buffer->dcl_list[0];
(*loc_port)->Notify (loc_port, kFWNuDCLModifyJumpNotification, dcl_list+1, 1);
(*loc_port)->Notify (loc_port, kFWNuDCLModifyJumpNotification, dcl_list, 1);
}
return DC1394_SUCCESS;
}
dc1394bool_t
dc1394_macosx_capture_is_frame_corrupt (platform_camera_t * craw,
dc1394video_frame_t * frame)
{
dc1394capture_t * capture = &(craw->capture);
buffer_info * buffer = capture->buffers + frame->id;
if (buffer->status == BUFFER_CORRUPT)
return DC1394_TRUE;
return DC1394_FALSE;
}
int
dc1394_macosx_capture_get_fileno (platform_camera_t * craw)
{
dc1394capture_t * capture = &(craw->capture);
if (capture->notify_pipe[0] == 0 && capture->notify_pipe[1] == 0)
return -1;
return capture->notify_pipe[0];
}
dc1394error_t
dc1394_macosx_capture_schedule_with_runloop (platform_camera_t * craw,
CFRunLoopRef run_loop, CFStringRef run_loop_mode)
{
dc1394capture_t * capture = &(craw->capture);
if (craw->capture_is_set) {
dc1394_log_warning("schedule_with_runloop must be called before capture_setup");
return DC1394_FAILURE;
}
capture->run_loop = run_loop;
capture->run_loop_mode = run_loop_mode;
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_macosx_capture_set_callback (platform_camera_t * craw,
dc1394capture_callback_t callback, void * user_data)
{
dc1394capture_t * capture = &(craw->capture);
capture->callback = callback;
capture->callback_user_data = user_data;
return DC1394_SUCCESS;
}

405
dc1394/macosx/control.c Normal file
View File

@ -0,0 +1,405 @@
/*
* 1394-Based Digital Camera Control Library
*
* Mac OS X Digital Camera Control Code
*
* Written by David Moore <dcm@acm.org>
*
* 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
*/
#include <stdio.h>
#include <sys/time.h>
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/IOCFPlugIn.h>
#include <IOKit/IOKitLib.h>
#include <IOKit/firewire/IOFireWireLib.h>
#include "config.h"
#include "platform.h"
#include "internal.h"
#include "macosx.h"
static platform_t *
dc1394_macosx_new (void)
{
platform_t * p = calloc (1, sizeof (platform_t));
return p;
}
static void
dc1394_macosx_free (platform_t * p)
{
free (p);
}
struct _platform_device_t {
io_object_t node;
};
static platform_device_list_t *
dc1394_macosx_get_device_list (platform_t * p)
{
platform_device_list_t * list;
uint32_t allocated_size = 64;
kern_return_t res;
mach_port_t master_port;
io_iterator_t iterator;
io_object_t node;
CFMutableDictionaryRef dict;
list = calloc (1, sizeof (platform_device_list_t));
if (!list)
return NULL;
list->devices = malloc(allocated_size * sizeof(platform_device_t *));
if (!list->devices) {
free (list);
return NULL;
}
res = IOMasterPort (MACH_PORT_NULL, &master_port);
if (res != KERN_SUCCESS)
return NULL;
dict = IOServiceMatching ("IOFireWireDevice");
if (!dict)
return NULL;
res = IOServiceGetMatchingServices (master_port, dict, &iterator);
while ((node = IOIteratorNext (iterator))) {
platform_device_t * device = malloc (sizeof (platform_device_t));
if (!device) {
IOObjectRelease (node);
continue;
}
device->node = node;
list->devices[list->num_devices] = device;
list->num_devices++;
if (list->num_devices >= allocated_size) {
allocated_size += 64;
list->devices = realloc (list->devices,
allocated_size * sizeof (platform_device_t *));
if (!list->devices)
return NULL;
}
}
IOObjectRelease (iterator);
return list;
}
static void
dc1394_macosx_free_device_list (platform_device_list_t * d)
{
int i;
for (i = 0; i < d->num_devices; i++) {
IOObjectRelease (d->devices[i]->node);
free (d->devices[i]);
}
free (d->devices);
free (d);
}
static int
dc1394_macosx_device_get_config_rom (platform_device_t * device,
uint32_t * quads, int * num_quads)
{
CFTypeRef prop;
prop = IORegistryEntryCreateCFProperty (device->node,
CFSTR ("FireWire Device ROM"), kCFAllocatorDefault, 0);
if (!prop)
return -1;
CFDataRef data = CFDictionaryGetValue (prop, CFSTR ("Offset 0"));
if (!data) {
CFRelease (prop);
return -1;
}
int nquads = CFDataGetLength (data) / 4;
if (*num_quads > nquads)
*num_quads = nquads;
const uint8_t * d = CFDataGetBytePtr (data);
int i;
for (i = 0; i < *num_quads; i++)
quads[i] = (d[4*i] << 24) | (d[4*i+1] << 16) | (d[4*i+2] << 8) | d[4*i+3];
CFRelease (prop);
return 0;
}
static platform_camera_t *
dc1394_macosx_camera_new (platform_t * p, platform_device_t * device,
uint32_t unit_directory_offset)
{
kern_return_t res;
platform_camera_t * camera;
IOFireWireLibDeviceRef iface = NULL;
io_iterator_t iterator;
io_object_t node;
res = IORegistryEntryGetChildIterator (device->node, kIOServicePlane,
&iterator);
if (res != KERN_SUCCESS) {
dc1394_log_error ("Failed to iterate device's children\n");
return NULL;
}
while ((node = IOIteratorNext (iterator))) {
io_name_t name;
IOFireWireLibConfigDirectoryRef dir;
int entries;
int i;
UInt32 val;
IOCFPlugInInterface ** plugin_interface = NULL;
SInt32 score;
IORegistryEntryGetName (node, name);
if (strcmp (name, "IOFireWireUnit")) {
IOObjectRelease (node);
continue;
}
res = IOCreatePlugInInterfaceForService (node, kIOFireWireLibTypeID,
kIOCFPlugInInterfaceID, &plugin_interface, &score);
IOObjectRelease (node);
if (res != KERN_SUCCESS)
continue;
iface = NULL;
(*plugin_interface)->QueryInterface (plugin_interface,
CFUUIDGetUUIDBytes (kIOFireWireDeviceInterfaceID),
(void**) &iface);
IODestroyPlugInInterface (plugin_interface);
if (!iface)
continue;
dir = (*iface)->GetConfigDirectory (iface,
CFUUIDGetUUIDBytes (kIOFireWireConfigDirectoryInterfaceID));
if (!dir) {
(*iface)->Release (iface);
continue;
}
(*dir)->GetNumEntries (dir, &entries);
val = 0;
for (i = 0; i < entries; i++) {
int key;
(*dir)->GetIndexKey (dir, i, &key);
if (key == kConfigUnitDependentInfoKey) {
(*dir)->GetIndexOffset_UInt32 (dir, i, &val);
break;
}
}
(*dir)->Release (dir);
if (val && val == (unit_directory_offset - 0x400) / 4)
break;
(*iface)->Release (iface);
}
IOObjectRelease (iterator);
if (!node) {
dc1394_log_error ("Matching unit not found\n");
return NULL;
}
res = (*iface)->Open (iface);
if (res != kIOReturnSuccess) {
dc1394_log_error ("Failed to gain exclusive access on unit (err %d)\n",
res);
(*iface)->Release (iface);
return NULL;
}
camera = calloc (1, sizeof (platform_camera_t));
camera->iface = iface;
(*camera->iface)->GetBusGeneration (camera->iface,
&(camera->generation));
return camera;
}
static void dc1394_macosx_camera_free (platform_camera_t * cam)
{
(*cam->iface)->Close (cam->iface);
(*cam->iface)->Release (cam->iface);
free (cam);
}
static void
dc1394_macosx_camera_set_parent (platform_camera_t * cam,
dc1394camera_t * parent)
{
cam->camera = parent;
}
static dc1394error_t
dc1394_macosx_camera_print_info (platform_camera_t * camera, FILE *fd)
{
fprintf(fd,"------ Camera platform-specific information ------\n");
fprintf(fd,"Interface : %p\n", camera->iface);
fprintf(fd,"Generation : %lu\n", camera->generation);
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_macosx_camera_read (platform_camera_t * cam, uint64_t offset,
uint32_t * quads, int num_quads)
{
IOFireWireLibDeviceRef d = cam->iface;
FWAddress full_addr;
int i, retval;
UInt32 length;
UInt64 addr = CONFIG_ROM_BASE + offset;
full_addr.addressHi = addr >> 32;
full_addr.addressLo = addr & 0xffffffff;
length = 4 * num_quads;
if (num_quads > 1)
retval = (*d)->Read (d, (*d)->GetDevice (d), &full_addr, quads, &length,
false, cam->generation);
else
retval = (*d)->ReadQuadlet (d, (*d)->GetDevice (d), &full_addr,
(UInt32 *) quads, false, cam->generation);
if (retval != 0) {
dc1394_log_error("Error reading (%x)...",retval);
return DC1394_FAILURE;
}
for (i = 0; i < num_quads; i++)
quads[i] = ntohl (quads[i]);
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_macosx_camera_write (platform_camera_t * cam, uint64_t offset,
const uint32_t * quads, int num_quads)
{
IOFireWireLibDeviceRef d = cam->iface;
FWAddress full_addr;
int i, retval;
UInt32 length;
UInt64 addr = CONFIG_ROM_BASE + offset;
uint32_t values[num_quads];
full_addr.addressHi = addr >> 32;
full_addr.addressLo = addr & 0xffffffff;
for (i = 0; i < num_quads; i++)
values[i] = htonl (quads[i]);
length = 4 * num_quads;
if (num_quads > 1)
retval = (*d)->Write (d, (*d)->GetDevice (d), &full_addr, values, &length,
false, cam->generation);
else
retval = (*d)->WriteQuadlet (d, (*d)->GetDevice (d), &full_addr, values[0],
false, cam->generation);
if (retval != 0) {
dc1394_log_error("Error writing (%x)...",retval);
return DC1394_FAILURE;
}
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_macosx_reset_bus (platform_camera_t * cam)
{
IOFireWireLibDeviceRef d = cam->iface;
if ((*d)->BusReset (d) == 0)
return DC1394_SUCCESS;
else
return DC1394_FAILURE;
}
static dc1394error_t
dc1394_macosx_read_cycle_timer (platform_camera_t * cam,
uint32_t * cycle_timer, uint64_t * local_time)
{
IOFireWireLibDeviceRef d = cam->iface;
struct timeval tv;
if ((*d)->GetCycleTime (d, (UInt32 *) cycle_timer) != 0)
return DC1394_FAILURE;
gettimeofday (&tv, NULL);
*local_time = (uint64_t)tv.tv_sec * 1000000ULL + tv.tv_usec;
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_macosx_camera_get_node(platform_camera_t *cam, uint32_t *node,
uint32_t * generation)
{
IOFireWireLibDeviceRef d = cam->iface;
UInt32 gen;
UInt16 nodeid;
while (1) {
IOReturn ret;
if ((*d)->GetBusGeneration (d, &gen) != 0)
return DC1394_FAILURE;
ret = (*d)->GetRemoteNodeID (d, gen, &nodeid);
if (ret == kIOFireWireBusReset)
continue;
else if (ret == kIOReturnSuccess)
break;
else
return DC1394_FAILURE;
}
if (node)
*node = nodeid & 0x3f;
if (generation)
*generation = gen;
return DC1394_SUCCESS;
}
static platform_dispatch_t
macosx_dispatch = {
.platform_new = dc1394_macosx_new,
.platform_free = dc1394_macosx_free,
.get_device_list = dc1394_macosx_get_device_list,
.free_device_list = dc1394_macosx_free_device_list,
.device_get_config_rom = dc1394_macosx_device_get_config_rom,
.camera_new = dc1394_macosx_camera_new,
.camera_free = dc1394_macosx_camera_free,
.camera_set_parent = dc1394_macosx_camera_set_parent,
.camera_read = dc1394_macosx_camera_read,
.camera_write = dc1394_macosx_camera_write,
.reset_bus = dc1394_macosx_reset_bus,
.camera_print_info = dc1394_macosx_camera_print_info,
.camera_get_node = dc1394_macosx_camera_get_node,
.read_cycle_timer = dc1394_macosx_read_cycle_timer,
.capture_setup = dc1394_macosx_capture_setup,
.capture_stop = dc1394_macosx_capture_stop,
.capture_dequeue = dc1394_macosx_capture_dequeue,
.capture_enqueue = dc1394_macosx_capture_enqueue,
.capture_get_fileno = dc1394_macosx_capture_get_fileno,
.capture_is_frame_corrupt = dc1394_macosx_capture_is_frame_corrupt,
.capture_set_callback = dc1394_macosx_capture_set_callback,
.capture_schedule_with_runloop = dc1394_macosx_capture_schedule_with_runloop,
};
void
macosx_init(dc1394_t * d)
{
register_platform (d, &macosx_dispatch, "macosx");
}

133
dc1394/macosx/macosx.h Normal file
View File

@ -0,0 +1,133 @@
/*
* 1394-Based Digital Camera Control Library
*
* Mac OS X specific headers
*
* Written by David Moore <dcm@acm.org>
*
* 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
*/
#ifndef __DC1394_MACOSX_MACOSX_H__
#define __DC1394_MACOSX_MACOSX_H__
#include <dc1394/dc1394.h>
#include <IOKit/firewire/IOFireWireLib.h>
#include <CoreServices/CoreServices.h>
#include "platform.h"
typedef enum {
BUFFER_EMPTY = 0,
BUFFER_FILLED = 1,
BUFFER_CORRUPT = 2,
BUFFER_ENQUEUED = 3,
} buffer_status;
typedef struct _packet_info {
UInt32 header;
UInt32 status;
UInt32 timestamp;
} packet_info;
typedef struct _buffer_info {
platform_camera_t * craw;
int i;
buffer_status status;
struct timeval filltime;
int num_dcls;
NuDCLRef * dcl_list;
packet_info * pkts;
} buffer_info;
struct _platform_t {
int dummy;
};
typedef struct __dc1394_capture
{
unsigned int num_frames;
//int frame_pages;
int last_dequeued;
int last_enqueued;
/* components needed for the DMA based video capture */
IOFireWireLibIsochChannelRef chan;
IOFireWireLibRemoteIsochPortRef rem_port;
IOFireWireLibLocalIsochPortRef loc_port;
IOFireWireLibNuDCLPoolRef dcl_pool;
IOVirtualRange databuf;
buffer_info * buffers;
CFRunLoopRef run_loop;
CFStringRef run_loop_mode;
dc1394capture_callback_t callback;
void * callback_user_data;
int notify_pipe[2];
uint8_t frames_ready;
MPCriticalRegionID mutex;
MPQueueID termination_queue;
MPSemaphoreID thread_init_semaphore;
MPTaskID task;
CFSocketRef socket;
CFRunLoopSourceRef socket_source;
uint8_t iso_is_allocated;
uint8_t iso_is_started;
uint32_t flags;
Boolean do_irm;
dc1394video_frame_t *frames;
} dc1394capture_t;
struct _platform_camera_t {
IOFireWireLibDeviceRef iface;
UInt32 generation;
dc1394camera_t * camera;
dc1394capture_t capture;
int capture_is_set;
int iso_channel_is_set;
int iso_channel;
int iso_auto_started;
};
dc1394error_t
dc1394_macosx_capture_setup(platform_camera_t *craw, uint32_t num_dma_buffers,
uint32_t flags);
dc1394error_t
dc1394_macosx_capture_stop(platform_camera_t *craw);
dc1394error_t
dc1394_macosx_capture_dequeue (platform_camera_t * craw,
dc1394capture_policy_t policy,
dc1394video_frame_t **frame);
dc1394error_t
dc1394_macosx_capture_enqueue (platform_camera_t * craw,
dc1394video_frame_t * frame);
dc1394bool_t
dc1394_macosx_capture_is_frame_corrupt (platform_camera_t * craw,
dc1394video_frame_t * frame);
int
dc1394_macosx_capture_get_fileno (platform_camera_t * craw);
dc1394error_t
dc1394_macosx_capture_set_callback (platform_camera_t * camera,
dc1394capture_callback_t callback, void * user_data);
dc1394error_t
dc1394_macosx_capture_schedule_with_runloop (platform_camera_t * camera,
CFRunLoopRef run_loop, CFStringRef run_loop_mode);
#endif

130
dc1394/offsets.h Normal file
View File

@ -0,0 +1,130 @@
/*
* 1394-Based Digital Camera Control Library
*
* Camera standard offsets
*
* Written by Damien Douxchamps <ddouxchamps@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.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
*/
#ifndef __DC1394_OFFSETS_H_
#define __DC1394_OFFSETS_H_
/* See the 1394-Based Digital Camera Spec. for definitions of these */
/* Base ROM offsets */
#define ROM_BUS_INFO_BLOCK 0x400U
#define ROM_ROOT_DIRECTORY 0x414U
#ifndef CSR_CONFIG_ROM_END
#define CSR_CONFIG_ROM_END 0x800U
#endif
/* Absolute feature */
#define REG_CAMERA_FEATURE_ABS_HI_BASE 0x700U
#define REG_CAMERA_FEATURE_ABS_LO_BASE 0x780U
#define REG_CAMERA_ABS_MIN 0x000U
#define REG_CAMERA_ABS_MAX 0x004U
#define REG_CAMERA_ABS_VALUE 0x008U
/* Command registers offsets */
#define REG_CAMERA_INITIALIZE 0x000U
#define REG_CAMERA_V_FORMAT_INQ 0x100U
#define REG_CAMERA_V_MODE_INQ_BASE 0x180U
#define REG_CAMERA_V_RATE_INQ_BASE 0x200U
#define REG_CAMERA_V_REV_INQ_BASE 0x2C0U
#define REG_CAMERA_V_CSR_INQ_BASE 0x2E0U
#define REG_CAMERA_BASIC_FUNC_INQ 0x400U
#define REG_CAMERA_FEATURE_HI_INQ 0x404U
#define REG_CAMERA_FEATURE_LO_INQ 0x408U
#define REG_CAMERA_OPT_FUNC_INQ 0x40CU
#define REG_CAMERA_ADV_FEATURE_INQ 0x480U
#define REG_CAMERA_PIO_CONTROL_CSR_INQ 0x484U
#define REG_CAMERA_SIO_CONTROL_CSR_INQ 0x488U
#define REG_CAMERA_STROBE_CONTROL_CSR_INQ 0x48CU
#define REG_CAMERA_FEATURE_HI_BASE_INQ 0x500U
#define REG_CAMERA_FEATURE_LO_BASE_INQ 0x580U
#define REG_CAMERA_FRAME_RATE 0x600U
#define REG_CAMERA_VIDEO_MODE 0x604U
#define REG_CAMERA_VIDEO_FORMAT 0x608U
#define REG_CAMERA_ISO_DATA 0x60CU
#define REG_CAMERA_POWER 0x610U
#define REG_CAMERA_ISO_EN 0x614U
#define REG_CAMERA_MEMORY_SAVE 0x618U
#define REG_CAMERA_ONE_SHOT 0x61CU
#define REG_CAMERA_MEM_SAVE_CH 0x620U
#define REG_CAMERA_CUR_MEM_CH 0x624U
#define REG_CAMERA_SOFT_TRIGGER 0x62CU
#define REG_CAMERA_DATA_DEPTH 0x630U
#define REG_CAMERA_FEATURE_ERR_HI_INQ 0x640h
#define REG_CAMERA_FEATURE_ERR_LO_INQ 0x644h
#define REG_CAMERA_FEATURE_HI_BASE 0x800U
#define REG_CAMERA_FEATURE_LO_BASE 0x880U
#define REG_CAMERA_BRIGHTNESS 0x800U
#define REG_CAMERA_EXPOSURE 0x804U
#define REG_CAMERA_SHARPNESS 0x808U
#define REG_CAMERA_WHITE_BALANCE 0x80CU
#define REG_CAMERA_HUE 0x810U
#define REG_CAMERA_SATURATION 0x814U
#define REG_CAMERA_GAMMA 0x818U
#define REG_CAMERA_SHUTTER 0x81CU
#define REG_CAMERA_GAIN 0x820U
#define REG_CAMERA_IRIS 0x824U
#define REG_CAMERA_FOCUS 0x828U
#define REG_CAMERA_TEMPERATURE 0x82CU
#define REG_CAMERA_TRIGGER_MODE 0x830U
#define REG_CAMERA_TRIGGER_DELAY 0x834U
#define REG_CAMERA_WHITE_SHADING 0x838U
#define REG_CAMERA_FRAME_RATE_FEATURE 0x83CU
#define REG_CAMERA_ZOOM 0x880U
#define REG_CAMERA_PAN 0x884U
#define REG_CAMERA_TILT 0x888U
#define REG_CAMERA_OPTICAL_FILTER 0x88CU
#define REG_CAMERA_CAPTURE_SIZE 0x8C0U
#define REG_CAMERA_CAPTURE_QUALITY 0x8C4U
/* Format_7 offsets */
#define REG_CAMERA_FORMAT7_MAX_IMAGE_SIZE_INQ 0x000U
#define REG_CAMERA_FORMAT7_UNIT_SIZE_INQ 0x004U
#define REG_CAMERA_FORMAT7_IMAGE_POSITION 0x008U
#define REG_CAMERA_FORMAT7_IMAGE_SIZE 0x00CU
#define REG_CAMERA_FORMAT7_COLOR_CODING_ID 0x010U
#define REG_CAMERA_FORMAT7_COLOR_CODING_INQ 0x014U
#define REG_CAMERA_FORMAT7_PIXEL_NUMBER_INQ 0x034U
#define REG_CAMERA_FORMAT7_TOTAL_BYTES_HI_INQ 0x038U
#define REG_CAMERA_FORMAT7_TOTAL_BYTES_LO_INQ 0x03CU
#define REG_CAMERA_FORMAT7_PACKET_PARA_INQ 0x040U
#define REG_CAMERA_FORMAT7_BYTE_PER_PACKET 0x044U
#define REG_CAMERA_FORMAT7_PACKET_PER_FRAME_INQ 0x048U
#define REG_CAMERA_FORMAT7_UNIT_POSITION_INQ 0x04CU
#define REG_CAMERA_FORMAT7_FRAME_INTERVAL_INQ 0x050U
#define REG_CAMERA_FORMAT7_DATA_DEPTH_INQ 0x054U
#define REG_CAMERA_FORMAT7_COLOR_FILTER_ID 0x058U
#define REG_CAMERA_FORMAT7_VALUE_SETTING 0x07CU
/* PIO offsets */
#define REG_CAMERA_PIO_IN 0x000U
#define REG_CAMERA_PIO_OUT 0x004U
#endif /* __DC1394_OFFSETS_H__ */

102
dc1394/platform.h Normal file
View File

@ -0,0 +1,102 @@
/*
* 1394-Based Digital Camera Control Library
*
* Platform specific headers
*
* Written by David Moore <dcm@acm.org>
*
* 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
*/
#ifndef __DC1394_PLATFORM_H__
#define __DC1394_PLATFORM_H__
#include <stdint.h>
#include <dc1394/camera.h>
#include "config.h"
#ifdef HAVE_MACOSX
#include <CoreFoundation/CoreFoundation.h>
#endif
typedef struct _platform_t platform_t;
typedef struct _platform_device_t platform_device_t;
typedef struct _platform_camera_t platform_camera_t;
typedef struct _platform_device_list_t {
platform_t * p;
platform_device_t ** devices;
int num_devices;
} platform_device_list_t;
typedef struct _platform_dispatch_t {
platform_t * (*platform_new)(void);
void (*platform_free)(platform_t *);
platform_device_list_t * (*get_device_list)(platform_t *);
void (*free_device_list)(platform_device_list_t *);
int (*device_get_config_rom)(platform_device_t *, uint32_t *, int *);
platform_camera_t * (*camera_new)(platform_t *, platform_device_t *,
uint32_t);
void (*camera_free)(platform_camera_t *);
void (*camera_set_parent)(platform_camera_t *, dc1394camera_t *);
dc1394error_t (*camera_read)(platform_camera_t *, uint64_t,
uint32_t *, int);
dc1394error_t (*camera_write)(platform_camera_t *, uint64_t,
const uint32_t *, int);
dc1394error_t (*reset_bus)(platform_camera_t *);
dc1394error_t (*read_cycle_timer)(platform_camera_t *, uint32_t *,
uint64_t *);
dc1394error_t (*camera_get_node)(platform_camera_t *, uint32_t *,
uint32_t *);
dc1394error_t (*camera_print_info)(platform_camera_t *, FILE *);
dc1394error_t (*set_broadcast)(platform_camera_t *, dc1394bool_t);
dc1394error_t (*get_broadcast)(platform_camera_t *, dc1394bool_t *);
dc1394error_t (*capture_setup)(platform_camera_t *, uint32_t, uint32_t);
dc1394error_t (*capture_stop)(platform_camera_t *);
dc1394error_t (*capture_dequeue)(platform_camera_t *,
dc1394capture_policy_t, dc1394video_frame_t **);
dc1394error_t (*capture_enqueue)(platform_camera_t *,
dc1394video_frame_t *);
int (*capture_get_fileno)(platform_camera_t *);
dc1394bool_t (*capture_is_frame_corrupt)(platform_camera_t *,
dc1394video_frame_t *);
dc1394error_t (*iso_set_persist)(platform_camera_t *);
dc1394error_t (*iso_allocate_channel)(platform_camera_t *, uint64_t,
int *);
dc1394error_t (*iso_release_channel)(platform_camera_t *, int);
dc1394error_t (*iso_allocate_bandwidth)(platform_camera_t *, int);
dc1394error_t (*iso_release_bandwidth)(platform_camera_t *, int);
dc1394error_t (*capture_set_callback)(platform_camera_t * , dc1394capture_callback_t , void * );
#ifdef HAVE_MACOSX
dc1394error_t (*capture_schedule_with_runloop)(platform_camera_t * , CFRunLoopRef , CFStringRef);
#else
dc1394error_t (*capture_schedule_with_runloop)(platform_camera_t *);
#endif
} platform_dispatch_t;
#endif

295
dc1394/register.c Normal file
View File

@ -0,0 +1,295 @@
/*
* 1394-Based Digital Camera Control Library
*
* Low-level register access functions
*
* Written by Damien Douxchamps <ddouxchamps@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.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
*/
#include <inttypes.h>
#include "control.h"
#include "internal.h"
#include "offsets.h"
#include "register.h"
#include "utils.h"
#include "config.h"
/* Note: debug modes can be very verbose. */
/* To debug config rom structure: */
//#define DC1394_DEBUG_TAGGED_REGISTER_ACCESS
#define FEATURE_TO_ABS_VALUE_OFFSET(feature, offset) \
{ \
if ( (feature > DC1394_FEATURE_MAX) || (feature < DC1394_FEATURE_MIN) ) \
{ \
return DC1394_FAILURE; \
} \
else if (feature < DC1394_FEATURE_ZOOM) \
{ \
offset= REG_CAMERA_FEATURE_ABS_HI_BASE; \
feature-= DC1394_FEATURE_MIN; \
} \
else \
{ \
offset= REG_CAMERA_FEATURE_ABS_LO_BASE; \
feature-= DC1394_FEATURE_ZOOM; \
\
if (feature >= DC1394_FEATURE_CAPTURE_SIZE) \
{ \
feature+= 12; \
} \
\
} \
\
offset+= feature * 0x04U; \
}
dc1394error_t
dc1394_get_registers (dc1394camera_t *camera, uint64_t offset,
uint32_t *value, uint32_t num_regs)
{
dc1394camera_priv_t * cp = DC1394_CAMERA_PRIV (camera);
if (camera == NULL)
return DC1394_CAMERA_NOT_INITIALIZED;
return cp->platform->dispatch->camera_read (cp->pcam, offset, value,
num_regs);
}
dc1394error_t
dc1394_set_registers (dc1394camera_t *camera, uint64_t offset,
const uint32_t *value, uint32_t num_regs)
{
dc1394camera_priv_t * cp = DC1394_CAMERA_PRIV (camera);
if (camera == NULL)
return DC1394_CAMERA_NOT_INITIALIZED;
return cp->platform->dispatch->camera_write (cp->pcam, offset, value,
num_regs);
}
/********************************************************************************/
/* Get/Set Command Registers */
/********************************************************************************/
dc1394error_t
dc1394_get_control_registers (dc1394camera_t *camera, uint64_t offset,
uint32_t *value, uint32_t num_regs)
{
return dc1394_get_registers (camera,
camera->command_registers_base + offset, value, num_regs);
}
dc1394error_t
dc1394_set_control_registers (dc1394camera_t *camera, uint64_t offset,
const uint32_t *value, uint32_t num_regs)
{
return dc1394_set_registers (camera,
camera->command_registers_base + offset, value, num_regs);
}
/********************************************************************************/
/* Get/Set Advanced Features Registers */
/********************************************************************************/
dc1394error_t
dc1394_get_adv_control_registers (dc1394camera_t *camera, uint64_t offset,
uint32_t *value, uint32_t num_regs)
{
return dc1394_get_registers (camera,
camera->advanced_features_csr + offset, value, num_regs);
}
dc1394error_t
dc1394_set_adv_control_registers (dc1394camera_t *camera, uint64_t offset,
const uint32_t *value, uint32_t num_regs)
{
return dc1394_set_registers (camera,
camera->advanced_features_csr + offset, value, num_regs);
}
/********************************************************************************/
/* Get/Set Format_7 Registers */
/********************************************************************************/
dc1394error_t
QueryFormat7CSROffset(dc1394camera_t *camera, dc1394video_mode_t mode, uint64_t *offset)
{
int retval;
uint32_t temp;
if (camera == NULL) {
return DC1394_CAMERA_NOT_INITIALIZED;
}
if (!dc1394_is_video_mode_scalable(mode))
return DC1394_INVALID_VIDEO_FORMAT;
retval=dc1394_get_control_register(camera, REG_CAMERA_V_CSR_INQ_BASE + ((mode - DC1394_VIDEO_MODE_FORMAT7_MIN) * 0x04U), &temp);
*offset=temp*4;
return retval;
}
dc1394error_t
dc1394_get_format7_register(dc1394camera_t *camera, unsigned int mode, uint64_t offset, uint32_t *value)
{
if (camera == NULL)
return DC1394_CAMERA_NOT_INITIALIZED;
if (!dc1394_is_video_mode_scalable(mode))
return DC1394_INVALID_VIDEO_FORMAT;
if (camera->format7_csr[mode-DC1394_VIDEO_MODE_FORMAT7_MIN]==0) {
if (QueryFormat7CSROffset(camera, mode,
&camera->format7_csr[mode-DC1394_VIDEO_MODE_FORMAT7_MIN])
!= DC1394_SUCCESS) {
return DC1394_FAILURE;
}
}
return dc1394_get_registers (camera,
camera->format7_csr[mode-DC1394_VIDEO_MODE_FORMAT7_MIN]+offset,
value, 1);
}
dc1394error_t
dc1394_set_format7_register(dc1394camera_t *camera, unsigned int mode, uint64_t offset, uint32_t value)
{
if (camera == NULL)
return DC1394_CAMERA_NOT_INITIALIZED;
if (!dc1394_is_video_mode_scalable(mode))
return DC1394_INVALID_VIDEO_FORMAT;;
if (camera->format7_csr[mode-DC1394_VIDEO_MODE_FORMAT7_MIN]==0) {
QueryFormat7CSROffset(camera, mode,
&camera->format7_csr[mode-DC1394_VIDEO_MODE_FORMAT7_MIN]);
}
return dc1394_set_registers (camera,
camera->format7_csr[mode-DC1394_VIDEO_MODE_FORMAT7_MIN]+offset,
&value, 1);
}
/********************************************************************************/
/* Get/Set Absolute Control Registers */
/********************************************************************************/
dc1394error_t
QueryAbsoluteCSROffset(dc1394camera_t *camera, dc1394feature_t feature, uint64_t *offset)
{
int absoffset, retval;
uint32_t quadlet=0;
if (camera == NULL)
return DC1394_CAMERA_NOT_INITIALIZED;
FEATURE_TO_ABS_VALUE_OFFSET(feature, absoffset);
retval=dc1394_get_control_register(camera, absoffset, &quadlet);
*offset=quadlet * 0x04;
return retval;
}
dc1394error_t
dc1394_get_absolute_register(dc1394camera_t *camera, unsigned int feature,
uint64_t offset, uint32_t *value)
{
uint64_t absoffset;
if (camera == NULL)
return DC1394_CAMERA_NOT_INITIALIZED;
QueryAbsoluteCSROffset(camera, feature, &absoffset);
return dc1394_get_registers (camera, absoffset + offset, value, 1);
}
dc1394error_t
dc1394_set_absolute_register(dc1394camera_t *camera, unsigned int feature,
uint64_t offset, uint32_t value)
{
uint64_t absoffset;
if (camera == NULL)
return DC1394_CAMERA_NOT_INITIALIZED;
QueryAbsoluteCSROffset(camera, feature, &absoffset);
return dc1394_set_registers (camera, absoffset + offset, &value, 1);
}
/********************************************************************************/
/* Get/Set PIO Feature Registers */
/********************************************************************************/
dc1394error_t
dc1394_get_PIO_register(dc1394camera_t *camera, uint64_t offset, uint32_t *value)
{
return dc1394_get_registers (camera, camera->PIO_control_csr + offset,
value, 1);
}
dc1394error_t
dc1394_set_PIO_register(dc1394camera_t *camera, uint64_t offset, uint32_t value)
{
return dc1394_set_registers (camera, camera->PIO_control_csr + offset,
&value, 1);
}
/********************************************************************************/
/* Get/Set SIO Feature Registers */
/********************************************************************************/
dc1394error_t
dc1394_get_SIO_register(dc1394camera_t *camera, uint64_t offset, uint32_t *value)
{
return dc1394_get_registers (camera, camera->SIO_control_csr + offset,
value, 1);
}
dc1394error_t
dc1394_set_SIO_register(dc1394camera_t *camera, uint64_t offset, uint32_t value)
{
return dc1394_set_registers (camera, camera->SIO_control_csr + offset,
&value, 1);
}
/********************************************************************************/
/* Get/Set Strobe Feature Registers */
/********************************************************************************/
dc1394error_t
dc1394_get_strobe_register(dc1394camera_t *camera, uint64_t offset,
uint32_t *value)
{
return dc1394_get_registers (camera, camera->strobe_control_csr + offset,
value, 1);
}
dc1394error_t
dc1394_set_strobe_register(dc1394camera_t *camera, uint64_t offset,
uint32_t value)
{
return dc1394_set_registers (camera, camera->strobe_control_csr + offset,
&value, 1);
}

229
dc1394/register.h Normal file
View File

@ -0,0 +1,229 @@
/*
* 1394-Based Digital Camera Control Library
*
* Low-level register access functions
*
* Written by Damien Douxchamps <ddouxchamps@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.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
*/
#ifndef __DC1394_REGISTER_H__
#define __DC1394_REGISTER_H__
/*! \file dc1394/register.h
\brief Functions to directly access camera registers.
\author Damien Douxchamps: coding
\author Peter Antoniac: documentation maintainer
More details soon
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* No Docs
*/
dc1394error_t dc1394_get_registers (dc1394camera_t *camera,
uint64_t offset, uint32_t *value, uint32_t num_regs);
/**
* No Docs
*/
static inline dc1394error_t dc1394_get_register (dc1394camera_t *camera,
uint64_t offset, uint32_t *value)
{
return dc1394_get_registers (camera, offset, value, 1);
}
/**
* No Docs
*/
dc1394error_t dc1394_set_registers (dc1394camera_t *camera,
uint64_t offset, const uint32_t *value, uint32_t num_regs);
/**
* No Docs
*/
static inline dc1394error_t dc1394_set_register (dc1394camera_t *camera,
uint64_t offset, uint32_t value)
{
return dc1394_set_registers (camera, offset, &value, 1);
}
/********************************************************************************/
/* Get/Set Command Registers */
/********************************************************************************/
/**
* No Docs
*/
dc1394error_t dc1394_get_control_registers (dc1394camera_t *camera,
uint64_t offset, uint32_t *value, uint32_t num_regs);
/**
* No Docs
*/
static inline dc1394error_t dc1394_get_control_register (dc1394camera_t *camera,
uint64_t offset, uint32_t *value)
{
return dc1394_get_control_registers (camera, offset, value, 1);
}
/**
* No Docs
*/
dc1394error_t dc1394_set_control_registers (dc1394camera_t *camera,
uint64_t offset, const uint32_t *value, uint32_t num_regs);
/**
* No Docs
*/
static inline dc1394error_t dc1394_set_control_register (dc1394camera_t *camera,
uint64_t offset, uint32_t value)
{
return dc1394_set_control_registers (camera, offset, &value, 1);
}
/********************************************************************************/
/* Get/Set Advanced Features Registers */
/********************************************************************************/
/**
* No Docs
*/
dc1394error_t
dc1394_get_adv_control_registers(dc1394camera_t *camera, uint64_t offset, uint32_t *value, uint32_t num_regs);
/**
* No Docs
*/
static inline dc1394error_t
dc1394_get_adv_control_register(dc1394camera_t *camera, uint64_t offset, uint32_t *value)
{
return dc1394_get_adv_control_registers(camera, offset, value, 1);
}
/**
* No Docs
*/
dc1394error_t
dc1394_set_adv_control_registers(dc1394camera_t *camera, uint64_t offset,
const uint32_t *value, uint32_t num_regs);
/**
* No Docs
*/
static inline dc1394error_t
dc1394_set_adv_control_register(dc1394camera_t *camera, uint64_t offset, uint32_t value)
{
return dc1394_set_adv_control_registers(camera, offset, &value, 1);
}
/********************************************************************************/
/* Get/Set Format_7 Registers */
/********************************************************************************/
/**
* No Docs
*/
dc1394error_t
dc1394_get_format7_register(dc1394camera_t *camera, unsigned int mode, uint64_t offset, uint32_t *value);
/**
* No Docs
*/
dc1394error_t
dc1394_set_format7_register(dc1394camera_t *camera, unsigned int mode, uint64_t offset, uint32_t value);
/********************************************************************************/
/* Get/Set Absolute Control Registers */
/********************************************************************************/
/**
* No Docs
*/
dc1394error_t
dc1394_get_absolute_register(dc1394camera_t *camera, unsigned int feature, uint64_t offset, uint32_t *value);
/**
* No Docs
*/
dc1394error_t
dc1394_set_absolute_register(dc1394camera_t *camera, unsigned int feature, uint64_t offset, uint32_t value);
/********************************************************************************/
/* Get/Set PIO Feature Registers */
/********************************************************************************/
/**
* No Docs
*/
dc1394error_t
dc1394_get_PIO_register(dc1394camera_t *camera, uint64_t offset, uint32_t *value);
/**
* No Docs
*/
dc1394error_t
dc1394_set_PIO_register(dc1394camera_t *camera, uint64_t offset, uint32_t value);
/********************************************************************************/
/* Get/Set SIO Feature Registers */
/********************************************************************************/
/**
* No Docs
*/
dc1394error_t
dc1394_get_SIO_register(dc1394camera_t *camera, uint64_t offset, uint32_t *value);
/**
* No Docs
*/
dc1394error_t
dc1394_set_SIO_register(dc1394camera_t *camera, uint64_t offset, uint32_t value);
/********************************************************************************/
/* Get/Set Strobe Feature Registers */
/********************************************************************************/
/**
* No Docs
*/
dc1394error_t
dc1394_get_strobe_register(dc1394camera_t *camera, uint64_t offset, uint32_t *value);
/**
* No Docs
*/
dc1394error_t
dc1394_set_strobe_register(dc1394camera_t *camera, uint64_t offset, uint32_t value);
#ifdef __cplusplus
}
#endif
#endif /* __DC1394_REGISTER_H__ */

166
dc1394/types.h Normal file
View File

@ -0,0 +1,166 @@
/*
* 1394-Based Digital Camera Control Library
*
* A few type definitions
*
* Written by Damien Douxchamps <ddouxchamps@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.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
*/
#ifndef __DC1394_TYPES_H__
#define __DC1394_TYPES_H__
/*! \file dc1394/types.h
\brief Various types that must be defined here
More details soon
*/
#include <stdint.h>
/**
* Enumeration of video modes. Note that the notion of IIDC "format" is not present here, except in the format_7 name.
*/
typedef enum {
DC1394_VIDEO_MODE_160x120_YUV444= 64,
DC1394_VIDEO_MODE_320x240_YUV422,
DC1394_VIDEO_MODE_640x480_YUV411,
DC1394_VIDEO_MODE_640x480_YUV422,
DC1394_VIDEO_MODE_640x480_RGB8,
DC1394_VIDEO_MODE_640x480_MONO8,
DC1394_VIDEO_MODE_640x480_MONO16,
DC1394_VIDEO_MODE_800x600_YUV422,
DC1394_VIDEO_MODE_800x600_RGB8,
DC1394_VIDEO_MODE_800x600_MONO8,
DC1394_VIDEO_MODE_1024x768_YUV422,
DC1394_VIDEO_MODE_1024x768_RGB8,
DC1394_VIDEO_MODE_1024x768_MONO8,
DC1394_VIDEO_MODE_800x600_MONO16,
DC1394_VIDEO_MODE_1024x768_MONO16,
DC1394_VIDEO_MODE_1280x960_YUV422,
DC1394_VIDEO_MODE_1280x960_RGB8,
DC1394_VIDEO_MODE_1280x960_MONO8,
DC1394_VIDEO_MODE_1600x1200_YUV422,
DC1394_VIDEO_MODE_1600x1200_RGB8,
DC1394_VIDEO_MODE_1600x1200_MONO8,
DC1394_VIDEO_MODE_1280x960_MONO16,
DC1394_VIDEO_MODE_1600x1200_MONO16,
DC1394_VIDEO_MODE_EXIF,
DC1394_VIDEO_MODE_FORMAT7_0,
DC1394_VIDEO_MODE_FORMAT7_1,
DC1394_VIDEO_MODE_FORMAT7_2,
DC1394_VIDEO_MODE_FORMAT7_3,
DC1394_VIDEO_MODE_FORMAT7_4,
DC1394_VIDEO_MODE_FORMAT7_5,
DC1394_VIDEO_MODE_FORMAT7_6,
DC1394_VIDEO_MODE_FORMAT7_7
} dc1394video_mode_t;
#define DC1394_VIDEO_MODE_MIN DC1394_VIDEO_MODE_160x120_YUV444
#define DC1394_VIDEO_MODE_MAX DC1394_VIDEO_MODE_FORMAT7_7
#define DC1394_VIDEO_MODE_NUM (DC1394_VIDEO_MODE_MAX - DC1394_VIDEO_MODE_MIN + 1)
/* Special min/max are defined for Format_7 */
#define DC1394_VIDEO_MODE_FORMAT7_MIN DC1394_VIDEO_MODE_FORMAT7_0
#define DC1394_VIDEO_MODE_FORMAT7_MAX DC1394_VIDEO_MODE_FORMAT7_7
#define DC1394_VIDEO_MODE_FORMAT7_NUM (DC1394_VIDEO_MODE_FORMAT7_MAX - DC1394_VIDEO_MODE_FORMAT7_MIN + 1)
/**
* Enumeration of colour codings. For details on the data format please read the IIDC specifications.
*/
typedef enum {
DC1394_COLOR_CODING_MONO8= 352,
DC1394_COLOR_CODING_YUV411,
DC1394_COLOR_CODING_YUV422,
DC1394_COLOR_CODING_YUV444,
DC1394_COLOR_CODING_RGB8,
DC1394_COLOR_CODING_MONO16,
DC1394_COLOR_CODING_RGB16,
DC1394_COLOR_CODING_MONO16S,
DC1394_COLOR_CODING_RGB16S,
DC1394_COLOR_CODING_RAW8,
DC1394_COLOR_CODING_RAW16
} dc1394color_coding_t;
#define DC1394_COLOR_CODING_MIN DC1394_COLOR_CODING_MONO8
#define DC1394_COLOR_CODING_MAX DC1394_COLOR_CODING_RAW16
#define DC1394_COLOR_CODING_NUM (DC1394_COLOR_CODING_MAX - DC1394_COLOR_CODING_MIN + 1)
/**
* RAW sensor filters. These elementary tiles tesselate the image plane in RAW modes. RGGB should be interpreted in 2D as
*
* RG
* GB
*
* and similarly for other filters.
*/
typedef enum {
DC1394_COLOR_FILTER_RGGB = 512,
DC1394_COLOR_FILTER_GBRG,
DC1394_COLOR_FILTER_GRBG,
DC1394_COLOR_FILTER_BGGR
} dc1394color_filter_t;
#define DC1394_COLOR_FILTER_MIN DC1394_COLOR_FILTER_RGGB
#define DC1394_COLOR_FILTER_MAX DC1394_COLOR_FILTER_BGGR
#define DC1394_COLOR_FILTER_NUM (DC1394_COLOR_FILTER_MAX - DC1394_COLOR_FILTER_MIN + 1)
/**
* Byte order for YUV formats (may be expanded to RGB in the future)
*
* IIDC cameras always return data in UYVY order, but conversion functions can change this if requested.
*/
typedef enum {
DC1394_BYTE_ORDER_UYVY=800,
DC1394_BYTE_ORDER_YUYV
} dc1394byte_order_t;
#define DC1394_BYTE_ORDER_MIN DC1394_BYTE_ORDER_UYVY
#define DC1394_BYTE_ORDER_MAX DC1394_BYTE_ORDER_YUYV
#define DC1394_BYTE_ORDER_NUM (DC1394_BYTE_ORDER_MAX - DC1394_BYTE_ORDER_MIN + 1)
/**
* A struct containing a list of color codings
*/
typedef struct
{
uint32_t num;
dc1394color_coding_t codings[DC1394_COLOR_CODING_NUM];
} dc1394color_codings_t;
/**
* A struct containing a list of video modes
*/
typedef struct
{
uint32_t num;
dc1394video_mode_t modes[DC1394_VIDEO_MODE_NUM];
} dc1394video_modes_t;
/**
* Yet another boolean data type
*/
typedef enum {
DC1394_FALSE= 0,
DC1394_TRUE
} dc1394bool_t;
/**
* Yet another boolean data type, a bit more oriented towards electrical-engineers
*/
typedef enum {
DC1394_OFF= 0,
DC1394_ON
} dc1394switch_t;
#endif

16
dc1394/usb/Makefile.am Normal file
View File

@ -0,0 +1,16 @@
pkgusbincludedir = $(pkgincludedir)/usb
if HAVE_LIBUSB
noinst_LTLIBRARIES = libdc1394-usb.la
# headers to be installed
pkgusbinclude_HEADERS =
endif
AM_CFLAGS = -I$(top_srcdir) -I$(top_srcdir)/dc1394 $(LIBUSB_CFLAGS)
libdc1394_usb_la_LIBADD = $(LIBUSB_LIBS)
libdc1394_usb_la_SOURCES = \
control.c \
usb.h \
capture.c

687
dc1394/usb/Makefile.in Normal file
View File

@ -0,0 +1,687 @@
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = dc1394/usb
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp $(pkgusbinclude_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/ax_check_framework.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
am__DEPENDENCIES_1 =
libdc1394_usb_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_libdc1394_usb_la_OBJECTS = control.lo capture.lo
libdc1394_usb_la_OBJECTS = $(am_libdc1394_usb_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
@HAVE_LIBUSB_TRUE@am_libdc1394_usb_la_rpath =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(libdc1394_usb_la_SOURCES)
DIST_SOURCES = $(libdc1394_usb_la_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(pkgusbincludedir)"
HEADERS = $(pkgusbinclude_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
pkgincludedir = @pkgincludedir@
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
DX_CONFIG = @DX_CONFIG@
DX_DOCDIR = @DX_DOCDIR@
DX_DOT = @DX_DOT@
DX_DOXYGEN = @DX_DOXYGEN@
DX_DVIPS = @DX_DVIPS@
DX_EGREP = @DX_EGREP@
DX_ENV = @DX_ENV@
DX_FLAG_chi = @DX_FLAG_chi@
DX_FLAG_chm = @DX_FLAG_chm@
DX_FLAG_doc = @DX_FLAG_doc@
DX_FLAG_dot = @DX_FLAG_dot@
DX_FLAG_html = @DX_FLAG_html@
DX_FLAG_man = @DX_FLAG_man@
DX_FLAG_pdf = @DX_FLAG_pdf@
DX_FLAG_ps = @DX_FLAG_ps@
DX_FLAG_rtf = @DX_FLAG_rtf@
DX_FLAG_xml = @DX_FLAG_xml@
DX_HHC = @DX_HHC@
DX_LATEX = @DX_LATEX@
DX_MAKEINDEX = @DX_MAKEINDEX@
DX_PDFLATEX = @DX_PDFLATEX@
DX_PERL = @DX_PERL@
DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FRAMEWORK_IOKIT = @FRAMEWORK_IOKIT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
LIBUSB_LIBS = @LIBUSB_LIBS@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
SDL_CONFIG = @SDL_CONFIG@
SDL_LIBS = @SDL_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
XMKMF = @XMKMF@
XV_CFLAGS = @XV_CFLAGS@
XV_LIBS = @XV_LIBS@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_age = @lt_age@
lt_current = @lt_current@
lt_revision = @lt_revision@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
platform_LDFLAGS = @platform_LDFLAGS@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
pkgusbincludedir = $(pkgincludedir)/usb
@HAVE_LIBUSB_TRUE@noinst_LTLIBRARIES = libdc1394-usb.la
# headers to be installed
@HAVE_LIBUSB_TRUE@pkgusbinclude_HEADERS =
AM_CFLAGS = -I$(top_srcdir) -I$(top_srcdir)/dc1394 $(LIBUSB_CFLAGS)
libdc1394_usb_la_LIBADD = $(LIBUSB_LIBS)
libdc1394_usb_la_SOURCES = \
control.c \
usb.h \
capture.c
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu dc1394/usb/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu dc1394/usb/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
libdc1394-usb.la: $(libdc1394_usb_la_OBJECTS) $(libdc1394_usb_la_DEPENDENCIES) $(EXTRA_libdc1394_usb_la_DEPENDENCIES)
$(AM_V_CCLD)$(LINK) $(am_libdc1394_usb_la_rpath) $(libdc1394_usb_la_OBJECTS) $(libdc1394_usb_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/capture.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/control.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-pkgusbincludeHEADERS: $(pkgusbinclude_HEADERS)
@$(NORMAL_INSTALL)
@list='$(pkgusbinclude_HEADERS)'; test -n "$(pkgusbincludedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(pkgusbincludedir)'"; \
$(MKDIR_P) "$(DESTDIR)$(pkgusbincludedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgusbincludedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgusbincludedir)" || exit $$?; \
done
uninstall-pkgusbincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(pkgusbinclude_HEADERS)'; test -n "$(pkgusbincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(pkgusbincludedir)'; $(am__uninstall_files_from_dir)
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(pkgusbincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-pkgusbincludeHEADERS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-pkgusbincludeHEADERS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-pkgusbincludeHEADERS install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
uninstall-pkgusbincludeHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

545
dc1394/usb/capture.c Normal file
View File

@ -0,0 +1,545 @@
/*
* 1394-Based Digital Camera Control Library
*
* IIDC-over-USB using libusb backend for dc1394
*
* Written by David Moore <dcm@acm.org>
*
* 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
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/time.h>
#ifdef HAVE_MACOSX
#include <CoreFoundation/CoreFoundation.h>
#endif
#include "usb/usb.h"
// LIBUSB_CALL only defined for latest libusb versions.
#ifndef LIBUSB_CALL
#define LIBUSB_CALL
#endif
/* Callback whenever a bulk transfer finishes. */
static void
LIBUSB_CALL callback (struct libusb_transfer * transfer)
{
// Get a software timestamp as soon as possible in this callback. Note that this timestamp
// is not as accurate as the bus timestamp we get with the IEEE1394 interface. For more
// accurate timings, consider using either a hardware external trigger or the camera
// timestamps that can be inserted within the video frame (see Point Grey documentation)
struct timeval filltime;
gettimeofday(&filltime,NULL);
struct usb_frame * f = transfer->user_data;
platform_camera_t * craw = f->pcam;
if (transfer->status == LIBUSB_TRANSFER_CANCELLED) {
dc1394_log_warning ("usb: Bulk transfer %d cancelled", f->frame.id);
return;
}
dc1394_log_debug ("usb: Bulk transfer %d complete, %d of %d bytes",
f->frame.id, transfer->actual_length, transfer->length);
int status = BUFFER_FILLED;
if (transfer->actual_length < transfer->length)
status = BUFFER_CORRUPT;
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
dc1394_log_error ("usb: Bulk transfer %d failed with code %d",
f->frame.id, transfer->status);
status = BUFFER_ERROR;
}
pthread_mutex_lock (&craw->mutex);
f->status = status;
f->frame.timestamp = filltime.tv_sec*1000000 + filltime.tv_usec;
craw->frames_ready++;
pthread_mutex_unlock (&craw->mutex);
if (write (craw->notify_pipe[1], "+", 1)!=1) {
dc1394_log_error ("usb: Failed to write to notify pipe");
// we may need to set the status to BUFFER_ERROR here
}
}
#ifdef HAVE_MACOSX
static void
socket_callback_usb (CFSocketRef s, CFSocketCallBackType type,
CFDataRef address, const void * data, void * info)
{
platform_camera_t * craw = info;
dc1394capture_t * capture = &(craw->capture);
if (capture->callback) {
capture->callback (craw->camera, capture->callback_user_data);
}
}
#endif
static void *
capture_thread (void * arg)
{
platform_camera_t * craw = arg;
dc1394_log_debug ("usb: Helper thread starting");
while (1) {
struct timeval tv = {
.tv_sec = 0,
.tv_usec = 100000,
};
libusb_handle_events_timeout(craw->thread_context, &tv);
pthread_mutex_lock (&craw->mutex);
if (craw->kill_thread)
break;
pthread_mutex_unlock (&craw->mutex);
}
pthread_mutex_unlock (&craw->mutex);
dc1394_log_debug ("usb: Helper thread ending");
return NULL;
}
static int
find_interface (libusb_device * usb_dev, uint8_t endpoint_address)
{
struct libusb_device_descriptor usb_desc;
struct libusb_config_descriptor * config_desc;
int ret;
int i, a, e;
uint8_t ea;
ret = libusb_get_device_descriptor(usb_dev, &usb_desc);
if (ret < 0) {
dc1394_log_error ("usb: Failed to get device descriptor");
return DC1394_FAILURE;
}
if (usb_desc.bNumConfigurations) {
ret = libusb_get_active_config_descriptor (usb_dev, &config_desc);
if (ret) {
dc1394_log_error ("usb: Failed to get config descriptor");
return DC1394_FAILURE;
}
for (i = 0; i < config_desc->bNumInterfaces; i++) {
for (a = 0; a < config_desc->interface[i].num_altsetting; a++) {
for (e = 0; e < config_desc->interface[i].altsetting[a].bNumEndpoints; e++) {
ea = config_desc->interface[i].altsetting[a].endpoint[e].bEndpointAddress;
// Return the interface number for the first suitable interface
if (ea == endpoint_address)
return i;
}
}
}
}
return DC1394_FAILURE;
}
static dc1394error_t
init_frame(platform_camera_t *craw, int index, dc1394video_frame_t *proto)
{
struct usb_frame *f = craw->frames + index;
memcpy (&f->frame, proto, sizeof f->frame);
f->frame.image = craw->buffer + index * proto->total_bytes;
f->frame.id = index;
f->transfer = libusb_alloc_transfer (0);
f->pcam = craw;
f->status = BUFFER_EMPTY;
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_usb_capture_setup(platform_camera_t *craw, uint32_t num_dma_buffers,
uint32_t flags)
{
dc1394video_frame_t proto;
int i;
dc1394camera_t * camera = craw->camera;
#ifdef HAVE_MACOSX
dc1394capture_t * capture = &(craw->capture);
CFSocketContext socket_context = { 0, craw, NULL, NULL, NULL };
#endif
// if capture is already set, abort
if (craw->capture_is_set > 0)
return DC1394_CAPTURE_IS_RUNNING;
if (flags & DC1394_CAPTURE_FLAGS_DEFAULT)
flags = DC1394_CAPTURE_FLAGS_CHANNEL_ALLOC |
DC1394_CAPTURE_FLAGS_BANDWIDTH_ALLOC;
craw->flags = flags;
if (capture_basic_setup(camera, &proto) != DC1394_SUCCESS) {
dc1394_log_error("usb: Basic capture setup failed");
dc1394_usb_capture_stop (craw);
return DC1394_FAILURE;
}
if (pipe (craw->notify_pipe) < 0) {
dc1394_usb_capture_stop (craw);
return DC1394_FAILURE;
}
#ifdef HAVE_MACOSX
capture->socket = CFSocketCreateWithNative (NULL, craw->notify_pipe[0],
kCFSocketReadCallBack, socket_callback_usb, &socket_context);
/* Set flags so that the underlying fd is not closed with the socket */
CFSocketSetSocketFlags (capture->socket,
CFSocketGetSocketFlags (capture->socket) & ~kCFSocketCloseOnInvalidate);
capture->socket_source = CFSocketCreateRunLoopSource (NULL,
capture->socket, 0);
if (!capture->run_loop)
dc1394_usb_capture_schedule_with_runloop (craw,
CFRunLoopGetCurrent (), kCFRunLoopCommonModes);
CFRunLoopAddSource (capture->run_loop, capture->socket_source,
capture->run_loop_mode);
#endif
craw->capture_is_set = 1;
dc1394_log_debug ("usb: Frame size is %"PRId64, proto.total_bytes);
craw->num_frames = num_dma_buffers;
craw->current = -1;
craw->frames_ready = 0;
craw->queue_broken = 0;
craw->buffer_size = proto.total_bytes * num_dma_buffers;
craw->buffer = malloc (craw->buffer_size);
if (craw->buffer == NULL) {
dc1394_usb_capture_stop (craw);
return DC1394_MEMORY_ALLOCATION_FAILURE;
}
craw->frames = calloc (num_dma_buffers, sizeof *craw->frames);
if (craw->frames == NULL) {
dc1394_usb_capture_stop (craw);
return DC1394_MEMORY_ALLOCATION_FAILURE;
}
for (i = 0; i < num_dma_buffers; i++)
init_frame(craw, i, &proto);
if (libusb_init(&craw->thread_context) != 0) {
dc1394_log_error ("usb: Failed to create thread USB context");
dc1394_usb_capture_stop (craw);
return DC1394_FAILURE;
}
uint8_t bus = libusb_get_bus_number (libusb_get_device (craw->handle));
uint8_t addr = libusb_get_device_address (libusb_get_device (craw->handle));
libusb_device **list, *dev;
libusb_get_device_list (craw->thread_context, &list);
for (i = 0, dev = list[0]; dev; dev = list[++i]) {
if (libusb_get_bus_number (dev) == bus &&
libusb_get_device_address (dev) == addr)
break;
}
if (!dev) {
libusb_free_device_list (list, 1);
dc1394_log_error ("usb: capture thread failed to find device");
dc1394_usb_capture_stop (craw);
return DC1394_FAILURE;
}
if (libusb_open (dev, &craw->thread_handle) < 0) {
libusb_free_device_list (list, 1);
dc1394_log_error ("usb: capture thread failed to open device");
dc1394_usb_capture_stop (craw);
return DC1394_FAILURE;
}
libusb_free_device_list (list, 1);
// Point Grey uses endpoint 0x81, but other manufacturers or models may use another endpoint
int usb_interface = find_interface (libusb_get_device(craw->thread_handle), 0x81);
if (usb_interface == DC1394_FAILURE) {
dc1394_log_error ("usb: capture thread failed to find suitable interface on device");
dc1394_usb_capture_stop (craw);
return DC1394_FAILURE;
}
if (libusb_claim_interface (craw->thread_handle, usb_interface) < 0) {
dc1394_log_error ("usb: capture thread failed to claim interface");
dc1394_usb_capture_stop (craw);
return DC1394_FAILURE;
}
for (i = 0; i < craw->num_frames; i++) {
struct usb_frame *f = craw->frames + i;
libusb_fill_bulk_transfer (f->transfer, craw->thread_handle,
0x81, f->frame.image, f->frame.total_bytes,
callback, f, 0);
}
for (i = 0; i < craw->num_frames; i++) {
if (libusb_submit_transfer (craw->frames[i].transfer) < 0) {
dc1394_log_error ("usb: Failed to submit initial transfer %d", i);
dc1394_usb_capture_stop (craw);
return DC1394_FAILURE;
}
}
if (pthread_mutex_init (&craw->mutex, NULL) < 0) {
dc1394_usb_capture_stop (craw);
return DC1394_FAILURE;
}
craw->mutex_created = 1;
if (pthread_create (&craw->thread, NULL, capture_thread, craw) < 0) {
dc1394_log_error ("usb: Failed to launch helper thread");
dc1394_usb_capture_stop (craw);
return DC1394_FAILURE;
}
craw->thread_created = 1;
// if auto iso is requested, start ISO
if (flags & DC1394_CAPTURE_FLAGS_AUTO_ISO) {
dc1394_video_set_transmission(camera, DC1394_ON);
craw->iso_auto_started = 1;
}
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_usb_capture_stop(platform_camera_t *craw)
{
dc1394camera_t * camera = craw->camera;
int i;
#ifdef HAVE_MACOSX
dc1394capture_t * capture = &(craw->capture);
#endif
if (craw->capture_is_set == 0)
return DC1394_CAPTURE_IS_NOT_SET;
dc1394_log_debug ("usb: Capture stopping");
// stop ISO if it was started automatically
if (craw->iso_auto_started > 0) {
dc1394_video_set_transmission(camera, DC1394_OFF);
craw->iso_auto_started = 0;
}
if (craw->thread_created) {
#if 0
for (i = 0; i < craw->num_frames; i++) {
libusb_cancel_transfer (craw->frames[i].transfer);
}
#endif
pthread_mutex_lock (&craw->mutex);
craw->kill_thread = 1;
pthread_mutex_unlock (&craw->mutex);
pthread_join (craw->thread, NULL);
dc1394_log_debug ("usb: Joined with helper thread");
craw->kill_thread = 0;
craw->thread_created = 0;
}
if (craw->mutex_created) {
pthread_mutex_destroy (&craw->mutex);
craw->mutex_created = 0;
}
if (craw->thread_handle) {
libusb_release_interface (craw->thread_handle, 0);
libusb_close (craw->thread_handle);
craw->thread_handle = NULL;
}
if (craw->thread_context) {
libusb_exit (craw->thread_context);
craw->thread_context = NULL;
}
#ifdef HAVE_MACOSX
if (capture->socket_source) {
CFRunLoopRemoveSource (capture->run_loop, capture->socket_source,
capture->run_loop_mode);
CFRelease (capture->socket_source);
}
capture->socket_source = NULL;
if (capture->socket) {
CFSocketInvalidate (capture->socket);
CFRelease (capture->socket);
}
capture->socket = NULL;
#endif
if (craw->frames) {
for (i = 0; i < craw->num_frames; i++) {
libusb_free_transfer (craw->frames[i].transfer);
}
free (craw->frames);
craw->frames = NULL;
}
free (craw->buffer);
craw->buffer = NULL;
if (craw->notify_pipe[0] != 0 || craw->notify_pipe[1] != 0) {
close (craw->notify_pipe[0]);
close (craw->notify_pipe[1]);
}
craw->notify_pipe[0] = 0;
craw->notify_pipe[1] = 0;
craw->capture_is_set = 0;
return DC1394_SUCCESS;
}
#define NEXT_BUFFER(c,i) (((i) == -1) ? 0 : ((i)+1)%(c)->num_frames)
dc1394error_t
dc1394_usb_capture_dequeue (platform_camera_t * craw,
dc1394capture_policy_t policy, dc1394video_frame_t **frame_return)
{
int next = NEXT_BUFFER (craw, craw->current);
struct usb_frame * f = craw->frames + next;
if ((policy < DC1394_CAPTURE_POLICY_MIN)
|| (policy > DC1394_CAPTURE_POLICY_MAX))
return DC1394_INVALID_CAPTURE_POLICY;
if(craw->buffer==NULL || craw->capture_is_set==0) {
*frame_return=NULL;
return DC1394_CAPTURE_IS_NOT_SET;
}
/* default: return NULL in case of failures or lack of frames */
*frame_return = NULL;
if (policy == DC1394_CAPTURE_POLICY_POLL) {
int status;
pthread_mutex_lock (&craw->mutex);
status = f->status;
pthread_mutex_unlock (&craw->mutex);
if (status == BUFFER_EMPTY)
return DC1394_SUCCESS;
}
if (craw->queue_broken)
return DC1394_FAILURE;
char ch;
if (read (craw->notify_pipe[0], &ch, 1)!=1) {
dc1394_log_error ("usb: Failed to read from notify pipe");
return DC1394_FAILURE;
}
pthread_mutex_lock (&craw->mutex);
if (f->status == BUFFER_EMPTY) {
dc1394_log_error ("usb: Expected filled buffer");
pthread_mutex_unlock (&craw->mutex);
return DC1394_FAILURE;
}
craw->frames_ready--;
f->frame.frames_behind = craw->frames_ready;
pthread_mutex_unlock (&craw->mutex);
craw->current = next;
*frame_return = &f->frame;
if (f->status == BUFFER_ERROR)
return DC1394_FAILURE;
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_usb_capture_enqueue (platform_camera_t * craw,
dc1394video_frame_t * frame)
{
dc1394camera_t * camera = craw->camera;
struct usb_frame * f = (struct usb_frame *) frame;
if (frame->camera != camera) {
dc1394_log_error("usb: Camera does not match frame's camera");
return DC1394_INVALID_ARGUMENT_VALUE;
}
if (f->status == BUFFER_EMPTY) {
dc1394_log_error ("usb: Frame is not enqueuable");
return DC1394_FAILURE;
}
f->status = BUFFER_EMPTY;
if (libusb_submit_transfer (f->transfer) != LIBUSB_SUCCESS) {
craw->queue_broken = 1;
return DC1394_FAILURE;
}
return DC1394_SUCCESS;
}
int
dc1394_usb_capture_get_fileno (platform_camera_t * craw)
{
if (craw->notify_pipe[0] == 0 && craw->notify_pipe[1] == 0)
return -1;
return craw->notify_pipe[0];
}
dc1394bool_t
dc1394_usb_capture_is_frame_corrupt (platform_camera_t * craw,
dc1394video_frame_t * frame)
{
struct usb_frame * f = (struct usb_frame *) frame;
if (f->status == BUFFER_CORRUPT || f->status == BUFFER_ERROR)
return DC1394_TRUE;
return DC1394_FALSE;
}
#ifdef HAVE_MACOSX
dc1394error_t
dc1394_usb_capture_schedule_with_runloop (platform_camera_t * craw,
CFRunLoopRef run_loop, CFStringRef run_loop_mode)
{
dc1394capture_t * capture = &(craw->capture);
if (craw->capture_is_set) {
dc1394_log_warning("schedule_with_runloop must be called before capture_setup");
return DC1394_FAILURE;
}
capture->run_loop = run_loop;
capture->run_loop_mode = run_loop_mode;
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_usb_capture_set_callback (platform_camera_t * craw,
dc1394capture_callback_t callback, void * user_data)
{
dc1394capture_t * capture = &(craw->capture);
capture->callback = callback;
capture->callback_user_data = user_data;
return DC1394_SUCCESS;
}
#endif

403
dc1394/usb/control.c Normal file
View File

@ -0,0 +1,403 @@
/*
* 1394-Based Digital Camera Control Library
*
* IIDC-over-USB using libusb backend for dc1394
*
* Written by David Moore <dcm@acm.org>
*
* 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
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include "config.h"
#include "platform.h"
#include "internal.h"
#include "usb.h"
static platform_t *
dc1394_usb_new (void)
{
libusb_context *context;
if (libusb_init(&context) != 0)
return NULL;
platform_t * p = calloc (1, sizeof (platform_t));
p->context = context;
return p;
}
static void
dc1394_usb_free (platform_t * p)
{
if (p->context)
libusb_exit(p->context);
p->context = NULL;
free (p);
}
struct _platform_device_t {
libusb_device * dev;
};
typedef struct _usb_device_list_t {
platform_device_list_t list;
libusb_device ** libusb_list;
} usb_device_list_t;
/* This is the list of USB vendor/products that we know support
* IIDC-over-USB. Currently, this is the only mechanism of detecting
* such cameras. */
static struct _vendor_product_t {
uint16_t vendor;
uint16_t product;
} usb_products[] = {
{ 0x1e10, 0x2000 }, // Point Grey Firefly MV Color
{ 0x1e10, 0x2001 }, // Point Grey Firefly MV Mono
{ 0x1e10, 0x2002 }, // Point Grey High Res Firefly MV Color
{ 0x1e10, 0x2003 }, // Point Grey High Res Firefly MV Mono
{ 0x1e10, 0x2004 }, // Point Grey Chameleon Color
{ 0x1e10, 0x2005 }, // Point Grey Chameleon Mono
{ 0x1e10, 0x3000 }, // Point Grey Flea 3
{ 0x1e10, 0x3005 }, // Point Grey Flea 3 (FL3-U3-13Y3M)
{ 0x1e10, 0x3006 }, // Point Grey Flea 3 (FL3-U3-13S2C)
{ 0x1e10, 0x3008 }, // Point Grey Flea 3 (FL3-U3-88S2C)
{ 0x1e10, 0x300a }, // Point Grey Flea 3 (FL3-U3-13E4C)
{ 0x1e10, 0x300b }, // Point Grey Flea 3 (FL3-U3-13E4M with 1.43.3.2 FW)
{ 0x1e10, 0x3103 }, // Point Grey Grasshopper 3 (GS3-U3-23S6M)
{ 0x1e10, 0x3300 }, // Point Grey Flea 3 (FL3-U3-13E4M with 2.7.3.0 FW)
{ 0x1e10, 0x3800 }, // Point Grey Ladybug 5 (LD5-U3-51S5C-44)
{ 0, 0 }
};
static int
is_device_iidc (uint16_t vendor, uint16_t product)
{
int j = 0;
while (usb_products[j].vendor != 0 && usb_products[j].product != 0) {
if (usb_products[j].vendor == vendor &&
usb_products[j].product == product)
return 1;
j++;
}
return 0;
}
static platform_device_list_t *
dc1394_usb_get_device_list (platform_t * p)
{
usb_device_list_t * list;
libusb_device * dev;
int i;
list = calloc (1, sizeof (usb_device_list_t));
if (!list)
return NULL;
if (libusb_get_device_list (p->context, &list->libusb_list) < 0)
return NULL;
dev = list->libusb_list[0];
for (i=0, dev = list->libusb_list[0]; dev; dev = list->libusb_list[++i]) {
struct libusb_device_descriptor desc;
if (libusb_get_device_descriptor (dev, &desc) != 0) {
dc1394_log_warning ("usb: Failed to get descriptor for device %d",
i);
continue;
}
if (!is_device_iidc (desc.idVendor, desc.idProduct))
continue;
list->list.num_devices++;
list->list.devices = realloc (list->list.devices,
list->list.num_devices * sizeof (platform_device_t *));
platform_device_t * pdev = malloc(sizeof(platform_device_t));
pdev->dev = dev;
list->list.devices[list->list.num_devices-1] = pdev;
dc1394_log_debug ("usb: Found vendor:prod %x:%x at address %x:%x",
desc.idVendor, desc.idProduct,
libusb_get_bus_number (dev), libusb_get_device_address (dev));
}
return &list->list;
}
static void
dc1394_usb_free_device_list (platform_device_list_t * d)
{
usb_device_list_t * list = (usb_device_list_t *) d;
int i;
for (i = 0; i < d->num_devices; i++)
free (d->devices[i]);
free (d->devices);
libusb_free_device_list (list->libusb_list, 1);
free (d);
}
/* The high 16 bits of the IEEE 1394 address space are mapped to the request
* byte of USB control transfers. Only a discrete set addresses are
* currently supported, as mapped by this function. */
static int
address_to_request (uint64_t address)
{
switch (address >> 32) {
case 0xffff:
return 0x7f;
case 0xd000:
return 0x80;
case 0xd0001:
return 0x81;
}
dc1394_log_error("usb: Invalid high address %x for request",
address >> 32);
return -1;
}
#define REQUEST_TIMEOUT_MS 1000
static int
do_read (libusb_device_handle * handle, uint64_t address, uint32_t * quads,
int num_quads)
{
int request = address_to_request (address);
if (request < 0)
return -1;
unsigned char buf[num_quads*4];
/* IEEE 1394 address reads are mapped to USB control transfers as
* shown here. */
int ret = libusb_control_transfer (handle, 0xc0, request,
address & 0xffff, (address >> 16) & 0xffff,
buf, num_quads * 4, REQUEST_TIMEOUT_MS);
if (ret < 0)
return -1;
int i;
int ret_quads = (ret + 3) / 4;
/* Convert from little-endian to host-endian */
for (i = 0; i < ret_quads; i++) {
quads[i] = (buf[4*i+3] << 24) | (buf[4*i+2] << 16)
| (buf[4*i+1] << 8) | buf[4*i];
}
return ret_quads;
}
static int
do_write (libusb_device_handle * handle, uint64_t address,
const uint32_t * quads, int num_quads)
{
int request = address_to_request (address);
if (request < 0)
return -1;
unsigned char buf[num_quads*4];
int i;
/* Convert from host-endian to little-endian */
for (i = 0; i < num_quads; i++) {
buf[4*i] = quads[i] & 0xff;
buf[4*i+1] = (quads[i] >> 8) & 0xff;
buf[4*i+2] = (quads[i] >> 16) & 0xff;
buf[4*i+3] = (quads[i] >> 24) & 0xff;
}
/* IEEE 1394 address writes are mapped to USB control transfers as
* shown here. */
int ret = libusb_control_transfer (handle, 0x40, request,
address & 0xffff, (address >> 16) & 0xffff,
buf, num_quads * 4, REQUEST_TIMEOUT_MS);
if (ret < 0)
return -1;
return ret / 4;
}
static int
dc1394_usb_device_get_config_rom (platform_device_t * device,
uint32_t * quads, int * num_quads)
{
libusb_device_handle * handle;
if (libusb_open (device->dev, &handle) < 0) {
dc1394_log_warning ("usb: Failed to open device for config ROM");
return DC1394_FAILURE;
}
if (*num_quads > 256)
*num_quads = 256;
/* Read the config ROM one quad at a time because a read longer than
* the length of the ROM will fail. */
int i;
for (i = 0; i < *num_quads; i++) {
int ret = do_read (handle, CONFIG_ROM_BASE + 0x400 + 4*i,
quads + i, 1);
if (ret < 1)
break;
}
if (i == 0) {
dc1394_log_error ("usb: Failed to read config ROM");
libusb_close (handle);
return -1;
}
*num_quads = i;
libusb_close (handle);
return 0;
}
static platform_camera_t *
dc1394_usb_camera_new (platform_t * p, platform_device_t * device,
uint32_t unit_directory_offset)
{
libusb_device_handle * handle;
platform_camera_t * camera;
if (libusb_open (device->dev, &handle) < 0) {
dc1394_log_error ("usb: Failed to open device");
return NULL;
}
if (libusb_set_configuration (handle, 1) < 0) {
dc1394_log_error ("usb: Failed to set configuration 1 after open");
libusb_close (handle);
return NULL;
}
camera = calloc (1, sizeof (platform_camera_t));
camera->handle = handle;
return camera;
}
static void dc1394_usb_camera_free (platform_camera_t * cam)
{
libusb_close (cam->handle);
cam->handle = NULL;
free (cam);
}
static void
dc1394_usb_camera_set_parent (platform_camera_t * cam, dc1394camera_t * parent)
{
cam->camera = parent;
}
static dc1394error_t
dc1394_usb_camera_print_info (platform_camera_t * camera, FILE *fd)
{
libusb_device *dev = libusb_get_device (camera->handle);
struct libusb_device_descriptor desc;
libusb_get_device_descriptor (dev, &desc);
fprintf(fd,"------ Camera platform-specific information ------\n");
fprintf(fd,"USB Bus Number : %d\n",
libusb_get_bus_number (dev));
fprintf(fd,"USB Device Address : %d\n",
libusb_get_device_address (dev));
fprintf(fd,"Vendor ID : 0x%x\n",
desc.idVendor);
fprintf(fd,"Product ID : 0x%x\n",
desc.idProduct);
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_usb_camera_read (platform_camera_t * cam, uint64_t offset,
uint32_t * quads, int num_quads)
{
if (do_read (cam->handle, CONFIG_ROM_BASE + offset, quads,
num_quads) != num_quads)
return DC1394_FAILURE;
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_usb_camera_write (platform_camera_t * cam, uint64_t offset,
const uint32_t * quads, int num_quads)
{
if (do_write (cam->handle, CONFIG_ROM_BASE + offset, quads,
num_quads) != num_quads)
return DC1394_FAILURE;
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_usb_camera_get_node(platform_camera_t *cam, uint32_t *node,
uint32_t * generation)
{
/* Since node/generation doesn't really apply to USB, we instead
* put the device address in the "node" argument and "bus number"
* in the generation argument. */
if (node)
*node = libusb_get_device_address (libusb_get_device (cam->handle));
if (generation)
*generation = libusb_get_bus_number (libusb_get_device (cam->handle));
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_usb_reset_bus (platform_camera_t * cam)
{
int ret = libusb_reset_device (cam->handle);
if (ret == 0 || ret == LIBUSB_ERROR_NOT_FOUND)
return DC1394_SUCCESS;
return DC1394_FAILURE;
}
static platform_dispatch_t
usb_dispatch = {
.platform_new = dc1394_usb_new,
.platform_free = dc1394_usb_free,
.get_device_list = dc1394_usb_get_device_list,
.free_device_list = dc1394_usb_free_device_list,
.device_get_config_rom = dc1394_usb_device_get_config_rom,
.camera_new = dc1394_usb_camera_new,
.camera_free = dc1394_usb_camera_free,
.camera_set_parent = dc1394_usb_camera_set_parent,
.camera_print_info = dc1394_usb_camera_print_info,
.camera_get_node = dc1394_usb_camera_get_node,
.reset_bus = dc1394_usb_reset_bus,
.camera_read = dc1394_usb_camera_read,
.camera_write = dc1394_usb_camera_write,
.capture_setup = dc1394_usb_capture_setup,
.capture_stop = dc1394_usb_capture_stop,
.capture_dequeue = dc1394_usb_capture_dequeue,
.capture_enqueue = dc1394_usb_capture_enqueue,
.capture_get_fileno = dc1394_usb_capture_get_fileno,
.capture_is_frame_corrupt = dc1394_usb_capture_is_frame_corrupt,
#ifdef HAVE_MACOSX
.capture_set_callback = dc1394_usb_capture_set_callback,
.capture_schedule_with_runloop = dc1394_usb_capture_schedule_with_runloop,
#else
.capture_set_callback = NULL,
.capture_schedule_with_runloop = NULL,
#endif
};
void
dc1394_usb_init(dc1394_t * d)
{
register_platform (d, &usb_dispatch, "usb");
}

140
dc1394/usb/usb.h Normal file
View File

@ -0,0 +1,140 @@
/*
* 1394-Based Digital Camera Control Library
*
* USB backend for dc1394
*
* Written by David Moore <dcm@acm.org>
*
* 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
*/
#ifndef __DC1394_USB_H__
#define __DC1394_USB_H__
#include <libusb.h>
#include "config.h"
#include "internal.h"
#include "register.h"
#include "offsets.h"
#ifdef HAVE_MACOSX
#include <mach/mach.h>
#include <CoreFoundation/CoreFoundation.h>
#include <CoreServices/CoreServices.h>
#endif
#ifdef __MINGW32__
#define pipe(fd) _pipe(fd, 4096, 0)
#endif
#include <pthread.h>
struct _platform_t {
libusb_context *context;
};
typedef enum {
BUFFER_EMPTY,
BUFFER_FILLED,
BUFFER_CORRUPT,
BUFFER_ERROR,
} usb_frame_status;
struct usb_frame {
dc1394video_frame_t frame;
struct libusb_transfer * transfer;
platform_camera_t * pcam;
usb_frame_status status;
};
#ifdef HAVE_MACOSX
typedef struct __dc1394_capture
{
CFRunLoopRef run_loop;
CFStringRef run_loop_mode;
dc1394capture_callback_t callback;
void * callback_user_data;
CFSocketRef socket;
CFRunLoopSourceRef socket_source;
} dc1394capture_t;
#endif
struct _platform_camera_t {
libusb_device_handle * handle;
dc1394camera_t * camera;
struct usb_frame * frames;
unsigned char * buffer;
size_t buffer_size;
uint32_t flags;
unsigned int num_frames;
int current;
int frames_ready;
int queue_broken;
uint8_t bus;
uint8_t addr;
int notify_pipe[2];
pthread_t thread;
int thread_created;
pthread_mutex_t mutex;
int mutex_created;
libusb_context *thread_context;
libusb_device_handle *thread_handle;
int kill_thread;
int capture_is_set;
int iso_auto_started;
#ifdef HAVE_MACOSX
dc1394capture_t capture;
#endif
};
dc1394error_t
dc1394_usb_capture_setup(platform_camera_t *craw, uint32_t num_dma_buffers,
uint32_t flags);
dc1394error_t
dc1394_usb_capture_stop(platform_camera_t *craw);
dc1394error_t
dc1394_usb_capture_dequeue (platform_camera_t * craw,
dc1394capture_policy_t policy, dc1394video_frame_t **frame_return);
dc1394error_t
dc1394_usb_capture_enqueue (platform_camera_t * craw,
dc1394video_frame_t * frame);
int
dc1394_usb_capture_get_fileno (platform_camera_t * craw);
dc1394bool_t
dc1394_usb_capture_is_frame_corrupt (platform_camera_t * craw,
dc1394video_frame_t * frame);
dc1394error_t
dc1394_usb_capture_set_callback (platform_camera_t * camera,
dc1394capture_callback_t callback, void * user_data);
#ifdef HAVE_MACOSX
int
dc1394_usb_capture_schedule_with_runloop (platform_camera_t * camera,
CFRunLoopRef run_loop, CFStringRef run_loop_mode);
#endif
#endif

398
dc1394/utils.c Normal file
View File

@ -0,0 +1,398 @@
/*
* 1394-Based Digital Camera Control Library
*
* Utilities
*
* Written by Damien Douxchamps <ddouxchamps@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.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
*/
#include "internal.h"
const char *dc1394_feature_desc[DC1394_FEATURE_NUM] = {
"Brightness",
"Exposure",
"Sharpness",
"White Balance",
"Hue",
"Saturation",
"Gamma",
"Shutter",
"Gain",
"Iris",
"Focus",
"Temperature",
"Trigger",
"Trigger Delay",
"White Shading",
"Frame Rate",
"Zoom",
"Pan",
"Tilt",
"Optical Filter",
"Capture Size",
"Capture Quality"
};
const char *dc1394_error_strings[DC1394_ERROR_NUM] = {
"Success",
"Generic failure",
"This node is not a camera",
"Function not supported by this camera",
"Camera not initialized",
"Memory allocation failure",
"Tagged register not found",
"Could not allocate an ISO channel",
"Could not allocate bandwidth",
"IOCTL failure",
"Capture is not set",
"Capture is running",
"RAW1394 failure",
"Format_7 Error_flag_1 is set",
"Format_7 Error_flag_2 is set",
"Invalid argument value",
"Requested value is out of range",
"Invalid feature",
"Invalid video format",
"Invalid video mode",
"Invalid framerate",
"Invalid trigger mode",
"Invalid trigger source",
"Invalid ISO speed",
"Invalid IIDC version",
"Invalid Format_7 color coding",
"Invalid Format_7 elementary Bayer tile",
"Invalid capture mode",
"Invalid error code",
"Invalid Bayer method",
"Invalid video1394 device",
"Invalid operation mode",
"Invalid trigger polarity",
"Invalid feature mode",
"Invalid log type",
"Invalid byte order",
"Invalid stereo method",
"Basler error: no more SFF chunks",
"Basler error: corrupted SFF chunk",
"Basler error: unknown SFF chunk"
};
dc1394error_t
dc1394_get_image_size_from_video_mode(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *w, uint32_t *h)
{
dc1394error_t err;
uint32_t sx, sy;
switch(video_mode) {
case DC1394_VIDEO_MODE_160x120_YUV444:
*w = 160;*h=120;
return DC1394_SUCCESS;
case DC1394_VIDEO_MODE_320x240_YUV422:
*w = 320;*h=240;
return DC1394_SUCCESS;
case DC1394_VIDEO_MODE_640x480_YUV411:
case DC1394_VIDEO_MODE_640x480_YUV422:
case DC1394_VIDEO_MODE_640x480_RGB8:
case DC1394_VIDEO_MODE_640x480_MONO8:
case DC1394_VIDEO_MODE_640x480_MONO16:
*w =640;*h=480;
return DC1394_SUCCESS;
case DC1394_VIDEO_MODE_800x600_YUV422:
case DC1394_VIDEO_MODE_800x600_RGB8:
case DC1394_VIDEO_MODE_800x600_MONO8:
case DC1394_VIDEO_MODE_800x600_MONO16:
*w=800;*h=600;
return DC1394_SUCCESS;
case DC1394_VIDEO_MODE_1024x768_YUV422:
case DC1394_VIDEO_MODE_1024x768_RGB8:
case DC1394_VIDEO_MODE_1024x768_MONO8:
case DC1394_VIDEO_MODE_1024x768_MONO16:
*w=1024;*h=768;
return DC1394_SUCCESS;
case DC1394_VIDEO_MODE_1280x960_YUV422:
case DC1394_VIDEO_MODE_1280x960_RGB8:
case DC1394_VIDEO_MODE_1280x960_MONO8:
case DC1394_VIDEO_MODE_1280x960_MONO16:
*w=1280;*h=960;
return DC1394_SUCCESS;
case DC1394_VIDEO_MODE_1600x1200_YUV422:
case DC1394_VIDEO_MODE_1600x1200_RGB8:
case DC1394_VIDEO_MODE_1600x1200_MONO8:
case DC1394_VIDEO_MODE_1600x1200_MONO16:
*w=1600;*h=1200;
return DC1394_SUCCESS;
case DC1394_VIDEO_MODE_FORMAT7_0:
case DC1394_VIDEO_MODE_FORMAT7_1:
case DC1394_VIDEO_MODE_FORMAT7_2:
case DC1394_VIDEO_MODE_FORMAT7_3:
case DC1394_VIDEO_MODE_FORMAT7_4:
case DC1394_VIDEO_MODE_FORMAT7_5:
case DC1394_VIDEO_MODE_FORMAT7_6:
case DC1394_VIDEO_MODE_FORMAT7_7:
// get the current color mode from the camera
err=dc1394_format7_get_image_size(camera, video_mode, &sx, &sy);
if (err!=DC1394_SUCCESS) {
return err;
}
else {
*w=sx;
*h=sy;
}
return DC1394_SUCCESS;
case DC1394_VIDEO_MODE_EXIF:
return DC1394_FAILURE;
}
return DC1394_FAILURE;
}
dc1394error_t
dc1394_framerate_as_float(dc1394framerate_t framerate_enum, float *framerate)
{
switch(framerate_enum) {
case DC1394_FRAMERATE_1_875:
*framerate=1.875;
return DC1394_SUCCESS;
case DC1394_FRAMERATE_3_75:
*framerate=3.75;
return DC1394_SUCCESS;
case DC1394_FRAMERATE_7_5:
*framerate=7.5;
return DC1394_SUCCESS;
case DC1394_FRAMERATE_15:
*framerate=15.0;
return DC1394_SUCCESS;
case DC1394_FRAMERATE_30:
*framerate=30.0;
return DC1394_SUCCESS;
case DC1394_FRAMERATE_60:
*framerate=60.0;
return DC1394_SUCCESS;
case DC1394_FRAMERATE_120:
*framerate=120.0;
return DC1394_SUCCESS;
case DC1394_FRAMERATE_240:
*framerate=240.0;
return DC1394_SUCCESS;
}
return DC1394_INVALID_FRAMERATE;
}
dc1394error_t
dc1394_is_color(dc1394color_coding_t color_coding, dc1394bool_t *is_color)
{
switch(color_coding) {
case DC1394_COLOR_CODING_MONO8:
case DC1394_COLOR_CODING_MONO16:
case DC1394_COLOR_CODING_MONO16S:
case DC1394_COLOR_CODING_RAW8:
case DC1394_COLOR_CODING_RAW16:
*is_color=DC1394_FALSE;
return DC1394_SUCCESS;
case DC1394_COLOR_CODING_YUV411:
case DC1394_COLOR_CODING_YUV422:
case DC1394_COLOR_CODING_YUV444:
case DC1394_COLOR_CODING_RGB8:
case DC1394_COLOR_CODING_RGB16:
case DC1394_COLOR_CODING_RGB16S:
*is_color=DC1394_TRUE;
return DC1394_SUCCESS;
}
return DC1394_INVALID_COLOR_CODING;
}
dc1394error_t
dc1394_get_color_coding_data_depth(dc1394color_coding_t color_coding, uint32_t * bits)
{
switch(color_coding) {
case DC1394_COLOR_CODING_MONO8:
case DC1394_COLOR_CODING_YUV411:
case DC1394_COLOR_CODING_YUV422:
case DC1394_COLOR_CODING_YUV444:
case DC1394_COLOR_CODING_RGB8:
case DC1394_COLOR_CODING_RAW8:
*bits = 8;
return DC1394_SUCCESS;
case DC1394_COLOR_CODING_MONO16:
case DC1394_COLOR_CODING_RGB16:
case DC1394_COLOR_CODING_MONO16S:
case DC1394_COLOR_CODING_RGB16S:
case DC1394_COLOR_CODING_RAW16:
// shoudn't we return the real bit depth (e.g. 12) instead of systematically 16?
*bits = 16;
return DC1394_SUCCESS;
}
return DC1394_INVALID_COLOR_CODING;
}
dc1394error_t
dc1394_get_color_coding_bit_size(dc1394color_coding_t color_coding, uint32_t* bits)
{
switch(color_coding) {
case DC1394_COLOR_CODING_MONO8:
case DC1394_COLOR_CODING_RAW8:
*bits=8;
return DC1394_SUCCESS;
case DC1394_COLOR_CODING_YUV411:
*bits=12;
return DC1394_SUCCESS;
case DC1394_COLOR_CODING_MONO16:
case DC1394_COLOR_CODING_RAW16:
case DC1394_COLOR_CODING_MONO16S:
case DC1394_COLOR_CODING_YUV422:
*bits=16;
return DC1394_SUCCESS;
case DC1394_COLOR_CODING_YUV444:
case DC1394_COLOR_CODING_RGB8:
*bits=24;
return DC1394_SUCCESS;
case DC1394_COLOR_CODING_RGB16:
case DC1394_COLOR_CODING_RGB16S:
*bits=48;
return DC1394_SUCCESS;
}
return DC1394_INVALID_COLOR_CODING;
}
dc1394error_t
dc1394_get_color_coding_from_video_mode(dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394color_coding_t *color_coding)
{
dc1394error_t err;
dc1394color_coding_t id;
switch(video_mode) {
case DC1394_VIDEO_MODE_160x120_YUV444:
*color_coding=DC1394_COLOR_CODING_YUV444;
return DC1394_SUCCESS;
case DC1394_VIDEO_MODE_320x240_YUV422:
case DC1394_VIDEO_MODE_640x480_YUV422:
case DC1394_VIDEO_MODE_800x600_YUV422:
case DC1394_VIDEO_MODE_1024x768_YUV422:
case DC1394_VIDEO_MODE_1280x960_YUV422:
case DC1394_VIDEO_MODE_1600x1200_YUV422:
*color_coding=DC1394_COLOR_CODING_YUV422;
return DC1394_SUCCESS;
case DC1394_VIDEO_MODE_640x480_YUV411:
*color_coding=DC1394_COLOR_CODING_YUV411;
return DC1394_SUCCESS;
case DC1394_VIDEO_MODE_640x480_RGB8:
case DC1394_VIDEO_MODE_800x600_RGB8:
case DC1394_VIDEO_MODE_1024x768_RGB8:
case DC1394_VIDEO_MODE_1280x960_RGB8:
case DC1394_VIDEO_MODE_1600x1200_RGB8:
*color_coding=DC1394_COLOR_CODING_RGB8;
return DC1394_SUCCESS;
case DC1394_VIDEO_MODE_640x480_MONO8:
case DC1394_VIDEO_MODE_800x600_MONO8:
case DC1394_VIDEO_MODE_1024x768_MONO8:
case DC1394_VIDEO_MODE_1280x960_MONO8:
case DC1394_VIDEO_MODE_1600x1200_MONO8:
*color_coding=DC1394_COLOR_CODING_MONO8;
return DC1394_SUCCESS;
case DC1394_VIDEO_MODE_800x600_MONO16:
case DC1394_VIDEO_MODE_640x480_MONO16:
case DC1394_VIDEO_MODE_1024x768_MONO16:
case DC1394_VIDEO_MODE_1280x960_MONO16:
case DC1394_VIDEO_MODE_1600x1200_MONO16:
*color_coding=DC1394_COLOR_CODING_MONO16;
return DC1394_SUCCESS;
case DC1394_VIDEO_MODE_FORMAT7_0:
case DC1394_VIDEO_MODE_FORMAT7_1:
case DC1394_VIDEO_MODE_FORMAT7_2:
case DC1394_VIDEO_MODE_FORMAT7_3:
case DC1394_VIDEO_MODE_FORMAT7_4:
case DC1394_VIDEO_MODE_FORMAT7_5:
case DC1394_VIDEO_MODE_FORMAT7_6:
case DC1394_VIDEO_MODE_FORMAT7_7:
// get the current color mode from the camera
err=dc1394_format7_get_color_coding(camera, video_mode, &id);
if (err!=DC1394_SUCCESS) {
return err;
}
else {
*color_coding=id;
}
return DC1394_SUCCESS;
case DC1394_VIDEO_MODE_EXIF:
return DC1394_FAILURE;
}
return DC1394_FAILURE;
}
dc1394bool_t
dc1394_is_video_mode_scalable(dc1394video_mode_t video_mode)
{
return ((video_mode>=DC1394_VIDEO_MODE_FORMAT7_MIN)&&(video_mode<=DC1394_VIDEO_MODE_FORMAT7_MAX));
}
dc1394bool_t
dc1394_is_video_mode_still_image(dc1394video_mode_t video_mode)
{
return ((video_mode>=DC1394_VIDEO_MODE_FORMAT6_MIN)&&(video_mode<=DC1394_VIDEO_MODE_FORMAT6_MAX));
}
dc1394bool_t
dc1394_is_same_camera(dc1394camera_id_t id1, dc1394camera_id_t id2)
{
return ((id1.guid==id2.guid)&&(id1.unit==id2.unit));
}
const char *
dc1394_feature_get_string(dc1394feature_t feature)
{
if ((feature>DC1394_FEATURE_MAX)||(feature<DC1394_FEATURE_MIN))
return NULL;
return dc1394_feature_desc[feature-DC1394_FEATURE_MIN];
}
const char *
dc1394_error_get_string(dc1394error_t error)
{
if ((error>DC1394_ERROR_MAX)||(error<DC1394_ERROR_MIN))
return NULL;
return dc1394_error_strings[-error-DC1394_ERROR_MAX];
}
/*
* Checksum algorithms
* Copyright (C) 2006 Mikael Olenfalk, Tobii Technology AB, Stockholm Sweden
*
* Written by Mikael Olenfalk <mikael _DOT_ olenfalk _AT_ tobii _DOT_ com>
* Version : 16/02/2005
*/
uint16_t
dc1394_checksum_crc16 (const uint8_t* buffer, uint32_t buffer_size)
{
uint32_t i, j, c, bit;
uint32_t crc = 0;
for (i = 0; i < buffer_size; i++) {
c = (uint32_t)*buffer++;
for (j = 0x80; j; j >>= 1) {
bit = crc & 0x8000;
crc <<= 1;
if (c & j) bit ^= 0x8000;
if (bit) crc ^= 0x1021;
}
}
return (uint16_t)(crc & 0xffff);
}

105
dc1394/utils.h Normal file
View File

@ -0,0 +1,105 @@
/*
* 1394-Based Digital Camera Control Library
*
* Utilities
*
* Written by Damien Douxchamps <ddouxchamps@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.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
*/
#ifndef __DC1394_UTILS_H__
#define __DC1394_UTILS_H__
/*! \file dc1394/utils.h
\brief Utility functions
\author Damien Douxchamps: coding
\author Peter Antoniac: documentation maintainer
More details soon
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* Returns the image width and height (in pixels) corresponding to a video mode. Works for scalable and non-scalable video modes.
*/
dc1394error_t dc1394_get_image_size_from_video_mode(dc1394camera_t *camera, uint32_t video_mode, uint32_t *width, uint32_t *height);
/**
* Returns the given framerate as a float.
*/
dc1394error_t dc1394_framerate_as_float(dc1394framerate_t framerate_enum, float *framerate);
/**
* Returns the number of bits per pixel for a certain color coding. This is the size of the data sent on the bus, the effective
* data depth may vary. Example: RGB16 is 16, YUV411 is 8, YUV422 is 8.
*/
dc1394error_t dc1394_get_color_coding_data_depth(dc1394color_coding_t color_coding, uint32_t * bits);
/**
* Returns the bit-space used by a pixel. This is different from the data depth! For instance, RGB16 has a bit space of 48 bits,
* YUV422 is 16bits and YU411 is 12bits.
*/
dc1394error_t dc1394_get_color_coding_bit_size(dc1394color_coding_t color_coding, uint32_t* bits);
/**
* Returns the color coding from the video mode. Works with scalable image formats too.
*/
dc1394error_t dc1394_get_color_coding_from_video_mode(dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394color_coding_t *color_coding);
/**
* Tells whether the color mode is color or monochrome
*/
dc1394error_t dc1394_is_color(dc1394color_coding_t color_mode, dc1394bool_t *is_color);
/**
* Tells whether the video mode is scalable or not.
*/
dc1394bool_t dc1394_is_video_mode_scalable(dc1394video_mode_t video_mode);
/**
* Tells whether the video mode is "still image" or not ("still image" is currently not supported by any cameras on the market)
*/
dc1394bool_t dc1394_is_video_mode_still_image(dc1394video_mode_t video_mode);
/**
* Tells whether two IDs refer to the same physical camera unit.
*/
dc1394bool_t dc1394_is_same_camera(dc1394camera_id_t id1, dc1394camera_id_t id2);
/**
* Returns a descriptive name for a feature
*/
const char * dc1394_feature_get_string(dc1394feature_t feature);
/**
* Returns a descriptive string for an error code
*/
const char * dc1394_error_get_string(dc1394error_t error);
/**
* Calculates the CRC16 checksum of a memory region. Useful to verify the CRC of an image buffer, for instance.
*/
uint16_t dc1394_checksum_crc16 (const uint8_t* buffer, uint32_t buffer_size);
#ifdef __cplusplus
}
#endif
#endif /* _DC1394_UTILS_H */

21
dc1394/vendor/Makefile.am vendored Normal file
View File

@ -0,0 +1,21 @@
noinst_LTLIBRARIES = libdc1394-vendor.la
pkgvendorincludedir = $(pkgincludedir)/vendor
AM_CFLAGS = -I$(top_srcdir) -I$(srcdir)/..
libdc1394_vendor_la_SOURCES = \
avt.c \
avt.h \
pixelink.c \
pixelink.h \
basler.c \
basler_sff_registry.h \
basler_sff_registry.c
# headers to be installed
pkgvendorinclude_HEADERS = \
avt.h \
pixelink.h \
basler.h \
basler_sff.h

696
dc1394/vendor/Makefile.in generated vendored Normal file
View File

@ -0,0 +1,696 @@
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = dc1394/vendor
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp $(pkgvendorinclude_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/ax_check_framework.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libdc1394_vendor_la_LIBADD =
am_libdc1394_vendor_la_OBJECTS = avt.lo pixelink.lo basler.lo \
basler_sff_registry.lo
libdc1394_vendor_la_OBJECTS = $(am_libdc1394_vendor_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(libdc1394_vendor_la_SOURCES)
DIST_SOURCES = $(libdc1394_vendor_la_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(pkgvendorincludedir)"
HEADERS = $(pkgvendorinclude_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
pkgincludedir = @pkgincludedir@
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
DX_CONFIG = @DX_CONFIG@
DX_DOCDIR = @DX_DOCDIR@
DX_DOT = @DX_DOT@
DX_DOXYGEN = @DX_DOXYGEN@
DX_DVIPS = @DX_DVIPS@
DX_EGREP = @DX_EGREP@
DX_ENV = @DX_ENV@
DX_FLAG_chi = @DX_FLAG_chi@
DX_FLAG_chm = @DX_FLAG_chm@
DX_FLAG_doc = @DX_FLAG_doc@
DX_FLAG_dot = @DX_FLAG_dot@
DX_FLAG_html = @DX_FLAG_html@
DX_FLAG_man = @DX_FLAG_man@
DX_FLAG_pdf = @DX_FLAG_pdf@
DX_FLAG_ps = @DX_FLAG_ps@
DX_FLAG_rtf = @DX_FLAG_rtf@
DX_FLAG_xml = @DX_FLAG_xml@
DX_HHC = @DX_HHC@
DX_LATEX = @DX_LATEX@
DX_MAKEINDEX = @DX_MAKEINDEX@
DX_PDFLATEX = @DX_PDFLATEX@
DX_PERL = @DX_PERL@
DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FRAMEWORK_IOKIT = @FRAMEWORK_IOKIT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
LIBUSB_LIBS = @LIBUSB_LIBS@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
SDL_CONFIG = @SDL_CONFIG@
SDL_LIBS = @SDL_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
XMKMF = @XMKMF@
XV_CFLAGS = @XV_CFLAGS@
XV_LIBS = @XV_LIBS@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_age = @lt_age@
lt_current = @lt_current@
lt_revision = @lt_revision@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
platform_LDFLAGS = @platform_LDFLAGS@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
noinst_LTLIBRARIES = libdc1394-vendor.la
pkgvendorincludedir = $(pkgincludedir)/vendor
AM_CFLAGS = -I$(top_srcdir) -I$(srcdir)/..
libdc1394_vendor_la_SOURCES = \
avt.c \
avt.h \
pixelink.c \
pixelink.h \
basler.c \
basler_sff_registry.h \
basler_sff_registry.c
# headers to be installed
pkgvendorinclude_HEADERS = \
avt.h \
pixelink.h \
basler.h \
basler_sff.h
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu dc1394/vendor/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu dc1394/vendor/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
libdc1394-vendor.la: $(libdc1394_vendor_la_OBJECTS) $(libdc1394_vendor_la_DEPENDENCIES) $(EXTRA_libdc1394_vendor_la_DEPENDENCIES)
$(AM_V_CCLD)$(LINK) $(libdc1394_vendor_la_OBJECTS) $(libdc1394_vendor_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avt.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basler.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basler_sff_registry.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixelink.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-pkgvendorincludeHEADERS: $(pkgvendorinclude_HEADERS)
@$(NORMAL_INSTALL)
@list='$(pkgvendorinclude_HEADERS)'; test -n "$(pkgvendorincludedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(pkgvendorincludedir)'"; \
$(MKDIR_P) "$(DESTDIR)$(pkgvendorincludedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgvendorincludedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgvendorincludedir)" || exit $$?; \
done
uninstall-pkgvendorincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(pkgvendorinclude_HEADERS)'; test -n "$(pkgvendorincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(pkgvendorincludedir)'; $(am__uninstall_files_from_dir)
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(pkgvendorincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-pkgvendorincludeHEADERS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-pkgvendorincludeHEADERS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-pkgvendorincludeHEADERS install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
uninstall-pkgvendorincludeHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

1723
dc1394/vendor/avt.c vendored Normal file

File diff suppressed because it is too large Load Diff

467
dc1394/vendor/avt.h vendored Normal file
View File

@ -0,0 +1,467 @@
/*
* 1394-Based Digital Camera Control Library
*
* Allied Vision Technologies (AVT) specific extensions
*
* Written by Pierre MOOS <pierre.moos@gmail.com>
*
* Copyright (C) 2005 Inria Sophia-Antipolis
*
* 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
*/
#ifndef __DC1394_VENDOR_AVT_H__
#define __DC1394_VENDOR_AVT_H__
#include <stdint.h>
#include <dc1394/types.h>
#include <dc1394/log.h>
/*! \file dc1394/vendor/avt.h
\brief No docs yet
More details soon
*/
typedef struct __dc1394_avt_adv_feature_info_struct
{
uint32_t feature_id;
dc1394bool_t features_requested;
/************************************************************************/
dc1394bool_t MaxResolution; //ADV_INQ_1 0
dc1394bool_t TimeBase; //ADV_INQ_1 1
dc1394bool_t ExtdShutter; //ADV_INQ_1 2
dc1394bool_t TestImage; //ADV_INQ_1 3
dc1394bool_t FrameInfo; //ADV_INQ_1 4
dc1394bool_t Sequences; //ADV_INQ_1 5
dc1394bool_t VersionInfo; //ADV_INQ_1 6
//ADV_INQ_1 7
dc1394bool_t Lookup_Tables; //ADV_INQ_1 8
dc1394bool_t Shading; //ADV_INQ_1 9
dc1394bool_t DeferredTrans; //ADV_INQ_1 10
dc1394bool_t HDR_Mode; //ADV_INQ_1 11
dc1394bool_t DSNU; //ADV_INQ_1 12
dc1394bool_t BlemishCorrection; //ADV_INQ_1 13
dc1394bool_t TriggerDelay; //ADV_INQ_1 14
dc1394bool_t MirrorImage; //ADV_INQ_1 15
dc1394bool_t SoftReset; //ADV_INQ_1 16
dc1394bool_t HSNR; //ADV_INQ_1 17
dc1394bool_t ColorCorrection; //ADV_INQ_1 18
dc1394bool_t UserProfiles; //ADV_INQ_1 19
//ADV_INQ_1 20
dc1394bool_t UserSets; //ADV_INQ_1 21
dc1394bool_t TimeStamp; //ADV_INQ_1 22
dc1394bool_t FrmCntStamp; //ADV_INQ_1 23
dc1394bool_t TrgCntStamp; //ADV_INQ_1 24
//ADV_INQ_1 25-30
dc1394bool_t GP_Buffer; //ADV_INQ_1 31
/************************************************************************/
dc1394bool_t Input_1; //ADV_INQ_2 0
dc1394bool_t Input_2; //ADV_INQ_2 1
//ADV_INQ_2 2-7
dc1394bool_t Output_1; //ADV_INQ_2 8
dc1394bool_t Output_2; //ADV_INQ_2 9
dc1394bool_t Output_3; //ADV_INQ_2 10
dc1394bool_t Output_4; //ADV_INQ_2 11
//ADV_INQ_2 12-15
dc1394bool_t IntEnaDelay; //ADV_INQ_2 16
dc1394bool_t IncDecoder; //ADV_INQ_2 17
//ADV_INQ_2 18-31
/************************************************************************/
dc1394bool_t CameraStatus; //ADV_INQ_3 0
//ADV_INQ_3 1-3
dc1394bool_t AutoShutter; //ADV_INQ_3 4
dc1394bool_t AutoGain; //ADV_INQ_3 5
dc1394bool_t AutoFunctionAOI; //ADV_INQ_3 6
//ADV_INQ_3 7-31
/************************************************************************/
dc1394bool_t HDRPike; //ADV_INQ_4 0
//ADV_INQ_4 1-31
} dc1394_avt_adv_feature_info_t;
#ifdef __cplusplus
extern "C" {
#endif
/**
* Retrieve the firmware version, FPGA version and the camera ID
*/
dc1394error_t dc1394_avt_get_version(dc1394camera_t *camera,
uint32_t *UCType,
uint32_t *Version,
uint32_t *Camera_ID,
uint32_t *FPGA_Version);
/**
* Retrieve the supported features
*/
dc1394error_t dc1394_avt_get_advanced_feature_inquiry(dc1394camera_t *camera,
dc1394_avt_adv_feature_info_t *adv_feature);
/**
* Print the supported features requested
*/
dc1394error_t dc1394_avt_print_advanced_feature(dc1394_avt_adv_feature_info_t *adv_feature);
/**
* Retrieve if shading is on and the number of frames used to compute the shading reference frame
*/
dc1394error_t dc1394_avt_get_shading(dc1394camera_t *camera,
dc1394bool_t *on_off,
dc1394bool_t *compute,
dc1394bool_t *show, uint32_t *frame_nb);
/**
* Set the shading to on/off and the number of frames used to compute the shading reference frame
*/
dc1394error_t dc1394_avt_set_shading(dc1394camera_t *camera,
dc1394bool_t on_off, dc1394bool_t compute,
dc1394bool_t show, uint32_t frame_nb);
/**
* Retrieve write and read access mode of the shading reference frame
*/
dc1394error_t dc1394_avt_get_shading_mem_ctrl(dc1394camera_t *camera,
dc1394bool_t *en_write,
dc1394bool_t *en_read,
uint32_t *addroffset);
/**
* Set write and read access mode of the shading reference frame
*/
dc1394error_t dc1394_avt_set_shading_mem_ctrl(dc1394camera_t *camera,
dc1394bool_t en_write,
dc1394bool_t en_read,
uint32_t addroffset);
/**
* Retrieve the max size of a shading image
*/
dc1394error_t dc1394_avt_get_shading_info(dc1394camera_t *camera,
uint32_t *MaxImageSize);
/**
* Retrieve if on/off, the nb of kneepoints used and the kneepoints values
*/
dc1394error_t dc1394_avt_get_multiple_slope(dc1394camera_t *camera,
dc1394bool_t *on_off,
uint32_t *points_nb,
uint32_t *kneepoint1,
uint32_t *kneepoint2,
uint32_t *kneepoint3);
/**
* Set on/off, the nb of kneepoints to use and the kneepoints values
*/
dc1394error_t dc1394_avt_set_multiple_slope(dc1394camera_t *camera,
dc1394bool_t on_off,
uint32_t points_nb,
uint32_t kneepoint1,
uint32_t kneepoint2,
uint32_t kneepoint3);
/**
* Get the timebase value with an Id. See Manual for correspondance
*/
dc1394error_t dc1394_avt_get_timebase(dc1394camera_t *camera,
uint32_t *timebase_id);
/**
* Set the timebase value with an Id. See Manual for correspondance
*/
dc1394error_t dc1394_avt_set_timebase(dc1394camera_t *camera,
uint32_t timebase_id);
/**
* Get the extented shutter value in us
*/
dc1394error_t dc1394_avt_get_extented_shutter(dc1394camera_t *camera,
uint32_t *timebase_id);
/**
* Set the extented shutter value in us
*/
dc1394error_t dc1394_avt_set_extented_shutter(dc1394camera_t *camera,
uint32_t timebase_id);
/**
* Get the Max reachable resolution
*/
dc1394error_t dc1394_avt_get_MaxResolution(dc1394camera_t *camera,
uint32_t *MaxHeight,
uint32_t *MaxWidth);
/**
* Get min and max shutter values for autoshutter
*/
dc1394error_t dc1394_avt_get_auto_shutter(dc1394camera_t *camera,
uint32_t *MinValue,
uint32_t *MaxValue);
/**
* Set min and max shutter values for autoshutter
*/
dc1394error_t dc1394_avt_set_auto_shutter(dc1394camera_t *camera,
uint32_t MinValue,
uint32_t MaxValue);
/**
* Get min and max gain values for autogain
*/
dc1394error_t dc1394_avt_get_auto_gain(dc1394camera_t *camera,
uint32_t *MinValue,
uint32_t *MaxValue);
/**
* Set min and max gain values for autogain
*/
dc1394error_t dc1394_avt_set_auto_gain(dc1394camera_t *camera,
uint32_t MinValue,
uint32_t MaxValue);
/**
* Get if trigger delay on and the trigger delay
*/
dc1394error_t dc1394_avt_get_trigger_delay(dc1394camera_t *camera,
dc1394bool_t *on_off,
uint32_t *DelayTime);
/**
* Set trigger delay on/off and the trigger delay value
*/
dc1394error_t dc1394_avt_set_trigger_delay(dc1394camera_t *camera,
dc1394bool_t on_off,
uint32_t DelayTime);
/**
* Get mirror mode
*/
dc1394error_t dc1394_avt_get_mirror(dc1394camera_t *camera,
dc1394bool_t *on_off);
/**
* Set mirror mode
*/
dc1394error_t dc1394_avt_set_mirror(dc1394camera_t *camera,
dc1394bool_t on_off);
/**
* Get DSNU mode and num of frames used for computing dsnu correction
*/
dc1394error_t dc1394_avt_get_dsnu(dc1394camera_t *camera,
dc1394bool_t *on_off,
uint32_t *frame_nb);
/**
* Set DSNU mode, number of frames used for computing and launch the the computation of the dsnu frame
*/
dc1394error_t dc1394_avt_set_dsnu(dc1394camera_t *camera,
dc1394bool_t on_off, dc1394bool_t compute,
uint32_t frame_nb);
/**
* Get Blemish mode and num of frames used for computing the correction
*/
dc1394error_t dc1394_avt_get_blemish(dc1394camera_t *camera,
dc1394bool_t *on_off, uint32_t *frame_nb);
/**
* Set Blemish mode, num of frames used for computing and launch the the computation of the blemish correction
*/
dc1394error_t dc1394_avt_set_blemish(dc1394camera_t *camera,
dc1394bool_t on_off, dc1394bool_t compute,
uint32_t frame_nb);
/**
* Get the polarity, the mode, the state of the IO
*/
dc1394error_t dc1394_avt_get_io(dc1394camera_t *camera, uint32_t IO,
dc1394bool_t *polarity, uint32_t *mode,
dc1394bool_t *pinstate);
/**
* Set the polarity, the mode and the state of the IO
*/
dc1394error_t dc1394_avt_set_io(dc1394camera_t *camera,uint32_t IO,
dc1394bool_t polarity, uint32_t mode,
dc1394bool_t pinstate);
/**
* Reset the bus and the fpga
*/
dc1394error_t dc1394_avt_reset(dc1394camera_t *camera);
/**
* Get on/off and the num of the current lut loaded
*/
dc1394error_t dc1394_avt_get_lut(dc1394camera_t *camera,
dc1394bool_t *on_off, uint32_t *lutnb );
/**
* Set on/off and the num of the current lut to loa
*/
dc1394error_t dc1394_avt_set_lut(dc1394camera_t *camera,
dc1394bool_t on_off, uint32_t lutnb);
/**
* Get access mode of a lut
*/
dc1394error_t dc1394_avt_get_lut_mem_ctrl(dc1394camera_t *camera,
dc1394bool_t *en_write,
uint32_t * AccessLutNo,
uint32_t *addroffset);
/**
* Set access mode of a lut
*/
dc1394error_t dc1394_avt_set_lut_mem_ctrl(dc1394camera_t *camera,
dc1394bool_t en_write,
uint32_t AccessLutNo,
uint32_t addroffset);
/**
* Get num of luts present and the max size
*/
dc1394error_t dc1394_avt_get_lut_info(dc1394camera_t *camera,
uint32_t *NumOfLuts, uint32_t *MaxLutSize);
/**
* Get on/off and area
*/
dc1394error_t dc1394_avt_get_aoi(dc1394camera_t *camera,
dc1394bool_t *on_off, int *left, int *top,
int *width, int *height);
/**
* Set on/off and area
*/
dc1394error_t dc1394_avt_set_aoi(dc1394camera_t *camera,
dc1394bool_t on_off,int left, int top,
int width, int height);
/**
* Get current test image
*/
dc1394error_t dc1394_avt_get_test_images(dc1394camera_t *camera,
uint32_t *image_no);
/**
* Set num of test image
*/
dc1394error_t dc1394_avt_set_test_images(dc1394camera_t *camera,
uint32_t image_no);
/**
* Get the number of captured frames
*/
dc1394error_t dc1394_avt_get_frame_info(dc1394camera_t *camera,
uint32_t *framecounter);
/**
* Reset frame counter
*/
dc1394error_t dc1394_avt_reset_frame_info(dc1394camera_t *camera);
/**
* Get the size of the buffer
*/
dc1394error_t dc1394_avt_get_gpdata_info(dc1394camera_t *camera,
uint32_t *BufferSize);
/**
* Get the fifo control mode
*/
dc1394error_t dc1394_avt_get_deferred_trans(dc1394camera_t *camera,
dc1394bool_t *HoldImage,
dc1394bool_t * FastCapture,
uint32_t *FifoSize,
uint32_t *NumOfImages );
/**
* Set the fifo control mode
*/
dc1394error_t dc1394_avt_set_deferred_trans(dc1394camera_t *camera,
dc1394bool_t HoldImage,
dc1394bool_t FastCapture,
uint32_t FifoSize,
uint32_t NumOfImages,
dc1394bool_t SendImage );
/**
* Read size number of bytes from GPData buffe
*/
dc1394error_t dc1394_avt_read_gpdata(dc1394camera_t *camera, unsigned char *buf,
uint32_t size);
/**
* Write size number of bytes to GPData buffer
*/
dc1394error_t dc1394_avt_write_gpdata(dc1394camera_t *camera,
unsigned char *buf, uint32_t size);
/**
* Read shading image from camera into buffer
*/
dc1394error_t dc1394_avt_read_shading_img(dc1394camera_t *camera,
unsigned char *buf, uint32_t size);
/**
* Write shading image from buffer to camera
*/
dc1394error_t dc1394_avt_write_shading_img(dc1394camera_t *camera,
unsigned char *buf, uint32_t size);
/**
* Read channel adjust (AVT Pike)
*/
dc1394error_t dc1394_avt_get_channel_adjust(dc1394camera_t *camera,
int16_t *channel_adjust);
/**
* Write channel adjust (AVT Pike)
*/
dc1394error_t dc1394_avt_set_channel_adjust(dc1394camera_t *camera,
int16_t channel_adjust);
/**
* Set Color Correction + Coefficients
*/
dc1394error_t dc1394_avt_set_color_corr(dc1394camera_t *camera, dc1394bool_t on_off, dc1394bool_t reset,
int32_t Crr, int32_t Cgr, int32_t Cbr, int32_t Crg, int32_t Cgg, int32_t Cbg, int32_t Crb, int32_t Cgb, int32_t Cbb);
/**
* Get Color Correction + Coefficients
*/
dc1394error_t dc1394_avt_get_color_corr(dc1394camera_t *camera, dc1394bool_t *on_off,
int32_t *Crr, int32_t *Cgr, int32_t *Cbr, int32_t *Crg, int32_t *Cgg, int32_t *Cbg, int32_t *Crb, int32_t *Cgb, int32_t *Cbb);
/**
* Get HSNR
*/
dc1394error_t dc1394_avt_get_hsnr(dc1394camera_t *camera, dc1394bool_t *on_off, uint32_t *grabCount);
/**
* Set HSNR
*/
dc1394error_t dc1394_avt_set_hsnr(dc1394camera_t *camera, dc1394bool_t on_off, uint32_t grabCount);
#ifdef __cplusplus
}
#endif
#endif

471
dc1394/vendor/basler.c vendored Normal file
View File

@ -0,0 +1,471 @@
/*
* 1394-Based Digital Camera Control Library
*
* Basler Smart Feature Framework specific extensions
*
* Written by Mikael Olenfalk <mikael _DOT_ olenfalk _AT_ tobii _DOT_ com>
*
* Copyright (C) 2006 Tobii Technology AB, Stockholm Sweden
*
* 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
*/
#include <inttypes.h>
#include "../internal.h"
#include "../register.h"
#include "../utils.h"
#include "../control.h"
#include "basler.h"
#include "basler_sff_registry.h"
/*
* BASLER CONTROL REGISTERS
*/
#define BASLER_ADDRESS_SFF_INQUIRY 0x010U
#define BASLER_ADDRESS_SFF_ADDRESS 0x020U
/*
* KNOWN BIT POSITIONS IN SFF FEATURE CSRs
*/
#define BASLER_SFF_CSR_BIT_ENABLE 0x00000001
#define BASLER_SFF_CSR_BIT_PRESENCE 0x80000000
/*
* Private functions
*/
dc1394error_t
get_sff_address_from_csr_guid (dc1394camera_t* camera, const dc1394basler_sff_guid_t* feature_guid, uint64_t* address)
{
dc1394error_t err;
uint32_t data;
if (camera == NULL || feature_guid == NULL || address == NULL)
return DC1394_FAILURE;
/* write GUID like this to BASLER_ADDRESS_SFF_INQUIRY_REGISTER:
* 0x10 <- D1
* 0x14 <- D3 | D2
* 0x18 <- D4[3] | D4[2] | D4[1] | D4[0]
* 0x1C <- D4[7] | D4[6] | D4[5] | D4[4]
*/
data = feature_guid->d1;
err = dc1394_set_adv_control_register (camera, BASLER_ADDRESS_SFF_INQUIRY, data);
DC1394_ERR_RTN(err, "Could not write D1 to SFF inquiry register");
data = ((uint32_t)feature_guid->d3) << 16 | feature_guid->d2;
err = dc1394_set_adv_control_register (camera, BASLER_ADDRESS_SFF_INQUIRY + 0x4U, data);
DC1394_ERR_RTN(err, "Could not write D3 | D2 to SFF inquiry register");
data = ((uint32_t)feature_guid->d4[3] << 24) | ((uint32_t)feature_guid->d4[2] << 16) |
((uint32_t)feature_guid->d4[1] << 8) | feature_guid->d4[0];
err = dc1394_set_adv_control_register (camera, BASLER_ADDRESS_SFF_INQUIRY + 0x8U, data);
DC1394_ERR_RTN(err, "Could not write D4[3..0] to SFF inquiry register");
data = ((uint32_t)feature_guid->d4[7] << 24) | ((uint32_t)feature_guid->d4[6] << 16) |
((uint32_t)feature_guid->d4[5] << 8) | feature_guid->d4[4];
err = dc1394_set_adv_control_register (camera, BASLER_ADDRESS_SFF_INQUIRY + 0xCU, data);
DC1394_ERR_RTN(err, "Could not write D4[7..4] to SFF inquiry register");
/* read address */
err = dc1394_get_adv_control_register (camera, BASLER_ADDRESS_SFF_ADDRESS, &data);
DC1394_ERR_RTN(err, "Could not read first quadlet of address from SFF address register");
*address = data;
err = dc1394_get_adv_control_register (camera, BASLER_ADDRESS_SFF_ADDRESS + 0x4U, &data);
DC1394_ERR_RTN(err, "Could not read second quadlet of address from SFF address register");
*address |= ((uint64_t)data) << 32;
*address -= CONFIG_ROM_BASE;
return DC1394_SUCCESS;
}
/*
* Tests whether the camera supports Basler SFF
*/
dc1394error_t
dc1394_basler_sff_is_available (dc1394camera_t* camera, dc1394bool_t *available)
{
uint32_t data;
dc1394error_t err;
const uint32_t basler_feature_id_1 = 0x0030533b;
const uint32_t basler_feature_id_2 = 0x73c3f000;
if (camera == NULL || available == NULL) {
err = DC1394_INVALID_ARGUMENT_VALUE;
DC1394_ERR_RTN(err, "camera or available is NULL");
}
*available = DC1394_FALSE;
err = dc1394_set_adv_control_register (camera, 0x0U, basler_feature_id_1);
DC1394_ERR_RTN(err, "Could not write the first quadlet of Basler feature ID");
err = dc1394_set_adv_control_register (camera, 0x4U, basler_feature_id_2);
DC1394_ERR_RTN(err, "Could not write the second quadlet of Basler feature ID");
err = dc1394_get_adv_control_register (camera, 0x0U, &data);
DC1394_ERR_RTN(err, "Could not read from the ACR");
if (data != 0xffffffff) {
*available = DC1394_TRUE;
return DC1394_SUCCESS;
}
err = dc1394_get_adv_control_register (camera, 0x4U, &data);
DC1394_ERR_RTN(err, "Could not read from ACR + 4");
if (data != 0xffffffff) {
*available = DC1394_TRUE;
return DC1394_SUCCESS;
}
/* SFF is not supported */
return DC1394_SUCCESS;
}
/**
* Tests whether the camera supports the specified SFF feature
*/
dc1394error_t
dc1394_basler_sff_feature_is_available (dc1394camera_t* camera, dc1394basler_sff_feature_t feature_id, dc1394bool_t *available)
{
const sff_feature *feature_desc = NULL;
uint64_t feature_address = 0;
dc1394error_t err;
if (camera == NULL || available == NULL) {
err = DC1394_INVALID_ARGUMENT_VALUE;
DC1394_ERR_RTN(err, "dc1394_basler_sff_feature_is_available(): camera or available is NULL");
}
feature_desc = basler_sff_registry_find_by_id (feature_id);
if (feature_desc == NULL) {
err = DC1394_FAILURE;
DC1394_ERR_RTN(err, "unknown feature");
}
/* if this feature uses has an image chunk, only allow it if the
* camera IIDC version is >= 1.30 because the _dc1394_capture_setup_basic()
* does not compute the frame byte size correctly for iidc version < 1.30 */
if (feature_desc->has_chunk && camera->iidc_version < DC1394_IIDC_VERSION_1_30) {
err = DC1394_FAILURE;
DC1394_ERR_RTN(err, "smart features which have image chunks cannot be used with cameras with a iidc_version lower than 1.30");
}
/* get address for this feature, if the address is 0x0, then this feature is not available */
err = get_sff_address_from_csr_guid (camera, &(feature_desc->csr_guid), &feature_address);
DC1394_ERR_RTN(err, "Cannot get SFF address from GUID");
if (feature_address == 0)
*available = DC1394_FALSE;
else
*available = DC1394_TRUE;
return DC1394_SUCCESS;
}
/*
* enables a specific SFF feature
*/
dc1394error_t
dc1394_basler_sff_feature_enable (dc1394camera_t* camera, dc1394basler_sff_feature_t feature_id, dc1394switch_t on_off)
{
const sff_feature *feature_desc = NULL;
uint64_t feature_address;
uint32_t data;
dc1394error_t err;
dc1394bool_t is_enabled;
if (camera == NULL) {
err = DC1394_INVALID_ARGUMENT_VALUE;
DC1394_ERR_RTN(err, "camera is NULL");
}
feature_desc = basler_sff_registry_find_by_id (feature_id);
if (feature_desc == NULL)
return DC1394_FAILURE;
/* check if this feature can be enabled by the generic function */
if (!feature_desc->generic) {
err = DC1394_FUNCTION_NOT_SUPPORTED;
DC1394_ERR_RTN(err, "cannot enable feature with the generic enable function");
}
/* we need to enable the extended data stream first if this chunk has image data */
if (feature_desc->has_chunk && feature_id != DC1394_BASLER_SFF_EXTENDED_DATA_STREAM) {
err = dc1394_basler_sff_feature_is_enabled (camera, DC1394_BASLER_SFF_EXTENDED_DATA_STREAM, &is_enabled);
DC1394_ERR_RTN (err, "Failed to get extended_data_stream status");
if (!is_enabled) {
err = dc1394_basler_sff_feature_enable (camera, DC1394_BASLER_SFF_EXTENDED_DATA_STREAM, DC1394_ON);
DC1394_ERR_RTN(err, "cannot enable Extended_Data_Stream feature prior to enabling feature");
}
}
err = get_sff_address_from_csr_guid (camera, &(feature_desc->csr_guid), &feature_address);
DC1394_ERR_RTN(err, "Cannot get SFF address from GUID");
if (feature_address == 0)
return DC1394_FAILURE;
err = dc1394_get_register (camera, feature_address, &data);
DC1394_ERR_RTN(err, "Cannot read SFF feature CSR register");
//fprintf (stderr, "%s: address = 0x%016"PRIx64" read data = 0x%08x\n", __FUNCTION__, feature_address, data);
/* enable or disable */
if (on_off) {
data |= BASLER_SFF_CSR_BIT_ENABLE;
} else {
data &= BASLER_SFF_CSR_BIT_ENABLE;
}
err = dc1394_set_register (camera, feature_address, data);
DC1394_ERR_RTN(err, "cannot write to feature CSR");
//fprintf (stderr, "%s: address = 0x%016"PRIx64" write data = 0x%08x\n", __FUNCTION__, feature_address, data);
/* check if it was enabled or disabled correctly */
err = dc1394_basler_sff_feature_is_enabled (camera, feature_id, &is_enabled);
DC1394_ERR_RTN(err, "cannot check if feature was enabled or disabled correctly");
if (on_off != is_enabled) {
err = DC1394_FAILURE;
DC1394_ERR_RTN(err, "camera reported that the feature was not in the proper state (enabled or disabled)");
}
return DC1394_SUCCESS;
}
/*
* check if a feature is enabled or not
*/
dc1394error_t
dc1394_basler_sff_feature_is_enabled (dc1394camera_t* camera, dc1394basler_sff_feature_t feature_id, dc1394bool_t *is_enabled)
{
const sff_feature *feature_desc = NULL;
uint64_t feature_address;
uint32_t data;
dc1394error_t err;
if (camera == NULL || is_enabled == NULL) {
err = DC1394_INVALID_ARGUMENT_VALUE;
DC1394_ERR_RTN(err, "camera or is_enabled is NULL");
}
feature_desc = basler_sff_registry_find_by_id (feature_id);
if (feature_desc == NULL)
return DC1394_FAILURE;
/* check if this feature can be enabled by the generic function */
if (!feature_desc->generic) {
err = DC1394_FUNCTION_NOT_SUPPORTED;
DC1394_ERR_RTN(err, "cannot check feature with the generic enable function");
}
err = get_sff_address_from_csr_guid (camera, &(feature_desc->csr_guid), &feature_address);
DC1394_ERR_RTN(err, "Cannot get SFF address from GUID");
if (feature_address == 0)
return DC1394_FAILURE;
err = dc1394_get_register (camera, feature_address, &data);
DC1394_ERR_RTN(err, "Cannot read SFF feature CSR register");
//fprintf (stderr, "%s: address = 0x%016"PRIx64" data = 0x%08x\n", __FUNCTION__, feature_address, data);
if (data & BASLER_SFF_CSR_BIT_ENABLE) {
*is_enabled = DC1394_TRUE;
} else {
*is_enabled = DC1394_FALSE;
}
return DC1394_SUCCESS;
}
/*
* print a feature
*/
dc1394error_t
dc1394_basler_sff_feature_print (dc1394camera_t* camera, dc1394basler_sff_feature_t feature_id, FILE *fd)
{
dc1394error_t err;
dc1394bool_t available;
uint64_t feature_address;
const sff_feature* feature_desc;
feature_desc = basler_sff_registry_find_by_id (feature_id);
if (feature_desc == NULL)
return DC1394_FAILURE;
if (camera == NULL) {
offline:
fprintf (fd,"Name : %s\n"
"CSR guid : %08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x\n",
feature_desc->name,
feature_desc->csr_guid.d1, feature_desc->csr_guid.d2, feature_desc->csr_guid.d3,
feature_desc->csr_guid.d4[0], feature_desc->csr_guid.d4[1], feature_desc->csr_guid.d4[2], feature_desc->csr_guid.d4[3],
feature_desc->csr_guid.d4[4], feature_desc->csr_guid.d4[5], feature_desc->csr_guid.d4[6], feature_desc->csr_guid.d4[7]);
if (feature_desc->has_chunk) {
fprintf (fd,"Has chunk : false\n"
"CHUNK guid: %08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x\n",
feature_desc->chunk_guid.d1, feature_desc->chunk_guid.d2, feature_desc->chunk_guid.d3,
feature_desc->chunk_guid.d4[0], feature_desc->chunk_guid.d4[1], feature_desc->chunk_guid.d4[2], feature_desc->chunk_guid.d4[3],
feature_desc->chunk_guid.d4[4], feature_desc->chunk_guid.d4[5], feature_desc->chunk_guid.d4[6], feature_desc->chunk_guid.d4[7]);
} else {
fprintf (fd,"Has chunk : false\n");
}
return DC1394_SUCCESS;
} else {
dc1394_basler_sff_is_available (camera, &available);
if (!available)
goto offline;
dc1394_basler_sff_feature_is_available (camera, feature_id, &available);
if (!available)
goto offline;
fprintf (fd,"Name : %s\n"
"CSR guid : %08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x\n",
feature_desc->name,
feature_desc->csr_guid.d1, feature_desc->csr_guid.d2, feature_desc->csr_guid.d3,
feature_desc->csr_guid.d4[0], feature_desc->csr_guid.d4[1], feature_desc->csr_guid.d4[2], feature_desc->csr_guid.d4[3],
feature_desc->csr_guid.d4[4], feature_desc->csr_guid.d4[5], feature_desc->csr_guid.d4[6], feature_desc->csr_guid.d4[7]);
if (feature_desc->has_chunk) {
fprintf (fd,"Has chunk : true\n"
"CHUNK guid: %08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x\n",
feature_desc->chunk_guid.d1, feature_desc->chunk_guid.d2, feature_desc->chunk_guid.d3,
feature_desc->chunk_guid.d4[0], feature_desc->chunk_guid.d4[1], feature_desc->chunk_guid.d4[2], feature_desc->chunk_guid.d4[3],
feature_desc->chunk_guid.d4[4], feature_desc->chunk_guid.d4[5], feature_desc->chunk_guid.d4[6], feature_desc->chunk_guid.d4[7]);
} else {
fprintf (fd,"Has chunk : false\n");
}
fprintf (fd,"Available : true\n");
err = get_sff_address_from_csr_guid (camera, &(feature_desc->csr_guid), &feature_address);
if (err == DC1394_SUCCESS) {
fprintf (fd,"Address : 0x%016"PRIx64"\n", feature_address);
} else {
fprintf (fd,"Address : unavailable\n");
}
}
return DC1394_SUCCESS;
}
dc1394error_t dc1394_basler_sff_feature_print_all (dc1394camera_t* camera, FILE *fd)
{
uint32_t i = DC1394_BASLER_SFF_FEATURE_MIN;
while (i < DC1394_BASLER_SFF_FEATURE_MAX) {
dc1394_basler_sff_feature_print (camera, i, fd);
fprintf (fd, "\n");
i++;
}
return DC1394_SUCCESS;
}
dc1394bool_t dc1394_basler_sff_check_crc (const uint8_t* frame_buffer, uint32_t frame_size)
{
uint32_t current_crc, desired_crc;
/* calculate the checksum, ignoring the last four bytes which is the checksum chunk */
current_crc = dc1394_checksum_crc16 (frame_buffer, frame_size - sizeof(dc1394basler_sff_crc_checksum_t));
/* retrieve the desired checksum from the buffer */
desired_crc = ((uint32_t*)frame_buffer)[frame_size / sizeof(uint32_t) - 1];
return current_crc == desired_crc;
}
/*
* Initializes the struct for iterating
*/
dc1394error_t dc1394_basler_sff_chunk_iterate_init (dc1394basler_sff_t* chunk, void *frame_buffer, uint32_t frame_size, dc1394bool_t has_crc_checksum)
{
if (chunk == NULL || frame_buffer == NULL || frame_size == 0)
return DC1394_FAILURE;
chunk->feature_id = DC1394_BASLER_SFF_FEATURE_MAX; /* invalid feature id */
chunk->frame_buffer = frame_buffer;
chunk->frame_size = frame_size;
/* if this frame has a checksum, we move the end position by
* sizeof(crc_checksum) to the beginning, because we are not
* interested in parsing it */
if (has_crc_checksum)
chunk->frame_size -= sizeof(dc1394basler_sff_crc_checksum_t);
chunk->current_iter = chunk->frame_buffer + chunk->frame_size;
chunk->chunk_data = NULL;
return DC1394_SUCCESS;
}
/**
* Iterates over the available SFF chunks in the frame buffer
*/
dc1394error_t dc1394_basler_sff_chunk_iterate (dc1394basler_sff_t* chunk)
{
dc1394basler_sff_chunk_tail_t* tail;
const sff_feature* feature_desc;
if (chunk == NULL || chunk->current_iter == NULL || chunk->frame_buffer == NULL)
return DC1394_INVALID_ARGUMENT_VALUE;
if (chunk->frame_buffer >= chunk->current_iter ||
chunk->current_iter - chunk->frame_buffer <= sizeof(dc1394basler_sff_chunk_tail_t))
return DC1394_BASLER_NO_MORE_SFF_CHUNKS;
/* try to extract at least one chunk tail */
tail = chunk->current_iter - sizeof(dc1394basler_sff_chunk_tail_t);
/* check if the size field is correct */
if (~(tail->chunk_size) != tail->inverted_chunk_size)
return DC1394_BASLER_CORRUPTED_SFF_CHUNK;
if (chunk->current_iter - chunk->frame_buffer < tail->chunk_size)
return DC1394_BASLER_CORRUPTED_SFF_CHUNK;
/* check if we know this chunk's type */
feature_desc = basler_sff_registry_find_by_chunk_guid (&(tail->chunk_guid));
if (feature_desc == NULL)
return DC1394_BASLER_UNKNOWN_SFF_CHUNK;
chunk->feature_id = feature_desc->feature_id;
/* set data pointer, here we cannot use the size field from the chunk tail
* because one chunk type the extended data stream has not the same in size
* in the image stream as has the C type, therefore for clarities sake
* the size of the C type is stored in the feature_desc */
chunk->chunk_data = chunk->current_iter - feature_desc->data_size;
/* but we must move the current_iter by the size in the tail */
chunk->current_iter -= tail->chunk_size;
return DC1394_SUCCESS;
}
/**
* Finds a specific SFF chunk in the frame buffer
*/
dc1394error_t dc1394_basler_sff_chunk_find (dc1394basler_sff_feature_t feature_id, void** chunk_data, void* frame_buffer, uint32_t frame_size, dc1394bool_t has_crc_checksum)
{
dc1394basler_sff_t chunk;
dc1394bool_t found = DC1394_FALSE;
dc1394error_t err;
err = dc1394_basler_sff_chunk_iterate_init (&chunk, frame_buffer, frame_size, has_crc_checksum);
DC1394_ERR_RTN(err, "dc1394_basler_sff_chunk_find(): dc1394_basler_sff_chunk_iterate_init() failed");
while ((err = dc1394_basler_sff_chunk_iterate (&chunk)) == DC1394_SUCCESS) {
if (chunk.feature_id == feature_id) {
found = DC1394_TRUE;
break;
}
}
if (!found)
return DC1394_FAILURE;
if (chunk_data)
*chunk_data = chunk.chunk_data;
return DC1394_SUCCESS;
}

95
dc1394/vendor/basler.h vendored Normal file
View File

@ -0,0 +1,95 @@
/*
* 1394-Based Digital Camera Control Library
*
* Basler Smart Feature Framework specific extensions
*
* Written by Mikael Olenfalk <mikael _DOT_ olenfalk _AT_ tobii _DOT_ com>
*
* Copyright (C) 2006 Tobii Technology AB, Stockholm Sweden
*
* 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
*/
#ifndef __DC1394_VENDOR_BASLER_H__
#define __DC1394_VENDOR_BASLER_H__
#include "basler_sff.h"
/*! \file dc1394/vendor/basler.h
\brief No docs yet
More details soon
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* Tests whether the camera supports Basler SFF
*/
dc1394error_t dc1394_basler_sff_is_available (dc1394camera_t* camera, dc1394bool_t *available);
/**
* Tests whether the camera supports the specified SFF feature
*/
dc1394error_t dc1394_basler_sff_feature_is_available (dc1394camera_t* camera, dc1394basler_sff_feature_t feature_id, dc1394bool_t *available);
/**
* Enables or disables a specific feature
*/
dc1394error_t dc1394_basler_sff_feature_enable (dc1394camera_t* camera, dc1394basler_sff_feature_t feature_id, dc1394switch_t on_off);
/**
* checks if a feature has been enabled
*/
dc1394error_t dc1394_basler_sff_feature_is_enabled (dc1394camera_t* camera, dc1394basler_sff_feature_t feature_id, dc1394bool_t *is_enabled);
/**
* Checks the crc checksum of the supplied frame
*/
dc1394bool_t dc1394_basler_sff_check_crc (const uint8_t* frame_buffer, uint32_t frame_size);
/**
* Initializes an iteration
*/
dc1394error_t dc1394_basler_sff_chunk_iterate_init (dc1394basler_sff_t* chunk, void *frame_buffer, uint32_t frame_size, dc1394bool_t has_crc_checksum);
/**
* Iterates over the available SFF chunks in the frame buffer
*/
dc1394error_t dc1394_basler_sff_chunk_iterate (dc1394basler_sff_t* chunk);
/**
* Finds a specific SFF chunk in the frame buffer
*/
dc1394error_t dc1394_basler_sff_chunk_find (dc1394basler_sff_feature_t feature_id, void** chunk_data, void* frame_buffer, uint32_t frame_size, dc1394bool_t has_crc_checksum);
/**
* prints info about one feature
*/
dc1394error_t dc1394_basler_sff_feature_print (dc1394camera_t* camera, dc1394basler_sff_feature_t feature_id, FILE *fd);
/**
* prints info about all features
*/
dc1394error_t dc1394_basler_sff_feature_print_all (dc1394camera_t* camera, FILE *fd);
#ifdef __cplusplus
}
#endif
#endif

303
dc1394/vendor/basler_sff.h vendored Normal file
View File

@ -0,0 +1,303 @@
/*
* 1394-Based Digital Camera Control Library
*
* Basler Smart Feature Framework specific extensions
*
* Written by Mikael Olenfalk <mikael _DOT_ olenfalk _AT_ tobii _DOT_ com>
*
* Copyright (C) 2006 Tobii Technology AB, Stockholm Sweden
*
* 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
*/
#ifndef __DC1394_VENDOR_BASLER_SFF_H__
#define __DC1394_VENDOR_BASLER_SFF_H__
#include <stdint.h>
/*! \file dc1394/vendor/basler_sff.h
\brief No docs yet
More details soon
*/
/**
* \struct dc1394basler_sff_guid_t
* Basler SFF Guid struct, this structure is used to identify chunks and to
* request features from the camera, is basically just a normal GUID value
*/
typedef struct __dc1394basler_sff_guid_t {
uint32_t d1;
uint16_t d2, d3;
uint8_t d4[8];
} dc1394basler_sff_guid_t;
/**
* \struct dc1394basler_sff_chunk_tail_t
* SFF chunks are read from the end to the beginning (that is backwards),
* each chunk ends in a chunk-tail, which contains information about the
* size of the chunk as well as the GUID used to identify which chunk this
* really is.
*/
typedef struct __dc1394basler_sff_chunk_tail_t {
dc1394basler_sff_guid_t chunk_guid; /**< the chunk GUID, this is different from
the CSR GUID used to request the feature */
uint32_t chunk_size; /**< the size of this chunk, including this struct */
uint32_t inverted_chunk_size; /**< the bitwise complement of the chunk size */
} dc1394basler_sff_chunk_tail_t;
/**
* SFF feature IDs
*/
typedef enum dc1394basler_sff_feature_t {
DC1394_BASLER_SFF_FEATURE_MIN = 0,
/**
* SFF Extended data stream, this feature must be enabled
* in order to use any other smart feature.
* Please refer to struct dc1394basler_sff_extended_data_stream
* for more information.
*/
DC1394_BASLER_SFF_EXTENDED_DATA_STREAM = 0,
/**
* The frame counter feature numbers images sequentially as they
* are captured, the counter starts at 0 and wraps at 2^32-1.
* The counter increments by one for each captured frame.
* Whenever the camera is powered off, the counter resets to 0.
* Please refer to struct dc1394basler_sff_frame_counter_t
* for more information.
*/
DC1394_BASLER_SFF_FRAME_COUNTER,
/**
* The cycle time stamp feature adds a chunk to each image frame
* containing the value of the IEEE1394 bus cycle timer.
* These counters are sampled at the start of exposure of each image.
* Please refer to struct dc1394basler_sff_cycle_time_stamp
* for more information.
*/
DC1394_BASLER_SFF_CYCLE_TIME_STAMP,
/**
* The DCAM values smart features adds a chunk to each image
* containing the current settings for some standard DCAM features.
* The settings are sampled at the start of exposure of each image.
* Please refer to struct dc1394basler_sff_dcam_values_t
* for more information.
*/
DC1394_BASLER_SFF_DCAM_VALUES,
/**
* The CRC checksum feature adds a chunk to each image frame
* containing a 16bit CRC checksum computed using the Z-modem
* algorithm. The checksum is computed for all the image data
* and all other SFF chunks except the CRC checksum chunk.
* Please refer to the function dc1394_basler_validate_checksum()
* for more information
*/
DC1394_BASLER_SFF_CRC_CHECKSUM,
/**
* The test images feature is used to check the camera's basic
* functionality and its ability to transmit an image via
* the video data cable. The test image can be used for
* service purposes and for failure diagnostics. In test mode
* the image is generated with a software program and the camera's
* digital devices and does not use the optics the pixel array
* or the ADCs.
*
* <b>This feature is not implemented</b>
*/
DC1394_BASLER_SFF_TEST_IMAGES,
/**
* Basler cameras include a register that contains version numbers
* for the camera's internal software. For troubleshooting
* purposes, Basler technical support may ask you to read
* this register and to supply the results.
*
* <b>This feature is not implemented</b>
*/
DC1394_BASLER_SFF_EXTENDED_VERSION_INFO,
/**
* <b>This feature is not implemented</b>
*/
DC1394_BASLER_SFF_LOOKUP_TABLE,
/**
* <b>This feature is not implemented</b>
*/
DC1394_BASLER_SFF_TRIGGER_FLAG_AND_COUNTER,
/**
* <b>This feature is not implemented</b>
*/
DC1394_BASLER_SFF_OUTPUT_PORT_0_CONFIGURATION,
/**
* <b>This feature is not implemented</b>
*/
DC1394_BASLER_SFF_OUTPUT_PORT_1_CONFIGURATION,
/**
* <b>This feature is not implemented</b>
*/
DC1394_BASLER_SFF_OUTPUT_PORT_2_CONFIGURATION,
/**
* <b>This feature is not implemented</b>
*/
DC1394_BASLER_SFF_OUTPUT_PORT_3_CONFIGURATION,
DC1394_BASLER_SFF_FEATURE_MAX
} dc1394basler_sff_feature_t;
/**
* \struct dc1394basler_sff_t
* Data type used by this API to define SFFs and also when iterating
*/
typedef struct __dc1394basler_sff_t {
dc1394basler_sff_feature_t feature_id;
/* the following members are used for iterating */
void* frame_buffer;
uint32_t frame_size;
void* current_iter;
/* when iterating this member points to the beginning
* to the data for this chunk, in order to use it should
* be casted to a pointer of the type for this feature */
void* chunk_data;
} dc1394basler_sff_t;
/**
* This structure is used to capture the SFF extended data stream chunk.
* According to the Basler manuals the extended data stream chunk
* also contains to members pixel_data and gap of variable size;
* these members are ignored in this API because they can be obtained
* from other sources. The pixel_data member which is the actual image frame
* is all data from the beginning of the frame buffer until width*height*bytes_per_pixel
* bytes. The gap is required on some cameras for technical reason but not used
* otherwise. The size of the gap can be computed by computing
* frame_size - sizeof all chunks - image_size.
*/
typedef struct dc1394basler_sff_extended_data_stream_t {
/* pixel_data and gap members ignored, because they are not needed in this context */
uint32_t stride;
uint8_t reserved3[3];
uint8_t data_depth;
uint16_t top;
uint16_t left;
uint16_t height;
uint16_t width;
uint8_t reserved2[3];
uint8_t color_coding_id;
uint8_t reserved1[3];
uint8_t color_filter_id;
dc1394basler_sff_chunk_tail_t tail;
} dc1394basler_sff_extended_data_stream_t;
/**
* No Docs
*/
typedef struct dc1394basler_sff_frame_counter_t {
uint32_t counter;
dc1394basler_sff_chunk_tail_t tail;
} dc1394basler_sff_frame_counter_t;
/**
* No Docs
*/
typedef struct dc1394basler_sff_cycle_time_stamp_t {
union {
struct {
uint32_t cycle_offset: 12;
uint32_t cycle_count: 13;
uint32_t second_count: 7;
} structured;
struct {
uint32_t value;
} unstructured;
} cycle_time_stamp;
} dc1394basler_sff_cycle_time_stamp_t;
/**
* No Docs
*/
typedef struct dc1394basler_dcam_csr_value_t {
uint32_t value: 12;
uint32_t reserved2: 12;
uint32_t a_m_mode: 1;
uint32_t on_off: 1;
uint32_t one_push: 1;
uint32_t reserved1: 2;
uint32_t abs_control: 1;
uint32_t presence_inq: 1;
} dc1394basler_dcam_csr_value_t;
/**
* No Docs
*/
typedef struct dc1394basler_dcam_whitebalance_csr_value_t {
uint32_t v_r_value: 12;
uint32_t u_b_value: 12;
uint32_t a_m_mode: 1;
uint32_t on_off: 1;
uint32_t one_push: 1;
uint32_t reserved1: 2;
uint32_t abs_control: 1;
uint32_t presence_inq: 1;
} dc1394basler_dcam_whitebalance_csr_value_t;
/**
* No Docs
*/
typedef struct dc1394basler_sff_dcam_values_t {
/* gain */
dc1394basler_dcam_csr_value_t gain_csr;
uint32_t gain_absolute_value;
/* shutter */
dc1394basler_dcam_csr_value_t shutter_csr;
uint32_t shutter_absolute_value;
/* gamma */
dc1394basler_dcam_csr_value_t gamma_csr;
uint32_t gamma_absolute_value;
/* white balance */
dc1394basler_dcam_whitebalance_csr_value_t whitebalance_csr;
uint32_t whitebalance_absolute_value;
/* brightness */
dc1394basler_dcam_csr_value_t brightness_csr;
uint32_t brightness_absolute_value;
/* tail */
dc1394basler_sff_chunk_tail_t tail;
} dc1394basler_sff_dcam_values_t;
/**
* No Docs
*/
typedef struct dc1394basler_sff_crc_checksum_t {
uint8_t crc_checksum_low;
uint8_t crc_checksum_high;
uint8_t reserved1;
uint8_t reserved2;
} dc1394basler_sff_crc_checksum_t;
#endif

219
dc1394/vendor/basler_sff_registry.c vendored Normal file
View File

@ -0,0 +1,219 @@
/*
* 1394-Based Digital Camera Control Library
*
* Basler Smart Feature Framework specific extensions
*
* Written by Mikael Olenfalk <mikael _DOT_ olenfalk _AT_ tobii _DOT_ com>
*
* Copyright (C) 2006 Tobii Technology AB, Stockholm Sweden
*
* 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
*/
#include <memory.h>
#include <stdint.h>
#include "../control.h"
#include "basler_sff_registry.h"
const struct sff_feature const sff_feature_registry[] = {
/* DC1394_BASLER_SFF_EXTENDED_DATA_STREAM */
{
/* name */ "Extended Data Stream",
/* feature_id */ DC1394_BASLER_SFF_EXTENDED_DATA_STREAM,
/* csr_guid */ {0x4e7abcb0, 0x1b84, 0x11d8, {0x96, 0x51, 0x00, 0x10, 0x5a, 0x5b, 0xae, 0x55}},
/* chunk_guid */ {0x94ed7c88, 0x1c0f, 0x11d8, {0x82, 0xe0, 0x00, 0x10, 0x5a, 0x5b, 0xae, 0x55}},
/* has_chunk */ DC1394_TRUE,
/* generic */ DC1394_TRUE,
/* data_size */ sizeof(dc1394basler_sff_extended_data_stream_t)
},
/* DC1394_BASLER_SFF_FRAME_COUNTER */
{
/* name */ "Frame Counter",
/* feature_id */ DC1394_BASLER_SFF_FRAME_COUNTER,
/* csr_guid */ {0x4433c4a4, 0x1b84, 0x11d8, {0x86, 0xb2, 0x00, 0x10, 0x5a, 0x5b, 0xae, 0x55}},
/* chunk_guid */ {0x8c5db844, 0x1c0f, 0x11d8, {0x96, 0x5f, 0x00, 0x10, 0x5a, 0x5b, 0xae, 0x55}},
/* has_chunk */ DC1394_TRUE,
/* generic */ DC1394_TRUE,
/* data_size */ sizeof(dc1394basler_sff_frame_counter_t)
},
/* DC1394_BASLER_SFF_CYCLE_TIME_STAMP */
{
/* name */ "Cycle Time Stamp",
/* feature_id */ DC1394_BASLER_SFF_CYCLE_TIME_STAMP,
/* csr_guid */ {0x5590d58e, 0x1b84, 0x11d8, {0x84, 0x47, 0x00, 0x10, 0x5a, 0x5b, 0xae, 0x55}},
/* chunk_guid */ {0x994dd430, 0x1c0f, 0x11d8, {0x8f, 0x6b, 0x00, 0x10, 0x5a, 0x5b, 0xae, 0x55}},
/* has_chunk */ DC1394_TRUE,
/* generic */ DC1394_TRUE,
/* data_size */ sizeof(dc1394basler_sff_cycle_time_stamp_t)
},
/* DC1394_BASLER_SFF_DCAM_VALUES */
{
/* name */ "DCAM Values",
/* feature_id */ DC1394_BASLER_SFF_DCAM_VALUES,
/* csr_guid */ {0x494de528, 0x1b84, 0x11d8, {0x8a, 0x0c, 0x00, 0x10, 0x5a, 0x5b, 0xae, 0x55}},
/* chunk_guid */ {0x911c8982, 0x1c0f, 0x11d8, {0x8a, 0xf0, 0x00, 0x10, 0x5a, 0x5b, 0xae, 0x55}},
/* has_chunk */ DC1394_TRUE,
/* generic */ DC1394_TRUE,
/* data_size */ sizeof(dc1394basler_sff_dcam_values_t)
},
/* DC1394_BASLER_SFF_CRC_CHECKSUM */
{
/* name */ "CRC Checksum",
/* feature_id */ DC1394_BASLER_SFF_CRC_CHECKSUM,
/* csr_guid */ {0x3b34004e, 0x1b84, 0x11d8, {0x83, 0xb3, 0x00, 0x10, 0x5a, 0x5b, 0xae, 0x55}},
/* chunk_guid */ {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0} /* not used */ },
/* has_chunk */ DC1394_FALSE,
/* generic */ DC1394_TRUE,
/* data_size */ 0
},
/* DC1394_BASLER_SFF_TEST_IMAGES */
{
/* name */ "Test Images",
/* feature_id */ DC1394_BASLER_SFF_TEST_IMAGES,
/* csr_guid */ {0x2a411342, 0xc0ca, 0x4368, {0xb4, 0x6e, 0xee, 0x5d, 0xee, 0xbf, 0x05, 0x48}},
/* chunk_guid */ {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0} /* not used */ },
/* has_chunk */ DC1394_FALSE,
/* generic */ DC1394_FALSE,
/* data_size */ 0
},
/* DC1394_BASLER_SFF_EXTENDED_VERSION_INFO */
{
/* name */ "Extended Version Info",
/* feature_id */ DC1394_BASLER_SFF_EXTENDED_VERSION_INFO,
/* csr_guid */ {0x2b2d8714, 0xc15e, 0x4176, {0xa2, 0x35, 0x6e, 0xf8, 0x43, 0xd7, 0x47, 0xb4}},
/* chunk_guid */ {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0} /* not used */ },
/* has_chunk */ DC1394_FALSE,
/* generic */ DC1394_FALSE,
/* data_size */ 0
},
/* DC1394_BASLER_SFF_LOOKUP_TABLE */
{
/* name */ "Lookup Table",
/* feature_id */ DC1394_BASLER_SFF_LOOKUP_TABLE,
/* csr_guid */ {0xb28c667c, 0xdf9d, 0x11d7, {0x86, 0x93, 0x00, 0x0c, 0x6e, 0x0b, 0xd1, 0xb0}},
/* chunk_guid */ {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0} /* not used */ },
/* has_chunk */ DC1394_FALSE,
/* generic */ DC1394_TRUE,
/* data_size */ 0
},
/* DC1394_BASLER_SFF_TRIGGER_FLAG_AND_COUNTER */
{
/* name */ "Trigger Flag and Counter",
/* feature_id */ DC1394_BASLER_SFF_TRIGGER_FLAG_AND_COUNTER,
/* csr_guid */ {0x16c31a78, 0x3f75, 0x11d8, {0x94, 0xec, 0x00, 0x10, 0x5a, 0x5b, 0xae, 0x55}},
/* chunk_guid */ {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0} /* not used */ },
/* has_chunk */ DC1394_FALSE,
/* generic */ DC1394_FALSE,
/* data_size */ 0
},
/* DC1394_BASLER_SFF_OUTPUT_PORT_0_CONFIGURATION */
{
/* name */ "Output Port 0 Configuration",
/* feature_id */ DC1394_BASLER_SFF_OUTPUT_PORT_0_CONFIGURATION,
/* csr_guid */ {0x5a889d7e, 0x41e5, 0x11d8, {0x84, 0x5b, 0x00, 0x10, 0x5a, 0x5b, 0xae, 0x55}},
/* chunk_guid */ {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0} /* not used */ },
/* has_chunk */ DC1394_FALSE,
/* generic */ DC1394_FALSE,
/* data_size */ 0
},
/* DC1394_BASLER_SFF_OUTPUT_PORT_1_CONFIGURATION */
{
/* name */ "Output Port 1 Configuration",
/* feature_id */ DC1394_BASLER_SFF_OUTPUT_PORT_1_CONFIGURATION,
/* csr_guid */ {0x949d820a, 0x4513, 0x11d8, {0x9e, 0xb1, 0x00, 0x10, 0x5a, 0x5b, 0xae, 0x55}},
/* chunk_guid */ {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0} /* not used */ },
/* has_chunk */ DC1394_FALSE,
/* generic */ DC1394_FALSE,
/* data_size */ 0
},
/* DC1394_BASLER_SFF_OUTPUT_PORT_2_CONFIGURATION */
{
/* name */ "Output Port 2 Configuration",
/* feature_id */ DC1394_BASLER_SFF_OUTPUT_PORT_2_CONFIGURATION,
/* csr_guid */ {0xc14e5072, 0x4513, 0x11d8, {0x81, 0xf3, 0x00, 0x10, 0x5a, 0x5b, 0xae, 0x55}},
/* chunk_guid */ {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0} /* not used */ },
/* has_chunk */ DC1394_FALSE,
/* generic */ DC1394_FALSE,
/* data_size */ 0
},
/* DC1394_BASLER_SFF_OUTPUT_PORT_3_CONFIGURATION */
{
/* name */ "Output Port 3 Configuration",
/* feature_id */ DC1394_BASLER_SFF_OUTPUT_PORT_3_CONFIGURATION,
/* csr_guid */ {0x949d820a, 0x4513, 0x11d8, {0x9e, 0xb1, 0x00, 0x10, 0x5a, 0x5b, 0xae, 0x55}},
/* chunk_guid */ {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0} /* not used */ },
/* has_chunk */ DC1394_FALSE,
/* generic */ DC1394_FALSE,
/* data_size */ 0
}
};
const uint32_t sff_feature_registry_size = sizeof (sff_feature_registry) / sizeof (sff_feature);
/*
* finds a feature by its API id
*/
const sff_feature* basler_sff_registry_find_by_id (dc1394basler_sff_feature_t feature_id)
{
if (feature_id < DC1394_BASLER_SFF_FEATURE_MIN ||
feature_id >= DC1394_BASLER_SFF_FEATURE_MAX ||
feature_id >= sff_feature_registry_size)
return NULL;
return &(sff_feature_registry[feature_id]);
}
/*
* finds a feature by its CSR GUID
*/
const sff_feature* basler_sff_registry_find_by_csr_guid (dc1394basler_sff_guid_t* csr_guid)
{
uint32_t i;
if (csr_guid == NULL)
return NULL;
for(i = 0; i < sff_feature_registry_size; i++) {
if (!memcmp (&(sff_feature_registry[i].csr_guid), csr_guid, sizeof(dc1394basler_sff_guid_t)))
return &(sff_feature_registry[i]);
}
return NULL;
}
/*
* finds a feature by its CHUNK GUID
*/
const sff_feature* basler_sff_registry_find_by_chunk_guid (dc1394basler_sff_guid_t* chunk_guid)
{
uint32_t i;
if (chunk_guid == NULL)
return NULL;
for(i = 0; i < sff_feature_registry_size; i++) {
if (!memcmp (&(sff_feature_registry[i].chunk_guid), chunk_guid, sizeof(dc1394basler_sff_guid_t)))
return &(sff_feature_registry[i]);
}
return NULL;
}

74
dc1394/vendor/basler_sff_registry.h vendored Normal file
View File

@ -0,0 +1,74 @@
/*
* 1394-Based Digital Camera Control Library
*
* Basler Smart Feature Framework specific extensions
*
* Written by Mikael Olenfalk <mikael _DOT_ olenfalk _AT_ tobii _DOT_ com>
*
* Copyright (C) 2006 Tobii Technology AB, Stockholm Sweden
*
* 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
*/
#ifndef __DC1394_VENDOR_BASLER_SFF_REGISTRY_H__
#define __DC1394_VENDOR_BASLER_SFF_REGISTRY_H__
#include "basler_sff.h"
/*! \file dc1394/vendor/basler_sff_registry.h
\brief No docs yet
More details soon
*/
typedef struct sff_feature {
/** human-readable name of the feature */
const char* name;
/** the feature id */
dc1394basler_sff_feature_t feature_id;
/** the CSR guid used for looking up the CSR address */
dc1394basler_sff_guid_t csr_guid;
/** the CHUNK guid, used for associating a chunk with a feature id */
dc1394basler_sff_guid_t chunk_guid;
/** whether this feature has an image chunk */
dc1394bool_t has_chunk;
/** whether this feature can be enabled by the generic dc1394_basler_sff_feature_enable() */
dc1394bool_t generic;
/** the size of the C type in the image chunk */
uint32_t data_size;
} sff_feature;
/**
* Returns a sff feature descriptor by id
*/
const sff_feature* basler_sff_registry_find_by_id (dc1394basler_sff_feature_t feature_id);
/**
* Returns a sff feature descriptor by CSR guid
*/
const sff_feature* basler_sff_registry_find_by_csr_guid (dc1394basler_sff_guid_t* csr_guid);
/**
* Returns a sff feature descriptor by CHUNK guid
*/
const sff_feature* basler_sff_registry_find_by_chunk_guid (dc1394basler_sff_guid_t* csr_guid);
#endif

623
dc1394/vendor/pixelink.c vendored Normal file
View File

@ -0,0 +1,623 @@
/*
* 1394-Based Digital Camera Control Library
*
* Pixelink (PxL) specific extensions for Multi-camera control.
*
* Written by
* Aravind Sundaresan <a.sundaresan@gmail.com>
* James Sherman <shermanj@umd.edu>
*
* Copyright (C) 2006 Tobii Technology AB, Stockholm Sweden
*
* 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
*/
#include "config.h"
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_WINDOWS
#include <windows.h>
#else
#include <arpa/inet.h>
#endif
#include "vendor/pixelink.h"
#include "log.h"
/******************************************************************************
* Function to convert float to quadlet (32 bit floating point representation)
*/
dc1394error_t
dc1394_pxl_convert_float32_to_quadlet(double d, uint32_t *i)
{
dc1394error_t retval;
float32_t f = d;
memcpy((void *)i, (void *)&f, sizeof(uint32_t));
if (sizeof(uint32_t) == sizeof(float32_t)) {
retval = DC1394_SUCCESS;
}
else {
retval = DC1394_FAILURE;
}
return retval;
}
/******************************************************************************
* Function to convert uint32_t (32 bit float representation) to float
*/
dc1394error_t
dc1394_pxl_convert_uint32_to_float32(uint32_t i, double *d)
{
dc1394error_t retval;
float32_t f;
memcpy((void *)&f, (void *)&i, sizeof(float32_t));
*d = (double) f;
if (sizeof(uint32_t) == sizeof(float32_t)) {
retval = DC1394_SUCCESS;
}
else {
retval = DC1394_FAILURE;
}
return retval;
}
/******************************************************************************
* Function to read N bytes from a camera location
* Internal function.
*/
dc1394error_t
dc1394_pxl_read_n_bytes(dc1394camera_t *camera, uint32_t offset, char *str, uint32_t n)
{
if (camera == NULL)
return DC1394_FAILURE;
uint32_t quadlet;
uint32_t i;
for (i = 0; i < n; i+=4) {
dc1394_get_register(camera, (uint64_t)offset*4+i, &quadlet);
quadlet = ntohl(quadlet);
memcpy((void *)(str+i), (void *)&quadlet, sizeof(quadlet));
}
return DC1394_SUCCESS;
}
/******************************************************************************
* Function to get the camera serial number as unsigned integer.
* As opposed to getting all parameters, this is a quick way to just identify
* the camera.
*/
dc1394error_t
dc1394_pxl_get_camera_serial_number(dc1394camera_t *camera, uint32_t *serial_num_int)
{
if (camera == NULL)
return DC1394_FAILURE;
uint32_t serial_num_offset, serial_num_length;
dc1394_get_adv_control_register(camera, PxL_ACR_SERIAL_NUM_OFFSET,
&serial_num_offset);
dc1394_get_adv_control_register(camera, PxL_ACR_SERIAL_NUM_LENGTH,
&serial_num_length);
char *serial_num = (char *) malloc((serial_num_length/4+1)*4);
dc1394_pxl_read_n_bytes(camera, serial_num_offset, serial_num, serial_num_length);
*serial_num_int = atoi(serial_num);
free(serial_num);
return DC1394_SUCCESS;
}
/******************************************************************************
* Function to get the camera info.
* All strings that are read are hard limited to PxL_MAX_STRING_LENGTH.
*/
dc1394error_t
dc1394_pxl_get_camera_info(dc1394camera_t *camera, dc1394_pxl_camera_info_t *camera_info)
{
if (camera == NULL)
return DC1394_FAILURE;
uint32_t serial_num_offset, serial_num_length,
camera_desc_offset, camera_desc_length;
dc1394_get_adv_control_register(camera, PxL_ACR_FPGA_VERSION,
&(camera_info->fpga_version));
dc1394_get_adv_control_register(camera, PxL_ACR_FW_VERSION,
&(camera_info->fw_version));
dc1394_get_adv_control_register(camera, PxL_ACR_SERIAL_NUM_OFFSET,
&serial_num_offset);
dc1394_get_adv_control_register(camera, PxL_ACR_SERIAL_NUM_LENGTH,
&serial_num_length);
dc1394_get_adv_control_register(camera, PxL_ACR_CAMERA_DESC_OFFSET,
&camera_desc_offset);
dc1394_get_adv_control_register(camera, PxL_ACR_CAMERA_DESC_LENGTH,
&camera_desc_length);
#ifdef PIXELINK_DEBUG_LOWEST_LEVEL
fprintf(stdout, "%-26s: %08x\n", "SERIAL_NUM", serial_num_offset);
fprintf(stdout, "%-26s: %08x\n", "SERIAL_NUM_LENGTH", serial_num_length);
fprintf(stdout, "%-26s: %08x\n", "CAMERA_DESC", camera_desc_offset);
fprintf(stdout, "%-26s: %08x\n", "CAMERA_DESC_LENGTH", camera_desc_length);
#endif
serial_num_length = (serial_num_length < PxL_MAX_STRING_LENGTH)?
serial_num_length: PxL_MAX_STRING_LENGTH;
dc1394_pxl_read_n_bytes(camera, serial_num_offset, camera_info->serial_number, serial_num_length);
camera_info->serial_number[PxL_MAX_STRING_LENGTH-1] = '\0';
camera_desc_length = (camera_desc_length < PxL_MAX_STRING_LENGTH)?
camera_desc_length: PxL_MAX_STRING_LENGTH;
dc1394_pxl_read_n_bytes(camera, camera_desc_offset, camera_info->description, camera_desc_length);
camera_info->description[PxL_MAX_STRING_LENGTH-1] = '\0';
return DC1394_SUCCESS;
}
/******************************************************************************
* Function to get the camera info.
* All strings that are read are hard limited to PxL_MAX_STRING_LENGTH.
*/
dc1394error_t
dc1394_pxl_get_adv_feature_info(dc1394camera_t *camera, dc1394_pxl_adv_feature_info_t *adv_feature_info)
{
if (camera == NULL)
return DC1394_FAILURE;
uint32_t name_inquiry, name_offset, name_length;
dc1394_get_adv_control_register(camera, PxL_ACR_NAME_INQUIRY, &name_inquiry);
dc1394_get_adv_control_register(camera, PxL_ACR_NAME_OFFSET, &name_offset);
dc1394_get_adv_control_register(camera, PxL_ACR_NAME_LENGTH, &name_length);
if (name_inquiry & 0x80000000) {
adv_feature_info->name_presence = DC1394_FALSE;
name_length = (name_length < PxL_MAX_STRING_LENGTH)?
name_length: PxL_MAX_STRING_LENGTH;
dc1394_pxl_read_n_bytes(camera, name_offset, adv_feature_info->name, name_length);
adv_feature_info->name[PxL_MAX_STRING_LENGTH-1] = '\0';
}
else
{
adv_feature_info->name_presence = DC1394_FALSE;
adv_feature_info->name[0] = '\0';
}
adv_feature_info->name_offset = name_offset;
return DC1394_SUCCESS;
}
/*****************************************************************************
* Function to get the GPIO (General Purpose Input Output) information.
* The GPIO functionality comes under Advanced Features, but are functionally
* different enought to warrant their own structure.
*/
dc1394error_t
dc1394_pxl_get_gpio_inq(dc1394camera_t *camera, dc1394_pxl_gpio_info_t *gpio_info)
{
uint32_t gpio_inq;
if (camera == NULL)
return DC1394_FAILURE;
uint32_t address = PxL_ACR_GPIO_INQ;
dc1394_get_adv_control_register(camera, address, &gpio_inq);
#ifdef PIXELINK_DEBUG_DISPLAY
printf(" 0x%08x : r 0x%08x < GPIO_INQ\n", address, gpio_inq);
#endif
uint32_t bit = 0x1UL << 31;
gpio_info->number = (gpio_inq>>24) & 0x0FUL;
gpio_info->presence = gpio_inq & (bit>> 0)? DC1394_TRUE: DC1394_FALSE;
gpio_info->polarity = gpio_inq & (bit>> 1)? DC1394_TRUE: DC1394_FALSE;
gpio_info->mode_strobe = gpio_inq & (bit>> 8)? DC1394_TRUE: DC1394_FALSE;
gpio_info->mode_normal = gpio_inq & (bit>> 9)? DC1394_TRUE: DC1394_FALSE;
gpio_info->mode_pulse = gpio_inq & (bit>>10)? DC1394_TRUE: DC1394_FALSE;
gpio_info->mode_busy = gpio_inq & (bit>>11)? DC1394_TRUE: DC1394_FALSE;
gpio_info->mode_flash = gpio_inq & (bit>>12)? DC1394_TRUE: DC1394_FALSE;
if (gpio_info->presence == DC1394_FALSE) {
gpio_info->number = 0;
gpio_info->polarity = DC1394_FALSE;
gpio_info->mode_strobe = DC1394_FALSE;
gpio_info->mode_normal = DC1394_FALSE;
gpio_info->mode_pulse = DC1394_FALSE;
gpio_info->mode_busy = DC1394_FALSE;
gpio_info->mode_flash = DC1394_FALSE;
}
#ifdef PIXELINK_DEBUG_LOWEST_LEVEL
printf("\n");
printf(" Presence ---------------------------------+\n");
printf(" Polarity inq ----------------------------+|\n");
printf(" Number of supported GPIOs ---------+--+ ||\n");
printf(" Strobe mode ----------------------+| | ||\n");
printf(" Normal mode ---------------------+|| | ||\n");
printf(" Pulse mode ---------------------+||| | ||\n");
printf(" Busy mode ---------------------+|||| | ||\n");
printf(" ||||| | ||\n");
printf(" GPIO_INQ : ");
uint32_t i;
for (i = 0; i < 32; i++) {
(gpio_inq & (1<<i))? printf("1"): printf("0");
}
printf("\n\n");
#endif
return DC1394_SUCCESS;
}
/*****************************************************************************
* Function to get the GPO parameters Parameter1, Parameter2, Parameter3
*/
dc1394error_t
dc1394_pxl_get_gpo_param(dc1394camera_t *camera, uint32_t gpio_id,
uint32_t *p1_val, uint32_t *p2_val, uint32_t *p3_val)
{
dc1394error_t err;
dc1394_pxl_gpio_info_t gpio_info;
err = dc1394_pxl_get_gpio_inq(camera, &gpio_info);
if (err == DC1394_FAILURE) {
return DC1394_FAILURE;
}
if (!(gpio_info.presence && gpio_id < gpio_info.number)) {
return DC1394_FAILURE;
}
uint32_t gpio_parm1_abs, gpio_parm2_abs, gpio_parm3_abs;
dc1394_get_adv_control_register(camera, PxL_ACR_GPIO_PARM1_ABS, &gpio_parm1_abs);
dc1394_get_adv_control_register(camera, PxL_ACR_GPIO_PARM2_ABS, &gpio_parm2_abs);
dc1394_get_adv_control_register(camera, PxL_ACR_GPIO_PARM3_ABS, &gpio_parm3_abs);
uint32_t gpio_parm1_add, gpio_parm2_add, gpio_parm3_add;
gpio_parm1_add = 4*gpio_parm1_abs + gpio_id*0x0c + 0x08;
gpio_parm2_add = 4*gpio_parm2_abs + gpio_id*0x0c + 0x08;
gpio_parm3_add = 4*gpio_parm3_abs + gpio_id*0x0c + 0x08;
dc1394_get_register(camera, (uint64_t)(gpio_parm1_add), p1_val);
dc1394_get_register(camera, (uint64_t)(gpio_parm2_add), p2_val);
dc1394_get_register(camera, (uint64_t)(gpio_parm3_add), p3_val);
#ifdef PIXELINK_DEBUG_DISPLAY
printf(" 0x%08x : r 0x%08x < GPIO_PARM1_VALUE\n", gpio_parm1_add, *p1_val);
printf(" 0x%08x : r 0x%08x < GPIO_PARM2_VALUE\n", gpio_parm2_add, *p2_val);
printf(" 0x%08x : r 0x%08x < GPIO_PARM3_VALUE\n", gpio_parm3_add, *p3_val);
#endif
return DC1394_SUCCESS;
}
/*****************************************************************************
* Function to get the GPO parameters Parameter1, Parameter2, Parameter3
* as well as the corresponding minimum and maximum values.
*/
dc1394error_t
dc1394_pxl_get_gpo_param_min_max(dc1394camera_t *camera, uint32_t gpio_id,
uint32_t *p1_val, uint32_t *p2_val, uint32_t *p3_val,
uint32_t *p1_min, uint32_t *p2_min, uint32_t *p3_min,
uint32_t *p1_max, uint32_t *p2_max, uint32_t *p3_max)
{
dc1394error_t err;
dc1394_pxl_gpio_info_t gpio_info;
err = dc1394_pxl_get_gpio_inq(camera, &gpio_info);
if (err == DC1394_FAILURE) {
return DC1394_FAILURE;
}
if (!(gpio_info.presence && gpio_id < gpio_info.number)) {
return DC1394_FAILURE;
}
uint32_t gpio_parm1_abs, gpio_parm2_abs, gpio_parm3_abs;
dc1394_get_adv_control_register(camera, PxL_ACR_GPIO_PARM1_ABS, &gpio_parm1_abs);
dc1394_get_adv_control_register(camera, PxL_ACR_GPIO_PARM2_ABS, &gpio_parm2_abs);
dc1394_get_adv_control_register(camera, PxL_ACR_GPIO_PARM3_ABS, &gpio_parm3_abs);
uint32_t gpio_parm1_add, gpio_parm2_add, gpio_parm3_add;
gpio_parm1_add = 4*gpio_parm1_abs + gpio_id*0x0c + 0x08;
gpio_parm2_add = 4*gpio_parm2_abs + gpio_id*0x0c + 0x08;
gpio_parm3_add = 4*gpio_parm3_abs + gpio_id*0x0c + 0x08;
dc1394_get_register(camera, (uint64_t)(gpio_parm1_add), p1_val);
dc1394_get_register(camera, (uint64_t)(gpio_parm2_add), p2_val);
dc1394_get_register(camera, (uint64_t)(gpio_parm3_add), p3_val);
#ifdef PIXELINK_DEBUG_DISPLAY
printf(" 0x%08x : r 0x%08x < GPIO_PARM1_VALUE\n", gpio_parm1_add, *p1_val);
printf(" 0x%08x : r 0x%08x < GPIO_PARM2_VALUE\n", gpio_parm2_add, *p2_val);
printf(" 0x%08x : r 0x%08x < GPIO_PARM3_VALUE\n", gpio_parm3_add, *p3_val);
#endif
gpio_parm1_add = 4*gpio_parm1_abs+ gpio_id*0x0c + 0x00;
gpio_parm2_add = 4*gpio_parm2_abs+ gpio_id*0x0c + 0x00;
gpio_parm3_add = 4*gpio_parm3_abs+ gpio_id*0x0c + 0x00;
dc1394_get_register(camera, (uint64_t)(gpio_parm1_add), p1_min);
dc1394_get_register(camera, (uint64_t)(gpio_parm2_add), p2_min);
dc1394_get_register(camera, (uint64_t)(gpio_parm3_add), p3_min);
#ifdef PIXELINK_DEBUG_DISPLAY
printf(" 0x%08x : r 0x%08x < GPIO_PARM1_MIN\n", gpio_parm1_add, *p1_min);
printf(" 0x%08x : r 0x%08x < GPIO_PARM2_MIN\n", gpio_parm2_add, *p2_min);
printf(" 0x%08x : r 0x%08x < GPIO_PARM3_MIN\n", gpio_parm3_add, *p3_min);
#endif
gpio_parm1_add = 4*gpio_parm1_abs+ gpio_id*0x0c + 0x04;
gpio_parm2_add = 4*gpio_parm2_abs+ gpio_id*0x0c + 0x04;
gpio_parm3_add = 4*gpio_parm3_abs+ gpio_id*0x0c + 0x04;
dc1394_get_register(camera, (uint64_t)(gpio_parm1_add), p1_max);
dc1394_get_register(camera, (uint64_t)(gpio_parm2_add), p2_max);
dc1394_get_register(camera, (uint64_t)(gpio_parm3_add), p3_max);
#ifdef PIXELINK_DEBUG_DISPLAY
printf(" 0x%08x : r 0x%08x < GPIO_PARM1_MAX\n", gpio_parm1_add, *p1_max);
printf(" 0x%08x : r 0x%08x < GPIO_PARM2_MAX\n", gpio_parm2_add, *p2_max);
printf(" 0x%08x : r 0x%08x < GPIO_PARM3_MAX\n", gpio_parm3_add, *p3_max);
#endif
return DC1394_SUCCESS;
}
/******************************************************************************
* Function to set the GPO parameters P1, P2, P3
* Internal Function.
*
*/
dc1394error_t
dc1394_pxl_set_gpo_param(dc1394camera_t *camera, uint32_t gpio_id,
uint32_t p1_val, uint32_t p2_val, uint32_t p3_val)
{
dc1394error_t err;
dc1394_pxl_gpio_info_t gpio_info;
err = dc1394_pxl_get_gpio_inq(camera, &gpio_info);
if (err == DC1394_FAILURE) {
return DC1394_FAILURE;
}
uint32_t gpio_parm1_abs, gpio_parm2_abs, gpio_parm3_abs;
dc1394_get_adv_control_register(camera, PxL_ACR_GPIO_PARM1_ABS, &gpio_parm1_abs);
dc1394_get_adv_control_register(camera, PxL_ACR_GPIO_PARM2_ABS, &gpio_parm2_abs);
dc1394_get_adv_control_register(camera, PxL_ACR_GPIO_PARM3_ABS, &gpio_parm3_abs);
uint32_t gpio_parm1_add, gpio_parm2_add, gpio_parm3_add;
gpio_parm1_add = 4*gpio_parm1_abs+ gpio_id*0x0c + 0x08;
gpio_parm2_add = 4*gpio_parm2_abs+ gpio_id*0x0c + 0x08;
gpio_parm3_add = 4*gpio_parm3_abs+ gpio_id*0x0c + 0x08;
dc1394_set_register(camera, (uint64_t)(gpio_parm1_add), p1_val);
dc1394_set_register(camera, (uint64_t)(gpio_parm2_add), p2_val);
dc1394_set_register(camera, (uint64_t)(gpio_parm3_add), p3_val);
#ifdef PIXELINK_DEBUG_DISPLAY
printf(" 0x%08x : w 0x%08x < GPIO_PARM1_VALUE\n", gpio_parm1_add, p1_val);
printf(" 0x%08x : w 0x%08x < GPIO_PARM2_VALUE\n", gpio_parm2_add, p2_val);
printf(" 0x%08x : w 0x%08x < GPIO_PARM3_VALUE\n", gpio_parm3_add, p3_val);
#endif
return DC1394_SUCCESS;
}
/******************************************************************************
* Function to read GPIO config. Internal function?
*/
dc1394error_t
dc1394_pxl_get_gpo_config(dc1394camera_t *camera, uint32_t gpio_id, uint32_t *gpio_cfg)
{
dc1394error_t err;
if (camera == NULL)
return DC1394_FAILURE;
uint32_t gpio_cfg_add = PxL_ACR_GPIO_0_CFG + gpio_id*4;
err = dc1394_get_adv_control_register(camera, (uint64_t) gpio_cfg_add, gpio_cfg);
#ifdef PIXELINK_DEBUG_DISPLAY
printf(" 0x%08x : r 0x%08x < GPO_0_CFG\n", gpio_cfg_add, *gpio_cfg);
#endif
return err;
}
/******************************************************************************
* Function to set GPIO config. Internal function?
*/
dc1394error_t
dc1394_pxl_set_gpo_config(dc1394camera_t *camera, uint32_t gpio_id, uint32_t gpio_cfg)
{
dc1394error_t err;
if (camera == NULL)
return DC1394_FAILURE;
uint32_t gpio_cfg_add = PxL_ACR_GPIO_0_CFG + gpio_id*4;
err = dc1394_set_adv_control_register(camera, (uint64_t) gpio_cfg_add, gpio_cfg);
#ifdef PIXELINK_DEBUG_DISPLAY
printf(" 0x%08x : w 0x%08x < GPO_0_CFG\n", gpio_cfg_add, gpio_cfg);
#endif
return err;
}
/******************************************************************************
* Function to print list of camera features.
* It can be used to test many functions in this file.
*/
dc1394error_t
dc1394_pxl_print_camera_info(dc1394camera_t *camera, FILE *fd)
{
dc1394_pxl_camera_info_t camera_info;
dc1394_pxl_get_camera_info(camera, &camera_info);
fprintf(fd,"Camera information.\n");
fprintf(fd," %-16s: %08x\n", "FPGA Version", camera_info.fpga_version);
fprintf(fd," %-16s: %08x\n", "FW Version", camera_info.fw_version);
fprintf(fd," %-16s: %s\n", "Serial Number", camera_info.serial_number);
fprintf(fd," %-16s: %s\n", "Description", camera_info.description);
dc1394_pxl_adv_feature_info_t adv_info;
dc1394_pxl_get_adv_feature_info(camera, &adv_info);
fprintf(fd,"Advanced Feature Information.\n");
fprintf(fd," %-16s: %s\n", "Name", adv_info.name);
fprintf(fd,"\n");
return DC1394_SUCCESS;
}
/******************************************************************************
* Function to activate GPIO mode with the parameters
*/
dc1394error_t
dc1394_pxl_set_gpio_mode_param(dc1394camera_t *camera, uint32_t gpio_id,
dc1394pxl_gpio_polarity_t gpio_polarity, dc1394pxl_gpio_mode_t gpio_mode,
double f1_val, double f2_val, double f3_val)
{
dc1394error_t err;
dc1394_pxl_gpio_info_t gpio_info;
err = dc1394_pxl_get_gpio_inq(camera, &gpio_info);
if (err == DC1394_FAILURE) {
return DC1394_FAILURE;
}
if (err == DC1394_FAILURE) {
dc1394_log_error("error reading gpio inq register\n");
return DC1394_FAILURE;
}
/* compose the cfg_register value */
uint32_t gpio_cfg = PxL_GPO_CFG_ENABLE;
/* check if mode is valid */
switch (gpio_mode) {
case DC1394_PxL_GPIO_MODE_STROBE:
gpio_cfg = gpio_cfg | PxL_GPO_CFG_MODE_STROBE;
if (gpio_info.mode_strobe == DC1394_FALSE) err = DC1394_FAILURE;
break;
case DC1394_PxL_GPIO_MODE_NORMAL:
gpio_cfg = gpio_cfg | PxL_GPO_CFG_MODE_NORMAL;
if (gpio_info.mode_normal == DC1394_FALSE) err = DC1394_FAILURE;
break;
case DC1394_PxL_GPIO_MODE_PULSE:
gpio_cfg = gpio_cfg | PxL_GPO_CFG_MODE_PULSE;
if (gpio_info.mode_pulse == DC1394_FALSE) err = DC1394_FAILURE;
break;
case DC1394_PxL_GPIO_MODE_BUSY:
gpio_cfg = gpio_cfg | PxL_GPO_CFG_MODE_BUSY;
if (gpio_info.mode_busy == DC1394_FALSE) err = DC1394_FAILURE;
break;
case DC1394_PxL_GPIO_MODE_FLASH:
gpio_cfg = gpio_cfg | PxL_GPO_CFG_MODE_FLASH;
if (gpio_info.mode_flash == DC1394_FALSE) err = DC1394_FAILURE;
break;
default:
err = DC1394_FAILURE;
}
if (err == DC1394_FAILURE) {
dc1394_log_error("error with gpio mode setting\n");
return DC1394_FAILURE;
}
/* check if polarity is valid */
switch (gpio_mode) {
case DC1394_PxL_GPIO_POLARITY_NONE:
/* No change in the mode, use whatever is available */
break;
case DC1394_PxL_GPIO_POLARITY_HIGH:
gpio_cfg = gpio_cfg | PxL_GPO_CFG_POLARITY_HIGH;
if (gpio_info.polarity == DC1394_FALSE) err = DC1394_FAILURE;
break;
case DC1394_PxL_GPIO_POLARITY_LOW:
gpio_cfg = gpio_cfg | PxL_GPO_CFG_POLARITY_LOW;
if (gpio_info.polarity == DC1394_FALSE) err = DC1394_FAILURE;
break;
default:
err = DC1394_FAILURE;
}
if (err == DC1394_FAILURE) {
dc1394_log_error("error with gpio polarity setting\n");
return DC1394_FAILURE;
}
/* Set the GPIO_CFG parameter */
dc1394_pxl_set_gpo_config(camera, gpio_id, gpio_cfg);
/* Check the minimum and maximum values */
uint32_t p1_val, p2_val, p3_val;
uint32_t p1_min, p2_min, p3_min, p1_max, p2_max, p3_max;
double f1_min, f2_min, f3_min, f1_max, f2_max, f3_max;
dc1394_pxl_get_gpo_param_min_max(camera, gpio_id, &p1_val, &p2_val, &p3_val,
&p1_min, &p2_min, &p3_min, &p1_max, &p2_max, &p3_max);
dc1394_pxl_convert_uint32_to_float32(p1_min, &f1_min);
dc1394_pxl_convert_uint32_to_float32(p2_min, &f2_min);
dc1394_pxl_convert_uint32_to_float32(p3_min, &f3_min);
dc1394_pxl_convert_uint32_to_float32(p1_max, &f1_max);
dc1394_pxl_convert_uint32_to_float32(p2_max, &f2_max);
dc1394_pxl_convert_uint32_to_float32(p3_max, &f3_max);
if ((f1_val < f1_min)| (f1_val > f1_max)) {
dc1394_log_warning("WARNING: parameter1 out of bounds! corrected.\n");
}
if ((f2_val < f2_min)| (f2_val > f2_max)) {
dc1394_log_warning("\nWARNING: parameter2 out of bounds! corrected.\n");
}
if ((f3_val < f3_min)| (f3_val > f3_max)) {
dc1394_log_warning("\nWARNING: parameter3 out of bounds! corrected.\n");
}
f1_val = (f1_val < f1_min)? f1_min: ((f1_val > f1_max)? f1_max: f1_val);
f2_val = (f2_val < f2_min)? f2_min: ((f2_val > f2_max)? f2_max: f2_val);
f3_val = (f3_val < f3_min)? f3_min: ((f3_val > f3_max)? f3_max: f3_val);
dc1394_pxl_convert_float32_to_quadlet(f1_val, &p1_val);
dc1394_pxl_convert_float32_to_quadlet(f2_val, &p2_val);
dc1394_pxl_convert_float32_to_quadlet(f3_val, &p3_val);
dc1394_pxl_set_gpo_param(camera, gpio_id, p1_val, p2_val, p3_val);
return DC1394_SUCCESS;
}

225
dc1394/vendor/pixelink.h vendored Normal file
View File

@ -0,0 +1,225 @@
/*
* 1394-Based Digital Camera Control Library
*
* Pixelink (PxL) specific extensions for Multi-camera control.
*
* Written by
* Aravind Sundaresan <a.sundaresan@gmail.com>
* James Sherman <shermanj@umd.edu>
*
* Copyright (C) 2006 Tobii Technology AB, Stockholm Sweden
*
* 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
*/
#ifndef __DC1394_VENDOR_PIXELINK_H__
#define __DC1394_VENDOR_PIXELINK_H__
#include <dc1394/log.h>
#include <dc1394/types.h>
/*! \file dc1394/vendor/pixelink.h
\brief No docs yet
More details soon
*/
//#define PIXELINK_DEBUG_LOWEST_LEVEL
//#define PIXELINK_DEBUG_DISPLAY
/*
* The following deal with the Pixelink specific extensions for cameras
* PL-A74x. They have been tested on PL-A742 cameras.
*/
#define PxL_MAX_STRING_LENGTH 256
/*
* Any definition with PxL_ACR prefix refers to the Advanced Feature Control
* and Status Registers. They are actually offsets from the
* Advanced_Feature_Inq Value.
*/
/* Camera Info Registers */
#define PxL_ACR_SERIAL_NUM_OFFSET 0x0008U
#define PxL_ACR_SERIAL_NUM_LENGTH 0x000cU
#define PxL_ACR_FPGA_VERSION 0x0010U
#define PxL_ACR_FW_VERSION 0x0014U
#define PxL_ACR_CAMERA_DESC_OFFSET 0x0018U
#define PxL_ACR_CAMERA_DESC_LENGTH 0x001cU
/* Advanced Feature Inquiry Registers */
#define PxL_ACR_NAME_INQUIRY 0x0100U
#define PxL_ACR_NAME_OFFSET 0x0104U
#define PxL_ACR_NAME_LENGTH 0x0108U
/* Advanced Feature Inquiry Registers (GPIO) */
#define PxL_ACR_GPIO_INQ 0x0128U
#define PxL_ACR_GPIO_PARM1_ABS 0x012CU
#define PxL_ACR_GPIO_PARM2_ABS 0x0130U
#define PxL_ACR_GPIO_PARM3_ABS 0x0134U
#define PxL_ACR_GPIO_0_CFG 0x0300U
#define PxL_ACR_GPIO_1_CFG 0x0304U
#define PxL_ACR_GPIO_2_CFG 0x0308U
#define PxL_ACR_GPIO_3_CFG 0x030CU
/*
* The following are some of the constants that are register specific.
*/
#define PxL_GPO_CFG_ENABLE 0x80000000U
#define PxL_GPO_CFG_DISABLE 0x00000000U
#define PxL_GPO_CFG_POLARITY_HIGH 0x40000000U
#define PxL_GPO_CFG_POLARITY_LOW 0x00000000U
#define PxL_GPO_CFG_MODE_STROBE 0x00000000U
#define PxL_GPO_CFG_MODE_NORMAL 0x00000001U
#define PxL_GPO_CFG_MODE_PULSE 0x00000002U
#define PxL_GPO_CFG_MODE_BUSY 0x00000003U
#define PxL_GPO_CFG_MODE_FLASH 0x00000004U
/**
* No Docs
*/
typedef enum {
DC1394_PxL_GPIO_POLARITY_NONE=0,
DC1394_PxL_GPIO_POLARITY_HIGH,
DC1394_PxL_GPIO_POLARITY_LOW
} dc1394pxl_gpio_polarity_t;
/**
* No Docs
*/
typedef enum {
DC1394_PxL_GPIO_MODE_STROBE=0,
DC1394_PxL_GPIO_MODE_NORMAL,
DC1394_PxL_GPIO_MODE_PULSE,
DC1394_PxL_GPIO_MODE_BUSY,
DC1394_PxL_GPIO_MODE_FLASH
} dc1394pxl_gpio_mode_t;
/* IEEE 32 bit floating point type */
typedef float float32_t;
/**
* GPIO Information structure
*/
typedef struct __dc1394_pxl_gpio_info_struct {
uint32_t number;
dc1394bool_t presence;
dc1394bool_t polarity;
dc1394bool_t mode_strobe;
dc1394bool_t mode_normal;
dc1394bool_t mode_pulse;
dc1394bool_t mode_busy;
dc1394bool_t mode_flash;
} dc1394_pxl_gpio_info_t;
/**
* Camera information
*/
typedef struct __dc1394_pxl_camera_info_struct {
uint32_t fpga_version;
uint32_t fw_version;
char serial_number[PxL_MAX_STRING_LENGTH];
char description[PxL_MAX_STRING_LENGTH];
} dc1394_pxl_camera_info_t;
/**
* Advanced feature inquiry
*/
typedef struct __dc1394_pxl_adv_feature_info_struct {
dc1394bool_t name_presence;
uint32_t name_offset;
char name[PxL_MAX_STRING_LENGTH];
} dc1394_pxl_adv_feature_info_t;
#ifdef __cplusplus
extern "C" {
#endif
/**
* No Docs
*/
dc1394error_t
dc1394_pxl_convert_float32_to_quadlet(double , uint32_t *);
/**
* No Docs
*/
dc1394error_t
dc1394_pxl_convert_uint32_to_float32(uint32_t , double *);
/**
* No Docs
*/
dc1394error_t
dc1394_pxl_get_camera_name(dc1394camera_t *, char *, uint32_t);
/**
* No Docs
*/
dc1394error_t
dc1394_pxl_get_camera_info(dc1394camera_t *, dc1394_pxl_camera_info_t *);
/**
* No Docs
*/
dc1394error_t
dc1394_pxl_get_camera_serial_number(dc1394camera_t *, uint32_t *);
/**
* No Docs
*/
dc1394error_t
dc1394_pxl_get_gpo_param(dc1394camera_t *, uint32_t, uint32_t *, uint32_t *, uint32_t *);
/**
* No Docs
*/
dc1394error_t
dc1394_pxl_get_gpo_param_min_max(dc1394camera_t *, uint32_t, uint32_t *,
uint32_t *, uint32_t *, uint32_t *, uint32_t *, uint32_t *,
uint32_t *, uint32_t *, uint32_t *);
/**
* No Docs
*/
dc1394error_t
dc1394_pxl_get_gpo_config(dc1394camera_t *, uint32_t, uint32_t *);
/**
* No Docs
*/
dc1394error_t
dc1394_pxl_set_gpo_config(dc1394camera_t *, uint32_t, uint32_t);
/**
* No Docs
*/
dc1394error_t
dc1394_pxl_set_gpio_mode_param(dc1394camera_t *, uint32_t ,
dc1394pxl_gpio_polarity_t, dc1394pxl_gpio_mode_t, double, double, double);
/**
* No Docs
*/
dc1394error_t
dc1394_pxl_print_camera_info(dc1394camera_t *, FILE *fd);
#ifdef __cplusplus
}
#endif
#endif

256
dc1394/video.h Normal file
View File

@ -0,0 +1,256 @@
/*
* 1394-Based Digital Camera Control Library
*
* Video format headers
*
* Written by Damien Douxchamps <ddouxchamps@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.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
*/
#include <dc1394/log.h>
/*! \file dc1394/video.h
\brief Functions related to video modes, formats, framerate and video flow.
More details soon
*/
#ifndef __DC1394_VIDEO_H__
#define __DC1394_VIDEO_H__
/**
* Enumeration of iso data speeds
*
* Most (if not all) cameras are compatible with 400Mbps speed. Only older cameras (pre-1999) may still only work at sub-400
* speeds. However, speeds lower than 400Mbps are still useful: they can be used for longer distances (e.g. 10m cables).
* Speeds over 400Mbps are only available in "B" mode (DC1394_OPERATION_MODE_1394B).
*/
typedef enum {
DC1394_ISO_SPEED_100= 0,
DC1394_ISO_SPEED_200,
DC1394_ISO_SPEED_400,
DC1394_ISO_SPEED_800,
DC1394_ISO_SPEED_1600,
DC1394_ISO_SPEED_3200
} dc1394speed_t;
#define DC1394_ISO_SPEED_MIN DC1394_ISO_SPEED_100
#define DC1394_ISO_SPEED_MAX DC1394_ISO_SPEED_3200
#define DC1394_ISO_SPEED_NUM (DC1394_ISO_SPEED_MAX - DC1394_ISO_SPEED_MIN + 1)
/**
* Enumeration of video framerates
*
* This enumeration is used for non-Format_7 modes. The framerate can be lower than expected if the exposure time is longer
* than the requested frame period. Framerate can be controlled in a number of other ways: framerate feature, external trigger,
* software trigger, shutter throttling and packet size (Format_7)
*/
typedef enum {
DC1394_FRAMERATE_1_875= 32,
DC1394_FRAMERATE_3_75,
DC1394_FRAMERATE_7_5,
DC1394_FRAMERATE_15,
DC1394_FRAMERATE_30,
DC1394_FRAMERATE_60,
DC1394_FRAMERATE_120,
DC1394_FRAMERATE_240
} dc1394framerate_t;
#define DC1394_FRAMERATE_MIN DC1394_FRAMERATE_1_875
#define DC1394_FRAMERATE_MAX DC1394_FRAMERATE_240
#define DC1394_FRAMERATE_NUM (DC1394_FRAMERATE_MAX - DC1394_FRAMERATE_MIN + 1)
/**
* Operation modes
*
* Two operation modes exist: the legacy and most common 1394a, and the newer 1394B. The latter allows speeds over 400Mbps, but
* can also be used at other speeds.
*/
typedef enum {
DC1394_OPERATION_MODE_LEGACY = 480,
DC1394_OPERATION_MODE_1394B
} dc1394operation_mode_t;
#define DC1394_OPERATION_MODE_MIN DC1394_OPERATION_MODE_LEGACY
#define DC1394_OPERATION_MODE_MAX DC1394_OPERATION_MODE_1394B
#define DC1394_OPERATION_MODE_NUM (DC1394_OPERATION_MODE_MAX - DC1394_OPERATION_MODE_MIN + 1)
/**
* List of framerates
*
* dc1394framerates_t contains a list of available framerates for a particular video mode.
*/
typedef struct {
uint32_t num;
dc1394framerate_t framerates[DC1394_FRAMERATE_NUM];
} dc1394framerates_t;
/**
* Video frame structure.
*
* dc1394video_frame_t is the structure returned by the capture functions. It contains the captured image as well as a number of
* information.
*
* In general this structure should be calloc'ed so that members such as "allocated size"
* are properly set to zero. Don't forget to free the "image" member before freeing the struct itself.
*/
typedef struct __dc1394_video_frame
{
unsigned char * image; /* the image. May contain padding data too (vendor specific). Read/write allowed. Free NOT allowed if
returned by dc1394_capture_dequeue() */
uint32_t size[2]; /* the image size [width, height] */
uint32_t position[2]; /* the WOI/ROI position [horizontal, vertical] == [0,0] for full frame */
dc1394color_coding_t color_coding; /* the color coding used. This field is valid for all video modes. */
dc1394color_filter_t color_filter; /* the color filter used. This field is valid only for RAW modes and IIDC 1.31 */
uint32_t yuv_byte_order; /* the order of the fields for 422 formats: YUYV or UYVY */
uint32_t data_depth; /* the number of bits per pixel. The number of grayscale levels is 2^(this_number).
This is independent from the colour coding */
uint32_t stride; /* the number of bytes per image line */
dc1394video_mode_t video_mode; /* the video mode used for capturing this frame */
uint64_t total_bytes; /* the total size of the frame buffer in bytes. May include packet-
multiple padding and intentional padding (vendor specific) */
uint32_t image_bytes; /* the number of bytes used for the image (image data only, no padding) */
uint32_t padding_bytes; /* the number of extra bytes, i.e. total_bytes-image_bytes. */
uint32_t packet_size; /* the size of a packet in bytes. (IIDC data) */
uint32_t packets_per_frame; /* the number of packets per frame. (IIDC data) */
uint64_t timestamp; /* the unix time [microseconds] at which the frame was captured in
the video1394 ringbuffer */
uint32_t frames_behind; /* the number of frames in the ring buffer that are yet to be accessed by the user */
dc1394camera_t *camera; /* the parent camera of this frame */
uint32_t id; /* the frame position in the ring buffer */
uint64_t allocated_image_bytes; /* amount of memory allocated in for the *image field. */
dc1394bool_t little_endian; /* DC1394_TRUE if little endian (16bpp modes only),
DC1394_FALSE otherwise */
dc1394bool_t data_in_padding; /* DC1394_TRUE if data is present in the padding bytes in IIDC 1.32 format,
DC1394_FALSE otherwise */
} dc1394video_frame_t;
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************
Video functions: formats, framerates,...
***************************************************************************/
/**
* Gets a list of video modes supported by the camera.
*/
dc1394error_t dc1394_video_get_supported_modes(dc1394camera_t *camera, dc1394video_modes_t *video_modes);
/**
* Gets a list of supported video framerates for a given video mode. This function only works with non-scalable formats.
*/
dc1394error_t dc1394_video_get_supported_framerates(dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394framerates_t *framerates);
/**
* Gets the current framerate. This is meaningful only if the video mode is not scalable.
*/
dc1394error_t dc1394_video_get_framerate(dc1394camera_t *camera, dc1394framerate_t *framerate);
/**
* Sets the current framerate. This is meaningful only if the video mode is not scalable.
*/
dc1394error_t dc1394_video_set_framerate(dc1394camera_t *camera, dc1394framerate_t framerate);
/**
* Gets the current vide mode.
*/
dc1394error_t dc1394_video_get_mode(dc1394camera_t *camera, dc1394video_mode_t *video_mode);
/**
* Sets the current vide mode.
*/
dc1394error_t dc1394_video_set_mode(dc1394camera_t *camera, dc1394video_mode_t video_mode);
/**
* Gets the current operation mode.
*/
dc1394error_t dc1394_video_get_operation_mode(dc1394camera_t *camera, dc1394operation_mode_t *mode);
/**
* Sets the current operation mode.
*/
dc1394error_t dc1394_video_set_operation_mode(dc1394camera_t *camera, dc1394operation_mode_t mode);
/**
* Gets the current ISO speed.
*/
dc1394error_t dc1394_video_get_iso_speed(dc1394camera_t *camera, dc1394speed_t *speed);
/**
* Sets the current ISO speed. Speeds over 400Mbps require 1394B.
*/
dc1394error_t dc1394_video_set_iso_speed(dc1394camera_t *camera, dc1394speed_t speed);
/**
* Gets the current ISO channel
*/
dc1394error_t dc1394_video_get_iso_channel(dc1394camera_t *camera, uint32_t * channel);
/**
* Sets the current ISO channel
*/
dc1394error_t dc1394_video_set_iso_channel(dc1394camera_t *camera, uint32_t channel);
/**
* Gets the current data depth, in bits. Only meaningful for 16bpp video modes (RAW16, RGB48, MONO16,...)
*/
dc1394error_t dc1394_video_get_data_depth(dc1394camera_t *camera, uint32_t *depth);
/**
* Starts/stops the isochronous data transmission. In other words, use this to control the image flow.
*/
dc1394error_t dc1394_video_set_transmission(dc1394camera_t *camera, dc1394switch_t pwr);
/**
* Gets the status of the video transmission
*/
dc1394error_t dc1394_video_get_transmission(dc1394camera_t *camera, dc1394switch_t *pwr);
/**
* Turns one-shot mode on or off
*/
dc1394error_t dc1394_video_set_one_shot(dc1394camera_t *camera, dc1394switch_t pwr);
/**
* Gets the status of the one-shot mode.
*/
dc1394error_t dc1394_video_get_one_shot(dc1394camera_t *camera, dc1394bool_t *is_on);
/**
* Turns multishot mode on or off
*/
dc1394error_t dc1394_video_set_multi_shot(dc1394camera_t *camera, uint32_t numFrames, dc1394switch_t pwr);
/**
* Gets the status of the multi-shot mode.
*/
dc1394error_t dc1394_video_get_multi_shot(dc1394camera_t *camera, dc1394bool_t *is_on, uint32_t *numFrames);
/**
* Gets the bandwidth usage of a camera.
*
* This function returns the bandwidth that is used by the camera *IF* ISO was ON.
* The returned value is in bandwidth units. The 1394 bus has 4915 bandwidth units
* available per cycle. Each unit corresponds to the time it takes to send one
* quadlet at ISO speed S1600. The bandwidth usage at S400 is thus four times the
* number of quadlets per packet. Thanks to Krisitian Hogsberg for clarifying this.
*/
dc1394error_t dc1394_video_get_bandwidth_usage(dc1394camera_t *camera, uint32_t *bandwidth);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,6 @@
if HAVE_WINDOWS
noinst_LTLIBRARIES = libdc1394-windows.la
endif
AM_CFLAGS = -I$(top_srcdir) -I$(srcdir)/..
libdc1394_windows_la_SOURCES = control.c capture.c platform_windows.h

622
dc1394/windows/Makefile.in Normal file
View File

@ -0,0 +1,622 @@
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = dc1394/windows
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/ax_check_framework.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libdc1394_windows_la_LIBADD =
am_libdc1394_windows_la_OBJECTS = control.lo capture.lo
libdc1394_windows_la_OBJECTS = $(am_libdc1394_windows_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
@HAVE_WINDOWS_TRUE@am_libdc1394_windows_la_rpath =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(libdc1394_windows_la_SOURCES)
DIST_SOURCES = $(libdc1394_windows_la_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
pkgincludedir = @pkgincludedir@
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
DX_CONFIG = @DX_CONFIG@
DX_DOCDIR = @DX_DOCDIR@
DX_DOT = @DX_DOT@
DX_DOXYGEN = @DX_DOXYGEN@
DX_DVIPS = @DX_DVIPS@
DX_EGREP = @DX_EGREP@
DX_ENV = @DX_ENV@
DX_FLAG_chi = @DX_FLAG_chi@
DX_FLAG_chm = @DX_FLAG_chm@
DX_FLAG_doc = @DX_FLAG_doc@
DX_FLAG_dot = @DX_FLAG_dot@
DX_FLAG_html = @DX_FLAG_html@
DX_FLAG_man = @DX_FLAG_man@
DX_FLAG_pdf = @DX_FLAG_pdf@
DX_FLAG_ps = @DX_FLAG_ps@
DX_FLAG_rtf = @DX_FLAG_rtf@
DX_FLAG_xml = @DX_FLAG_xml@
DX_HHC = @DX_HHC@
DX_LATEX = @DX_LATEX@
DX_MAKEINDEX = @DX_MAKEINDEX@
DX_PDFLATEX = @DX_PDFLATEX@
DX_PERL = @DX_PERL@
DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FRAMEWORK_IOKIT = @FRAMEWORK_IOKIT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
LIBUSB_LIBS = @LIBUSB_LIBS@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
SDL_CONFIG = @SDL_CONFIG@
SDL_LIBS = @SDL_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
XMKMF = @XMKMF@
XV_CFLAGS = @XV_CFLAGS@
XV_LIBS = @XV_LIBS@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_age = @lt_age@
lt_current = @lt_current@
lt_revision = @lt_revision@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
platform_LDFLAGS = @platform_LDFLAGS@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
@HAVE_WINDOWS_TRUE@noinst_LTLIBRARIES = libdc1394-windows.la
AM_CFLAGS = -I$(top_srcdir) -I$(srcdir)/..
libdc1394_windows_la_SOURCES = control.c capture.c platform_windows.h
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu dc1394/windows/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu dc1394/windows/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
libdc1394-windows.la: $(libdc1394_windows_la_OBJECTS) $(libdc1394_windows_la_DEPENDENCIES) $(EXTRA_libdc1394_windows_la_DEPENDENCIES)
$(AM_V_CCLD)$(LINK) $(am_libdc1394_windows_la_rpath) $(libdc1394_windows_la_OBJECTS) $(libdc1394_windows_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/capture.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/control.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

464
dc1394/windows/capture.c Normal file
View File

@ -0,0 +1,464 @@
/*
* 1394-Based Digital Camera Control Library
*
* Camera control code for Windows
*
* Written by
* Satofumi Kamimura <satofumi@users.sourceforge.jp>
*
* We use CMU 1394 Digital Camera Driver project's source code for this project.
* http://www.cs.cmu.edu/~iwan/1394/
*
* 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
*/
#include <windows.h>
#include "dc1394/internal.h"
#include "platform_windows.h"
static dc1394error_t
free_resources(platform_camera_t * cam)
{
DWORD ret = t1394IsochTearDownStream(cam->device->device_path);
if (ret) {
dc1394_log_warning("t1394IsochTearDownStream: Error %ld\n", ret);
return DC1394_FAILURE;
}
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_windows_iso_allocate_channel (platform_camera_t * cam,
uint64_t channels_allowed, int * channel)
{
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_windows_iso_release_channel (platform_camera_t * cam, int channel)
{
// \todo implement
return DC1394_FAILURE;
}
static dc1394error_t
windows_capture_setup (platform_camera_t * craw, uint32_t num_dma_buffers, uint32_t flags)
{
int i;
free_resources(craw);
ULARGE_INTEGER dma_buffer_size;
const char * device_path = craw->device->device_path;
t1394_GetHostDmaCapabilities (device_path, NULL, &dma_buffer_size);
const dc1394video_frame_t * frame = &craw->capture.frames[0];
int max_buffer_size = frame->total_bytes; //number of bytes needed
int max_bytes = frame->packet_size / 2;
PACQUISITION_BUFFER acquisition_buffer =
dc1394BuildAcquisitonBuffer(max_buffer_size,
(unsigned long)dma_buffer_size.QuadPart,
max_bytes, 0);
ISOCH_STREAM_PARAMS stream_params;
if (acquisition_buffer) {
stream_params.nMaxBufferSize = acquisition_buffer->subBuffers[0].ulSize;
stream_params.nNumberOfBuffers = (num_dma_buffers * acquisition_buffer->nSubBuffers) + 1;
// free the buffer: this wouldn't be necessary if this were merged into StartImageAcquisitionEx
dc1394FreeAcquisitionBuffer(acquisition_buffer);
acquisition_buffer = NULL;
} else {
dc1394_log_error("windows_capture_setup: failed to determine required buffer size and count!");
return DC1394_FAILURE;
}
dc1394speed_t speed;
if (dc1394_video_get_iso_speed(craw->camera, &speed) != DC1394_SUCCESS) {
dc1394_log_error("windows_capture_setup: failed to get iso speed!");
return DC1394_FAILURE;
}
uint32_t channel = -1;
stream_params.fulSpeed = 1 << speed;
stream_params.nChannel = channel;
stream_params.nMaxBytesPerFrame = max_bytes;
DWORD ret = t1394IsochSetupStream(craw->device->device_path,
&stream_params);
craw->allocated_channel = stream_params.nChannel;
if (ret != ERROR_SUCCESS) {
dc1394_log_error("windows_capture_setup: Error on IsochSetupStream: %d\n", ret);
return DC1394_FAILURE;
}
#if 1
// allocate channel/bandwidth if requested
if (flags & DC1394_CAPTURE_FLAGS_CHANNEL_ALLOC) {
if (dc1394_iso_allocate_channel (craw->camera, 0, &craw->allocated_channel)
!= DC1394_SUCCESS) {
return DC1394_FAILURE;
}
if (dc1394_video_set_iso_channel (craw->camera, craw->allocated_channel)
!= DC1394_SUCCESS) {
return DC1394_FAILURE;
}
}
#endif
#if 1
if (flags & DC1394_CAPTURE_FLAGS_BANDWIDTH_ALLOC) {
unsigned int bandwidth_usage;
if (dc1394_video_get_bandwidth_usage (craw->camera, &bandwidth_usage)
!= DC1394_SUCCESS) {
return DC1394_FAILURE;
}
if (dc1394_iso_allocate_bandwidth (craw->camera, bandwidth_usage)
!= DC1394_SUCCESS) {
return DC1394_FAILURE;
}
craw->allocated_bandwidth = bandwidth_usage;
}
#endif
/* QUEUE the buffers */
for (i = 0; i < num_dma_buffers; ++i) {
PACQUISITION_BUFFER buffer =
dc1394BuildAcquisitonBuffer(max_buffer_size,
dma_buffer_size.QuadPart, max_bytes, i);
if(!buffer) {
dc1394_log_error("windows_capture_setup: Error Allocating AcqBuffer %d\n", i);
return DC1394_FAILURE;
}
// add it to our list of buffers
if (i == 0) {
craw->pLastBuffer = craw->pFirstBuffer = buffer;
craw->pLastBuffer->pNextBuffer = craw->pCurrentBuffer = NULL;
} else {
craw->pFirstBuffer->pNextBuffer = buffer;
craw->pFirstBuffer = buffer;
}
}
// all done making buffers
// open our long term device handle
HANDLE device;
if((device = OpenDevice(device_path, TRUE)) == INVALID_HANDLE_VALUE) {
dc1394_log_error("windows_capture_setup error opening device (%s)\n", craw->device->device_path);
return DC1394_FAILURE;
}
// all done making buffers
// open our long term device handle
PACQUISITION_BUFFER buffer;
for (buffer = craw->pLastBuffer;
buffer != NULL; buffer = buffer->pNextBuffer) {
DWORD ret = dc1394AttachAcquisitionBuffer(device, buffer);
if (ret != ERROR_SUCCESS) {
dc1394_log_error("windows_capture_setup: Failed to attach buffer %u/%u", buffer->index, num_dma_buffers);
return DC1394_FAILURE;
}
}
// new: sleep a little while and verify that the buffers were
// successfully attached this basically catches "Parameter is Incorrect"
// here instead of confusing users at AcquireImageEx()
// 50 ms is all it should take for completion routines to fire and
// propagate in the kernel
Sleep(50);
for (buffer = craw->pLastBuffer;
buffer != NULL; buffer = buffer->pNextBuffer) {
DWORD dwBytesRet = 0;
for (unsigned int bb = 0; bb < buffer->nSubBuffers; ++bb) {
if (!GetOverlappedResult(device,
&(buffer->subBuffers[bb].overLapped),
&dwBytesRet, FALSE)) {
if (GetLastError() != ERROR_IO_INCOMPLETE) {
dc1394_log_error("Buffer validation failed for buffer %u\n", buffer->index,bb);
return DC1394_FAILURE;
}
// else: this is the actual success case
} else {
dc1394_log_error("Buffer %u is unexpectedly ready during pre-listen validation\n", buffer->index, bb);
return DC1394_FAILURE;
}
}
}
ret = t1394IsochListen(craw->device->device_path);
if (ret != ERROR_SUCCESS) {
dc1394_log_error("Error %08lx on IOCTL_ISOCH_LISTEN\n", ret);
return DC1394_FAILURE;
}
// starting from here we use the ISO channel so we set the flag
// in the camera struct:
craw->capture_is_set = 1;
for (i = 1; i < num_dma_buffers; ++i) {
memcpy(&craw->capture.frames[i], frame, sizeof (dc1394video_frame_t));
}
craw->capture.frames_last_index = num_dma_buffers - 1;
craw->device_acquisition = device;
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_windows_capture_setup(platform_camera_t * craw, uint32_t num_dma_buffers,
uint32_t flags)
{
dc1394camera_t * camera = craw->camera;
dc1394error_t err;
if (flags & DC1394_CAPTURE_FLAGS_DEFAULT) {
flags = DC1394_CAPTURE_FLAGS_CHANNEL_ALLOC |
DC1394_CAPTURE_FLAGS_BANDWIDTH_ALLOC;
}
// if capture is already set, abort
if (craw->capture_is_set > 0) {
return DC1394_CAPTURE_IS_RUNNING;
}
craw->capture.flags = flags;
craw->allocated_channel = -1;
// if auto iso is requested, stop ISO (if necessary)
if (flags & DC1394_CAPTURE_FLAGS_AUTO_ISO) {
dc1394switch_t is_iso_on;
dc1394_video_get_transmission(camera, &is_iso_on);
if (is_iso_on == DC1394_ON) {
err=dc1394_video_set_transmission(camera, DC1394_OFF);
DC1394_ERR_RTN(err,"Could not stop ISO!");
}
}
craw->capture.frames =
malloc (num_dma_buffers * sizeof (dc1394video_frame_t));
if (!craw->capture.frames) {
goto fail;
}
err = capture_basic_setup(camera, craw->capture.frames);
if (err != DC1394_SUCCESS) {
goto fail;
}
err = windows_capture_setup (craw, num_dma_buffers, flags);
if (err != DC1394_SUCCESS) {
goto fail;
}
// if auto iso is requested, start ISO
if (flags & DC1394_CAPTURE_FLAGS_AUTO_ISO) {
err=dc1394_video_set_transmission(camera, DC1394_ON);
DC1394_ERR_RTN(err,"Could not start ISO!");
craw->iso_auto_started = 1;
}
craw->capture.num_dma_buffers = num_dma_buffers;
return DC1394_SUCCESS;
fail:
// free resources if they were allocated
if (craw->allocated_channel >= 0) {
if (dc1394_iso_release_channel (camera, craw->allocated_channel)
!= DC1394_SUCCESS)
dc1394_log_warning("Warning: Could not free ISO channel");
}
if (craw->allocated_bandwidth) {
if (dc1394_iso_release_bandwidth (camera, craw->allocated_bandwidth)
!= DC1394_SUCCESS)
dc1394_log_warning("Warning: Could not free bandwidth");
}
craw->allocated_channel = -1;
craw->allocated_bandwidth = 0;
free (craw->capture.frames);
craw->capture.frames = NULL;
dc1394_log_error ("Error: Failed to setup DMA capture");
return DC1394_FAILURE;
}
dc1394error_t
dc1394_windows_capture_stop(platform_camera_t *craw)
{
DWORD dwBytesRet = 0;
DWORD ret;
if (craw->device_acquisition == INVALID_HANDLE_VALUE) {
dc1394_log_error("StopImageAcquisition: Called with invalid device handle\n");
return DC1394_FAILURE;
}
// Tear down the stream
ret = free_resources(craw);
if (ret) {
dc1394_log_error("free_resources: Error %ld\n", ret);
}
// put pCurrentBuffer on the list for the sake of cleanup
if (craw->pCurrentBuffer != NULL) {
craw->pCurrentBuffer->pNextBuffer = craw->pLastBuffer;
craw->pLastBuffer = craw->pCurrentBuffer;
}
while (craw->pLastBuffer) {
if (craw->pLastBuffer != craw->pCurrentBuffer) {
// check the IO status, just in case
for (unsigned int ii = 0; ii < craw->pLastBuffer->nSubBuffers; ++ii) {
if (!GetOverlappedResult(craw->device_acquisition, &craw->pLastBuffer->subBuffers[ii].overLapped, &dwBytesRet, TRUE)) {
dc1394_log_warning("dc1394_windows_capture_stop: Warning Buffer %d.%d has not been detached, error = %d\n", craw->pLastBuffer->index,ii,GetLastError());
}
}
}
// check the IO status, just in case
for(unsigned int ii = 0; ii<craw->pLastBuffer->nSubBuffers; ++ii) {
// close event: NOTE: must pre-populate correctly above
if(craw->pLastBuffer->subBuffers[ii].overLapped.hEvent != NULL) {
CloseHandle(craw->pLastBuffer->subBuffers[ii].overLapped.hEvent);
craw->pLastBuffer->subBuffers[ii].overLapped.hEvent = NULL;
}
}
// free data buffer
if (craw->pLastBuffer->pDataBuf)
GlobalFree(craw->pLastBuffer->pDataBuf);
// advance to next buffer
PACQUISITION_BUFFER pAcqBuffer = craw->pLastBuffer;
craw->pLastBuffer = craw->pLastBuffer->pNextBuffer;
// free buffer struct
GlobalFree(pAcqBuffer);
}
// clean up our junk
if (craw->device_acquisition != INVALID_HANDLE_VALUE) {
CloseHandle(craw->device_acquisition);
craw->device_acquisition = INVALID_HANDLE_VALUE;
}
craw->pFirstBuffer = craw->pLastBuffer = craw->pCurrentBuffer = NULL;
free (craw->capture.frames);
craw->capture.frames=NULL;
craw->capture_is_set = 0;
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_windows_capture_dequeue (platform_camera_t * craw,
dc1394capture_policy_t policy,
dc1394video_frame_t **frame)
{
LPOVERLAPPED pOverlapped = &(craw->pLastBuffer->subBuffers[craw->pLastBuffer->nSubBuffers - 1].overLapped);
DWORD dwBytesRet = 0;
BOOL ready = 0;
// default: return NULL frame if no new frames/error/etc.
*frame=NULL;
if(craw->capture.frames==NULL || craw->capture_is_set==0) {
*frame=NULL;
return DC1394_CAPTURE_IS_NOT_SET;
}
switch (policy) {
case DC1394_CAPTURE_POLICY_WAIT:
ready=GetOverlappedResult(craw->device_acquisition, pOverlapped, &dwBytesRet, TRUE);
break;
case DC1394_CAPTURE_POLICY_POLL:
ready=GetOverlappedResult(craw->device_acquisition, pOverlapped, &dwBytesRet, FALSE);
break;
}
if (ready) {
craw->pCurrentBuffer = craw->pLastBuffer;
// advance the buffer queue
craw->pLastBuffer = craw->pLastBuffer->pNextBuffer;
// handle the single-buffer case
// (again, this would be more clear as simply "head" and "tail"
if (craw->pLastBuffer == NULL) {
craw->pFirstBuffer = NULL;
}
}
else if (policy==DC1394_CAPTURE_POLICY_POLL)
return DC1394_SUCCESS;
if (!craw->pCurrentBuffer) {
return DC1394_FAILURE;
}
// flatten the buffer before returning the internal pointer
// note: this can only be made more efficient via the "smart" way discussed in CamRGB.cpp: provide
// an stl-containerlike iterator mechanism that "hides" the flattened-or-not-ness. Putting that here
// would, however, break the external API in a way that might require a majorversion bump...
dc1394FlattenAcquisitionBuffer(craw->pCurrentBuffer);
unsigned long length = craw->pCurrentBuffer->ulBufferSize;
dc1394capture_t * capture = &craw->capture;
*frame = &capture->frames[capture->frames_last_index];
(*frame)->image = craw->pCurrentBuffer->pFrameStart;
(*frame)->image_bytes = length;
capture->frames_last_index =
(capture->frames_last_index + 1) % capture->num_dma_buffers;
return DC1394_SUCCESS;
}
dc1394error_t
dc1394_windows_capture_enqueue (platform_camera_t * craw,
dc1394video_frame_t * frame)
{
if (craw->pCurrentBuffer != NULL) {
if(dc1394AttachAcquisitionBuffer(craw->device_acquisition, craw->pCurrentBuffer) != ERROR_SUCCESS) {
dc1394_log_error("AcquireImage: Error Reattaching current buffer!");
return DC1394_FAILURE;
}
// push m_pCurrentBuffer onto the Buffer Queue
// Note: m_pFirstBuffer is the most recently attached buffer, which is at the end of the queue (confusing names...)
if(craw->pFirstBuffer == NULL) {
// there is only one buffer, and we just attached it
craw->pLastBuffer = craw->pCurrentBuffer;
} else {
// current buffer goes onto the end of the queue
craw->pFirstBuffer->pNextBuffer = craw->pCurrentBuffer;
}
// current buffer is now the most recently attached buffer
craw->pFirstBuffer = craw->pCurrentBuffer;
// which marks the end of the line
craw->pFirstBuffer->pNextBuffer = NULL;
// and means that there is, for now, no "current" buffer
craw->pCurrentBuffer = NULL;
}
return DC1394_SUCCESS;
}

425
dc1394/windows/control.c Normal file
View File

@ -0,0 +1,425 @@
/*
* 1394-Based Digital Camera Control Library
*
* Camera control code for Windows
*
* Written by
* Satofumi Kamimura <satofumi@users.sourceforge.jp>
*
* We use CMU 1394 Digital Camera Driver project's source code for this project.
* http://www.cs.cmu.edu/~iwan/1394/
*
* 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
*/
#include <windows.h>
#include <stdlib.h>
#include "dc1394/internal.h"
#include "platform_windows.h"
#include "types.h"
// \todo remove this function
extern dc1394error_t
dc1394_windows_iso_allocate_channel (platform_camera_t * cam,
uint64_t channels_allowed, int * channel);
extern dc1394error_t
dc1394_windows_iso_release_channel (platform_camera_t * cam, int channel);
extern dc1394error_t
dc1394_windows_capture_setup(platform_camera_t * craw, uint32_t num_dma_buffers,
uint32_t flags);
extern dc1394error_t
dc1394_windows_capture_stop(platform_camera_t *craw);
extern dc1394error_t
dc1394_windows_capture_dequeue (platform_camera_t * craw,
dc1394capture_policy_t policy,
dc1394video_frame_t **frame);
extern dc1394error_t
dc1394_windows_capture_enqueue (platform_camera_t * craw,
dc1394video_frame_t * frame);
static platform_t *
dc1394_windows_new (void)
{
HDEVINFO * dev_info = t1394CmdrGetDeviceList();
if (dev_info == INVALID_HANDLE_VALUE) {
return NULL;
}
platform_t * p = calloc (1, sizeof (platform_t));
if (!p) {
return NULL;
}
p->dev_info = dev_info;
return p;
}
static void
dc1394_windows_free (platform_t * p)
{
if (p == NULL) {
return;
}
SetupDiDestroyDeviceInfoList(p->dev_info);
free (p);
}
static int
read_retry (const char * device_path, ULONG offset, PULONG data)
{
int retry = DC1394_MAX_RETRIES;
while (retry > 0) {
DWORD ret = ReadRegisterUL ((char *)device_path, offset, data);
if (ret == ERROR_SUCCESS) {
return 0;
}
if (ret != ERROR_SEM_TIMEOUT && ret != ERROR_BUSY) {
break;
}
usleep (DC1394_SLOW_DOWN);
retry--;
}
return -1;
}
static int
write_retry (const char * device_path, ULONG offset, ULONG data)
{
int retry = DC1394_MAX_RETRIES;
while (retry > 0) {
DWORD ret = WriteRegisterUL ((char *)device_path, offset, data);
if (ret == ERROR_SUCCESS) {
return 0;
}
if (ret != ERROR_SEM_TIMEOUT && ret != ERROR_BUSY) {
break;
}
usleep (DC1394_SLOW_DOWN);
retry--;
}
return -1;
}
static int number_of_devices(platform_t * p)
{
int n;
for (n = 0; n < MAX_DEVICE_SIZE; ++n) {
char device_path[DEVICE_PATH_SIZE];
ULONG device_path_size = DEVICE_PATH_SIZE;
if (t1394CmdrGetDevicePath (p->dev_info, n,
device_path, &device_path_size) <= 0) {
return n;
}
}
return 0;
}
static platform_device_list_t *
dc1394_windows_get_device_list (platform_t * p)
{
platform_device_list_t * list;
int device_size;
int i;
list = calloc (1, sizeof (platform_device_list_t));
if (!list) {
return NULL;
}
device_size = number_of_devices(p);
list->devices = malloc (device_size * sizeof(platform_device_t *));
if (!list->devices) {
free (list);
return NULL;
}
list->num_devices = 0;
// find device path
for (i = 0; i < device_size; ++i) {
char device_path[DEVICE_PATH_SIZE];
ULONG device_path_size = DEVICE_PATH_SIZE;
ULONG quad;
platform_device_t * device;
int j;
if (t1394CmdrGetDevicePath (p->dev_info, i,
device_path, &device_path_size) <= 0) {
break;
}
if (read_retry (device_path, 0xf0000400, &quad) < 0) {
break;
}
device = malloc (sizeof (platform_device_t));
if (!device) {
break;
}
strncpy(device->device_path, device_path, device_path_size);
device->node = i;
device->config_rom[0] = quad;
for (j = 1; j < CONFIG_ROM_SIZE; ++j) {
if (read_retry (device_path, 0xf0000400 + 4*j, &quad) < 0) {
break;
}
device->config_rom[j] = quad;
}
device->config_rom_size = j;
list->devices[list->num_devices] = device;
++list->num_devices;
}
return list;
}
static void
dc1394_windows_free_device_list (platform_device_list_t * d)
{
int i;
if (!d) {
return;
}
for (i = 0; i < d->num_devices; ++i) {
free (d->devices[i]);
}
free (d);
}
static int
dc1394_windows_device_get_config_rom (platform_device_t * device,
uint32_t * quads, int * num_quads)
{
if (*num_quads > device->config_rom_size) {
*num_quads = device->config_rom_size;
}
memcpy (quads, device->config_rom, *num_quads * sizeof (uint32_t));
return 0;
}
static platform_camera_t *
dc1394_windows_camera_new (platform_t * p, platform_device_t * device,
uint32_t unit_directory_offset)
{
platform_camera_t * camera = malloc (sizeof (platform_camera_t));
if (!camera) {
return NULL;
}
camera->device = device;
camera->camera = NULL;
camera->capture_is_set = 0;
camera->allocated_channel = 0;
camera->allocated_bandwidth = 0;
camera->iso_channel = 0;
camera->iso_auto_started = 0;
camera->capture.flags = 0;
camera->capture.frames = NULL;
return camera;
}
static void
dc1394_windows_camera_free (platform_camera_t * cam)
{
free (cam);
}
static void
dc1394_windows_camera_set_parent (platform_camera_t * cam,
dc1394camera_t * parent)
{
cam->camera = parent;
}
static dc1394error_t
dc1394_windows_camera_print_info (platform_camera_t * cam, FILE *fd)
{
fprintf(fd,"------ Camera platform-specific information ------\n");
fprintf(fd,"Device : %p\n", cam->device);
fprintf(fd,"Camera : %p\n", cam->camera);
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_windows_camera_read (platform_camera_t * cam, uint64_t offset,
uint32_t * quads, int num_quads)
{
int i;
for (i = 0; i < num_quads; ++i) {
if (read_retry (cam->device->device_path,
0xf0000000 + offset + 4*i, (PULONG)&quads[i]) < 0) {
return DC1394_FAILURE;
}
}
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_windows_camera_write (platform_camera_t * cam, uint64_t offset,
const uint32_t * quads, int num_quads)
{
int i;
for (i = 0; i < num_quads; ++i) {
if (write_retry (cam->device->device_path,
0xf0000000 + offset + 4*i, quads[i]) < 0) {
return DC1394_FAILURE;
}
}
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_windows_reset_bus (platform_camera_t * cam)
{
// \todo implement
return DC1394_FAILURE;
}
static dc1394error_t
dc1394_windows_read_cycle_timer (platform_camera_t * cam,
uint32_t * cycle_timer, uint64_t * local_time)
{
// \todo implement
return DC1394_FAILURE;
}
static dc1394error_t
dc1394_windows_set_broadcast (platform_camera_t * craw, dc1394bool_t pwr)
{
// \todo implement
return DC1394_FAILURE;
}
static dc1394error_t
dc1394_windows_get_broadcast (platform_camera_t * craw, dc1394bool_t *pwr)
{
// \todo implement
return DC1394_FAILURE;
}
static dc1394error_t
dc1394_windows_iso_set_persist (platform_camera_t * cam)
{
// \todo implement
return DC1394_FAILURE;
}
static dc1394error_t
dc1394_windows_iso_allocate_bandwidth (platform_camera_t * cam,
int bandwidth_units)
{
// \todo implement
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_windows_iso_release_bandwidth (platform_camera_t * cam,
int bandwidth_units)
{
// \todo implement
//return DC1394_FAILURE;
return DC1394_SUCCESS;
}
static dc1394error_t
dc1394_windows_camera_get_node(platform_camera_t * cam, uint32_t *node,
uint32_t * generation)
{
*node = cam->device->node;
// \todo implement
return DC1394_FAILURE;
}
dc1394error_t
dc1394_camera_get_windows_port(dc1394camera_t *camera, uint32_t *port)
{
// \todo implement
return DC1394_FAILURE;
}
static int
dc1394_windows_capture_get_fileno (platform_camera_t * craw)
{
// \todo implement
return -1;
}
static platform_dispatch_t
windows_dispatch = {
.platform_new = dc1394_windows_new,
.platform_free = dc1394_windows_free,
.get_device_list = dc1394_windows_get_device_list,
.free_device_list = dc1394_windows_free_device_list,
.device_get_config_rom = dc1394_windows_device_get_config_rom,
.camera_new = dc1394_windows_camera_new,
.camera_free = dc1394_windows_camera_free,
.camera_set_parent = dc1394_windows_camera_set_parent,
.camera_read = dc1394_windows_camera_read,
.camera_write = dc1394_windows_camera_write,
.reset_bus = dc1394_windows_reset_bus,
.camera_print_info = dc1394_windows_camera_print_info,
.camera_get_node = dc1394_windows_camera_get_node,
.set_broadcast = dc1394_windows_set_broadcast,
.get_broadcast = dc1394_windows_get_broadcast,
.read_cycle_timer = dc1394_windows_read_cycle_timer,
.capture_setup = dc1394_windows_capture_setup,
.capture_stop = dc1394_windows_capture_stop,
.capture_dequeue = dc1394_windows_capture_dequeue,
.capture_enqueue = dc1394_windows_capture_enqueue,
.capture_get_fileno = dc1394_windows_capture_get_fileno,
.iso_set_persist = dc1394_windows_iso_set_persist,
.iso_allocate_channel = dc1394_windows_iso_allocate_channel,
.iso_release_channel = dc1394_windows_iso_release_channel,
.iso_allocate_bandwidth = dc1394_windows_iso_allocate_bandwidth,
.iso_release_bandwidth = dc1394_windows_iso_release_bandwidth,
.capture_set_callback = NULL,
.capture_schedule_with_runloop = NULL,
};
void
windows_init(dc1394_t * d)
{
register_platform (d, &windows_dispatch, "windows");
}

View File

@ -0,0 +1,74 @@
/*
* 1394-Based Digital Camera Control Library
*
* Platform specific headers
*
* Written by
* Satofumi Kamimura <satofumi@users.sourceforge.jp>
*
* We use CMU 1394 Digital Camera Driver project's source code for this project.
* http://www.cs.cmu.edu/~iwan/1394/
*
* 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
*/
#ifndef __DC1394_PLATFORM_WINDOWS_H__
#define __DC1394_PLATFORM_WINDOWS_H__
#include <1394camapi.h>
enum {
MAX_DEVICE_SIZE = 63,
DEVICE_PATH_SIZE = 512,
CONFIG_ROM_SIZE = 256,
};
typedef struct
{
uint32_t flags;
dc1394video_frame_t * frames;
int num_dma_buffers;
int frames_last_index;
} dc1394capture_t;
struct _platform_camera_t {
platform_device_t * device;
dc1394camera_t * camera;
dc1394capture_t capture;
int capture_is_set;
int allocated_channel;
unsigned int allocated_bandwidth;
unsigned int iso_channel;
int iso_auto_started;
HANDLE device_acquisition;
PACQUISITION_BUFFER pFirstBuffer;
PACQUISITION_BUFFER pLastBuffer;
PACQUISITION_BUFFER pCurrentBuffer;
};
struct _platform_device_t {
int node;
char device_path[DEVICE_PATH_SIZE];
ULONG config_rom[CONFIG_ROM_SIZE];
ULONG config_rom_size;
};
struct _platform_t {
HDEVINFO * dev_info;
};
#endif

791
depcomp Executable file
View File

@ -0,0 +1,791 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2013-05-30.07; # UTC
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program 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 General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by 'PROGRAMS ARGS'.
object Object file output by 'PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputting dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
# Get the directory component of the given path, and save it in the
# global variables '$dir'. Note that this directory component will
# be either empty or ending with a '/' character. This is deliberate.
set_dir_from ()
{
case $1 in
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
*) dir=;;
esac
}
# Get the suffix-stripped basename of the given path, and save it the
# global variable '$base'.
set_base_from ()
{
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
}
# If no dependency file was actually created by the compiler invocation,
# we still have to create a dummy depfile, to avoid errors with the
# Makefile "include basename.Plo" scheme.
make_dummy_depfile ()
{
echo "#dummy" > "$depfile"
}
# Factor out some common post-processing of the generated depfile.
# Requires the auxiliary global variable '$tmpdepfile' to be set.
aix_post_process_depfile ()
{
# If the compiler actually managed to produce a dependency file,
# post-process it.
if test -f "$tmpdepfile"; then
# Each line is of the form 'foo.o: dependency.h'.
# Do two passes, one to just change these to
# $object: dependency.h
# and one to simply output
# dependency.h:
# which is needed to avoid the deleted-header problem.
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
} > "$depfile"
rm -f "$tmpdepfile"
else
make_dummy_depfile
fi
}
# A tabulation character.
tab=' '
# A newline character.
nl='
'
# Character ranges might be problematic outside the C locale.
# These definitions help.
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
lower=abcdefghijklmnopqrstuvwxyz
digits=0123456789
alpha=${upper}${lower}
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Avoid interferences from the environment.
gccflag= dashmflag=
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
# This is just like msvc7 but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvc7
fi
if test "$depmode" = xlc; then
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
gccflag=-qmakedep=gcc,-MF
depmode=gcc
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
## (see the conditional assignment to $gccflag above).
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say). Also, it might not be
## supported by the other compilers which use the 'gcc' depmode.
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The second -e expression handles DOS-style file names with drive
# letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the "deleted header file" problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
## Some versions of gcc put a space before the ':'. On the theory
## that the space means something, we add a space to the output as
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
| tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile"
;;
xlc)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
aix_post_process_depfile
;;
tcc)
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
# FIXME: That version still under development at the moment of writing.
# Make that this statement remains true also for stable, released
# versions.
# It will wrap lines (doesn't matter whether long or short) with a
# trailing '\', as in:
#
# foo.o : \
# foo.c \
# foo.h \
#
# It will put a trailing '\' even on the last line, and will use leading
# spaces rather than leading tabs (at least since its commit 0394caf7
# "Emit spaces for -MD").
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
# We have to change lines of the first kind to '$object: \'.
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
# And for each line of the second kind, we have to emit a 'dep.h:'
# dummy dependency, to avoid the deleted-header problem.
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
## The order of this option in the case statement is important, since the
## shell code in configure will try each of these formats in the order
## listed in this file. A plain '-MD' option would be understood by many
## compilers, so we must ensure this comes after the gcc and icc options.
pgcc)
# Portland's C compiler understands '-MD'.
# Will always output deps to 'file.d' where file is the root name of the
# source file under compilation, even if file resides in a subdirectory.
# The object file name does not affect the name of the '.d' file.
# pgcc 10.2 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using '\' :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
set_dir_from "$object"
# Use the source, not the object, to determine the base name, since
# that's sadly what pgcc will do too.
set_base_from "$source"
tmpdepfile=$base.d
# For projects that build the same source file twice into different object
# files, the pgcc approach of using the *source* file root name can cause
# problems in parallel builds. Use a locking strategy to avoid stomping on
# the same $tmpdepfile.
lockdir=$base.d-lock
trap "
echo '$0: caught signal, cleaning up...' >&2
rmdir '$lockdir'
exit 1
" 1 2 13 15
numtries=100
i=$numtries
while test $i -gt 0; do
# mkdir is a portable test-and-set.
if mkdir "$lockdir" 2>/dev/null; then
# This process acquired the lock.
"$@" -MD
stat=$?
# Release the lock.
rmdir "$lockdir"
break
else
# If the lock is being held by a different process, wait
# until the winning process is done or we timeout.
while test -d "$lockdir" && test $i -gt 0; do
sleep 1
i=`expr $i - 1`
done
fi
i=`expr $i - 1`
done
trap - 1 2 13 15
if test $i -le 0; then
echo "$0: failed to acquire lock after $numtries attempts" >&2
echo "$0: check lockdir '$lockdir'" >&2
exit 1
fi
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
# Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in 'foo.d' instead, so we check for that too.
# Subdirectories are respected.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
# Libtool generates 2 separate objects for the 2 libraries. These
# two compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir$base.o.d # libtool 1.5
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
# Same post-processing that is required for AIX mode.
aix_post_process_depfile
;;
msvc7)
if test "$libtool" = yes; then
showIncludes=-Wc,-showIncludes
else
showIncludes=-showIncludes
fi
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The first sed program below extracts the file names and escapes
# backslashes for cygpath. The second sed program outputs the file
# name when reading, but also accumulates all include files in the
# hold buffer in order to output them again at the end. This only
# works with sed implementations that can handle large buffers.
sed < "$tmpdepfile" -n '
/^Note: including file: *\(.*\)/ {
s//\1/
s/\\/\\\\/g
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/'"$tab"'/
G
p
}' >> "$depfile"
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
rm -f "$tmpdepfile"
;;
msvc7msys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for ':'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this sed invocation
# correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process the last invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed '1,2d' "$tmpdepfile" \
| tr ' ' "$nl" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E \
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
| sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
echo "$tab" >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

76
examples/Makefile.am Normal file
View File

@ -0,0 +1,76 @@
MAINTAINERCLEANFILES = Makefile.in
dist_man_MANS = dc1394_multiview.1 dc1394_reset_bus.1 dc1394_vloopback.1 grab_color_image.1 grab_gray_image.1 grab_partial_image.1
AM_CPPFLAGS = -I$(top_srcdir)
A = grab_gray_image grab_partial_image grab_color_image \
grab_color_image2 helloworld ladybug grab_partial_pvn \
basler_sff_info basler_sff_extended_data ladybug5capture
B = dc1394_reset_bus
if HAVE_LIBSDL
if HAVE_OPENGL
A += dc1394_iso
endif
endif
if HAVE_LINUX
if HAVE_VIDEODEV
B += dc1394_vloopback
endif
if HAVE_XV
A += dc1394_multiview
endif
if HAVE_OPENGL
GL_LIBS = -lGL
endif
endif
if HAVE_WINDOWS
if HAVE_OPENGL
GL_LIBS = -lopengl32
endif
endif
if HAVE_MACOSX
AM_LDFLAGS = -framework CoreFoundation $(FRAMEWORK_IOKIT)
endif
noinst_PROGRAMS = $(A)
bin_PROGRAMS = $(B)
LDADD = ../dc1394/libdc1394.la
helloworld_SOURCES = helloworld.c
ladybug_SOURCES = ladybug.c
ladybug5capture_SOURCES = ladybug5capture.c
grab_gray_image_SOURCES = grab_gray_image.c
grab_color_image_SOURCES = grab_color_image.c
grab_color_image2_SOURCES = grab_color_image2.c
grab_partial_image_SOURCES = grab_partial_image.c
grab_partial_pvn_SOURCES = grab_partial_pvn.c
dc1394_vloopback_SOURCES = dc1394_vloopback.c affine.c affine.h
dc1394_vloopback_LDADD = $(LDADD) -lm
dc1394_reset_bus_SOURCES = dc1394_reset_bus.c
basler_sff_info_SOURCES = basler_sff_info.c
basler_sff_extended_data_SOURCES = basler_sff_extended_data.c
dc1394_multiview_CFLAGS = $(X_CFLAGS) $(XV_CFLAGS)
dc1394_multiview_SOURCES = dc1394_multiview.c
dc1394_multiview_LDADD = $(LDADD) $(X_LIBS) $(X_PRE_LIBS) $(XV_LIBS) -lX11 $(X_EXTRA_LIBS)
dc1394_iso_CFLAGS = $(SDL_CFLAGS)
dc1394_iso_SOURCES = dc1394_iso.c
dc1394_iso_LDADD = $(LDADD) $(SDL_LIBS) $(GL_LIBS)

967
examples/Makefile.in Normal file
View File

@ -0,0 +1,967 @@
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
@HAVE_LIBSDL_TRUE@@HAVE_OPENGL_TRUE@am__append_1 = dc1394_iso
@HAVE_LINUX_TRUE@@HAVE_VIDEODEV_TRUE@am__append_2 = dc1394_vloopback
@HAVE_LINUX_TRUE@@HAVE_XV_TRUE@am__append_3 = dc1394_multiview
noinst_PROGRAMS = $(am__EXEEXT_5)
bin_PROGRAMS = $(am__EXEEXT_2)
subdir = examples
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp $(dist_man_MANS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/ax_check_framework.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
@HAVE_LINUX_TRUE@@HAVE_VIDEODEV_TRUE@am__EXEEXT_1 = dc1394_vloopback$(EXEEXT)
am__EXEEXT_2 = dc1394_reset_bus$(EXEEXT) $(am__EXEEXT_1)
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
@HAVE_LIBSDL_TRUE@@HAVE_OPENGL_TRUE@am__EXEEXT_3 = \
@HAVE_LIBSDL_TRUE@@HAVE_OPENGL_TRUE@ dc1394_iso$(EXEEXT)
@HAVE_LINUX_TRUE@@HAVE_XV_TRUE@am__EXEEXT_4 = \
@HAVE_LINUX_TRUE@@HAVE_XV_TRUE@ dc1394_multiview$(EXEEXT)
am__EXEEXT_5 = grab_gray_image$(EXEEXT) grab_partial_image$(EXEEXT) \
grab_color_image$(EXEEXT) grab_color_image2$(EXEEXT) \
helloworld$(EXEEXT) ladybug$(EXEEXT) grab_partial_pvn$(EXEEXT) \
basler_sff_info$(EXEEXT) basler_sff_extended_data$(EXEEXT) \
ladybug5capture$(EXEEXT) $(am__EXEEXT_3) $(am__EXEEXT_4)
PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
am_basler_sff_extended_data_OBJECTS = \
basler_sff_extended_data.$(OBJEXT)
basler_sff_extended_data_OBJECTS = \
$(am_basler_sff_extended_data_OBJECTS)
basler_sff_extended_data_LDADD = $(LDADD)
basler_sff_extended_data_DEPENDENCIES = ../dc1394/libdc1394.la
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
am_basler_sff_info_OBJECTS = basler_sff_info.$(OBJEXT)
basler_sff_info_OBJECTS = $(am_basler_sff_info_OBJECTS)
basler_sff_info_LDADD = $(LDADD)
basler_sff_info_DEPENDENCIES = ../dc1394/libdc1394.la
am_dc1394_iso_OBJECTS = dc1394_iso-dc1394_iso.$(OBJEXT)
dc1394_iso_OBJECTS = $(am_dc1394_iso_OBJECTS)
am__DEPENDENCIES_1 =
dc1394_iso_DEPENDENCIES = $(LDADD) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
dc1394_iso_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(dc1394_iso_CFLAGS) \
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
am_dc1394_multiview_OBJECTS = \
dc1394_multiview-dc1394_multiview.$(OBJEXT)
dc1394_multiview_OBJECTS = $(am_dc1394_multiview_OBJECTS)
dc1394_multiview_DEPENDENCIES = $(LDADD) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
dc1394_multiview_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(dc1394_multiview_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
am_dc1394_reset_bus_OBJECTS = dc1394_reset_bus.$(OBJEXT)
dc1394_reset_bus_OBJECTS = $(am_dc1394_reset_bus_OBJECTS)
dc1394_reset_bus_LDADD = $(LDADD)
dc1394_reset_bus_DEPENDENCIES = ../dc1394/libdc1394.la
am_dc1394_vloopback_OBJECTS = dc1394_vloopback.$(OBJEXT) \
affine.$(OBJEXT)
dc1394_vloopback_OBJECTS = $(am_dc1394_vloopback_OBJECTS)
dc1394_vloopback_DEPENDENCIES = $(LDADD)
am_grab_color_image_OBJECTS = grab_color_image.$(OBJEXT)
grab_color_image_OBJECTS = $(am_grab_color_image_OBJECTS)
grab_color_image_LDADD = $(LDADD)
grab_color_image_DEPENDENCIES = ../dc1394/libdc1394.la
am_grab_color_image2_OBJECTS = grab_color_image2.$(OBJEXT)
grab_color_image2_OBJECTS = $(am_grab_color_image2_OBJECTS)
grab_color_image2_LDADD = $(LDADD)
grab_color_image2_DEPENDENCIES = ../dc1394/libdc1394.la
am_grab_gray_image_OBJECTS = grab_gray_image.$(OBJEXT)
grab_gray_image_OBJECTS = $(am_grab_gray_image_OBJECTS)
grab_gray_image_LDADD = $(LDADD)
grab_gray_image_DEPENDENCIES = ../dc1394/libdc1394.la
am_grab_partial_image_OBJECTS = grab_partial_image.$(OBJEXT)
grab_partial_image_OBJECTS = $(am_grab_partial_image_OBJECTS)
grab_partial_image_LDADD = $(LDADD)
grab_partial_image_DEPENDENCIES = ../dc1394/libdc1394.la
am_grab_partial_pvn_OBJECTS = grab_partial_pvn.$(OBJEXT)
grab_partial_pvn_OBJECTS = $(am_grab_partial_pvn_OBJECTS)
grab_partial_pvn_LDADD = $(LDADD)
grab_partial_pvn_DEPENDENCIES = ../dc1394/libdc1394.la
am_helloworld_OBJECTS = helloworld.$(OBJEXT)
helloworld_OBJECTS = $(am_helloworld_OBJECTS)
helloworld_LDADD = $(LDADD)
helloworld_DEPENDENCIES = ../dc1394/libdc1394.la
am_ladybug_OBJECTS = ladybug.$(OBJEXT)
ladybug_OBJECTS = $(am_ladybug_OBJECTS)
ladybug_LDADD = $(LDADD)
ladybug_DEPENDENCIES = ../dc1394/libdc1394.la
am_ladybug5capture_OBJECTS = ladybug5capture.$(OBJEXT)
ladybug5capture_OBJECTS = $(am_ladybug5capture_OBJECTS)
ladybug5capture_LDADD = $(LDADD)
ladybug5capture_DEPENDENCIES = ../dc1394/libdc1394.la
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(basler_sff_extended_data_SOURCES) \
$(basler_sff_info_SOURCES) $(dc1394_iso_SOURCES) \
$(dc1394_multiview_SOURCES) $(dc1394_reset_bus_SOURCES) \
$(dc1394_vloopback_SOURCES) $(grab_color_image_SOURCES) \
$(grab_color_image2_SOURCES) $(grab_gray_image_SOURCES) \
$(grab_partial_image_SOURCES) $(grab_partial_pvn_SOURCES) \
$(helloworld_SOURCES) $(ladybug_SOURCES) \
$(ladybug5capture_SOURCES)
DIST_SOURCES = $(basler_sff_extended_data_SOURCES) \
$(basler_sff_info_SOURCES) $(dc1394_iso_SOURCES) \
$(dc1394_multiview_SOURCES) $(dc1394_reset_bus_SOURCES) \
$(dc1394_vloopback_SOURCES) $(grab_color_image_SOURCES) \
$(grab_color_image2_SOURCES) $(grab_gray_image_SOURCES) \
$(grab_partial_image_SOURCES) $(grab_partial_pvn_SOURCES) \
$(helloworld_SOURCES) $(ladybug_SOURCES) \
$(ladybug5capture_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
man1dir = $(mandir)/man1
NROFF = nroff
MANS = $(dist_man_MANS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
pkgincludedir = @pkgincludedir@
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
DX_CONFIG = @DX_CONFIG@
DX_DOCDIR = @DX_DOCDIR@
DX_DOT = @DX_DOT@
DX_DOXYGEN = @DX_DOXYGEN@
DX_DVIPS = @DX_DVIPS@
DX_EGREP = @DX_EGREP@
DX_ENV = @DX_ENV@
DX_FLAG_chi = @DX_FLAG_chi@
DX_FLAG_chm = @DX_FLAG_chm@
DX_FLAG_doc = @DX_FLAG_doc@
DX_FLAG_dot = @DX_FLAG_dot@
DX_FLAG_html = @DX_FLAG_html@
DX_FLAG_man = @DX_FLAG_man@
DX_FLAG_pdf = @DX_FLAG_pdf@
DX_FLAG_ps = @DX_FLAG_ps@
DX_FLAG_rtf = @DX_FLAG_rtf@
DX_FLAG_xml = @DX_FLAG_xml@
DX_HHC = @DX_HHC@
DX_LATEX = @DX_LATEX@
DX_MAKEINDEX = @DX_MAKEINDEX@
DX_PDFLATEX = @DX_PDFLATEX@
DX_PERL = @DX_PERL@
DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FRAMEWORK_IOKIT = @FRAMEWORK_IOKIT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
LIBUSB_LIBS = @LIBUSB_LIBS@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
SDL_CONFIG = @SDL_CONFIG@
SDL_LIBS = @SDL_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
XMKMF = @XMKMF@
XV_CFLAGS = @XV_CFLAGS@
XV_LIBS = @XV_LIBS@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_age = @lt_age@
lt_current = @lt_current@
lt_revision = @lt_revision@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
platform_LDFLAGS = @platform_LDFLAGS@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
MAINTAINERCLEANFILES = Makefile.in
dist_man_MANS = dc1394_multiview.1 dc1394_reset_bus.1 dc1394_vloopback.1 grab_color_image.1 grab_gray_image.1 grab_partial_image.1
AM_CPPFLAGS = -I$(top_srcdir)
A = grab_gray_image grab_partial_image grab_color_image \
grab_color_image2 helloworld ladybug grab_partial_pvn \
basler_sff_info basler_sff_extended_data ladybug5capture \
$(am__append_1) $(am__append_3)
B = dc1394_reset_bus $(am__append_2)
@HAVE_LINUX_TRUE@@HAVE_OPENGL_TRUE@GL_LIBS = -lGL
@HAVE_OPENGL_TRUE@@HAVE_WINDOWS_TRUE@GL_LIBS = -lopengl32
@HAVE_MACOSX_TRUE@AM_LDFLAGS = -framework CoreFoundation $(FRAMEWORK_IOKIT)
LDADD = ../dc1394/libdc1394.la
helloworld_SOURCES = helloworld.c
ladybug_SOURCES = ladybug.c
ladybug5capture_SOURCES = ladybug5capture.c
grab_gray_image_SOURCES = grab_gray_image.c
grab_color_image_SOURCES = grab_color_image.c
grab_color_image2_SOURCES = grab_color_image2.c
grab_partial_image_SOURCES = grab_partial_image.c
grab_partial_pvn_SOURCES = grab_partial_pvn.c
dc1394_vloopback_SOURCES = dc1394_vloopback.c affine.c affine.h
dc1394_vloopback_LDADD = $(LDADD) -lm
dc1394_reset_bus_SOURCES = dc1394_reset_bus.c
basler_sff_info_SOURCES = basler_sff_info.c
basler_sff_extended_data_SOURCES = basler_sff_extended_data.c
dc1394_multiview_CFLAGS = $(X_CFLAGS) $(XV_CFLAGS)
dc1394_multiview_SOURCES = dc1394_multiview.c
dc1394_multiview_LDADD = $(LDADD) $(X_LIBS) $(X_PRE_LIBS) $(XV_LIBS) -lX11 $(X_EXTRA_LIBS)
dc1394_iso_CFLAGS = $(SDL_CFLAGS)
dc1394_iso_SOURCES = dc1394_iso.c
dc1394_iso_LDADD = $(LDADD) $(SDL_LIBS) $(GL_LIBS)
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu examples/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
$(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
fi; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p \
|| test -f $$p1 \
; then echo "$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n;h' \
-e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) files[d] = files[d] " " $$1; \
else { print "f", $$3 "/" $$4, $$1; } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
} \
; done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' \
`; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(bindir)" && rm -f $$files
clean-binPROGRAMS:
@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
clean-noinstPROGRAMS:
@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
basler_sff_extended_data$(EXEEXT): $(basler_sff_extended_data_OBJECTS) $(basler_sff_extended_data_DEPENDENCIES) $(EXTRA_basler_sff_extended_data_DEPENDENCIES)
@rm -f basler_sff_extended_data$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(basler_sff_extended_data_OBJECTS) $(basler_sff_extended_data_LDADD) $(LIBS)
basler_sff_info$(EXEEXT): $(basler_sff_info_OBJECTS) $(basler_sff_info_DEPENDENCIES) $(EXTRA_basler_sff_info_DEPENDENCIES)
@rm -f basler_sff_info$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(basler_sff_info_OBJECTS) $(basler_sff_info_LDADD) $(LIBS)
dc1394_iso$(EXEEXT): $(dc1394_iso_OBJECTS) $(dc1394_iso_DEPENDENCIES) $(EXTRA_dc1394_iso_DEPENDENCIES)
@rm -f dc1394_iso$(EXEEXT)
$(AM_V_CCLD)$(dc1394_iso_LINK) $(dc1394_iso_OBJECTS) $(dc1394_iso_LDADD) $(LIBS)
dc1394_multiview$(EXEEXT): $(dc1394_multiview_OBJECTS) $(dc1394_multiview_DEPENDENCIES) $(EXTRA_dc1394_multiview_DEPENDENCIES)
@rm -f dc1394_multiview$(EXEEXT)
$(AM_V_CCLD)$(dc1394_multiview_LINK) $(dc1394_multiview_OBJECTS) $(dc1394_multiview_LDADD) $(LIBS)
dc1394_reset_bus$(EXEEXT): $(dc1394_reset_bus_OBJECTS) $(dc1394_reset_bus_DEPENDENCIES) $(EXTRA_dc1394_reset_bus_DEPENDENCIES)
@rm -f dc1394_reset_bus$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(dc1394_reset_bus_OBJECTS) $(dc1394_reset_bus_LDADD) $(LIBS)
dc1394_vloopback$(EXEEXT): $(dc1394_vloopback_OBJECTS) $(dc1394_vloopback_DEPENDENCIES) $(EXTRA_dc1394_vloopback_DEPENDENCIES)
@rm -f dc1394_vloopback$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(dc1394_vloopback_OBJECTS) $(dc1394_vloopback_LDADD) $(LIBS)
grab_color_image$(EXEEXT): $(grab_color_image_OBJECTS) $(grab_color_image_DEPENDENCIES) $(EXTRA_grab_color_image_DEPENDENCIES)
@rm -f grab_color_image$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(grab_color_image_OBJECTS) $(grab_color_image_LDADD) $(LIBS)
grab_color_image2$(EXEEXT): $(grab_color_image2_OBJECTS) $(grab_color_image2_DEPENDENCIES) $(EXTRA_grab_color_image2_DEPENDENCIES)
@rm -f grab_color_image2$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(grab_color_image2_OBJECTS) $(grab_color_image2_LDADD) $(LIBS)
grab_gray_image$(EXEEXT): $(grab_gray_image_OBJECTS) $(grab_gray_image_DEPENDENCIES) $(EXTRA_grab_gray_image_DEPENDENCIES)
@rm -f grab_gray_image$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(grab_gray_image_OBJECTS) $(grab_gray_image_LDADD) $(LIBS)
grab_partial_image$(EXEEXT): $(grab_partial_image_OBJECTS) $(grab_partial_image_DEPENDENCIES) $(EXTRA_grab_partial_image_DEPENDENCIES)
@rm -f grab_partial_image$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(grab_partial_image_OBJECTS) $(grab_partial_image_LDADD) $(LIBS)
grab_partial_pvn$(EXEEXT): $(grab_partial_pvn_OBJECTS) $(grab_partial_pvn_DEPENDENCIES) $(EXTRA_grab_partial_pvn_DEPENDENCIES)
@rm -f grab_partial_pvn$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(grab_partial_pvn_OBJECTS) $(grab_partial_pvn_LDADD) $(LIBS)
helloworld$(EXEEXT): $(helloworld_OBJECTS) $(helloworld_DEPENDENCIES) $(EXTRA_helloworld_DEPENDENCIES)
@rm -f helloworld$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(helloworld_OBJECTS) $(helloworld_LDADD) $(LIBS)
ladybug$(EXEEXT): $(ladybug_OBJECTS) $(ladybug_DEPENDENCIES) $(EXTRA_ladybug_DEPENDENCIES)
@rm -f ladybug$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(ladybug_OBJECTS) $(ladybug_LDADD) $(LIBS)
ladybug5capture$(EXEEXT): $(ladybug5capture_OBJECTS) $(ladybug5capture_DEPENDENCIES) $(EXTRA_ladybug5capture_DEPENDENCIES)
@rm -f ladybug5capture$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(ladybug5capture_OBJECTS) $(ladybug5capture_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/affine.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basler_sff_extended_data.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basler_sff_info.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dc1394_iso-dc1394_iso.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dc1394_multiview-dc1394_multiview.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dc1394_reset_bus.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dc1394_vloopback.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grab_color_image.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grab_color_image2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grab_gray_image.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grab_partial_image.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grab_partial_pvn.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helloworld.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ladybug.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ladybug5capture.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
dc1394_iso-dc1394_iso.o: dc1394_iso.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dc1394_iso_CFLAGS) $(CFLAGS) -MT dc1394_iso-dc1394_iso.o -MD -MP -MF $(DEPDIR)/dc1394_iso-dc1394_iso.Tpo -c -o dc1394_iso-dc1394_iso.o `test -f 'dc1394_iso.c' || echo '$(srcdir)/'`dc1394_iso.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dc1394_iso-dc1394_iso.Tpo $(DEPDIR)/dc1394_iso-dc1394_iso.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dc1394_iso.c' object='dc1394_iso-dc1394_iso.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dc1394_iso_CFLAGS) $(CFLAGS) -c -o dc1394_iso-dc1394_iso.o `test -f 'dc1394_iso.c' || echo '$(srcdir)/'`dc1394_iso.c
dc1394_iso-dc1394_iso.obj: dc1394_iso.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dc1394_iso_CFLAGS) $(CFLAGS) -MT dc1394_iso-dc1394_iso.obj -MD -MP -MF $(DEPDIR)/dc1394_iso-dc1394_iso.Tpo -c -o dc1394_iso-dc1394_iso.obj `if test -f 'dc1394_iso.c'; then $(CYGPATH_W) 'dc1394_iso.c'; else $(CYGPATH_W) '$(srcdir)/dc1394_iso.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dc1394_iso-dc1394_iso.Tpo $(DEPDIR)/dc1394_iso-dc1394_iso.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dc1394_iso.c' object='dc1394_iso-dc1394_iso.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dc1394_iso_CFLAGS) $(CFLAGS) -c -o dc1394_iso-dc1394_iso.obj `if test -f 'dc1394_iso.c'; then $(CYGPATH_W) 'dc1394_iso.c'; else $(CYGPATH_W) '$(srcdir)/dc1394_iso.c'; fi`
dc1394_multiview-dc1394_multiview.o: dc1394_multiview.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dc1394_multiview_CFLAGS) $(CFLAGS) -MT dc1394_multiview-dc1394_multiview.o -MD -MP -MF $(DEPDIR)/dc1394_multiview-dc1394_multiview.Tpo -c -o dc1394_multiview-dc1394_multiview.o `test -f 'dc1394_multiview.c' || echo '$(srcdir)/'`dc1394_multiview.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dc1394_multiview-dc1394_multiview.Tpo $(DEPDIR)/dc1394_multiview-dc1394_multiview.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dc1394_multiview.c' object='dc1394_multiview-dc1394_multiview.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dc1394_multiview_CFLAGS) $(CFLAGS) -c -o dc1394_multiview-dc1394_multiview.o `test -f 'dc1394_multiview.c' || echo '$(srcdir)/'`dc1394_multiview.c
dc1394_multiview-dc1394_multiview.obj: dc1394_multiview.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dc1394_multiview_CFLAGS) $(CFLAGS) -MT dc1394_multiview-dc1394_multiview.obj -MD -MP -MF $(DEPDIR)/dc1394_multiview-dc1394_multiview.Tpo -c -o dc1394_multiview-dc1394_multiview.obj `if test -f 'dc1394_multiview.c'; then $(CYGPATH_W) 'dc1394_multiview.c'; else $(CYGPATH_W) '$(srcdir)/dc1394_multiview.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dc1394_multiview-dc1394_multiview.Tpo $(DEPDIR)/dc1394_multiview-dc1394_multiview.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dc1394_multiview.c' object='dc1394_multiview-dc1394_multiview.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dc1394_multiview_CFLAGS) $(CFLAGS) -c -o dc1394_multiview-dc1394_multiview.obj `if test -f 'dc1394_multiview.c'; then $(CYGPATH_W) 'dc1394_multiview.c'; else $(CYGPATH_W) '$(srcdir)/dc1394_multiview.c'; fi`
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-man1: $(dist_man_MANS)
@$(NORMAL_INSTALL)
@list1=''; \
list2='$(dist_man_MANS)'; \
test -n "$(man1dir)" \
&& test -n "`echo $$list1$$list2`" \
|| exit 0; \
echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
$(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
{ for i in $$list1; do echo "$$i"; done; \
if test -n "$$list2"; then \
for i in $$list2; do echo "$$i"; done \
| sed -n '/\.1[a-z]*$$/p'; \
fi; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
done | \
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
sed 'N;N;s,\n, ,g' | { \
list=; while read file base inst; do \
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
fi; \
done; \
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
while read files; do \
test -z "$$files" || { \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
done; }
uninstall-man1:
@$(NORMAL_UNINSTALL)
@list=''; test -n "$(man1dir)" || exit 0; \
files=`{ for i in $$list; do echo "$$i"; done; \
l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
sed -n '/\.1[a-z]*$$/p'; \
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS) $(MANS)
installdirs:
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool \
clean-noinstPROGRAMS mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-man
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-binPROGRAMS
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man: install-man1
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-man
uninstall-man: uninstall-man1
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
clean-binPROGRAMS clean-generic clean-libtool \
clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-binPROGRAMS install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-man1 install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \
uninstall-man uninstall-man1
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

88
examples/affine.c Normal file
View File

@ -0,0 +1,88 @@
/*
* affine.c -- Affine Transforms for 2d objects
* Copyright (C) 2002 Charles Yates <charles.yates@pandora.be>
*
* 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
*/
#include "affine.h"
static inline void Multiply( affine_transform_t *this, affine_transform_t *that )
{
double output[2][2];
register int i, j;
for ( i = 0; i < 2; i ++ )
for ( j = 0; j < 2; j ++ )
output[ i ][ j ] = this->matrix[ i ][ 0 ] * that->matrix[ j ][ 0 ] +
this->matrix[ i ][ 1 ] * that->matrix[ j ][ 1 ];
this->matrix[ 0 ][ 0 ] = output[ 0 ][ 0 ];
this->matrix[ 0 ][ 1 ] = output[ 0 ][ 1 ];
this->matrix[ 1 ][ 0 ] = output[ 1 ][ 0 ];
this->matrix[ 1 ][ 1 ] = output[ 1 ][ 1 ];
}
void affine_transform_init( affine_transform_t *this )
{
this->matrix[ 0 ][ 0 ] = 1;
this->matrix[ 0 ][ 1 ] = 0;
this->matrix[ 1 ][ 0 ] = 0;
this->matrix[ 1 ][ 1 ] = 1;
}
// Rotate by a given angle
void affine_transform_rotate( affine_transform_t *this, double angle )
{
affine_transform_t affine;
affine.matrix[ 0 ][ 0 ] = cos( angle * M_PI / 180 );
affine.matrix[ 0 ][ 1 ] = 0 - sin( angle * M_PI / 180 );
affine.matrix[ 1 ][ 0 ] = sin( angle * M_PI / 180 );
affine.matrix[ 1 ][ 1 ] = cos( angle * M_PI / 180 );
Multiply( this, &affine );
}
// Shear by a given value
void affine_transform_shear( affine_transform_t *this, double shear )
{
affine_transform_t affine;
affine.matrix[ 0 ][ 0 ] = 1;
affine.matrix[ 0 ][ 1 ] = shear;
affine.matrix[ 1 ][ 0 ] = 0;
affine.matrix[ 1 ][ 1 ] = 1;
Multiply( this, &affine );
}
void affine_transform_scale( affine_transform_t *this, double sx, double sy )
{
affine_transform_t affine;
affine.matrix[ 0 ][ 0 ] = sx;
affine.matrix[ 0 ][ 1 ] = 0;
affine.matrix[ 1 ][ 0 ] = 0;
affine.matrix[ 1 ][ 1 ] = sy;
Multiply( this, &affine );
}
// Obtain the mapped x coordinate of the input
double affine_transform_mapx( affine_transform_t *this, int x, int y )
{
return this->matrix[0][0] * x + this->matrix[0][1] * y;
}
// Obtain the mapped y coordinate of the input
double affine_transform_mapy( affine_transform_t *this, int x, int y )
{
return this->matrix[1][0] * x + this->matrix[1][1] * y;
}

41
examples/affine.h Normal file
View File

@ -0,0 +1,41 @@
/*
* affine.h -- Affine Transforms for 2d objects
* Copyright (C) 2002 Charles Yates <charles.yates@pandora.be>
*
* 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
*/
#ifndef _AFFINE_H
#define _AFFINE_H
#include <math.h>
/** Affine transforms for 2d image manipulation. Current provides shearing and
rotating support.
*/
typedef struct {
double matrix[2][2];
} affine_transform_t;
void affine_transform_init( affine_transform_t *this );
void affine_transform_rotate( affine_transform_t *this, double angle );
void affine_transform_shear( affine_transform_t *this, double shear );
void affine_transform_scale( affine_transform_t *this, double sx, double sy );
double affine_transform_mapx( affine_transform_t *this, int x, int y );
double affine_transform_mapy( affine_transform_t *this, int x, int y );
#endif

View File

@ -0,0 +1,245 @@
/*
* 1394-Based Digital Camera Control Library
* Basler Smart Feature Framework specific extensions
* Copyright (C) 2006 Mikael Olenfalk, Tobii Technology AB, Stockholm Sweden
*
* Written by Mikael Olenfalk <mikael _DOT_ olenfalk _AT_ tobii _DOT_ com>
* Version : 16/02/2005
*
* 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
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <dc1394/dc1394.h>
#include <dc1394/vendor/basler.h>
int list_cameras (dc1394_t * d, dc1394camera_list_t * list)
{
uint32_t i;
dc1394bool_t sff_available;
dc1394camera_t * camera;
for (i = 0; i < list->num; i++) {
sff_available = DC1394_FALSE;
camera = dc1394_camera_new (d, list->ids[i].guid);
dc1394_basler_sff_is_available (camera, &sff_available);
printf ("%02d:0x%"PRIx64":%s:%s:%s\n", i, camera->guid,
camera->vendor, camera->model, sff_available ? "SFF" : "NO SFF");
dc1394_camera_free (camera);
}
return 0;
}
int print_usage ()
{
printf ("usage: basler_sff_extended_data [--list-cameras|[--guid GUID]]\n");
return 1;
}
int main (int argc, char **argv)
{
dc1394error_t err;
dc1394camera_t *camera = NULL;
dc1394bool_t sff_available;
uint32_t i, max_height, max_width;
uint64_t guid = 0x0LL, total_bytes;
uint8_t* buffer;
dc1394basler_sff_t chunk;
dc1394basler_sff_extended_data_stream_t* sff_ext;
dc1394basler_sff_dcam_values_t* sff_dcam;
dc1394_t * d;
dc1394camera_list_t * list;
d = dc1394_new ();
if (!d)
return 1;
err=dc1394_camera_enumerate (d, &list);
DC1394_ERR_RTN(err,"Failed to enumerate cameras\n");
if (list->num == 0) {
dc1394_log_error("No cameras found");
return 1;
}
/* parse arguments */
if (argc == 2) {
if (!strcmp (argv[1], "--list-cameras"))
list_cameras (d, list);
else
print_usage();
dc1394_camera_free_list (list);
dc1394_free (d);
return 0;
} else if (argc == 3) {
if (!strcmp (argv[1], "--guid")) {
if (sscanf (argv[2], "0x%"PRIx64, &guid) == 1) {
} else {
dc1394_camera_free_list (list);
dc1394_free (d);
return print_usage();
}
}
} else if (argc != 1) {
dc1394_camera_free_list (list);
dc1394_free (d);
return print_usage();
}
if (guid == 0x0LL) {
printf ("I: found %d camera%s, working with camera 0\n", list->num,
list->num == 1 ? "" : "s");
camera = dc1394_camera_new (d, list->ids[0].guid);
} else {
camera = dc1394_camera_new (d, guid);
if (camera == NULL) {
dc1394_log_error("no camera with guid 0x%"PRIx64" found", guid);
return 1;
}
printf ("I: found camera with guid 0x%"PRIx64"\n", guid);
}
dc1394_camera_free_list (list);
/*
* setup format7 with a roi allocating a quarter of the screen and bounce around the roi, while changing gain and brightness
*/
err = dc1394_video_set_mode (camera, DC1394_VIDEO_MODE_FORMAT7_0);
DC1394_ERR_CLN_RTN(err,dc1394_camera_free (camera),"cannot choose format7_0");
printf ("I: video mode is format7_0\n");
err = dc1394_feature_set_value (camera, DC1394_FEATURE_GAIN, 100);
DC1394_ERR_CLN_RTN(err,dc1394_camera_free (camera),"cannot set gain");
printf ("I: gain is 100\n");
err = dc1394_feature_set_value (camera, DC1394_FEATURE_SHUTTER, 50);
DC1394_ERR_CLN_RTN(err,dc1394_camera_free (camera),"cannot set shutter");
printf ("I: shutter is 50\n");
err = dc1394_feature_set_value (camera, DC1394_FEATURE_BRIGHTNESS, 150);
DC1394_ERR_CLN_RTN(err,dc1394_camera_free (camera),"cannot set brightness");
printf ("I: brightness is 150\n");
err = dc1394_format7_get_max_image_size (camera, DC1394_VIDEO_MODE_FORMAT7_0, &max_width, &max_height);
DC1394_ERR_CLN_RTN(err,dc1394_camera_free (camera),"cannot get max image size for format7_0");
printf ("I: max image size is: height = %d, width = %d\n", max_height, max_width);
err = dc1394_format7_set_roi (camera, DC1394_VIDEO_MODE_FORMAT7_0, DC1394_COLOR_CODING_MONO8,
DC1394_USE_RECOMMENDED, 0, 0, max_width / 2, max_height / 2);
DC1394_ERR_CLN_RTN(err,dc1394_camera_free (camera),"cannot set roi");
printf ("I: roi is (0, 0) - (%d, %d)\n", max_width / 2, max_height / 2);
err = dc1394_format7_get_total_bytes (camera, DC1394_VIDEO_MODE_FORMAT7_0, &total_bytes);
DC1394_ERR_CLN_RTN(err,dc1394_camera_free (camera),"cannot get total bytes");
printf ("I: total bytes is %"PRIu64" before SFF enabled\n", total_bytes);
err = dc1394_basler_sff_is_available (camera, &sff_available);
DC1394_ERR_CLN_RTN(err,dc1394_camera_free (camera),"cannot check if SFF is available");
if (!sff_available) {
dc1394_camera_free (camera);
dc1394_log_error("SFF is not available");
return 2;
} else {
printf ("I: SFF is available\n");
}
err = dc1394_basler_sff_feature_enable (camera, DC1394_BASLER_SFF_EXTENDED_DATA_STREAM, DC1394_ON);
DC1394_ERR_CLN_RTN(err,dc1394_camera_free (camera), "cannot enable Extended_Data_Stream");
err = dc1394_format7_get_total_bytes (camera, DC1394_VIDEO_MODE_FORMAT7_0, &total_bytes);
DC1394_ERR_CLN_RTN(err,dc1394_camera_free (camera), "cannot get total bytes");
printf ("I: total bytes is %"PRIu64" after Extended_Data_Stream was enabled\n", total_bytes);
err = dc1394_basler_sff_feature_enable (camera, DC1394_BASLER_SFF_DCAM_VALUES, DC1394_ON);
DC1394_ERR_CLN_RTN(err,dc1394_camera_free (camera), "cannot enable DCAM_Values");
err = dc1394_format7_get_total_bytes (camera, DC1394_VIDEO_MODE_FORMAT7_0, &total_bytes);
DC1394_ERR_CLN_RTN(err,dc1394_camera_free (camera), "cannot get total bytes");
printf ("I: total bytes is %"PRIu64" after DCAM_Values was enabled\n", total_bytes);
err = dc1394_capture_setup (camera, 10, DC1394_CAPTURE_FLAGS_DEFAULT);
DC1394_ERR_CLN_RTN(err,dc1394_camera_free (camera), "cannot setup capture");
err = dc1394_video_set_transmission (camera, DC1394_ON);
if (err != DC1394_SUCCESS)
dc1394_capture_stop (camera);
DC1394_ERR_CLN_RTN(err,dc1394_camera_free (camera), "cannot enable transmission");
i = 0;
dc1394video_frame_t* frame;
while (i < 100) {
err = dc1394_capture_dequeue (camera, DC1394_CAPTURE_POLICY_WAIT, &frame);
if (err != DC1394_SUCCESS) {
dc1394_log_error("capture failed (%d)", err);
break;
}
buffer = frame->image;
/* parse chunks and print */
// printf ("-- %02d - %d\n", i, dc1394_capture_get_bytes_per_frame(camera));
dc1394_basler_sff_chunk_iterate_init (&chunk, buffer, total_bytes, DC1394_FALSE);
while ((err = dc1394_basler_sff_chunk_iterate(&chunk)) == DC1394_SUCCESS) {
switch (chunk.feature_id) {
case DC1394_BASLER_SFF_EXTENDED_DATA_STREAM:
{
sff_ext = (dc1394basler_sff_extended_data_stream_t*)(chunk.chunk_data);
printf ("top: %04d left: %04d height: %04d width: %04d\n",
sff_ext->top, sff_ext->left, sff_ext->height, sff_ext->width);
break;
}
case DC1394_BASLER_SFF_DCAM_VALUES:
{
sff_dcam = (dc1394basler_sff_dcam_values_t*)(chunk.chunk_data);
printf ("gain: %04d brightness: %04d shutter: %04d\n",
sff_dcam->gain_csr.value, sff_dcam->brightness_csr.value, sff_dcam->shutter_csr.value);
break;
}
default:
break;
}
}
if (err != DC1394_BASLER_NO_MORE_SFF_CHUNKS) {
dc1394_log_error("error parsing chunks");
break;
}
err = dc1394_capture_enqueue(camera, frame);
if (err != DC1394_SUCCESS) {
dc1394_log_error("cannot release buffer");
break;
}
err = dc1394_format7_set_image_position (camera, DC1394_VIDEO_MODE_FORMAT7_0, (((i+1) * 10) % max_height) / 2 - 1, (((i+1) * 10) % max_width) / 2 - 1);
if (err != DC1394_SUCCESS) {
dc1394_log_error("cannot set image position %d - %d", (((i+1) * 10) % max_height) / 2 - 1, (((i+1) * 10) % max_width) / 2 - 1);
}
i++;
}
dc1394_video_set_transmission (camera, DC1394_OFF);
dc1394_capture_stop (camera);
dc1394_camera_free (camera);
dc1394_free (d);
return 0;
}

121
examples/basler_sff_info.c Normal file
View File

@ -0,0 +1,121 @@
/*
* 1394-Based Digital Camera Control Library
* Basler Smart Feature Framework specific extensions
* Copyright (C) 2006 Mikael Olenfalk, Tobii Technology AB, Stockholm Sweden
*
* Written by Mikael Olenfalk <mikael _DOT_ olenfalk _AT_ tobii _DOT_ com>
* Version : 16/02/2005
*
* 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
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <inttypes.h>
#include <dc1394/dc1394.h>
#include <dc1394/vendor/basler.h>
int list_cameras (dc1394_t * d, dc1394camera_list_t * list)
{
uint32_t i;
dc1394bool_t sff_available;
dc1394camera_t * camera;
for (i = 0; i < list->num; i++) {
sff_available = DC1394_FALSE;
camera = dc1394_camera_new (d, list->ids[i].guid);
dc1394_basler_sff_is_available (camera, &sff_available);
printf ("%02d:0x%"PRIx64":%s:%s:%s\n", i, camera->guid,
camera->vendor, camera->model, sff_available ? "SFF" : "NO SFF");
dc1394_camera_free (camera);
}
return 0;
}
int print_usage ()
{
printf ("usage: basler_sff_info [--list-cameras|[--guid GUID]]\n");
return 1;
}
int main (int argc, char **argv)
{
dc1394camera_t *camera = NULL;
uint64_t guid = 0x0LL;
dc1394_t * d;
dc1394camera_list_t * list;
dc1394error_t err;
d = dc1394_new ();
if (!d)
return 1;
err=dc1394_camera_enumerate (d, &list);
DC1394_ERR_RTN(err,"Failed to enumerate cameras");
if (list->num == 0) {
dc1394_log_error("No cameras found");
return 1;
}
/* parse arguments */
if (argc == 2) {
if (!strcmp (argv[1], "--list-cameras"))
list_cameras (d, list);
else
print_usage();
dc1394_camera_free_list (list);
dc1394_free (d);
return 0;
} else if (argc == 3) {
if (!strcmp (argv[1], "--guid")) {
if (sscanf (argv[2], "0x%"PRIx64, &guid) == 1) {
} else {
dc1394_camera_free_list (list);
dc1394_free (d);
return print_usage();
}
}
} else if (argc != 1) {
dc1394_camera_free_list (list);
dc1394_free (d);
return print_usage();
}
if (guid == 0x0LL) {
printf ("I: found %d camera%s, working with camera 0\n", list->num,
list->num == 1 ? "" : "s");
camera = dc1394_camera_new (d, list->ids[0].guid);
} else {
camera = dc1394_camera_new (d, guid);
if (camera == NULL) {
dc1394_log_error("no camera with guid 0x%"PRIx64" found", guid);
return 1;
}
printf ("I: found camera with guid 0x%"PRIx64"\n", guid);
}
dc1394_camera_print_info (camera, stdout);
printf ("\nSFF feature info:\n");
dc1394_basler_sff_feature_print_all (camera, stdout);
dc1394_camera_free (camera);
dc1394_camera_free_list (list);
dc1394_free (d);
return 0;
}

Some files were not shown because too many files have changed in this diff Show More