Browse Source

Update License to GPL

Update license to GPL because the used libraries are also GPL

Signed-off-by: Daniel S. <earthnuker@noreply.gitdab.com>

initial commit
main
Daniel S. 9 months ago committed by Daniel Seiller
parent
commit
5543177e5d
  1. 340
      LICENSE
  2. 344
      dvd_reader.h
  3. 38
      dvd_ripper.py
  4. 266
      dvd_types.h
  5. 10
      dvdcss.h
  6. 718
      dvdnav.h
  7. 212
      dvdnav.py
  8. 230
      dvdnav_events.h
  9. 43
      dvdread.py
  10. 173
      ff_d2v.py
  11. 21
      ifo_print.h
  12. 215
      ifo_read.h
  13. 683
      ifo_types.h
  14. 38
      nav_print.h
  15. 40
      nav_read.h
  16. 235
      nav_types.h
  17. 63
      vob_demux.py

340
LICENSE

@ -1,9 +1,339 @@
MIT License
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (c) <year> <copyright holders>
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.
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:
Preamble
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
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.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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.

344
dvd_reader.h

@ -0,0 +1,344 @@
/*
* Copyright (C) 2001, 2002 Billy Biggs <vektor@dumbterm.net>,
* Håkan Hjort <d95hjort@dtek.chalmers.se>,
* Björn Englund <d4bjorn@dtek.chalmers.se>
*
* This file is part of libdvdread.
*
* libdvdread 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.
*
* libdvdread 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 libdvdread; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/**
* The DVD access interface.
*
* This file contains the functions that form the interface to to
* reading files located on a DVD.
*/
/**
* The current version.
*/
/**
* The length of one Logical Block of a DVD.
*/
#define DVD_VIDEO_LB_LEN 2048
/**
* Maximum length of filenames allowed in UDF.
*/
#define MAX_UDF_FILE_NAME_LEN 2048
typedef long int off_t;
/**
* Opaque type that is used as a handle for one instance of an opened DVD.
*/
typedef struct dvd_reader_s dvd_reader_t;
typedef struct dvd_reader_device_s dvd_reader_device_t;
/**
* Opaque type for a file read handle, much like a normal fd or FILE *.
*/
typedef struct dvd_file_s dvd_file_t;
struct dvd_reader_stream_cb
{
int ( *pf_seek ) ( void *p_stream, uint64_t i_pos);
int ( *pf_read ) ( void *p_stream, void* buffer, int i_read);
int ( *pf_readv ) ( void *p_stream, void *p_iovec, int i_blocks);
};
typedef struct dvd_reader_stream_cb dvd_reader_stream_cb;
/**
* Custom logger callback for DVDOpen[Stream]2
* @param private Handle as provided in Open functions
* @param level Log level
* @param fmt Format string
* @param args Arguments list
* pf_log(priv, level, fmt, args);
*/
typedef enum
{
DVD_LOGGER_LEVEL_INFO,
DVD_LOGGER_LEVEL_ERROR,
DVD_LOGGER_LEVEL_WARN,
DVD_LOGGER_LEVEL_DEBUG,
} dvd_logger_level_t;
typedef struct
{
// void ( *pf_log ) ( void *, dvd_logger_level_t, const char *, va_list );
void *pf_log;
} dvd_logger_cb;
/**
* Public type that is used to provide statistics on a handle.
*/
typedef struct {
off_t size; /**< Total size of file in bytes */
int nr_parts; /**< Number of file parts */
off_t parts_size[9]; /**< Size of each part in bytes */
} dvd_stat_t;
/**
* Opens a block device of a DVD-ROM file, or an image file, or a directory
* name for a mounted DVD or HD copy of a DVD.
* The second form of Open function (DVDOpenStream) can be used to
* provide custom stream_cb functions to access the DVD (see libdvdcss).
*
* If the given file is a block device, or is the mountpoint for a block
* device, then that device is used for CSS authentication using libdvdcss.
* If no device is available, then no CSS authentication is performed,
* and we hope that the image is decrypted.
*
* If the path given is a directory, then the files in that directory may be
* in any one of these formats:
*
* path/VIDEO_TS/VTS_01_1.VOB
* path/video_ts/vts_01_1.vob
* path/VTS_01_1.VOB
* path/vts_01_1.vob
*
* @param path Specifies the the device, file or directory to be used.
* @param stream is a private handle used by stream_cb
* @param stream_cb is a struct containing seek and read functions
* @return If successful a a read handle is returned. Otherwise 0 is returned.
*
* dvd = DVDOpen(path);
* dvd = DVDOpenStream(stream, &stream_cb);
*/
dvd_reader_t *DVDOpen( const char * );
dvd_reader_t *DVDOpenStream( void *, dvd_reader_stream_cb * );
/**
* Same as DVDOpen, but with private handle to be passed back on callbacks
*
* @param path Specifies the the device, file or directory to be used.
* @param priv is a private handle
* @param logcb is a custom logger callback struct, or NULL if none needed
* @param stream_cb is a struct containing seek and read functions
* @return If successful a a read handle is returned. Otherwise 0 is returned.
*
* dvd = DVDOpen2(priv, logcb, path);
* dvd = DVDOpenStream2(priv, logcb, &stream_cb);
*/
dvd_reader_t *DVDOpen2( void *, const dvd_logger_cb *, const char * );
dvd_reader_t *DVDOpenStream2( void *, const dvd_logger_cb *, dvd_reader_stream_cb * );
/**
* Closes and cleans up the DVD reader object.
*
* You must close all open files before calling this function.
*
* @param dvd A read handle that should be closed.
*
* DVDClose(dvd);
*/
void DVDClose( dvd_reader_t * );
/**
*
*/
typedef enum {
DVD_READ_INFO_FILE, /**< VIDEO_TS.IFO or VTS_XX_0.IFO (title) */
DVD_READ_INFO_BACKUP_FILE, /**< VIDEO_TS.BUP or VTS_XX_0.BUP (title) */
DVD_READ_MENU_VOBS, /**< VIDEO_TS.VOB or VTS_XX_0.VOB (title) */
DVD_READ_TITLE_VOBS /**< VTS_XX_[1-9].VOB (title). All files in
the title set are opened and read as a
single file. */
} dvd_read_domain_t;
/**
* Stats a file on the DVD given the title number and domain.
* The information about the file is stored in a dvd_stat_t
* which contains information about the size of the file and
* the number of parts in case of a multipart file and the respective
* sizes of the parts.
* A multipart file is for instance VTS_02_1.VOB, VTS_02_2.VOB, VTS_02_3.VOB
* The size of VTS_02_1.VOB will be stored in stat->parts_size[0],
* VTS_02_2.VOB in stat->parts_size[1], ...
* The total size (sum of all parts) is stored in stat->size and
* stat->nr_parts will hold the number of parts.
* Only DVD_READ_TITLE_VOBS (VTS_??_[1-9].VOB) can be multipart files.
*
* This function is only of use if you want to get the size of each file
* in the filesystem. These sizes are not needed to use any other
* functions in libdvdread.
*
* @param dvd A dvd read handle.
* @param titlenum Which Video Title Set should be used, VIDEO_TS is 0.
* @param domain Which domain.
* @param stat Pointer to where the result is stored.
* @return If successful 0, otherwise -1.
*
* int DVDFileStat(dvd, titlenum, domain, stat);
*/
int DVDFileStat(dvd_reader_t *, int, dvd_read_domain_t, dvd_stat_t *);
/**
* Opens a file on the DVD given the title number and domain.
*
* If the title number is 0, the video manager information is opened
* (VIDEO_TS.[IFO,BUP,VOB]). Returns a file structure which may be
* used for reads, or 0 if the file was not found.
*
* @param dvd A dvd read handle.
* @param titlenum Which Video Title Set should be used, VIDEO_TS is 0.
* @param domain Which domain.
* @return If successful a a file read handle is returned, otherwise 0.
*
* dvd_file = DVDOpenFile(dvd, titlenum, domain); */
dvd_file_t *DVDOpenFile( dvd_reader_t *, int, dvd_read_domain_t );
/**
* Closes a file and frees the associated structure.
*
* @param dvd_file The file read handle to be closed.
*
* DVDCloseFile(dvd_file);
*/
void DVDCloseFile( dvd_file_t * );
/**
* Reads block_count number of blocks from the file at the given block offset.
* Returns number of blocks read on success, -1 on error. This call is only
* for reading VOB data, and should not be used when reading the IFO files.
* When reading from an encrypted drive, blocks are decrypted using libdvdcss
* where required.
*
* @param dvd_file A file read handle.
* @param offset Block offset from the start of the file to start reading at.
* @param block_count Number of block to read.
* @param data Pointer to a buffer to write the data into.
* @return Returns number of blocks read on success, -1 on error.
*
* blocks_read = DVDReadBlocks(dvd_file, offset, block_count, data);
*/
ssize_t DVDReadBlocks( dvd_file_t *, int, size_t, unsigned char * );
/**
* Seek to the given position in the file. Returns the resulting position in
* bytes from the beginning of the file. The seek position is only used for
* byte reads from the file, the block read call always reads from the given
* offset.
*
* @param dvd_file A file read handle.
* @param seek_offset Byte offset from the start of the file to seek to.
* @return The resulting position in bytes from the beginning of the file.
*
* offset_set = DVDFileSeek(dvd_file, seek_offset);
*/
int32_t DVDFileSeek( dvd_file_t *, int32_t );
/**
* Reads the given number of bytes from the file. This call can only be used
* on the information files, and may not be used for reading from a VOB. This
* reads from and increments the currrent seek position for the file.
*
* @param dvd_file A file read handle.
* @param data Pointer to a buffer to write the data into.
* @param bytes Number of bytes to read.
* @return Returns number of bytes read on success, -1 on error.
*
* bytes_read = DVDReadBytes(dvd_file, data, bytes);
*/
ssize_t DVDReadBytes( dvd_file_t *, void *, size_t );
/**
* Returns the file size in blocks.
*
* @param dvd_file A file read handle.
* @return The size of the file in blocks, -1 on error.
*
* blocks = DVDFileSize(dvd_file);
*/
ssize_t DVDFileSize( dvd_file_t * );
/**
* Get a unique 128 bit disc ID.
* This is the MD5 sum of VIDEO_TS.IFO and the VTS_0?_0.IFO files
* in title order (those that exist).
* If you need a 'text' representation of the id, print it as a
* hexadecimal number, using lowercase letters, discid[0] first.
* I.e. the same format as the command-line 'md5sum' program uses.
*
* @param dvd A read handle to get the disc ID from
* @param discid The buffer to put the disc ID into. The buffer must
* have room for 128 bits (16 chars).
* @return 0 on success, -1 on error.
*/
int DVDDiscID( dvd_reader_t *, unsigned char * );
/**
* Get the UDF VolumeIdentifier and VolumeSetIdentifier
* from the PrimaryVolumeDescriptor.
*
* @param dvd A read handle to get the disc ID from
* @param volid The buffer to put the VolumeIdentifier into.
* The VolumeIdentifier is latin-1 encoded (8bit unicode)
* null terminated and max 32 bytes (including '\0')
* @param volid_size No more than volid_size bytes will be copied to volid.
* If the VolumeIdentifier is truncated because of this
* it will still be null terminated.
* @param volsetid The buffer to put the VolumeSetIdentifier into.
* The VolumeIdentifier is 128 bytes as
* stored in the UDF PrimaryVolumeDescriptor.
* Note that this is not a null terminated string.
* @param volsetid_size At most volsetid_size bytes will be copied to volsetid.
* @return 0 on success, -1 on error.
*/
int DVDUDFVolumeInfo( dvd_reader_t *, char *, unsigned int,
unsigned char *, unsigned int );
int DVDFileSeekForce( dvd_file_t *, int offset, int force_size);
/**
* Get the ISO9660 VolumeIdentifier and VolumeSetIdentifier
*
* * Only use this function as fallback if DVDUDFVolumeInfo returns 0 *
* * this will happen on a disc mastered only with a iso9660 filesystem *
* * All video DVD discs have UDF filesystem *
*
* @param dvd A read handle to get the disc ID from
* @param volid The buffer to put the VolumeIdentifier into.
* The VolumeIdentifier is coded with '0-9','A-Z','_'
* null terminated and max 33 bytes (including '\0')
* @param volid_size No more than volid_size bytes will be copied to volid.
* If the VolumeIdentifier is truncated because of this
* it will still be null terminated.
* @param volsetid The buffer to put the VolumeSetIdentifier into.
* The VolumeIdentifier is 128 bytes as
* stored in the ISO9660 PrimaryVolumeDescriptor.
* Note that this is not a null terminated string.
* @param volsetid_size At most volsetid_size bytes will be copied to volsetid.
* @return 0 on success, -1 on error.
*/
int DVDISOVolumeInfo( dvd_reader_t *, char *, unsigned int,
unsigned char *, unsigned int );
/**
* Sets the level of caching that is done when reading from a device
*
* @param dvd A read handle to get the disc ID from
* @param level The level of caching wanted.
* -1 - returns the current setting.
* 0 - UDF Cache turned off.
* 1 - (default level) Pointers to IFO files and some data from
* PrimaryVolumeDescriptor are cached.
*
* @return The level of caching.
*/
int DVDUDFCacheLevel( dvd_reader_t *, int );

38
dvd_ripper.py

@ -0,0 +1,38 @@
import cffi
import os
import sys
import time
from dvdnav import DVDNav
from dvdread import DVDRead
import subprocess as SP
import json
from vob_demux import demux
from ff_d2v import make_d2v
def loadlib(dll_path,*includes,**kwargs):
ffi = cffi.FFI()
for include in includes:
ffi.cdef(open(include).read(),kwargs)
return ffi,ffi.dlopen(dll_path)
os.environ["DVDCSS_VERBOSE"]="2"
os.environ["DVDCSS_METHOD"]="disc"
r=DVDRead(sys.argv[1])
out_folder=os.path.join("out","_".join([r.disc_id,r.udf_disc_name or r.iso_disc_name]).replace(" ","_"))
del r
os.makedirs(out_folder,exist_ok=True)
d=DVDNav(sys.argv[1])
for k,v in d.titles.items():
v['duration']=v['duration'].total_seconds()
v['chapters']=[c.total_seconds() for c in v['chapters']]
d.titles[k]=v
with open(os.path.join(out_folder,f"{k}.json"),"w") as fh:
json.dump(v,fh)
for a in range(v['angles']):
a+=1
outfile=os.path.join(out_folder,f"{k}_{a}.vob")
with open(outfile,"wb") as fh:
for block in d.get_blocks(k,a):
fh.write(block)
demux(outfile)
os.unlink(outfile)

266
dvd_types.h

@ -0,0 +1,266 @@
/*
* Copyright (C) 2000, 2001 Björn Englund, Håkan Hjort
*
* This file is part of libdvdnav, a DVD navigation library. It is a modified
* file originally part of the Ogle DVD player project.
*
* libdvdnav 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.
*
* libdvdnav 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 libdvdnav; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
* Various useful structs and enums for DVDs.
*/
/*
* DVD Menu ID
* (see dvdnav_menu_call())
*/
typedef enum {
/* When used in VTS domain, DVD_MENU_Escape behaves like DVD_MENU_Root,
* but from within a menu domain, DVD_MENU_Escape resumes playback. */
DVD_MENU_Escape = 0,
DVD_MENU_Title = 2,
DVD_MENU_Root = 3,
DVD_MENU_Subpicture = 4,
DVD_MENU_Audio = 5,
DVD_MENU_Angle = 6,
DVD_MENU_Part = 7
} DVDMenuID_t;
/* Domain */
typedef enum {
DVD_DOMAIN_FirstPlay = 1, /* First Play Domain */
DVD_DOMAIN_VTSTitle = 2, /* Video Title Set Domain */
DVD_DOMAIN_VMGM = 4, /* Video Manager Domain */
DVD_DOMAIN_VTSMenu = 8 /* Video Title Set Menu Domain */
} DVDDomain_t;
/*
* Structure containing info on highlight areas
* (see dvdnav_get_highlight_area())
*/
typedef struct {
uint32_t palette; /* The CLUT entries for the highlight palette
(4-bits per entry -> 4 entries) */
uint16_t sx,sy,ex,ey; /* The start/end x,y positions */
uint32_t pts; /* Highlight PTS to match with SPU */
/* button number for the SPU decoder/overlaying engine */
uint32_t buttonN;
} dvdnav_highlight_area_t;
/* The audio format */
typedef enum {
DVD_AUDIO_FORMAT_AC3 = 0,
DVD_AUDIO_FORMAT_UNKNOWN_1 = 1,
DVD_AUDIO_FORMAT_MPEG = 2,
DVD_AUDIO_FORMAT_MPEG2_EXT = 3,
DVD_AUDIO_FORMAT_LPCM = 4,
DVD_AUDIO_FORMAT_UNKNOWN_5 = 5,
DVD_AUDIO_FORMAT_DTS = 6,
DVD_AUDIO_FORMAT_SDDS = 7
} DVDAudioFormat_t;
/* the following types are currently unused */
// #if 0
// /* User operation permissions */
// typedef enum {
// UOP_FLAG_TitleOrTimePlay = 0x00000001,
// UOP_FLAG_ChapterSearchOrPlay = 0x00000002,
// UOP_FLAG_TitlePlay = 0x00000004,
// UOP_FLAG_Stop = 0x00000008,
// UOP_FLAG_GoUp = 0x00000010,
// UOP_FLAG_TimeOrChapterSearch = 0x00000020,
// UOP_FLAG_PrevOrTopPGSearch = 0x00000040,
// UOP_FLAG_NextPGSearch = 0x00000080,
// UOP_FLAG_ForwardScan = 0x00000100,
// UOP_FLAG_BackwardScan = 0x00000200,
// UOP_FLAG_TitleMenuCall = 0x00000400,
// UOP_FLAG_RootMenuCall = 0x00000800,
// UOP_FLAG_SubPicMenuCall = 0x00001000,
// UOP_FLAG_AudioMenuCall = 0x00002000,
// UOP_FLAG_AngleMenuCall = 0x00004000,
// UOP_FLAG_ChapterMenuCall = 0x00008000,
// UOP_FLAG_Resume = 0x00010000,
// UOP_FLAG_ButtonSelectOrActivate = 0x00020000,
// UOP_FLAG_StillOff = 0x00040000,
// UOP_FLAG_PauseOn = 0x00080000,
// UOP_FLAG_AudioStreamChange = 0x00100000,
// UOP_FLAG_SubPicStreamChange = 0x00200000,
// UOP_FLAG_AngleChange = 0x00400000,
// UOP_FLAG_KaraokeAudioPresModeChange = 0x00800000,
// UOP_FLAG_VideoPresModeChange = 0x01000000
// } DVDUOP_t;
// /* Parental Level */
// typedef enum {
// DVD_PARENTAL_LEVEL_1 = 1,
// DVD_PARENTAL_LEVEL_2 = 2,
// DVD_PARENTAL_LEVEL_3 = 3,
// DVD_PARENTAL_LEVEL_4 = 4,
// DVD_PARENTAL_LEVEL_5 = 5,
// DVD_PARENTAL_LEVEL_6 = 6,
// DVD_PARENTAL_LEVEL_7 = 7,
// DVD_PARENTAL_LEVEL_8 = 8,
// DVD_PARENTAL_LEVEL_None = 15
// } DVDParentalLevel_t;
// /* Language ID (ISO-639 language code) */
// typedef uint16_t DVDLangID_t;
// /* Country ID (ISO-3166 country code) */
// typedef uint16_t DVDCountryID_t;
// /* Register */
// typedef uint16_t DVDRegister_t;
// typedef enum {
// DVDFalse = 0,
// DVDTrue = 1
// } DVDBool_t;
// typedef DVDRegister_t DVDGPRMArray_t[16];
// typedef DVDRegister_t DVDSPRMArray_t[24];
// /* Navigation */
// typedef int DVDStream_t;
// typedef int DVDPTT_t;
// typedef int DVDTitle_t;
// /* Angle number (1-9 or default?) */
// typedef int DVDAngle_t;
// /* Timecode */
// typedef struct {
// uint8_t Hours;
// uint8_t Minutes;
// uint8_t Seconds;
// uint8_t Frames;
// } DVDTimecode_t;
// /* Subpicture stream number (0-31,62,63) */
// typedef int DVDSubpictureStream_t;
// /* Audio stream number (0-7, 15(none)) */
// typedef int DVDAudioStream_t;
// /* The audio application mode */
// typedef enum {
// DVD_AUDIO_APP_MODE_None = 0,
// DVD_AUDIO_APP_MODE_Karaoke = 1,
// DVD_AUDIO_APP_MODE_Surround = 2,
// DVD_AUDIO_APP_MODE_Other = 3
// } DVDAudioAppMode_t;
// /* Audio language extension */
// typedef enum {
// DVD_AUDIO_LANG_EXT_NotSpecified = 0,
// DVD_AUDIO_LANG_EXT_NormalCaptions = 1,
// DVD_AUDIO_LANG_EXT_VisuallyImpaired = 2,
// DVD_AUDIO_LANG_EXT_DirectorsComments1 = 3,
// DVD_AUDIO_LANG_EXT_DirectorsComments2 = 4
// } DVDAudioLangExt_t;
// /* Subpicture language extension */
// typedef enum {
// DVD_SUBPICTURE_LANG_EXT_NotSpecified = 0,
// DVD_SUBPICTURE_LANG_EXT_NormalCaptions = 1,
// DVD_SUBPICTURE_LANG_EXT_BigCaptions = 2,
// DVD_SUBPICTURE_LANG_EXT_ChildrensCaptions = 3,
// DVD_SUBPICTURE_LANG_EXT_NormalCC = 5,
// DVD_SUBPICTURE_LANG_EXT_BigCC = 6,
// DVD_SUBPICTURE_LANG_EXT_ChildrensCC = 7,
// DVD_SUBPICTURE_LANG_EXT_Forced = 9,
// DVD_SUBPICTURE_LANG_EXT_NormalDirectorsComments = 13,
// DVD_SUBPICTURE_LANG_EXT_BigDirectorsComments = 14,
// DVD_SUBPICTURE_LANG_EXT_ChildrensDirectorsComments = 15,
// } DVDSubpictureLangExt_t;
// /* Karaoke Downmix mode */
// typedef enum {
// DVD_KARAOKE_DOWNMIX_0to0 = 0x0001,
// DVD_KARAOKE_DOWNMIX_1to0 = 0x0002,
// DVD_KARAOKE_DOWNMIX_2to0 = 0x0004,
// DVD_KARAOKE_DOWNMIX_3to0 = 0x0008,
// DVD_KARAOKE_DOWNMIX_4to0 = 0x0010,
// DVD_KARAOKE_DOWNMIX_Lto0 = 0x0020,
// DVD_KARAOKE_DOWNMIX_Rto0 = 0x0040,
// DVD_KARAOKE_DOWNMIX_0to1 = 0x0100,
// DVD_KARAOKE_DOWNMIX_1to1 = 0x0200,
// DVD_KARAOKE_DOWNMIX_2to1 = 0x0400,
// DVD_KARAOKE_DOWNMIX_3to1 = 0x0800,
// DVD_KARAOKE_DOWNMIX_4to1 = 0x1000,
// DVD_KARAOKE_DOWNMIX_Lto1 = 0x2000,
// DVD_KARAOKE_DOWNMIX_Rto1 = 0x4000
// } DVDKaraokeDownmix_t;
// typedef int DVDKaraokeDownmixMask_t;
// /* Display mode */
// typedef enum {
// DVD_DISPLAY_MODE_ContentDefault = 0,
// DVD_DISPLAY_MODE_16x9 = 1,
// DVD_DISPLAY_MODE_4x3PanScan = 2,
// DVD_DISPLAY_MODE_4x3Letterboxed = 3
// } DVDDisplayMode_t;
// /* Audio attributes */
// typedef struct {
// DVDAudioAppMode_t AppMode;
// DVDAudioFormat_t AudioFormat;
// DVDLangID_t Language;
// DVDAudioLangExt_t LanguageExtension;
// DVDBool_t HasMultichannelInfo;
// DVDAudioSampleFreq_t SampleFrequency;
// DVDAudioSampleQuant_t SampleQuantization;
// DVDChannelNumber_t NumberOfChannels;
// } DVDAudioAttributes_t;
// typedef int DVDAudioSampleFreq_t;
// typedef int DVDAudioSampleQuant_t;
// typedef int DVDChannelNumber_t;
// /* Subpicture attributes */
// typedef enum {
// DVD_SUBPICTURE_TYPE_NotSpecified = 0,
// DVD_SUBPICTURE_TYPE_Language = 1,
// DVD_SUBPICTURE_TYPE_Other = 2
// } DVDSubpictureType_t;
// typedef enum {
// DVD_SUBPICTURE_CODING_RunLength = 0,
// DVD_SUBPICTURE_CODING_Extended = 1,
// DVD_SUBPICTURE_CODING_Other = 2
// } DVDSubpictureCoding_t;
// typedef struct {
// DVDSubpictureType_t Type;
// DVDSubpictureCoding_t CodingMode;
// DVDLangID_t Language;
// DVDSubpictureLangExt_t LanguageExtension;
// } DVDSubpictureAttributes_t;
// /* Video attributes */
// typedef struct {
// DVDBool_t PanscanPermitted;
// DVDBool_t LetterboxPermitted;
// int AspectX;
// int AspectY;
// int FrameRate;
// int FrameHeight;
// DVDVideoCompression_t Compression;
// DVDBool_t Line21Field1InGop;
// DVDBool_t Line21Field2InGop;
// int more_to_come;
// } DVDVideoAttributes_t;
// typedef int DVDVideoCompression_t;
// #endif

10
dvdcss.h

@ -0,0 +1,10 @@
typedef struct dvdcss_s * dvdcss_t;
typedef struct dvdcss_stream_cb dvdcss_stream_cb;
dvdcss_t dvdcss_open (const char *psz_target);
dvdcss_t dvdcss_open_stream (void *p_stream, dvdcss_stream_cb *p_stream_cb);
int dvdcss_close (dvdcss_t);
int dvdcss_seek (dvdcss_t, int i_blocks, int i_flags);
int dvdcss_read (dvdcss_t, void *p_buffer, int i_blocks, int i_flags);
int dvdcss_readv(dvdcss_t, void *p_iovec, int i_blocks, int i_flags);
const char* dvdcss_error (const dvdcss_t);
int dvdcss_is_scrambled (dvdcss_t);

718
dvdnav.h

@ -0,0 +1,718 @@
/*
* Copyright (C) 2001 Rich Wareham <richwareham@users.sourceforge.net>
*
* This file is part of libdvdnav, a DVD navigation library.
*
* libdvdnav 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.
*
* libdvdnav 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 libdvdnav; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
* This is the main header file applications should include if they want
* to access dvdnav functionality.
*/
// #include <dvdnav/dvd_types.h>
// #include <dvdread/dvd_reader.h>
// #include <dvdread/nav_types.h>
// #include <dvdread/ifo_types.h> /* For vm_cmd_t */
// #include <dvdnav/dvdnav_events.h>
// #include <stdarg.h>
/*********************************************************************
* dvdnav data types *
*********************************************************************/
/*
* Opaque data-type can be viewed as a 'DVD handle'. You should get
* a pointer to a dvdnav_t from the dvdnav_open() function.
* Never call free() on the pointer, you have to give it back with
* dvdnav_close().
*/
typedef struct dvdnav_s dvdnav_t;
/* Status as reported by most of libdvdnav's functions */
typedef int32_t dvdnav_status_t;
typedef dvd_reader_stream_cb dvdnav_stream_cb;
/*
* Unless otherwise stated, all functions return DVDNAV_STATUS_OK if
* they succeeded, otherwise DVDNAV_STATUS_ERR is returned and the error may
* be obtained by calling dvdnav_err_to_string().
*/
#define DVDNAV_STATUS_ERR 0
#define DVDNAV_STATUS_OK 1
/*********************************************************************
* initialisation & housekeeping functions *
*********************************************************************/
/*
* Logger callback definition
*/
typedef enum
{
DVDNAV_LOGGER_LEVEL_INFO,
DVDNAV_LOGGER_LEVEL_ERROR,
DVDNAV_LOGGER_LEVEL_WARN,
DVDNAV_LOGGER_LEVEL_DEBUG,
} dvdnav_logger_level_t;
typedef struct
{
void *pf_log;
} dvdnav_logger_cb;
/*
* These functions allow you to open a DVD device and associate it
* with a dvdnav_t.
*/
/*
* Attempts to open the DVD drive at the specified path or using external
* seek/read functions (dvdnav_open_stream) and pre-cache the CSS-keys.
* libdvdread is used to access the DVD, so any source supported by libdvdread
* can be given with "path" or "stream_cb". Currently, using dvdnav_open,
* libdvdread can access : DVD drives, DVD image files, DVD file-by-file
* copies. Using dvdnav_open_stream, libdvdread can access any kind of DVD
* storage via custom implementation of seek/read functions.
*
* The resulting dvdnav_t handle will be written to *dest.
*/
dvdnav_status_t dvdnav_open(dvdnav_t **dest, const char *path);
dvdnav_status_t
dvdnav_open_stream(dvdnav_t **dest, void *priv, dvdnav_stream_cb *stream_cb);
dvdnav_status_t dvdnav_open2(dvdnav_t **dest,
void *, const dvdnav_logger_cb *,
const char *path);
dvdnav_status_t dvdnav_open_stream2(dvdnav_t **dest,
void *priv, const dvdnav_logger_cb *,
dvdnav_stream_cb *stream_cb);
dvdnav_status_t dvdnav_dup(dvdnav_t **dest, dvdnav_t *src);
dvdnav_status_t dvdnav_free_dup(dvdnav_t * _this);
/*
* Closes a dvdnav_t previously opened with dvdnav_open(), freeing any
* memory associated with it.
*/
dvdnav_status_t dvdnav_close(dvdnav_t *self);
/*
* Resets the DVD virtual machine and cache buffers.
*/
dvdnav_status_t dvdnav_reset(dvdnav_t *self);
/*
* Fills a pointer with a value pointing to a string describing
* the path associated with an open dvdnav_t. It assigns *path to NULL
* on error.
*/
dvdnav_status_t dvdnav_path(dvdnav_t *self, const char **path);
/*
* Returns a human-readable string describing the last error.
*/
const char* dvdnav_err_to_string(dvdnav_t *self);
const char* dvdnav_version(void);
/*********************************************************************
* changing and reading DVD player characteristics *
*********************************************************************/
/*
* These functions allow you to manipulate the various global characteristics
* of the DVD playback engine.
*/
/*
* Sets the region mask (bit 0 set implies region 1, bit 1 set implies
* region 2, etc) of the virtual machine. Generally you will only need to set
* this if you are playing RCE discs which query the virtual machine as to its
* region setting.
*
* This has _nothing_ to do with the region setting of the DVD drive.
*/
dvdnav_status_t dvdnav_set_region_mask(dvdnav_t *self, int32_t region_mask);
/*
* Returns the region mask (bit 0 set implies region 1, bit 1 set implies
* region 2, etc) of the virtual machine.
*
* This has _nothing_ to do with the region setting of the DVD drive.
*/
dvdnav_status_t dvdnav_get_region_mask(dvdnav_t *self, int32_t *region_mask);
/*
* Specify whether read-ahead caching should be used. You may not want this if your
* decoding engine does its own buffering.
*
* The default read-ahead cache does not use an additional thread for the reading
* (see read_cache.c for a threaded cache, but note that this code is currently
* unmaintained). It prebuffers on VOBU level by reading ahead several buffers
* on every read request. The speed of this prebuffering has been optimized to
* also work on slow DVD drives.
*
* If in addition you want to prevent memcpy's to improve performance, have a look
* at dvdnav_get_next_cache_block().
*/
dvdnav_status_t dvdnav_set_readahead_flag(dvdnav_t *self, int32_t read_ahead_flag);
/*
* Query whether read-ahead caching/buffering will be used.
*/
dvdnav_status_t dvdnav_get_readahead_flag(dvdnav_t *self, int32_t *read_ahead_flag);
/*
* Specify whether the positioning works PGC or PG based.
* Programs (PGs) on DVDs are similar to Chapters and a program chain (PGC)
* usually covers a whole feature. This affects the behaviour of the
* functions dvdnav_get_position() and dvdnav_sector_search(). See there.
* Default is PG based positioning.
*/
dvdnav_status_t dvdnav_set_PGC_positioning_flag(dvdnav_t *self, int32_t pgc_based_flag);
/*
* Query whether positioning is PG or PGC based.
*/
dvdnav_status_t dvdnav_get_PGC_positioning_flag(dvdnav_t *self, int32_t *pgc_based_flag);
/*********************************************************************
* reading data *
*********************************************************************/
/*
* These functions are used to poll the playback engine and actually get data
* off the DVD.
*/
/*
* Attempts to get the next block off the DVD and copies it into the buffer 'buf'.
* If there is any special actions that may need to be performed, the value
* pointed to by 'event' gets set accordingly.
*
* If 'event' is DVDNAV_BLOCK_OK then 'buf' is filled with the next block
* (note that means it has to be at /least/ 2048 bytes big). 'len' is
* then set to 2048.
*
* Otherwise, buf is filled with an appropriate event structure and
* len is set to the length of that structure.
*
* See the dvdnav_events.h header for information on the various events.
*/
dvdnav_status_t dvdnav_get_next_block(dvdnav_t *self, uint8_t *buf,
int32_t *event, int32_t *len);
/*
* This basically does the same as dvdnav_get_next_block. The only difference is
* that it avoids a memcopy, when the requested block was found in the cache.
* In such a case (cache hit) this function will return a different pointer than
* the one handed in, pointing directly into the relevant block in the cache.
* Those pointers must _never_ be freed but instead returned to the library via
* dvdnav_free_cache_block().
*/
dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *self, uint8_t **buf,
int32_t *event, int32_t *len);
/*
* All buffers which came from the internal cache (when dvdnav_get_next_cache_block()
* returned a buffer different from the one handed in) have to be freed with this
* function. Although handing in other buffers not from the cache doesn't cause any harm.
*/
dvdnav_status_t dvdnav_free_cache_block(dvdnav_t *self, unsigned char *buf);
/*
* If we are currently in a still-frame this function skips it.
*
* See also the DVDNAV_STILL_FRAME event.
*/
dvdnav_status_t dvdnav_still_skip(dvdnav_t *self);
/*
* If we are currently in WAIT state, that is: the application is required to
* wait for its fifos to become empty, calling this signals libdvdnav that this
* is achieved and that it can continue.
*
* See also the DVDNAV_WAIT event.
*/
dvdnav_status_t dvdnav_wait_skip(dvdnav_t *self);
/*
* Returns the still time from the currently playing cell.
* The still time is given in seconds with 0xff meaning an indefinite still.
*
* This function can be used to detect still frames before they are reached.
* Some players might need this to prepare for a frame to be shown for a
* longer time than usual.
*/
uint32_t dvdnav_get_next_still_flag(dvdnav_t *self);
/*
* Stops playback. The next event obtained with one of the get_next_block
* functions will be a DVDNAV_STOP event.
*
* It is not required to call this before dvdnav_close().
*/
dvdnav_status_t dvdnav_stop(dvdnav_t *self);
/*********************************************************************
* title/part navigation *
*********************************************************************/
/*
* Returns the number of titles on the disk.
*/
dvdnav_status_t dvdnav_get_number_of_titles(dvdnav_t *self, int32_t *titles);
/*
* Returns the number of parts within the given title.
*/
dvdnav_status_t dvdnav_get_number_of_parts(dvdnav_t *self, int32_t title, int32_t *parts);
/*
* Returns the number of angles for the given title.
*/
dvdnav_status_t dvdnav_get_number_of_angles(dvdnav_t *self, int32_t title, int32_t *angles);
/*
* Plays the specified title of the DVD from its beginning (that is: part 1).
*/
dvdnav_status_t dvdnav_title_play(dvdnav_t *self, int32_t title);
/*
* Plays the specified title, starting from the specified part.
*/
dvdnav_status_t dvdnav_part_play(dvdnav_t *self, int32_t title, int32_t part);
/*
* Plays the specified title, starting from the specified program
*/
dvdnav_status_t dvdnav_program_play(dvdnav_t *self, int32_t title, int32_t pgcn, int32_t pgn);
/*
* Stores in *times an array (that the application *must* free) of
* dvdtimes corresponding to the chapter times for the chosen title.
* *duration will have the duration of the title
* The number of entries in *times is the result of the function.
* On error *times is NULL and the output is 0
*/
uint32_t dvdnav_describe_title_chapters(dvdnav_t *self, int32_t title, uint64_t **times, uint64_t *duration);
/*
* Play the specified amount of parts of the specified title of
* the DVD then STOP.
*
* Currently unimplemented!
*/
dvdnav_status_t dvdnav_part_play_auto_stop(dvdnav_t *self, int32_t title,
int32_t part, int32_t parts_to_play);
/*
* Play the specified title starting from the specified time.
*
* Currently unimplemented!
*/
dvdnav_status_t dvdnav_time_play(dvdnav_t *self, int32_t title,
uint64_t time);
/*
* Stop playing the current position and jump to the specified menu.
*
* See also DVDMenuID_t from libdvdread
*/
dvdnav_status_t dvdnav_menu_call(dvdnav_t *self, DVDMenuID_t menu);
/*
* Return the title number and part currently being played.
* A title of 0 indicates we are in a menu. In this case, part
* is set to the current menu's ID.
*/
dvdnav_status_t dvdnav_current_title_info(dvdnav_t *self, int32_t *title,
int32_t *part);
/*
* Return the title number, pgcn and pgn currently being played.
* A title of 0 indicates, we are in a menu.
*/
dvdnav_status_t dvdnav_current_title_program(dvdnav_t *self, int32_t *title,
int32_t *pgcn, int32_t *pgn);
/*
* Return the current position (in blocks) within the current
* title and the length (in blocks) of said title.
*
* Current implementation is wrong and likely to behave unpredictably!
* Use is discouraged!
*/
dvdnav_status_t dvdnav_get_position_in_title(dvdnav_t *self,
uint32_t *pos,
uint32_t *len);
/*
* This function is only available for compatibility reasons.
*
* Stop playing the current position and start playback of the current title
* from the specified part.
*/
dvdnav_status_t dvdnav_part_search(dvdnav_t *self, int32_t part);
/*********************************************************************
* program chain/program navigation *
*********************************************************************/
/*
* Stop playing the current position and start playback from the last
* VOBU boundary before the given sector. The sector number is not
* meant to be an absolute physical DVD sector, but a relative sector
* in the current program. This function cannot leave the current
* program and will fail if asked to do so.
*
* If program chain based positioning is enabled
* (see dvdnav_set_PGC_positioning_flag()), this will seek to the relative
* sector inside the current program chain.
*
* 'origin' can be one of SEEK_SET, SEEK_CUR, SEEK_END as defined in
* fcntl.h.
*/
dvdnav_status_t dvdnav_sector_search(dvdnav_t *self,
int64_t offset, int32_t origin);
/*
returns the current stream time in PTS ticks as reported by the IFO structures
divide it by 90000 to get the current play time in seconds
*/
int64_t dvdnav_get_current_time(dvdnav_t *self);
/*
* Stop playing the current position and start playback of the title
* from the specified timecode.
*
* Currently implemented using interpolation. That interpolation is slightly
* inaccurate.
*/
dvdnav_status_t dvdnav_time_search(dvdnav_t *self,
uint64_t time);
/*
* Stop playing current position and play the "GoUp"-program chain.
* (which generally leads to the title menu or a higher-level menu).
*/