Adding upstream version 1.4.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
This commit is contained in:
parent
bb950ada36
commit
72810b455a
50 changed files with 59340 additions and 0 deletions
88
AUTHORS
Normal file
88
AUTHORS
Normal file
|
@ -0,0 +1,88 @@
|
|||
# The format of this file was inspired by the Linux kernel CREDITS file.
|
||||
#
|
||||
# Authors and contributors are listed alphabetically.
|
||||
#
|
||||
# The fields are: name (N), email (E), web address (W),
|
||||
# PGP key ID and fingerprint (P), description (D)
|
||||
|
||||
N: Billy Biggs
|
||||
E: vektor@dumbterm.net
|
||||
D: libdvdcss enhancements
|
||||
|
||||
N: Diego Biurrun
|
||||
E: diego@biurrun.de
|
||||
D: misc build and portability fixes, cleanup
|
||||
|
||||
N: Stéphane Borel
|
||||
E: stef@via.ecp.fr
|
||||
D: original CSS decryption code from VLC
|
||||
|
||||
N: Sven Heithecker
|
||||
E: sven.heithecker@web.de
|
||||
D: cache bug fix for discs with identical content but different keys
|
||||
|
||||
N: Håkan Hjort
|
||||
E: d95hjort@dtek.chalmers.se
|
||||
D: Solaris port of the DVD ioctls
|
||||
D: libdvdcss enhancements
|
||||
|
||||
N: Samuel Hocevar
|
||||
E: sam@zoy.org
|
||||
D: original CSS decryption code from VLC
|
||||
|
||||
N: Eugenio Jarosiewicz
|
||||
E: ej0@cise.ufl.edu
|
||||
D: Mac OS X DVD ioctls
|
||||
|
||||
N: Jon Lech Johansen
|
||||
E: jon-vl@nanocrew.net
|
||||
D: Win32 port
|
||||
D: Fixes to the Darwin port
|
||||
|
||||
N: KO Myung-Hun
|
||||
E: komh@chollian.net
|
||||
D: OS/2 port
|
||||
|
||||
N: Jean-Baptiste Kempf
|
||||
E: jb@videolan.org
|
||||
D: maintainer
|
||||
|
||||
N: Markus Kuespert
|
||||
E: ltlBeBoy@beosmail.com
|
||||
D: BeOS port of the DVD ioctls
|
||||
|
||||
N: Pascal Levesque
|
||||
E: Pascal.Levesque@mindready.com
|
||||
D: QNX port
|
||||
|
||||
N: Steve Lhomme
|
||||
E: steve.lhomme@free.fr
|
||||
D: Windows improvements
|
||||
|
||||
N: Christophe Massiot
|
||||
E: massiot@via.ecp.fr
|
||||
D: former maintainer
|
||||
|
||||
N: Diego Elio Pettenò
|
||||
E: flameeyes@flameeyes.eu
|
||||
D: build system rewrite
|
||||
|
||||
N: Steven M. Schultz
|
||||
E: sms@TO.GD-ES.COM
|
||||
D: BSD/OS port
|
||||
|
||||
N: David Siebörger
|
||||
E: drs-videolan@rucus.ru.ac.za
|
||||
D: HP-UX port of the DVD ioctls
|
||||
|
||||
N: Alex Strelnikov
|
||||
E: lelik@os2.ru
|
||||
D: OS/2 port
|
||||
|
||||
N: German Tischler
|
||||
E: tanis@gaspode.franken.de
|
||||
D: FreeBSD DVD input
|
||||
|
||||
N: Gildas Bazin
|
||||
E: gbazin@netcourrier.com
|
||||
D: various fixes to the Windows port
|
339
COPYING
Normal file
339
COPYING
Normal file
|
@ -0,0 +1,339 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 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.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, 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 or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
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 give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
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 Program or any portion
|
||||
of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
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 Program, 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 Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) 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; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, 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 executable. However, as a
|
||||
special exception, the source code 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.
|
||||
|
||||
If distribution of executable or 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 counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program 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.
|
||||
|
||||
5. 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 Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program 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 to
|
||||
this License.
|
||||
|
||||
7. 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 Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program 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 Program.
|
||||
|
||||
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.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program 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.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the 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 Program
|
||||
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 Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, 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
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), 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 Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. 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 program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
67
INSTALL
Normal file
67
INSTALL
Normal file
|
@ -0,0 +1,67 @@
|
|||
INSTALL file for libdvdcss, a DVD access library
|
||||
|
||||
|
||||
Configuring libdvdcss
|
||||
=====================
|
||||
|
||||
A typical way to configure libdvdcss is:
|
||||
|
||||
./configure --prefix=/usr
|
||||
|
||||
See `./configure --help' for more information.
|
||||
|
||||
|
||||
If you got libdvdcss from its version control system, please bootstrap first:
|
||||
|
||||
autoreconf -i
|
||||
|
||||
|
||||
Building libdvdcss
|
||||
==================
|
||||
|
||||
Once configured, run `make' to build libdvdcss.
|
||||
|
||||
If you have player keys, you need to put them in the file csskeys.h, before
|
||||
configuring libdvdcss to enable the "key" method (the one from libcss).
|
||||
|
||||
|
||||
Installing libdvdcss
|
||||
====================
|
||||
|
||||
You can install libdvdcss by typing:
|
||||
|
||||
make install
|
||||
|
||||
|
||||
Building libdvdcss for Windows
|
||||
==============================
|
||||
|
||||
There are two alternative ways to build libdvdcss for Windows.
|
||||
|
||||
- on a host with the mingw-w64 cross-compilers:
|
||||
|
||||
Tell configure about the compiler to use. If you run, for example, Debian,
|
||||
Ubuntu, or Cygwin under Windows with the necessary mingw64 packages
|
||||
installed, it would be:
|
||||
|
||||
for a 32-bit target platform:
|
||||
./configure --host=i686-w64-mingw32
|
||||
make
|
||||
|
||||
or for a 64-bit target platform:
|
||||
./configure --host=x86_64-w64-mingw32
|
||||
make
|
||||
|
||||
- natively on Windows with MSYS + MinGW (www.mingw.org):
|
||||
|
||||
(MSYS is a minimal build environment to compile Unixish projects under
|
||||
Windows. It provides all the common Unix tools like sh, GNU Make...)
|
||||
|
||||
You will need to download and install the latest MSYS and MinGW.
|
||||
|
||||
To build libdvdcss you just have to run the following commands:
|
||||
|
||||
./configure
|
||||
make
|
||||
|
||||
More about MSYS on our wiki: http://wiki.videolan.org/Win32CompileMSYS
|
83
Makefile.am
Normal file
83
Makefile.am
Normal file
|
@ -0,0 +1,83 @@
|
|||
ACLOCAL_AMFLAGS = -I m4
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src/dvdcss
|
||||
|
||||
EXTRA_DIST = msvc libdvdcss.spec INSTALL
|
||||
|
||||
dist_doc_DATA = AUTHORS COPYING NEWS README ChangeLog
|
||||
|
||||
MAINTAINERCLEANFILES = ChangeLog
|
||||
|
||||
ChangeLog: $(wildcard $(srcdir)/.git/logs/HEAD)
|
||||
if GIT
|
||||
-cd $(srcdir) && git log > $(abs_builddir)/$(@)-tmp
|
||||
test -s $(@)-tmp && mv $(@)-tmp $(@)
|
||||
-rm -f $(@)-tmp
|
||||
endif
|
||||
test -e $(@) || touch $(@)
|
||||
|
||||
lib_LTLIBRARIES = libdvdcss.la
|
||||
EXTRA_PROGRAMS = test/csstest test/dvd_region
|
||||
|
||||
libdvdcss_la_SOURCES = \
|
||||
src/libdvdcss.c \
|
||||
src/libdvdcss.h \
|
||||
src/device.c \
|
||||
src/device.h \
|
||||
src/css.c \
|
||||
src/css.h \
|
||||
src/csstables.h \
|
||||
src/ioctl.c \
|
||||
src/ioctl.h \
|
||||
src/error.c \
|
||||
src/common.h
|
||||
|
||||
libdvdcss_la_LDFLAGS = -version-info $(DVDCSS_LTVERSION) $(DVDCSS_LDFLAGS)
|
||||
libdvdcss_la_LIBADD =
|
||||
|
||||
if !SYS_MSVC
|
||||
libdvdcss_la_LDFLAGS += -no-undefined
|
||||
endif
|
||||
|
||||
test_csstest_SOURCES = test/csstest.c
|
||||
test_csstest_LDADD = libdvdcss.la
|
||||
test_csstest_CFLAGS = -I $(top_srcdir)/src
|
||||
|
||||
test_dvd_region_SOURCES = test/dvd_region.c
|
||||
test_dvd_region_LDADD = libdvdcss.la
|
||||
test_dvd_region_CFLAGS = -I $(top_srcdir)/src
|
||||
|
||||
pkgincludedir = $(includedir)/dvdcss
|
||||
pkginclude_HEADERS = \
|
||||
src/dvdcss/dvdcss.h \
|
||||
src/dvdcss/version.h
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = src/libdvdcss.pc
|
||||
|
||||
if APIDOC
|
||||
all-local: apidoc
|
||||
install-data-local: install-apidoc
|
||||
uninstall-hook: uninstall-apidoc
|
||||
endif
|
||||
|
||||
apidoc: stamp-doxygen
|
||||
|
||||
stamp-doxygen: doc/doxygen.cfg src/libdvdcss.c src/dvdcss/dvdcss.h
|
||||
doxygen $<
|
||||
touch $@
|
||||
|
||||
tools: test/csstest$(EXEEXT) test/dvd_region$(EXEEXT)
|
||||
|
||||
clean-local:
|
||||
-rm -Rf stamp-doxygen doc/doxygen_sqlite3.db libdvdcss.spec doc/html
|
||||
|
||||
install-apidoc:
|
||||
$(MKDIR_P) $(DESTDIR)$(htmldir)
|
||||
for file in doc/html/*; do \
|
||||
$(INSTALL_DATA) $$file "$(DESTDIR)$(htmldir)" || exit 1; \
|
||||
done;
|
||||
|
||||
uninstall-apidoc:
|
||||
-rm -Rf $(DESTDIR)$(htmldir)/*.png $(DESTDIR)$(htmldir)/*.html $(DESTDIR)$(htmldir)/*.css $(DESTDIR)$(htmldir)/*.js
|
||||
|
||||
.PHONY: apidoc tools
|
1126
Makefile.in
Normal file
1126
Makefile.in
Normal file
File diff suppressed because it is too large
Load diff
192
NEWS
Normal file
192
NEWS
Normal file
|
@ -0,0 +1,192 @@
|
|||
Changes between 1.4.2 and 1.4.3:
|
||||
--------------------------------
|
||||
|
||||
* Fix opening non-ASCII paths in Windows
|
||||
* Fix potential buffer overflow if PATH_MAX is reached
|
||||
|
||||
|
||||
Changes between 1.4.1 and 1.4.2:
|
||||
--------------------------------
|
||||
|
||||
* Fix buffer overflow when region mask is 0x0
|
||||
* Fix invalid free on Open
|
||||
|
||||
|
||||
Changes between 1.4.0 and 1.4.1:
|
||||
--------------------------------
|
||||
|
||||
* Fix crashes in cache directory creation
|
||||
* Fix cases where the cache directory was not used
|
||||
|
||||
|
||||
Changes between 1.3.99 and 1.4.0:
|
||||
---------------------------------
|
||||
|
||||
* Add key caching on Android
|
||||
* Fix leaks, win32 build breakage, file descriptor initialization
|
||||
* Expose version.h
|
||||
|
||||
|
||||
Changes between 1.3.0 and 1.3.99:
|
||||
---------------------------------
|
||||
|
||||
* Drop support for HP-UX.
|
||||
* Drop support for Windows 9x and Windows NT.
|
||||
Windows 2000 is now required.
|
||||
* Replace BeOS support by Haiku support.
|
||||
* Add dvdcss_open_stream() to public API. This allows installing custom
|
||||
callback functions for accessing DVD, e.g. over the network.
|
||||
* dvdcss_error() now returns "const char *" instad of "char *".
|
||||
* Drop support for MSVC versions before 2010.
|
||||
* Raw device access now errors out if the device cannot be opened.
|
||||
* Miscellaneous cleanups to code, documentation, build system.
|
||||
|
||||
|
||||
Changes between 1.2.13 and 1.3.0:
|
||||
---------------------------------
|
||||
|
||||
* Dropped deprecated, undocumented API:
|
||||
- the function dvdcss_title()
|
||||
- the type dvdcss_handle
|
||||
- the variable dvdcss_interface_2
|
||||
* Drop support for Windows 98 and Windows NT 4.0.
|
||||
Windows 98 SE with IE 5.0 and Windows NT 4.0 SP4 with IE 5.0 are required.
|
||||
* Support for Android
|
||||
|
||||
|
||||
Changes between 1.2.12 and 1.2.13:
|
||||
----------------------------------
|
||||
|
||||
* Drop BSD/OS and Windows 95 support.
|
||||
* Rewrite most of the build system and simplify it.
|
||||
* System-dependent code cleanup
|
||||
* Move to Git and rewrite the history to get proper authorship.
|
||||
* Drop LaTeX documentation.
|
||||
* Fix build on various systems including MSVC.
|
||||
|
||||
|
||||
Changes between 1.2.11 and 1.2.12:
|
||||
----------------------------------
|
||||
|
||||
* Fix regression with RPC-I drive handling.
|
||||
|
||||
|
||||
Changes between 1.2.10 and 1.2.11:
|
||||
----------------------------------
|
||||
|
||||
* improvements with RPC-II handling
|
||||
* more robust key retrieval
|
||||
* fixes for MinGW compilation
|
||||
* fixes for OS/2 compilation
|
||||
* various bug fixes for small issues, memleaks, crashes and build problems
|
||||
|
||||
|
||||
Changes between 1.2.9 and 1.2.10:
|
||||
---------------------------------
|
||||
|
||||
* DVD drive autodetection
|
||||
* new dvdcss_is_scrambled() function
|
||||
* various failure recovery improvements
|
||||
* accept "X:\", as well as "X:" as device name
|
||||
* various bug fixes
|
||||
|
||||
Changes between 1.2.8 and 1.2.9:
|
||||
--------------------------------
|
||||
|
||||
* more robust key caching
|
||||
* support for cache directory tags
|
||||
* improved seeking on Win32
|
||||
* support for Solaris libsmedia library
|
||||
|
||||
Changes between 1.2.7 and 1.2.8:
|
||||
--------------------------------
|
||||
|
||||
* Win32 fix for encrypted DVDs
|
||||
* workaround for strange discs that report read errors seemingly at random
|
||||
|
||||
Changes between 1.2.6 and 1.2.7:
|
||||
--------------------------------
|
||||
|
||||
* key caching activated by default
|
||||
* fix for collisions between cached keys
|
||||
* packaging improvements for Debian
|
||||
* packaging improvements for RPM-based distributions
|
||||
|
||||
Changes between 1.2.5 and 1.2.6:
|
||||
--------------------------------
|
||||
|
||||
* compilation fix for most Unixes
|
||||
|
||||
Changes between 1.2.4 and 1.2.5:
|
||||
--------------------------------
|
||||
|
||||
* key cache support
|
||||
* improved robustness in case of read errors
|
||||
* now builds under Cygwin
|
||||
* now builds under Microsoft Visual C++
|
||||
|
||||
Changes between 1.2.3 and 1.2.4:
|
||||
--------------------------------
|
||||
|
||||
* Administrator privileges are no longer required under Windows NT/2000/XP.
|
||||
|
||||
Changes between 1.2.2 and 1.2.3:
|
||||
--------------------------------
|
||||
|
||||
* many Windows bug fixes
|
||||
* workaround for drives which prevent key decryption
|
||||
|
||||
Changes between 1.2.1 and 1.2.2:
|
||||
--------------------------------
|
||||
|
||||
* fix for the "ioctl_ReadTitleKey failed" bug on RPC2 drives
|
||||
* better error checking
|
||||
* improved documentation
|
||||
* OS/2 port
|
||||
|
||||
Changes between 1.2.0 and 1.2.1:
|
||||
--------------------------------
|
||||
|
||||
* fix for discs with a mismatched region
|
||||
* QNX port
|
||||
|
||||
Changes between 1.1.1 and 1.2.0:
|
||||
--------------------------------
|
||||
|
||||
* fix for a crash when an unencrypted sector is found on a scrambled disc
|
||||
* stability enhancements
|
||||
|
||||
Changes between 1.1.0 and 1.1.1:
|
||||
--------------------------------
|
||||
|
||||
* compilation fixes for BeOS, IRIX, OpenBSD
|
||||
|
||||
Changes between 1.0.0 and 1.1.0:
|
||||
--------------------------------
|
||||
|
||||
* merged all patches from the Ogle group
|
||||
* lots of bug fixes
|
||||
* HP-UX port
|
||||
* better error recovery
|
||||
* third descrambling implementation
|
||||
|
||||
Changes between 0.0.3 and 1.0.0:
|
||||
--------------------------------
|
||||
|
||||
* stable API
|
||||
* OpenBSD port
|
||||
* NetBSD port
|
||||
* Mac OS X port
|
||||
|
||||
Changes between 0.0.2 and 0.0.3:
|
||||
--------------------------------
|
||||
|
||||
* fix to access the whole device under Win32
|
||||
* BSD/OS port
|
||||
* Solaris port
|
||||
|
||||
Changes between 0.0.1 and 0.0.2:
|
||||
--------------------------------
|
||||
|
||||
* internal key cache mechanism
|
||||
* stability fixes
|
62
README
Normal file
62
README
Normal file
|
@ -0,0 +1,62 @@
|
|||
README for libdvdcss, a portable abstraction library for DVD decryption
|
||||
|
||||
|
||||
Introduction
|
||||
============
|
||||
|
||||
libdvdcss is part of the VideoLAN project, which among other things produces
|
||||
VLC, a full video client/server streaming solution. VLC can also be used as
|
||||
a standalone program to play video streams from a hard disk or a DVD.
|
||||
|
||||
|
||||
Building and Installing libdvdcss
|
||||
=================================
|
||||
|
||||
See the INSTALL file.
|
||||
|
||||
|
||||
Running libdvdcss
|
||||
=================
|
||||
|
||||
The behavior of the library can be changed by setting two environment variables:
|
||||
|
||||
DVDCSS_METHOD={title|disc|key}: method for key decryption
|
||||
title: By default the decrypted title key is guessed from the encrypted
|
||||
sectors of the stream. Thus it should work with a file as well as
|
||||
the DVD device. But decrypting a title key may take too much time
|
||||
or even fail. With the title method, the key is only checked at
|
||||
the beginning of each title, so it will not work if the key
|
||||
changes in the middle of a title.
|
||||
disc: The disc key is cracked first. Afterwards all title keys can be
|
||||
decrypted instantly, which allows checking them often.
|
||||
key: The same as the "disc" method if you do not have a file with player
|
||||
keys at compile time. If you do, disc key decryption will be faster.
|
||||
This is the default method also employed by libcss.
|
||||
DVDCSS_VERBOSE={0|1|2}: libdvdcss verbosity
|
||||
0: no error messages, no debug messages (this is the default)
|
||||
1: only error messages
|
||||
2: error and debug messages
|
||||
|
||||
|
||||
Troubleshooting
|
||||
===============
|
||||
|
||||
A mailing-list has been set up for support and discussion about
|
||||
libdvdcss. Its address is:
|
||||
|
||||
<libdvdcss-devel@videolan.org>
|
||||
|
||||
To subscribe or unsubscribe, go to:
|
||||
|
||||
http://mailman.videolan.org/
|
||||
|
||||
When reporting bugs, try to be as precise as possible (which OS, which
|
||||
distribution, what plugins you were trying, and so on).
|
||||
|
||||
|
||||
Resources
|
||||
=========
|
||||
|
||||
The VideoLAN web site at http://www.videolan.org/ is a good start for
|
||||
information about MPEG and DVD playback. Have a look at the support
|
||||
section to look for answers.
|
1174
aclocal.m4
vendored
Normal file
1174
aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load diff
348
compile
Executable file
348
compile
Executable file
|
@ -0,0 +1,348 @@
|
|||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1999-2018 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 <https://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 | \
|
||||
icl | *[/\\]icl | icl.exe | *[/\\]icl.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 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
1480
config.guess
vendored
Executable file
1480
config.guess
vendored
Executable file
File diff suppressed because it is too large
Load diff
169
config.h.in
Normal file
169
config.h.in
Normal file
|
@ -0,0 +1,169 @@
|
|||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Have IOKit DVD IOCTL headers */
|
||||
#undef DARWIN_DVD_IOCTL
|
||||
|
||||
/* Define if <linux/cdrom.h> defines DVD_STRUCT. */
|
||||
#undef DVD_STRUCT_IN_LINUX_CDROM_H
|
||||
|
||||
/* Define if <sys/cdio.h> defines dvd_struct. */
|
||||
#undef DVD_STRUCT_IN_SYS_CDIO_H
|
||||
|
||||
/* Define if <sys/dvdio.h> defines dvd_struct. */
|
||||
#undef DVD_STRUCT_IN_SYS_DVDIO_H
|
||||
|
||||
/* Define if you have a broken mkdir */
|
||||
#undef HAVE_BROKEN_MKDIR
|
||||
|
||||
/* Define if FreeBSD-like dvd_struct is defined. */
|
||||
#undef HAVE_BSD_DVD_STRUCT
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the <dvd.h> header file. */
|
||||
#undef HAVE_DVD_H
|
||||
|
||||
/* Define to 1 if you have the <errno.h> header file. */
|
||||
#undef HAVE_ERRNO_H
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the <io.h> header file. */
|
||||
#undef HAVE_IO_H
|
||||
|
||||
/* Define to 1 if you have the <linux/cdrom.h> header file. */
|
||||
#undef HAVE_LINUX_CDROM_H
|
||||
|
||||
/* Define if Linux-like dvd_struct is defined. */
|
||||
#undef HAVE_LINUX_DVD_STRUCT
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define if OpenBSD-like dvd_struct is defined. */
|
||||
#undef HAVE_OPENBSD_DVD_STRUCT
|
||||
|
||||
/* Define to 1 if you have the <pwd.h> header file. */
|
||||
#undef HAVE_PWD_H
|
||||
|
||||
/* 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/cdio.h> header file. */
|
||||
#undef HAVE_SYS_CDIO_H
|
||||
|
||||
/* Define to 1 if you have the <sys/dvdio.h> header file. */
|
||||
#undef HAVE_SYS_DVDIO_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/param.h> header file. */
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define to 1 if you have the <sys/scsi/impl/uscsi.h> header file. */
|
||||
#undef HAVE_SYS_SCSI_IMPL_USCSI_H
|
||||
|
||||
/* Define to 1 if you have the <sys/scsi/scsi_types.h> header file. */
|
||||
#undef HAVE_SYS_SCSI_SCSI_TYPES_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 <sys/uio.h> header file. */
|
||||
#undef HAVE_SYS_UIO_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the <windows.h> header file. */
|
||||
#undef HAVE_WINDOWS_H
|
||||
|
||||
/* Define to 1 if you have the <winioctl.h> header file. */
|
||||
#undef HAVE_WINIOCTL_H
|
||||
|
||||
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* Define O_BINARY if missing */
|
||||
#undef O_BINARY
|
||||
|
||||
/* 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
|
||||
|
||||
/* Have userspace SCSI headers. */
|
||||
#undef SOLARIS_USCSI
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define this if the compiler supports __attribute__((visibility("default")))
|
||||
*/
|
||||
#undef SUPPORT_ATTRIBUTE_VISIBILITY_DEFAULT
|
||||
|
||||
/* Define this if the compiler supports the -fvisibility flag */
|
||||
#undef SUPPORT_FLAG_VISIBILITY
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Enable large inode numbers on Mac OS X 10.5. */
|
||||
#ifndef _DARWIN_USE_64_BIT_INODE
|
||||
# define _DARWIN_USE_64_BIT_INODE 1
|
||||
#endif
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
#undef _FILE_OFFSET_BITS
|
||||
|
||||
/* Define for large files, on AIX-style hosts. */
|
||||
#undef _LARGE_FILES
|
||||
|
||||
/* Define to '0x0501' for IE 5.01 (and shell) APIs. */
|
||||
#undef _WIN32_IE
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
#undef inline
|
||||
#endif
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
1801
config.sub
vendored
Executable file
1801
config.sub
vendored
Executable file
File diff suppressed because it is too large
Load diff
255
configure.ac
Normal file
255
configure.ac
Normal file
|
@ -0,0 +1,255 @@
|
|||
dnl library version number
|
||||
m4_define([dvdcss_major], 1)
|
||||
m4_define([dvdcss_minor], 4)
|
||||
m4_define([dvdcss_micro], 3)
|
||||
m4_define([dvdcss_version],[dvdcss_major.dvdcss_minor.dvdcss_micro])
|
||||
|
||||
AC_INIT(libdvdcss, dvdcss_version, , , https://www.videolan.org/developers/libdvdcss.html)
|
||||
AC_CONFIG_SRCDIR([src/libdvdcss.c])
|
||||
|
||||
AC_PREREQ(2.50)
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip subdir-objects])
|
||||
AM_MAINTAINER_MODE([enable])
|
||||
dnl Enable silent rules only when available (automake 1.11 or later).
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
||||
LT_INIT([win32-dll])
|
||||
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
dnl The libtool version numbers (DVDCSS_LT_*); Don't even think about faking this!
|
||||
dnl
|
||||
dnl immediately before every release do:
|
||||
dnl ===================================
|
||||
dnl if (the interface is totally unchanged from previous release)
|
||||
dnl DVDCSS_LT_REVISION ++;
|
||||
dnl else { /* interfaces have been added, removed or changed */
|
||||
dnl DVDCSS_LT_REVISION = 0;
|
||||
dnl DVDCSS_LT_CURRENT ++;
|
||||
dnl if (any interfaces have been _added_ since last release)
|
||||
dnl AGE ++;
|
||||
dnl if (any interfaces have been _removed_ or _incompatibly changed_)
|
||||
dnl AGE = 0;
|
||||
dnl }
|
||||
dnl
|
||||
dnl If you want to know more about what you are doing, here are some details:
|
||||
dnl * DVDCSS_LT_CURRENT is the current API version
|
||||
dnl * DVDCSS_LT_REVISION is an internal revision number which is increased when the API
|
||||
dnl itself did not change
|
||||
dnl * DVDCSS_LT_AGE is the number of previous API versions still supported by this library
|
||||
dnl * libtool has its own numbering scheme, because local library numbering schemes
|
||||
dnl are platform dependent
|
||||
dnl * in Linux, the library will be named
|
||||
dnl libname.so.(DVDCSS_LT_CURRENT - DVDCSS_LT_AGE).DVDCSS_LT_AGE.DVDCSS_LT_REVISION
|
||||
|
||||
DVDCSS_LT_CURRENT=4
|
||||
DVDCSS_LT_AGE=2
|
||||
DVDCSS_LT_REVISION=0
|
||||
|
||||
AC_SUBST([DVDCSS_LTVERSION], [$DVDCSS_LT_CURRENT:$DVDCSS_LT_REVISION:$DVDCSS_LT_AGE])
|
||||
|
||||
AC_PROG_CC
|
||||
AC_HEADER_STDC
|
||||
|
||||
AC_C_CONST
|
||||
AC_C_INLINE
|
||||
AC_TYPE_SIZE_T
|
||||
|
||||
AC_CHECK_HEADERS([unistd.h sys/param.h sys/uio.h pwd.h]dnl
|
||||
[errno.h sys/types.h sys/stat.h fcntl.h io.h])
|
||||
|
||||
AC_CHECK_DECL([O_BINARY], [],
|
||||
[AC_DEFINE([O_BINARY], [0], [Define O_BINARY if missing])],
|
||||
[
|
||||
#if HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#if HAVE_SYS_STAT_H
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
#if HAVE_FCNTL_H
|
||||
# include <fcntl.h>
|
||||
#endif
|
||||
])
|
||||
|
||||
AC_SYS_LARGEFILE
|
||||
|
||||
AC_CACHE_CHECK(
|
||||
[for posix mkdir()],
|
||||
[css_cv_mkdir_posix], [
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
||||
#ifdef HAVE_IO_H
|
||||
# include <io.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
int mkdir(const char *path, mode_t mode);
|
||||
])
|
||||
],
|
||||
[css_cv_mkdir_posix=yes],
|
||||
[css_cv_mkdir_posix=no])
|
||||
])
|
||||
|
||||
AS_IF([test "$css_cv_mkdir_posix" = "no"], [
|
||||
AC_DEFINE([HAVE_BROKEN_MKDIR], 1, [Define if you have a broken mkdir])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Check the operating system
|
||||
dnl
|
||||
|
||||
case x"${host_os}" in
|
||||
xdarwin*)
|
||||
CFLAGS="${CFLAGS} -no-cpp-precomp"
|
||||
;;
|
||||
x*cygwin* | x*msys*)
|
||||
CFLAGS="${CFLAGS} -mwin32"
|
||||
AC_DEFINE([_WIN32_IE], 0x0501, [Define to '0x0501' for IE 5.01 (and shell) APIs.])
|
||||
;;
|
||||
xos2*)
|
||||
LDFLAGS="-Zbin-files"
|
||||
;;
|
||||
x*msvc*)
|
||||
SYS_MSVC=1
|
||||
AC_DEFINE([_WIN32_IE], 0x0501, [Define to '0x0501' for IE 5.01 (and shell) APIs.])
|
||||
;;
|
||||
x*mingw* | x*wince* | x*mingwce*)
|
||||
AC_DEFINE([_WIN32_IE], 0x0501, [Define to '0x0501' for IE 5.01 (and shell) APIs.])
|
||||
;;
|
||||
x*)
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl
|
||||
dnl libdvdcss: check for DVD ioctls
|
||||
dnl
|
||||
|
||||
dnl default is no
|
||||
CAN_BUILD_LIBDVDCSS=0
|
||||
|
||||
dnl for windoze
|
||||
AC_CHECK_HEADERS(windows.h,[
|
||||
AC_CHECK_HEADERS(winioctl.h,[
|
||||
CAN_BUILD_LIBDVDCSS=1
|
||||
],,[
|
||||
#include <windows.h>
|
||||
])
|
||||
])
|
||||
|
||||
dnl for Unix
|
||||
AC_CHECK_HEADERS(sys/ioctl.h,[
|
||||
CAN_BUILD_LIBDVDCSS=1
|
||||
AC_CHECK_HEADERS(sys/cdio.h sys/dvdio.h linux/cdrom.h dvd.h)
|
||||
BSD_DVD_STRUCT=0
|
||||
LINUX_DVD_STRUCT=0
|
||||
OPENBSD_DVD_STRUCT=0
|
||||
dnl
|
||||
dnl Old FreeBSD: sys/cdio.h
|
||||
dnl
|
||||
AC_EGREP_HEADER(dvd_struct,sys/cdio.h,[
|
||||
AC_DEFINE(DVD_STRUCT_IN_SYS_CDIO_H, 1,
|
||||
Define if <sys/cdio.h> defines dvd_struct.)
|
||||
AC_EGREP_HEADER(struct dvd_struct,sys/cdio.h,[
|
||||
BSD_DVD_STRUCT=1],[LINUX_DVD_STRUCT=1; OPENBSD_DVD_STRUCT=1])
|
||||
])
|
||||
dnl
|
||||
dnl Newer FreeBSD: sys/dvdio.h
|
||||
dnl
|
||||
AC_EGREP_HEADER(dvd_struct,sys/dvdio.h,[
|
||||
AC_DEFINE(DVD_STRUCT_IN_SYS_DVDIO_H, 1,
|
||||
Define if <sys/dvdio.h> defines dvd_struct.)
|
||||
AC_EGREP_HEADER(struct dvd_struct,sys/dvdio.h,[
|
||||
BSD_DVD_STRUCT=1],[LINUX_DVD_STRUCT=1])
|
||||
])
|
||||
dnl
|
||||
dnl Linux: linux/cdrom.h
|
||||
dnl
|
||||
AC_EGREP_HEADER(dvd_struct,linux/cdrom.h,[
|
||||
AC_DEFINE(DVD_STRUCT_IN_LINUX_CDROM_H, 1,
|
||||
Define if <linux/cdrom.h> defines DVD_STRUCT.)
|
||||
LINUX_DVD_STRUCT=1
|
||||
])
|
||||
dnl
|
||||
dnl Solaris: sys/scsi/scsi_types.h, sys/scsi/impl/uscsi.h
|
||||
dnl
|
||||
solaris_uscsi=yes
|
||||
AC_CHECK_HEADERS([sys/scsi/scsi_types.h sys/scsi/impl/uscsi.h], [],
|
||||
[solaris_uscsi=no; break;])
|
||||
AS_IF([test "$solaris_uscsi" = "yes"], [
|
||||
AC_DEFINE(SOLARIS_USCSI, 1, Have userspace SCSI headers.)
|
||||
])
|
||||
dnl
|
||||
dnl Darwin
|
||||
dnl
|
||||
AC_CHECK_HEADER(IOKit/storage/IODVDMediaBSDClient.h,[
|
||||
AC_DEFINE(DARWIN_DVD_IOCTL, 1, Have IOKit DVD IOCTL headers)
|
||||
DVDCSS_LDFLAGS="-Wl,-framework -Wl,CoreFoundation -Wl,-framework -Wl,IOKit"
|
||||
])
|
||||
dnl
|
||||
dnl Final tests to check what was detected
|
||||
dnl
|
||||
if test x$LINUX_DVD_STRUCT = x1; then
|
||||
AC_DEFINE(HAVE_LINUX_DVD_STRUCT, 1,
|
||||
Define if Linux-like dvd_struct is defined.)
|
||||
if test x$OPENBSD_DVD_STRUCT = x1; then
|
||||
AC_DEFINE(HAVE_OPENBSD_DVD_STRUCT, 1,
|
||||
Define if OpenBSD-like dvd_struct is defined.)
|
||||
fi
|
||||
else
|
||||
if test x$BSD_DVD_STRUCT = x1; then
|
||||
AC_DEFINE(HAVE_BSD_DVD_STRUCT, 1,
|
||||
Define if FreeBSD-like dvd_struct is defined.)
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
CC_CHECK_CFLAGS_APPEND([-Wall -Wextra])
|
||||
CC_FLAG_VISIBILITY([
|
||||
CC_ATTRIBUTE_VISIBILITY([default], [
|
||||
CFLAGS="${CFLAGS} -fvisibility=hidden"
|
||||
])
|
||||
])
|
||||
|
||||
AM_CONDITIONAL(SYS_MSVC, test "${SYS_MSVC}" = "1")
|
||||
|
||||
AC_ARG_ENABLE([doc],
|
||||
AS_HELP_STRING([--disable-doc], [Disable building (with Doxygen) and intalling API documentation @<:@default=auto@:@>]))
|
||||
|
||||
AS_IF([test "x$enable_doc" != "xno"], [
|
||||
AC_PATH_PROG([DOXYGEN], [doxygen])
|
||||
])
|
||||
|
||||
AS_IF([test "x$DOXYGEN" = "x"], [
|
||||
AS_IF([test "x$enable_doc" = "xyes"], [
|
||||
AC_MSG_ERROR([You need Doxygen to build API documentation])
|
||||
])
|
||||
])
|
||||
AM_CONDITIONAL([APIDOC], [test "x$DOXYGEN" != "x"])
|
||||
|
||||
AC_PATH_PROG([GIT], [git])
|
||||
AM_CONDITIONAL([GIT], [test "x$GIT" != "x"])
|
||||
|
||||
dnl export library version number
|
||||
DVDCSS_VERSION_MAJOR=dvdcss_major()
|
||||
DVDCSS_VERSION_MINOR=dvdcss_minor()
|
||||
DVDCSS_VERSION_MICRO=dvdcss_micro()
|
||||
AC_SUBST(DVDCSS_VERSION_MAJOR)
|
||||
AC_SUBST(DVDCSS_VERSION_MINOR)
|
||||
AC_SUBST(DVDCSS_VERSION_MICRO)
|
||||
|
||||
AC_SUBST(DVDCSS_LDFLAGS)
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
libdvdcss.spec
|
||||
doc/doxygen.cfg
|
||||
src/libdvdcss.pc
|
||||
src/dvdcss/version.h
|
||||
])
|
791
depcomp
Executable file
791
depcomp
Executable file
|
@ -0,0 +1,791 @@
|
|||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1999-2018 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 <https://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 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
2293
doc/doxygen.cfg.in
Normal file
2293
doc/doxygen.cfg.in
Normal file
File diff suppressed because it is too large
Load diff
518
install-sh
Executable file
518
install-sh
Executable file
|
@ -0,0 +1,518 @@
|
|||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2018-03-11.20; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# 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 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
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
tab=' '
|
||||
nl='
|
||||
'
|
||||
IFS=" $tab$nl"
|
||||
|
||||
# Set DOITPROG to "echo" to test this script.
|
||||
|
||||
doit=${DOITPROG-}
|
||||
doit_exec=${doit:-exec}
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
is_target_a_directory=possibly
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t)
|
||||
is_target_a_directory=always
|
||||
dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) is_target_a_directory=never;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# We allow the use of options -d and -T together, by making -d
|
||||
# take the precedence; this is for compatibility with GNU install.
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
if test -n "$dst_arg"; then
|
||||
echo "$0: target directory not allowed when installing a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
if test $# -gt 1 || test "$is_target_a_directory" = always; then
|
||||
if test ! -d "$dst_arg"; then
|
||||
echo "$0: $dst_arg: Is not a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename.
|
||||
if test -d "$dst"; then
|
||||
if test "$is_target_a_directory" = never; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dstbase=`basename "$src"`
|
||||
case $dst in
|
||||
*/) dst=$dst$dstbase;;
|
||||
*) dst=$dst/$dstbase;;
|
||||
esac
|
||||
dstdir_status=0
|
||||
else
|
||||
dstdir=`dirname "$dst"`
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
case $dstdir in
|
||||
*/) dstdirslash=$dstdir;;
|
||||
*) dstdirslash=$dstdir/;;
|
||||
esac
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
# Note that $RANDOM variable is not portable (e.g. dash); Use it
|
||||
# here however when possible just to lower collision chance.
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
|
||||
trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
# Because "mkdir -p" follows existing symlinks and we likely work
|
||||
# directly in world-writeable /tmp, make sure that the '$tmpdir'
|
||||
# directory is successfully created first before we actually test
|
||||
# 'mkdir -p' feature.
|
||||
if (umask $mkdir_umask &&
|
||||
$mkdirprog $mkdir_mode "$tmpdir" &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
test_tmpdir="$tmpdir/a"
|
||||
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=${dstdirslash}_inst.$$_
|
||||
rmtmp=${dstdirslash}_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
set +f &&
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
181
libdvdcss.spec
Normal file
181
libdvdcss.spec
Normal file
|
@ -0,0 +1,181 @@
|
|||
%define name libdvdcss
|
||||
%define version 1.4.3
|
||||
%define release 1
|
||||
|
||||
%define major 2
|
||||
%define libname %{name}%{major}
|
||||
|
||||
%define buildfor_rh9 %([[ -e /etc/mandrake-release ]] && echo 0 || echo 1)
|
||||
|
||||
%if %buildfor_rh9
|
||||
# some mdk macros that do not exist in rh
|
||||
%define configure2_5x %configure
|
||||
%define make %__make
|
||||
%define makeinstall_std %makeinstall
|
||||
# adjust define for Red Hat.
|
||||
%endif
|
||||
|
||||
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
Release: %{release}%{?dist}
|
||||
Summary: Library for accessing DVDs like block devices with transparent decryption
|
||||
Source: %{name}-%{version}.tar.bz2
|
||||
License: GPL
|
||||
Group: System/Libraries
|
||||
URL: https://www.videolan.org/developers/libdvdcss.html
|
||||
Packager: Yves Duret <yves@zarb.org>
|
||||
BuildRoot: %_tmppath/%name-%version-%release-root
|
||||
Conflicts: libdvdcss0.0.1, libdvdcss0.0.2
|
||||
|
||||
%description
|
||||
libdvdcss is a simple library designed for accessing DVDs like a block device
|
||||
without having to bother about the decryption. The important features are:
|
||||
* Portability: Currently supported platforms are GNU/Linux, FreeBSD, NetBSD,
|
||||
OpenBSD, Haiku, Mac OS X, Solaris, QNX, OS/2, and Windows 2000 or later.
|
||||
* Adaptability: Unlike most similar projects, libdvdcss does not require the
|
||||
region of your drive to be set and will try its best to read from the disc
|
||||
even in the case of a region mismatch.
|
||||
* Simplicity: A DVD player can be built around the libdvdcss API using no
|
||||
more than 4 or 5 library calls.
|
||||
|
||||
%package -n %{libname}
|
||||
Summary: Library for accessing DVDs like block devices with transparent decryption
|
||||
Group: System/Libraries
|
||||
Provides: %name = %version-%release
|
||||
|
||||
%description -n %{libname}
|
||||
libdvdcss is a simple library designed for accessing DVDs like a block device
|
||||
without having to bother about the decryption. The important features are:
|
||||
* Portability: Currently supported platforms are GNU/Linux, FreeBSD, NetBSD,
|
||||
OpenBSD, Haiku, Mac OS X, Solaris, QNX, OS/2, and Windows 2000 or later.
|
||||
* Adaptability: Unlike most similar projects, libdvdcss does not require the
|
||||
region of your drive to be set and will try its best to read from the disc
|
||||
even in the case of a region mismatch.
|
||||
* Simplicity: A DVD player can be built around the libdvdcss API using no
|
||||
more than 4 or 5 library calls.
|
||||
|
||||
%package -n %{libname}-devel
|
||||
Summary: Development tools for programs which will use the %{name} library
|
||||
Group: Development/C
|
||||
Requires: %{libname} = %version-%release
|
||||
Provides: %{name}-devel = %version-%release
|
||||
|
||||
%description -n %{libname}-devel
|
||||
The %{name}-devel package includes the header files and static libraries
|
||||
necessary for developing programs which will manipulate DVDs files using
|
||||
the %{name} library.
|
||||
|
||||
If you are going to develop programs which will manipulate DVDs, you
|
||||
should install %{name}-devel. You will also need to have the %{name}
|
||||
package installed.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
%configure2_5x
|
||||
%make
|
||||
|
||||
%install
|
||||
%makeinstall_std
|
||||
|
||||
%clean
|
||||
[ %buildroot != "/" ] && rm -Rf %buildroot
|
||||
|
||||
%post -n %{libname} -p /sbin/ldconfig
|
||||
|
||||
%postun -n %{libname} -p /sbin/ldconfig
|
||||
|
||||
%files -n %{libname}
|
||||
%defattr(-,root,root)
|
||||
%doc AUTHORS COPYING NEWS
|
||||
%{_docdir}/libdvdcss
|
||||
%{_libdir}/*.so.*
|
||||
|
||||
%files -n %{libname}-devel
|
||||
%defattr(-,root,root)
|
||||
%doc ChangeLog COPYING
|
||||
%{_libdir}/*.a
|
||||
%{_libdir}/*.so
|
||||
%{_libdir}/*.la
|
||||
%{_libdir}/pkgconfig/*
|
||||
%{_includedir}/*
|
||||
|
||||
%changelog
|
||||
* Mon Jul 11 2005 Sam Hocevar <sam@zoy.org> 1.2.9-1
|
||||
- new upstream release
|
||||
|
||||
* Tue Jul 29 2003 Sam Hocevar <sam@zoy.org> 1.2.8-1
|
||||
- new upstream release
|
||||
|
||||
* Fri Jun 13 2003 Sam Hocevar <sam@zoy.org> 1.2.7-1
|
||||
- new upstream release
|
||||
- key cache activated by default
|
||||
|
||||
* Mon Mar 10 2003 Alexis de Lattre <alexis@videolan.org> 1.2.6-1
|
||||
- new upstream release
|
||||
- small bug fixes
|
||||
|
||||
* Tue Jan 28 2003 Sam Hocevar <sam@zoy.org> 1.2.5-1
|
||||
- new upstream release
|
||||
- improved robustness in case of read errors
|
||||
- key cache support
|
||||
- added more macros to fix Red Hat build
|
||||
|
||||
* Mon Nov 18 2002 Alexis de Lattre <alexis@videolan.org> 1.2.4-2
|
||||
- Changes in .spec file for Red Hat and RPM 4.1
|
||||
|
||||
* Thu Nov 14 2002 Alexis de Lattre <alexis@videolan.org> 1.2.4-1
|
||||
- new upstream release
|
||||
- fixes for Win32
|
||||
|
||||
* Sun Oct 13 2002 Sam Hocevar <sam@zoy.org> 1.2.3-1
|
||||
- new upstream release
|
||||
- fix for drives not allowing to read their disc key
|
||||
|
||||
* Sat Aug 10 2002 Sam Hocevar <sam@zoy.org> 1.2.2-1
|
||||
- new upstream release
|
||||
- even more fixes for the disc/drive region mismatch problem
|
||||
|
||||
* Sun Jun 02 2002 Sam Hocevar <sam@zoy.org> 1.2.1-1
|
||||
- new upstream release
|
||||
- fix for a crash on disc/drive region mismatch
|
||||
|
||||
* Mon May 20 2002 Sam Hocevar <sam@zoy.org> 1.2.0-1
|
||||
- new upstream release
|
||||
- weird libxalf dependency is gone
|
||||
|
||||
* Sun Apr 07 2002 Yves Duret <yduret@mandrakesoft.com> 1.1.1-2plf
|
||||
- major version is 2 (aka guillaume sux).
|
||||
- spec clean up: do not rm in %%prep, %%buildroot, %%makeinstall_std, %%provides %%version-%%release
|
||||
- added doc in devel
|
||||
- sync with the CVS one (%%description,%%files, conflicts).
|
||||
- fix URL
|
||||
|
||||
* Sat Apr 06 2002 Guillaume Rousse <rousse@ccr.jussieu.fr> 1.1.1-1plf
|
||||
- 1.1.1
|
||||
|
||||
* Wed Jan 30 2002 Guillaume Rousse <rousse@ccr.jussieu.fr> 1.0.0-3plf
|
||||
- new plf extension
|
||||
|
||||
* Wed Dec 05 2001 Guillaume Rousse <g.rousse@linux-mandrake.com> 1.0.0-3mdk
|
||||
- removed conflict
|
||||
|
||||
* Tue Dec 04 2001 Guillaume Rousse <g.rousse@linux-mandrake.com> 1.0.0-2mdk
|
||||
- contributed to PLF by Yves Duret <yduret@mandrakesoft.com>
|
||||
- Conflicts: libdvdcss-ogle
|
||||
- more doc files
|
||||
- no doc file for devel package
|
||||
|
||||
* Fri Nov 30 2001 Yves Duret <yduret@mandrakesoft.com> 1.0.0-1mdk
|
||||
- version 1.0.0
|
||||
|
||||
* Thu Aug 23 2001 Yves Duret <yduret@mandrakesoft.com> 0.0.3-1mdk
|
||||
- version 0.0.3
|
||||
|
||||
* Mon Aug 13 2001 Yves Duret <yduret@mandrakesoft.com> 0.0.2-1mdk
|
||||
- version 0.0.2
|
||||
|
||||
* Tue Jun 19 2001 Yves Duret <yduret@mandrakesoft.com> 0.0.1-1mdk
|
||||
- first release and first mdk release
|
181
libdvdcss.spec.in
Normal file
181
libdvdcss.spec.in
Normal file
|
@ -0,0 +1,181 @@
|
|||
%define name @PACKAGE_NAME@
|
||||
%define version @PACKAGE_VERSION@
|
||||
%define release 1
|
||||
|
||||
%define major 2
|
||||
%define libname %{name}%{major}
|
||||
|
||||
%define buildfor_rh9 %([[ -e /etc/mandrake-release ]] && echo 0 || echo 1)
|
||||
|
||||
%if %buildfor_rh9
|
||||
# some mdk macros that do not exist in rh
|
||||
%define configure2_5x %configure
|
||||
%define make %__make
|
||||
%define makeinstall_std %makeinstall
|
||||
# adjust define for Red Hat.
|
||||
%endif
|
||||
|
||||
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
Release: %{release}%{?dist}
|
||||
Summary: Library for accessing DVDs like block devices with transparent decryption
|
||||
Source: %{name}-%{version}.tar.bz2
|
||||
License: GPL
|
||||
Group: System/Libraries
|
||||
URL: @PACKAGE_URL@
|
||||
Packager: Yves Duret <yves@zarb.org>
|
||||
BuildRoot: %_tmppath/%name-%version-%release-root
|
||||
Conflicts: libdvdcss0.0.1, libdvdcss0.0.2
|
||||
|
||||
%description
|
||||
libdvdcss is a simple library designed for accessing DVDs like a block device
|
||||
without having to bother about the decryption. The important features are:
|
||||
* Portability: Currently supported platforms are GNU/Linux, FreeBSD, NetBSD,
|
||||
OpenBSD, Haiku, Mac OS X, Solaris, QNX, OS/2, and Windows 2000 or later.
|
||||
* Adaptability: Unlike most similar projects, libdvdcss does not require the
|
||||
region of your drive to be set and will try its best to read from the disc
|
||||
even in the case of a region mismatch.
|
||||
* Simplicity: A DVD player can be built around the libdvdcss API using no
|
||||
more than 4 or 5 library calls.
|
||||
|
||||
%package -n %{libname}
|
||||
Summary: Library for accessing DVDs like block devices with transparent decryption
|
||||
Group: System/Libraries
|
||||
Provides: %name = %version-%release
|
||||
|
||||
%description -n %{libname}
|
||||
libdvdcss is a simple library designed for accessing DVDs like a block device
|
||||
without having to bother about the decryption. The important features are:
|
||||
* Portability: Currently supported platforms are GNU/Linux, FreeBSD, NetBSD,
|
||||
OpenBSD, Haiku, Mac OS X, Solaris, QNX, OS/2, and Windows 2000 or later.
|
||||
* Adaptability: Unlike most similar projects, libdvdcss does not require the
|
||||
region of your drive to be set and will try its best to read from the disc
|
||||
even in the case of a region mismatch.
|
||||
* Simplicity: A DVD player can be built around the libdvdcss API using no
|
||||
more than 4 or 5 library calls.
|
||||
|
||||
%package -n %{libname}-devel
|
||||
Summary: Development tools for programs which will use the %{name} library
|
||||
Group: Development/C
|
||||
Requires: %{libname} = %version-%release
|
||||
Provides: %{name}-devel = %version-%release
|
||||
|
||||
%description -n %{libname}-devel
|
||||
The %{name}-devel package includes the header files and static libraries
|
||||
necessary for developing programs which will manipulate DVDs files using
|
||||
the %{name} library.
|
||||
|
||||
If you are going to develop programs which will manipulate DVDs, you
|
||||
should install %{name}-devel. You will also need to have the %{name}
|
||||
package installed.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
%configure2_5x
|
||||
%make
|
||||
|
||||
%install
|
||||
%makeinstall_std
|
||||
|
||||
%clean
|
||||
[ %buildroot != "/" ] && rm -Rf %buildroot
|
||||
|
||||
%post -n %{libname} -p /sbin/ldconfig
|
||||
|
||||
%postun -n %{libname} -p /sbin/ldconfig
|
||||
|
||||
%files -n %{libname}
|
||||
%defattr(-,root,root)
|
||||
%doc AUTHORS COPYING NEWS
|
||||
%{_docdir}/libdvdcss
|
||||
%{_libdir}/*.so.*
|
||||
|
||||
%files -n %{libname}-devel
|
||||
%defattr(-,root,root)
|
||||
%doc ChangeLog COPYING
|
||||
%{_libdir}/*.a
|
||||
%{_libdir}/*.so
|
||||
%{_libdir}/*.la
|
||||
%{_libdir}/pkgconfig/*
|
||||
%{_includedir}/*
|
||||
|
||||
%changelog
|
||||
* Mon Jul 11 2005 Sam Hocevar <sam@zoy.org> 1.2.9-1
|
||||
- new upstream release
|
||||
|
||||
* Tue Jul 29 2003 Sam Hocevar <sam@zoy.org> 1.2.8-1
|
||||
- new upstream release
|
||||
|
||||
* Fri Jun 13 2003 Sam Hocevar <sam@zoy.org> 1.2.7-1
|
||||
- new upstream release
|
||||
- key cache activated by default
|
||||
|
||||
* Mon Mar 10 2003 Alexis de Lattre <alexis@videolan.org> 1.2.6-1
|
||||
- new upstream release
|
||||
- small bug fixes
|
||||
|
||||
* Tue Jan 28 2003 Sam Hocevar <sam@zoy.org> 1.2.5-1
|
||||
- new upstream release
|
||||
- improved robustness in case of read errors
|
||||
- key cache support
|
||||
- added more macros to fix Red Hat build
|
||||
|
||||
* Mon Nov 18 2002 Alexis de Lattre <alexis@videolan.org> 1.2.4-2
|
||||
- Changes in .spec file for Red Hat and RPM 4.1
|
||||
|
||||
* Thu Nov 14 2002 Alexis de Lattre <alexis@videolan.org> 1.2.4-1
|
||||
- new upstream release
|
||||
- fixes for Win32
|
||||
|
||||
* Sun Oct 13 2002 Sam Hocevar <sam@zoy.org> 1.2.3-1
|
||||
- new upstream release
|
||||
- fix for drives not allowing to read their disc key
|
||||
|
||||
* Sat Aug 10 2002 Sam Hocevar <sam@zoy.org> 1.2.2-1
|
||||
- new upstream release
|
||||
- even more fixes for the disc/drive region mismatch problem
|
||||
|
||||
* Sun Jun 02 2002 Sam Hocevar <sam@zoy.org> 1.2.1-1
|
||||
- new upstream release
|
||||
- fix for a crash on disc/drive region mismatch
|
||||
|
||||
* Mon May 20 2002 Sam Hocevar <sam@zoy.org> 1.2.0-1
|
||||
- new upstream release
|
||||
- weird libxalf dependency is gone
|
||||
|
||||
* Sun Apr 07 2002 Yves Duret <yduret@mandrakesoft.com> 1.1.1-2plf
|
||||
- major version is 2 (aka guillaume sux).
|
||||
- spec clean up: do not rm in %%prep, %%buildroot, %%makeinstall_std, %%provides %%version-%%release
|
||||
- added doc in devel
|
||||
- sync with the CVS one (%%description,%%files, conflicts).
|
||||
- fix URL
|
||||
|
||||
* Sat Apr 06 2002 Guillaume Rousse <rousse@ccr.jussieu.fr> 1.1.1-1plf
|
||||
- 1.1.1
|
||||
|
||||
* Wed Jan 30 2002 Guillaume Rousse <rousse@ccr.jussieu.fr> 1.0.0-3plf
|
||||
- new plf extension
|
||||
|
||||
* Wed Dec 05 2001 Guillaume Rousse <g.rousse@linux-mandrake.com> 1.0.0-3mdk
|
||||
- removed conflict
|
||||
|
||||
* Tue Dec 04 2001 Guillaume Rousse <g.rousse@linux-mandrake.com> 1.0.0-2mdk
|
||||
- contributed to PLF by Yves Duret <yduret@mandrakesoft.com>
|
||||
- Conflicts: libdvdcss-ogle
|
||||
- more doc files
|
||||
- no doc file for devel package
|
||||
|
||||
* Fri Nov 30 2001 Yves Duret <yduret@mandrakesoft.com> 1.0.0-1mdk
|
||||
- version 1.0.0
|
||||
|
||||
* Thu Aug 23 2001 Yves Duret <yduret@mandrakesoft.com> 0.0.3-1mdk
|
||||
- version 0.0.3
|
||||
|
||||
* Mon Aug 13 2001 Yves Duret <yduret@mandrakesoft.com> 0.0.2-1mdk
|
||||
- version 0.0.2
|
||||
|
||||
* Tue Jun 19 2001 Yves Duret <yduret@mandrakesoft.com> 0.0.1-1mdk
|
||||
- first release and first mdk release
|
295
m4/attributes.m4
Normal file
295
m4/attributes.m4
Normal file
|
@ -0,0 +1,295 @@
|
|||
dnl Macros to check the presence of generic (non-typed) symbols.
|
||||
dnl Copyright (c) 2006-2007 Diego Pettenò <flameeyes@gmail.com>
|
||||
dnl Copyright (c) 2006-2007 xine project
|
||||
dnl
|
||||
dnl This program is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl This program is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with this program; if not, write to the Free Software
|
||||
dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
dnl 02110-1301, USA.
|
||||
dnl
|
||||
dnl As a special exception, the copyright owners of the
|
||||
dnl macro gives unlimited permission to copy, distribute and modify the
|
||||
dnl configure scripts that are the output of Autoconf when processing the
|
||||
dnl Macro. You need not follow the terms of the GNU General Public
|
||||
dnl License when using or distributing such scripts, even though portions
|
||||
dnl of the text of the Macro appear in them. The GNU General Public
|
||||
dnl License (GPL) does govern all other use of the material that
|
||||
dnl constitutes the Autoconf Macro.
|
||||
dnl
|
||||
dnl This special exception to the GPL applies to versions of the
|
||||
dnl Autoconf Macro released by this project. When you make and
|
||||
dnl distribute a modified version of the Autoconf Macro, you may extend
|
||||
dnl this special exception to the GPL to apply to your modified version as
|
||||
dnl well.
|
||||
|
||||
dnl Check if the flag is supported by compiler
|
||||
dnl CC_CHECK_CFLAGS_SILENT([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
|
||||
|
||||
AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [
|
||||
AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]),
|
||||
[ac_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $1"
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return 0; }])],
|
||||
[eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"],
|
||||
[eval "AS_TR_SH([cc_cv_cflags_$1])='no'"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
])
|
||||
|
||||
AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
|
||||
[$2], [$3])
|
||||
])
|
||||
|
||||
dnl Check if the flag is supported by compiler (cacheable)
|
||||
dnl CC_CHECK_CFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
|
||||
|
||||
AC_DEFUN([CC_CHECK_CFLAGS], [
|
||||
AC_CACHE_CHECK([if $CC supports $1 flag],
|
||||
AS_TR_SH([cc_cv_cflags_$1]),
|
||||
CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here!
|
||||
)
|
||||
|
||||
AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
|
||||
[$2], [$3])
|
||||
])
|
||||
|
||||
dnl CC_CHECK_CFLAG_APPEND(FLAG, [action-if-found], [action-if-not-found])
|
||||
dnl Check for CFLAG and appends them to CFLAGS if supported
|
||||
AC_DEFUN([CC_CHECK_CFLAG_APPEND], [
|
||||
AC_CACHE_CHECK([if $CC supports $1 flag],
|
||||
AS_TR_SH([cc_cv_cflags_$1]),
|
||||
CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here!
|
||||
)
|
||||
|
||||
AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
|
||||
[CFLAGS="$CFLAGS $1"; $2], [$3])
|
||||
])
|
||||
|
||||
dnl CC_CHECK_CFLAGS_APPEND([FLAG1 FLAG2], [action-if-found], [action-if-not])
|
||||
AC_DEFUN([CC_CHECK_CFLAGS_APPEND], [
|
||||
for flag in $1; do
|
||||
CC_CHECK_CFLAG_APPEND($flag, [$2], [$3])
|
||||
done
|
||||
])
|
||||
|
||||
dnl Check if the flag is supported by linker (cacheable)
|
||||
dnl CC_CHECK_LDFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
|
||||
|
||||
AC_DEFUN([CC_CHECK_LDFLAGS], [
|
||||
AC_CACHE_CHECK([if $CC supports $1 flag],
|
||||
AS_TR_SH([cc_cv_ldflags_$1]),
|
||||
[ac_save_LDFLAGS="$LDFLAGS"
|
||||
LDFLAGS="$LDFLAGS $1"
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return 1; }])],
|
||||
[eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"],
|
||||
[eval "AS_TR_SH([cc_cv_ldflags_$1])="])
|
||||
LDFLAGS="$ac_save_LDFLAGS"
|
||||
])
|
||||
|
||||
AS_IF([eval test x$]AS_TR_SH([cc_cv_ldflags_$1])[ = xyes],
|
||||
[$2], [$3])
|
||||
])
|
||||
|
||||
dnl Check for a -Werror flag or equivalent. -Werror is the GCC
|
||||
dnl and ICC flag that tells the compiler to treat all the warnings
|
||||
dnl as fatal. We usually need this option to make sure that some
|
||||
dnl constructs (like attributes) are not simply ignored.
|
||||
dnl
|
||||
dnl Other compilers don't support -Werror per se, but they support
|
||||
dnl an equivalent flag:
|
||||
dnl - Sun Studio compiler supports -errwarn=%all
|
||||
AC_DEFUN([CC_CHECK_WERROR], [
|
||||
AC_CACHE_CHECK(
|
||||
[for $CC way to treat warnings as errors],
|
||||
[cc_cv_werror],
|
||||
[CC_CHECK_CFLAGS_SILENT([-Werror], [cc_cv_werror=-Werror],
|
||||
[CC_CHECK_CFLAGS_SILENT([-errwarn=%all], [cc_cv_werror=-errwarn=%all])])
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([CC_CHECK_ATTRIBUTE], [
|
||||
AC_REQUIRE([CC_CHECK_WERROR])
|
||||
AC_CACHE_CHECK([if $CC supports __attribute__(( ifelse([$2], , [$1], [$2]) ))],
|
||||
AS_TR_SH([cc_cv_attribute_$1]),
|
||||
[ac_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $cc_cv_werror"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([$3])],
|
||||
[eval "AS_TR_SH([cc_cv_attribute_$1])='yes'"],
|
||||
[eval "AS_TR_SH([cc_cv_attribute_$1])='no'"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
])
|
||||
|
||||
AS_IF([eval test x$]AS_TR_SH([cc_cv_attribute_$1])[ = xyes],
|
||||
[AC_DEFINE(
|
||||
AS_TR_CPP([SUPPORT_ATTRIBUTE_$1]), 1,
|
||||
Define this if the compiler supports __attribute__((ifelse([$2], , [$1], [$2]))))
|
||||
$4],
|
||||
[$5])
|
||||
])
|
||||
|
||||
AC_DEFUN([CC_ATTRIBUTE_CONSTRUCTOR], [
|
||||
CC_CHECK_ATTRIBUTE(
|
||||
[constructor],,
|
||||
[extern void foo();
|
||||
void __attribute__((constructor)) ctor() { foo(); }],
|
||||
[$1], [$2])
|
||||
])
|
||||
|
||||
AC_DEFUN([CC_ATTRIBUTE_DESTRUCTOR], [
|
||||
CC_CHECK_ATTRIBUTE(
|
||||
[destructor],,
|
||||
[extern void foo();
|
||||
void __attribute__((destructor)) dtor() { foo(); }],
|
||||
[$1], [$2])
|
||||
])
|
||||
|
||||
AC_DEFUN([CC_ATTRIBUTE_FORMAT], [
|
||||
CC_CHECK_ATTRIBUTE(
|
||||
[format], [format(printf, n, n)],
|
||||
[void __attribute__((format(printf, 1, 2))) printflike(const char *fmt, ...) { fmt = (void *)0; }],
|
||||
[$1], [$2])
|
||||
])
|
||||
|
||||
AC_DEFUN([CC_ATTRIBUTE_FORMAT_ARG], [
|
||||
CC_CHECK_ATTRIBUTE(
|
||||
[format_arg], [format_arg(printf)],
|
||||
[char *__attribute__((format_arg(1))) gettextlike(const char *fmt) { fmt = (void *)0; }],
|
||||
[$1], [$2])
|
||||
])
|
||||
|
||||
AC_DEFUN([CC_ATTRIBUTE_VISIBILITY], [
|
||||
CC_CHECK_ATTRIBUTE(
|
||||
[visibility_$1], [visibility("$1")],
|
||||
[void __attribute__((visibility("$1"))) $1_function() { }],
|
||||
[$2], [$3])
|
||||
])
|
||||
|
||||
AC_DEFUN([CC_ATTRIBUTE_NONNULL], [
|
||||
CC_CHECK_ATTRIBUTE(
|
||||
[nonnull], [nonnull()],
|
||||
[void __attribute__((nonnull())) some_function(void *foo, void *bar) { foo = (void*)0; bar = (void*)0; }],
|
||||
[$1], [$2])
|
||||
])
|
||||
|
||||
AC_DEFUN([CC_ATTRIBUTE_UNUSED], [
|
||||
CC_CHECK_ATTRIBUTE(
|
||||
[unused], ,
|
||||
[void some_function(void *foo, __attribute__((unused)) void *bar);],
|
||||
[$1], [$2])
|
||||
])
|
||||
|
||||
AC_DEFUN([CC_ATTRIBUTE_SENTINEL], [
|
||||
CC_CHECK_ATTRIBUTE(
|
||||
[sentinel], ,
|
||||
[void some_function(void *foo, ...) __attribute__((sentinel));],
|
||||
[$1], [$2])
|
||||
])
|
||||
|
||||
AC_DEFUN([CC_ATTRIBUTE_DEPRECATED], [
|
||||
CC_CHECK_ATTRIBUTE(
|
||||
[deprecated], ,
|
||||
[void some_function(void *foo, ...) __attribute__((deprecated));],
|
||||
[$1], [$2])
|
||||
])
|
||||
|
||||
AC_DEFUN([CC_ATTRIBUTE_ALIAS], [
|
||||
CC_CHECK_ATTRIBUTE(
|
||||
[alias], [weak, alias],
|
||||
[void other_function(void *foo) { }
|
||||
void some_function(void *foo) __attribute__((weak, alias("other_function")));],
|
||||
[$1], [$2])
|
||||
])
|
||||
|
||||
AC_DEFUN([CC_ATTRIBUTE_MALLOC], [
|
||||
CC_CHECK_ATTRIBUTE(
|
||||
[malloc], ,
|
||||
[void * __attribute__((malloc)) my_alloc(int n);],
|
||||
[$1], [$2])
|
||||
])
|
||||
|
||||
AC_DEFUN([CC_ATTRIBUTE_PACKED], [
|
||||
CC_CHECK_ATTRIBUTE(
|
||||
[packed], ,
|
||||
[struct astructure { char a; int b; long c; void *d; } __attribute__((packed));
|
||||
char assert@<:@(sizeof(struct astructure) == (sizeof(char)+sizeof(int)+sizeof(long)+sizeof(void*)))-1@:>@;],
|
||||
[$1], [$2])
|
||||
])
|
||||
|
||||
AC_DEFUN([CC_ATTRIBUTE_CONST], [
|
||||
CC_CHECK_ATTRIBUTE(
|
||||
[const], ,
|
||||
[int __attribute__((const)) twopow(int n) { return 1 << n; } ],
|
||||
[$1], [$2])
|
||||
])
|
||||
|
||||
AC_DEFUN([CC_FLAG_VISIBILITY], [
|
||||
AC_REQUIRE([CC_CHECK_WERROR])
|
||||
AC_CACHE_CHECK([if $CC supports -fvisibility=hidden],
|
||||
[cc_cv_flag_visibility],
|
||||
[cc_flag_visibility_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $cc_cv_werror"
|
||||
CC_CHECK_CFLAGS_SILENT([-fvisibility=hidden],
|
||||
cc_cv_flag_visibility='yes',
|
||||
cc_cv_flag_visibility='no')
|
||||
CFLAGS="$cc_flag_visibility_save_CFLAGS"])
|
||||
|
||||
AS_IF([test "x$cc_cv_flag_visibility" = "xyes"],
|
||||
[AC_DEFINE([SUPPORT_FLAG_VISIBILITY], 1,
|
||||
[Define this if the compiler supports the -fvisibility flag])
|
||||
$1],
|
||||
[$2])
|
||||
])
|
||||
|
||||
AC_DEFUN([CC_FUNC_EXPECT], [
|
||||
AC_REQUIRE([CC_CHECK_WERROR])
|
||||
AC_CACHE_CHECK([if compiler has __builtin_expect function],
|
||||
[cc_cv_func_expect],
|
||||
[ac_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $cc_cv_werror"
|
||||
AC_COMPILE_IFELSE(
|
||||
[int some_function() {
|
||||
int a = 3;
|
||||
return (int)__builtin_expect(a, 3);
|
||||
}],
|
||||
[cc_cv_func_expect=yes],
|
||||
[cc_cv_func_expect=no])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
])
|
||||
|
||||
AS_IF([test "x$cc_cv_func_expect" = "xyes"],
|
||||
[AC_DEFINE([SUPPORT__BUILTIN_EXPECT], 1,
|
||||
[Define this if the compiler supports __builtin_expect() function])
|
||||
$1],
|
||||
[$2])
|
||||
])
|
||||
|
||||
AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [
|
||||
AC_REQUIRE([CC_CHECK_WERROR])
|
||||
AC_CACHE_CHECK([highest __attribute__ ((aligned ())) supported],
|
||||
[cc_cv_attribute_aligned],
|
||||
[ac_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $cc_cv_werror"
|
||||
for cc_attribute_align_try in 64 32 16 8 4 2; do
|
||||
AC_COMPILE_IFELSE([
|
||||
int main(void) {
|
||||
static char c __attribute__ ((aligned($cc_attribute_align_try))) = 0;
|
||||
return c;
|
||||
}], [cc_cv_attribute_aligned=$cc_attribute_align_try; break])
|
||||
done
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
])
|
||||
|
||||
if test "x$cc_cv_attribute_aligned" != "x"; then
|
||||
AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX], [$cc_cv_attribute_aligned],
|
||||
[Define the highest alignment supported])
|
||||
fi
|
||||
])
|
8388
m4/libtool.m4
vendored
Normal file
8388
m4/libtool.m4
vendored
Normal file
File diff suppressed because it is too large
Load diff
437
m4/ltoptions.m4
vendored
Normal file
437
m4/ltoptions.m4
vendored
Normal file
|
@ -0,0 +1,437 @@
|
|||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software
|
||||
# Foundation, Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# serial 8 ltoptions.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
|
||||
|
||||
|
||||
# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
|
||||
# ------------------------------------------
|
||||
m4_define([_LT_MANGLE_OPTION],
|
||||
[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
|
||||
|
||||
|
||||
# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
|
||||
# ---------------------------------------
|
||||
# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
|
||||
# matching handler defined, dispatch to it. Other OPTION-NAMEs are
|
||||
# saved as a flag.
|
||||
m4_define([_LT_SET_OPTION],
|
||||
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
|
||||
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
|
||||
_LT_MANGLE_DEFUN([$1], [$2]),
|
||||
[m4_warning([Unknown $1 option '$2'])])[]dnl
|
||||
])
|
||||
|
||||
|
||||
# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
|
||||
# ------------------------------------------------------------
|
||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
|
||||
m4_define([_LT_IF_OPTION],
|
||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
|
||||
|
||||
|
||||
# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
|
||||
# -------------------------------------------------------
|
||||
# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
|
||||
# are set.
|
||||
m4_define([_LT_UNLESS_OPTIONS],
|
||||
[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
|
||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
|
||||
[m4_define([$0_found])])])[]dnl
|
||||
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
|
||||
])[]dnl
|
||||
])
|
||||
|
||||
|
||||
# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
|
||||
# ----------------------------------------
|
||||
# OPTION-LIST is a space-separated list of Libtool options associated
|
||||
# with MACRO-NAME. If any OPTION has a matching handler declared with
|
||||
# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
|
||||
# the unknown option and exit.
|
||||
m4_defun([_LT_SET_OPTIONS],
|
||||
[# Set options
|
||||
m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
|
||||
[_LT_SET_OPTION([$1], _LT_Option)])
|
||||
|
||||
m4_if([$1],[LT_INIT],[
|
||||
dnl
|
||||
dnl Simply set some default values (i.e off) if boolean options were not
|
||||
dnl specified:
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
|
||||
])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
|
||||
])
|
||||
dnl
|
||||
dnl If no reference was made to various pairs of opposing options, then
|
||||
dnl we run the default mode handler for the pair. For example, if neither
|
||||
dnl 'shared' nor 'disable-shared' was passed, we enable building of shared
|
||||
dnl archives by default:
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
|
||||
[_LT_ENABLE_FAST_INSTALL])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4],
|
||||
[_LT_WITH_AIX_SONAME([aix])])
|
||||
])
|
||||
])# _LT_SET_OPTIONS
|
||||
|
||||
|
||||
## --------------------------------- ##
|
||||
## Macros to handle LT_INIT options. ##
|
||||
## --------------------------------- ##
|
||||
|
||||
# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
|
||||
# -----------------------------------------
|
||||
m4_define([_LT_MANGLE_DEFUN],
|
||||
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
|
||||
|
||||
|
||||
# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
|
||||
# -----------------------------------------------
|
||||
m4_define([LT_OPTION_DEFINE],
|
||||
[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
|
||||
])# LT_OPTION_DEFINE
|
||||
|
||||
|
||||
# dlopen
|
||||
# ------
|
||||
LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
|
||||
])
|
||||
|
||||
AU_DEFUN([AC_LIBTOOL_DLOPEN],
|
||||
[_LT_SET_OPTION([LT_INIT], [dlopen])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the 'dlopen' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
|
||||
|
||||
|
||||
# win32-dll
|
||||
# ---------
|
||||
# Declare package support for building win32 dll's.
|
||||
LT_OPTION_DEFINE([LT_INIT], [win32-dll],
|
||||
[enable_win32_dll=yes
|
||||
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
;;
|
||||
esac
|
||||
|
||||
test -z "$AS" && AS=as
|
||||
_LT_DECL([], [AS], [1], [Assembler program])dnl
|
||||
|
||||
test -z "$DLLTOOL" && DLLTOOL=dlltool
|
||||
_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
|
||||
|
||||
test -z "$OBJDUMP" && OBJDUMP=objdump
|
||||
_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
|
||||
])# win32-dll
|
||||
|
||||
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
_LT_SET_OPTION([LT_INIT], [win32-dll])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the 'win32-dll' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
|
||||
|
||||
|
||||
# _LT_ENABLE_SHARED([DEFAULT])
|
||||
# ----------------------------
|
||||
# implement the --enable-shared flag, and supports the 'shared' and
|
||||
# 'disable-shared' LT_INIT options.
|
||||
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
|
||||
m4_define([_LT_ENABLE_SHARED],
|
||||
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([shared],
|
||||
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
|
||||
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_shared=yes ;;
|
||||
no) enable_shared=no ;;
|
||||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for pkg in $enableval; do
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
|
||||
|
||||
_LT_DECL([build_libtool_libs], [enable_shared], [0],
|
||||
[Whether or not to build shared libraries])
|
||||
])# _LT_ENABLE_SHARED
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
|
||||
|
||||
# Old names:
|
||||
AC_DEFUN([AC_ENABLE_SHARED],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_DISABLE_SHARED],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-shared])
|
||||
])
|
||||
|
||||
AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
|
||||
AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AM_ENABLE_SHARED], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_SHARED], [])
|
||||
|
||||
|
||||
|
||||
# _LT_ENABLE_STATIC([DEFAULT])
|
||||
# ----------------------------
|
||||
# implement the --enable-static flag, and support the 'static' and
|
||||
# 'disable-static' LT_INIT options.
|
||||
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
|
||||
m4_define([_LT_ENABLE_STATIC],
|
||||
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([static],
|
||||
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
|
||||
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_static=yes ;;
|
||||
no) enable_static=no ;;
|
||||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for pkg in $enableval; do
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
|
||||
|
||||
_LT_DECL([build_old_libs], [enable_static], [0],
|
||||
[Whether or not to build static libraries])
|
||||
])# _LT_ENABLE_STATIC
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
|
||||
|
||||
# Old names:
|
||||
AC_DEFUN([AC_ENABLE_STATIC],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_DISABLE_STATIC],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-static])
|
||||
])
|
||||
|
||||
AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
|
||||
AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AM_ENABLE_STATIC], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_STATIC], [])
|
||||
|
||||
|
||||
|
||||
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
|
||||
# ----------------------------------
|
||||
# implement the --enable-fast-install flag, and support the 'fast-install'
|
||||
# and 'disable-fast-install' LT_INIT options.
|
||||
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
|
||||
m4_define([_LT_ENABLE_FAST_INSTALL],
|
||||
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([fast-install],
|
||||
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
|
||||
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_fast_install=yes ;;
|
||||
no) enable_fast_install=no ;;
|
||||
*)
|
||||
enable_fast_install=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for pkg in $enableval; do
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_fast_install=yes
|
||||
fi
|
||||
done
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
|
||||
|
||||
_LT_DECL([fast_install], [enable_fast_install], [0],
|
||||
[Whether or not to optimize for fast installation])dnl
|
||||
])# _LT_ENABLE_FAST_INSTALL
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
|
||||
|
||||
# Old names:
|
||||
AU_DEFUN([AC_ENABLE_FAST_INSTALL],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
||||
the 'fast-install' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
||||
the 'disable-fast-install' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
|
||||
|
||||
|
||||
# _LT_WITH_AIX_SONAME([DEFAULT])
|
||||
# ----------------------------------
|
||||
# implement the --with-aix-soname flag, and support the `aix-soname=aix'
|
||||
# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
|
||||
# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'.
|
||||
m4_define([_LT_WITH_AIX_SONAME],
|
||||
[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
|
||||
shared_archive_member_spec=
|
||||
case $host,$enable_shared in
|
||||
power*-*-aix[[5-9]]*,yes)
|
||||
AC_MSG_CHECKING([which variant of shared library versioning to provide])
|
||||
AC_ARG_WITH([aix-soname],
|
||||
[AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
|
||||
[shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
|
||||
[case $withval in
|
||||
aix|svr4|both)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Unknown argument to --with-aix-soname])
|
||||
;;
|
||||
esac
|
||||
lt_cv_with_aix_soname=$with_aix_soname],
|
||||
[AC_CACHE_VAL([lt_cv_with_aix_soname],
|
||||
[lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
|
||||
with_aix_soname=$lt_cv_with_aix_soname])
|
||||
AC_MSG_RESULT([$with_aix_soname])
|
||||
if test aix != "$with_aix_soname"; then
|
||||
# For the AIX way of multilib, we name the shared archive member
|
||||
# based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
|
||||
# and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
|
||||
# Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
|
||||
# the AIX toolchain works better with OBJECT_MODE set (default 32).
|
||||
if test 64 = "${OBJECT_MODE-32}"; then
|
||||
shared_archive_member_spec=shr_64
|
||||
else
|
||||
shared_archive_member_spec=shr
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
with_aix_soname=aix
|
||||
;;
|
||||
esac
|
||||
|
||||
_LT_DECL([], [shared_archive_member_spec], [0],
|
||||
[Shared archive member basename, for filename based shared library versioning on AIX])dnl
|
||||
])# _LT_WITH_AIX_SONAME
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
|
||||
|
||||
|
||||
# _LT_WITH_PIC([MODE])
|
||||
# --------------------
|
||||
# implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
|
||||
# LT_INIT options.
|
||||
# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'.
|
||||
m4_define([_LT_WITH_PIC],
|
||||
[AC_ARG_WITH([pic],
|
||||
[AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
|
||||
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
|
||||
[lt_p=${PACKAGE-default}
|
||||
case $withval in
|
||||
yes|no) pic_mode=$withval ;;
|
||||
*)
|
||||
pic_mode=default
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for lt_pkg in $withval; do
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$lt_pkg" = "X$lt_p"; then
|
||||
pic_mode=yes
|
||||
fi
|
||||
done
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[pic_mode=m4_default([$1], [default])])
|
||||
|
||||
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
|
||||
])# _LT_WITH_PIC
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
|
||||
|
||||
# Old name:
|
||||
AU_DEFUN([AC_LIBTOOL_PICMODE],
|
||||
[_LT_SET_OPTION([LT_INIT], [pic-only])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the 'pic-only' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
|
||||
|
||||
## ----------------- ##
|
||||
## LTDL_INIT Options ##
|
||||
## ----------------- ##
|
||||
|
||||
m4_define([_LTDL_MODE], [])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
|
||||
[m4_define([_LTDL_MODE], [nonrecursive])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [recursive],
|
||||
[m4_define([_LTDL_MODE], [recursive])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [subproject],
|
||||
[m4_define([_LTDL_MODE], [subproject])])
|
||||
|
||||
m4_define([_LTDL_TYPE], [])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [installable],
|
||||
[m4_define([_LTDL_TYPE], [installable])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [convenience],
|
||||
[m4_define([_LTDL_TYPE], [convenience])])
|
124
m4/ltsugar.m4
vendored
Normal file
124
m4/ltsugar.m4
vendored
Normal file
|
@ -0,0 +1,124 @@
|
|||
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software
|
||||
# Foundation, Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# serial 6 ltsugar.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
|
||||
|
||||
|
||||
# lt_join(SEP, ARG1, [ARG2...])
|
||||
# -----------------------------
|
||||
# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
|
||||
# associated separator.
|
||||
# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
|
||||
# versions in m4sugar had bugs.
|
||||
m4_define([lt_join],
|
||||
[m4_if([$#], [1], [],
|
||||
[$#], [2], [[$2]],
|
||||
[m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
|
||||
m4_define([_lt_join],
|
||||
[m4_if([$#$2], [2], [],
|
||||
[m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
|
||||
|
||||
|
||||
# lt_car(LIST)
|
||||
# lt_cdr(LIST)
|
||||
# ------------
|
||||
# Manipulate m4 lists.
|
||||
# These macros are necessary as long as will still need to support
|
||||
# Autoconf-2.59, which quotes differently.
|
||||
m4_define([lt_car], [[$1]])
|
||||
m4_define([lt_cdr],
|
||||
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
|
||||
[$#], 1, [],
|
||||
[m4_dquote(m4_shift($@))])])
|
||||
m4_define([lt_unquote], $1)
|
||||
|
||||
|
||||
# lt_append(MACRO-NAME, STRING, [SEPARATOR])
|
||||
# ------------------------------------------
|
||||
# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'.
|
||||
# Note that neither SEPARATOR nor STRING are expanded; they are appended
|
||||
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
|
||||
# No SEPARATOR is output if MACRO-NAME was previously undefined (different
|
||||
# than defined and empty).
|
||||
#
|
||||
# This macro is needed until we can rely on Autoconf 2.62, since earlier
|
||||
# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
|
||||
m4_define([lt_append],
|
||||
[m4_define([$1],
|
||||
m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
|
||||
|
||||
|
||||
|
||||
# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
|
||||
# ----------------------------------------------------------
|
||||
# Produce a SEP delimited list of all paired combinations of elements of
|
||||
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
|
||||
# has the form PREFIXmINFIXSUFFIXn.
|
||||
# Needed until we can rely on m4_combine added in Autoconf 2.62.
|
||||
m4_define([lt_combine],
|
||||
[m4_if(m4_eval([$# > 3]), [1],
|
||||
[m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
|
||||
[[m4_foreach([_Lt_prefix], [$2],
|
||||
[m4_foreach([_Lt_suffix],
|
||||
]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
|
||||
[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
|
||||
|
||||
|
||||
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
|
||||
# -----------------------------------------------------------------------
|
||||
# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
|
||||
# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
|
||||
m4_define([lt_if_append_uniq],
|
||||
[m4_ifdef([$1],
|
||||
[m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
|
||||
[lt_append([$1], [$2], [$3])$4],
|
||||
[$5])],
|
||||
[lt_append([$1], [$2], [$3])$4])])
|
||||
|
||||
|
||||
# lt_dict_add(DICT, KEY, VALUE)
|
||||
# -----------------------------
|
||||
m4_define([lt_dict_add],
|
||||
[m4_define([$1($2)], [$3])])
|
||||
|
||||
|
||||
# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
|
||||
# --------------------------------------------
|
||||
m4_define([lt_dict_add_subkey],
|
||||
[m4_define([$1($2:$3)], [$4])])
|
||||
|
||||
|
||||
# lt_dict_fetch(DICT, KEY, [SUBKEY])
|
||||
# ----------------------------------
|
||||
m4_define([lt_dict_fetch],
|
||||
[m4_ifval([$3],
|
||||
m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
|
||||
m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
|
||||
|
||||
|
||||
# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
|
||||
# -----------------------------------------------------------------
|
||||
m4_define([lt_if_dict_fetch],
|
||||
[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
|
||||
[$5],
|
||||
[$6])])
|
||||
|
||||
|
||||
# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
|
||||
# --------------------------------------------------------------
|
||||
m4_define([lt_dict_filter],
|
||||
[m4_if([$5], [], [],
|
||||
[lt_join(m4_quote(m4_default([$4], [[, ]])),
|
||||
lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
|
||||
[lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
|
||||
])
|
23
m4/ltversion.m4
vendored
Normal file
23
m4/ltversion.m4
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
# ltversion.m4 -- version numbers -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# @configure_input@
|
||||
|
||||
# serial 4179 ltversion.m4
|
||||
# This file is part of GNU Libtool
|
||||
|
||||
m4_define([LT_PACKAGE_VERSION], [2.4.6])
|
||||
m4_define([LT_PACKAGE_REVISION], [2.4.6])
|
||||
|
||||
AC_DEFUN([LTVERSION_VERSION],
|
||||
[macro_version='2.4.6'
|
||||
macro_revision='2.4.6'
|
||||
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
|
||||
_LT_DECL(, macro_revision, 0)
|
||||
])
|
99
m4/lt~obsolete.m4
vendored
Normal file
99
m4/lt~obsolete.m4
vendored
Normal file
|
@ -0,0 +1,99 @@
|
|||
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software
|
||||
# Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# serial 5 lt~obsolete.m4
|
||||
|
||||
# These exist entirely to fool aclocal when bootstrapping libtool.
|
||||
#
|
||||
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN),
|
||||
# which have later been changed to m4_define as they aren't part of the
|
||||
# exported API, or moved to Autoconf or Automake where they belong.
|
||||
#
|
||||
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
|
||||
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
|
||||
# using a macro with the same name in our local m4/libtool.m4 it'll
|
||||
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
|
||||
# and doesn't know about Autoconf macros at all.)
|
||||
#
|
||||
# So we provide this file, which has a silly filename so it's always
|
||||
# included after everything else. This provides aclocal with the
|
||||
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
|
||||
# because those macros already exist, or will be overwritten later.
|
||||
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
|
||||
#
|
||||
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
|
||||
# Yes, that means every name once taken will need to remain here until
|
||||
# we give up compatibility with versions before 1.7, at which point
|
||||
# we need to keep only those names which we still refer to.
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
|
||||
|
||||
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
|
||||
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
|
||||
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
|
||||
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
|
||||
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
|
||||
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
|
||||
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
|
||||
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
|
||||
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
|
||||
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
|
||||
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
|
||||
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
|
||||
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
|
||||
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
|
||||
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
|
||||
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
|
||||
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
|
||||
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
|
||||
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
|
||||
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
|
||||
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
|
||||
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
|
||||
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
|
||||
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
|
||||
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
|
||||
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
|
||||
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
|
||||
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
|
||||
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
|
||||
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
|
||||
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
|
||||
m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
|
||||
m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
|
||||
m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
|
||||
m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
|
||||
m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
|
||||
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
|
||||
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
|
215
missing
Executable file
215
missing
Executable file
|
@ -0,0 +1,215 @@
|
|||
#! /bin/sh
|
||||
# Common wrapper for a few potentially missing GNU programs.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
||||
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# 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 <https://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.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
|
||||
--is-lightweight)
|
||||
# Used by our autoconf macros to check whether the available missing
|
||||
# script is modern enough.
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--run)
|
||||
# Back-compat with the calling convention used by older automake.
|
||||
shift
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
|
||||
to PROGRAM being missing or too old.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal autoconf autoheader autom4te automake makeinfo
|
||||
bison yacc flex lex help2man
|
||||
|
||||
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
|
||||
'g' are ignored when checking the name.
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: unknown '$1' option"
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# Run the given program, remember its exit status.
|
||||
"$@"; st=$?
|
||||
|
||||
# If it succeeded, we are done.
|
||||
test $st -eq 0 && exit 0
|
||||
|
||||
# Also exit now if we it failed (or wasn't found), and '--version' was
|
||||
# passed; such an option is passed most likely to detect whether the
|
||||
# program is present and works.
|
||||
case $2 in --version|--help) exit $st;; esac
|
||||
|
||||
# Exit code 63 means version mismatch. This often happens when the user
|
||||
# tries to use an ancient version of a tool on a file that requires a
|
||||
# minimum version.
|
||||
if test $st -eq 63; then
|
||||
msg="probably too old"
|
||||
elif test $st -eq 127; then
|
||||
# Program was missing.
|
||||
msg="missing on your system"
|
||||
else
|
||||
# Program was found and executed, but failed. Give up.
|
||||
exit $st
|
||||
fi
|
||||
|
||||
perl_URL=https://www.perl.org/
|
||||
flex_URL=https://github.com/westes/flex
|
||||
gnu_software_URL=https://www.gnu.org/software
|
||||
|
||||
program_details ()
|
||||
{
|
||||
case $1 in
|
||||
aclocal|automake)
|
||||
echo "The '$1' program is part of the GNU Automake package:"
|
||||
echo "<$gnu_software_URL/automake>"
|
||||
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/autoconf>"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
autoconf|autom4te|autoheader)
|
||||
echo "The '$1' program is part of the GNU Autoconf package:"
|
||||
echo "<$gnu_software_URL/autoconf/>"
|
||||
echo "It also requires GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice ()
|
||||
{
|
||||
# Normalize program name to check for.
|
||||
normalized_program=`echo "$1" | sed '
|
||||
s/^gnu-//; t
|
||||
s/^gnu//; t
|
||||
s/^g//; t'`
|
||||
|
||||
printf '%s\n' "'$1' is $msg."
|
||||
|
||||
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
|
||||
case $normalized_program in
|
||||
autoconf*)
|
||||
echo "You should only need it if you modified 'configure.ac',"
|
||||
echo "or m4 files included by it."
|
||||
program_details 'autoconf'
|
||||
;;
|
||||
autoheader*)
|
||||
echo "You should only need it if you modified 'acconfig.h' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'autoheader'
|
||||
;;
|
||||
automake*)
|
||||
echo "You should only need it if you modified 'Makefile.am' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'automake'
|
||||
;;
|
||||
aclocal*)
|
||||
echo "You should only need it if you modified 'acinclude.m4' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'aclocal'
|
||||
;;
|
||||
autom4te*)
|
||||
echo "You might have modified some maintainer files that require"
|
||||
echo "the 'autom4te' program to be rebuilt."
|
||||
program_details 'autom4te'
|
||||
;;
|
||||
bison*|yacc*)
|
||||
echo "You should only need it if you modified a '.y' file."
|
||||
echo "You may want to install the GNU Bison package:"
|
||||
echo "<$gnu_software_URL/bison/>"
|
||||
;;
|
||||
lex*|flex*)
|
||||
echo "You should only need it if you modified a '.l' file."
|
||||
echo "You may want to install the Fast Lexical Analyzer package:"
|
||||
echo "<$flex_URL>"
|
||||
;;
|
||||
help2man*)
|
||||
echo "You should only need it if you modified a dependency" \
|
||||
"of a man page."
|
||||
echo "You may want to install the GNU Help2man package:"
|
||||
echo "<$gnu_software_URL/help2man/>"
|
||||
;;
|
||||
makeinfo*)
|
||||
echo "You should only need it if you modified a '.texi' file, or"
|
||||
echo "any other file indirectly affecting the aspect of the manual."
|
||||
echo "You might want to install the Texinfo package:"
|
||||
echo "<$gnu_software_URL/texinfo/>"
|
||||
echo "The spurious makeinfo call might also be the consequence of"
|
||||
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
|
||||
echo "want to install GNU make:"
|
||||
echo "<$gnu_software_URL/make/>"
|
||||
;;
|
||||
*)
|
||||
echo "You might have modified some files without having the proper"
|
||||
echo "tools for further handling them. Check the 'README' file, it"
|
||||
echo "often tells you about the needed prerequisites for installing"
|
||||
echo "this package. You may also peek at any GNU archive site, in"
|
||||
echo "case some other package contains this missing '$1' program."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice "$1" | sed -e '1s/^/WARNING: /' \
|
||||
-e '2,$s/^/ /' >&2
|
||||
|
||||
# Propagate the correct exit status (expected to be 127 for a program
|
||||
# not found, 63 for a program that failed due to version mismatch).
|
||||
exit $st
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
44
msvc/config.h
Normal file
44
msvc/config.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/* config.h. Generated by hand. */
|
||||
|
||||
/* #undef DARWIN_DVD_IOCTL */
|
||||
/* #undef DVD_STRUCT_IN_DVD_H */
|
||||
/* #undef DVD_STRUCT_IN_LINUX_CDROM_H */
|
||||
/* #undef DVD_STRUCT_IN_SYS_CDIO_H */
|
||||
/* #undef DVD_STRUCT_IN_SYS_DVDIO_H */
|
||||
/* #undef HAVE_BSD_DVD_STRUCT */
|
||||
#define HAVE_DLFCN_H 1
|
||||
/* #undef HAVE_DVD_H */
|
||||
/* #undef HAVE_INTTYPES_H */
|
||||
/* #undef HAVE_LINUX_CDROM_H */
|
||||
/* #undef HAVE_LINUX_DVD_STRUCT */
|
||||
#define HAVE_MEMORY_H 1
|
||||
/* #undef HAVE_OPENBSD_DVD_STRUCT */
|
||||
#define HAVE_STDLIB_H 1
|
||||
#define HAVE_STRINGS_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
/* #undef HAVE_SYS_CDIO_H */
|
||||
/* #undef HAVE_SYS_DVDIO_H */
|
||||
#define HAVE_SYS_IOCTL_H 1
|
||||
/* #undef HAVE_SYS_PARAM_H */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
/* #undef HAVE_UNISTD_H */
|
||||
#define HAVE_WINDOWS_H 1
|
||||
#define HAVE_WINIOCTL_H 1
|
||||
/* #undef HAVE__SYS_DEV_SCSI_SCSI_IOCTL_H */
|
||||
#define PACKAGE "libdvdcss"
|
||||
#define PACKAGE_BUGREPORT ""
|
||||
#define PACKAGE_NAME "libdvdcss"
|
||||
#define PACKAGE_STRING "libdvdcss 1.3.0"
|
||||
#define PACKAGE_TARNAME "libdvdcss"
|
||||
#define PACKAGE_VERSION "1.3.0"
|
||||
/* #undef SOLARIS_USCSI */
|
||||
#define STDC_HEADERS 1
|
||||
#define VERSION "1.3.0"
|
||||
#define _WIN32_IE 0x0501
|
||||
/* #undef const */
|
||||
/* #undef inline */
|
||||
/* #undef size_t */
|
||||
#define HAVE_BROKEN_MKDIR 1
|
||||
#define _CRT_SECURE_NO_WARNINGS 1
|
||||
#define LIBDVDCSS_EXPORTS 1
|
104
msvc/csstest.dsp
Normal file
104
msvc/csstest.dsp
Normal file
|
@ -0,0 +1,104 @@
|
|||
# Microsoft Developer Studio Project File - Name="csstest" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=csstest - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "csstest.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "csstest.mak" CFG="csstest - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "csstest - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "csstest - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "csstest - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "." /I "..\src" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "csstest - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "csstest___Win32_Debug"
|
||||
# PROP BASE Intermediate_Dir "csstest___Win32_Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "csstest___Win32_Debug"
|
||||
# PROP Intermediate_Dir "csstest___Win32_Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "..\src" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "csstest - Win32 Release"
|
||||
# Name "csstest - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\test\csstest.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\dvdcss\dvdcss.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
144
msvc/libdvdcss.dsp
Normal file
144
msvc/libdvdcss.dsp
Normal file
|
@ -0,0 +1,144 @@
|
|||
# Microsoft Developer Studio Project File - Name="libdvdcss" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=libdvdcss - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "libdvdcss.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "libdvdcss.mak" CFG="libdvdcss - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "libdvdcss - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "libdvdcss - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "libdvdcss - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D PATH_MAX=2048 /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "libdvdcss - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D PATH_MAX=2048 /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "libdvdcss - Win32 Release"
|
||||
# Name "libdvdcss - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\css.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\device.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\error.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\ioctl.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\libdvdcss.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\common.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\config.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\css.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\csstables.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\device.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\dvdcss\dvdcss.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\ioctl.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\libdvdcss.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
133
msvc/libdvdcss.vcxproj
Normal file
133
msvc/libdvdcss.vcxproj
Normal file
|
@ -0,0 +1,133 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<SccProjectName />
|
||||
<SccLocalPath />
|
||||
<ProjectGuid>{50F2BF62-8520-4B37-97DD-578EA282EC04}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>.\Release\</OutDir>
|
||||
<IntDir>.\Release\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>.\Debug\</OutDir>
|
||||
<IntDir>.\Debug\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<StringPooling>true</StringPooling>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;WIN32;_LIB;PATH_MAX=2048;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>.\Release\</AssemblerListingLocation>
|
||||
<PrecompiledHeaderOutputFile>.\Release\libdvdcss.pch</PrecompiledHeaderOutputFile>
|
||||
<ObjectFileName>.\Release\</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\Release\</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\Release\libdvdcss.bsc</OutputFile>
|
||||
</Bscmake>
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\Release\libdvdcss.lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;WIN32;_LIB;PATH_MAX=2048;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>.\Debug\</AssemblerListingLocation>
|
||||
<PrecompiledHeaderOutputFile>.\Debug\libdvdcss.pch</PrecompiledHeaderOutputFile>
|
||||
<ObjectFileName>.\Debug\</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\Debug\</ProgramDataBaseFileName>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\Debug\libdvdcss.bsc</OutputFile>
|
||||
</Bscmake>
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\Debug\libdvdcss.lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\css.c" />
|
||||
<ClCompile Include="..\src\device.c" />
|
||||
<ClCompile Include="..\src\error.c" />
|
||||
<ClCompile Include="..\src\ioctl.c" />
|
||||
<ClCompile Include="..\src\libdvdcss.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\common.h" />
|
||||
<ClInclude Include="config.h" />
|
||||
<ClInclude Include="..\src\css.h" />
|
||||
<ClInclude Include="..\src\csstables.h" />
|
||||
<ClInclude Include="..\src\device.h" />
|
||||
<ClInclude Include="..\src\dvdcss\dvdcss.h" />
|
||||
<ClInclude Include="..\src\ioctl.h" />
|
||||
<ClInclude Include="..\src\libdvdcss.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
44
msvc/workspace.dsw
Normal file
44
msvc/workspace.dsw
Normal file
|
@ -0,0 +1,44 @@
|
|||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "csstest"=.\csstest.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name libdvdcss
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "libdvdcss"=.\libdvdcss.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
72
src/common.h
Normal file
72
src/common.h
Normal file
|
@ -0,0 +1,72 @@
|
|||
/*****************************************************************************
|
||||
* common.h: common definitions
|
||||
* Collection of useful common types and macros definitions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1998, 1999, 2000 VideoLAN
|
||||
*
|
||||
* Authors: Sam Hocevar <sam@via.ecp.fr>
|
||||
* Vincent Seguin <seguin@via.ecp.fr>
|
||||
* Gildas Bazin <gbazin@netcourrier.com>
|
||||
*
|
||||
* libdvdcss 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.
|
||||
*
|
||||
* libdvdcss 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 libdvdcss; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef DVDCSS_COMMON_H
|
||||
#define DVDCSS_COMMON_H
|
||||
|
||||
#if defined( _WIN32 )
|
||||
# include <io.h> /* _lseeki64 */
|
||||
|
||||
/* several type definitions */
|
||||
# if defined( __MINGW32__ )
|
||||
# undef lseek
|
||||
# define lseek _lseeki64
|
||||
# if !defined( _OFF_T_ )
|
||||
typedef long long _off_t;
|
||||
typedef _off_t off_t;
|
||||
# define _OFF_T_
|
||||
# else
|
||||
# define off_t long long
|
||||
# endif
|
||||
# endif /* defined( __MINGW32__ ) */
|
||||
|
||||
# if defined( _MSC_VER )
|
||||
# undef lseek
|
||||
# define lseek _lseeki64
|
||||
# if !defined( _OFF_T_DEFINED )
|
||||
typedef __int64 off_t;
|
||||
# define _OFF_T_DEFINED
|
||||
# else
|
||||
# define off_t __int64
|
||||
# endif
|
||||
# define ssize_t SSIZE_T
|
||||
# define snprintf _snprintf
|
||||
# define strdup _strdup
|
||||
# define open _open
|
||||
# define close _close
|
||||
# define read _read
|
||||
# define write _write
|
||||
# endif /* defined( _MSC_VER ) */
|
||||
|
||||
#endif /* defined( _WIN32 ) */
|
||||
|
||||
#ifdef __ANDROID__
|
||||
# undef lseek
|
||||
# define lseek lseek64
|
||||
# undef off_t
|
||||
# define off_t off64_t
|
||||
#endif /* __ANDROID__ */
|
||||
|
||||
#endif /* DVDCSS_COMMON_H */
|
65
src/css.h
Normal file
65
src/css.h
Normal file
|
@ -0,0 +1,65 @@
|
|||
/*****************************************************************************
|
||||
* css.h: Structures for DVD authentication and unscrambling
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1999-2001 VideoLAN
|
||||
*
|
||||
* Author: Stéphane Borel <stef@via.ecp.fr>
|
||||
*
|
||||
* based on:
|
||||
* - css-auth by Derek Fawcus <derek@spider.com>
|
||||
* - DVD CSS ioctls example program by Andrew T. Veliath <andrewtv@usa.net>
|
||||
* - DeCSSPlus by Ethan Hawke
|
||||
* - The Divide and conquer attack by Frank A. Stevenson <frank@funcom.com>
|
||||
*
|
||||
* libdvdcss 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.
|
||||
*
|
||||
* libdvdcss 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 libdvdcss; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef DVDCSS_CSS_H
|
||||
#define DVDCSS_CSS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "dvdcss/dvdcss.h"
|
||||
|
||||
#define CACHE_FILENAME_LENGTH_STRING "10"
|
||||
|
||||
#define DVD_KEY_SIZE 5
|
||||
|
||||
typedef uint8_t dvd_key[DVD_KEY_SIZE];
|
||||
|
||||
typedef struct dvd_title
|
||||
{
|
||||
int i_startlb;
|
||||
dvd_key p_key;
|
||||
struct dvd_title *p_next;
|
||||
} dvd_title;
|
||||
|
||||
typedef struct css
|
||||
{
|
||||
int i_agid; /* Current Authentication Grant ID. */
|
||||
dvd_key p_bus_key; /* Current session key. */
|
||||
dvd_key p_disc_key; /* This DVD disc's key. */
|
||||
dvd_key p_title_key; /* Current title key. */
|
||||
} css;
|
||||
|
||||
/*****************************************************************************
|
||||
* Prototypes in css.c
|
||||
*****************************************************************************/
|
||||
int dvdcss_test ( dvdcss_t );
|
||||
int dvdcss_title ( dvdcss_t, int );
|
||||
int dvdcss_disckey ( dvdcss_t );
|
||||
int dvdcss_unscramble ( uint8_t *, uint8_t * );
|
||||
|
||||
#endif /* DVDCSS_CSS_H */
|
396
src/csstables.h
Normal file
396
src/csstables.h
Normal file
|
@ -0,0 +1,396 @@
|
|||
/*****************************************************************************
|
||||
* csstables.h: CSS Tables for DVD unscrambling
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1999-2001 VideoLAN
|
||||
*
|
||||
* Author: Stéphane Borel <stef@via.ecp.fr>
|
||||
*
|
||||
* based on:
|
||||
* - css-auth by Derek Fawcus <derek@spider.com>
|
||||
* - DVD CSS ioctls example program by Andrew T. Veliath <andrewtv@usa.net>
|
||||
* - The Divide and conquer attack by Frank A. Stevenson <frank@funcom.com>
|
||||
* - DeCSSPlus by Ethan Hawke
|
||||
* - DecVOB
|
||||
* see http://www.lemuria.org/DeCSS/ by Tom Vogt for more information.
|
||||
*
|
||||
* libdvdcss 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.
|
||||
*
|
||||
* libdvdcss 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 libdvdcss; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef DVDCSS_CSSTABLES_H
|
||||
#define DVDCSS_CSSTABLES_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
static const uint8_t p_css_tab1[ 256 ] =
|
||||
{
|
||||
0x33, 0x73, 0x3b, 0x26, 0x63, 0x23, 0x6b, 0x76,
|
||||
0x3e, 0x7e, 0x36, 0x2b, 0x6e, 0x2e, 0x66, 0x7b,
|
||||
0xd3, 0x93, 0xdb, 0x06, 0x43, 0x03, 0x4b, 0x96,
|
||||
0xde, 0x9e, 0xd6, 0x0b, 0x4e, 0x0e, 0x46, 0x9b,
|
||||
0x57, 0x17, 0x5f, 0x82, 0xc7, 0x87, 0xcf, 0x12,
|
||||
0x5a, 0x1a, 0x52, 0x8f, 0xca, 0x8a, 0xc2, 0x1f,
|
||||
0xd9, 0x99, 0xd1, 0x00, 0x49, 0x09, 0x41, 0x90,
|
||||
0xd8, 0x98, 0xd0, 0x01, 0x48, 0x08, 0x40, 0x91,
|
||||
0x3d, 0x7d, 0x35, 0x24, 0x6d, 0x2d, 0x65, 0x74,
|
||||
0x3c, 0x7c, 0x34, 0x25, 0x6c, 0x2c, 0x64, 0x75,
|
||||
0xdd, 0x9d, 0xd5, 0x04, 0x4d, 0x0d, 0x45, 0x94,
|
||||
0xdc, 0x9c, 0xd4, 0x05, 0x4c, 0x0c, 0x44, 0x95,
|
||||
0x59, 0x19, 0x51, 0x80, 0xc9, 0x89, 0xc1, 0x10,
|
||||
0x58, 0x18, 0x50, 0x81, 0xc8, 0x88, 0xc0, 0x11,
|
||||
0xd7, 0x97, 0xdf, 0x02, 0x47, 0x07, 0x4f, 0x92,
|
||||
0xda, 0x9a, 0xd2, 0x0f, 0x4a, 0x0a, 0x42, 0x9f,
|
||||
0x53, 0x13, 0x5b, 0x86, 0xc3, 0x83, 0xcb, 0x16,
|
||||
0x5e, 0x1e, 0x56, 0x8b, 0xce, 0x8e, 0xc6, 0x1b,
|
||||
0xb3, 0xf3, 0xbb, 0xa6, 0xe3, 0xa3, 0xeb, 0xf6,
|
||||
0xbe, 0xfe, 0xb6, 0xab, 0xee, 0xae, 0xe6, 0xfb,
|
||||
0x37, 0x77, 0x3f, 0x22, 0x67, 0x27, 0x6f, 0x72,
|
||||
0x3a, 0x7a, 0x32, 0x2f, 0x6a, 0x2a, 0x62, 0x7f,
|
||||
0xb9, 0xf9, 0xb1, 0xa0, 0xe9, 0xa9, 0xe1, 0xf0,
|
||||
0xb8, 0xf8, 0xb0, 0xa1, 0xe8, 0xa8, 0xe0, 0xf1,
|
||||
0x5d, 0x1d, 0x55, 0x84, 0xcd, 0x8d, 0xc5, 0x14,
|
||||
0x5c, 0x1c, 0x54, 0x85, 0xcc, 0x8c, 0xc4, 0x15,
|
||||
0xbd, 0xfd, 0xb5, 0xa4, 0xed, 0xad, 0xe5, 0xf4,
|
||||
0xbc, 0xfc, 0xb4, 0xa5, 0xec, 0xac, 0xe4, 0xf5,
|
||||
0x39, 0x79, 0x31, 0x20, 0x69, 0x29, 0x61, 0x70,
|
||||
0x38, 0x78, 0x30, 0x21, 0x68, 0x28, 0x60, 0x71,
|
||||
0xb7, 0xf7, 0xbf, 0xa2, 0xe7, 0xa7, 0xef, 0xf2,
|
||||
0xba, 0xfa, 0xb2, 0xaf, 0xea, 0xaa, 0xe2, 0xff
|
||||
};
|
||||
|
||||
static const uint8_t p_css_tab2[ 256 ] =
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x09, 0x08, 0x0b, 0x0a, 0x0d, 0x0c, 0x0f, 0x0e,
|
||||
0x12, 0x13, 0x10, 0x11, 0x16, 0x17, 0x14, 0x15,
|
||||
0x1b, 0x1a, 0x19, 0x18, 0x1f, 0x1e, 0x1d, 0x1c,
|
||||
0x24, 0x25, 0x26, 0x27, 0x20, 0x21, 0x22, 0x23,
|
||||
0x2d, 0x2c, 0x2f, 0x2e, 0x29, 0x28, 0x2b, 0x2a,
|
||||
0x36, 0x37, 0x34, 0x35, 0x32, 0x33, 0x30, 0x31,
|
||||
0x3f, 0x3e, 0x3d, 0x3c, 0x3b, 0x3a, 0x39, 0x38,
|
||||
0x49, 0x48, 0x4b, 0x4a, 0x4d, 0x4c, 0x4f, 0x4e,
|
||||
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
|
||||
0x5b, 0x5a, 0x59, 0x58, 0x5f, 0x5e, 0x5d, 0x5c,
|
||||
0x52, 0x53, 0x50, 0x51, 0x56, 0x57, 0x54, 0x55,
|
||||
0x6d, 0x6c, 0x6f, 0x6e, 0x69, 0x68, 0x6b, 0x6a,
|
||||
0x64, 0x65, 0x66, 0x67, 0x60, 0x61, 0x62, 0x63,
|
||||
0x7f, 0x7e, 0x7d, 0x7c, 0x7b, 0x7a, 0x79, 0x78,
|
||||
0x76, 0x77, 0x74, 0x75, 0x72, 0x73, 0x70, 0x71,
|
||||
0x92, 0x93, 0x90, 0x91, 0x96, 0x97, 0x94, 0x95,
|
||||
0x9b, 0x9a, 0x99, 0x98, 0x9f, 0x9e, 0x9d, 0x9c,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
||||
0x89, 0x88, 0x8b, 0x8a, 0x8d, 0x8c, 0x8f, 0x8e,
|
||||
0xb6, 0xb7, 0xb4, 0xb5, 0xb2, 0xb3, 0xb0, 0xb1,
|
||||
0xbf, 0xbe, 0xbd, 0xbc, 0xbb, 0xba, 0xb9, 0xb8,
|
||||
0xa4, 0xa5, 0xa6, 0xa7, 0xa0, 0xa1, 0xa2, 0xa3,
|
||||
0xad, 0xac, 0xaf, 0xae, 0xa9, 0xa8, 0xab, 0xaa,
|
||||
0xdb, 0xda, 0xd9, 0xd8, 0xdf, 0xde, 0xdd, 0xdc,
|
||||
0xd2, 0xd3, 0xd0, 0xd1, 0xd6, 0xd7, 0xd4, 0xd5,
|
||||
0xc9, 0xc8, 0xcb, 0xca, 0xcd, 0xcc, 0xcf, 0xce,
|
||||
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
||||
0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8,
|
||||
0xf6, 0xf7, 0xf4, 0xf5, 0xf2, 0xf3, 0xf0, 0xf1,
|
||||
0xed, 0xec, 0xef, 0xee, 0xe9, 0xe8, 0xeb, 0xea,
|
||||
0xe4, 0xe5, 0xe6, 0xe7, 0xe0, 0xe1, 0xe2, 0xe3
|
||||
};
|
||||
|
||||
static const uint8_t p_css_tab3[ 512 ] =
|
||||
{
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff,
|
||||
0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff
|
||||
};
|
||||
|
||||
static const uint8_t p_css_tab4[ 256 ] =
|
||||
{
|
||||
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
|
||||
0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
|
||||
0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
|
||||
0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
|
||||
0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
|
||||
0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
|
||||
0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
|
||||
0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
|
||||
0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
|
||||
0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
|
||||
0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
|
||||
0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
|
||||
0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
|
||||
0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
|
||||
0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
|
||||
0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
|
||||
0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
|
||||
0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
|
||||
0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
|
||||
0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
|
||||
0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
|
||||
0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
|
||||
0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
|
||||
0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
|
||||
0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
|
||||
0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
|
||||
0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
|
||||
0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
|
||||
0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
|
||||
0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
|
||||
0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
|
||||
0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
|
||||
};
|
||||
|
||||
static const uint8_t p_css_tab5[ 256 ] =
|
||||
{
|
||||
0xff, 0x7f, 0xbf, 0x3f, 0xdf, 0x5f, 0x9f, 0x1f,
|
||||
0xef, 0x6f, 0xaf, 0x2f, 0xcf, 0x4f, 0x8f, 0x0f,
|
||||
0xf7, 0x77, 0xb7, 0x37, 0xd7, 0x57, 0x97, 0x17,
|
||||
0xe7, 0x67, 0xa7, 0x27, 0xc7, 0x47, 0x87, 0x07,
|
||||
0xfb, 0x7b, 0xbb, 0x3b, 0xdb, 0x5b, 0x9b, 0x1b,
|
||||
0xeb, 0x6b, 0xab, 0x2b, 0xcb, 0x4b, 0x8b, 0x0b,
|
||||
0xf3, 0x73, 0xb3, 0x33, 0xd3, 0x53, 0x93, 0x13,
|
||||
0xe3, 0x63, 0xa3, 0x23, 0xc3, 0x43, 0x83, 0x03,
|
||||
0xfd, 0x7d, 0xbd, 0x3d, 0xdd, 0x5d, 0x9d, 0x1d,
|
||||
0xed, 0x6d, 0xad, 0x2d, 0xcd, 0x4d, 0x8d, 0x0d,
|
||||
0xf5, 0x75, 0xb5, 0x35, 0xd5, 0x55, 0x95, 0x15,
|
||||
0xe5, 0x65, 0xa5, 0x25, 0xc5, 0x45, 0x85, 0x05,
|
||||
0xf9, 0x79, 0xb9, 0x39, 0xd9, 0x59, 0x99, 0x19,
|
||||
0xe9, 0x69, 0xa9, 0x29, 0xc9, 0x49, 0x89, 0x09,
|
||||
0xf1, 0x71, 0xb1, 0x31, 0xd1, 0x51, 0x91, 0x11,
|
||||
0xe1, 0x61, 0xa1, 0x21, 0xc1, 0x41, 0x81, 0x01,
|
||||
0xfe, 0x7e, 0xbe, 0x3e, 0xde, 0x5e, 0x9e, 0x1e,
|
||||
0xee, 0x6e, 0xae, 0x2e, 0xce, 0x4e, 0x8e, 0x0e,
|
||||
0xf6, 0x76, 0xb6, 0x36, 0xd6, 0x56, 0x96, 0x16,
|
||||
0xe6, 0x66, 0xa6, 0x26, 0xc6, 0x46, 0x86, 0x06,
|
||||
0xfa, 0x7a, 0xba, 0x3a, 0xda, 0x5a, 0x9a, 0x1a,
|
||||
0xea, 0x6a, 0xaa, 0x2a, 0xca, 0x4a, 0x8a, 0x0a,
|
||||
0xf2, 0x72, 0xb2, 0x32, 0xd2, 0x52, 0x92, 0x12,
|
||||
0xe2, 0x62, 0xa2, 0x22, 0xc2, 0x42, 0x82, 0x02,
|
||||
0xfc, 0x7c, 0xbc, 0x3c, 0xdc, 0x5c, 0x9c, 0x1c,
|
||||
0xec, 0x6c, 0xac, 0x2c, 0xcc, 0x4c, 0x8c, 0x0c,
|
||||
0xf4, 0x74, 0xb4, 0x34, 0xd4, 0x54, 0x94, 0x14,
|
||||
0xe4, 0x64, 0xa4, 0x24, 0xc4, 0x44, 0x84, 0x04,
|
||||
0xf8, 0x78, 0xb8, 0x38, 0xd8, 0x58, 0x98, 0x18,
|
||||
0xe8, 0x68, 0xa8, 0x28, 0xc8, 0x48, 0x88, 0x08,
|
||||
0xf0, 0x70, 0xb0, 0x30, 0xd0, 0x50, 0x90, 0x10,
|
||||
0xe0, 0x60, 0xa0, 0x20, 0xc0, 0x40, 0x80, 0x00
|
||||
};
|
||||
|
||||
static const uint8_t p_crypt_tab0[ 256 ] =
|
||||
{
|
||||
0xB7, 0xF4, 0x82, 0x57, 0xDA, 0x4D, 0xDB, 0xE2,
|
||||
0x2F, 0x52, 0x1A, 0xA8, 0x68, 0x5A, 0x8A, 0xFF,
|
||||
0xFB, 0x0E, 0x6D, 0x35, 0xF7, 0x5C, 0x76, 0x12,
|
||||
0xCE, 0x25, 0x79, 0x29, 0x39, 0x62, 0x08, 0x24,
|
||||
0xA5, 0x85, 0x7B, 0x56, 0x01, 0x23, 0x68, 0xCF,
|
||||
0x0A, 0xE2, 0x5A, 0xED, 0x3D, 0x59, 0xB0, 0xA9,
|
||||
0xB0, 0x2C, 0xF2, 0xB8, 0xEF, 0x32, 0xA9, 0x40,
|
||||
0x80, 0x71, 0xAF, 0x1E, 0xDE, 0x8F, 0x58, 0x88,
|
||||
0xB8, 0x3A, 0xD0, 0xFC, 0xC4, 0x1E, 0xB5, 0xA0,
|
||||
0xBB, 0x3B, 0x0F, 0x01, 0x7E, 0x1F, 0x9F, 0xD9,
|
||||
0xAA, 0xB8, 0x3D, 0x9D, 0x74, 0x1E, 0x25, 0xDB,
|
||||
0x37, 0x56, 0x8F, 0x16, 0xBA, 0x49, 0x2B, 0xAC,
|
||||
0xD0, 0xBD, 0x95, 0x20, 0xBE, 0x7A, 0x28, 0xD0,
|
||||
0x51, 0x64, 0x63, 0x1C, 0x7F, 0x66, 0x10, 0xBB,
|
||||
0xC4, 0x56, 0x1A, 0x04, 0x6E, 0x0A, 0xEC, 0x9C,
|
||||
0xD6, 0xE8, 0x9A, 0x7A, 0xCF, 0x8C, 0xDB, 0xB1,
|
||||
0xEF, 0x71, 0xDE, 0x31, 0xFF, 0x54, 0x3E, 0x5E,
|
||||
0x07, 0x69, 0x96, 0xB0, 0xCF, 0xDD, 0x9E, 0x47,
|
||||
0xC7, 0x96, 0x8F, 0xE4, 0x2B, 0x59, 0xC6, 0xEE,
|
||||
0xB9, 0x86, 0x9A, 0x64, 0x84, 0x72, 0xE2, 0x5B,
|
||||
0xA2, 0x96, 0x58, 0x99, 0x50, 0x03, 0xF5, 0x38,
|
||||
0x4D, 0x02, 0x7D, 0xE7, 0x7D, 0x75, 0xA7, 0xB8,
|
||||
0x67, 0x87, 0x84, 0x3F, 0x1D, 0x11, 0xE5, 0xFC,
|
||||
0x1E, 0xD3, 0x83, 0x16, 0xA5, 0x29, 0xF6, 0xC7,
|
||||
0x15, 0x61, 0x29, 0x1A, 0x43, 0x4F, 0x9B, 0xAF,
|
||||
0xC5, 0x87, 0x34, 0x6C, 0x0F, 0x3B, 0xA8, 0x1D,
|
||||
0x45, 0x58, 0x25, 0xDC, 0xA8, 0xA3, 0x3B, 0xD1,
|
||||
0x79, 0x1B, 0x48, 0xF2, 0xE9, 0x93, 0x1F, 0xFC,
|
||||
0xDB, 0x2A, 0x90, 0xA9, 0x8A, 0x3D, 0x39, 0x18,
|
||||
0xA3, 0x8E, 0x58, 0x6C, 0xE0, 0x12, 0xBB, 0x25,
|
||||
0xCD, 0x71, 0x22, 0xA2, 0x64, 0xC6, 0xE7, 0xFB,
|
||||
0xAD, 0x94, 0x77, 0x04, 0x9A, 0x39, 0xCF, 0x7C
|
||||
};
|
||||
|
||||
static const uint8_t p_crypt_tab1[ 256 ] =
|
||||
{
|
||||
0x8C, 0x47, 0xB0, 0xE1, 0xEB, 0xFC, 0xEB, 0x56,
|
||||
0x10, 0xE5, 0x2C, 0x1A, 0x5D, 0xEF, 0xBE, 0x4F,
|
||||
0x08, 0x75, 0x97, 0x4B, 0x0E, 0x25, 0x8E, 0x6E,
|
||||
0x39, 0x5A, 0x87, 0x53, 0xC4, 0x1F, 0xF4, 0x5C,
|
||||
0x4E, 0xE6, 0x99, 0x30, 0xE0, 0x42, 0x88, 0xAB,
|
||||
0xE5, 0x85, 0xBC, 0x8F, 0xD8, 0x3C, 0x54, 0xC9,
|
||||
0x53, 0x47, 0x18, 0xD6, 0x06, 0x5B, 0x41, 0x2C,
|
||||
0x67, 0x1E, 0x41, 0x74, 0x33, 0xE2, 0xB4, 0xE0,
|
||||
0x23, 0x29, 0x42, 0xEA, 0x55, 0x0F, 0x25, 0xB4,
|
||||
0x24, 0x2C, 0x99, 0x13, 0xEB, 0x0A, 0x0B, 0xC9,
|
||||
0xF9, 0x63, 0x67, 0x43, 0x2D, 0xC7, 0x7D, 0x07,
|
||||
0x60, 0x89, 0xD1, 0xCC, 0xE7, 0x94, 0x77, 0x74,
|
||||
0x9B, 0x7E, 0xD7, 0xE6, 0xFF, 0xBB, 0x68, 0x14,
|
||||
0x1E, 0xA3, 0x25, 0xDE, 0x3A, 0xA3, 0x54, 0x7B,
|
||||
0x87, 0x9D, 0x50, 0xCA, 0x27, 0xC3, 0xA4, 0x50,
|
||||
0x91, 0x27, 0xD4, 0xB0, 0x82, 0x41, 0x97, 0x79,
|
||||
0x94, 0x82, 0xAC, 0xC7, 0x8E, 0xA5, 0x4E, 0xAA,
|
||||
0x78, 0x9E, 0xE0, 0x42, 0xBA, 0x28, 0xEA, 0xB7,
|
||||
0x74, 0xAD, 0x35, 0xDA, 0x92, 0x60, 0x7E, 0xD2,
|
||||
0x0E, 0xB9, 0x24, 0x5E, 0x39, 0x4F, 0x5E, 0x63,
|
||||
0x09, 0xB5, 0xFA, 0xBF, 0xF1, 0x22, 0x55, 0x1C,
|
||||
0xE2, 0x25, 0xDB, 0xC5, 0xD8, 0x50, 0x03, 0x98,
|
||||
0xC4, 0xAC, 0x2E, 0x11, 0xB4, 0x38, 0x4D, 0xD0,
|
||||
0xB9, 0xFC, 0x2D, 0x3C, 0x08, 0x04, 0x5A, 0xEF,
|
||||
0xCE, 0x32, 0xFB, 0x4C, 0x92, 0x1E, 0x4B, 0xFB,
|
||||
0x1A, 0xD0, 0xE2, 0x3E, 0xDA, 0x6E, 0x7C, 0x4D,
|
||||
0x56, 0xC3, 0x3F, 0x42, 0xB1, 0x3A, 0x23, 0x4D,
|
||||
0x6E, 0x84, 0x56, 0x68, 0xF4, 0x0E, 0x03, 0x64,
|
||||
0xD0, 0xA9, 0x92, 0x2F, 0x8B, 0xBC, 0x39, 0x9C,
|
||||
0xAC, 0x09, 0x5E, 0xEE, 0xE5, 0x97, 0xBF, 0xA5,
|
||||
0xCE, 0xFA, 0x28, 0x2C, 0x6D, 0x4F, 0xEF, 0x77,
|
||||
0xAA, 0x1B, 0x79, 0x8E, 0x97, 0xB4, 0xC3, 0xF4
|
||||
};
|
||||
|
||||
static const uint8_t p_crypt_tab2[ 256 ] =
|
||||
{
|
||||
0xB7, 0x75, 0x81, 0xD5, 0xDC, 0xCA, 0xDE, 0x66,
|
||||
0x23, 0xDF, 0x15, 0x26, 0x62, 0xD1, 0x83, 0x77,
|
||||
0xE3, 0x97, 0x76, 0xAF, 0xE9, 0xC3, 0x6B, 0x8E,
|
||||
0xDA, 0xB0, 0x6E, 0xBF, 0x2B, 0xF1, 0x19, 0xB4,
|
||||
0x95, 0x34, 0x48, 0xE4, 0x37, 0x94, 0x5D, 0x7B,
|
||||
0x36, 0x5F, 0x65, 0x53, 0x07, 0xE2, 0x89, 0x11,
|
||||
0x98, 0x85, 0xD9, 0x12, 0xC1, 0x9D, 0x84, 0xEC,
|
||||
0xA4, 0xD4, 0x88, 0xB8, 0xFC, 0x2C, 0x79, 0x28,
|
||||
0xD8, 0xDB, 0xB3, 0x1E, 0xA2, 0xF9, 0xD0, 0x44,
|
||||
0xD7, 0xD6, 0x60, 0xEF, 0x14, 0xF4, 0xF6, 0x31,
|
||||
0xD2, 0x41, 0x46, 0x67, 0x0A, 0xE1, 0x58, 0x27,
|
||||
0x43, 0xA3, 0xF8, 0xE0, 0xC8, 0xBA, 0x5A, 0x5C,
|
||||
0x80, 0x6C, 0xC6, 0xF2, 0xE8, 0xAD, 0x7D, 0x04,
|
||||
0x0D, 0xB9, 0x3C, 0xC2, 0x25, 0xBD, 0x49, 0x63,
|
||||
0x8C, 0x9F, 0x51, 0xCE, 0x20, 0xC5, 0xA1, 0x50,
|
||||
0x92, 0x2D, 0xDD, 0xBC, 0x8D, 0x4F, 0x9A, 0x71,
|
||||
0x2F, 0x30, 0x1D, 0x73, 0x39, 0x13, 0xFB, 0x1A,
|
||||
0xCB, 0x24, 0x59, 0xFE, 0x05, 0x96, 0x57, 0x0F,
|
||||
0x1F, 0xCF, 0x54, 0xBE, 0xF5, 0x06, 0x1B, 0xB2,
|
||||
0x6D, 0xD3, 0x4D, 0x32, 0x56, 0x21, 0x33, 0x0B,
|
||||
0x52, 0xE7, 0xAB, 0xEB, 0xA6, 0x74, 0x00, 0x4C,
|
||||
0xB1, 0x7F, 0x82, 0x99, 0x87, 0x0E, 0x5E, 0xC0,
|
||||
0x8F, 0xEE, 0x6F, 0x55, 0xF3, 0x7E, 0x08, 0x90,
|
||||
0xFA, 0xB6, 0x64, 0x70, 0x47, 0x4A, 0x17, 0xA7,
|
||||
0xB5, 0x40, 0x8A, 0x38, 0xE5, 0x68, 0x3E, 0x8B,
|
||||
0x69, 0xAA, 0x9B, 0x42, 0xA5, 0x10, 0x01, 0x35,
|
||||
0xFD, 0x61, 0x9E, 0xE6, 0x16, 0x9C, 0x86, 0xED,
|
||||
0xCD, 0x2E, 0xFF, 0xC4, 0x5B, 0xA0, 0xAE, 0xCC,
|
||||
0x4B, 0x3B, 0x03, 0xBB, 0x1C, 0x2A, 0xAC, 0x0C,
|
||||
0x3F, 0x93, 0xC7, 0x72, 0x7A, 0x09, 0x22, 0x3D,
|
||||
0x45, 0x78, 0xA9, 0xA8, 0xEA, 0xC9, 0x6A, 0xF7,
|
||||
0x29, 0x91, 0xF0, 0x02, 0x18, 0x3A, 0x4E, 0x7C
|
||||
};
|
||||
|
||||
static const uint8_t p_crypt_tab3[ 288 ] =
|
||||
{
|
||||
0x73, 0x51, 0x95, 0xE1, 0x12, 0xE4, 0xC0, 0x58,
|
||||
0xEE, 0xF2, 0x08, 0x1B, 0xA9, 0xFA, 0x98, 0x4C,
|
||||
0xA7, 0x33, 0xE2, 0x1B, 0xA7, 0x6D, 0xF5, 0x30,
|
||||
0x97, 0x1D, 0xF3, 0x02, 0x60, 0x5A, 0x82, 0x0F,
|
||||
0x91, 0xD0, 0x9C, 0x10, 0x39, 0x7A, 0x83, 0x85,
|
||||
0x3B, 0xB2, 0xB8, 0xAE, 0x0C, 0x09, 0x52, 0xEA,
|
||||
0x1C, 0xE1, 0x8D, 0x66, 0x4F, 0xF3, 0xDA, 0x92,
|
||||
0x29, 0xB9, 0xD5, 0xC5, 0x77, 0x47, 0x22, 0x53,
|
||||
0x14, 0xF7, 0xAF, 0x22, 0x64, 0xDF, 0xC6, 0x72,
|
||||
0x12, 0xF3, 0x75, 0xDA, 0xD7, 0xD7, 0xE5, 0x02,
|
||||
0x9E, 0xED, 0xDA, 0xDB, 0x4C, 0x47, 0xCE, 0x91,
|
||||
0x06, 0x06, 0x6D, 0x55, 0x8B, 0x19, 0xC9, 0xEF,
|
||||
0x8C, 0x80, 0x1A, 0x0E, 0xEE, 0x4B, 0xAB, 0xF2,
|
||||
0x08, 0x5C, 0xE9, 0x37, 0x26, 0x5E, 0x9A, 0x90,
|
||||
0x00, 0xF3, 0x0D, 0xB2, 0xA6, 0xA3, 0xF7, 0x26,
|
||||
0x17, 0x48, 0x88, 0xC9, 0x0E, 0x2C, 0xC9, 0x02,
|
||||
0xE7, 0x18, 0x05, 0x4B, 0xF3, 0x39, 0xE1, 0x20,
|
||||
0x02, 0x0D, 0x40, 0xC7, 0xCA, 0xB9, 0x48, 0x30,
|
||||
0x57, 0x67, 0xCC, 0x06, 0xBF, 0xAC, 0x81, 0x08,
|
||||
0x24, 0x7A, 0xD4, 0x8B, 0x19, 0x8E, 0xAC, 0xB4,
|
||||
0x5A, 0x0F, 0x73, 0x13, 0xAC, 0x9E, 0xDA, 0xB6,
|
||||
0xB8, 0x96, 0x5B, 0x60, 0x88, 0xE1, 0x81, 0x3F,
|
||||
0x07, 0x86, 0x37, 0x2D, 0x79, 0x14, 0x52, 0xEA,
|
||||
0x73, 0xDF, 0x3D, 0x09, 0xC8, 0x25, 0x48, 0xD8,
|
||||
0x75, 0x60, 0x9A, 0x08, 0x27, 0x4A, 0x2C, 0xB9,
|
||||
0xA8, 0x8B, 0x8A, 0x73, 0x62, 0x37, 0x16, 0x02,
|
||||
0xBD, 0xC1, 0x0E, 0x56, 0x54, 0x3E, 0x14, 0x5F,
|
||||
0x8C, 0x8F, 0x6E, 0x75, 0x1C, 0x07, 0x39, 0x7B,
|
||||
0x4B, 0xDB, 0xD3, 0x4B, 0x1E, 0xC8, 0x7E, 0xFE,
|
||||
0x3E, 0x72, 0x16, 0x83, 0x7D, 0xEE, 0xF5, 0xCA,
|
||||
0xC5, 0x18, 0xF9, 0xD8, 0x68, 0xAB, 0x38, 0x85,
|
||||
0xA8, 0xF0, 0xA1, 0x73, 0x9F, 0x5D, 0x19, 0x0B,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x33, 0x72, 0x39, 0x25, 0x67, 0x26, 0x6D, 0x71,
|
||||
0x36, 0x77, 0x3C, 0x20, 0x62, 0x23, 0x68, 0x74,
|
||||
0xC3, 0x82, 0xC9, 0x15, 0x57, 0x16, 0x5D, 0x81
|
||||
};
|
||||
|
||||
#endif /* DVDCSS_CSSTABLES_H */
|
889
src/device.c
Normal file
889
src/device.c
Normal file
|
@ -0,0 +1,889 @@
|
|||
/*****************************************************************************
|
||||
* device.h: DVD device access
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1998-2006 VideoLAN
|
||||
*
|
||||
* Authors: Stéphane Borel <stef@via.ecp.fr>
|
||||
* Sam Hocevar <sam@zoy.org>
|
||||
* Håkan Hjort <d95hjort@dtek.chalmers.se>
|
||||
*
|
||||
* libdvdcss 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.
|
||||
*
|
||||
* libdvdcss 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 libdvdcss; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* Preamble
|
||||
*****************************************************************************/
|
||||
#include "config.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_ERRNO_H
|
||||
# include <errno.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef DARWIN_DVD_IOCTL
|
||||
# include <paths.h>
|
||||
# include <CoreFoundation/CoreFoundation.h>
|
||||
# include <IOKit/IOKitLib.h>
|
||||
# include <IOKit/IOBSD.h>
|
||||
# include <IOKit/storage/IOMedia.h>
|
||||
# include <IOKit/storage/IOCDMedia.h>
|
||||
# include <IOKit/storage/IODVDMedia.h>
|
||||
#endif
|
||||
|
||||
#ifdef __OS2__
|
||||
# define INCL_DOS
|
||||
# define INCL_DOSDEVIOCTL
|
||||
# include <os2.h>
|
||||
# include <io.h> /* setmode() */
|
||||
# include <fcntl.h> /* O_BINARY */
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "dvdcss/dvdcss.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "css.h"
|
||||
#include "libdvdcss.h"
|
||||
#include "ioctl.h"
|
||||
#include "device.h"
|
||||
|
||||
/*****************************************************************************
|
||||
* Device reading prototypes
|
||||
*****************************************************************************/
|
||||
static int libc_open ( dvdcss_t, const char * );
|
||||
static int libc_seek ( dvdcss_t, int );
|
||||
static int libc_read ( dvdcss_t, void *, int );
|
||||
static int libc_readv ( dvdcss_t, const struct iovec *, int );
|
||||
|
||||
static int stream_seek ( dvdcss_t, int );
|
||||
static int stream_read ( dvdcss_t, void *, int );
|
||||
static int stream_readv ( dvdcss_t, const struct iovec *, int );
|
||||
|
||||
#ifdef _WIN32
|
||||
static int win2k_open ( dvdcss_t, const char * );
|
||||
static int win2k_seek ( dvdcss_t, int );
|
||||
static int win2k_read ( dvdcss_t, void *, int );
|
||||
static int win2k_readv ( dvdcss_t, const struct iovec *, int );
|
||||
|
||||
#elif defined( __OS2__ )
|
||||
static int os2_open ( dvdcss_t, const char * );
|
||||
#endif
|
||||
|
||||
int dvdcss_use_ioctls( dvdcss_t dvdcss )
|
||||
{
|
||||
if( dvdcss->p_stream )
|
||||
return 0;
|
||||
|
||||
#if defined( _WIN32 )
|
||||
if( dvdcss->b_file )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* FIXME: implement this for Windows */
|
||||
return 1;
|
||||
#elif defined( __OS2__ )
|
||||
ULONG ulMode;
|
||||
|
||||
if( DosQueryFHState( dvdcss->i_fd, &ulMode ) != 0 )
|
||||
return 1; /* What to do? Be conservative and try to use the ioctls */
|
||||
|
||||
if( ulMode & OPEN_FLAGS_DASD )
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
#else
|
||||
struct stat fileinfo;
|
||||
int ret;
|
||||
|
||||
ret = fstat( dvdcss->i_fd, &fileinfo );
|
||||
if( ret < 0 )
|
||||
{
|
||||
return 1; /* What to do? Be conservative and try to use the ioctls */
|
||||
}
|
||||
|
||||
/* Complete this list and check that we test for the right things
|
||||
* (I've assumed for all OSs that 'r', (raw) device, are char devices
|
||||
* and those that don't contain/use an 'r' in the name are block devices)
|
||||
*
|
||||
* Linux needs a block device
|
||||
* Solaris needs a char device
|
||||
* Darwin needs a char device
|
||||
* OpenBSD needs a char device
|
||||
* NetBSD needs a char device
|
||||
* FreeBSD can use either the block or the char device
|
||||
*/
|
||||
|
||||
/* Check if this is a block/char device */
|
||||
if( S_ISBLK( fileinfo.st_mode ) ||
|
||||
S_ISCHR( fileinfo.st_mode ) )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void dvdcss_check_device ( dvdcss_t dvdcss )
|
||||
{
|
||||
#if defined( _WIN32 )
|
||||
DWORD drives;
|
||||
int i;
|
||||
#elif defined( DARWIN_DVD_IOCTL )
|
||||
io_object_t next_media;
|
||||
mach_port_t master_port;
|
||||
kern_return_t kern_result;
|
||||
io_iterator_t media_iterator;
|
||||
CFMutableDictionaryRef classes_to_match;
|
||||
#elif defined( __OS2__ )
|
||||
#pragma pack( 1 )
|
||||
struct
|
||||
{
|
||||
BYTE bCmdInfo;
|
||||
BYTE bDrive;
|
||||
} param;
|
||||
|
||||
struct
|
||||
{
|
||||
BYTE abEBPB[31];
|
||||
USHORT usCylinders;
|
||||
BYTE bDevType;
|
||||
USHORT usDevAttr;
|
||||
} data;
|
||||
#pragma pack()
|
||||
|
||||
ULONG ulParamLen;
|
||||
ULONG ulDataLen;
|
||||
ULONG rc;
|
||||
|
||||
int i;
|
||||
#else
|
||||
const char *ppsz_devices[] = { "/dev/dvd", "/dev/cdrom", "/dev/hdc", NULL };
|
||||
int i, i_fd;
|
||||
#endif
|
||||
|
||||
/* If the device name is non-NULL or stream is set, return. */
|
||||
if( (dvdcss->psz_device && dvdcss->psz_device[0]) || dvdcss->p_stream )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined( _WIN32 )
|
||||
drives = GetLogicalDrives();
|
||||
|
||||
for( i = 0; drives; i++ )
|
||||
{
|
||||
char psz_device[5];
|
||||
DWORD cur = 1 << i;
|
||||
UINT i_ret;
|
||||
|
||||
if( (drives & cur) == 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
drives &= ~cur;
|
||||
|
||||
sprintf( psz_device, "%c:\\", 'A' + i );
|
||||
i_ret = GetDriveType( psz_device );
|
||||
if( i_ret != DRIVE_CDROM )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Remove trailing backslash */
|
||||
psz_device[2] = '\0';
|
||||
|
||||
/* FIXME: we want to differentiate between CD and DVD drives
|
||||
* using DeviceIoControl() */
|
||||
print_debug( dvdcss, "defaulting to drive `%s'", psz_device );
|
||||
free( dvdcss->psz_device );
|
||||
dvdcss->psz_device = strdup( psz_device );
|
||||
return;
|
||||
}
|
||||
#elif defined( DARWIN_DVD_IOCTL )
|
||||
|
||||
kern_result = IOMasterPort( MACH_PORT_NULL, &master_port );
|
||||
if( kern_result != KERN_SUCCESS )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
classes_to_match = IOServiceMatching( kIODVDMediaClass );
|
||||
if( classes_to_match == NULL )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CFDictionarySetValue( classes_to_match, CFSTR( kIOMediaEjectableKey ),
|
||||
kCFBooleanTrue );
|
||||
|
||||
kern_result = IOServiceGetMatchingServices( master_port, classes_to_match,
|
||||
&media_iterator );
|
||||
if( kern_result != KERN_SUCCESS )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
next_media = IOIteratorNext( media_iterator );
|
||||
for( ; ; )
|
||||
{
|
||||
char psz_buf[0x32];
|
||||
size_t i_pathlen;
|
||||
CFTypeRef psz_path;
|
||||
|
||||
next_media = IOIteratorNext( media_iterator );
|
||||
if( next_media == 0 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
psz_path = IORegistryEntryCreateCFProperty( next_media,
|
||||
CFSTR( kIOBSDNameKey ),
|
||||
kCFAllocatorDefault,
|
||||
0 );
|
||||
if( psz_path == NULL )
|
||||
{
|
||||
IOObjectRelease( next_media );
|
||||
continue;
|
||||
}
|
||||
|
||||
snprintf( psz_buf, sizeof(psz_buf), "%s%c", _PATH_DEV, 'r' );
|
||||
i_pathlen = strlen( psz_buf );
|
||||
|
||||
if( CFStringGetCString( psz_path,
|
||||
(char*)&psz_buf + i_pathlen,
|
||||
sizeof(psz_buf) - i_pathlen,
|
||||
kCFStringEncodingASCII ) )
|
||||
{
|
||||
print_debug( dvdcss, "defaulting to drive `%s'", psz_buf );
|
||||
CFRelease( psz_path );
|
||||
IOObjectRelease( next_media );
|
||||
IOObjectRelease( media_iterator );
|
||||
free( dvdcss->psz_device );
|
||||
dvdcss->psz_device = strdup( psz_buf );
|
||||
return;
|
||||
}
|
||||
|
||||
CFRelease( psz_path );
|
||||
|
||||
IOObjectRelease( next_media );
|
||||
}
|
||||
|
||||
IOObjectRelease( media_iterator );
|
||||
#elif defined( __OS2__ )
|
||||
for( i = 0; i < 26; i++ )
|
||||
{
|
||||
param.bCmdInfo = 0;
|
||||
param.bDrive = i;
|
||||
|
||||
rc = DosDevIOCtl( ( HFILE )-1, IOCTL_DISK, DSK_GETDEVICEPARAMS,
|
||||
¶m, sizeof( param ), &ulParamLen,
|
||||
&data, sizeof( data ), &ulDataLen );
|
||||
|
||||
if( rc == 0 )
|
||||
{
|
||||
/* Check for removable and for cylinders */
|
||||
if( ( data.usDevAttr & 1 ) == 0 && data.usCylinders == 0xFFFF )
|
||||
{
|
||||
char psz_dvd[] = "A:";
|
||||
|
||||
psz_dvd[0] += i;
|
||||
|
||||
print_debug( dvdcss, "defaulting to drive `%s'", psz_dvd );
|
||||
free( dvdcss->psz_device );
|
||||
dvdcss->psz_device = strdup( psz_dvd );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
for( i = 0; ppsz_devices[i]; i++ )
|
||||
{
|
||||
i_fd = open( ppsz_devices[i], 0 );
|
||||
if( i_fd != -1 )
|
||||
{
|
||||
print_debug( dvdcss, "defaulting to drive `%s'", ppsz_devices[i] );
|
||||
close( i_fd );
|
||||
free( dvdcss->psz_device );
|
||||
dvdcss->psz_device = strdup( ppsz_devices[i] );
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
print_error( dvdcss, "could not find a suitable default drive" );
|
||||
}
|
||||
|
||||
int dvdcss_open_device ( dvdcss_t dvdcss )
|
||||
{
|
||||
const char *psz_device = getenv( "DVDCSS_RAW_DEVICE" );
|
||||
if( !psz_device )
|
||||
{
|
||||
psz_device = dvdcss->psz_device;
|
||||
}
|
||||
print_debug( dvdcss, "opening target `%s'", psz_device );
|
||||
|
||||
#if defined( _WIN32 )
|
||||
/* Initialize readv temporary buffer */
|
||||
dvdcss->p_readv_buffer = NULL;
|
||||
dvdcss->i_readv_buf_size = 0;
|
||||
#endif
|
||||
|
||||
/* if callback functions are initialized */
|
||||
if( dvdcss->p_stream )
|
||||
{
|
||||
print_debug( dvdcss, "using stream API for access" );
|
||||
dvdcss->pf_seek = stream_seek;
|
||||
dvdcss->pf_read = stream_read;
|
||||
dvdcss->pf_readv = stream_readv;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined( _WIN32 )
|
||||
dvdcss->b_file = 1;
|
||||
/* If device is "X:" or "X:\", we are not actually opening a file. */
|
||||
if (psz_device[0] && psz_device[1] == ':' &&
|
||||
(!psz_device[2] || (psz_device[2] == '\\' && !psz_device[3])))
|
||||
dvdcss->b_file = 0;
|
||||
|
||||
if( !dvdcss->b_file )
|
||||
{
|
||||
print_debug( dvdcss, "using Win2K API for access" );
|
||||
dvdcss->pf_seek = win2k_seek;
|
||||
dvdcss->pf_read = win2k_read;
|
||||
dvdcss->pf_readv = win2k_readv;
|
||||
return win2k_open( dvdcss, psz_device );
|
||||
}
|
||||
else
|
||||
#elif defined( __OS2__ )
|
||||
/* If device is "X:" or "X:\", we are not actually opening a file. */
|
||||
if( psz_device[0] && psz_device[1] == ':' &&
|
||||
( !psz_device[2] || ( psz_device[2] == '\\' && !psz_device[3] ) ) )
|
||||
{
|
||||
print_debug( dvdcss, "using OS/2 API for access" );
|
||||
dvdcss->pf_seek = libc_seek;
|
||||
dvdcss->pf_read = libc_read;
|
||||
dvdcss->pf_readv = libc_readv;
|
||||
return os2_open( dvdcss, psz_device );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
print_debug( dvdcss, "using libc API for access" );
|
||||
dvdcss->pf_seek = libc_seek;
|
||||
dvdcss->pf_read = libc_read;
|
||||
dvdcss->pf_readv = libc_readv;
|
||||
return libc_open( dvdcss, psz_device );
|
||||
}
|
||||
}
|
||||
|
||||
int dvdcss_close_device ( dvdcss_t dvdcss )
|
||||
{
|
||||
if( dvdcss->p_stream )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined( _WIN32 )
|
||||
/* Free readv temporary buffer */
|
||||
free( dvdcss->p_readv_buffer );
|
||||
dvdcss->p_readv_buffer = NULL;
|
||||
dvdcss->i_readv_buf_size = 0;
|
||||
|
||||
if( !dvdcss->b_file )
|
||||
{
|
||||
CloseHandle( (HANDLE) dvdcss->i_fd );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
int i_ret = close( dvdcss->i_fd );
|
||||
if( i_ret < 0 )
|
||||
{
|
||||
print_error( dvdcss, "Failed to close fd, data loss possible." );
|
||||
return i_ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Following functions are local */
|
||||
|
||||
/*****************************************************************************
|
||||
* Open commands.
|
||||
*****************************************************************************/
|
||||
static int libc_open ( dvdcss_t dvdcss, const char *psz_device )
|
||||
{
|
||||
#ifdef _WIN32
|
||||
int wlen;
|
||||
dvdcss->i_fd = -1;
|
||||
wlen = MultiByteToWideChar( CP_UTF8, 0, psz_device, -1, NULL, 0 );
|
||||
if( wlen > 0 ) {
|
||||
wchar_t *wpath = (wchar_t*)malloc( sizeof(wchar_t) * wlen );
|
||||
if( wpath ) {
|
||||
if( MultiByteToWideChar(CP_UTF8, 0, psz_device, -1, wpath, wlen ) ) {
|
||||
dvdcss->i_fd = _wopen( wpath, O_BINARY );
|
||||
}
|
||||
free( wpath );
|
||||
}
|
||||
}
|
||||
#else
|
||||
dvdcss->i_fd = open( psz_device, O_BINARY );
|
||||
#endif
|
||||
|
||||
if( dvdcss->i_fd == -1 )
|
||||
{
|
||||
print_error( dvdcss, "failed to open device %s (%s)",
|
||||
psz_device, strerror(errno) );
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined( _WIN32 )
|
||||
static int win2k_open ( dvdcss_t dvdcss, const char *psz_device )
|
||||
{
|
||||
char psz_dvd[7] = "\\\\.\\\0:";
|
||||
psz_dvd[4] = psz_device[0];
|
||||
|
||||
/* To work around an M$ bug in IOCTL_DVD_READ_STRUCTURE, we need read
|
||||
* _and_ write access to the device (so we can make SCSI Pass Through
|
||||
* Requests). Unfortunately this is only allowed if you have
|
||||
* administrator privileges so we allow for a fallback method with
|
||||
* only read access to the device (in this case ioctl_ReadCopyright()
|
||||
* won't send back the right result).
|
||||
* (See Microsoft Q241374: Read and Write Access Required for SCSI
|
||||
* Pass Through Requests) */
|
||||
dvdcss->i_fd = (int)
|
||||
CreateFile( psz_dvd, GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
NULL, OPEN_EXISTING,
|
||||
FILE_FLAG_RANDOM_ACCESS, NULL );
|
||||
|
||||
if( (HANDLE) dvdcss->i_fd == INVALID_HANDLE_VALUE )
|
||||
dvdcss->i_fd = (int)
|
||||
CreateFile( psz_dvd, GENERIC_READ, FILE_SHARE_READ,
|
||||
NULL, OPEN_EXISTING,
|
||||
FILE_FLAG_RANDOM_ACCESS, NULL );
|
||||
|
||||
if( (HANDLE) dvdcss->i_fd == INVALID_HANDLE_VALUE )
|
||||
{
|
||||
print_error( dvdcss, "failed to open device %s", psz_device );
|
||||
return -1;
|
||||
}
|
||||
|
||||
dvdcss->i_pos = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* defined( _WIN32 ) */
|
||||
|
||||
#ifdef __OS2__
|
||||
static int os2_open ( dvdcss_t dvdcss, const char *psz_device )
|
||||
{
|
||||
char psz_dvd[] = "X:";
|
||||
HFILE hfile;
|
||||
ULONG ulAction;
|
||||
ULONG rc;
|
||||
|
||||
psz_dvd[0] = psz_device[0];
|
||||
|
||||
rc = DosOpenL( ( PSZ )psz_dvd, &hfile, &ulAction, 0, FILE_NORMAL,
|
||||
OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW,
|
||||
OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE | OPEN_FLAGS_DASD,
|
||||
NULL );
|
||||
|
||||
if( rc )
|
||||
{
|
||||
print_error( dvdcss, "failed to open device %s", psz_device );
|
||||
return -1;
|
||||
}
|
||||
|
||||
setmode( hfile, O_BINARY );
|
||||
|
||||
dvdcss->i_fd = hfile;
|
||||
|
||||
dvdcss->i_pos = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* __OS2__ */
|
||||
|
||||
/*****************************************************************************
|
||||
* Seek commands.
|
||||
*****************************************************************************/
|
||||
static int libc_seek( dvdcss_t dvdcss, int i_blocks )
|
||||
{
|
||||
off_t i_seek;
|
||||
|
||||
if( dvdcss->i_pos == i_blocks )
|
||||
{
|
||||
/* We are already in position */
|
||||
return i_blocks;
|
||||
}
|
||||
|
||||
i_seek = (off_t)i_blocks * (off_t)DVDCSS_BLOCK_SIZE;
|
||||
i_seek = lseek( dvdcss->i_fd, i_seek, SEEK_SET );
|
||||
|
||||
if( i_seek < 0 )
|
||||
{
|
||||
print_error( dvdcss, "seek error" );
|
||||
dvdcss->i_pos = -1;
|
||||
return i_seek;
|
||||
}
|
||||
|
||||
dvdcss->i_pos = i_seek / DVDCSS_BLOCK_SIZE;
|
||||
|
||||
return dvdcss->i_pos;
|
||||
}
|
||||
|
||||
static int stream_seek( dvdcss_t dvdcss, int i_blocks )
|
||||
{
|
||||
off_t i_seek = (off_t) i_blocks * (off_t) DVDCSS_BLOCK_SIZE;
|
||||
|
||||
if( !dvdcss->p_stream_cb->pf_seek )
|
||||
return -1;
|
||||
|
||||
if( dvdcss->i_pos == i_blocks )
|
||||
{
|
||||
/* We are already in position */
|
||||
return i_blocks;
|
||||
}
|
||||
|
||||
if( dvdcss->p_stream_cb->pf_seek( dvdcss->p_stream, i_seek ) != 0 )
|
||||
{
|
||||
print_error( dvdcss, "seek error" );
|
||||
dvdcss->i_pos = -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
dvdcss->i_pos = i_blocks;
|
||||
|
||||
return dvdcss->i_pos;
|
||||
}
|
||||
|
||||
#if defined( _WIN32 )
|
||||
static int win2k_seek( dvdcss_t dvdcss, int i_blocks )
|
||||
{
|
||||
LARGE_INTEGER li_seek;
|
||||
|
||||
if( dvdcss->i_pos == i_blocks )
|
||||
{
|
||||
/* We are already in position */
|
||||
return i_blocks;
|
||||
}
|
||||
|
||||
li_seek.QuadPart = (LONGLONG)i_blocks * DVDCSS_BLOCK_SIZE;
|
||||
|
||||
li_seek.LowPart = SetFilePointer( (HANDLE) dvdcss->i_fd,
|
||||
li_seek.LowPart,
|
||||
&li_seek.HighPart, FILE_BEGIN );
|
||||
if( (li_seek.LowPart == INVALID_SET_FILE_POINTER)
|
||||
&& GetLastError() != NO_ERROR)
|
||||
{
|
||||
dvdcss->i_pos = -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
dvdcss->i_pos = li_seek.QuadPart / DVDCSS_BLOCK_SIZE;
|
||||
|
||||
return dvdcss->i_pos;
|
||||
}
|
||||
#endif /* defined( _WIN32 ) */
|
||||
|
||||
/*****************************************************************************
|
||||
* Read commands.
|
||||
*****************************************************************************/
|
||||
static int libc_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
|
||||
{
|
||||
off_t i_size, i_ret, i_ret_blocks;
|
||||
|
||||
i_size = (off_t)i_blocks * (off_t)DVDCSS_BLOCK_SIZE;
|
||||
i_ret = read( dvdcss->i_fd, p_buffer, i_size );
|
||||
|
||||
if( i_ret < 0 )
|
||||
{
|
||||
print_error( dvdcss, "read error" );
|
||||
dvdcss->i_pos = -1;
|
||||
return i_ret;
|
||||
}
|
||||
|
||||
i_ret_blocks = i_ret / DVDCSS_BLOCK_SIZE;
|
||||
|
||||
/* Handle partial reads */
|
||||
if( i_ret != i_size )
|
||||
{
|
||||
int i_seek, i_set_pos;
|
||||
|
||||
i_set_pos = dvdcss->i_pos + i_ret_blocks;
|
||||
dvdcss->i_pos = -1;
|
||||
i_seek = libc_seek( dvdcss, i_set_pos );
|
||||
if( i_seek < 0 )
|
||||
{
|
||||
return i_seek;
|
||||
}
|
||||
|
||||
/* We have to return now so that i_pos isn't clobbered */
|
||||
return i_ret_blocks;
|
||||
}
|
||||
|
||||
dvdcss->i_pos += i_ret_blocks;
|
||||
return i_ret_blocks;
|
||||
}
|
||||
|
||||
static int stream_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
|
||||
{
|
||||
off_t i_size, i_ret, i_ret_blocks;
|
||||
|
||||
i_size = (off_t)i_blocks * (off_t)DVDCSS_BLOCK_SIZE;
|
||||
|
||||
if( !dvdcss->p_stream_cb->pf_read )
|
||||
return -1;
|
||||
|
||||
i_ret = dvdcss->p_stream_cb->pf_read( dvdcss->p_stream, p_buffer, i_size );
|
||||
|
||||
if( i_ret < 0 )
|
||||
{
|
||||
print_error( dvdcss, "read error" );
|
||||
dvdcss->i_pos = -1;
|
||||
return i_ret;
|
||||
}
|
||||
|
||||
i_ret_blocks = i_ret / DVDCSS_BLOCK_SIZE;
|
||||
|
||||
/* Handle partial reads */
|
||||
if( i_ret != i_size )
|
||||
{
|
||||
int i_seek;
|
||||
|
||||
dvdcss->i_pos = -1;
|
||||
i_seek = stream_seek( dvdcss, i_ret_blocks );
|
||||
if( i_seek < 0 )
|
||||
{
|
||||
return i_seek;
|
||||
}
|
||||
|
||||
/* We have to return now so that i_pos isn't clobbered */
|
||||
return i_ret_blocks;
|
||||
}
|
||||
|
||||
dvdcss->i_pos += i_ret_blocks;
|
||||
return i_ret_blocks;
|
||||
}
|
||||
|
||||
#if defined( _WIN32 )
|
||||
static int win2k_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
|
||||
{
|
||||
DWORD i_bytes;
|
||||
|
||||
if( !ReadFile( (HANDLE) dvdcss->i_fd, p_buffer,
|
||||
i_blocks * DVDCSS_BLOCK_SIZE,
|
||||
&i_bytes, NULL ) )
|
||||
{
|
||||
dvdcss->i_pos = -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
i_bytes /= DVDCSS_BLOCK_SIZE;
|
||||
dvdcss->i_pos += i_bytes;
|
||||
return i_bytes;
|
||||
}
|
||||
#endif /* defined( _WIN32 ) */
|
||||
|
||||
/*****************************************************************************
|
||||
* Readv commands.
|
||||
*****************************************************************************/
|
||||
static int libc_readv ( dvdcss_t dvdcss, const struct iovec *p_iovec,
|
||||
int i_blocks )
|
||||
{
|
||||
#if defined( _WIN32 )
|
||||
int i_index, i_len, i_total = 0;
|
||||
unsigned char *p_base;
|
||||
int i_bytes;
|
||||
|
||||
for( i_index = i_blocks;
|
||||
i_index;
|
||||
i_index--, p_iovec++ )
|
||||
{
|
||||
i_len = p_iovec->iov_len;
|
||||
p_base = p_iovec->iov_base;
|
||||
|
||||
if( i_len <= 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
i_bytes = read( dvdcss->i_fd, p_base, i_len );
|
||||
|
||||
if( i_bytes < 0 )
|
||||
{
|
||||
/* One of the reads failed, too bad.
|
||||
* We won't even bother returning the reads that went OK,
|
||||
* and as in the POSIX spec the file position is left
|
||||
* unspecified after a failure */
|
||||
dvdcss->i_pos = -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
i_total += i_bytes;
|
||||
i_total /= DVDCSS_BLOCK_SIZE;
|
||||
|
||||
if( i_bytes != i_len )
|
||||
{
|
||||
/* We reached the end of the file or a signal interrupted
|
||||
* the read. Return a partial read. */
|
||||
int i_seek;
|
||||
|
||||
dvdcss->i_pos = -1;
|
||||
i_seek = libc_seek( dvdcss, i_total );
|
||||
if( i_seek < 0 )
|
||||
{
|
||||
return i_seek;
|
||||
}
|
||||
|
||||
/* We have to return now so that i_pos isn't clobbered */
|
||||
return i_total;
|
||||
}
|
||||
}
|
||||
|
||||
dvdcss->i_pos += i_total;
|
||||
return i_total;
|
||||
#else
|
||||
int i_read = readv( dvdcss->i_fd, p_iovec, i_blocks );
|
||||
|
||||
if( i_read < 0 )
|
||||
{
|
||||
dvdcss->i_pos = -1;
|
||||
return i_read;
|
||||
}
|
||||
|
||||
i_read /= DVDCSS_BLOCK_SIZE;
|
||||
dvdcss->i_pos += i_read;
|
||||
return i_read;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* stream_readv: vectored read
|
||||
*****************************************************************************/
|
||||
static int stream_readv ( dvdcss_t dvdcss, const struct iovec *p_iovec,
|
||||
int i_blocks )
|
||||
{
|
||||
int i_read;
|
||||
|
||||
if( !dvdcss->p_stream_cb->pf_readv )
|
||||
return -1;
|
||||
|
||||
i_read = dvdcss->p_stream_cb->pf_readv( dvdcss->p_stream, p_iovec,
|
||||
i_blocks );
|
||||
|
||||
if( i_read < 0 )
|
||||
{
|
||||
dvdcss->i_pos = -1;
|
||||
return i_read;
|
||||
}
|
||||
|
||||
dvdcss->i_pos += i_read / DVDCSS_BLOCK_SIZE;
|
||||
return i_read / DVDCSS_BLOCK_SIZE;
|
||||
}
|
||||
|
||||
#if defined( _WIN32 )
|
||||
/*****************************************************************************
|
||||
* win2k_readv: vectored read using ReadFile for Win2K
|
||||
*****************************************************************************/
|
||||
static int win2k_readv ( dvdcss_t dvdcss, const struct iovec *p_iovec,
|
||||
int i_blocks )
|
||||
{
|
||||
int i_index;
|
||||
int i_blocks_read, i_blocks_total = 0;
|
||||
DWORD i_bytes;
|
||||
|
||||
/* Check the size of the readv temp buffer, just in case we need to
|
||||
* realloc something bigger */
|
||||
if( dvdcss->i_readv_buf_size < i_blocks * DVDCSS_BLOCK_SIZE )
|
||||
{
|
||||
dvdcss->i_readv_buf_size = i_blocks * DVDCSS_BLOCK_SIZE;
|
||||
|
||||
free( dvdcss->p_readv_buffer );
|
||||
|
||||
/* Allocate a buffer which will be used as a temporary storage
|
||||
* for readv */
|
||||
dvdcss->p_readv_buffer = malloc( dvdcss->i_readv_buf_size );
|
||||
if( !dvdcss->p_readv_buffer )
|
||||
{
|
||||
print_error( dvdcss, "scatter input (readv) failed" );
|
||||
dvdcss->i_pos = -1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
for( i_index = i_blocks; i_index; i_index-- )
|
||||
{
|
||||
i_blocks_total += p_iovec[i_index-1].iov_len;
|
||||
}
|
||||
|
||||
if( i_blocks_total <= 0 ) return 0;
|
||||
|
||||
if( !ReadFile( (HANDLE)dvdcss->i_fd, dvdcss->p_readv_buffer,
|
||||
i_blocks_total, &i_bytes, NULL ) )
|
||||
{
|
||||
/* The read failed... too bad.
|
||||
* As in the POSIX spec the file position is left
|
||||
* unspecified after a failure */
|
||||
dvdcss->i_pos = -1;
|
||||
return -1;
|
||||
}
|
||||
i_blocks_read = i_bytes / DVDCSS_BLOCK_SIZE;
|
||||
|
||||
/* We just have to copy the content of the temp buffer into the iovecs */
|
||||
for( i_index = 0, i_blocks_total = i_blocks_read;
|
||||
i_blocks_total > 0;
|
||||
i_index++ )
|
||||
{
|
||||
memcpy( p_iovec[i_index].iov_base,
|
||||
dvdcss->p_readv_buffer + (i_blocks_read - i_blocks_total)
|
||||
* DVDCSS_BLOCK_SIZE,
|
||||
p_iovec[i_index].iov_len );
|
||||
/* if we read less blocks than asked, we'll just end up copying
|
||||
* garbage, this isn't an issue as we return the number of
|
||||
* blocks actually read */
|
||||
i_blocks_total -= ( p_iovec[i_index].iov_len / DVDCSS_BLOCK_SIZE );
|
||||
}
|
||||
|
||||
dvdcss->i_pos += i_blocks_read;
|
||||
return i_blocks_read;
|
||||
}
|
||||
#endif /* defined( _WIN32 ) */
|
56
src/device.h
Normal file
56
src/device.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*****************************************************************************
|
||||
* device.h: DVD device access
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1998-2002 VideoLAN
|
||||
*
|
||||
* Authors: Stéphane Borel <stef@via.ecp.fr>
|
||||
* Sam Hocevar <sam@zoy.org>
|
||||
* Håkan Hjort <d95hjort@dtek.chalmers.se>
|
||||
*
|
||||
* libdvdcss 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.
|
||||
*
|
||||
* libdvdcss 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 libdvdcss; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef DVDCSS_DEVICE_H
|
||||
#define DVDCSS_DEVICE_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
/*****************************************************************************
|
||||
* iovec structure: vectored data entry
|
||||
*****************************************************************************/
|
||||
#ifndef HAVE_SYS_UIO_H
|
||||
# include <io.h> /* read() */
|
||||
struct iovec
|
||||
{
|
||||
void *iov_base; /* Pointer to data. */
|
||||
size_t iov_len; /* Length of data. */
|
||||
};
|
||||
#else
|
||||
# include <sys/types.h>
|
||||
# include <sys/uio.h> /* struct iovec */
|
||||
#endif
|
||||
|
||||
#include "dvdcss/dvdcss.h"
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Device reading prototypes
|
||||
*****************************************************************************/
|
||||
int dvdcss_use_ioctls ( dvdcss_t );
|
||||
void dvdcss_check_device ( dvdcss_t );
|
||||
int dvdcss_open_device ( dvdcss_t );
|
||||
int dvdcss_close_device ( dvdcss_t );
|
||||
|
||||
#endif /* DVDCSS_DEVICE_H */
|
113
src/dvdcss/dvdcss.h
Normal file
113
src/dvdcss/dvdcss.h
Normal file
|
@ -0,0 +1,113 @@
|
|||
/**
|
||||
* \file dvdcss.h
|
||||
* \author Stéphane Borel <stef@via.ecp.fr>
|
||||
* \author Sam Hocevar <sam@zoy.org>
|
||||
*
|
||||
* \brief The \e libdvdcss public header.
|
||||
*
|
||||
* Public types and functions that describe the API of the \e libdvdcss library.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 1998-2008 VideoLAN
|
||||
*
|
||||
* libdvdcss 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.
|
||||
*
|
||||
* libdvdcss 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 libdvdcss; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef DVDCSS_DVDCSS_H
|
||||
#ifndef _DOXYGEN_SKIP_ME
|
||||
#define DVDCSS_DVDCSS_H 1
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Library instance handle, to be used for each library call. */
|
||||
typedef struct dvdcss_s* dvdcss_t;
|
||||
|
||||
/** Set of callbacks to access DVDs in custom ways. */
|
||||
typedef struct dvdcss_stream_cb
|
||||
{
|
||||
/** custom seek callback */
|
||||
int ( *pf_seek ) ( void *p_stream, uint64_t i_pos);
|
||||
/** custom read callback */
|
||||
int ( *pf_read ) ( void *p_stream, void *buffer, int i_read);
|
||||
/** custom vectored read callback */
|
||||
int ( *pf_readv ) ( void *p_stream, const void *p_iovec, int i_blocks);
|
||||
} dvdcss_stream_cb;
|
||||
|
||||
|
||||
/** The block size of a DVD. */
|
||||
#define DVDCSS_BLOCK_SIZE 2048
|
||||
|
||||
/** The default flag to be used by \e libdvdcss functions. */
|
||||
#define DVDCSS_NOFLAGS 0
|
||||
|
||||
/** Flag to ask dvdcss_read() to decrypt the data it reads. */
|
||||
#define DVDCSS_READ_DECRYPT (1 << 0)
|
||||
|
||||
/** Flag to tell dvdcss_seek() it is seeking in MPEG data. */
|
||||
#define DVDCSS_SEEK_MPEG (1 << 0)
|
||||
|
||||
/** Flag to ask dvdcss_seek() to check the current title key. */
|
||||
#define DVDCSS_SEEK_KEY (1 << 1)
|
||||
|
||||
|
||||
/** Macro for setting symbol storage-class or visibility.
|
||||
* Define LIBDVDCSS_IMPORTS before importing this header to get the
|
||||
* correct DLL storage-class when using \e libdvdcss from MSVC. */
|
||||
#if defined(LIBDVDCSS_EXPORTS)
|
||||
#define LIBDVDCSS_EXPORT __declspec(dllexport) extern
|
||||
#elif defined(LIBDVDCSS_IMPORTS)
|
||||
#define LIBDVDCSS_EXPORT __declspec(dllimport) extern
|
||||
#elif defined(SUPPORT_ATTRIBUTE_VISIBILITY_DEFAULT)
|
||||
#define LIBDVDCSS_EXPORT __attribute__((visibility("default"))) extern
|
||||
#else
|
||||
#define LIBDVDCSS_EXPORT extern
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Exported prototypes.
|
||||
*/
|
||||
LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target );
|
||||
LIBDVDCSS_EXPORT dvdcss_t dvdcss_open_stream( void *p_stream,
|
||||
dvdcss_stream_cb *p_stream_cb );
|
||||
LIBDVDCSS_EXPORT int dvdcss_close ( dvdcss_t );
|
||||
LIBDVDCSS_EXPORT int dvdcss_seek ( dvdcss_t,
|
||||
int i_blocks,
|
||||
int i_flags );
|
||||
LIBDVDCSS_EXPORT int dvdcss_read ( dvdcss_t,
|
||||
void *p_buffer,
|
||||
int i_blocks,
|
||||
int i_flags );
|
||||
LIBDVDCSS_EXPORT int dvdcss_readv ( dvdcss_t,
|
||||
void *p_iovec,
|
||||
int i_blocks,
|
||||
int i_flags );
|
||||
LIBDVDCSS_EXPORT const char *dvdcss_error ( const dvdcss_t );
|
||||
|
||||
LIBDVDCSS_EXPORT int dvdcss_is_scrambled ( dvdcss_t );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DVDCSS_DVDCSS_H */
|
37
src/dvdcss/version.h
Normal file
37
src/dvdcss/version.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* This file is part of libdvdcss
|
||||
* Copyright (C) 2015 VideoLAN
|
||||
*
|
||||
* This file 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 file 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, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DVDCSS_VERSION_H_
|
||||
#define DVDCSS_VERSION_H_
|
||||
|
||||
#define DVDCSS_VERSION_CODE(major, minor, micro) \
|
||||
(((major) * 10000) + \
|
||||
((minor) * 100) + \
|
||||
((micro) * 1))
|
||||
|
||||
#define DVDCSS_VERSION_MAJOR 1
|
||||
#define DVDCSS_VERSION_MINOR 4
|
||||
#define DVDCSS_VERSION_MICRO 3
|
||||
|
||||
#define DVDCSS_VERSION_STRING "1.4.3"
|
||||
|
||||
#define DVDCSS_VERSION \
|
||||
DVDCSS_VERSION_CODE(DVDCSS_VERSION_MAJOR, DVDCSS_VERSION_MINOR, DVDCSS_VERSION_MICRO)
|
||||
|
||||
#endif /* DVDCSS_VERSION_H_ */
|
37
src/dvdcss/version.h.in
Normal file
37
src/dvdcss/version.h.in
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* This file is part of libdvdcss
|
||||
* Copyright (C) 2015 VideoLAN
|
||||
*
|
||||
* This file 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 file 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, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DVDCSS_VERSION_H_
|
||||
#define DVDCSS_VERSION_H_
|
||||
|
||||
#define DVDCSS_VERSION_CODE(major, minor, micro) \
|
||||
(((major) * 10000) + \
|
||||
((minor) * 100) + \
|
||||
((micro) * 1))
|
||||
|
||||
#define DVDCSS_VERSION_MAJOR @DVDCSS_VERSION_MAJOR@
|
||||
#define DVDCSS_VERSION_MINOR @DVDCSS_VERSION_MINOR@
|
||||
#define DVDCSS_VERSION_MICRO @DVDCSS_VERSION_MICRO@
|
||||
|
||||
#define DVDCSS_VERSION_STRING "@DVDCSS_VERSION_MAJOR@.@DVDCSS_VERSION_MINOR@.@DVDCSS_VERSION_MICRO@"
|
||||
|
||||
#define DVDCSS_VERSION \
|
||||
DVDCSS_VERSION_CODE(DVDCSS_VERSION_MAJOR, DVDCSS_VERSION_MINOR, DVDCSS_VERSION_MICRO)
|
||||
|
||||
#endif /* DVDCSS_VERSION_H_ */
|
66
src/error.c
Normal file
66
src/error.c
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*****************************************************************************
|
||||
* error.c: error management functions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1998-2002 VideoLAN
|
||||
*
|
||||
* Author: Sam Hocevar <sam@zoy.org>
|
||||
*
|
||||
* libdvdcss 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.
|
||||
*
|
||||
* libdvdcss 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 libdvdcss; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "libdvdcss.h"
|
||||
|
||||
static void print_message( const char *prefix, const char *psz_string,
|
||||
va_list args )
|
||||
{
|
||||
fprintf( stderr, "libdvdcss %s: ", prefix );
|
||||
vfprintf( stderr, psz_string, args );
|
||||
fprintf( stderr, "\n" );
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* Error messages
|
||||
*****************************************************************************/
|
||||
void print_error( dvdcss_t dvdcss, const char *psz_string, ... )
|
||||
{
|
||||
if( dvdcss->b_errors )
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start( args, psz_string );
|
||||
print_message("error", psz_string, args);
|
||||
va_end( args );
|
||||
}
|
||||
|
||||
dvdcss->psz_error = psz_string;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* Debug messages
|
||||
*****************************************************************************/
|
||||
void print_debug( const dvdcss_t dvdcss, const char *psz_string, ... )
|
||||
{
|
||||
if( dvdcss->b_debug )
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start( args, psz_string );
|
||||
print_message("debug", psz_string, args );
|
||||
va_end( args );
|
||||
}
|
||||
}
|
1563
src/ioctl.c
Normal file
1563
src/ioctl.c
Normal file
File diff suppressed because it is too large
Load diff
276
src/ioctl.h
Normal file
276
src/ioctl.h
Normal file
|
@ -0,0 +1,276 @@
|
|||
/*****************************************************************************
|
||||
* ioctl.h: DVD ioctl replacement function
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1999-2001 VideoLAN
|
||||
*
|
||||
* Authors: Sam Hocevar <sam@zoy.org>
|
||||
*
|
||||
* libdvdcss 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.
|
||||
*
|
||||
* libdvdcss 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 libdvdcss; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef DVDCSS_IOCTL_H
|
||||
#define DVDCSS_IOCTL_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
int ioctl_ReadCopyright ( int, int, int * );
|
||||
int ioctl_ReadDiscKey ( int, const int *, uint8_t * );
|
||||
int ioctl_ReadTitleKey ( int, const int *, int, uint8_t * );
|
||||
int ioctl_ReportAgid ( int, int * );
|
||||
int ioctl_ReportChallenge ( int, const int *, uint8_t * );
|
||||
int ioctl_ReportKey1 ( int, const int *, uint8_t * );
|
||||
int ioctl_ReportASF ( int, int * );
|
||||
int ioctl_InvalidateAgid ( int, int * );
|
||||
int ioctl_SendChallenge ( int, const int *, const uint8_t * );
|
||||
int ioctl_SendKey2 ( int, const int *, const uint8_t * );
|
||||
int ioctl_ReportRPC ( int, int *, int *, int * );
|
||||
|
||||
#define DVD_DISCKEY_SIZE 2048
|
||||
|
||||
/*****************************************************************************
|
||||
* Common macros, OS-specific
|
||||
*****************************************************************************/
|
||||
#if defined( __HAIKU__ )
|
||||
#define INIT_RDC( TYPE, SIZE ) \
|
||||
raw_device_command rdc = { 0 }; \
|
||||
uint8_t p_buffer[ (SIZE)+1 ]; \
|
||||
rdc.data = (char *)p_buffer; \
|
||||
rdc.data_length = (SIZE); \
|
||||
BeInitRDC( &rdc, (TYPE) );
|
||||
#elif defined( SOLARIS_USCSI )
|
||||
#define INIT_USCSI( TYPE, SIZE ) \
|
||||
struct uscsi_cmd sc = { 0 }; \
|
||||
union scsi_cdb rs_cdb; \
|
||||
uint8_t p_buffer[ (SIZE)+1 ]; \
|
||||
sc.uscsi_cdb = (caddr_t)&rs_cdb; \
|
||||
sc.uscsi_bufaddr = (caddr_t)p_buffer; \
|
||||
sc.uscsi_buflen = (SIZE); \
|
||||
SolarisInitUSCSI( &sc, (TYPE) );
|
||||
#elif defined( DARWIN_DVD_IOCTL )
|
||||
#define INIT_DVDIOCTL( DKDVD_TYPE, BUFFER_TYPE, FORMAT ) \
|
||||
DKDVD_TYPE dvd = { 0 }; \
|
||||
BUFFER_TYPE dvdbs = { 0 }; \
|
||||
dvd.format = FORMAT; \
|
||||
dvd.buffer = &dvdbs; \
|
||||
dvd.bufferLength = sizeof(dvdbs);
|
||||
#elif defined( __QNXNTO__ )
|
||||
#define INIT_CPT( TYPE, SIZE ) \
|
||||
CAM_PASS_THRU * p_cpt = { 0 }; \
|
||||
uint8_t * p_buffer; \
|
||||
int structSize = sizeof( CAM_PASS_THRU ) + (SIZE); \
|
||||
p_cpt = (CAM_PASS_THRU *) malloc ( structSize ); \
|
||||
p_buffer = (uint8_t *) p_cpt + sizeof( CAM_PASS_THRU ); \
|
||||
p_cpt->cam_data_ptr = sizeof( CAM_PASS_THRU ); \
|
||||
p_cpt->cam_dxfer_len = (SIZE); \
|
||||
QNXInitCPT( p_cpt, (TYPE) );
|
||||
#elif defined( __OS2__ )
|
||||
#define INIT_SSC( TYPE, SIZE ) \
|
||||
struct OS2_ExecSCSICmd sdc = { 0 }; \
|
||||
uint8_t p_buffer[ (SIZE) + 1 ] = { 0 }; \
|
||||
unsigned long ulParamLen; \
|
||||
unsigned long ulDataLen; \
|
||||
sdc.data_length = (SIZE); \
|
||||
ulParamLen = sizeof(sdc); \
|
||||
OS2InitSDC( &sdc, (TYPE) )
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
* Additional types, OpenBSD-specific
|
||||
*****************************************************************************/
|
||||
#if defined( HAVE_OPENBSD_DVD_STRUCT )
|
||||
typedef union dvd_struct dvd_struct;
|
||||
typedef union dvd_authinfo dvd_authinfo;
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
* Various DVD I/O tables
|
||||
*****************************************************************************/
|
||||
/* The generic packet command opcodes for CD/DVD Logical Units,
|
||||
* From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */
|
||||
#define GPCMD_READ_DVD_STRUCTURE 0xad
|
||||
#define GPCMD_REPORT_KEY 0xa4
|
||||
#define GPCMD_SEND_KEY 0xa3
|
||||
/* DVD struct types */
|
||||
#define DVD_STRUCT_PHYSICAL 0x00
|
||||
#define DVD_STRUCT_COPYRIGHT 0x01
|
||||
#define DVD_STRUCT_DISCKEY 0x02
|
||||
#define DVD_STRUCT_BCA 0x03
|
||||
#define DVD_STRUCT_MANUFACT 0x04
|
||||
/* Key formats */
|
||||
#define DVD_REPORT_AGID 0x00
|
||||
#define DVD_REPORT_CHALLENGE 0x01
|
||||
#define DVD_SEND_CHALLENGE 0x01
|
||||
#define DVD_REPORT_KEY1 0x02
|
||||
#define DVD_SEND_KEY2 0x03
|
||||
#define DVD_REPORT_TITLE_KEY 0x04
|
||||
#define DVD_REPORT_ASF 0x05
|
||||
#define DVD_SEND_RPC 0x06
|
||||
#define DVD_REPORT_RPC 0x08
|
||||
#define DVDCSS_INVALIDATE_AGID 0x3f
|
||||
|
||||
/*****************************************************************************
|
||||
* Win32-ioctl-specific
|
||||
*****************************************************************************/
|
||||
#if defined( _WIN32 )
|
||||
|
||||
#define _WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <winioctl.h>
|
||||
|
||||
#define IOCTL_DVD_START_SESSION CTL_CODE(FILE_DEVICE_DVD, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
#define IOCTL_DVD_READ_KEY CTL_CODE(FILE_DEVICE_DVD, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
#define IOCTL_DVD_SEND_KEY CTL_CODE(FILE_DEVICE_DVD, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
#define IOCTL_DVD_END_SESSION CTL_CODE(FILE_DEVICE_DVD, 0x0403, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
#define IOCTL_DVD_GET_REGION CTL_CODE(FILE_DEVICE_DVD, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
#define IOCTL_DVD_SEND_KEY2 CTL_CODE(FILE_DEVICE_DVD, 0x0406, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
|
||||
#define IOCTL_DVD_READ_STRUCTURE CTL_CODE(FILE_DEVICE_DVD, 0x0450, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
#define IOCTL_SCSI_PASS_THROUGH_DIRECT CTL_CODE(FILE_DEVICE_CONTROLLER, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
|
||||
|
||||
#define DVD_CHALLENGE_KEY_LENGTH (12 + sizeof(DVD_COPY_PROTECT_KEY))
|
||||
#define DVD_BUS_KEY_LENGTH (8 + sizeof(DVD_COPY_PROTECT_KEY))
|
||||
#define DVD_TITLE_KEY_LENGTH (8 + sizeof(DVD_COPY_PROTECT_KEY))
|
||||
#define DVD_DISK_KEY_LENGTH (2048 + sizeof(DVD_COPY_PROTECT_KEY))
|
||||
#define DVD_RPC_KEY_LENGTH (sizeof(DVD_RPC_KEY) + sizeof(DVD_COPY_PROTECT_KEY))
|
||||
#define DVD_ASF_LENGTH (sizeof(DVD_ASF) + sizeof(DVD_COPY_PROTECT_KEY))
|
||||
|
||||
#define DVD_COPYRIGHT_MASK 0x00000040
|
||||
#define DVD_NOT_COPYRIGHTED 0x00000000
|
||||
#define DVD_COPYRIGHTED 0x00000040
|
||||
|
||||
#define DVD_SECTOR_PROTECT_MASK 0x00000020
|
||||
#define DVD_SECTOR_NOT_PROTECTED 0x00000000
|
||||
#define DVD_SECTOR_PROTECTED 0x00000020
|
||||
|
||||
#define SCSI_IOCTL_DATA_OUT 0
|
||||
#define SCSI_IOCTL_DATA_IN 1
|
||||
|
||||
typedef ULONG DVD_SESSION_ID, *PDVD_SESSION_ID;
|
||||
|
||||
typedef enum DVD_STRUCTURE_FORMAT {
|
||||
DvdPhysicalDescriptor,
|
||||
DvdCopyrightDescriptor,
|
||||
DvdDiskKeyDescriptor,
|
||||
DvdBCADescriptor,
|
||||
DvdManufacturerDescriptor,
|
||||
DvdMaxDescriptor
|
||||
} DVD_STRUCTURE_FORMAT, *PDVD_STRUCTURE_FORMAT;
|
||||
|
||||
typedef struct DVD_READ_STRUCTURE {
|
||||
LARGE_INTEGER BlockByteOffset;
|
||||
DVD_STRUCTURE_FORMAT Format;
|
||||
DVD_SESSION_ID SessionId;
|
||||
UCHAR LayerNumber;
|
||||
} DVD_READ_STRUCTURE, *PDVD_READ_STRUCTURE;
|
||||
|
||||
typedef struct DVD_COPYRIGHT_DESCRIPTOR {
|
||||
UCHAR CopyrightProtectionType;
|
||||
UCHAR RegionManagementInformation;
|
||||
USHORT Reserved;
|
||||
} DVD_COPYRIGHT_DESCRIPTOR, *PDVD_COPYRIGHT_DESCRIPTOR;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DvdChallengeKey = 0x01,
|
||||
DvdBusKey1,
|
||||
DvdBusKey2,
|
||||
DvdTitleKey,
|
||||
DvdAsf,
|
||||
DvdSetRpcKey = 0x6,
|
||||
DvdGetRpcKey = 0x8,
|
||||
DvdDiskKey = 0x80,
|
||||
DvdInvalidateAGID = 0x3f
|
||||
} DVD_KEY_TYPE;
|
||||
|
||||
typedef struct DVD_COPY_PROTECT_KEY
|
||||
{
|
||||
ULONG KeyLength;
|
||||
DVD_SESSION_ID SessionId;
|
||||
DVD_KEY_TYPE KeyType;
|
||||
ULONG KeyFlags;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
ULONG FileHandle;
|
||||
ULONG Reserved; // used for NT alignment
|
||||
};
|
||||
LARGE_INTEGER TitleOffset;
|
||||
} Parameters;
|
||||
UCHAR KeyData[0];
|
||||
} DVD_COPY_PROTECT_KEY, *PDVD_COPY_PROTECT_KEY;
|
||||
|
||||
typedef struct DVD_ASF
|
||||
{
|
||||
UCHAR Reserved0[3];
|
||||
UCHAR SuccessFlag:1;
|
||||
UCHAR Reserved1:7;
|
||||
} DVD_ASF, * PDVD_ASF;
|
||||
|
||||
typedef struct DVD_RPC_KEY
|
||||
{
|
||||
UCHAR UserResetsAvailable:3;
|
||||
UCHAR ManufacturerResetsAvailable:3;
|
||||
UCHAR TypeCode:2;
|
||||
UCHAR RegionMask;
|
||||
UCHAR RpcScheme;
|
||||
UCHAR Reserved2[1];
|
||||
} DVD_RPC_KEY, * PDVD_RPC_KEY;
|
||||
|
||||
typedef struct SCSI_PASS_THROUGH_DIRECT
|
||||
{
|
||||
USHORT Length;
|
||||
UCHAR ScsiStatus;
|
||||
UCHAR PathId;
|
||||
UCHAR TargetId;
|
||||
UCHAR Lun;
|
||||
UCHAR CdbLength;
|
||||
UCHAR SenseInfoLength;
|
||||
UCHAR DataIn;
|
||||
ULONG DataTransferLength;
|
||||
ULONG TimeOutValue;
|
||||
PVOID DataBuffer;
|
||||
ULONG SenseInfoOffset;
|
||||
UCHAR Cdb[16];
|
||||
} SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT;
|
||||
|
||||
#endif /* defined( _WIN32 ) */
|
||||
|
||||
/*****************************************************************************
|
||||
* OS/2-ioctl-specific
|
||||
*****************************************************************************/
|
||||
#if defined( __OS2__ )
|
||||
|
||||
#define CDROMDISK_EXECMD 0x7A
|
||||
|
||||
#define EX_DIRECTION_IN 0x01
|
||||
#define EX_PLAYING_CHK 0x02
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
struct OS2_ExecSCSICmd
|
||||
{
|
||||
unsigned long id_code; // 'CD01'
|
||||
unsigned short data_length; // length of the Data Packet
|
||||
unsigned short cmd_length; // length of the Command Buffer
|
||||
unsigned short flags; // flags
|
||||
unsigned char command[16]; // Command Buffer for SCSI command
|
||||
|
||||
} OS2_ExecSCSICmd;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif /* defined( __OS2__ ) */
|
||||
|
||||
#endif /* DVDCSS_IOCTL_H */
|
863
src/libdvdcss.c
Normal file
863
src/libdvdcss.c
Normal file
|
@ -0,0 +1,863 @@
|
|||
/* libdvdcss.c: DVD reading library.
|
||||
*
|
||||
* Authors: Stéphane Borel <stef@via.ecp.fr>
|
||||
* Sam Hocevar <sam@zoy.org>
|
||||
* Håkan Hjort <d95hjort@dtek.chalmers.se>
|
||||
*
|
||||
* Copyright (C) 1998-2008 VideoLAN
|
||||
*
|
||||
* libdvdcss 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.
|
||||
*
|
||||
* libdvdcss 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 libdvdcss; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \mainpage libdvdcss developer documentation
|
||||
*
|
||||
* \section intro Introduction
|
||||
*
|
||||
* \e libdvdcss is a simple library designed for accessing DVDs like a block
|
||||
* device without having to bother about the decryption. The important features
|
||||
* are:
|
||||
* \li portability: Currently supported platforms are GNU/Linux, FreeBSD,
|
||||
* NetBSD, OpenBSD, Haiku, Mac OS X, Solaris, QNX, OS/2, and Windows
|
||||
* 2000 or later.
|
||||
* \li adaptability: Unlike most similar projects, libdvdcss does not require
|
||||
* the region of your drive to be set and will try its best to read from
|
||||
* the disc even in the case of a region mismatch.
|
||||
* \li simplicity: A DVD player can be built around the \e libdvdcss API using
|
||||
* no more than 4 or 5 library calls.
|
||||
*
|
||||
* \e libdvdcss is free software, released under the GNU General Public License.
|
||||
* This ensures that \e libdvdcss remains free and used only with free
|
||||
* software.
|
||||
*
|
||||
* \section api The libdvdcss API
|
||||
*
|
||||
* The complete \e libdvdcss programming interface is documented in the
|
||||
* dvdcss.h file.
|
||||
*
|
||||
* \section env Environment variables
|
||||
*
|
||||
* Some environment variables can be used to change the behavior of
|
||||
* \e libdvdcss without having to modify the program which uses it. These
|
||||
* variables are:
|
||||
*
|
||||
* \li \b DVDCSS_VERBOSE: Sets the verbosity level.
|
||||
* - \c 0 outputs no messages at all.
|
||||
* - \c 1 outputs error messages to stderr.
|
||||
* - \c 2 outputs error messages and debug messages to stderr.
|
||||
*
|
||||
* \li \b DVDCSS_METHOD: Sets the authentication and decryption method
|
||||
* that \e libdvdcss will use to read scrambled discs. Can be one
|
||||
* of \c title, \c key or \c disc.
|
||||
* - \c key is the default method. \e libdvdcss will use a set of
|
||||
* calculated player keys to try and get the disc key. This can fail
|
||||
* if the drive does not recognize any of the player keys.
|
||||
* - \c disc is a fallback method when \c key has failed. Instead of
|
||||
* using player keys, \e libdvdcss will crack the disc key using
|
||||
* a brute force algorithm. This process is CPU intensive and requires
|
||||
* 64 MB of memory to store temporary data.
|
||||
* - \c title is the fallback when all other methods have failed. It does
|
||||
* not rely on a key exchange with the DVD drive, but rather uses a
|
||||
* crypto attack to guess the title key. In rare cases this may fail
|
||||
* because there is not enough encrypted data on the disc to perform
|
||||
* a statistical attack, but on the other hand it is the only way to
|
||||
* decrypt a DVD stored on a hard disc, or a DVD with the wrong region
|
||||
* on an RPC2 drive.
|
||||
*
|
||||
* \li \b DVDCSS_RAW_DEVICE: Specify the raw device to use. Exact usage will
|
||||
* depend on your operating system, the Linux utility to set up raw devices
|
||||
* is \c raw(8) for instance. Please note that on most operating systems,
|
||||
* using a raw device requires highly aligned buffers: Linux requires a
|
||||
* 2048 bytes alignment (which is the size of a DVD sector).
|
||||
*
|
||||
* \li \b DVDCSS_CACHE: Specify a directory in which to cache title key
|
||||
* values. This will speed up descrambling of DVDs which are in the
|
||||
* cache. The DVDCSS_CACHE directory is created if it does not exist,
|
||||
* and a subdirectory is created named after the DVD's title or
|
||||
* manufacturing date. If DVDCSS_CACHE is not set or is empty, \e libdvdcss
|
||||
* will use the default value which is "${HOME}/.dvdcss/" under Unix and
|
||||
* "C:\Documents and Settings\$USER\Application Data\dvdcss\" under Win32.
|
||||
* The special value "off" disables caching.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Preamble
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
#ifdef HAVE_PWD_H
|
||||
# include <pwd.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <windows.h>
|
||||
# include <shlobj.h>
|
||||
#endif
|
||||
|
||||
#include "dvdcss/dvdcss.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "css.h"
|
||||
#include "libdvdcss.h"
|
||||
#include "ioctl.h"
|
||||
#include "device.h"
|
||||
|
||||
#ifdef HAVE_BROKEN_MKDIR
|
||||
#include <direct.h>
|
||||
#define mkdir(a, b) _mkdir(a)
|
||||
#endif
|
||||
|
||||
#define CACHE_TAG_NAME "CACHEDIR.TAG"
|
||||
|
||||
#define STRING_KEY_SIZE (DVD_KEY_SIZE * 2)
|
||||
#define INTERESTING_SECTOR 16
|
||||
#define DISC_TITLE_OFFSET 40
|
||||
#define DISC_TITLE_LENGTH 32
|
||||
#define MANUFACTURING_DATE_OFFSET 813
|
||||
#define MANUFACTURING_DATE_LENGTH 16
|
||||
|
||||
static int exists_or_mkdir( const char *path, int perm )
|
||||
{
|
||||
/* mkdir() may return an error if making the directory would fail,
|
||||
* even if the directory exists, so use stat() to test for existence
|
||||
* before trying to make the directory. */
|
||||
struct stat st;
|
||||
if( stat(path, &st) )
|
||||
return mkdir(path, perm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static dvdcss_t dvdcss_open_common ( const char *psz_target, void *p_stream,
|
||||
dvdcss_stream_cb *p_stream_cb );
|
||||
static void set_verbosity( dvdcss_t dvdcss )
|
||||
{
|
||||
const char *psz_verbose = getenv( "DVDCSS_VERBOSE" );
|
||||
|
||||
dvdcss->b_debug = 0;
|
||||
dvdcss->b_errors = 0;
|
||||
|
||||
if( psz_verbose != NULL )
|
||||
{
|
||||
int i = atoi( psz_verbose );
|
||||
|
||||
if( i >= 2 )
|
||||
dvdcss->b_debug = 1;
|
||||
if( i >= 1 )
|
||||
dvdcss->b_errors = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static int set_access_method( dvdcss_t dvdcss )
|
||||
{
|
||||
const char *psz_method = getenv( "DVDCSS_METHOD" );
|
||||
|
||||
if( !psz_method )
|
||||
return 0;
|
||||
|
||||
if( !strncmp( psz_method, "key", 4 ) )
|
||||
{
|
||||
dvdcss->i_method = DVDCSS_METHOD_KEY;
|
||||
}
|
||||
else if( !strncmp( psz_method, "disc", 5 ) )
|
||||
{
|
||||
dvdcss->i_method = DVDCSS_METHOD_DISC;
|
||||
}
|
||||
else if( !strncmp( psz_method, "title", 5 ) )
|
||||
{
|
||||
dvdcss->i_method = DVDCSS_METHOD_TITLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
print_error( dvdcss, "unknown decryption method %s, please choose "
|
||||
"from 'title', 'key' or 'disc'", psz_method );
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_cache_directory( dvdcss_t dvdcss )
|
||||
{
|
||||
char *psz_cache = getenv( "DVDCSS_CACHE" );
|
||||
|
||||
if( psz_cache && !strcmp( psz_cache, "off" ) )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( psz_cache == NULL || psz_cache[0] == '\0' )
|
||||
{
|
||||
#ifdef _WIN32
|
||||
char psz_home[PATH_MAX];
|
||||
|
||||
/* Cache our keys in
|
||||
* C:\Documents and Settings\$USER\Application Data\dvdcss\ */
|
||||
if (SHGetFolderPathA (NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE,
|
||||
NULL, SHGFP_TYPE_CURRENT, psz_home ) == S_OK)
|
||||
{
|
||||
snprintf( dvdcss->psz_cachefile, PATH_MAX, "%s\\dvdcss", psz_home );
|
||||
dvdcss->psz_cachefile[PATH_MAX - 1] = '\0';
|
||||
psz_cache = dvdcss->psz_cachefile;
|
||||
}
|
||||
#else
|
||||
#ifdef __ANDROID__
|
||||
/* $HOME is not writable on __ANDROID__ so we have to create a custom
|
||||
* directory in userland */
|
||||
char *psz_home = "/sdcard/Android/data/org.videolan.dvdcss";
|
||||
|
||||
int i_ret = exists_or_mkdir( psz_home, 0755 );
|
||||
if( i_ret < 0 && errno != EEXIST )
|
||||
{
|
||||
print_error( dvdcss, "failed creating home directory" );
|
||||
psz_home = NULL;
|
||||
}
|
||||
#else
|
||||
char *psz_home = NULL;
|
||||
#ifdef HAVE_PWD_H
|
||||
struct passwd *p_pwd;
|
||||
|
||||
/* Try looking in password file for home dir. */
|
||||
p_pwd = getpwuid(getuid());
|
||||
if( p_pwd && p_pwd->pw_dir && p_pwd->pw_dir[ 0 ] )
|
||||
{
|
||||
psz_home = p_pwd->pw_dir;
|
||||
}
|
||||
#endif /* HAVE_PWD_H */
|
||||
|
||||
#endif /* __ANDROID__ */
|
||||
|
||||
if( psz_home == NULL )
|
||||
{
|
||||
psz_home = getenv( "HOME" );
|
||||
}
|
||||
|
||||
/* Cache our keys in ${HOME}/.dvdcss/ */
|
||||
if( psz_home && psz_home[ 0 ] )
|
||||
{
|
||||
int home_pos = 0;
|
||||
|
||||
#ifdef __OS2__
|
||||
if( *psz_home == '/' || *psz_home == '\\')
|
||||
{
|
||||
const char *psz_unixroot = getenv("UNIXROOT");
|
||||
|
||||
if( psz_unixroot &&
|
||||
psz_unixroot[0] &&
|
||||
psz_unixroot[1] == ':' &&
|
||||
psz_unixroot[2] == '\0')
|
||||
{
|
||||
strcpy( dvdcss->psz_cachefile, psz_unixroot );
|
||||
home_pos = 2;
|
||||
}
|
||||
}
|
||||
#endif /* __OS2__ */
|
||||
snprintf( dvdcss->psz_cachefile + home_pos, PATH_MAX - home_pos,
|
||||
"%s/.dvdcss", psz_home );
|
||||
dvdcss->psz_cachefile[PATH_MAX - 1] = '\0';
|
||||
psz_cache = dvdcss->psz_cachefile;
|
||||
}
|
||||
#endif /* ! defined( _WIN32 ) */
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy( dvdcss->psz_cachefile, psz_cache, PATH_MAX );
|
||||
dvdcss->psz_cachefile[PATH_MAX - 1] = '\0';
|
||||
}
|
||||
|
||||
/* Check that there is enough space for the cache directory path and the
|
||||
* block filename. The +1s are path separators. */
|
||||
if( psz_cache && strlen( psz_cache ) + 1 + DISC_TITLE_LENGTH + 1 +
|
||||
MANUFACTURING_DATE_LENGTH + 1 + STRING_KEY_SIZE + 1 +
|
||||
sizeof(CACHE_TAG_NAME) > PATH_MAX )
|
||||
{
|
||||
print_error( dvdcss, "cache directory name is too long" );
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int init_cache_dir( dvdcss_t dvdcss )
|
||||
{
|
||||
static const char psz_tag[] =
|
||||
"Signature: 8a477f597d28d172789f06886806bc55\r\n"
|
||||
"# This file is a cache directory tag created by libdvdcss.\r\n"
|
||||
"# For information about cache directory tags, see:\r\n"
|
||||
"# http://www.brynosaurus.com/cachedir/\r\n";
|
||||
char psz_tagfile[PATH_MAX];
|
||||
int i_fd, i_ret;
|
||||
|
||||
i_ret = exists_or_mkdir( dvdcss->psz_cachefile, 0755 );
|
||||
if( i_ret < 0 && errno != EEXIST )
|
||||
{
|
||||
print_error( dvdcss, "failed creating cache directory '%s'", dvdcss->psz_cachefile );
|
||||
dvdcss->psz_cachefile[0] = '\0';
|
||||
return -1;
|
||||
}
|
||||
|
||||
i_ret = snprintf( psz_tagfile, PATH_MAX, "%s/" CACHE_TAG_NAME,
|
||||
dvdcss->psz_cachefile );
|
||||
if ( i_ret < 0 || i_ret >= PATH_MAX)
|
||||
{
|
||||
if ( i_ret < 0)
|
||||
print_error( dvdcss, "failed to compose cache directory tag path");
|
||||
else
|
||||
print_error( dvdcss, "cache directory tag path too long: %s/" CACHE_TAG_NAME,
|
||||
dvdcss->psz_cachefile );
|
||||
dvdcss->psz_cachefile[0] = '\0';
|
||||
return -1;
|
||||
}
|
||||
|
||||
i_fd = open( psz_tagfile, O_RDWR|O_CREAT, 0644 );
|
||||
if( i_fd >= 0 )
|
||||
{
|
||||
ssize_t len = strlen(psz_tag);
|
||||
if( write( i_fd, psz_tag, len ) < len )
|
||||
{
|
||||
print_error( dvdcss,
|
||||
"Error writing cache directory tag, continuing..\n" );
|
||||
}
|
||||
close( i_fd );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void create_cache_subdir( dvdcss_t dvdcss )
|
||||
{
|
||||
uint8_t p_sector[DVDCSS_BLOCK_SIZE];
|
||||
char psz_key[STRING_KEY_SIZE + 1];
|
||||
char *psz_title;
|
||||
uint8_t *psz_serial;
|
||||
int i, i_ret;
|
||||
|
||||
/* We read sector 0. If it starts with 0x000001ba (BE), we are
|
||||
* reading a VOB file, and we should not cache anything. */
|
||||
|
||||
i_ret = dvdcss->pf_seek( dvdcss, 0 );
|
||||
if( i_ret != 0 )
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
i_ret = dvdcss->pf_read( dvdcss, p_sector, 1 );
|
||||
if( i_ret != 1 )
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
if( p_sector[0] == 0x00 && p_sector[1] == 0x00
|
||||
&& p_sector[2] == 0x01 && p_sector[3] == 0xba )
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* The data we are looking for is at sector 16 (32768 bytes):
|
||||
* - offset 40: disc title (32 uppercase chars)
|
||||
* - offset 813: manufacturing date + serial no (16 digits) */
|
||||
|
||||
i_ret = dvdcss->pf_seek( dvdcss, INTERESTING_SECTOR );
|
||||
if( i_ret != INTERESTING_SECTOR )
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
i_ret = dvdcss->pf_read( dvdcss, p_sector, 1 );
|
||||
if( i_ret != 1 )
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Get the disc title */
|
||||
psz_title = (char *)p_sector + DISC_TITLE_OFFSET;
|
||||
psz_title[DISC_TITLE_LENGTH] = '\0';
|
||||
|
||||
for( i = 0; i < DISC_TITLE_LENGTH; i++ )
|
||||
{
|
||||
if( psz_title[i] <= ' ' )
|
||||
{
|
||||
psz_title[i] = '\0';
|
||||
break;
|
||||
}
|
||||
else if( psz_title[i] == '/' || psz_title[i] == '\\' )
|
||||
{
|
||||
psz_title[i] = '-';
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the date + serial */
|
||||
psz_serial = p_sector + MANUFACTURING_DATE_OFFSET;
|
||||
psz_serial[MANUFACTURING_DATE_LENGTH] = '\0';
|
||||
|
||||
/* Check that all characters are digits, otherwise convert. */
|
||||
for( i = 0 ; i < MANUFACTURING_DATE_LENGTH ; i++ )
|
||||
{
|
||||
if( psz_serial[i] < '0' || psz_serial[i] > '9' )
|
||||
{
|
||||
char psz_tmp[MANUFACTURING_DATE_LENGTH + 1];
|
||||
sprintf( psz_tmp,
|
||||
"%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x",
|
||||
psz_serial[0], psz_serial[1], psz_serial[2],
|
||||
psz_serial[3], psz_serial[4], psz_serial[5],
|
||||
psz_serial[6], psz_serial[7] );
|
||||
memcpy( psz_serial, psz_tmp, MANUFACTURING_DATE_LENGTH );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get disk key, since some discs have the same title, manufacturing
|
||||
* date and serial number, but different keys. */
|
||||
if( dvdcss->b_scrambled )
|
||||
{
|
||||
for( i = 0; i < DVD_KEY_SIZE; i++ )
|
||||
{
|
||||
sprintf( &psz_key[i * 2], "%.2x", dvdcss->css.p_disc_key[i] );
|
||||
}
|
||||
psz_key[STRING_KEY_SIZE] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
psz_key[0] = 0;
|
||||
}
|
||||
|
||||
/* We have a disc name or ID, we can create the cache subdirectory. */
|
||||
i = strlen( dvdcss->psz_cachefile );
|
||||
i += sprintf( dvdcss->psz_cachefile + i, "/%s-%s-%s",
|
||||
psz_title, psz_serial, psz_key );
|
||||
i_ret = exists_or_mkdir( dvdcss->psz_cachefile, 0755 );
|
||||
if( i_ret < 0 && errno != EEXIST )
|
||||
{
|
||||
print_error( dvdcss, "failed creating cache subdirectory" );
|
||||
goto error;
|
||||
}
|
||||
i += sprintf( dvdcss->psz_cachefile + i, "/");
|
||||
|
||||
/* Pointer to the filename we will use. */
|
||||
dvdcss->psz_block = dvdcss->psz_cachefile + i;
|
||||
|
||||
print_debug( dvdcss, "Content Scrambling System (CSS) key cache dir: %s",
|
||||
dvdcss->psz_cachefile );
|
||||
return;
|
||||
|
||||
error:
|
||||
dvdcss->psz_cachefile[0] = '\0';
|
||||
}
|
||||
|
||||
static void init_cache( dvdcss_t dvdcss )
|
||||
{
|
||||
/* Set CSS key cache directory. */
|
||||
int i_ret = set_cache_directory( dvdcss );
|
||||
if ( i_ret < 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* If the cache is enabled, initialize the cache directory. */
|
||||
i_ret = init_cache_dir( dvdcss );
|
||||
if ( i_ret < 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* If the cache is enabled, create a DVD-specific subdirectory. */
|
||||
create_cache_subdir( dvdcss );
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Open a DVD device or directory and return a dvdcss instance.
|
||||
*
|
||||
* \param psz_target a string containing the target name, for instance
|
||||
* "/dev/hdc" or "E:"
|
||||
* \return a handle to a dvdcss instance or NULL on error.
|
||||
*
|
||||
* Initialize the \e libdvdcss library, open the requested DVD device or
|
||||
* directory, and return a handle to be used for all subsequent \e libdvdcss
|
||||
* calls. \e libdvdcss checks whether ioctls can be performed on the disc,
|
||||
* and when possible, the disc key is retrieved.
|
||||
*/
|
||||
LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
|
||||
{
|
||||
return dvdcss_open_common( psz_target, NULL, NULL );
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Open a DVD device using dvdcss_stream_cb.
|
||||
*
|
||||
* \param p_stream a private handle used by p_stream_cb
|
||||
* \param p_stream_cb a struct containing seek and read functions
|
||||
* \return a handle to a dvdcss instance or NULL on error.
|
||||
*
|
||||
* \see dvdcss_open()
|
||||
*/
|
||||
LIBDVDCSS_EXPORT dvdcss_t dvdcss_open_stream ( void *p_stream,
|
||||
dvdcss_stream_cb *p_stream_cb )
|
||||
{
|
||||
return dvdcss_open_common( NULL, p_stream, p_stream_cb );
|
||||
}
|
||||
|
||||
static dvdcss_t dvdcss_open_common ( const char *psz_target, void *p_stream,
|
||||
dvdcss_stream_cb *p_stream_cb )
|
||||
{
|
||||
int i_ret;
|
||||
|
||||
/* Allocate the library structure. */
|
||||
dvdcss_t dvdcss = malloc( sizeof( *dvdcss ) );
|
||||
if( dvdcss == NULL )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( psz_target == NULL &&
|
||||
( p_stream == NULL || p_stream_cb == NULL ) )
|
||||
{
|
||||
dvdcss->psz_device = NULL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Initialize structure with default values. */
|
||||
dvdcss->i_fd = -1;
|
||||
dvdcss->i_pos = 0;
|
||||
dvdcss->p_titles = NULL;
|
||||
dvdcss->psz_device = psz_target ? strdup( psz_target ) : NULL;
|
||||
dvdcss->psz_error = "no error";
|
||||
dvdcss->i_method = DVDCSS_METHOD_KEY;
|
||||
dvdcss->psz_cachefile[0] = '\0';
|
||||
|
||||
dvdcss->p_stream = p_stream;
|
||||
dvdcss->p_stream_cb = p_stream_cb;
|
||||
|
||||
/* Set library verbosity from DVDCSS_VERBOSE environment variable. */
|
||||
set_verbosity( dvdcss );
|
||||
|
||||
/* Set DVD access method from DVDCSS_METHOD environment variable. */
|
||||
if( set_access_method( dvdcss ) < 0 )
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Open device. */
|
||||
dvdcss_check_device( dvdcss );
|
||||
i_ret = dvdcss_open_device( dvdcss );
|
||||
if( i_ret < 0 )
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
dvdcss->b_scrambled = 1; /* Assume the worst */
|
||||
dvdcss->b_ioctls = dvdcss_use_ioctls( dvdcss );
|
||||
|
||||
if( dvdcss->b_ioctls )
|
||||
{
|
||||
i_ret = dvdcss_test( dvdcss );
|
||||
|
||||
if( i_ret == -3 )
|
||||
{
|
||||
print_debug( dvdcss, "scrambled disc on a region-free RPC-II "
|
||||
"drive: possible failure, but continuing "
|
||||
"anyway" );
|
||||
}
|
||||
else if( i_ret < 0 )
|
||||
{
|
||||
/* Disable the CSS ioctls and hope that it works? */
|
||||
print_debug( dvdcss,
|
||||
"could not check whether the disc was scrambled" );
|
||||
dvdcss->b_ioctls = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
print_debug( dvdcss, i_ret ? "disc is scrambled"
|
||||
: "disc is unscrambled" );
|
||||
dvdcss->b_scrambled = i_ret;
|
||||
}
|
||||
}
|
||||
|
||||
memset( dvdcss->css.p_disc_key, 0, DVD_KEY_SIZE );
|
||||
/* If disc is CSS protected and the ioctls work, authenticate the drive */
|
||||
if( dvdcss->b_scrambled && dvdcss->b_ioctls )
|
||||
{
|
||||
i_ret = dvdcss_disckey( dvdcss );
|
||||
|
||||
if( i_ret < 0 )
|
||||
{
|
||||
print_debug( dvdcss, "could not get disc key" );
|
||||
}
|
||||
}
|
||||
|
||||
init_cache( dvdcss );
|
||||
|
||||
/* Seek to the beginning, just for safety. */
|
||||
dvdcss->pf_seek( dvdcss, 0 );
|
||||
|
||||
return dvdcss;
|
||||
|
||||
error:
|
||||
free( dvdcss->psz_device );
|
||||
free( dvdcss );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Return a string containing the last error that occurred in the
|
||||
* given \e libdvdcss instance.
|
||||
*
|
||||
* \param dvdcss a \e libdvdcss instance
|
||||
* \return a NULL-terminated string containing the last error message.
|
||||
*
|
||||
* Return a string with the last error message produced by \e libdvdcss.
|
||||
* Useful to conveniently format error messages in external applications.
|
||||
*/
|
||||
LIBDVDCSS_EXPORT const char * dvdcss_error ( const dvdcss_t dvdcss )
|
||||
{
|
||||
return dvdcss->psz_error;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Seek in the disc and change the current key if requested.
|
||||
*
|
||||
* \param dvdcss a \e libdvdcss instance
|
||||
* \param i_blocks an absolute block offset to seek to
|
||||
* \param i_flags #DVDCSS_NOFLAGS, optionally ORed with one of #DVDCSS_SEEK_KEY
|
||||
* or #DVDCSS_SEEK_MPEG
|
||||
* \return the new position in blocks or a negative value in case an error
|
||||
* happened.
|
||||
*
|
||||
* This function seeks to the requested position, in logical blocks.
|
||||
*
|
||||
* You typically set \p i_flags to #DVDCSS_NOFLAGS when seeking in a .IFO.
|
||||
*
|
||||
* If #DVDCSS_SEEK_MPEG is specified in \p i_flags and if \e libdvdcss finds it
|
||||
* reasonable to do so (i.e., if the dvdcss method is not "title"), the current
|
||||
* title key will be checked and a new one will be calculated if necessary.
|
||||
* This flag is typically used when reading data from a .VOB file.
|
||||
*
|
||||
* If #DVDCSS_SEEK_KEY is specified, the title key will always be checked,
|
||||
* even with the "title" method. This flag is typically used when seeking
|
||||
* in a new title.
|
||||
*/
|
||||
LIBDVDCSS_EXPORT int dvdcss_seek ( dvdcss_t dvdcss, int i_blocks, int i_flags )
|
||||
{
|
||||
/* title cracking method is too slow to be used at each seek */
|
||||
if( ( ( i_flags & DVDCSS_SEEK_MPEG )
|
||||
&& ( dvdcss->i_method != DVDCSS_METHOD_TITLE ) )
|
||||
|| ( i_flags & DVDCSS_SEEK_KEY ) )
|
||||
{
|
||||
/* check the title key */
|
||||
if( dvdcss_title( dvdcss, i_blocks ) )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return dvdcss->pf_seek( dvdcss, i_blocks );
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Read from the disc and decrypt data if requested.
|
||||
*
|
||||
* \param dvdcss a \e libdvdcss instance
|
||||
* \param p_buffer a buffer that will contain the data read from the disc
|
||||
* \param i_blocks the amount of blocks to read
|
||||
* \param i_flags #DVDCSS_NOFLAGS, optionally ORed with #DVDCSS_READ_DECRYPT
|
||||
* \return the amount of blocks read or a negative value in case an
|
||||
* error happened.
|
||||
*
|
||||
* Read \p i_blocks logical blocks from the DVD.
|
||||
*
|
||||
* You typically set \p i_flags to #DVDCSS_NOFLAGS when reading data from a
|
||||
* .IFO file on the DVD.
|
||||
*
|
||||
* If #DVDCSS_READ_DECRYPT is specified in \p i_flags, dvdcss_read() will
|
||||
* automatically decrypt scrambled sectors. This flag is typically used when
|
||||
* reading data from a .VOB file on the DVD. It has no effect on unscrambled
|
||||
* discs or unscrambled sectors and can be safely used on those.
|
||||
*
|
||||
* \warning dvdcss_read() expects to be able to write \p i_blocks *
|
||||
* #DVDCSS_BLOCK_SIZE bytes into \p p_buffer.
|
||||
*/
|
||||
LIBDVDCSS_EXPORT int dvdcss_read ( dvdcss_t dvdcss, void *p_buffer,
|
||||
int i_blocks,
|
||||
int i_flags )
|
||||
{
|
||||
uint8_t *_p_buffer = p_buffer;
|
||||
int i_ret, i_index;
|
||||
|
||||
i_ret = dvdcss->pf_read( dvdcss, _p_buffer, i_blocks );
|
||||
|
||||
if( i_ret <= 0
|
||||
|| !dvdcss->b_scrambled
|
||||
|| !(i_flags & DVDCSS_READ_DECRYPT) )
|
||||
{
|
||||
return i_ret;
|
||||
}
|
||||
|
||||
if( ! memcmp( dvdcss->css.p_title_key, "\0\0\0\0\0", 5 ) )
|
||||
{
|
||||
/* For what we believe is an unencrypted title,
|
||||
* check that there are no encrypted blocks */
|
||||
for( i_index = i_ret; i_index; i_index-- )
|
||||
{
|
||||
if( _p_buffer[0x14] & 0x30 )
|
||||
{
|
||||
print_error( dvdcss, "no key but found encrypted block" );
|
||||
/* Only return the initial range of unscrambled blocks? */
|
||||
/* or fail completely? return 0; */
|
||||
break;
|
||||
}
|
||||
_p_buffer = _p_buffer + DVDCSS_BLOCK_SIZE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Decrypt the blocks we managed to read */
|
||||
for( i_index = i_ret; i_index; i_index-- )
|
||||
{
|
||||
dvdcss_unscramble( dvdcss->css.p_title_key, _p_buffer );
|
||||
_p_buffer[0x14] &= 0x8f;
|
||||
_p_buffer = _p_buffer + DVDCSS_BLOCK_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
return i_ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Read data from the disc into multiple buffers and decrypt data if
|
||||
* requested.
|
||||
*
|
||||
* \param dvdcss a \e libdvdcss instance
|
||||
* \param p_iovec a pointer to an array of iovec structures that will contain
|
||||
* the data read from the disc
|
||||
* \param i_blocks the amount of blocks to read
|
||||
* \param i_flags #DVDCSS_NOFLAGS, optionally ORed with #DVDCSS_READ_DECRYPT
|
||||
* \return the amount of blocks read or a negative value in case an
|
||||
* error happened.
|
||||
*
|
||||
* Read \p i_blocks logical blocks from the DVD and write them
|
||||
* to an array of iovec structures.
|
||||
*
|
||||
* You typically set \p i_flags to #DVDCSS_NOFLAGS when reading data from a
|
||||
* .IFO file on the DVD.
|
||||
*
|
||||
* If #DVDCSS_READ_DECRYPT is specified in \p i_flags, dvdcss_readv() will
|
||||
* automatically decrypt scrambled sectors. This flag is typically used when
|
||||
* reading data from a .VOB file on the DVD. It has no effect on unscrambled
|
||||
* discs or unscrambled sectors and can be safely used on those.
|
||||
*
|
||||
* \warning dvdcss_readv() expects to be able to write \p i_blocks *
|
||||
* #DVDCSS_BLOCK_SIZE bytes into the buffers pointed by \p p_iovec.
|
||||
* Moreover, all iov_len members of the iovec structures should be
|
||||
* multiples of #DVDCSS_BLOCK_SIZE.
|
||||
*/
|
||||
LIBDVDCSS_EXPORT int dvdcss_readv ( dvdcss_t dvdcss, void *p_iovec,
|
||||
int i_blocks,
|
||||
int i_flags )
|
||||
{
|
||||
struct iovec *_p_iovec = p_iovec;
|
||||
int i_ret, i_index;
|
||||
void *iov_base;
|
||||
size_t iov_len;
|
||||
|
||||
i_ret = dvdcss->pf_readv( dvdcss, _p_iovec, i_blocks );
|
||||
|
||||
if( i_ret <= 0
|
||||
|| !dvdcss->b_scrambled
|
||||
|| !(i_flags & DVDCSS_READ_DECRYPT) )
|
||||
{
|
||||
return i_ret;
|
||||
}
|
||||
|
||||
/* Initialize loop for decryption */
|
||||
iov_base = _p_iovec->iov_base;
|
||||
iov_len = _p_iovec->iov_len;
|
||||
|
||||
/* Decrypt the blocks we managed to read */
|
||||
for( i_index = i_ret; i_index; i_index-- )
|
||||
{
|
||||
/* Check that iov_len is a multiple of 2048 */
|
||||
if( iov_len & 0x7ff )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
while( iov_len == 0 )
|
||||
{
|
||||
_p_iovec++;
|
||||
iov_base = _p_iovec->iov_base;
|
||||
iov_len = _p_iovec->iov_len;
|
||||
}
|
||||
|
||||
dvdcss_unscramble( dvdcss->css.p_title_key, iov_base );
|
||||
((uint8_t*)iov_base)[0x14] &= 0x8f;
|
||||
|
||||
iov_base = (uint8_t*)iov_base + DVDCSS_BLOCK_SIZE;
|
||||
iov_len -= DVDCSS_BLOCK_SIZE;
|
||||
}
|
||||
|
||||
return i_ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Clean up library state and structures.
|
||||
*
|
||||
* \param dvdcss a \e libdvdcss instance
|
||||
* \return zero in case of success, a negative value otherwise.
|
||||
*
|
||||
* Close the DVD device and free all the memory allocated by \e libdvdcss.
|
||||
* On return, the #dvdcss_t is invalidated and may not be used again.
|
||||
*/
|
||||
LIBDVDCSS_EXPORT int dvdcss_close ( dvdcss_t dvdcss )
|
||||
{
|
||||
struct dvd_title *p_title;
|
||||
int i_ret;
|
||||
|
||||
/* Free our list of keys */
|
||||
p_title = dvdcss->p_titles;
|
||||
while( p_title )
|
||||
{
|
||||
struct dvd_title *p_tmptitle = p_title->p_next;
|
||||
free( p_title );
|
||||
p_title = p_tmptitle;
|
||||
}
|
||||
|
||||
i_ret = dvdcss_close_device( dvdcss );
|
||||
|
||||
free( dvdcss->psz_device );
|
||||
free( dvdcss );
|
||||
|
||||
return i_ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Detect whether or not a DVD is scrambled
|
||||
*
|
||||
* \param dvdcss a \e libdvdcss instance.
|
||||
* \return 1 if the DVD is scrambled, 0 otherwise.
|
||||
*/
|
||||
LIBDVDCSS_EXPORT int dvdcss_is_scrambled ( dvdcss_t dvdcss )
|
||||
{
|
||||
return dvdcss->b_scrambled;
|
||||
}
|
88
src/libdvdcss.h
Normal file
88
src/libdvdcss.h
Normal file
|
@ -0,0 +1,88 @@
|
|||
/*****************************************************************************
|
||||
* libdvdcss.h: private DVD reading library data
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1998-2001 VideoLAN
|
||||
*
|
||||
* Authors: Stéphane Borel <stef@via.ecp.fr>
|
||||
* Sam Hocevar <sam@zoy.org>
|
||||
*
|
||||
* libdvdcss 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.
|
||||
*
|
||||
* libdvdcss 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 libdvdcss; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef DVDCSS_LIBDVDCSS_H
|
||||
#define DVDCSS_LIBDVDCSS_H
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include "dvdcss/dvdcss.h"
|
||||
#include "css.h"
|
||||
#include "device.h"
|
||||
|
||||
/*****************************************************************************
|
||||
* libdvdcss method: used like init flags
|
||||
*****************************************************************************/
|
||||
enum dvdcss_method {
|
||||
DVDCSS_METHOD_KEY,
|
||||
DVDCSS_METHOD_DISC,
|
||||
DVDCSS_METHOD_TITLE,
|
||||
};
|
||||
/*****************************************************************************
|
||||
* The libdvdcss structure
|
||||
*****************************************************************************/
|
||||
struct dvdcss_s
|
||||
{
|
||||
/* File descriptor */
|
||||
char * psz_device;
|
||||
int i_fd;
|
||||
int i_pos;
|
||||
|
||||
/* File handling */
|
||||
int ( * pf_seek ) ( dvdcss_t, int );
|
||||
int ( * pf_read ) ( dvdcss_t, void *, int );
|
||||
int ( * pf_readv ) ( dvdcss_t, const struct iovec *, int );
|
||||
|
||||
/* Decryption stuff */
|
||||
enum dvdcss_method i_method;
|
||||
struct css css;
|
||||
int b_ioctls;
|
||||
int b_scrambled;
|
||||
struct dvd_title *p_titles;
|
||||
|
||||
/* Key cache directory and pointer to the filename */
|
||||
char psz_cachefile[PATH_MAX];
|
||||
char * psz_block;
|
||||
|
||||
/* Error management */
|
||||
const char *psz_error;
|
||||
int b_errors;
|
||||
int b_debug;
|
||||
|
||||
#ifdef _WIN32
|
||||
int b_file;
|
||||
char * p_readv_buffer;
|
||||
int i_readv_buf_size;
|
||||
#endif /* _WIN32 */
|
||||
|
||||
void *p_stream;
|
||||
dvdcss_stream_cb *p_stream_cb;
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
* Functions used across the library
|
||||
*****************************************************************************/
|
||||
void print_error ( dvdcss_t, const char *, ... );
|
||||
void print_debug ( const dvdcss_t, const char *, ... );
|
||||
|
||||
#endif /* DVDCSS_LIBDVDCSS_H */
|
10
src/libdvdcss.pc.in
Normal file
10
src/libdvdcss.pc.in
Normal file
|
@ -0,0 +1,10 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: libdvdcss
|
||||
Description: DVD access and decryption library.
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -ldvdcss
|
||||
Cflags: -I${includedir} -I${includedir}/dvdcss
|
126
test/csstest.c
Normal file
126
test/csstest.c
Normal file
|
@ -0,0 +1,126 @@
|
|||
/* csstest.c - test program for libdvdcss
|
||||
*
|
||||
* Sam Hocevar <sam@zoy.org> - June 2001
|
||||
* Updated on Nov 13th 2001 for libdvdcss version 1.0.0
|
||||
* Additional error checks on Aug 9th 2002
|
||||
* Aligned data reads on Jan 28th 2003
|
||||
*
|
||||
* This piece of code is public domain */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <dvdcss/dvdcss.h>
|
||||
|
||||
static int isscrambled( unsigned char * );
|
||||
static void dumpsector ( unsigned char * );
|
||||
|
||||
int main( int i_argc, char *ppsz_argv[] )
|
||||
{
|
||||
dvdcss_t dvdcss;
|
||||
unsigned char p_data[ DVDCSS_BLOCK_SIZE * 2 ];
|
||||
unsigned char *p_buffer;
|
||||
unsigned int i_sector;
|
||||
int i_ret;
|
||||
|
||||
/* Check for 2 arguments */
|
||||
if( i_argc != 3 )
|
||||
{
|
||||
printf( "usage: %s <target> <sector>\n", ppsz_argv[0] );
|
||||
printf( "examples:\n" );
|
||||
printf( " %s /dev/hdc 1024\n", ppsz_argv[0] );
|
||||
printf( " %s D: 1024\n", ppsz_argv[0] );
|
||||
printf( " %s scrambledfile.vob 1024\n", ppsz_argv[0] );
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Save the requested sector */
|
||||
i_sector = atoi( ppsz_argv[2] );
|
||||
|
||||
/* Initialize libdvdcss */
|
||||
dvdcss = dvdcss_open( ppsz_argv[1] );
|
||||
if( dvdcss == NULL )
|
||||
{
|
||||
printf( "argh ! couldn't open DVD (%s)\n", ppsz_argv[1] );
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Align our read buffer */
|
||||
p_buffer = p_data + DVDCSS_BLOCK_SIZE
|
||||
- ((long int)p_data & (DVDCSS_BLOCK_SIZE-1));
|
||||
|
||||
/* Set the file descriptor at sector i_sector and read one sector */
|
||||
i_ret = dvdcss_seek( dvdcss, i_sector, DVDCSS_NOFLAGS );
|
||||
if( i_ret != (int)i_sector )
|
||||
{
|
||||
printf( "seek failed (%s)\n", dvdcss_error( dvdcss ) );
|
||||
dvdcss_close( dvdcss );
|
||||
return i_ret;
|
||||
}
|
||||
|
||||
i_ret = dvdcss_read( dvdcss, p_buffer, 1, DVDCSS_NOFLAGS );
|
||||
if( i_ret != 1 )
|
||||
{
|
||||
printf( "read failed (%s)\n", dvdcss_error( dvdcss ) );
|
||||
dvdcss_close( dvdcss );
|
||||
return i_ret;
|
||||
}
|
||||
|
||||
/* Print the sector */
|
||||
printf( "requested sector: " );
|
||||
dumpsector( p_buffer );
|
||||
|
||||
/* Check if sector was encrypted */
|
||||
if( isscrambled( p_buffer ) )
|
||||
{
|
||||
/* Set the file descriptor position to the previous location */
|
||||
/* ... and get the appropriate key for this sector */
|
||||
i_ret = dvdcss_seek( dvdcss, i_sector, DVDCSS_SEEK_KEY );
|
||||
if( i_ret != (int)i_sector )
|
||||
{
|
||||
printf( "seek failed (%s)\n", dvdcss_error( dvdcss ) );
|
||||
dvdcss_close( dvdcss );
|
||||
return i_ret;
|
||||
}
|
||||
|
||||
/* Read sector again, and decrypt it on the fly */
|
||||
i_ret = dvdcss_read( dvdcss, p_buffer, 1, DVDCSS_READ_DECRYPT );
|
||||
if( i_ret != 1 )
|
||||
{
|
||||
printf( "read failed (%s)\n", dvdcss_error( dvdcss ) );
|
||||
dvdcss_close( dvdcss );
|
||||
return i_ret;
|
||||
}
|
||||
|
||||
/* Print the decrypted sector */
|
||||
printf( "unscrambled sector: " );
|
||||
dumpsector( p_buffer );
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( "sector is not scrambled\n" );
|
||||
}
|
||||
|
||||
/* Close the device */
|
||||
i_ret = dvdcss_close( dvdcss );
|
||||
|
||||
return i_ret;
|
||||
}
|
||||
|
||||
/* Check if a sector is scrambled */
|
||||
static int isscrambled( unsigned char *p_buffer )
|
||||
{
|
||||
return p_buffer[ 0x14 ] & 0x30;
|
||||
}
|
||||
|
||||
/* Print parts of a 2048 bytes buffer */
|
||||
static void dumpsector( unsigned char *p_buffer )
|
||||
{
|
||||
int i_amount = 4;
|
||||
for( ; i_amount ; i_amount--, p_buffer++ ) printf( "%.2x", *p_buffer );
|
||||
printf( "..." );
|
||||
i_amount = 22;
|
||||
p_buffer += 200;
|
||||
for( ; i_amount ; i_amount--, p_buffer++ ) printf( "%.2x", *p_buffer );
|
||||
printf( "...\n" );
|
||||
}
|
297
test/dvd_region.c
Normal file
297
test/dvd_region.c
Normal file
|
@ -0,0 +1,297 @@
|
|||
/*
|
||||
* Set / inspect region settings on a DVD drive. This is most interesting
|
||||
* on a RPC Phase-2 drive, of course.
|
||||
*
|
||||
* Usage: dvd_region [ -d device ] [ [ -s ] [ -r region ] ]
|
||||
*
|
||||
* Based on code from Jens Axboe <axboe@suse.de>.
|
||||
*
|
||||
* FIXME: This code does _not_ work yet.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include <dvdcss/dvdcss.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
#include "ioctl.h"
|
||||
#include "libdvdcss.h"
|
||||
|
||||
/* On non-Linux platforms static functions from ioctl.c are used. */
|
||||
#include "ioctl.c"
|
||||
|
||||
#define DEFAULT_DEVICE "/dev/dvd"
|
||||
|
||||
/*****************************************************************************
|
||||
* ioctl_SendRPC: set RPC status for the drive
|
||||
*****************************************************************************/
|
||||
static int ioctl_SendRPC( int i_fd, int i_pdrc )
|
||||
{
|
||||
int i_ret;
|
||||
|
||||
/* Shut up warnings about unused parameters. */
|
||||
(void)i_fd;
|
||||
(void)i_pdrc;
|
||||
|
||||
#if defined( HAVE_LINUX_DVD_STRUCT ) && defined( DVD_HOST_SEND_RPC_STATE )
|
||||
dvd_authinfo auth_info = { 0 };
|
||||
|
||||
auth_info.type = DVD_HOST_SEND_RPC_STATE;
|
||||
auth_info.hrpcs.pdrc = i_pdrc;
|
||||
|
||||
i_ret = ioctl( i_fd, DVD_AUTH, &auth_info );
|
||||
|
||||
#elif defined( HAVE_LINUX_DVD_STRUCT )
|
||||
/* FIXME: OpenBSD doesn't know this */
|
||||
i_ret = -1;
|
||||
|
||||
#elif defined( HAVE_BSD_DVD_STRUCT )
|
||||
struct dvd_authinfo auth_info = { 0 };
|
||||
|
||||
auth_info.format = DVD_SEND_RPC;
|
||||
auth_info.region = i_pdrc;
|
||||
|
||||
i_ret = ioctl( i_fd, DVDIOCSENDKEY, &auth_info );
|
||||
|
||||
#elif defined( __HAIKU__ )
|
||||
INIT_RDC( GPCMD_SEND_KEY, 8 );
|
||||
|
||||
rdc.command[ 10 ] = DVD_SEND_RPC;
|
||||
|
||||
p_buffer[ 1 ] = 6;
|
||||
p_buffer[ 4 ] = i_pdrc;
|
||||
|
||||
i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
|
||||
|
||||
#elif defined( SOLARIS_USCSI )
|
||||
INIT_USCSI( GPCMD_SEND_KEY, 8 );
|
||||
|
||||
rs_cdb.cdb_opaque[ 10 ] = DVD_SEND_RPC;
|
||||
|
||||
p_buffer[ 1 ] = 6;
|
||||
p_buffer[ 4 ] = i_pdrc;
|
||||
|
||||
i_ret = SolarisSendUSCSI( i_fd, &sc );
|
||||
|
||||
if( i_ret < 0 || sc.uscsi_status )
|
||||
{
|
||||
i_ret = -1;
|
||||
}
|
||||
|
||||
#elif defined( DARWIN_DVD_IOCTL )
|
||||
INIT_DVDIOCTL( dk_dvd_send_key_t, DVDRegionPlaybackControlInfo,
|
||||
kDVDKeyFormatSetRegion );
|
||||
|
||||
dvd.keyClass = kDVDKeyClassCSS_CPPM_CPRM;
|
||||
dvdbs.driveRegion = i_pdrc;
|
||||
|
||||
i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );
|
||||
|
||||
#elif defined( _WIN32 )
|
||||
DWORD tmp;
|
||||
SCSI_PASS_THROUGH_DIRECT sptd = { 0 };
|
||||
uint8_t p_buffer[8];
|
||||
sptd.Length = sizeof( SCSI_PASS_THROUGH_DIRECT );
|
||||
sptd.DataBuffer = p_buffer;
|
||||
sptd.DataTransferLength = sizeof( p_buffer );
|
||||
WinInitSPTD( &sptd, GPCMD_SEND_KEY );
|
||||
|
||||
sptd.Cdb[ 10 ] = DVD_SEND_RPC;
|
||||
|
||||
p_buffer[ 1 ] = 6;
|
||||
p_buffer[ 4 ] = i_pdrc;
|
||||
|
||||
i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_SCSI_PASS_THROUGH_DIRECT,
|
||||
&sptd, sizeof( SCSI_PASS_THROUGH_DIRECT ),
|
||||
&sptd, sizeof( SCSI_PASS_THROUGH_DIRECT ),
|
||||
&tmp, NULL ) ? 0 : -1;
|
||||
|
||||
#elif defined( __QNXNTO__ )
|
||||
|
||||
INIT_CPT( GPCMD_SEND_KEY, 8 );
|
||||
|
||||
p_cpt->cam_cdb[ 10 ] = DVD_SEND_RPC;
|
||||
|
||||
p_buffer[ 1 ] = 6;
|
||||
p_buffer[ 4 ] = i_pdrc;
|
||||
|
||||
i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
|
||||
|
||||
#elif defined( __OS2__ )
|
||||
INIT_SSC( GPCMD_SEND_KEY, 8 );
|
||||
|
||||
sdc.command[ 10 ] = DVD_SEND_RPC;
|
||||
|
||||
p_buffer[ 1 ] = 6;
|
||||
p_buffer[ 4 ] = i_pdrc;
|
||||
|
||||
i_ret = DosDevIOCtl( i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
|
||||
&sdc, sizeof(sdc), &ulParamLen,
|
||||
p_buffer, sizeof(p_buffer), &ulDataLen );
|
||||
|
||||
#else
|
||||
# error "DVD ioctls are unavailable on this system"
|
||||
|
||||
#endif
|
||||
return i_ret;
|
||||
}
|
||||
|
||||
static int set_region(int fd, int region)
|
||||
{
|
||||
int ret, region_mask;
|
||||
|
||||
if(region > 8 || region <= 0) {
|
||||
printf("Invalid region( %d)\n", region);
|
||||
return 1;
|
||||
}
|
||||
printf("Setting drive region can only be done a finite "
|
||||
"number of times, press Ctrl-C now to cancel!\n");
|
||||
/* Discard returned character, just wait for any key as confirmation. */
|
||||
(void) getchar();
|
||||
|
||||
region_mask = 0xff & ~(1 << (region - 1));
|
||||
printf("Setting region to %d( %x)\n", region, region_mask);
|
||||
if( (ret = ioctl_SendRPC(fd, region_mask)) < 0) {
|
||||
perror("dvd_region");
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int print_region(int fd)
|
||||
{
|
||||
int type, region_mask, rpc_scheme;
|
||||
int region = 1;
|
||||
int ret;
|
||||
|
||||
printf("Drive region info:\n");
|
||||
|
||||
if( (ret = ioctl_ReportRPC(fd, &type, ®ion_mask, &rpc_scheme)) < 0) {
|
||||
perror("dvd_region");
|
||||
return ret;
|
||||
}
|
||||
|
||||
printf("Type: ");
|
||||
switch( type ) {
|
||||
case 0:
|
||||
printf("No drive region setting\n");
|
||||
break;
|
||||
case 1:
|
||||
printf("Drive region is set\n");
|
||||
break;
|
||||
case 2:
|
||||
printf("Drive region is set, with additional "
|
||||
"restrictions required to make a change\n");
|
||||
break;
|
||||
case 3:
|
||||
printf("Drive region has been set permanently, but "
|
||||
"may be reset by the vendor if necessary\n");
|
||||
break;
|
||||
default:
|
||||
printf("Invalid( %x)\n", type);
|
||||
break;
|
||||
}
|
||||
|
||||
printf("Region: ");
|
||||
if( region_mask)
|
||||
while(region_mask) {
|
||||
if( !(region_mask & 1) )
|
||||
printf("%d playable\n", region);
|
||||
region++;
|
||||
region_mask >>= 1;
|
||||
}
|
||||
else
|
||||
printf("non-RPC( all)\n");
|
||||
|
||||
printf("RPC Scheme: ");
|
||||
switch( rpc_scheme ) {
|
||||
case 0:
|
||||
printf("The Logical Unit does not enforce Regional "
|
||||
"Playback Control (RPC).\n");
|
||||
break;
|
||||
case 1:
|
||||
printf("The Logical Unit _shall_ adhere to the "
|
||||
"specification and all requirements of the "
|
||||
"Content Scrambling System (CSS) license "
|
||||
"agreement concerning RPC.\n");
|
||||
break;
|
||||
default:
|
||||
printf("Reserved( %x)\n", rpc_scheme);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
fprintf( stderr,
|
||||
"Usage: dvd_region [ -d device ] [ [ -s ] [ -r region ] ]\n" );
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char device_name[FILENAME_MAX], c, set, region = 0;
|
||||
int ret;
|
||||
dvdcss_t dvdcss;
|
||||
|
||||
strcpy(device_name, DEFAULT_DEVICE);
|
||||
set = 0;
|
||||
while( (c = getopt(argc, argv, "d:sr:h?")) != EOF ) {
|
||||
switch( c ) {
|
||||
case 'd':
|
||||
strncpy(device_name, optarg, FILENAME_MAX - 1);
|
||||
break;
|
||||
case 's':
|
||||
set = 1;
|
||||
break;
|
||||
case 'r':
|
||||
region = strtoul(optarg, NULL, 10);
|
||||
printf("region %d\n", region);
|
||||
break;
|
||||
case 'h':
|
||||
case '?':
|
||||
default:
|
||||
usage();
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( optind != argc ) {
|
||||
fprintf(stderr, "Unknown argument\n");
|
||||
usage();
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( !(dvdcss = dvdcss_open(device_name)) ) {
|
||||
usage();
|
||||
return 1;
|
||||
}
|
||||
|
||||
{
|
||||
int copyright;
|
||||
ret = ioctl_ReadCopyright( dvdcss->i_fd, 0, ©right );
|
||||
printf( "ret %d, copyright %d\n", ret, copyright );
|
||||
}
|
||||
|
||||
if( (ret = print_region(dvdcss->i_fd)) < 0 )
|
||||
return ret;
|
||||
|
||||
if( set ) {
|
||||
if( !region ) {
|
||||
fprintf( stderr, "you must specify the region!\n" );
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if( (ret = set_region(dvdcss->i_fd, region)) < 0 )
|
||||
return ret;
|
||||
}
|
||||
|
||||
exit( 0 );
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue