# HG changeset patch # User reimar # Date 1230648526 0 # Node ID 9c5aef10d165736f01a9175ed037537682e47a6c # Parent 0ac6f0d242bc293bde4b579dc3cd96cfa950b208 Move dvd_types.h, dvdnav_events.h and dvdnav.h into a dvdnav directory. This allows getting rid of the DVDNAV_COMPILE define hack and makes it easier to use the library without installing or integrating the source into some other project directly. diff -r 0ac6f0d242bc -r 9c5aef10d165 Makefile.am --- a/Makefile.am Thu Oct 09 22:20:36 2008 +0000 +++ b/Makefile.am Tue Dec 30 14:48:46 2008 +0000 @@ -4,7 +4,7 @@ includedir = ${prefix}/include/dvdnav -AM_CPPFLAGS = -DDVDNAV_COMPILE $(THREAD_CFLAGS) $(DVDREAD_CFLAGS) \ +AM_CPPFLAGS = $(THREAD_CFLAGS) $(DVDREAD_CFLAGS) \ -I$(top_srcdir)/src/vm EXTRA_DIST = README.MAP FELLOWSHIP.map @@ -31,4 +31,4 @@ libdvdnavmini_la_LDFLAGS = $(libdvdnav_la_LDFLAGS) -include_HEADERS = dvdnav.h dvdnav_events.h dvd_types.h +include_HEADERS = dvdnav/dvdnav.h dvdnav/dvdnav_events.h dvdnav/dvd_types.h diff -r 0ac6f0d242bc -r 9c5aef10d165 dvd_types.h --- a/dvd_types.h Thu Oct 09 22:20:36 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,275 +0,0 @@ -/* - * 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. - */ - -#ifndef LIBDVDNAV_DVD_TYPES_H -#define LIBDVDNAV_DVD_TYPES_H - -/* - * 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; - - -/* - * 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 following types are currently unused */ - -#if 0 - -/* Domain */ -typedef enum { - DVD_DOMAIN_FirstPlay, /* First Play Domain */ - DVD_DOMAIN_VMG, /* Video Manager Domain */ - DVD_DOMAIN_VTSMenu, /* Video Title Set Menu Domain */ - DVD_DOMAIN_VTSTitle, /* Video Title Set Domain */ - DVD_DOMAIN_Stop /* Stop Domain */ -} DVDDomain_t; - -/* 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; - -/* The audio format */ -typedef enum { - DVD_AUDIO_FORMAT_AC3 = 0, - DVD_AUDIO_FORMAT_MPEG1 = 1, - DVD_AUDIO_FORMAT_MPEG1_DRC = 2, - DVD_AUDIO_FORMAT_MPEG2 = 3, - DVD_AUDIO_FORMAT_MPEG2_DRC = 4, - DVD_AUDIO_FORMAT_LPCM = 5, - DVD_AUDIO_FORMAT_DTS = 6, - DVD_AUDIO_FORMAT_SDDS = 7, - DVD_AUDIO_FORMAT_Other = 8 -} DVDAudioFormat_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 - -#endif /* LIBDVDNAV_DVD_TYPES_H */ diff -r 0ac6f0d242bc -r 9c5aef10d165 dvdnav.c --- a/dvdnav.c Thu Oct 09 22:20:36 2008 +0000 +++ b/dvdnav.c Tue Dec 30 14:48:46 2008 +0000 @@ -33,15 +33,13 @@ #include #include #include -#include "dvd_types.h" +#include "dvdnav/dvdnav.h" #include #include #include /* For vm_cmd_t */ #include "remap.h" #include "vm/decoder.h" #include "vm/vm.h" -#include "dvdnav.h" -#include "dvdnav_events.h" #include "dvdnav_internal.h" #include "read_cache.h" #include diff -r 0ac6f0d242bc -r 9c5aef10d165 dvdnav.h --- a/dvdnav.h Thu Oct 09 22:20:36 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,681 +0,0 @@ -/* - * Copyright (C) 2001 Rich Wareham - * - * 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. - */ - -#ifndef LIBDVDNAV_DVDNAV_H -#define LIBDVDNAV_DVDNAV_H - -#define MP_DVDNAV 1 - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef DVDNAV_COMPILE -# include -# include -# include -# include /* For vm_cmd_t */ -# include -#endif - - - -/********************************************************************* - * 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; - -/* - * 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 - -#define DVDNAV_FORMAT_AC3 0 -#define DVDNAV_FORMAT_MPEGAUDIO 3 -#define DVDNAV_FORMAT_LPCM 4 -#define DVDNAV_FORMAT_DTS 5 -#define DVDNAV_FORMAT_SDDS 6 - -/********************************************************************* - * initialisation & housekeeping functions * - *********************************************************************/ - -/* - * 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 and pre-cache - * the CSS-keys. libdvdread is used to access the DVD, so any source - * supported by libdvdread can be given with "path". Currently, - * libdvdread can access: DVD drives, DVD image files, DVD file-by-file - * copies. - * - * The resulting dvdnav_t handle will be written to *dest. - */ -dvdnav_status_t dvdnav_open(dvdnav_t **dest, const char *path); - -/* - * 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); - - -/********************************************************************* - * 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 enginge 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. - * I 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); - -/* - * 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); - -/* - * 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 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, - uint64_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 unimplemented! - */ -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 higer-level menu). - */ -dvdnav_status_t dvdnav_go_up(dvdnav_t *self); - -/* - * Stop playing the current position and start playback at the - * previous program (if it exists). - */ -dvdnav_status_t dvdnav_prev_pg_search(dvdnav_t *self); - -/* - * Stop playing the current position and start playback at the - * first program. - */ -dvdnav_status_t dvdnav_top_pg_search(dvdnav_t *self); - -/* - * Stop playing the current position and start playback at the - * next program (if it exists). - */ -dvdnav_status_t dvdnav_next_pg_search(dvdnav_t *self); - -/* - * Return the current position (in blocks) within the current - * program and the length (in blocks) of current program. - * - * If program chain based positioning is enabled - * (see dvdnav_set_PGC_positioning_flag()), this will return the - * relative position in and the length of the current program chain. - */ -dvdnav_status_t dvdnav_get_position(dvdnav_t *self, uint32_t *pos, - uint32_t *len); - - -/********************************************************************* - * menu highlights * - *********************************************************************/ - -/* - * Most functions related to highlights take a NAV PCI packet as a parameter. - * While you can get the such a packet from libdvdnav, for players with internal - * FIFOs, this will result in errors, because due to the FIFO length, libdvdnav will - * be ahead in the stream compared to what the user is seeing on screen. - * Therefore, player applications who have a NAV packet available, which is - * better in sync with the actual playback should always pass this one to these - * functions. - */ - -/* - * Get the currently highlighted button - * number (1..36) or 0 if no button is highlighted. - */ -dvdnav_status_t dvdnav_get_current_highlight(dvdnav_t *self, int32_t *button); - -/* - * Returns the Presentation Control Information (PCI) structure associated - * with the current position. - * - * Read the general notes above. - * See also libdvdreads nav_types.h for definition of pci_t. - */ -pci_t* dvdnav_get_current_nav_pci(dvdnav_t *self); - -/* - * Returns the DSI (data search information) structure associated - * with the current position. - * - * Read the general notes above. - * See also libdvdreads nav_types.h for definition of dsi_t. - */ -dsi_t* dvdnav_get_current_nav_dsi(dvdnav_t *self); - -/* - * Get the area associated with a certain button. - */ -dvdnav_status_t dvdnav_get_highlight_area(pci_t *nav_pci , int32_t button, int32_t mode, - dvdnav_highlight_area_t *highlight); - -/* - * Move button highlight around as suggested by function name (e.g. with arrow keys). - */ -dvdnav_status_t dvdnav_upper_button_select(dvdnav_t *self, pci_t *pci); -dvdnav_status_t dvdnav_lower_button_select(dvdnav_t *self, pci_t *pci); -dvdnav_status_t dvdnav_right_button_select(dvdnav_t *self, pci_t *pci); -dvdnav_status_t dvdnav_left_button_select(dvdnav_t *self, pci_t *pci); - -/* - * Activate ("press") the currently highlighted button. - */ -dvdnav_status_t dvdnav_button_activate(dvdnav_t *self, pci_t *pci); - -/* - * Highlight a specific button. - */ -dvdnav_status_t dvdnav_button_select(dvdnav_t *self, pci_t *pci, int32_t button); - -/* - * Activate ("press") specified button. - */ -dvdnav_status_t dvdnav_button_select_and_activate(dvdnav_t *self, pci_t *pci, int32_t button); - -/* - * Activate (press) a button and execute specified command. - */ -dvdnav_status_t dvdnav_button_activate_cmd(dvdnav_t *self, int32_t button, vm_cmd_t *cmd); - -/* - * Select button at specified video frame coordinates. - */ -dvdnav_status_t dvdnav_mouse_select(dvdnav_t *self, pci_t *pci, int32_t x, int32_t y); - -/* - * Activate ("press") button at specified video frame coordinates. - */ -dvdnav_status_t dvdnav_mouse_activate(dvdnav_t *self, pci_t *pci, int32_t x, int32_t y); - - -/********************************************************************* - * languages * - *********************************************************************/ - -/* - * The language codes expected by these functions are two character - * codes as defined in ISO639. - */ - -/* - * Set which menu language we should use per default. - */ -dvdnav_status_t dvdnav_menu_language_select(dvdnav_t *self, - char *code); - -/* - * Set which audio language we should use per default. - */ -dvdnav_status_t dvdnav_audio_language_select(dvdnav_t *self, - char *code); - -/* - * Set which spu language we should use per default. - */ -dvdnav_status_t dvdnav_spu_language_select(dvdnav_t *self, - char *code); - - -/********************************************************************* - * obtaining stream attributes * - *********************************************************************/ - -/* - * Return a string describing the title of the DVD. - * This is an ID string encoded on the disc by the author. In many cases - * this is a descriptive string such as `THE_MATRIX' but sometimes is sigularly - * uninformative such as `PDVD-011421'. Some DVD authors even forget to set this, - * so you may also read the default of the authoring software they used, like - * `DVDVolume'. - */ -dvdnav_status_t dvdnav_get_title_string(dvdnav_t *self, const char **title_str); - -/* - * Get video aspect code. - * The aspect code does only change on VTS boundaries. - * See the DVDNAV_VTS_CHANGE event. - * - * 0 -- 4:3, 2 -- 16:9 - */ -uint8_t dvdnav_get_video_aspect(dvdnav_t *self); - -/* - * Get video scaling permissions. - * The scaling permission does only change on VTS boundaries. - * See the DVDNAV_VTS_CHANGE event. - * - * bit0 set = deny letterboxing, bit1 set = deny pan&scan - */ -uint8_t dvdnav_get_video_scale_permission(dvdnav_t *self); - -/* - * Converts a *logical* audio stream id into language code - * (returns 0xffff if no such stream). - */ -uint16_t dvdnav_audio_stream_to_lang(dvdnav_t *self, uint8_t stream); - -/* - * Returns the format of *logical* audio stream 'stream' - * (returns 0xffff if no such stream). - */ -uint16_t dvdnav_audio_stream_format(dvdnav_t *self, uint8_t stream); - -/* - * Returns number of channelsn in *logical* audio stream 'stream' - * (returns 0xffff if no such stream). - */ -uint16_t dvdnav_audio_stream_channels(dvdnav_t *self, uint8_t stream); - -/* - * Converts a *logical* subpicture stream id into country code - * (returns 0xffff if no such stream). - */ -uint16_t dvdnav_spu_stream_to_lang(dvdnav_t *self, uint8_t stream); - -/* - * Converts a *physical* (MPEG) audio stream id into a logical stream number. - */ -int8_t dvdnav_get_audio_logical_stream(dvdnav_t *self, uint8_t audio_num); - -#define HAVE_GET_AUDIO_ATTR -/* - * Get audio attr - */ -dvdnav_status_t dvdnav_get_audio_attr(dvdnav_t *self, uint8_t audio_mum, audio_attr_t *audio_attr); - -/* - * Converts a *physical* (MPEG) subpicture stream id into a logical stream number. - */ -int8_t dvdnav_get_spu_logical_stream(dvdnav_t *self, uint8_t subp_num); - -#define HAVE_GET_SPU_ATTR -/* - * Get spu attr - */ -dvdnav_status_t dvdnav_get_spu_attr(dvdnav_t *self, uint8_t audio_mum, subp_attr_t *subp_attr); - -/* - * Get active audio stream. - */ -int8_t dvdnav_get_active_audio_stream(dvdnav_t *self); - -/* - * Get active spu stream. - */ -int8_t dvdnav_get_active_spu_stream(dvdnav_t *self); - -/* - * Get the set of user operations that are currently prohibited. - * There are potentially new restrictions right after - * DVDNAV_CHANNEL_HOP and DVDNAV_NAV_PACKET. - */ -user_ops_t dvdnav_get_restrictions(dvdnav_t *self); - - -/********************************************************************* - * multiple angles * - *********************************************************************/ - -/* - * The libdvdnav library abstracts away the difference between seamless and - * non-seamless angles. From the point of view of the programmer you just set the - * angle number and all is well in the world. You will always see only the - * selected angle coming from the get_next_block functions. - * - * Note: - * It is quite possible that some tremendously strange DVD feature might change the - * angle number from under you. Generally you should always view the results from - * dvdnav_get_angle_info() as definitive only up to the next time you call - * dvdnav_get_next_block(). - */ - -/* - * Sets the current angle. If you try to follow a non existant angle - * the call fails. - */ -dvdnav_status_t dvdnav_angle_change(dvdnav_t *self, int32_t angle); - -/* - * Returns the current angle and number of angles present. - */ -dvdnav_status_t dvdnav_get_angle_info(dvdnav_t *self, int32_t *current_angle, - int32_t *number_of_angles); - -/********************************************************************* - * domain queries * - *********************************************************************/ - -/* - * Are we in the First Play domain? - */ -int8_t dvdnav_is_domain_fp(dvdnav_t *self); - -/* - * Are we in the Video management Menu domain? - */ -int8_t dvdnav_is_domain_vmgm(dvdnav_t *self); - -/* - * Are we in the Video Title Menu domain? - */ -int8_t dvdnav_is_domain_vtsm(dvdnav_t *self); - -/* - * Are we in the Video Title Set domain? - */ -int8_t dvdnav_is_domain_vts(dvdnav_t *self); - - -#ifdef __cplusplus -} -#endif - -#endif /* LIBDVDNAV_DVDNAV_H */ diff -r 0ac6f0d242bc -r 9c5aef10d165 dvdnav/dvd_types.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dvdnav/dvd_types.h Tue Dec 30 14:48:46 2008 +0000 @@ -0,0 +1,275 @@ +/* + * 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. + */ + +#ifndef LIBDVDNAV_DVD_TYPES_H +#define LIBDVDNAV_DVD_TYPES_H + +/* + * 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; + + +/* + * 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 following types are currently unused */ + +#if 0 + +/* Domain */ +typedef enum { + DVD_DOMAIN_FirstPlay, /* First Play Domain */ + DVD_DOMAIN_VMG, /* Video Manager Domain */ + DVD_DOMAIN_VTSMenu, /* Video Title Set Menu Domain */ + DVD_DOMAIN_VTSTitle, /* Video Title Set Domain */ + DVD_DOMAIN_Stop /* Stop Domain */ +} DVDDomain_t; + +/* 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; + +/* The audio format */ +typedef enum { + DVD_AUDIO_FORMAT_AC3 = 0, + DVD_AUDIO_FORMAT_MPEG1 = 1, + DVD_AUDIO_FORMAT_MPEG1_DRC = 2, + DVD_AUDIO_FORMAT_MPEG2 = 3, + DVD_AUDIO_FORMAT_MPEG2_DRC = 4, + DVD_AUDIO_FORMAT_LPCM = 5, + DVD_AUDIO_FORMAT_DTS = 6, + DVD_AUDIO_FORMAT_SDDS = 7, + DVD_AUDIO_FORMAT_Other = 8 +} DVDAudioFormat_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 + +#endif /* LIBDVDNAV_DVD_TYPES_H */ diff -r 0ac6f0d242bc -r 9c5aef10d165 dvdnav/dvdnav.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dvdnav/dvdnav.h Tue Dec 30 14:48:46 2008 +0000 @@ -0,0 +1,679 @@ +/* + * Copyright (C) 2001 Rich Wareham + * + * 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. + */ + +#ifndef LIBDVDNAV_DVDNAV_H +#define LIBDVDNAV_DVDNAV_H + +#define MP_DVDNAV 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include /* For vm_cmd_t */ +#include + + + +/********************************************************************* + * 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; + +/* + * 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 + +#define DVDNAV_FORMAT_AC3 0 +#define DVDNAV_FORMAT_MPEGAUDIO 3 +#define DVDNAV_FORMAT_LPCM 4 +#define DVDNAV_FORMAT_DTS 5 +#define DVDNAV_FORMAT_SDDS 6 + +/********************************************************************* + * initialisation & housekeeping functions * + *********************************************************************/ + +/* + * 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 and pre-cache + * the CSS-keys. libdvdread is used to access the DVD, so any source + * supported by libdvdread can be given with "path". Currently, + * libdvdread can access: DVD drives, DVD image files, DVD file-by-file + * copies. + * + * The resulting dvdnav_t handle will be written to *dest. + */ +dvdnav_status_t dvdnav_open(dvdnav_t **dest, const char *path); + +/* + * 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); + + +/********************************************************************* + * 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 enginge 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. + * I 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); + +/* + * 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); + +/* + * 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 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, + uint64_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 unimplemented! + */ +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 higer-level menu). + */ +dvdnav_status_t dvdnav_go_up(dvdnav_t *self); + +/* + * Stop playing the current position and start playback at the + * previous program (if it exists). + */ +dvdnav_status_t dvdnav_prev_pg_search(dvdnav_t *self); + +/* + * Stop playing the current position and start playback at the + * first program. + */ +dvdnav_status_t dvdnav_top_pg_search(dvdnav_t *self); + +/* + * Stop playing the current position and start playback at the + * next program (if it exists). + */ +dvdnav_status_t dvdnav_next_pg_search(dvdnav_t *self); + +/* + * Return the current position (in blocks) within the current + * program and the length (in blocks) of current program. + * + * If program chain based positioning is enabled + * (see dvdnav_set_PGC_positioning_flag()), this will return the + * relative position in and the length of the current program chain. + */ +dvdnav_status_t dvdnav_get_position(dvdnav_t *self, uint32_t *pos, + uint32_t *len); + + +/********************************************************************* + * menu highlights * + *********************************************************************/ + +/* + * Most functions related to highlights take a NAV PCI packet as a parameter. + * While you can get the such a packet from libdvdnav, for players with internal + * FIFOs, this will result in errors, because due to the FIFO length, libdvdnav will + * be ahead in the stream compared to what the user is seeing on screen. + * Therefore, player applications who have a NAV packet available, which is + * better in sync with the actual playback should always pass this one to these + * functions. + */ + +/* + * Get the currently highlighted button + * number (1..36) or 0 if no button is highlighted. + */ +dvdnav_status_t dvdnav_get_current_highlight(dvdnav_t *self, int32_t *button); + +/* + * Returns the Presentation Control Information (PCI) structure associated + * with the current position. + * + * Read the general notes above. + * See also libdvdreads nav_types.h for definition of pci_t. + */ +pci_t* dvdnav_get_current_nav_pci(dvdnav_t *self); + +/* + * Returns the DSI (data search information) structure associated + * with the current position. + * + * Read the general notes above. + * See also libdvdreads nav_types.h for definition of dsi_t. + */ +dsi_t* dvdnav_get_current_nav_dsi(dvdnav_t *self); + +/* + * Get the area associated with a certain button. + */ +dvdnav_status_t dvdnav_get_highlight_area(pci_t *nav_pci , int32_t button, int32_t mode, + dvdnav_highlight_area_t *highlight); + +/* + * Move button highlight around as suggested by function name (e.g. with arrow keys). + */ +dvdnav_status_t dvdnav_upper_button_select(dvdnav_t *self, pci_t *pci); +dvdnav_status_t dvdnav_lower_button_select(dvdnav_t *self, pci_t *pci); +dvdnav_status_t dvdnav_right_button_select(dvdnav_t *self, pci_t *pci); +dvdnav_status_t dvdnav_left_button_select(dvdnav_t *self, pci_t *pci); + +/* + * Activate ("press") the currently highlighted button. + */ +dvdnav_status_t dvdnav_button_activate(dvdnav_t *self, pci_t *pci); + +/* + * Highlight a specific button. + */ +dvdnav_status_t dvdnav_button_select(dvdnav_t *self, pci_t *pci, int32_t button); + +/* + * Activate ("press") specified button. + */ +dvdnav_status_t dvdnav_button_select_and_activate(dvdnav_t *self, pci_t *pci, int32_t button); + +/* + * Activate (press) a button and execute specified command. + */ +dvdnav_status_t dvdnav_button_activate_cmd(dvdnav_t *self, int32_t button, vm_cmd_t *cmd); + +/* + * Select button at specified video frame coordinates. + */ +dvdnav_status_t dvdnav_mouse_select(dvdnav_t *self, pci_t *pci, int32_t x, int32_t y); + +/* + * Activate ("press") button at specified video frame coordinates. + */ +dvdnav_status_t dvdnav_mouse_activate(dvdnav_t *self, pci_t *pci, int32_t x, int32_t y); + + +/********************************************************************* + * languages * + *********************************************************************/ + +/* + * The language codes expected by these functions are two character + * codes as defined in ISO639. + */ + +/* + * Set which menu language we should use per default. + */ +dvdnav_status_t dvdnav_menu_language_select(dvdnav_t *self, + char *code); + +/* + * Set which audio language we should use per default. + */ +dvdnav_status_t dvdnav_audio_language_select(dvdnav_t *self, + char *code); + +/* + * Set which spu language we should use per default. + */ +dvdnav_status_t dvdnav_spu_language_select(dvdnav_t *self, + char *code); + + +/********************************************************************* + * obtaining stream attributes * + *********************************************************************/ + +/* + * Return a string describing the title of the DVD. + * This is an ID string encoded on the disc by the author. In many cases + * this is a descriptive string such as `THE_MATRIX' but sometimes is sigularly + * uninformative such as `PDVD-011421'. Some DVD authors even forget to set this, + * so you may also read the default of the authoring software they used, like + * `DVDVolume'. + */ +dvdnav_status_t dvdnav_get_title_string(dvdnav_t *self, const char **title_str); + +/* + * Get video aspect code. + * The aspect code does only change on VTS boundaries. + * See the DVDNAV_VTS_CHANGE event. + * + * 0 -- 4:3, 2 -- 16:9 + */ +uint8_t dvdnav_get_video_aspect(dvdnav_t *self); + +/* + * Get video scaling permissions. + * The scaling permission does only change on VTS boundaries. + * See the DVDNAV_VTS_CHANGE event. + * + * bit0 set = deny letterboxing, bit1 set = deny pan&scan + */ +uint8_t dvdnav_get_video_scale_permission(dvdnav_t *self); + +/* + * Converts a *logical* audio stream id into language code + * (returns 0xffff if no such stream). + */ +uint16_t dvdnav_audio_stream_to_lang(dvdnav_t *self, uint8_t stream); + +/* + * Returns the format of *logical* audio stream 'stream' + * (returns 0xffff if no such stream). + */ +uint16_t dvdnav_audio_stream_format(dvdnav_t *self, uint8_t stream); + +/* + * Returns number of channelsn in *logical* audio stream 'stream' + * (returns 0xffff if no such stream). + */ +uint16_t dvdnav_audio_stream_channels(dvdnav_t *self, uint8_t stream); + +/* + * Converts a *logical* subpicture stream id into country code + * (returns 0xffff if no such stream). + */ +uint16_t dvdnav_spu_stream_to_lang(dvdnav_t *self, uint8_t stream); + +/* + * Converts a *physical* (MPEG) audio stream id into a logical stream number. + */ +int8_t dvdnav_get_audio_logical_stream(dvdnav_t *self, uint8_t audio_num); + +#define HAVE_GET_AUDIO_ATTR +/* + * Get audio attr + */ +dvdnav_status_t dvdnav_get_audio_attr(dvdnav_t *self, uint8_t audio_mum, audio_attr_t *audio_attr); + +/* + * Converts a *physical* (MPEG) subpicture stream id into a logical stream number. + */ +int8_t dvdnav_get_spu_logical_stream(dvdnav_t *self, uint8_t subp_num); + +#define HAVE_GET_SPU_ATTR +/* + * Get spu attr + */ +dvdnav_status_t dvdnav_get_spu_attr(dvdnav_t *self, uint8_t audio_mum, subp_attr_t *subp_attr); + +/* + * Get active audio stream. + */ +int8_t dvdnav_get_active_audio_stream(dvdnav_t *self); + +/* + * Get active spu stream. + */ +int8_t dvdnav_get_active_spu_stream(dvdnav_t *self); + +/* + * Get the set of user operations that are currently prohibited. + * There are potentially new restrictions right after + * DVDNAV_CHANNEL_HOP and DVDNAV_NAV_PACKET. + */ +user_ops_t dvdnav_get_restrictions(dvdnav_t *self); + + +/********************************************************************* + * multiple angles * + *********************************************************************/ + +/* + * The libdvdnav library abstracts away the difference between seamless and + * non-seamless angles. From the point of view of the programmer you just set the + * angle number and all is well in the world. You will always see only the + * selected angle coming from the get_next_block functions. + * + * Note: + * It is quite possible that some tremendously strange DVD feature might change the + * angle number from under you. Generally you should always view the results from + * dvdnav_get_angle_info() as definitive only up to the next time you call + * dvdnav_get_next_block(). + */ + +/* + * Sets the current angle. If you try to follow a non existant angle + * the call fails. + */ +dvdnav_status_t dvdnav_angle_change(dvdnav_t *self, int32_t angle); + +/* + * Returns the current angle and number of angles present. + */ +dvdnav_status_t dvdnav_get_angle_info(dvdnav_t *self, int32_t *current_angle, + int32_t *number_of_angles); + +/********************************************************************* + * domain queries * + *********************************************************************/ + +/* + * Are we in the First Play domain? + */ +int8_t dvdnav_is_domain_fp(dvdnav_t *self); + +/* + * Are we in the Video management Menu domain? + */ +int8_t dvdnav_is_domain_vmgm(dvdnav_t *self); + +/* + * Are we in the Video Title Menu domain? + */ +int8_t dvdnav_is_domain_vtsm(dvdnav_t *self); + +/* + * Are we in the Video Title Set domain? + */ +int8_t dvdnav_is_domain_vts(dvdnav_t *self); + + +#ifdef __cplusplus +} +#endif + +#endif /* LIBDVDNAV_DVDNAV_H */ diff -r 0ac6f0d242bc -r 9c5aef10d165 dvdnav/dvdnav_events.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dvdnav/dvdnav_events.h Tue Dec 30 14:48:46 2008 +0000 @@ -0,0 +1,236 @@ +/* + * Copyright (C) 2001 Rich Wareham + * + * 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 header defines events and event types + */ + +#ifndef LIBDVDNAV_DVDNAV_EVENTS_H +#define LIBDVDNAV_DVDNAV_EVENTS_H + +/* + * DVDNAV_BLOCK_OK + * + * A regular data block from the DVD has been returned. + * This one should be demuxed and decoded for playback. + */ +#define DVDNAV_BLOCK_OK 0 + + +/* + * DVDNAV_NOP + * + * Just ignore this. + */ +#define DVDNAV_NOP 1 + + +/* + * DVDNAV_STILL_FRAME + * + * We have reached a still frame. The player application should wait + * the amount of time specified by the still's length while still handling + * user input to make menus and other interactive stills work. + * The last delivered frame should be kept showing. + * Once the still has timed out, call dvdnav_skip_still(). + * A length of 0xff means an infinite still which has to be skipped + * indirectly by some user interaction. + */ +#define DVDNAV_STILL_FRAME 2 + +typedef struct { + /* The length (in seconds) the still frame should be displayed for, + * or 0xff if infinite. */ + int length; +} dvdnav_still_event_t; + + +/* + * DVDNAV_SPU_STREAM_CHANGE + * + * Inform the SPU decoding/overlaying engine to switch SPU channels. + */ +#define DVDNAV_SPU_STREAM_CHANGE 3 + +typedef struct { + /* The physical (MPEG) stream number for widescreen SPU display. + * Use this, if you blend the SPU on an anamorphic image before + * unsqueezing it. */ + int physical_wide; + + /* The physical (MPEG) stream number for letterboxed display. + * Use this, if you blend the SPU on an anamorphic image after + * unsqueezing it. */ + int physical_letterbox; + + /* The physical (MPEG) stream number for pan&scan display. + * Use this, if you blend the SPU on an anamorphic image after + * unsqueezing it the pan&scan way. */ + int physical_pan_scan; + + /* The logical (DVD) stream number. */ + int logical; +} dvdnav_spu_stream_change_event_t; + + +/* + * DVDNAV_AUDIO_STREAM_CHANGE + * + * Inform the audio decoder to switch channels. + */ +#define DVDNAV_AUDIO_STREAM_CHANGE 4 + +typedef struct { + /* The physical (MPEG) stream number. */ + int physical; + + /* The logical (DVD) stream number. */ + int logical; +} dvdnav_audio_stream_change_event_t; + + +/* + * DVDNAV_VTS_CHANGE + * + * Some status information like video aspect and video scale permissions do + * not change inside a VTS. Therefore this event can be used to query such + * information only when necessary and update the decoding/displaying + * accordingly. + */ +#define DVDNAV_VTS_CHANGE 5 + +typedef struct { + int old_vtsN; /* the old VTS number */ + dvd_read_domain_t old_domain; /* the old domain */ + int new_vtsN; /* the new VTS number */ + dvd_read_domain_t new_domain; /* the new domain */ +} dvdnav_vts_change_event_t; + + +/* + * DVDNAV_CELL_CHANGE + * + * Some status information like the current Title and Part numbers do not + * change inside a cell. Therefore this event can be used to query such + * information only when necessary and update the decoding/displaying + * accordingly. + * Some useful information for accurate time display is also reported + * together with this event. + */ +#define DVDNAV_CELL_CHANGE 6 + +typedef struct { + int cellN; /* the new cell number */ + int pgN; /* the current program number */ + int64_t cell_length; /* the length of the current cell in PTS ticks */ + int64_t pg_length; /* the length of the current program in PTS ticks */ + int64_t pgc_length; /* the length of the current program chain in PTS ticks */ + int64_t cell_start; /* the start time of the current cell relatively to the PGC in PTS ticks */ + int64_t pg_start; /* the start time of the current PG relatively to the PGC in PTS ticks */ +} dvdnav_cell_change_event_t; + + +/* + * DVDNAV_NAV_PACKET + * + * NAV packets are useful for various purposes. They define the button + * highlight areas and VM commands of DVD menus, so they should in any + * case be sent to the SPU decoder/overlaying engine for the menus to work. + * NAV packets also provide a way to detect PTS discontinuities, because + * they carry the start and end PTS values for the current VOBU. + * (pci.vobu_s_ptm and pci.vobu_e_ptm) Whenever the start PTS of the + * current NAV does not match the end PTS of the previous NAV, a PTS + * discontinuity has occured. + * NAV packets can also be used for time display, because they are + * timestamped relatively to the current Cell. + */ +#define DVDNAV_NAV_PACKET 7 + + +/* + * DVDNAV_STOP + * + * Applications should end playback here. A subsequent dvdnav_get_next_block() + * call will restart the VM from the beginning of the DVD. + */ +#define DVDNAV_STOP 8 + + +/* + * DVDNAV_HIGHLIGHT + * + * The current button highlight changed. Inform the overlaying engine to + * highlight a different button. Please note, that at the moment only mode 1 + * highlights are reported this way. That means, when the button highlight + * has been moved around by some function call, you will receive an event + * telling you the new button. But when a button gets activated, you have + * to handle the mode 2 highlighting (that is some different colour the + * button turns to on activation) in your application. + */ +#define DVDNAV_HIGHLIGHT 9 + +typedef struct { + /* highlight mode: 0 - hide, 1 - show, 2 - activate, currently always 1 */ + int display; + + /* FIXME: these fields are currently not set */ + 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_event_t; + + +/* + * DVDNAV_SPU_CLUT_CHANGE + * + * Inform the SPU decoder/overlaying engine to update its colour lookup table. + * The CLUT is given as 16 uint32_t's in the buffer. + */ +#define DVDNAV_SPU_CLUT_CHANGE 10 + + +/* + * DVDNAV_HOP_CHANNEL + * + * A non-seamless operation has been performed. Applications can drop all + * their internal fifo's content, which will speed up the response. + */ +#define DVDNAV_HOP_CHANNEL 12 + + +/* + * DVDNAV_WAIT + * + * We have reached a point in DVD playback, where timing is critical. + * Player application with internal fifos can introduce state + * inconsistencies, because libdvdnav is always the fifo's length + * ahead in the stream compared to what the application sees. + * Such applications should wait until their fifos are empty + * when they receive this type of event. + * Once this is achieved, call dvdnav_skip_wait(). + */ +#define DVDNAV_WAIT 13 + + +#endif /* LIBDVDNAV_DVDNAV_EVENTS_H */ diff -r 0ac6f0d242bc -r 9c5aef10d165 dvdnav_events.h --- a/dvdnav_events.h Thu Oct 09 22:20:36 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,236 +0,0 @@ -/* - * Copyright (C) 2001 Rich Wareham - * - * 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 header defines events and event types - */ - -#ifndef LIBDVDNAV_DVDNAV_EVENTS_H -#define LIBDVDNAV_DVDNAV_EVENTS_H - -/* - * DVDNAV_BLOCK_OK - * - * A regular data block from the DVD has been returned. - * This one should be demuxed and decoded for playback. - */ -#define DVDNAV_BLOCK_OK 0 - - -/* - * DVDNAV_NOP - * - * Just ignore this. - */ -#define DVDNAV_NOP 1 - - -/* - * DVDNAV_STILL_FRAME - * - * We have reached a still frame. The player application should wait - * the amount of time specified by the still's length while still handling - * user input to make menus and other interactive stills work. - * The last delivered frame should be kept showing. - * Once the still has timed out, call dvdnav_skip_still(). - * A length of 0xff means an infinite still which has to be skipped - * indirectly by some user interaction. - */ -#define DVDNAV_STILL_FRAME 2 - -typedef struct { - /* The length (in seconds) the still frame should be displayed for, - * or 0xff if infinite. */ - int length; -} dvdnav_still_event_t; - - -/* - * DVDNAV_SPU_STREAM_CHANGE - * - * Inform the SPU decoding/overlaying engine to switch SPU channels. - */ -#define DVDNAV_SPU_STREAM_CHANGE 3 - -typedef struct { - /* The physical (MPEG) stream number for widescreen SPU display. - * Use this, if you blend the SPU on an anamorphic image before - * unsqueezing it. */ - int physical_wide; - - /* The physical (MPEG) stream number for letterboxed display. - * Use this, if you blend the SPU on an anamorphic image after - * unsqueezing it. */ - int physical_letterbox; - - /* The physical (MPEG) stream number for pan&scan display. - * Use this, if you blend the SPU on an anamorphic image after - * unsqueezing it the pan&scan way. */ - int physical_pan_scan; - - /* The logical (DVD) stream number. */ - int logical; -} dvdnav_spu_stream_change_event_t; - - -/* - * DVDNAV_AUDIO_STREAM_CHANGE - * - * Inform the audio decoder to switch channels. - */ -#define DVDNAV_AUDIO_STREAM_CHANGE 4 - -typedef struct { - /* The physical (MPEG) stream number. */ - int physical; - - /* The logical (DVD) stream number. */ - int logical; -} dvdnav_audio_stream_change_event_t; - - -/* - * DVDNAV_VTS_CHANGE - * - * Some status information like video aspect and video scale permissions do - * not change inside a VTS. Therefore this event can be used to query such - * information only when necessary and update the decoding/displaying - * accordingly. - */ -#define DVDNAV_VTS_CHANGE 5 - -typedef struct { - int old_vtsN; /* the old VTS number */ - dvd_read_domain_t old_domain; /* the old domain */ - int new_vtsN; /* the new VTS number */ - dvd_read_domain_t new_domain; /* the new domain */ -} dvdnav_vts_change_event_t; - - -/* - * DVDNAV_CELL_CHANGE - * - * Some status information like the current Title and Part numbers do not - * change inside a cell. Therefore this event can be used to query such - * information only when necessary and update the decoding/displaying - * accordingly. - * Some useful information for accurate time display is also reported - * together with this event. - */ -#define DVDNAV_CELL_CHANGE 6 - -typedef struct { - int cellN; /* the new cell number */ - int pgN; /* the current program number */ - int64_t cell_length; /* the length of the current cell in PTS ticks */ - int64_t pg_length; /* the length of the current program in PTS ticks */ - int64_t pgc_length; /* the length of the current program chain in PTS ticks */ - int64_t cell_start; /* the start time of the current cell relatively to the PGC in PTS ticks */ - int64_t pg_start; /* the start time of the current PG relatively to the PGC in PTS ticks */ -} dvdnav_cell_change_event_t; - - -/* - * DVDNAV_NAV_PACKET - * - * NAV packets are useful for various purposes. They define the button - * highlight areas and VM commands of DVD menus, so they should in any - * case be sent to the SPU decoder/overlaying engine for the menus to work. - * NAV packets also provide a way to detect PTS discontinuities, because - * they carry the start and end PTS values for the current VOBU. - * (pci.vobu_s_ptm and pci.vobu_e_ptm) Whenever the start PTS of the - * current NAV does not match the end PTS of the previous NAV, a PTS - * discontinuity has occured. - * NAV packets can also be used for time display, because they are - * timestamped relatively to the current Cell. - */ -#define DVDNAV_NAV_PACKET 7 - - -/* - * DVDNAV_STOP - * - * Applications should end playback here. A subsequent dvdnav_get_next_block() - * call will restart the VM from the beginning of the DVD. - */ -#define DVDNAV_STOP 8 - - -/* - * DVDNAV_HIGHLIGHT - * - * The current button highlight changed. Inform the overlaying engine to - * highlight a different button. Please note, that at the moment only mode 1 - * highlights are reported this way. That means, when the button highlight - * has been moved around by some function call, you will receive an event - * telling you the new button. But when a button gets activated, you have - * to handle the mode 2 highlighting (that is some different colour the - * button turns to on activation) in your application. - */ -#define DVDNAV_HIGHLIGHT 9 - -typedef struct { - /* highlight mode: 0 - hide, 1 - show, 2 - activate, currently always 1 */ - int display; - - /* FIXME: these fields are currently not set */ - 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_event_t; - - -/* - * DVDNAV_SPU_CLUT_CHANGE - * - * Inform the SPU decoder/overlaying engine to update its colour lookup table. - * The CLUT is given as 16 uint32_t's in the buffer. - */ -#define DVDNAV_SPU_CLUT_CHANGE 10 - - -/* - * DVDNAV_HOP_CHANNEL - * - * A non-seamless operation has been performed. Applications can drop all - * their internal fifo's content, which will speed up the response. - */ -#define DVDNAV_HOP_CHANNEL 12 - - -/* - * DVDNAV_WAIT - * - * We have reached a point in DVD playback, where timing is critical. - * Player application with internal fifos can introduce state - * inconsistencies, because libdvdnav is always the fifo's length - * ahead in the stream compared to what the application sees. - * Such applications should wait until their fifos are empty - * when they receive this type of event. - * Once this is achieved, call dvdnav_skip_wait(). - */ -#define DVDNAV_WAIT 13 - - -#endif /* LIBDVDNAV_DVDNAV_EVENTS_H */ diff -r 0ac6f0d242bc -r 9c5aef10d165 highlight.c --- a/highlight.c Thu Oct 09 22:20:36 2008 +0000 +++ b/highlight.c Tue Dec 30 14:48:46 2008 +0000 @@ -30,13 +30,12 @@ #include #include #include -#include "dvd_types.h" +#include "dvdnav/dvdnav.h" #include "remap.h" #include "vm/decoder.h" #include "vm/vm.h" #include "vm/vmcmd.h" #include "dvdnav_internal.h" -#include "dvdnav.h" /* #define BUTTON_TESTING diff -r 0ac6f0d242bc -r 9c5aef10d165 navigation.c --- a/navigation.c Thu Oct 09 22:20:36 2008 +0000 +++ b/navigation.c Tue Dec 30 14:48:46 2008 +0000 @@ -26,13 +26,12 @@ #include #include #include -#include "dvd_types.h" +#include "dvdnav/dvdnav.h" #include #include #include "remap.h" #include "vm/decoder.h" #include "vm/vm.h" -#include "dvdnav.h" #include "dvdnav_internal.h" /* Navigation API calls */ diff -r 0ac6f0d242bc -r 9c5aef10d165 read_cache.c --- a/read_cache.c Thu Oct 09 22:20:36 2008 +0000 +++ b/read_cache.c Tue Dec 30 14:48:46 2008 +0000 @@ -33,13 +33,12 @@ #include #include #include -#include "dvd_types.h" +#include "dvdnav/dvdnav.h" #include #include #include "remap.h" #include "vm/decoder.h" #include "vm/vm.h" -#include "dvdnav.h" #include "dvdnav_internal.h" #include "read_cache.h" diff -r 0ac6f0d242bc -r 9c5aef10d165 remap.c --- a/remap.c Thu Oct 09 22:20:36 2008 +0000 +++ b/remap.c Tue Dec 30 14:48:46 2008 +0000 @@ -36,13 +36,12 @@ #include #include #include -#include "dvd_types.h" +#include "dvdnav/dvdnav.h" #include #include #include "remap.h" #include "vm/decoder.h" #include "vm/vm.h" -#include "dvdnav.h" #include "dvdnav_internal.h" struct block_s { diff -r 0ac6f0d242bc -r 9c5aef10d165 searching.c --- a/searching.c Thu Oct 09 22:20:36 2008 +0000 +++ b/searching.c Tue Dec 30 14:48:46 2008 +0000 @@ -29,13 +29,12 @@ #include #include #include -#include "dvd_types.h" +#include "dvdnav/dvdnav.h" #include #include #include "remap.h" #include "vm/decoder.h" #include "vm/vm.h" -#include "dvdnav.h" #include "dvdnav_internal.h" /* diff -r 0ac6f0d242bc -r 9c5aef10d165 settings.c --- a/settings.c Thu Oct 09 22:20:36 2008 +0000 +++ b/settings.c Tue Dec 30 14:48:46 2008 +0000 @@ -26,13 +26,12 @@ #include #include #include -#include "dvd_types.h" +#include "dvdnav/dvdnav.h" #include #include #include "remap.h" #include "vm/decoder.h" #include "vm/vm.h" -#include "dvdnav.h" #include "dvdnav_internal.h" /* Characteristics/setting API calls */ diff -r 0ac6f0d242bc -r 9c5aef10d165 vm/decoder.c --- a/vm/decoder.c Thu Oct 09 22:20:36 2008 +0000 +++ b/vm/decoder.c Tue Dec 30 14:48:46 2008 +0000 @@ -33,12 +33,11 @@ #include #include /* vm_cmd_t */ -#include "dvd_types.h" +#include "dvdnav/dvdnav.h" #include "remap.h" #include "decoder.h" #include "vm.h" #include "vmcmd.h" -#include "dvdnav.h" #include "dvdnav_internal.h" uint32_t vm_getbits(command_t *command, int32_t start, int32_t count) { diff -r 0ac6f0d242bc -r 9c5aef10d165 vm/vm.c --- a/vm/vm.c Thu Oct 09 22:20:36 2008 +0000 +++ b/vm/vm.c Tue Dec 30 14:48:46 2008 +0000 @@ -40,12 +40,11 @@ #include #include #include -#include "dvd_types.h" +#include "dvdnav/dvdnav.h" #include "decoder.h" #include "remap.h" #include "vm.h" -#include "dvdnav.h" #include "dvdnav_internal.h" #ifdef _MSC_VER diff -r 0ac6f0d242bc -r 9c5aef10d165 vm/vmcmd.c --- a/vm/vmcmd.c Thu Oct 09 22:20:36 2008 +0000 +++ b/vm/vmcmd.c Tue Dec 30 14:48:46 2008 +0000 @@ -30,14 +30,13 @@ #include #include -#include "dvd_types.h" +#include "dvdnav/dvdnav.h" #include #include #include "decoder.h" #include "remap.h" #include "vm.h" #include "vmcmd.h" -#include "dvdnav.h" #include "dvdnav_internal.h" /* freebsd compatibility */