DVDnav-discuss
Threads by month
- ----- 2026 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
September 2008
- 11 participants
- 35 discussions
I've just received a bug report:
===
Opened by W. Michael Petullo on 2008-04-15 04:11 EST [reply]
Description of problem:
I have been unable to play DVD's with gstreamer-plugins-ugly-0.10.7-1.lvn9.ppc
when it is built against libdvdread-4.1.1-6.fc9.ppc. I rebuilt
gstreamer-plugins-ugly against the older libdvdread-0.9.7-3.fc8 and it worked fine.
I receive an error that states, "libdvdread: Invalid main menu IFO
(VIDEO_TS.IFO)." Here is an example:
> gst-launch dvdreadsrc device=/dev/hdc ! dvddemux name=dvd dvd. ! mpeg2dec !
queue ! ffmpegcolorspace ! xvimagesink dvd. ! a52dec ! audioconvert !
audioresample ! queue ! osssink
Setting pipeline to PAUSED ...
No accelerated IMDCT transform found
libdvdread: Using libdvdcss version 1.2.9 for DVD access
libdvdread: Invalid main menu IFO (VIDEO_TS.IFO).
ERROR: Pipeline doesn't want to pause.
ERROR: from element /pipeline0/dvdreadsrc0: Could not open DVD
Additional debug info:
dvdreadsrc.c(236): gst_dvd_read_src_start (): /pipeline0/dvdreadsrc0:
ifoOpen() failed: File exists
Setting pipeline to NULL ...
FREEING pipeline ...
[...]
===
https://bugzilla.redhat.com/show_bug.cgi?id=442508
Regards,
R.
--
Fedora contributor http://fedoraproject.org/wiki/DominikMierzejewski
Livna contributor http://rpm.livna.org MPlayer developer http://mplayerhq.hu
"Faith manages."
-- Delenn to Lennier in Babylon 5:"Confessions and Lamentations"
3
20
Hello,
The pthread_mutex_destroy doesn't exist in the pthreads implementation
for Windows. I don't know if it's the intended behaviour, but when
leaving dvdnav, there's an attempt to free a block of memory where
there is a critical section (apparently, it's bad :P). See the patch
attached for a small fix.
Regards,
Geoffroy
2
3
Author: diego
Date: Sun Sep 28 17:56:44 2008
New Revision: 1153
Log:
Remove remaining tabs and trailing whitespace.
Modified:
trunk/libdvdread/COPYING
trunk/libdvdread/configure.ac
Modified: trunk/libdvdread/COPYING
==============================================================================
--- trunk/libdvdread/COPYING (original)
+++ trunk/libdvdread/COPYING Sun Sep 28 17:56:44 2008
@@ -1,12 +1,12 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
- Preamble
+ Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
@@ -56,7 +56,7 @@ patent must be licensed for everyone's f
The precise terms and conditions for copying, distribution and
modification follow.
- GNU GENERAL PUBLIC LICENSE
+ GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
@@ -255,7 +255,7 @@ make exceptions for this. Our decision
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
- NO WARRANTY
+ 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
@@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
- END OF TERMS AND CONDITIONS
+ END OF TERMS AND CONDITIONS
- How to Apply These Terms to Your New Programs
+ 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
Modified: trunk/libdvdread/configure.ac
==============================================================================
--- trunk/libdvdread/configure.ac (original)
+++ trunk/libdvdread/configure.ac Sun Sep 28 17:56:44 2008
@@ -35,7 +35,7 @@ AC_SUBST(DVDREAD_MINOR)
AC_SUBST(DVDREAD_SUB)
dnl The libtool version numbers (DVDREAD_LT_*); Don't even think about faking this!
-dnl
+dnl
dnl immediately before every release do:
dnl ===================================
dnl if (the interface is totally unchanged from previous release)
@@ -48,7 +48,7 @@ dnl AGE ++;
dnl if (any interfaces have been _removed_ or _incompatibly changed_)
dnl AGE = 0;
dnl }
-dnl
+dnl
dnl If you want to know more about what you are doing, here are some details:
dnl * DVDREAD_LT_CURRENT is the current API version
dnl * DVDREAD_LT_REVISION is an internal revision number which is increased when the API
@@ -147,10 +147,10 @@ case $host in
;;
*)
AC_CHECK_LIB(c, dlopen,
- DYNAMIC_LD_LIBS="",
- AC_CHECK_LIB(dl, dlopen,
- DYNAMIC_LD_LIBS="-ldl",
- AC_MSG_ERROR(dynamic linker needed)))
+ DYNAMIC_LD_LIBS="",
+ AC_CHECK_LIB(dl, dlopen,
+ DYNAMIC_LD_LIBS="-ldl",
+ AC_MSG_ERROR(dynamic linker needed)))
AC_SUBST(DYNAMIC_LD_LIBS)
;;
esac
@@ -199,7 +199,7 @@ dnl ------------------------------------
dnl Output configuration files
dnl ---------------------------------------------
AC_OUTPUT([
-Makefile
+Makefile
src/Makefile
misc/Makefile
misc/dvdread-config
1
0
This is more of a user question and I'm debating about whether to
direct this to mplayer-users or here, but I'll send it here and see
what kind of response I get.
I just got libdvdnav and libdvdread externals (from this SVN) going
with mplayer and I've found the very annoying side effect of libdvdcss
being not included. If you use external libdvdnav and libdvdread does
this break inclusion of the libdvdcss or is libdvdcss compiled in at
libdvdread and libdvdnav compile time? If so is the suggested course
of action to go intstall an external libdvdcss or could I also use the
internal libdvdcss from mplayer directly into libdvdnav/libdvdread.
2
1
Author: diego
Date: Fri Sep 26 00:09:59 2008
New Revision: 1152
Log:
cosmetics: function renaming from libdvdread 0.9.5
Modified:
trunk/libdvdread/src/ifo_print.c
Modified: trunk/libdvdread/src/ifo_print.c
==============================================================================
--- trunk/libdvdread/src/ifo_print.c (original)
+++ trunk/libdvdread/src/ifo_print.c Fri Sep 26 00:09:59 2008
@@ -426,7 +426,7 @@ static void ifo_print_subp_attributes(in
}
-static void ifo_print_USER_OPS(user_ops_t *user_ops) {
+static void ifoPrint_USER_OPS(user_ops_t *user_ops) {
uint32_t uops;
unsigned char *ptr = (unsigned char *)user_ops;
@@ -495,7 +495,7 @@ static void ifo_print_USER_OPS(user_ops_
}
-void ifo_print_VMGI_MAT(vmgi_mat_t *vmgi_mat) {
+void ifoPrint_VMGI_MAT(vmgi_mat_t *vmgi_mat) {
printf("VMG Identifier: %.12s\n", vmgi_mat->vmg_identifier);
printf("Last Sector of VMG: %08x\n", vmgi_mat->vmg_last_sector);
@@ -544,7 +544,7 @@ void ifo_print_VMGI_MAT(vmgi_mat_t *vmgi
}
-void ifo_print_VTSI_MAT(vtsi_mat_t *vtsi_mat) {
+void ifoPrint_VTSI_MAT(vtsi_mat_t *vtsi_mat) {
int i;
printf("VTS Identifier: %.12s\n", vtsi_mat->vts_identifier);
@@ -608,7 +608,7 @@ void ifo_print_VTSI_MAT(vtsi_mat_t *vtsi
}
-static void ifo_print_PGC_COMMAND_TBL(pgc_command_tbl_t *cmd_tbl) {
+static void ifoPrint_PGC_COMMAND_TBL(pgc_command_tbl_t *cmd_tbl) {
int i;
if(cmd_tbl == NULL) {
@@ -633,7 +633,7 @@ static void ifo_print_PGC_COMMAND_TBL(pg
}
-static void ifo_print_PGC_PROGRAM_MAP(pgc_program_map_t *program_map, int nr) {
+static void ifoPrint_PGC_PROGRAM_MAP(pgc_program_map_t *program_map, int nr) {
int i;
if(program_map == NULL) {
@@ -647,7 +647,7 @@ static void ifo_print_PGC_PROGRAM_MAP(pg
}
-static void ifo_print_CELL_PLAYBACK(cell_playback_t *cell_playback, int nr) {
+static void ifoPrint_CELL_PLAYBACK(cell_playback_t *cell_playback, int nr) {
int i;
if(cell_playback == NULL) {
@@ -717,7 +717,7 @@ static void ifo_print_CELL_PLAYBACK(cell
}
}
-static void ifo_print_CELL_POSITION(cell_position_t *cell_position, int nr) {
+static void ifoPrint_CELL_POSITION(cell_position_t *cell_position, int nr) {
int i;
if(cell_position == NULL) {
@@ -732,7 +732,7 @@ static void ifo_print_CELL_POSITION(cell
}
-void ifo_print_PGC(pgc_t *pgc) {
+void ifoPrint_PGC(pgc_t *pgc) {
int i;
if (!pgc) {
@@ -747,7 +747,7 @@ void ifo_print_PGC(pgc_t *pgc) {
/* If no programs/no time then does this mean anything? */
printf("Prohibited user operations: ");
- ifo_print_USER_OPS(&pgc->prohibited_ops);
+ ifoPrint_USER_OPS(&pgc->prohibited_ops);
for(i = 0; i < 8; i++) {
if(pgc->audio_control[i] & 0x8000) { /* The 'is present' bit */
@@ -782,14 +782,14 @@ void ifo_print_PGC(pgc_t *pgc) {
}
/* Memmory offsets to div. tables. */
- ifo_print_PGC_COMMAND_TBL(pgc->command_tbl);
- ifo_print_PGC_PROGRAM_MAP(pgc->program_map, pgc->nr_of_programs);
- ifo_print_CELL_PLAYBACK(pgc->cell_playback, pgc->nr_of_cells);
- ifo_print_CELL_POSITION(pgc->cell_position, pgc->nr_of_cells);
+ ifoPrint_PGC_COMMAND_TBL(pgc->command_tbl);
+ ifoPrint_PGC_PROGRAM_MAP(pgc->program_map, pgc->nr_of_programs);
+ ifoPrint_CELL_PLAYBACK(pgc->cell_playback, pgc->nr_of_cells);
+ ifoPrint_CELL_POSITION(pgc->cell_position, pgc->nr_of_cells);
}
-void ifo_print_TT_SRPT(tt_srpt_t *tt_srpt) {
+void ifoPrint_TT_SRPT(tt_srpt_t *tt_srpt) {
int i;
printf("Number of TitleTrack search pointers: %i\n",
@@ -822,7 +822,7 @@ void ifo_print_TT_SRPT(tt_srpt_t *tt_srp
}
-void ifo_print_VTS_PTT_SRPT(vts_ptt_srpt_t *vts_ptt_srpt) {
+void ifoPrint_VTS_PTT_SRPT(vts_ptt_srpt_t *vts_ptt_srpt) {
int i, j;
printf(" nr_of_srpts %i last byte %i\n",
vts_ptt_srpt->nr_of_srpts,
@@ -843,7 +843,7 @@ static void hexdump(uint8_t *ptr, int le
printf("%02x ", *ptr++);
}
-void ifo_print_PTL_MAIT(ptl_mait_t *ptl_mait) {
+void ifoPrint_PTL_MAIT(ptl_mait_t *ptl_mait) {
int i, j;
printf("Number of Countries: %i\n", ptl_mait->nr_of_countries);
@@ -872,7 +872,7 @@ void ifo_print_PTL_MAIT(ptl_mait_t *ptl_
}
}
-void ifo_print_VTS_TMAPT(vts_tmapt_t *vts_tmapt) {
+void ifoPrint_VTS_TMAPT(vts_tmapt_t *vts_tmapt) {
unsigned int timeunit;
int i, j;
@@ -895,7 +895,7 @@ void ifo_print_VTS_TMAPT(vts_tmapt_t *vt
}
}
-void ifo_print_C_ADT(c_adt_t *c_adt) {
+void ifoPrint_C_ADT(c_adt_t *c_adt) {
int i, entries;
printf("Number of VOBs in this VOBS: %i\n", c_adt->nr_of_vobs);
@@ -912,7 +912,7 @@ void ifo_print_C_ADT(c_adt_t *c_adt) {
}
-void ifo_print_VOBU_ADMAP(vobu_admap_t *vobu_admap) {
+void ifoPrint_VOBU_ADMAP(vobu_admap_t *vobu_admap) {
int i, entries;
entries = (vobu_admap->last_byte + 1 - VOBU_ADMAP_SIZE)/4;
@@ -952,7 +952,7 @@ const char *ifo_print_menu_name(int type
}
/* pgc_type=1 for menu, 0 for title. */
-void ifo_print_PGCIT(pgcit_t *pgcit, int pgc_type) {
+void ifoPrint_PGCIT(pgcit_t *pgcit, int pgc_type) {
int i;
printf("\nNumber of Program Chains: %3i\n", pgcit->nr_of_pgci_srp);
@@ -971,12 +971,12 @@ void ifo_print_PGCIT(pgcit_t *pgcit, int
pgcit->pgci_srp[i].entry_id);
}
printf("Parental ID mask 0x%04x\n", pgcit->pgci_srp[i].ptl_id_mask);
- ifo_print_PGC(pgcit->pgci_srp[i].pgc);
+ ifoPrint_PGC(pgcit->pgci_srp[i].pgc);
}
}
-void ifo_print_PGCI_UT(pgci_ut_t *pgci_ut) {
+void ifoPrint_PGCI_UT(pgci_ut_t *pgci_ut) {
int i, menu;
printf("Number of Menu Language Units (PGCI_LU): %3i\n", pgci_ut->nr_of_lus);
@@ -1016,12 +1016,12 @@ void ifo_print_PGCI_UT(pgci_ut_t *pgci_u
menu^=0x08;
}
printf("\n");
- ifo_print_PGCIT(pgci_ut->lu[i].pgcit, 1);
+ ifoPrint_PGCIT(pgci_ut->lu[i].pgcit, 1);
}
}
-static void ifo_print_VTS_ATTRIBUTES(vts_attributes_t *vts_attributes) {
+static void ifoPrint_VTS_ATTRIBUTES(vts_attributes_t *vts_attributes) {
int i;
printf("VTS_CAT Application type: %08x\n", vts_attributes->vts_cat);
@@ -1065,13 +1065,13 @@ static void ifo_print_VTS_ATTRIBUTES(vts
}
-void ifo_print_VTS_ATRT(vts_atrt_t *vts_atrt) {
+void ifoPrint_VTS_ATRT(vts_atrt_t *vts_atrt) {
int i;
printf("Number of Video Title Sets: %3i\n", vts_atrt->nr_of_vtss);
for(i = 0; i < vts_atrt->nr_of_vtss; i++) {
printf("\nVideo Title Set %i\n", i + 1);
- ifo_print_VTS_ATTRIBUTES(&vts_atrt->vts[i]);
+ ifoPrint_VTS_ATTRIBUTES(&vts_atrt->vts[i]);
}
}
@@ -1089,22 +1089,22 @@ void ifo_print(dvd_reader_t *dvd, int ti
if(ifohandle->vmgi_mat) {
printf("VMG top level\n-------------\n");
- ifo_print_VMGI_MAT(ifohandle->vmgi_mat);
+ ifoPrint_VMGI_MAT(ifohandle->vmgi_mat);
printf("\nFirst Play PGC\n--------------\n");
if(ifohandle->first_play_pgc)
- ifo_print_PGC(ifohandle->first_play_pgc);
+ ifoPrint_PGC(ifohandle->first_play_pgc);
else
printf("No First Play PGC present\n");
printf("\nTitle Track search pointer table\n");
printf( "------------------------------------------------\n");
- ifo_print_TT_SRPT(ifohandle->tt_srpt);
+ ifoPrint_TT_SRPT(ifohandle->tt_srpt);
printf("\nMenu PGCI Unit table\n");
printf( "--------------------\n");
if(ifohandle->pgci_ut) {
- ifo_print_PGCI_UT(ifohandle->pgci_ut);
+ ifoPrint_PGCI_UT(ifohandle->pgci_ut);
} else {
printf("No PGCI Unit table present\n");
}
@@ -1112,14 +1112,14 @@ void ifo_print(dvd_reader_t *dvd, int ti
printf("\nParental Manegment Information table\n");
printf( "------------------------------------\n");
if(ifohandle->ptl_mait) {
- ifo_print_PTL_MAIT(ifohandle->ptl_mait);
+ ifoPrint_PTL_MAIT(ifohandle->ptl_mait);
} else {
printf("No Parental Management Information present\n");
}
printf("\nVideo Title Set Attribute Table\n");
printf( "-------------------------------\n");
- ifo_print_VTS_ATRT(ifohandle->vts_atrt);
+ ifoPrint_VTS_ATRT(ifohandle->vts_atrt);
printf("\nText Data Manager Information\n");
printf( "-----------------------------\n");
@@ -1132,7 +1132,7 @@ void ifo_print(dvd_reader_t *dvd, int ti
printf("\nMenu Cell Adress table\n");
printf( "-----------------\n");
if(ifohandle->menu_c_adt) {
- ifo_print_C_ADT(ifohandle->menu_c_adt);
+ ifoPrint_C_ADT(ifohandle->menu_c_adt);
} else {
printf("No Menu Cell Adress table present\n");
}
@@ -1140,7 +1140,7 @@ void ifo_print(dvd_reader_t *dvd, int ti
printf("\nVideo Manager Menu VOBU address map\n");
printf( "-----------------\n");
if(ifohandle->menu_vobu_admap) {
- ifo_print_VOBU_ADMAP(ifohandle->menu_vobu_admap);
+ ifoPrint_VOBU_ADMAP(ifohandle->menu_vobu_admap);
} else {
printf("No Menu VOBU address map present\n");
}
@@ -1150,20 +1150,20 @@ void ifo_print(dvd_reader_t *dvd, int ti
if(ifohandle->vtsi_mat) {
printf("VTS top level\n-------------\n");
- ifo_print_VTSI_MAT(ifohandle->vtsi_mat);
+ ifoPrint_VTSI_MAT(ifohandle->vtsi_mat);
printf("\nPart of Title Track search pointer table\n");
printf( "----------------------------------------------\n");
- ifo_print_VTS_PTT_SRPT(ifohandle->vts_ptt_srpt);
+ ifoPrint_VTS_PTT_SRPT(ifohandle->vts_ptt_srpt);
printf("\nPGCI Unit table\n");
printf( "--------------------\n");
- ifo_print_PGCIT(ifohandle->vts_pgcit, 0);
+ ifoPrint_PGCIT(ifohandle->vts_pgcit, 0);
printf("\nMenu PGCI Unit table\n");
printf( "--------------------\n");
if(ifohandle->pgci_ut) {
- ifo_print_PGCI_UT(ifohandle->pgci_ut);
+ ifoPrint_PGCI_UT(ifohandle->pgci_ut);
} else {
printf("No Menu PGCI Unit table present\n");
}
@@ -1171,7 +1171,7 @@ void ifo_print(dvd_reader_t *dvd, int ti
printf("\nVTS Time Map table\n");
printf( "-----------------\n");
if(ifohandle->vts_tmapt) {
- ifo_print_VTS_TMAPT(ifohandle->vts_tmapt);
+ ifoPrint_VTS_TMAPT(ifohandle->vts_tmapt);
} else {
printf("No VTS Time Map table present\n");
}
@@ -1179,7 +1179,7 @@ void ifo_print(dvd_reader_t *dvd, int ti
printf("\nMenu Cell Adress table\n");
printf( "-----------------\n");
if(ifohandle->menu_c_adt) {
- ifo_print_C_ADT(ifohandle->menu_c_adt);
+ ifoPrint_C_ADT(ifohandle->menu_c_adt);
} else {
printf("No Cell Adress table present\n");
}
@@ -1187,18 +1187,18 @@ void ifo_print(dvd_reader_t *dvd, int ti
printf("\nVideo Title Set Menu VOBU address map\n");
printf( "-----------------\n");
if(ifohandle->menu_vobu_admap) {
- ifo_print_VOBU_ADMAP(ifohandle->menu_vobu_admap);
+ ifoPrint_VOBU_ADMAP(ifohandle->menu_vobu_admap);
} else {
printf("No Menu VOBU address map present\n");
}
printf("\nCell Adress table\n");
printf( "-----------------\n");
- ifo_print_C_ADT(ifohandle->vts_c_adt);
+ ifoPrint_C_ADT(ifohandle->vts_c_adt);
printf("\nVideo Title Set VOBU address map\n");
printf( "-----------------\n");
- ifo_print_VOBU_ADMAP(ifohandle->vts_vobu_admap);
+ ifoPrint_VOBU_ADMAP(ifohandle->vts_vobu_admap);
}
ifoClose(ifohandle);
1
0
Author: diego
Date: Fri Sep 26 00:08:45 2008
New Revision: 1151
Log:
cosmetics: one more hunk of indentation sync
Modified:
trunk/libdvdread/src/ifo_print.c
Modified: trunk/libdvdread/src/ifo_print.c
==============================================================================
--- trunk/libdvdread/src/ifo_print.c (original)
+++ trunk/libdvdread/src/ifo_print.c Fri Sep 26 00:08:45 2008
@@ -749,12 +749,12 @@ void ifo_print_PGC(pgc_t *pgc) {
printf("Prohibited user operations: ");
ifo_print_USER_OPS(&pgc->prohibited_ops);
- for(i = 0; i < 8; i++) {
- if(pgc->audio_control[i] & 0x8000) { /* The 'is present' bit */
- printf("Audio stream %i control: %04x\n",
- i, pgc->audio_control[i]);
- }
+ for(i = 0; i < 8; i++) {
+ if(pgc->audio_control[i] & 0x8000) { /* The 'is present' bit */
+ printf("Audio stream %i control: %04x\n",
+ i, pgc->audio_control[i]);
}
+ }
for(i = 0; i < 32; i++) {
if(pgc->subp_control[i] & 0x80000000) { /* The 'is present' bit */
1
0
r1150 - in trunk/libdvdread/src: bswap.h dvd_input.c dvd_reader.c dvd_udf.c dvdread_internal.h ifo_print.c ifo_read.c ifo_types.h md5.c md5.h nav_print.c nav_read.c nav_types.h
by diego 25 Sep '08
by diego 25 Sep '08
25 Sep '08
Author: diego
Date: Thu Sep 25 11:17:42 2008
New Revision: 1150
Log:
cosmetics: Sync indentation and similar changes from libdvdread 0.9.5.
Modified:
trunk/libdvdread/src/bswap.h
trunk/libdvdread/src/dvd_input.c
trunk/libdvdread/src/dvd_reader.c
trunk/libdvdread/src/dvd_udf.c
trunk/libdvdread/src/dvdread_internal.h
trunk/libdvdread/src/ifo_print.c
trunk/libdvdread/src/ifo_read.c
trunk/libdvdread/src/ifo_types.h
trunk/libdvdread/src/md5.c
trunk/libdvdread/src/md5.h
trunk/libdvdread/src/nav_print.c
trunk/libdvdread/src/nav_read.c
trunk/libdvdread/src/nav_types.h
Modified: trunk/libdvdread/src/bswap.h
==============================================================================
--- trunk/libdvdread/src/bswap.h (original)
+++ trunk/libdvdread/src/bswap.h Thu Sep 25 11:17:42 2008
@@ -74,15 +74,15 @@
*/
#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined(WIN32) || defined(__CYGWIN__) || defined(__BEOS__)
-#define B2N_16(x) \
- x = ((((x) & 0xff00) >> 8) | \
+#define B2N_16(x) \
+ x = ((((x) & 0xff00) >> 8) | \
(((x) & 0x00ff) << 8))
-#define B2N_32(x) \
- x = ((((x) & 0xff000000) >> 24) | \
- (((x) & 0x00ff0000) >> 8) | \
- (((x) & 0x0000ff00) << 8) | \
+#define B2N_32(x) \
+ x = ((((x) & 0xff000000) >> 24) | \
+ (((x) & 0x00ff0000) >> 8) | \
+ (((x) & 0x0000ff00) << 8) | \
(((x) & 0x000000ff) << 24))
-#define B2N_64(x) \
+#define B2N_64(x) \
x = ((((x) & 0xff00000000000000ULL) >> 56) | \
(((x) & 0x00ff000000000000ULL) >> 40) | \
(((x) & 0x0000ff0000000000ULL) >> 24) | \
Modified: trunk/libdvdread/src/dvd_input.c
==============================================================================
--- trunk/libdvdread/src/dvd_input.c (original)
+++ trunk/libdvdread/src/dvd_input.c Thu Sep 25 11:17:42 2008
@@ -198,7 +198,7 @@ static int file_seek(dvd_input_t dev, in
pos = lseek(dev->fd, (off_t)blocks * (off_t)DVD_VIDEO_LB_LEN, SEEK_SET);
if(pos < 0) {
- return pos;
+ return pos;
}
/* assert pos % DVD_VIDEO_LB_LEN == 0 */
return (int) (pos / DVD_VIDEO_LB_LEN);
Modified: trunk/libdvdread/src/dvd_reader.c
==============================================================================
--- trunk/libdvdread/src/dvd_reader.c (original)
+++ trunk/libdvdread/src/dvd_reader.c Thu Sep 25 11:17:42 2008
@@ -53,7 +53,7 @@ static inline int _private_gettimeofday(
#define lseek64 _lseeki64
#endif
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__)|| defined(__DARWIN__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__) || defined(__DARWIN__)
#define SYS_BSD 1
#endif
@@ -73,49 +73,49 @@ static inline int _private_gettimeofday(
#define DEFAULT_UDF_CACHE_LEVEL 1
struct dvd_reader_s {
- /* Basic information. */
- int isImageFile;
+ /* Basic information. */
+ int isImageFile;
- /* Hack for keeping track of the css status.
- * 0: no css, 1: perhaps (need init of keys), 2: have done init */
- int css_state;
- int css_title; /* Last title that we have called dvdinpute_title for. */
+ /* Hack for keeping track of the css status.
+ * 0: no css, 1: perhaps (need init of keys), 2: have done init */
+ int css_state;
+ int css_title; /* Last title that we have called dvdinpute_title for. */
- /* Information required for an image file. */
- dvd_input_t dev;
+ /* Information required for an image file. */
+ dvd_input_t dev;
- /* Information required for a directory path drive. */
- char *path_root;
+ /* Information required for a directory path drive. */
+ char *path_root;
- /* Filesystem cache */
- int udfcache_level; /* 0 - turned off, 1 - on */
- void *udfcache;
+ /* Filesystem cache */
+ int udfcache_level; /* 0 - turned off, 1 - on */
+ void *udfcache;
};
#define TITLES_MAX 9
struct dvd_file_s {
- /* Basic information. */
- dvd_reader_t *dvd;
+ /* Basic information. */
+ dvd_reader_t *dvd;
- /* Hack for selecting the right css title. */
- int css_title;
+ /* Hack for selecting the right css title. */
+ int css_title;
- /* Information required for an image file. */
- uint32_t lb_start;
- uint32_t seek_pos;
+ /* Information required for an image file. */
+ uint32_t lb_start;
+ uint32_t seek_pos;
- /* Information required for a directory path drive. */
- size_t title_sizes[ TITLES_MAX ];
- dvd_input_t title_devs[ TITLES_MAX ];
+ /* Information required for a directory path drive. */
+ size_t title_sizes[ TITLES_MAX ];
+ dvd_input_t title_devs[ TITLES_MAX ];
- /* Calculated at open-time, size in blocks. */
- ssize_t filesize;
+ /* Calculated at open-time, size in blocks. */
+ ssize_t filesize;
};
int UDFReadBlocksRaw( dvd_reader_t *device, uint32_t lb_number,
- size_t block_count, unsigned char *data,
- int encrypted );
+ size_t block_count, unsigned char *data,
+ int encrypted );
/**
* Set the level of caching on udf
@@ -156,68 +156,67 @@ void SetUDFCacheHandle(dvd_reader_t *dev
/* Loop over all titles and call dvdcss_title to crack the keys. */
static int initAllCSSKeys( dvd_reader_t *dvd )
{
- struct timeval all_s, all_e;
- struct timeval t_s, t_e;
- char filename[ MAX_UDF_FILE_NAME_LEN ];
- uint32_t start, len;
- int title;
-
- char *nokeys_str = getenv("DVDREAD_NOKEYS");
- if(nokeys_str != NULL)
- return 0;
+ struct timeval all_s, all_e;
+ struct timeval t_s, t_e;
+ char filename[ MAX_UDF_FILE_NAME_LEN ];
+ uint32_t start, len;
+ int title;
- fprintf( stderr, "\n" );
- fprintf( stderr, "libdvdread: Attempting to retrieve all CSS keys\n" );
- fprintf( stderr, "libdvdread: This can take a _long_ time, "
- "please be patient\n\n" );
+ char *nokeys_str = getenv("DVDREAD_NOKEYS");
+ if(nokeys_str != NULL)
+ return 0;
- gettimeofday(&all_s, NULL);
+ fprintf( stderr, "\n" );
+ fprintf( stderr, "libdvdread: Attempting to retrieve all CSS keys\n" );
+ fprintf( stderr, "libdvdread: This can take a _long_ time, "
+ "please be patient\n\n" );
+ gettimeofday(&all_s, NULL);
- for( title = 0; title < 100; title++ ) {
- gettimeofday( &t_s, NULL );
- if( title == 0 ) {
- sprintf( filename, "/VIDEO_TS/VIDEO_TS.VOB" );
- } else {
- sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, 0 );
- }
- start = UDFFindFile( dvd, filename, &len );
- if( start != 0 && len != 0 ) {
- /* Perform CSS key cracking for this title. */
- fprintf( stderr, "libdvdread: Get key for %s at 0x%08x\n",
- filename, start );
- if( dvdinput_title( dvd->dev, (int)start ) < 0 ) {
- fprintf( stderr, "libdvdread: Error cracking CSS key for %s (0x%08x)\n", filename, start);
- }
- gettimeofday( &t_e, NULL );
- fprintf( stderr, "libdvdread: Elapsed time %ld\n",
- (long int) t_e.tv_sec - t_s.tv_sec );
- }
+ for( title = 0; title < 100; title++ ) {
+ gettimeofday( &t_s, NULL );
+ if( title == 0 ) {
+ sprintf( filename, "/VIDEO_TS/VIDEO_TS.VOB" );
+ } else {
+ sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, 0 );
+ }
+ start = UDFFindFile( dvd, filename, &len );
+ if( start != 0 && len != 0 ) {
+ /* Perform CSS key cracking for this title. */
+ fprintf( stderr, "libdvdread: Get key for %s at 0x%08x\n",
+ filename, start );
+ if( dvdinput_title( dvd->dev, (int)start ) < 0 ) {
+ fprintf( stderr, "libdvdread: Error cracking CSS key for %s (0x%08x)\n", filename, start);
+ }
+ gettimeofday( &t_e, NULL );
+ fprintf( stderr, "libdvdread: Elapsed time %ld\n",
+ (long int) t_e.tv_sec - t_s.tv_sec );
+ }
- if( title == 0 ) continue;
+ if( title == 0 ) continue;
- gettimeofday( &t_s, NULL );
- sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, 1 );
- start = UDFFindFile( dvd, filename, &len );
- if( start == 0 || len == 0 ) break;
+ gettimeofday( &t_s, NULL );
+ sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, 1 );
+ start = UDFFindFile( dvd, filename, &len );
+ if( start == 0 || len == 0 ) break;
- /* Perform CSS key cracking for this title. */
- fprintf( stderr, "libdvdread: Get key for %s at 0x%08x\n",
- filename, start );
- if( dvdinput_title( dvd->dev, (int)start ) < 0 ) {
- fprintf( stderr, "libdvdread: Error cracking CSS key for %s (0x%08x)!!\n", filename, start);
- }
- gettimeofday( &t_e, NULL );
- fprintf( stderr, "libdvdread: Elapsed time %ld\n",
- (long int) t_e.tv_sec - t_s.tv_sec );
+ /* Perform CSS key cracking for this title. */
+ fprintf( stderr, "libdvdread: Get key for %s at 0x%08x\n",
+ filename, start );
+ if( dvdinput_title( dvd->dev, (int)start ) < 0 ) {
+ fprintf( stderr, "libdvdread: Error cracking CSS key for %s (0x%08x)!!\n", filename, start);
}
- title--;
-
- fprintf( stderr, "libdvdread: Found %d VTS's\n", title );
- gettimeofday(&all_e, NULL);
+ gettimeofday( &t_e, NULL );
fprintf( stderr, "libdvdread: Elapsed time %ld\n",
- (long int) all_e.tv_sec - all_s.tv_sec );
+ (long int) t_e.tv_sec - t_s.tv_sec );
+ }
+ title--;
- return 0;
+ fprintf( stderr, "libdvdread: Found %d VTS's\n", title );
+ gettimeofday(&all_e, NULL);
+ fprintf( stderr, "libdvdread: Elapsed time %ld\n",
+ (long int) all_e.tv_sec - all_s.tv_sec );
+
+ return 0;
}
@@ -227,60 +226,59 @@ static int initAllCSSKeys( dvd_reader_t
*/
static dvd_reader_t *DVDOpenImageFile( const char *location, int have_css )
{
- dvd_reader_t *dvd;
- dvd_input_t dev;
+ dvd_reader_t *dvd;
+ dvd_input_t dev;
- dev = dvdinput_open( location );
- if( !dev ) {
- fprintf( stderr, "libdvdread: Can't open %s for reading\n", location );
- return NULL;
- }
+ dev = dvdinput_open( location );
+ if( !dev ) {
+ fprintf( stderr, "libdvdread: Can't open %s for reading\n", location );
+ return NULL;
+ }
- dvd = (dvd_reader_t *) malloc( sizeof( dvd_reader_t ) );
- if( !dvd ) {
- dvdinput_close(dev);
- return NULL;
- }
- dvd->isImageFile = 1;
- dvd->dev = dev;
- dvd->path_root = NULL;
+ dvd = (dvd_reader_t *) malloc( sizeof( dvd_reader_t ) );
+ if( !dvd ) {
+ dvdinput_close(dev);
+ return NULL;
+ }
+ dvd->isImageFile = 1;
+ dvd->dev = dev;
+ dvd->path_root = NULL;
- dvd->udfcache_level = DEFAULT_UDF_CACHE_LEVEL;
- dvd->udfcache = NULL;
+ dvd->udfcache_level = DEFAULT_UDF_CACHE_LEVEL;
+ dvd->udfcache = NULL;
- if( have_css ) {
- /* Only if DVDCSS_METHOD = title, a bit if it's disc or if
- * DVDCSS_METHOD = key but region missmatch. Unfortunaly we
- * don't have that information. */
+ if( have_css ) {
+ /* Only if DVDCSS_METHOD = title, a bit if it's disc or if
+ * DVDCSS_METHOD = key but region missmatch. Unfortunaly we
+ * don't have that information. */
- dvd->css_state = 1; /* Need key init. */
- }
- dvd->css_title = 0;
+ dvd->css_state = 1; /* Need key init. */
+ }
+ dvd->css_title = 0;
- return dvd;
+ return dvd;
}
static dvd_reader_t *DVDOpenPath( const char *path_root )
{
- dvd_reader_t *dvd;
-
- dvd = (dvd_reader_t *) malloc( sizeof( dvd_reader_t ) );
- if( !dvd ) return NULL;
- dvd->isImageFile = 0;
- dvd->dev = 0;
- dvd->path_root = strdup( path_root );
- if(!dvd->path_root) {
- free(dvd);
- return 0;
- }
+ dvd_reader_t *dvd;
- dvd->udfcache_level = DEFAULT_UDF_CACHE_LEVEL;
- dvd->udfcache = NULL;
+ dvd = (dvd_reader_t *) malloc( sizeof( dvd_reader_t ) );
+ if( !dvd ) return NULL;
+ dvd->isImageFile = 0;
+ dvd->dev = 0;
+ dvd->path_root = strdup( path_root );
+ if(!dvd->path_root) {
+ free(dvd);
+ return 0;
+ }
+ dvd->udfcache_level = DEFAULT_UDF_CACHE_LEVEL;
+ dvd->udfcache = NULL;
- dvd->css_state = 0; /* Only used in the UDF path */
- dvd->css_title = 0; /* Only matters in the UDF path */
+ dvd->css_state = 0; /* Only used in the UDF path */
+ dvd->css_title = 0; /* Only matters in the UDF path */
- return dvd;
+ return dvd;
}
#if defined(__sun)
@@ -289,19 +287,19 @@ static dvd_reader_t *DVDOpenPath( const
/vol/rdsk/<name> */
static char *sun_block2char( const char *path )
{
- char *new_path;
+ char *new_path;
- /* Must contain "/dsk/" */
- if( !strstr( path, "/dsk/" ) ) return (char *) strdup( path );
+ /* Must contain "/dsk/" */
+ if( !strstr( path, "/dsk/" ) ) return (char *) strdup( path );
- /* Replace "/dsk/" with "/rdsk/" */
- new_path = malloc( strlen(path) + 2 );
- strcpy( new_path, path );
- strcpy( strstr( new_path, "/dsk/" ), "" );
- strcat( new_path, "/rdsk/" );
- strcat( new_path, strstr( path, "/dsk/" ) + strlen( "/dsk/" ) );
+ /* Replace "/dsk/" with "/rdsk/" */
+ new_path = malloc( strlen(path) + 2 );
+ strcpy( new_path, path );
+ strcpy( strstr( new_path, "/dsk/" ), "" );
+ strcat( new_path, "/rdsk/" );
+ strcat( new_path, strstr( path, "/dsk/" ) + strlen( "/dsk/" ) );
- return new_path;
+ return new_path;
}
#endif
@@ -313,252 +311,253 @@ static char *sun_block2char( const char
BSD/OS /dev/sr0c (if not mounted) or /dev/rsr0c ('c' any letter will do) */
static char *bsd_block2char( const char *path )
{
- char *new_path;
+ char *new_path;
- /* If it doesn't start with "/dev/" or does start with "/dev/r" exit */
- if( !strncmp( path, "/dev/", 5 ) || strncmp( path, "/dev/r", 6 ) )
- return (char *) strdup( path );
+ /* If it doesn't start with "/dev/" or does start with "/dev/r" exit */
+ if( !strncmp( path, "/dev/", 5 ) || strncmp( path, "/dev/r", 6 ) )
+ return (char *) strdup( path );
- /* Replace "/dev/" with "/dev/r" */
- new_path = malloc( strlen(path) + 2 );
- strcpy( new_path, "/dev/r" );
- strcat( new_path, path + strlen( "/dev/" ) );
+ /* Replace "/dev/" with "/dev/r" */
+ new_path = malloc( strlen(path) + 2 );
+ strcpy( new_path, "/dev/r" );
+ strcat( new_path, path + strlen( "/dev/" ) );
- return new_path;
+ return new_path;
}
#endif
+
dvd_reader_t *DVDOpen( const char *ppath )
{
- struct stat fileinfo;
- int ret;
- int have_css;
- dvd_reader_t *ret_val = NULL;
- char *dev_name = NULL;
- char *path;
+ struct stat fileinfo;
+ int ret, have_css;
+ dvd_reader_t *ret_val = NULL;
+ char *dev_name = NULL;
+ char *path;
#ifdef _MSC_VER
- int len;
+ int len;
#endif
- if( ppath == NULL )
- return 0;
+ if( ppath == NULL )
+ return 0;
- path = strdup(ppath);
- if( path == NULL )
- return 0;
+ path = strdup(ppath);
+ if( path == NULL )
+ return 0;
- /* Try to open libdvdcss or fall back to standard functions */
- have_css = dvdinput_setup();
+ /* Try to open libdvdcss or fall back to standard functions */
+ have_css = dvdinput_setup();
#ifdef _MSC_VER
- /* Strip off the trailing \ if it is not a drive */
- len = strlen(path);
- if ((len > 1) &&
- (path[len - 1] == '\\') &&
- (path[len - 2] != ':'))
- {
- path[len-1] = '\0';
- }
+ /* Strip off the trailing \ if it is not a drive */
+ len = strlen(path);
+ if ((len > 1) &&
+ (path[len - 1] == '\\') &&
+ (path[len - 2] != ':'))
+ {
+ path[len-1] = '\0';
+ }
#endif
- ret = stat( path, &fileinfo );
-
- if( ret < 0 ) {
+ ret = stat( path, &fileinfo );
- /* maybe "host:port" url? try opening it with acCeSS library */
- if( strchr(path,':') ) {
- ret_val = DVDOpenImageFile( path, have_css );
- free(path);
- return ret_val;
- }
+ if( ret < 0 ) {
- /* If we can't stat the file, give up */
- fprintf( stderr, "libdvdread: Can't stat %s\n", path );
- perror("");
- free(path);
- return NULL;
+ /* maybe "host:port" url? try opening it with acCeSS library */
+ if( strchr(path,':') ) {
+ ret_val = DVDOpenImageFile( path, have_css );
+ free(path);
+ return ret_val;
}
- /* First check if this is a block/char device or a file*/
- if( S_ISBLK( fileinfo.st_mode ) ||
- S_ISCHR( fileinfo.st_mode ) ||
- S_ISREG( fileinfo.st_mode ) ) {
+ /* If we can't stat the file, give up */
+ fprintf( stderr, "libdvdread: Can't stat %s\n", path );
+ perror("");
+ free(path);
+ return NULL;
+ }
- /**
- * Block devices and regular files are assumed to be DVD-Video images.
- */
+ /* First check if this is a block/char device or a file*/
+ if( S_ISBLK( fileinfo.st_mode ) ||
+ S_ISCHR( fileinfo.st_mode ) ||
+ S_ISREG( fileinfo.st_mode ) ) {
+
+ /**
+ * Block devices and regular files are assumed to be DVD-Video images.
+ */
#if defined(__sun)
- ret_val = DVDOpenImageFile( sun_block2char( path ), have_css );
+ ret_val = DVDOpenImageFile( sun_block2char( path ), have_css );
#elif defined(SYS_BSD)
- ret_val = DVDOpenImageFile( bsd_block2char( path ), have_css );
+ ret_val = DVDOpenImageFile( bsd_block2char( path ), have_css );
#else
- ret_val = DVDOpenImageFile( path, have_css );
+ ret_val = DVDOpenImageFile( path, have_css );
#endif
- free(path);
- return ret_val;
+ free(path);
+ return ret_val;
- } else if( S_ISDIR( fileinfo.st_mode ) ) {
- dvd_reader_t *auth_drive = 0;
- char *path_copy;
+ } else if( S_ISDIR( fileinfo.st_mode ) ) {
+ dvd_reader_t *auth_drive = 0;
+ char *path_copy;
#if defined(SYS_BSD)
- struct fstab* fe;
+ struct fstab* fe;
#elif defined(__sun) || defined(__linux__)
- FILE *mntfile;
+ FILE *mntfile;
#endif
- /* XXX: We should scream real loud here. */
- if( !(path_copy = strdup( path ) ) ) {
- free(path);
- return NULL;
- }
+ /* XXX: We should scream real loud here. */
+ if( !(path_copy = strdup( path ) ) ) {
+ free(path);
+ return NULL;
+ }
#ifndef WIN32 /* don't have fchdir, and getcwd( NULL, ... ) is strange */
/* Also WIN32 does not have symlinks, so we don't need this bit of code. */
- /* Resolve any symlinks and get the absolut dir name. */
- {
- char *new_path;
- int cdir = open( ".", O_RDONLY );
+ /* Resolve any symlinks and get the absolut dir name. */
+ {
+ char *new_path;
+ int cdir = open( ".", O_RDONLY );
- if( cdir >= 0 ) {
- chdir( path_copy );
- new_path = malloc(PATH_MAX+1);
- if(!new_path) {
- free(path);
- return NULL;
- }
- getcwd(new_path, PATH_MAX );
- fchdir( cdir );
- close( cdir );
- free( path_copy );
- path_copy = new_path;
- }
+ if( cdir >= 0 ) {
+ chdir( path_copy );
+ new_path = malloc(PATH_MAX+1);
+ if(!new_path) {
+ free(path);
+ return NULL;
}
+ getcwd(new_path, PATH_MAX );
+ fchdir( cdir );
+ close( cdir );
+ free( path_copy );
+ path_copy = new_path;
+ }
+ }
#endif
- /**
- * If we're being asked to open a directory, check if that directory
- * is the mountpoint for a DVD-ROM which we can use instead.
- */
- if( strlen( path_copy ) > 1 ) {
- if( path_copy[ strlen( path_copy ) - 1 ] == '/' )
- path_copy[ strlen( path_copy ) - 1 ] = '\0';
- }
+ /**
+ * If we're being asked to open a directory, check if that directory
+ * is the mountpoint for a DVD-ROM which we can use instead.
+ */
- if( strlen( path_copy ) > TITLES_MAX ) {
- if( !strcasecmp( &(path_copy[ strlen( path_copy ) - TITLES_MAX ]),
- "/video_ts" ) ) {
- path_copy[ strlen( path_copy ) - TITLES_MAX ] = '\0';
- }
- }
+ if( strlen( path_copy ) > 1 ) {
+ if( path_copy[ strlen( path_copy ) - 1 ] == '/' ) {
+ path_copy[ strlen( path_copy ) - 1 ] = '\0';
+ }
+ }
- if(path_copy[0] == '\0') {
- path_copy[0] = '/';
- path_copy[1] = '\0';
- }
+ if( strlen( path_copy ) > TITLES_MAX ) {
+ if( !strcasecmp( &(path_copy[ strlen( path_copy ) - TITLES_MAX ]),
+ "/video_ts" ) ) {
+ path_copy[ strlen( path_copy ) - TITLES_MAX ] = '\0';
+ }
+ }
+
+ if(path_copy[0] == '\0') {
+ path_copy[0] = '/';
+ path_copy[1] = '\0';
+ }
#if defined(SYS_BSD)
- if( ( fe = getfsfile( path_copy ) ) ) {
- dev_name = bsd_block2char( fe->fs_spec );
- fprintf( stderr,
- "libdvdread: Attempting to use device %s"
- " mounted on %s for CSS authentication\n",
- dev_name,
- fe->fs_file );
- auth_drive = DVDOpenImageFile( dev_name, have_css );
- }
+ if( ( fe = getfsfile( path_copy ) ) ) {
+ dev_name = bsd_block2char( fe->fs_spec );
+ fprintf( stderr,
+ "libdvdread: Attempting to use device %s"
+ " mounted on %s for CSS authentication\n",
+ dev_name,
+ fe->fs_file );
+ auth_drive = DVDOpenImageFile( dev_name, have_css );
+ }
#elif defined(__sun)
- mntfile = fopen( MNTTAB, "r" );
- if( mntfile ) {
- struct mnttab mp;
- int res;
+ mntfile = fopen( MNTTAB, "r" );
+ if( mntfile ) {
+ struct mnttab mp;
+ int res;
- while( ( res = getmntent( mntfile, &mp ) ) != -1 ) {
- if( res == 0 && !strcmp( mp.mnt_mountp, path_copy ) ) {
- dev_name = sun_block2char( mp.mnt_special );
- fprintf( stderr,
- "libdvdread: Attempting to use device %s"
- " mounted on %s for CSS authentication\n",
- dev_name,
- mp.mnt_mountp );
- auth_drive = DVDOpenImageFile( dev_name, have_css );
- break;
- }
- }
- fclose( mntfile );
+ while( ( res = getmntent( mntfile, &mp ) ) != -1 ) {
+ if( res == 0 && !strcmp( mp.mnt_mountp, path_copy ) ) {
+ dev_name = sun_block2char( mp.mnt_special );
+ fprintf( stderr,
+ "libdvdread: Attempting to use device %s"
+ " mounted on %s for CSS authentication\n",
+ dev_name,
+ mp.mnt_mountp );
+ auth_drive = DVDOpenImageFile( dev_name, have_css );
+ break;
}
+ }
+ fclose( mntfile );
+ }
#elif defined(__linux__)
- mntfile = fopen( MOUNTED, "r" );
- if( mntfile ) {
- struct mntent *me;
+ mntfile = fopen( MOUNTED, "r" );
+ if( mntfile ) {
+ struct mntent *me;
- while( ( me = getmntent( mntfile ) ) ) {
- if( !strcmp( me->mnt_dir, path_copy ) ) {
- fprintf( stderr,
- "libdvdread: Attempting to use device %s"
- " mounted on %s for CSS authentication\n",
- me->mnt_fsname,
- me->mnt_dir );
- auth_drive = DVDOpenImageFile( me->mnt_fsname, have_css );
- dev_name = strdup(me->mnt_fsname);
- break;
- }
- }
- fclose( mntfile );
+ while( ( me = getmntent( mntfile ) ) ) {
+ if( !strcmp( me->mnt_dir, path_copy ) ) {
+ fprintf( stderr,
+ "libdvdread: Attempting to use device %s"
+ " mounted on %s for CSS authentication\n",
+ me->mnt_fsname,
+ me->mnt_dir );
+ auth_drive = DVDOpenImageFile( me->mnt_fsname, have_css );
+ dev_name = strdup(me->mnt_fsname);
+ break;
}
+ }
+ fclose( mntfile );
+ }
#elif defined(_MSC_VER)
auth_drive = DVDOpenImageFile( path, have_css );
#endif
#ifndef _MSC_VER
- if( !dev_name ) {
- fprintf( stderr, "libdvdread: Couldn't find device name.\n" );
- } else if( !auth_drive ) {
- fprintf( stderr, "libdvdread: Device %s inaccessible, "
- "CSS authentication not available.\n", dev_name );
- }
+ if( !dev_name ) {
+ fprintf( stderr, "libdvdread: Couldn't find device name.\n" );
+ } else if( !auth_drive ) {
+ fprintf( stderr, "libdvdread: Device %s inaccessible, "
+ "CSS authentication not available.\n", dev_name );
+ }
#else
- if( !auth_drive ) {
- fprintf( stderr, "libdvdread: Device %s inaccessible, "
- "CSS authentication not available.\n", dev_name );
- }
+ if( !auth_drive ) {
+ fprintf( stderr, "libdvdread: Device %s inaccessible, "
+ "CSS authentication not available.\n", dev_name );
+ }
#endif
- free( dev_name );
- free( path_copy );
-
- /**
- * If we've opened a drive, just use that.
- */
- if( auth_drive ) {
- free(path);
- return auth_drive;
- }
+ free( dev_name );
+ free( path_copy );
- /**
- * Otherwise, we now try to open the directory tree instead.
- */
- ret_val = DVDOpenPath( path );
- free( path );
- return ret_val;
+ /**
+ * If we've opened a drive, just use that.
+ */
+ if( auth_drive ) {
+ free(path);
+ return auth_drive;
}
+ /**
+ * Otherwise, we now try to open the directory tree instead.
+ */
+ ret_val = DVDOpenPath( path );
+ free( path );
+ return ret_val;
+ }
- /* If it's none of the above, screw it. */
- fprintf( stderr, "libdvdread: Could not open %s\n", path );
- free( path );
- return NULL;
+ /* If it's none of the above, screw it. */
+ fprintf( stderr, "libdvdread: Could not open %s\n", path );
+ free( path );
+ return NULL;
}
void DVDClose( dvd_reader_t *dvd )
{
- if( dvd ) {
- if( dvd->dev ) dvdinput_close( dvd->dev );
- if( dvd->path_root ) free( dvd->path_root );
- if( dvd->udfcache ) FreeUDFCache( dvd->udfcache );
- free( dvd );
- }
+ if( dvd ) {
+ if( dvd->dev ) dvdinput_close( dvd->dev );
+ if( dvd->path_root ) free( dvd->path_root );
+ if( dvd->udfcache ) FreeUDFCache( dvd->udfcache );
+ free( dvd );
+ }
}
/**
@@ -566,28 +565,28 @@ void DVDClose( dvd_reader_t *dvd )
*/
static dvd_file_t *DVDOpenFileUDF( dvd_reader_t *dvd, char *filename )
{
- uint32_t start, len;
- dvd_file_t *dvd_file;
+ uint32_t start, len;
+ dvd_file_t *dvd_file;
- start = UDFFindFile( dvd, filename, &len );
- if( !start ) {
- fprintf( stderr, "libdvdnav:DVDOpenFileUDF:UDFFindFile %s failed\n", filename );
- return NULL;
- }
+ start = UDFFindFile( dvd, filename, &len );
+ if( !start ) {
+ fprintf( stderr, "libdvdnav:DVDOpenFileUDF:UDFFindFile %s failed\n", filename );
+ return NULL;
+ }
- dvd_file = (dvd_file_t *) malloc( sizeof( dvd_file_t ) );
- if( !dvd_file ) {
- fprintf( stderr, "libdvdnav:DVDOpenFileUDF:malloc failed\n" );
- return NULL;
- }
- dvd_file->dvd = dvd;
- dvd_file->lb_start = start;
- dvd_file->seek_pos = 0;
- memset( dvd_file->title_sizes, 0, sizeof( dvd_file->title_sizes ) );
- memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) );
- dvd_file->filesize = len / DVD_VIDEO_LB_LEN;
+ dvd_file = (dvd_file_t *) malloc( sizeof( dvd_file_t ) );
+ if( !dvd_file ) {
+ fprintf( stderr, "libdvdnav:DVDOpenFileUDF:malloc failed\n" );
+ return NULL;
+ }
+ dvd_file->dvd = dvd;
+ dvd_file->lb_start = start;
+ dvd_file->seek_pos = 0;
+ memset( dvd_file->title_sizes, 0, sizeof( dvd_file->title_sizes ) );
+ memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) );
+ dvd_file->filesize = len / DVD_VIDEO_LB_LEN;
- return dvd_file;
+ return dvd_file;
}
/**
@@ -598,55 +597,54 @@ static dvd_file_t *DVDOpenFileUDF( dvd_r
*/
static int findDirFile( const char *path, const char *file, char *filename )
{
- DIR *dir;
- struct dirent *ent;
+ DIR *dir;
+ struct dirent *ent;
- dir = opendir( path );
- if( !dir ) return -2;
+ dir = opendir( path );
+ if( !dir ) return -2;
- while( ( ent = readdir( dir ) ) != NULL ) {
- if( !strcasecmp( ent->d_name, file ) ) {
- sprintf( filename, "%s%s%s", path,
- ( ( path[ strlen( path ) - 1 ] == '/' ) ? "" : "/" ),
- ent->d_name );
- closedir( dir );
- return 0;
- }
+ while( ( ent = readdir( dir ) ) != NULL ) {
+ if( !strcasecmp( ent->d_name, file ) ) {
+ sprintf( filename, "%s%s%s", path,
+ ( ( path[ strlen( path ) - 1 ] == '/' ) ? "" : "/" ),
+ ent->d_name );
+ closedir(dir);
+ return 0;
}
-
- closedir( dir );
- return -1;
+ }
+ closedir(dir);
+ return -1;
}
static int findDVDFile( dvd_reader_t *dvd, const char *file, char *filename )
{
- char video_path[ PATH_MAX + 1 ];
- const char *nodirfile;
- int ret;
+ char video_path[ PATH_MAX + 1 ];
+ const char *nodirfile;
+ int ret;
- /* Strip off the directory for our search */
- if( !strncasecmp( "/VIDEO_TS/", file, 10 ) ) {
- nodirfile = &(file[ 10 ]);
- } else {
- nodirfile = file;
- }
+ /* Strip off the directory for our search */
+ if( !strncasecmp( "/VIDEO_TS/", file, 10 ) ) {
+ nodirfile = &(file[ 10 ]);
+ } else {
+ nodirfile = file;
+ }
- ret = findDirFile( dvd->path_root, nodirfile, filename );
+ ret = findDirFile( dvd->path_root, nodirfile, filename );
+ if( ret < 0 ) {
+ /* Try also with adding the path, just in case. */
+ sprintf( video_path, "%s/VIDEO_TS/", dvd->path_root );
+ ret = findDirFile( video_path, nodirfile, filename );
if( ret < 0 ) {
- /* Try also with adding the path, just in case. */
- sprintf( video_path, "%s/VIDEO_TS/", dvd->path_root );
- ret = findDirFile( video_path, nodirfile, filename );
- if( ret < 0 ) {
- /* Try with the path, but in lower case. */
- sprintf( video_path, "%s/video_ts/", dvd->path_root );
- ret = findDirFile( video_path, nodirfile, filename );
- if( ret < 0 ) {
- return 0;
- }
- }
+ /* Try with the path, but in lower case. */
+ sprintf( video_path, "%s/video_ts/", dvd->path_root );
+ ret = findDirFile( video_path, nodirfile, filename );
+ if( ret < 0 ) {
+ return 0;
+ }
}
+ }
- return 1;
+ return 1;
}
/**
@@ -654,263 +652,264 @@ static int findDVDFile( dvd_reader_t *dv
*/
static dvd_file_t *DVDOpenFilePath( dvd_reader_t *dvd, char *filename )
{
- char full_path[ PATH_MAX + 1 ];
- dvd_file_t *dvd_file;
- struct stat fileinfo;
- dvd_input_t dev;
+ char full_path[ PATH_MAX + 1 ];
+ dvd_file_t *dvd_file;
+ struct stat fileinfo;
+ dvd_input_t dev;
- /* Get the full path of the file. */
- if( !findDVDFile( dvd, filename, full_path ) ) {
- fprintf( stderr, "libdvdnav:DVDOpenFilePath:findDVDFile %s failed\n", filename );
- return NULL;
- }
+ /* Get the full path of the file. */
+ if( !findDVDFile( dvd, filename, full_path ) ) {
+ fprintf( stderr, "libdvdnav:DVDOpenFilePath:findDVDFile %s failed\n", filename );
+ return NULL;
+ }
- dev = dvdinput_open( full_path );
- if( !dev ) {
- fprintf( stderr, "libdvdnav:DVDOpenFilePath:dvdinput_open %s failed\n", full_path );
- return NULL;
- }
+ dev = dvdinput_open( full_path );
+ if( !dev ) {
+ fprintf( stderr, "libdvdnav:DVDOpenFilePath:dvdinput_open %s failed\n", full_path );
+ return NULL;
+ }
- dvd_file = (dvd_file_t *) malloc( sizeof( dvd_file_t ) );
- if( !dvd_file ) {
- fprintf( stderr, "libdvdnav:DVDOpenFilePath:dvd_file malloc failed\n" );
- dvdinput_close(dev);
- return NULL;
- }
- dvd_file->dvd = dvd;
- dvd_file->lb_start = 0;
- dvd_file->seek_pos = 0;
- memset( dvd_file->title_sizes, 0, sizeof( dvd_file->title_sizes ) );
- memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) );
- dvd_file->filesize = 0;
+ dvd_file = (dvd_file_t *) malloc( sizeof( dvd_file_t ) );
+ if( !dvd_file ) {
+ fprintf( stderr, "libdvdnav:DVDOpenFilePath:dvd_file malloc failed\n" );
+ dvdinput_close(dev);
+ return NULL;
+ }
+ dvd_file->dvd = dvd;
+ dvd_file->lb_start = 0;
+ dvd_file->seek_pos = 0;
+ memset( dvd_file->title_sizes, 0, sizeof( dvd_file->title_sizes ) );
+ memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) );
+ dvd_file->filesize = 0;
- if( stat( full_path, &fileinfo ) < 0 ) {
- fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
- free( dvd_file );
- return NULL;
- }
- dvd_file->title_sizes[ 0 ] = fileinfo.st_size / DVD_VIDEO_LB_LEN;
- dvd_file->title_devs[ 0 ] = dev;
- dvd_file->filesize = dvd_file->title_sizes[ 0 ];
+ if( stat( full_path, &fileinfo ) < 0 ) {
+ fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
+ free( dvd_file );
+ return NULL;
+ }
+ dvd_file->title_sizes[ 0 ] = fileinfo.st_size / DVD_VIDEO_LB_LEN;
+ dvd_file->title_devs[ 0 ] = dev;
+ dvd_file->filesize = dvd_file->title_sizes[ 0 ];
- return dvd_file;
+ return dvd_file;
}
static dvd_file_t *DVDOpenVOBUDF( dvd_reader_t *dvd, int title, int menu )
{
- char filename[ MAX_UDF_FILE_NAME_LEN ];
- uint32_t start, len;
- dvd_file_t *dvd_file;
+ char filename[ MAX_UDF_FILE_NAME_LEN ];
+ uint32_t start, len;
+ dvd_file_t *dvd_file;
- if( title == 0 ) {
- sprintf( filename, "/VIDEO_TS/VIDEO_TS.VOB" );
- } else {
- sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, menu ? 0 : 1 );
- }
- start = UDFFindFile( dvd, filename, &len );
- if( start == 0 ) return NULL;
+ if( title == 0 ) {
+ sprintf( filename, "/VIDEO_TS/VIDEO_TS.VOB" );
+ } else {
+ sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, menu ? 0 : 1 );
+ }
+ start = UDFFindFile( dvd, filename, &len );
+ if( start == 0 ) return NULL;
- dvd_file = (dvd_file_t *) malloc( sizeof( dvd_file_t ) );
- if( !dvd_file ) return NULL;
- dvd_file->dvd = dvd;
- /*Hack*/ dvd_file->css_title = title << 1 | menu;
- dvd_file->lb_start = start;
- dvd_file->seek_pos = 0;
- memset( dvd_file->title_sizes, 0, sizeof( dvd_file->title_sizes ) );
- memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) );
- dvd_file->filesize = len / DVD_VIDEO_LB_LEN;
+ dvd_file = (dvd_file_t *) malloc( sizeof( dvd_file_t ) );
+ if( !dvd_file ) return NULL;
+ dvd_file->dvd = dvd;
+ /*Hack*/ dvd_file->css_title = title << 1 | menu;
+ dvd_file->lb_start = start;
+ dvd_file->seek_pos = 0;
+ memset( dvd_file->title_sizes, 0, sizeof( dvd_file->title_sizes ) );
+ memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) );
+ dvd_file->filesize = len / DVD_VIDEO_LB_LEN;
- /* Calculate the complete file size for every file in the VOBS */
- if( !menu ) {
- int cur;
+ /* Calculate the complete file size for every file in the VOBS */
+ if( !menu ) {
+ int cur;
- for( cur = 2; cur < 10; cur++ ) {
- sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, cur );
- if( !UDFFindFile( dvd, filename, &len ) ) break;
- dvd_file->filesize += len / DVD_VIDEO_LB_LEN;
- }
+ for( cur = 2; cur < 10; cur++ ) {
+ sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, cur );
+ if( !UDFFindFile( dvd, filename, &len ) ) break;
+ dvd_file->filesize += len / DVD_VIDEO_LB_LEN;
}
+ }
- if( dvd->css_state == 1 /* Need key init */ ) {
- initAllCSSKeys( dvd );
- dvd->css_state = 2;
- }
- /*
- if( dvdinput_title( dvd_file->dvd->dev, (int)start ) < 0 ) {
- fprintf( stderr, "libdvdread: Error cracking CSS key for %s\n",
- filename );
- }
- */
+ if( dvd->css_state == 1 /* Need key init */ ) {
+ initAllCSSKeys( dvd );
+ dvd->css_state = 2;
+ }
+ /*
+ if( dvdinput_title( dvd_file->dvd->dev, (int)start ) < 0 ) {
+ fprintf( stderr, "libdvdread: Error cracking CSS key for %s\n",
+ filename );
+ }
+ */
- return dvd_file;
+ return dvd_file;
}
static dvd_file_t *DVDOpenVOBPath( dvd_reader_t *dvd, int title, int menu )
{
- char filename[ MAX_UDF_FILE_NAME_LEN ];
- char full_path[ PATH_MAX + 1 ];
- struct stat fileinfo;
- dvd_file_t *dvd_file;
- int i;
+ char filename[ MAX_UDF_FILE_NAME_LEN ];
+ char full_path[ PATH_MAX + 1 ];
+ struct stat fileinfo;
+ dvd_file_t *dvd_file;
+ int i;
- dvd_file = (dvd_file_t *) malloc( sizeof( dvd_file_t ) );
- if( !dvd_file ) return NULL;
- dvd_file->dvd = dvd;
- /*Hack*/ dvd_file->css_title = title << 1 | menu;
- dvd_file->lb_start = 0;
- dvd_file->seek_pos = 0;
- memset( dvd_file->title_sizes, 0, sizeof( dvd_file->title_sizes ) );
- memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) );
- dvd_file->filesize = 0;
+ dvd_file = (dvd_file_t *) malloc( sizeof( dvd_file_t ) );
+ if( !dvd_file ) return NULL;
+ dvd_file->dvd = dvd;
+ /*Hack*/ dvd_file->css_title = title << 1 | menu;
+ dvd_file->lb_start = 0;
+ dvd_file->seek_pos = 0;
+ memset( dvd_file->title_sizes, 0, sizeof( dvd_file->title_sizes ) );
+ memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) );
+ dvd_file->filesize = 0;
- if( menu ) {
- dvd_input_t dev;
+ if( menu ) {
+ dvd_input_t dev;
- if( title == 0 ) {
- sprintf( filename, "VIDEO_TS.VOB" );
- } else {
- sprintf( filename, "VTS_%02i_0.VOB", title );
- }
- if( !findDVDFile( dvd, filename, full_path ) ) {
- free( dvd_file );
- return NULL;
- }
+ if( title == 0 ) {
+ sprintf( filename, "VIDEO_TS.VOB" );
+ } else {
+ sprintf( filename, "VTS_%02i_0.VOB", title );
+ }
+ if( !findDVDFile( dvd, filename, full_path ) ) {
+ free( dvd_file );
+ return NULL;
+ }
- dev = dvdinput_open( full_path );
- if( dev == NULL ) {
- free( dvd_file );
- return NULL;
- }
+ dev = dvdinput_open( full_path );
+ if( dev == NULL ) {
+ free( dvd_file );
+ return NULL;
+ }
- if( stat( full_path, &fileinfo ) < 0 ) {
- fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
- dvdinput_close(dev);
- free( dvd_file );
- return NULL;
- }
- dvd_file->title_sizes[ 0 ] = fileinfo.st_size / DVD_VIDEO_LB_LEN;
- dvd_file->title_devs[ 0 ] = dev;
- dvdinput_title( dvd_file->title_devs[0], 0);
- dvd_file->filesize = dvd_file->title_sizes[ 0 ];
+ if( stat( full_path, &fileinfo ) < 0 ) {
+ fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
+ dvdinput_close(dev);
+ free( dvd_file );
+ return NULL;
+ }
+ dvd_file->title_sizes[ 0 ] = fileinfo.st_size / DVD_VIDEO_LB_LEN;
+ dvd_file->title_devs[ 0 ] = dev;
+ dvdinput_title( dvd_file->title_devs[0], 0);
+ dvd_file->filesize = dvd_file->title_sizes[ 0 ];
- } else {
- for( i = 0; i < TITLES_MAX; ++i ) {
+ } else {
+ for( i = 0; i < TITLES_MAX; ++i ) {
- sprintf( filename, "VTS_%02i_%i.VOB", title, i + 1 );
- if( !findDVDFile( dvd, filename, full_path ) ) {
- break;
- }
+ sprintf( filename, "VTS_%02i_%i.VOB", title, i + 1 );
+ if( !findDVDFile( dvd, filename, full_path ) ) {
+ break;
+ }
- if( stat( full_path, &fileinfo ) < 0 ) {
- fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
- break;
- }
+ if( stat( full_path, &fileinfo ) < 0 ) {
+ fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
+ break;
+ }
- dvd_file->title_sizes[ i ] = fileinfo.st_size / DVD_VIDEO_LB_LEN;
- dvd_file->title_devs[ i ] = dvdinput_open( full_path );
- dvdinput_title( dvd_file->title_devs[ i ], 0 );
- dvd_file->filesize += dvd_file->title_sizes[ i ];
- }
- if( !dvd_file->title_devs[ 0 ] ) {
- free( dvd_file );
- return NULL;
- }
+ dvd_file->title_sizes[ i ] = fileinfo.st_size / DVD_VIDEO_LB_LEN;
+ dvd_file->title_devs[ i ] = dvdinput_open( full_path );
+ dvdinput_title( dvd_file->title_devs[ i ], 0 );
+ dvd_file->filesize += dvd_file->title_sizes[ i ];
}
+ if( !dvd_file->title_devs[ 0 ] ) {
+ free( dvd_file );
+ return NULL;
+ }
+ }
- return dvd_file;
+ return dvd_file;
}
dvd_file_t *DVDOpenFile( dvd_reader_t *dvd, int titlenum,
dvd_read_domain_t domain )
{
- char filename[ MAX_UDF_FILE_NAME_LEN ];
+ char filename[ MAX_UDF_FILE_NAME_LEN ];
- /* Check arguments. */
- if( dvd == NULL || titlenum < 0 )
- return NULL;
+ /* Check arguments. */
+ if( dvd == NULL || titlenum < 0 )
+ return NULL;
- switch( domain ) {
- case DVD_READ_INFO_FILE:
- if( titlenum == 0 ) {
- sprintf( filename, "/VIDEO_TS/VIDEO_TS.IFO" );
- } else {
- sprintf( filename, "/VIDEO_TS/VTS_%02i_0.IFO", titlenum );
- }
- break;
- case DVD_READ_INFO_BACKUP_FILE:
- if( titlenum == 0 ) {
- sprintf( filename, "/VIDEO_TS/VIDEO_TS.BUP" );
- } else {
- sprintf( filename, "/VIDEO_TS/VTS_%02i_0.BUP", titlenum );
- }
- break;
- case DVD_READ_MENU_VOBS:
- if( dvd->isImageFile ) {
- return DVDOpenVOBUDF( dvd, titlenum, 1 );
- } else {
- return DVDOpenVOBPath( dvd, titlenum, 1 );
- }
- break;
- case DVD_READ_TITLE_VOBS:
- if( titlenum == 0 ) return 0;
- if( dvd->isImageFile ) {
- return DVDOpenVOBUDF( dvd, titlenum, 0 );
- } else {
- return DVDOpenVOBPath( dvd, titlenum, 0 );
- }
- break;
- default:
- fprintf( stderr, "libdvdread: Invalid domain for file open.\n" );
- return NULL;
+ switch( domain ) {
+ case DVD_READ_INFO_FILE:
+ if( titlenum == 0 ) {
+ sprintf( filename, "/VIDEO_TS/VIDEO_TS.IFO" );
+ } else {
+ sprintf( filename, "/VIDEO_TS/VTS_%02i_0.IFO", titlenum );
}
-
+ break;
+ case DVD_READ_INFO_BACKUP_FILE:
+ if( titlenum == 0 ) {
+ sprintf( filename, "/VIDEO_TS/VIDEO_TS.BUP" );
+ } else {
+ sprintf( filename, "/VIDEO_TS/VTS_%02i_0.BUP", titlenum );
+ }
+ break;
+ case DVD_READ_MENU_VOBS:
if( dvd->isImageFile ) {
- return DVDOpenFileUDF( dvd, filename );
+ return DVDOpenVOBUDF( dvd, titlenum, 1 );
} else {
- return DVDOpenFilePath( dvd, filename );
+ return DVDOpenVOBPath( dvd, titlenum, 1 );
}
+ break;
+ case DVD_READ_TITLE_VOBS:
+ if( titlenum == 0 ) return 0;
+ if( dvd->isImageFile ) {
+ return DVDOpenVOBUDF( dvd, titlenum, 0 );
+ } else {
+ return DVDOpenVOBPath( dvd, titlenum, 0 );
+ }
+ break;
+ default:
+ fprintf( stderr, "libdvdread: Invalid domain for file open.\n" );
+ return NULL;
+ }
+
+ if( dvd->isImageFile ) {
+ return DVDOpenFileUDF( dvd, filename );
+ } else {
+ return DVDOpenFilePath( dvd, filename );
+ }
}
void DVDCloseFile( dvd_file_t *dvd_file )
{
- int i;
+ int i;
- if( dvd_file ) {
- if( dvd_file->dvd->isImageFile ) {
- ;
- } else {
- for( i = 0; i < TITLES_MAX; ++i ) {
- if( dvd_file->title_devs[ i ] ) {
- dvdinput_close( dvd_file->title_devs[i] );
- }
- }
+ if( dvd_file ) {
+ if( dvd_file->dvd->isImageFile ) {
+ ;
+ } else {
+ for( i = 0; i < TITLES_MAX; ++i ) {
+ if( dvd_file->title_devs[ i ] ) {
+ dvdinput_close( dvd_file->title_devs[i] );
}
-
- free( dvd_file );
- dvd_file = 0;
+ }
}
+
+ free( dvd_file );
+ dvd_file = 0;
+ }
}
/* Internal, but used from dvd_udf.c */
int UDFReadBlocksRaw( dvd_reader_t *device, uint32_t lb_number,
- size_t block_count, unsigned char *data,
- int encrypted )
+ size_t block_count, unsigned char *data,
+ int encrypted )
{
- int ret;
- if( !device->dev ) {
- fprintf( stderr, "libdvdread: Fatal error in block read.\n" );
- return 0;
- }
+ int ret;
- ret = dvdinput_seek( device->dev, (int) lb_number );
- if( ret != (int) lb_number ) {
- fprintf( stderr, "libdvdread: Can't seek to block %u\n", lb_number );
- return 0;
- }
+ if( !device->dev ) {
+ fprintf( stderr, "libdvdread: Fatal error in block read.\n" );
+ return 0;
+ }
- ret = dvdinput_read( device->dev, (char *) data,
- (int) block_count, encrypted );
- return ret;
+ ret = dvdinput_seek( device->dev, (int) lb_number );
+ if( ret != (int) lb_number ) {
+ fprintf( stderr, "libdvdread: Can't seek to block %u\n", lb_number );
+ return 0;
+ }
+
+ ret = dvdinput_read( device->dev, (char *) data,
+ (int) block_count, encrypted );
+ return ret;
}
/* This is using a single input and starting from 'dvd_file->lb_start' offset.
@@ -923,8 +922,8 @@ static int DVDReadBlocksUDF( dvd_file_t
size_t block_count, unsigned char *data,
int encrypted )
{
- return UDFReadBlocksRaw( dvd_file->dvd, dvd_file->lb_start + offset,
- block_count, data, encrypted );
+ return UDFReadBlocksRaw( dvd_file->dvd, dvd_file->lb_start + offset,
+ block_count, data, encrypted );
}
/* This is using possibly several inputs and starting from an offset of '0'.
@@ -937,238 +936,240 @@ static int DVDReadBlocksPath( dvd_file_t
size_t block_count, unsigned char *data,
int encrypted )
{
- int i;
- int ret, ret2, off;
+ int i;
+ int ret, ret2, off;
- ret = 0;
- ret2 = 0;
- for( i = 0; i < TITLES_MAX; ++i ) {
- if( !dvd_file->title_sizes[ i ] ) return 0; /* Past end of file */
+ ret = 0;
+ ret2 = 0;
+ for( i = 0; i < TITLES_MAX; ++i ) {
+ if( !dvd_file->title_sizes[ i ] ) return 0; /* Past end of file */
- if( offset < dvd_file->title_sizes[ i ] ) {
- if( ( offset + block_count ) <= dvd_file->title_sizes[ i ] ) {
- off = dvdinput_seek( dvd_file->title_devs[ i ], (int)offset );
- if( off < 0 || off != (int)offset ) {
- fprintf( stderr, "libdvdread: Can't seek to block %d\n",
- offset );
- return off < 0 ? off : 0;
- }
- ret = dvdinput_read( dvd_file->title_devs[ i ], data,
- (int)block_count, encrypted );
- break;
- } else {
- size_t part1_size = dvd_file->title_sizes[ i ] - offset;
- /* FIXME: Really needs to be a while loop.
- * (This is only true if you try and read >1GB at a time) */
+ if( offset < dvd_file->title_sizes[ i ] ) {
+ if( ( offset + block_count ) <= dvd_file->title_sizes[ i ] ) {
+ off = dvdinput_seek( dvd_file->title_devs[ i ], (int)offset );
+ if( off < 0 || off != (int)offset ) {
+ fprintf( stderr, "libdvdread: Can't seek to block %d\n",
+ offset );
+ return off < 0 ? off : 0;
+ }
+ ret = dvdinput_read( dvd_file->title_devs[ i ], data,
+ (int)block_count, encrypted );
+ break;
+ } else {
+ size_t part1_size = dvd_file->title_sizes[ i ] - offset;
+ /* FIXME: Really needs to be a while loop.
+ * (This is only true if you try and read >1GB at a time) */
- /* Read part 1 */
- off = dvdinput_seek( dvd_file->title_devs[ i ], (int)offset );
- if( off < 0 || off != (int)offset ) {
- fprintf( stderr, "libdvdread: Can't seek to block %d\n",
- offset );
- return off < 0 ? off : 0;
- }
- ret = dvdinput_read( dvd_file->title_devs[ i ], data,
- (int)part1_size, encrypted );
- if( ret < 0 ) return ret;
- /* FIXME: This is wrong if i is the last file in the set.
- * also error from this read will not show in ret. */
+ /* Read part 1 */
+ off = dvdinput_seek( dvd_file->title_devs[ i ], (int)offset );
+ if( off < 0 || off != (int)offset ) {
+ fprintf( stderr, "libdvdread: Can't seek to block %d\n",
+ offset );
+ return off < 0 ? off : 0;
+ }
+ ret = dvdinput_read( dvd_file->title_devs[ i ], data,
+ (int)part1_size, encrypted );
+ if( ret < 0 ) return ret;
+ /* FIXME: This is wrong if i is the last file in the set.
+ * also error from this read will not show in ret. */
- /* Does the next part exist? If not then return now. */
- if( i + 1 >= TITLES_MAX || !dvd_file->title_devs[ i + 1 ] )
- return ret;
+ /* Does the next part exist? If not then return now. */
+ if( i + 1 >= TITLES_MAX || !dvd_file->title_devs[ i + 1 ] )
+ return ret;
- /* Read part 2 */
- off = dvdinput_seek( dvd_file->title_devs[ i + 1 ], 0 );
- if( off < 0 || off != 0 ) {
- fprintf( stderr, "libdvdread: Can't seek to block %d\n",
- 0 );
- return off < 0 ? off : 0;
- }
- ret2 = dvdinput_read( dvd_file->title_devs[ i + 1 ],
- data + ( part1_size
- * (int64_t)DVD_VIDEO_LB_LEN ),
- (int)(block_count - part1_size),
- encrypted );
- if( ret2 < 0 ) return ret2;
- break;
- }
- } else {
- offset -= dvd_file->title_sizes[ i ];
+ /* Read part 2 */
+ off = dvdinput_seek( dvd_file->title_devs[ i + 1 ], 0 );
+ if( off < 0 || off != 0 ) {
+ fprintf( stderr, "libdvdread: Can't seek to block %d\n",
+ 0 );
+ return off < 0 ? off : 0;
}
+ ret2 = dvdinput_read( dvd_file->title_devs[ i + 1 ],
+ data + ( part1_size
+ * (int64_t)DVD_VIDEO_LB_LEN ),
+ (int)(block_count - part1_size),
+ encrypted );
+ if( ret2 < 0 ) return ret2;
+ break;
+ }
+ } else {
+ offset -= dvd_file->title_sizes[ i ];
}
+ }
- return ret + ret2;
+ return ret + ret2;
}
/* This is broken reading more than 2Gb at a time is ssize_t is 32-bit. */
ssize_t DVDReadBlocks( dvd_file_t *dvd_file, int offset,
size_t block_count, unsigned char *data )
{
- int ret;
- /* Check arguments. */
- if( dvd_file == NULL || offset < 0 || data == NULL )
- return -1;
+ int ret;
- /* Hack, and it will still fail for multiple opens in a threaded app ! */
- if( dvd_file->dvd->css_title != dvd_file->css_title ) {
- dvd_file->dvd->css_title = dvd_file->css_title;
- if( dvd_file->dvd->isImageFile ) {
- dvdinput_title( dvd_file->dvd->dev, (int)dvd_file->lb_start );
- }
- /* Here each vobu has it's own dvdcss handle, so no need to update
- else {
- dvdinput_title( dvd_file->title_devs[ 0 ], (int)dvd_file->lb_start );
- }*/
- }
+ /* Check arguments. */
+ if( dvd_file == NULL || offset < 0 || data == NULL )
+ return -1;
+ /* Hack, and it will still fail for multiple opens in a threaded app ! */
+ if( dvd_file->dvd->css_title != dvd_file->css_title ) {
+ dvd_file->dvd->css_title = dvd_file->css_title;
if( dvd_file->dvd->isImageFile ) {
- ret = DVDReadBlocksUDF( dvd_file, (uint32_t)offset,
- block_count, data, DVDINPUT_READ_DECRYPT );
- } else {
- ret = DVDReadBlocksPath( dvd_file, (unsigned int)offset,
- block_count, data, DVDINPUT_READ_DECRYPT );
+ dvdinput_title( dvd_file->dvd->dev, (int)dvd_file->lb_start );
}
+ /* Here each vobu has it's own dvdcss handle, so no need to update
+ else {
+ dvdinput_title( dvd_file->title_devs[ 0 ], (int)dvd_file->lb_start );
+ }*/
+ }
- return (ssize_t)ret;
+ if( dvd_file->dvd->isImageFile ) {
+ ret = DVDReadBlocksUDF( dvd_file, (uint32_t)offset,
+ block_count, data, DVDINPUT_READ_DECRYPT );
+ } else {
+ ret = DVDReadBlocksPath( dvd_file, (unsigned int)offset,
+ block_count, data, DVDINPUT_READ_DECRYPT );
+ }
+
+ return (ssize_t)ret;
}
int32_t DVDFileSeek( dvd_file_t *dvd_file, int32_t offset )
{
- /* Check arguments. */
- if( dvd_file == NULL || offset < 0 )
- return -1;
+ /* Check arguments. */
+ if( dvd_file == NULL || offset < 0 )
+ return -1;
- if( offset > dvd_file->filesize * DVD_VIDEO_LB_LEN ) {
- return -1;
- }
- dvd_file->seek_pos = (uint32_t) offset;
- return offset;
+ if( offset > dvd_file->filesize * DVD_VIDEO_LB_LEN ) {
+ return -1;
+ }
+ dvd_file->seek_pos = (uint32_t) offset;
+ return offset;
}
int DVDFileSeekForce(dvd_file_t *dvd_file, int offset, int force_size)
{
- /* Check arguments. */
- if( dvd_file == NULL || offset <= 0 )
- return -1;
+ /* Check arguments. */
+ if( dvd_file == NULL || offset <= 0 )
+ return -1;
- if( dvd_file->dvd->isImageFile ) {
- if( force_size < 0 )
- force_size = (offset - 1) / DVD_VIDEO_LB_LEN + 1;
- if( dvd_file->filesize < force_size ) {
- dvd_file->filesize = force_size;
- fprintf(stderr, "libdvdread: Ignored size of file indicated in UDF.\n");
- }
+ if( dvd_file->dvd->isImageFile ) {
+ if( force_size < 0 )
+ force_size = (offset - 1) / DVD_VIDEO_LB_LEN + 1;
+ if( dvd_file->filesize < force_size ) {
+ dvd_file->filesize = force_size;
+ fprintf(stderr, "libdvdread: Ignored size of file indicated in UDF.\n");
}
+ }
- if( offset > dvd_file->filesize * DVD_VIDEO_LB_LEN )
- return -1;
+ if( offset > dvd_file->filesize * DVD_VIDEO_LB_LEN )
+ return -1;
- dvd_file->seek_pos = (uint32_t) offset;
- return offset;
+ dvd_file->seek_pos = (uint32_t) offset;
+ return offset;
}
ssize_t DVDReadBytes( dvd_file_t *dvd_file, void *data, size_t byte_size )
{
- unsigned char *secbuf_base, *secbuf;
- unsigned int numsec, seek_sector, seek_byte;
- int ret;
-
- /* Check arguments. */
- if( dvd_file == NULL || data == NULL )
- return -1;
+ unsigned char *secbuf_base, *secbuf;
+ unsigned int numsec, seek_sector, seek_byte;
+ int ret;
- seek_sector = dvd_file->seek_pos / DVD_VIDEO_LB_LEN;
- seek_byte = dvd_file->seek_pos % DVD_VIDEO_LB_LEN;
+ /* Check arguments. */
+ if( dvd_file == NULL || data == NULL )
+ return -1;
- numsec = ( ( seek_byte + byte_size ) / DVD_VIDEO_LB_LEN ) +
- ( ( ( seek_byte + byte_size ) % DVD_VIDEO_LB_LEN ) ? 1 : 0 );
+ seek_sector = dvd_file->seek_pos / DVD_VIDEO_LB_LEN;
+ seek_byte = dvd_file->seek_pos % DVD_VIDEO_LB_LEN;
- secbuf_base = (unsigned char *) malloc( numsec * DVD_VIDEO_LB_LEN + 2048 );
- secbuf = (unsigned char *)(((uintptr_t)secbuf_base & ~((uintptr_t)2047)) + 2048);
- if( !secbuf_base ) {
- fprintf( stderr, "libdvdread: Can't allocate memory "
- "for file read!\n" );
- return 0;
- }
+ numsec = ( ( seek_byte + byte_size ) / DVD_VIDEO_LB_LEN ) +
+ ( ( ( seek_byte + byte_size ) % DVD_VIDEO_LB_LEN ) ? 1 : 0 );
- if( dvd_file->dvd->isImageFile ) {
- ret = DVDReadBlocksUDF( dvd_file, (uint32_t) seek_sector,
- (size_t) numsec, secbuf, DVDINPUT_NOFLAGS );
- } else {
- ret = DVDReadBlocksPath( dvd_file, seek_sector,
- (size_t) numsec, secbuf, DVDINPUT_NOFLAGS );
- }
+ secbuf_base = (unsigned char *) malloc( numsec * DVD_VIDEO_LB_LEN + 2048 );
+ secbuf = (unsigned char *)(((uintptr_t)secbuf_base & ~((uintptr_t)2047)) + 2048);
+ if( !secbuf_base ) {
+ fprintf( stderr, "libdvdread: Can't allocate memory "
+ "for file read!\n" );
+ return 0;
+ }
- if( ret != (int) numsec ) {
- free( secbuf_base );
- return ret < 0 ? ret : 0;
- }
+ if( dvd_file->dvd->isImageFile ) {
+ ret = DVDReadBlocksUDF( dvd_file, (uint32_t) seek_sector,
+ (size_t) numsec, secbuf, DVDINPUT_NOFLAGS );
+ } else {
+ ret = DVDReadBlocksPath( dvd_file, seek_sector,
+ (size_t) numsec, secbuf, DVDINPUT_NOFLAGS );
+ }
- memcpy( data, &(secbuf[ seek_byte ]), byte_size );
+ if( ret != (int) numsec ) {
free( secbuf_base );
+ return ret < 0 ? ret : 0;
+ }
- DVDFileSeekForce(dvd_file, dvd_file->seek_pos + byte_size, -1);
- return byte_size;
+ memcpy( data, &(secbuf[ seek_byte ]), byte_size );
+ free( secbuf_base );
+
+ DVDFileSeekForce(dvd_file, dvd_file->seek_pos + byte_size, -1);
+ return byte_size;
}
ssize_t DVDFileSize( dvd_file_t *dvd_file )
{
- /* Check arguments. */
- if( dvd_file == NULL )
- return -1;
+ /* Check arguments. */
+ if( dvd_file == NULL )
+ return -1;
- return dvd_file->filesize;
+ return dvd_file->filesize;
}
int DVDDiscID( dvd_reader_t *dvd, unsigned char *discid )
{
- struct md5_ctx ctx;
- int title;
- int nr_of_files = 0;
+ struct md5_ctx ctx;
+ int title;
+ int nr_of_files = 0;
- /* Check arguments. */
- if( dvd == NULL || discid == NULL )
- return 0;
+ /* Check arguments. */
+ if( dvd == NULL || discid == NULL )
+ return 0;
- /* Go through the first 10 IFO:s, in order,
- * and md5sum them, i.e VIDEO_TS.IFO and VTS_0?_0.IFO */
- md5_init_ctx( &ctx );
- for( title = 0; title < 10; title++ ) {
- dvd_file_t *dvd_file = DVDOpenFile( dvd, title, DVD_READ_INFO_FILE );
- if( dvd_file != NULL ) {
- ssize_t bytes_read;
- size_t file_size = dvd_file->filesize * DVD_VIDEO_LB_LEN;
- char *buffer_base = malloc( file_size + 2048 );
- char *buffer = (char *)(((uintptr_t)buffer_base & ~((uintptr_t)2047)) + 2048);
+ /* Go through the first 10 IFO:s, in order,
+ * and md5sum them, i.e VIDEO_TS.IFO and VTS_0?_0.IFO */
+ md5_init_ctx( &ctx );
+ for( title = 0; title < 10; title++ ) {
+ dvd_file_t *dvd_file = DVDOpenFile( dvd, title, DVD_READ_INFO_FILE );
+ if( dvd_file != NULL ) {
+ ssize_t bytes_read;
+ size_t file_size = dvd_file->filesize * DVD_VIDEO_LB_LEN;
+ char *buffer_base = malloc( file_size + 2048 );
+ char *buffer = (char *)(((uintptr_t)buffer_base & ~((uintptr_t)2047)) + 2048);
- if( buffer_base == NULL ) {
- DVDCloseFile( dvd_file );
- fprintf( stderr, "libdvdread: DVDDiscId, failed to "
- "allocate memory for file read!\n" );
- return -1;
- }
- bytes_read = DVDReadBytes( dvd_file, buffer, file_size );
- if( bytes_read != file_size ) {
- fprintf( stderr, "libdvdread: DVDDiscId read returned %zd bytes"
- ", wanted %zd\n", bytes_read, file_size );
- DVDCloseFile( dvd_file );
- free( buffer_base );
- return -1;
- }
+ if( buffer_base == NULL ) {
+ DVDCloseFile( dvd_file );
+ fprintf( stderr, "libdvdread: DVDDiscId, failed to "
+ "allocate memory for file read!\n" );
+ return -1;
+ }
- md5_process_bytes( buffer, file_size, &ctx );
+ bytes_read = DVDReadBytes( dvd_file, buffer, file_size );
+ if( bytes_read != file_size ) {
+ fprintf( stderr, "libdvdread: DVDDiscId read returned %zd bytes"
+ ", wanted %zd\n", bytes_read, file_size );
+ DVDCloseFile( dvd_file );
+ free( buffer_base );
+ return -1;
+ }
- DVDCloseFile( dvd_file );
- free( buffer_base );
- nr_of_files++;
- }
+ md5_process_bytes( buffer, file_size, &ctx );
+
+ DVDCloseFile( dvd_file );
+ free( buffer_base );
+ nr_of_files++;
}
- md5_finish_ctx( &ctx, discid );
- if(!nr_of_files)
- return -1;
+ }
+ md5_finish_ctx( &ctx, discid );
+ if(!nr_of_files)
+ return -1;
- return 0;
+ return 0;
}
Modified: trunk/libdvdread/src/dvd_udf.c
==============================================================================
--- trunk/libdvdread/src/dvd_udf.c (original)
+++ trunk/libdvdread/src/dvd_udf.c Thu Sep 25 11:17:42 2008
@@ -44,8 +44,8 @@
/* Private but located in/shared with dvd_reader.c */
extern int UDFReadBlocksRaw( dvd_reader_t *device, uint32_t lb_number,
- size_t block_count, unsigned char *data,
- int encrypted );
+ size_t block_count, unsigned char *data,
+ int encrypted );
/* It's required to either fail or deliver all the blocks asked for. */
static int DVDReadLBUDF( dvd_reader_t *device, uint32_t lb_number,
@@ -56,6 +56,7 @@ static int DVDReadLBUDF( dvd_reader_t *d
size_t count = block_count;
while(count > 0) {
+
ret = UDFReadBlocksRaw(device, lb_number, count, data, encrypted);
if(ret <= 0) {
@@ -201,16 +202,16 @@ static int GetUDFCache(dvd_reader_t *dev
case LBUDFCache:
for(n = 0; n < c->lb_num; n++) {
if(c->lbs[n].lb == nr) {
- *(uint8_t **)data = c->lbs[n].data;
- return 1;
+ *(uint8_t **)data = c->lbs[n].data;
+ return 1;
}
}
break;
case MapCache:
for(n = 0; n < c->map_num; n++) {
if(c->maps[n].lbn == nr) {
- *(struct icbmap *)data = c->maps[n];
- return 1;
+ *(struct icbmap *)data = c->maps[n];
+ return 1;
}
}
break;
@@ -262,19 +263,19 @@ static int SetUDFCache(dvd_reader_t *dev
case LBUDFCache:
for(n = 0; n < c->lb_num; n++) {
if(c->lbs[n].lb == nr) {
- /* replace with new data */
- c->lbs[n].data_base = ((uint8_t **)data)[0];
- c->lbs[n].data = ((uint8_t **)data)[1];
- c->lbs[n].lb = nr;
- return 1;
+ /* replace with new data */
+ c->lbs[n].data_base = ((uint8_t **)data)[0];
+ c->lbs[n].data = ((uint8_t **)data)[1];
+ c->lbs[n].lb = nr;
+ return 1;
}
}
c->lb_num++;
tmp = realloc(c->lbs, c->lb_num * sizeof(struct lbudf));
/*
fprintf(stderr, "realloc lb: %d * %d = %d\n",
- c->lb_num, sizeof(struct lbudf),
- c->lb_num * sizeof(struct lbudf));
+ c->lb_num, sizeof(struct lbudf),
+ c->lb_num * sizeof(struct lbudf));
*/
if(tmp == NULL) {
if(c->lbs) free(c->lbs);
@@ -289,10 +290,10 @@ static int SetUDFCache(dvd_reader_t *dev
case MapCache:
for(n = 0; n < c->map_num; n++) {
if(c->maps[n].lbn == nr) {
- /* replace with new data */
- c->maps[n] = *(struct icbmap *)data;
- c->maps[n].lbn = nr;
- return 1;
+ /* replace with new data */
+ c->maps[n] = *(struct icbmap *)data;
+ c->maps[n].lbn = nr;
+ return 1;
}
}
c->map_num++;
@@ -322,94 +323,94 @@ static int SetUDFCache(dvd_reader_t *dev
/* For direct data access, LSB first */
#define GETN1(p) ((uint8_t)data[p])
#define GETN2(p) ((uint16_t)data[p] | ((uint16_t)data[(p) + 1] << 8))
-#define GETN3(p) ((uint32_t)data[p] | ((uint32_t)data[(p) + 1] << 8) \
+#define GETN3(p) ((uint32_t)data[p] | ((uint32_t)data[(p) + 1] << 8) \
| ((uint32_t)data[(p) + 2] << 16))
-#define GETN4(p) ((uint32_t)data[p] \
- | ((uint32_t)data[(p) + 1] << 8) \
- | ((uint32_t)data[(p) + 2] << 16) \
+#define GETN4(p) ((uint32_t)data[p] \
+ | ((uint32_t)data[(p) + 1] << 8) \
+ | ((uint32_t)data[(p) + 2] << 16) \
| ((uint32_t)data[(p) + 3] << 24))
/* This is wrong with regard to endianess */
#define GETN(p, n, target) memcpy(target, &data[p], n)
static int Unicodedecode( uint8_t *data, int len, char *target )
{
- int p = 1, i = 0;
+ int p = 1, i = 0;
- if( ( data[ 0 ] == 8 ) || ( data[ 0 ] == 16 ) ) do {
- if( data[ 0 ] == 16 ) p++; /* Ignore MSB of unicode16 */
- if( p < len ) {
- target[ i++ ] = data[ p++ ];
- }
- } while( p < len );
+ if( ( data[ 0 ] == 8 ) || ( data[ 0 ] == 16 ) ) do {
+ if( data[ 0 ] == 16 ) p++; /* Ignore MSB of unicode16 */
+ if( p < len ) {
+ target[ i++ ] = data[ p++ ];
+ }
+ } while( p < len );
- target[ i ] = '\0';
- return 0;
+ target[ i ] = '\0';
+ return 0;
}
static int UDFDescriptor( uint8_t *data, uint16_t *TagID )
{
- *TagID = GETN2(0);
- /* TODO: check CRC 'n stuff */
- return 0;
+ *TagID = GETN2(0);
+ /* TODO: check CRC 'n stuff */
+ return 0;
}
static int UDFExtentAD( uint8_t *data, uint32_t *Length, uint32_t *Location )
{
- *Length = GETN4(0);
- *Location = GETN4(4);
- return 0;
+ *Length = GETN4(0);
+ *Location = GETN4(4);
+ return 0;
}
static int UDFShortAD( uint8_t *data, struct AD *ad,
struct Partition *partition )
{
- ad->Length = GETN4(0);
- ad->Flags = ad->Length >> 30;
- ad->Length &= 0x3FFFFFFF;
- ad->Location = GETN4(4);
- ad->Partition = partition->Number; /* use number of current partition */
- return 0;
+ ad->Length = GETN4(0);
+ ad->Flags = ad->Length >> 30;
+ ad->Length &= 0x3FFFFFFF;
+ ad->Location = GETN4(4);
+ ad->Partition = partition->Number; /* use number of current partition */
+ return 0;
}
static int UDFLongAD( uint8_t *data, struct AD *ad )
{
- ad->Length = GETN4(0);
- ad->Flags = ad->Length >> 30;
- ad->Length &= 0x3FFFFFFF;
- ad->Location = GETN4(4);
- ad->Partition = GETN2(8);
- /* GETN(10, 6, Use); */
- return 0;
+ ad->Length = GETN4(0);
+ ad->Flags = ad->Length >> 30;
+ ad->Length &= 0x3FFFFFFF;
+ ad->Location = GETN4(4);
+ ad->Partition = GETN2(8);
+ /* GETN(10, 6, Use); */
+ return 0;
}
static int UDFExtAD( uint8_t *data, struct AD *ad )
{
- ad->Length = GETN4(0);
- ad->Flags = ad->Length >> 30;
- ad->Length &= 0x3FFFFFFF;
- ad->Location = GETN4(12);
- ad->Partition = GETN2(16);
- /* GETN(10, 6, Use); */
- return 0;
+ ad->Length = GETN4(0);
+ ad->Flags = ad->Length >> 30;
+ ad->Length &= 0x3FFFFFFF;
+ ad->Location = GETN4(12);
+ ad->Partition = GETN2(16);
+ /* GETN(10, 6, Use); */
+ return 0;
}
static int UDFICB( uint8_t *data, uint8_t *FileType, uint16_t *Flags )
{
- *FileType = GETN1(11);
- *Flags = GETN2(18);
- return 0;
+ *FileType = GETN1(11);
+ *Flags = GETN2(18);
+ return 0;
}
static int UDFPartition( uint8_t *data, uint16_t *Flags, uint16_t *Number,
char *Contents, uint32_t *Start, uint32_t *Length )
{
- *Flags = GETN2(20);
- *Number = GETN2(22);
- GETN(24, 32, Contents);
- *Start = GETN4(188);
- *Length = GETN4(192);
- return 0;
+ *Flags = GETN2(20);
+ *Number = GETN2(22);
+ GETN(24, 32, Contents);
+ *Start = GETN4(188);
+ *Length = GETN4(192);
+ return 0;
}
/**
@@ -418,66 +419,66 @@ static int UDFPartition( uint8_t *data,
*/
static int UDFLogVolume( uint8_t *data, char *VolumeDescriptor )
{
- uint32_t lbsize, MT_L, N_PM;
- Unicodedecode(&data[84], 128, VolumeDescriptor);
- lbsize = GETN4(212); /* should be 2048 */
- MT_L = GETN4(264); /* should be 6 */
- N_PM = GETN4(268); /* should be 1 */
- if (lbsize != DVD_VIDEO_LB_LEN) return 1;
- return 0;
+ uint32_t lbsize, MT_L, N_PM;
+ Unicodedecode(&data[84], 128, VolumeDescriptor);
+ lbsize = GETN4(212); /* should be 2048 */
+ MT_L = GETN4(264); /* should be 6 */
+ N_PM = GETN4(268); /* should be 1 */
+ if (lbsize != DVD_VIDEO_LB_LEN) return 1;
+ return 0;
}
static int UDFFileEntry( uint8_t *data, uint8_t *FileType,
struct Partition *partition, struct AD *ad )
{
- uint16_t flags;
- uint32_t L_EA, L_AD;
- unsigned int p;
+ uint16_t flags;
+ uint32_t L_EA, L_AD;
+ unsigned int p;
- UDFICB( &data[ 16 ], FileType, &flags );
+ UDFICB( &data[ 16 ], FileType, &flags );
- /* Init ad for an empty file (i.e. there isn't a AD, L_AD == 0 ) */
- ad->Length = GETN4( 60 ); /* Really 8 bytes a 56 */
- ad->Flags = 0;
- ad->Location = 0; /* what should we put here? */
- ad->Partition = partition->Number; /* use number of current partition */
+ /* Init ad for an empty file (i.e. there isn't a AD, L_AD == 0 ) */
+ ad->Length = GETN4( 60 ); /* Really 8 bytes a 56 */
+ ad->Flags = 0;
+ ad->Location = 0; /* what should we put here? */
+ ad->Partition = partition->Number; /* use number of current partition */
- L_EA = GETN4( 168 );
- L_AD = GETN4( 172 );
- p = 176 + L_EA;
- while( p < 176 + L_EA + L_AD ) {
- switch( flags & 0x0007 ) {
- case 0: UDFShortAD( &data[ p ], ad, partition ); p += 8; break;
- case 1: UDFLongAD( &data[ p ], ad ); p += 16; break;
- case 2: UDFExtAD( &data[ p ], ad ); p += 20; break;
- case 3:
- switch( L_AD ) {
- case 8: UDFShortAD( &data[ p ], ad, partition ); break;
- case 16: UDFLongAD( &data[ p ], ad ); break;
- case 20: UDFExtAD( &data[ p ], ad ); break;
- }
- p += L_AD;
- break;
- default:
- p += L_AD; break;
- }
+ L_EA = GETN4( 168 );
+ L_AD = GETN4( 172 );
+ p = 176 + L_EA;
+ while( p < 176 + L_EA + L_AD ) {
+ switch( flags & 0x0007 ) {
+ case 0: UDFShortAD( &data[ p ], ad, partition ); p += 8; break;
+ case 1: UDFLongAD( &data[ p ], ad ); p += 16; break;
+ case 2: UDFExtAD( &data[ p ], ad ); p += 20; break;
+ case 3:
+ switch( L_AD ) {
+ case 8: UDFShortAD( &data[ p ], ad, partition ); break;
+ case 16: UDFLongAD( &data[ p ], ad ); break;
+ case 20: UDFExtAD( &data[ p ], ad ); break;
+ }
+ p += L_AD;
+ break;
+ default:
+ p += L_AD; break;
}
- return 0;
+ }
+ return 0;
}
static int UDFFileIdentifier( uint8_t *data, uint8_t *FileCharacteristics,
char *FileName, struct AD *FileICB )
{
- uint8_t L_FI;
- uint16_t L_IU;
+ uint8_t L_FI;
+ uint16_t L_IU;
- *FileCharacteristics = GETN1(18);
- L_FI = GETN1(19);
- UDFLongAD(&data[20], FileICB);
- L_IU = GETN2(36);
- if (L_FI) Unicodedecode(&data[38 + L_IU], L_FI, FileName);
- else FileName[0] = '\0';
- return 4 * ((38 + L_FI + L_IU + 3) / 4);
+ *FileCharacteristics = GETN1(18);
+ L_FI = GETN1(19);
+ UDFLongAD(&data[20], FileICB);
+ L_IU = GETN2(36);
+ if (L_FI) Unicodedecode(&data[38 + L_IU], L_FI, FileName);
+ else FileName[0] = '\0';
+ return 4 * ((38 + L_FI + L_IU + 3) / 4);
}
/**
@@ -490,37 +491,37 @@ static int UDFFileIdentifier( uint8_t *d
static int UDFMapICB( dvd_reader_t *device, struct AD ICB, uint8_t *FileType,
struct Partition *partition, struct AD *File )
{
- uint8_t LogBlock_base[DVD_VIDEO_LB_LEN + 2048];
- uint8_t *LogBlock = (uint8_t *)(((uintptr_t)LogBlock_base & ~((uintptr_t)2047)) + 2048);
- uint32_t lbnum;
- uint16_t TagID;
- struct icbmap tmpmap;
+ uint8_t LogBlock_base[DVD_VIDEO_LB_LEN + 2048];
+ uint8_t *LogBlock = (uint8_t *)(((uintptr_t)LogBlock_base & ~((uintptr_t)2047)) + 2048);
+ uint32_t lbnum;
+ uint16_t TagID;
+ struct icbmap tmpmap;
- lbnum = partition->Start + ICB.Location;
- tmpmap.lbn = lbnum;
- if(GetUDFCache(device, MapCache, lbnum, &tmpmap)) {
- *FileType = tmpmap.filetype;
- memcpy(File, &tmpmap.file, sizeof(tmpmap.file));
- return 1;
- }
+ lbnum = partition->Start + ICB.Location;
+ tmpmap.lbn = lbnum;
+ if(GetUDFCache(device, MapCache, lbnum, &tmpmap)) {
+ *FileType = tmpmap.filetype;
+ memcpy(File, &tmpmap.file, sizeof(tmpmap.file));
+ return 1;
+ }
- do {
- if( DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 ) <= 0 )
- TagID = 0;
- else
- UDFDescriptor( LogBlock, &TagID );
+ do {
+ if( DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 ) <= 0 )
+ TagID = 0;
+ else
+ UDFDescriptor( LogBlock, &TagID );
- if( TagID == 261 ) {
- UDFFileEntry( LogBlock, FileType, partition, File );
- memcpy(&tmpmap.file, File, sizeof(tmpmap.file));
- tmpmap.filetype = *FileType;
- SetUDFCache(device, MapCache, tmpmap.lbn, &tmpmap);
- return 1;
- };
- } while( ( lbnum <= partition->Start + ICB.Location + ( ICB.Length - 1 )
+ if( TagID == 261 ) {
+ UDFFileEntry( LogBlock, FileType, partition, File );
+ memcpy(&tmpmap.file, File, sizeof(tmpmap.file));
+ tmpmap.filetype = *FileType;
+ SetUDFCache(device, MapCache, tmpmap.lbn, &tmpmap);
+ return 1;
+ };
+ } while( ( lbnum <= partition->Start + ICB.Location + ( ICB.Length - 1 )
/ DVD_VIDEO_LB_LEN ) && ( TagID != 261 ) );
- return 0;
+ return 0;
}
/**
@@ -533,110 +534,110 @@ static int UDFScanDir( dvd_reader_t *dev
struct Partition *partition, struct AD *FileICB,
int cache_file_info)
{
- char filename[ MAX_UDF_FILE_NAME_LEN ];
- uint8_t directory_base[ 2 * DVD_VIDEO_LB_LEN + 2048];
- uint8_t *directory = (uint8_t *)(((uintptr_t)directory_base & ~((uintptr_t)2047)) + 2048);
- uint32_t lbnum;
- uint16_t TagID;
- uint8_t filechar;
- unsigned int p;
- uint8_t *cached_dir_base = NULL, *cached_dir;
- uint32_t dir_lba;
- struct AD tmpICB;
- int found = 0;
- int in_cache = 0;
-
- /* Scan dir for ICB of file */
- lbnum = partition->Start + Dir.Location;
-
- if(DVDUDFCacheLevel(device, -1) > 0) {
- /* caching */
+ char filename[ MAX_UDF_FILE_NAME_LEN ];
+ uint8_t directory_base[ 2 * DVD_VIDEO_LB_LEN + 2048];
+ uint8_t *directory = (uint8_t *)(((uintptr_t)directory_base & ~((uintptr_t)2047)) + 2048);
+ uint32_t lbnum;
+ uint16_t TagID;
+ uint8_t filechar;
+ unsigned int p;
+ uint8_t *cached_dir_base = NULL, *cached_dir;
+ uint32_t dir_lba;
+ struct AD tmpICB;
+ int found = 0;
+ int in_cache = 0;
- if(!GetUDFCache(device, LBUDFCache, lbnum, &cached_dir)) {
- dir_lba = (Dir.Length + DVD_VIDEO_LB_LEN) / DVD_VIDEO_LB_LEN;
- if((cached_dir_base = malloc(dir_lba * DVD_VIDEO_LB_LEN + 2048)) == NULL)
- return 0;
+ /* Scan dir for ICB of file */
+ lbnum = partition->Start + Dir.Location;
- cached_dir = (uint8_t *)(((uintptr_t)cached_dir_base & ~((uintptr_t)2047)) + 2048);
- if( DVDReadLBUDF( device, lbnum, dir_lba, cached_dir, 0) <= 0 ) {
- free(cached_dir_base);
- cached_dir_base = NULL;
- cached_dir = NULL;
- }
- /*
- if(cached_dir) {
- fprintf(stderr, "malloc dir: %d\n", dir_lba * DVD_VIDEO_LB_LEN);
- }
- */
- {
- uint8_t *data[2];
- data[0] = cached_dir_base;
- data[1] = cached_dir;
- SetUDFCache(device, LBUDFCache, lbnum, data);
- }
- } else
- in_cache = 1;
+ if(DVDUDFCacheLevel(device, -1) > 0) {
+ /* caching */
- if(cached_dir == NULL)
+ if(!GetUDFCache(device, LBUDFCache, lbnum, &cached_dir)) {
+ dir_lba = (Dir.Length + DVD_VIDEO_LB_LEN) / DVD_VIDEO_LB_LEN;
+ if((cached_dir_base = malloc(dir_lba * DVD_VIDEO_LB_LEN + 2048)) == NULL)
return 0;
+ cached_dir = (uint8_t *)(((uintptr_t)cached_dir_base & ~((uintptr_t)2047)) + 2048);
+ if( DVDReadLBUDF( device, lbnum, dir_lba, cached_dir, 0) <= 0 ) {
+ free(cached_dir_base);
+ cached_dir_base = NULL;
+ cached_dir = NULL;
+ }
+ /*
+ if(cached_dir) {
+ fprintf(stderr, "malloc dir: %d\n", dir_lba * DVD_VIDEO_LB_LEN);
+ }
+ */
+ {
+ uint8_t *data[2];
+ data[0] = cached_dir_base;
+ data[1] = cached_dir;
+ SetUDFCache(device, LBUDFCache, lbnum, data);
+ }
+ } else
+ in_cache = 1;
- p = 0;
+ if(cached_dir == NULL)
+ return 0;
- while( p < Dir.Length ) {
- UDFDescriptor( &cached_dir[ p ], &TagID );
- if( TagID == 257 ) {
- p += UDFFileIdentifier( &cached_dir[ p ], &filechar, filename, &tmpICB );
- if(cache_file_info && !in_cache) {
- uint8_t tmpFiletype;
- struct AD tmpFile;
+ p = 0;
- if( !strcasecmp( FileName, filename ) ) {
- memcpy(FileICB, &tmpICB, sizeof(tmpICB));
- found = 1;
- }
- UDFMapICB(device, tmpICB, &tmpFiletype, partition, &tmpFile);
- } else {
- if( !strcasecmp( FileName, filename ) ) {
- memcpy(FileICB, &tmpICB, sizeof(tmpICB));
- return 1;
- }
+ while( p < Dir.Length ) {
+ UDFDescriptor( &cached_dir[ p ], &TagID );
+ if( TagID == 257 ) {
+ p += UDFFileIdentifier( &cached_dir[ p ], &filechar,
+ filename, &tmpICB );
+ if(cache_file_info && !in_cache) {
+ uint8_t tmpFiletype;
+ struct AD tmpFile;
+
+ if( !strcasecmp( FileName, filename ) ) {
+ memcpy(FileICB, &tmpICB, sizeof(tmpICB));
+ found = 1;
}
+ UDFMapICB(device, tmpICB, &tmpFiletype, partition, &tmpFile);
} else {
- if(cache_file_info && (!in_cache) && found)
+ if( !strcasecmp( FileName, filename ) ) {
+ memcpy(FileICB, &tmpICB, sizeof(tmpICB));
return 1;
- return 0;
+ }
}
+ } else {
+ if(cache_file_info && (!in_cache) && found)
+ return 1;
+ return 0;
}
- if(cache_file_info && (!in_cache) && found)
- return 1;
- return 0;
}
+ if(cache_file_info && (!in_cache) && found)
+ return 1;
+ return 0;
+ }
- if( DVDReadLBUDF( device, lbnum, 2, directory, 0 ) <= 0 )
- return 0;
+ if( DVDReadLBUDF( device, lbnum, 2, directory, 0 ) <= 0 )
+ return 0;
- p = 0;
- while( p < Dir.Length ) {
- if( p > DVD_VIDEO_LB_LEN ) {
- ++lbnum;
- p -= DVD_VIDEO_LB_LEN;
- Dir.Length -= DVD_VIDEO_LB_LEN;
- if( DVDReadLBUDF( device, lbnum, 2, directory, 0 ) <= 0 ) {
- return 0;
- }
+ p = 0;
+ while( p < Dir.Length ) {
+ if( p > DVD_VIDEO_LB_LEN ) {
+ ++lbnum;
+ p -= DVD_VIDEO_LB_LEN;
+ Dir.Length -= DVD_VIDEO_LB_LEN;
+ if( DVDReadLBUDF( device, lbnum, 2, directory, 0 ) <= 0 ) {
+ return 0;
}
- UDFDescriptor( &directory[ p ], &TagID );
- if( TagID == 257 ) {
- p += UDFFileIdentifier( &directory[ p ], &filechar,
- filename, FileICB );
- if( !strcasecmp( FileName, filename ) ) {
- return 1;
- }
- } else
- return 0;
}
+ UDFDescriptor( &directory[ p ], &TagID );
+ if( TagID == 257 ) {
+ p += UDFFileIdentifier( &directory[ p ], &filechar,
+ filename, FileICB );
+ if( !strcasecmp( FileName, filename ) ) {
+ return 1;
+ }
+ } else
+ return 0;
+ }
- return 0;
+ return 0;
}
@@ -670,10 +671,9 @@ static int UDFGetAVDP( dvd_reader_t *dev
if( terminate ) return 0; /* Final try failed */
if( lastsector ) {
- /*
- * We already found the last sector. Try #3, alternative
+ /* We already found the last sector. Try #3, alternative
* backup anchor. If that fails, don't try again.
- */
+ */
lbnum = lastsector;
terminate = 1;
} else {
@@ -712,134 +712,139 @@ static int UDFGetAVDP( dvd_reader_t *dev
static int UDFFindPartition( dvd_reader_t *device, int partnum,
struct Partition *part )
{
- uint8_t LogBlock_base[ DVD_VIDEO_LB_LEN + 2048 ];
- uint8_t *LogBlock = (uint8_t *)(((uintptr_t)LogBlock_base & ~((uintptr_t)2047)) + 2048);
- uint32_t lbnum, MVDS_location, MVDS_length;
- uint16_t TagID;
- int i, volvalid;
- struct avdp_t avdp;
+ uint8_t LogBlock_base[ DVD_VIDEO_LB_LEN + 2048 ];
+ uint8_t *LogBlock = (uint8_t *)(((uintptr_t)LogBlock_base & ~((uintptr_t)2047)) + 2048);
+ uint32_t lbnum, MVDS_location, MVDS_length;
+ uint16_t TagID;
+ int i, volvalid;
+ struct avdp_t avdp;
- if(!UDFGetAVDP(device, &avdp))
- return 0;
+ if(!UDFGetAVDP(device, &avdp))
+ return 0;
- /* Main volume descriptor */
- MVDS_location = avdp.mvds.location;
- MVDS_length = avdp.mvds.length;
+ /* Main volume descriptor */
+ MVDS_location = avdp.mvds.location;
+ MVDS_length = avdp.mvds.length;
- part->valid = 0;
- volvalid = 0;
- part->VolumeDesc[ 0 ] = '\0';
- i = 1;
+ part->valid = 0;
+ volvalid = 0;
+ part->VolumeDesc[ 0 ] = '\0';
+ i = 1;
+ do {
+ /* Find Volume Descriptor */
+ lbnum = MVDS_location;
do {
- /* Find Volume Descriptor */
- lbnum = MVDS_location;
- do {
- if( DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 ) <= 0 )
- TagID = 0;
- else
- UDFDescriptor( LogBlock, &TagID );
+ if( DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 ) <= 0 )
+ TagID = 0;
+ else
+ UDFDescriptor( LogBlock, &TagID );
- if( ( TagID == 5 ) && ( !part->valid ) ) {
- /* Partition Descriptor */
- UDFPartition( LogBlock, &part->Flags, &part->Number,
- part->Contents, &part->Start, &part->Length );
- part->valid = ( partnum == part->Number );
- } else if( ( TagID == 6 ) && ( !volvalid ) ) {
- /* Logical Volume Descriptor */
- if( UDFLogVolume( LogBlock, part->VolumeDesc ) ) {
- /* TODO: sector size wrong! */
- } else
- volvalid = 1;
- }
+ if( ( TagID == 5 ) && ( !part->valid ) ) {
+ /* Partition Descriptor */
+ UDFPartition( LogBlock, &part->Flags, &part->Number,
+ part->Contents, &part->Start, &part->Length );
+ part->valid = ( partnum == part->Number );
+ } else if( ( TagID == 6 ) && ( !volvalid ) ) {
+ /* Logical Volume Descriptor */
+ if( UDFLogVolume( LogBlock, part->VolumeDesc ) ) {
+ /* TODO: sector size wrong! */
+ } else
+ volvalid = 1;
+ }
- } while( ( lbnum <= MVDS_location + ( MVDS_length - 1 )
- / DVD_VIDEO_LB_LEN ) && ( TagID != 8 )
- && ( ( !part->valid ) || ( !volvalid ) ) );
+ } while( ( lbnum <= MVDS_location + ( MVDS_length - 1 )
+ / DVD_VIDEO_LB_LEN ) && ( TagID != 8 )
+ && ( ( !part->valid ) || ( !volvalid ) ) );
- if( ( !part->valid) || ( !volvalid ) ) {
- /* Backup volume descriptor */
- MVDS_location = avdp.mvds.location;
- MVDS_length = avdp.mvds.length;
- }
- } while( i-- && ( ( !part->valid ) || ( !volvalid ) ) );
+ if( ( !part->valid) || ( !volvalid ) ) {
+ /* Backup volume descriptor */
+ MVDS_location = avdp.mvds.location;
+ MVDS_length = avdp.mvds.length;
+ }
+ } while( i-- && ( ( !part->valid ) || ( !volvalid ) ) );
- /* We only care for the partition, not the volume */
- return part->valid;
+ /* We only care for the partition, not the volume */
+ return part->valid;
}
uint32_t UDFFindFile( dvd_reader_t *device, char *filename,
uint32_t *filesize )
{
- uint8_t LogBlock_base[ DVD_VIDEO_LB_LEN + 2048 ];
- uint8_t *LogBlock = (uint8_t *)(((uintptr_t)LogBlock_base & ~((uintptr_t)2047)) + 2048);
- uint32_t lbnum;
- uint16_t TagID;
- struct Partition partition;
- struct AD RootICB, File, ICB;
- char tokenline[ MAX_UDF_FILE_NAME_LEN ];
- char *token;
- uint8_t filetype;
+ uint8_t LogBlock_base[ DVD_VIDEO_LB_LEN + 2048 ];
+ uint8_t *LogBlock = (uint8_t *)(((uintptr_t)LogBlock_base & ~((uintptr_t)2047)) + 2048);
+ uint32_t lbnum;
+ uint16_t TagID;
+ struct Partition partition;
+ struct AD RootICB, File, ICB;
+ char tokenline[ MAX_UDF_FILE_NAME_LEN ];
+ char *token;
+ uint8_t filetype;
- *filesize = 0;
- tokenline[0] = '\0';
- strncat(tokenline, filename, MAX_UDF_FILE_NAME_LEN - 1);
- memset(&ICB, 0, sizeof(ICB));
+ *filesize = 0;
+ tokenline[0] = '\0';
+ strncat(tokenline, filename, MAX_UDF_FILE_NAME_LEN - 1);
+ memset(&ICB, 0, sizeof(ICB));
- if(!(GetUDFCache(device, PartitionCache, 0, &partition) &&
- GetUDFCache(device, RootICBCache, 0, &RootICB))) {
- /* Find partition, 0 is the standard location for DVD Video.*/
- if( !UDFFindPartition( device, 0, &partition ) ) return 0;
- SetUDFCache(device, PartitionCache, 0, &partition);
+ if(!(GetUDFCache(device, PartitionCache, 0, &partition) &&
+ GetUDFCache(device, RootICBCache, 0, &RootICB))) {
+ /* Find partition, 0 is the standard location for DVD Video.*/
+ if( !UDFFindPartition( device, 0, &partition ) ) return 0;
+ SetUDFCache(device, PartitionCache, 0, &partition);
- /* Find root dir ICB */
- lbnum = partition.Start;
- do {
- if( DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 ) <= 0 )
- TagID = 0;
- else
- UDFDescriptor( LogBlock, &TagID );
+ /* Find root dir ICB */
+ lbnum = partition.Start;
+ do {
+ if( DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 ) <= 0 )
+ TagID = 0;
+ else
+ UDFDescriptor( LogBlock, &TagID );
- /* File Set Descriptor */
- if( TagID == 256 ) /* File Set Descriptor */
- UDFLongAD( &LogBlock[ 400 ], &RootICB );
+ /* File Set Descriptor */
+ if( TagID == 256 ) /* File Set Descriptor */
+ UDFLongAD( &LogBlock[ 400 ], &RootICB );
} while( ( lbnum < partition.Start + partition.Length )
&& ( TagID != 8 ) && ( TagID != 256 ) );
/* Sanity checks. */
- if( TagID != 256 ) return 0;
- if( RootICB.Partition != 0 ) return 0;
+ if( TagID != 256 )
+ return 0;
+ if( RootICB.Partition != 0 )
+ return 0;
SetUDFCache(device, RootICBCache, 0, &RootICB);
- }
+ }
- /* Find root dir */
- if( !UDFMapICB( device, RootICB, &filetype, &partition, &File ) ) return 0;
- if( filetype != 4 ) return 0; /* Root dir should be dir */
+ /* Find root dir */
+ if( !UDFMapICB( device, RootICB, &filetype, &partition, &File ) )
+ return 0;
+ if( filetype != 4 )
+ return 0; /* Root dir should be dir */
+ {
+ int cache_file_info = 0;
+ /* Tokenize filepath */
+ token = strtok(tokenline, "/");
- {
- int cache_file_info = 0;
- /* Tokenize filepath */
- token = strtok(tokenline, "/");
- while( token != NULL ) {
- if( !UDFScanDir( device, File, token, &partition, &ICB,
- cache_file_info))
- return 0;
- if( !UDFMapICB( device, ICB, &filetype, &partition, &File ) )
- return 0;
- if(!strcmp(token, "VIDEO_TS"))
- cache_file_info = 1;
- token = strtok( NULL, "/" );
- }
+ while( token != NULL ) {
+ if( !UDFScanDir( device, File, token, &partition, &ICB,
+ cache_file_info))
+ return 0;
+ if( !UDFMapICB( device, ICB, &filetype, &partition, &File ) )
+ return 0;
+ if(!strcmp(token, "VIDEO_TS"))
+ cache_file_info = 1;
+ token = strtok( NULL, "/" );
}
+ }
- /* Sanity check. */
- if( File.Partition != 0 ) return 0;
- *filesize = File.Length;
- /* Hack to not return partition.Start for empty files. */
- if( !File.Location )
- return 0;
- else
- return partition.Start + File.Location;
+ /* Sanity check. */
+ if( File.Partition != 0 )
+ return 0;
+ *filesize = File.Length;
+ /* Hack to not return partition.Start for empty files. */
+ if( !File.Location )
+ return 0;
+ else
+ return partition.Start + File.Location;
}
@@ -872,6 +877,7 @@ static int UDFGetDescriptor( dvd_reader_
/* Main volume descriptor */
MVDS_location = avdp.mvds.location;
MVDS_length = avdp.mvds.length;
+
i = 1;
do {
/* Find Descriptor */
@@ -938,6 +944,7 @@ int UDFGetVolumeIdentifier(dvd_reader_t
if(volid_size > volid_len)
volid_size = volid_len;
Unicodedecode(pvd.VolumeIdentifier, volid_size, volid);
+
return volid_len;
}
@@ -964,5 +971,6 @@ int UDFGetVolumeSetIdentifier(dvd_reader
volsetid_size = 128;
memcpy(volsetid, pvd.VolumeSetIdentifier, volsetid_size);
+
return 128;
}
Modified: trunk/libdvdread/src/dvdread_internal.h
==============================================================================
--- trunk/libdvdread/src/dvdread_internal.h (original)
+++ trunk/libdvdread/src/dvdread_internal.h Thu Sep 25 11:17:42 2008
@@ -23,11 +23,11 @@
#include <unistd.h>
#endif /* _MSC_VER */
-#define CHECK_VALUE(arg) \
- if(!(arg)) { \
- fprintf(stderr, "\n*** libdvdread: CHECK_VALUE failed in %s:%i ***" \
- "\n*** for %s ***\n\n", \
- __FILE__, __LINE__, # arg ); \
- }
+#define CHECK_VALUE(arg) \
+ if(!(arg)) { \
+ fprintf(stderr, "\n*** libdvdread: CHECK_VALUE failed in %s:%i ***" \
+ "\n*** for %s ***\n\n", \
+ __FILE__, __LINE__, # arg ); \
+ }
#endif /* LIBDVDREAD_DVDREAD_INTERNAL_H */
Modified: trunk/libdvdread/src/ifo_print.c
==============================================================================
--- trunk/libdvdread/src/ifo_print.c (original)
+++ trunk/libdvdread/src/ifo_print.c Thu Sep 25 11:17:42 2008
@@ -222,31 +222,31 @@ static void ifo_print_audio_attributes(i
case 3:
printf("mpeg2ext ");
switch(attr->quantization) {
- case 0:
- printf("no drc ");
- break;
- case 1:
- printf("drc ");
- break;
- default:
- printf("(please send a bug report) mpeg reserved quant/drc (%d)", attr->quantization);
+ case 0:
+ printf("no drc ");
+ break;
+ case 1:
+ printf("drc ");
+ break;
+ default:
+ printf("(please send a bug report) mpeg reserved quant/drc (%d)", attr->quantization);
}
break;
case 4:
printf("lpcm ");
switch(attr->quantization) {
- case 0:
- printf("16bit ");
- break;
- case 1:
- printf("20bit ");
- break;
- case 2:
- printf("24bit ");
- break;
- case 3:
- printf("(please send a bug report) lpcm reserved quant/drc (%d)", attr->quantization);
+ case 0:
+ printf("16bit ");
+ break;
+ case 1:
+ printf("20bit ");
+ break;
+ case 2:
+ printf("24bit ");
break;
+ case 3:
+ printf("(please send a bug report) lpcm reserved quant/drc (%d)", attr->quantization);
+ break;
}
break;
case 5:
@@ -806,7 +806,7 @@ void ifo_print_TT_SRPT(tt_srpt_t *tt_srp
printf("\tTitle playback type: (%02x)\n",
*(uint8_t *)&(tt_srpt->title[i].pb_ty));
printf("\t\t%s\n",
- tt_srpt->title[i].pb_ty.multi_or_random_pgc_title ? "Random or Shuffle" : "Sequencial");
+ tt_srpt->title[i].pb_ty.multi_or_random_pgc_title ? "Random or Shuffle" : "Sequencial");
if (tt_srpt->title[i].pb_ty.jlc_exists_in_cell_cmd) printf("\t\tJump/Link/Call exists in cell cmd\n");
if (tt_srpt->title[i].pb_ty.jlc_exists_in_prepost_cmd) printf("\t\tJump/Link/Call exists in pre/post cmd\n");
if (tt_srpt->title[i].pb_ty.jlc_exists_in_button_cmd) printf("\t\tJump/Link/Call exists in button cmd\n");
@@ -960,15 +960,15 @@ void ifo_print_PGCIT(pgcit_t *pgcit, int
printf("\nProgram (PGC): %3i\n", i + 1);
if (pgc_type) {
printf("PGC Category: Entry PGC %d, Menu Type=0x%02x:%s (Entry id 0x%02x), ",
- pgcit->pgci_srp[i].entry_id >> 7,
- pgcit->pgci_srp[i].entry_id & 0xf,
- ifo_print_menu_name(pgcit->pgci_srp[i].entry_id & 0xf),
- pgcit->pgci_srp[i].entry_id);
+ pgcit->pgci_srp[i].entry_id >> 7,
+ pgcit->pgci_srp[i].entry_id & 0xf,
+ ifo_print_menu_name(pgcit->pgci_srp[i].entry_id & 0xf),
+ pgcit->pgci_srp[i].entry_id);
} else {
printf("PGC Category: %s VTS_TTN:0x%02x (Entry id 0x%02x), ",
- pgcit->pgci_srp[i].entry_id >> 7 ? "At Start of" : "During",
- pgcit->pgci_srp[i].entry_id & 0xf,
- pgcit->pgci_srp[i].entry_id);
+ pgcit->pgci_srp[i].entry_id >> 7 ? "At Start of" : "During",
+ pgcit->pgci_srp[i].entry_id & 0xf,
+ pgcit->pgci_srp[i].entry_id);
}
printf("Parental ID mask 0x%04x\n", pgcit->pgci_srp[i].ptl_id_mask);
ifo_print_PGC(pgcit->pgci_srp[i].pgc);
Modified: trunk/libdvdread/src/ifo_read.c
==============================================================================
--- trunk/libdvdread/src/ifo_read.c (original)
+++ trunk/libdvdread/src/ifo_read.c Thu Sep 25 11:17:42 2008
@@ -39,19 +39,19 @@
#endif
#ifndef NDEBUG
-#define CHECK_ZERO0(arg) \
- if(arg != 0) { \
+#define CHECK_ZERO0(arg) \
+ if(arg != 0) { \
fprintf(stderr, "*** Zero check failed in %s:%i\n for %s = 0x%x\n", \
- __FILE__, __LINE__, # arg, arg); \
+ __FILE__, __LINE__, # arg, arg); \
}
-#define CHECK_ZERO(arg) \
- if(memcmp(my_friendly_zeros, &arg, sizeof(arg))) { \
- unsigned int i_CZ; \
- fprintf(stderr, "*** Zero check failed in %s:%i\n for %s = 0x", \
- __FILE__, __LINE__, # arg ); \
- for(i_CZ = 0; i_CZ < sizeof(arg); i_CZ++) \
- fprintf(stderr, "%02x", *((uint8_t *)&arg + i_CZ)); \
- fprintf(stderr, "\n"); \
+#define CHECK_ZERO(arg) \
+ if(memcmp(my_friendly_zeros, &arg, sizeof(arg))) { \
+ unsigned int i_CZ; \
+ fprintf(stderr, "*** Zero check failed in %s:%i\n for %s = 0x", \
+ __FILE__, __LINE__, # arg ); \
+ for(i_CZ = 0; i_CZ < sizeof(arg); i_CZ++) \
+ fprintf(stderr, "%02x", *((uint8_t *)&arg + i_CZ)); \
+ fprintf(stderr, "\n"); \
}
static const uint8_t my_friendly_zeros[2048];
#else
@@ -345,7 +345,6 @@ ifo_handle_t *ifoOpen(dvd_reader_t *dvd,
return NULL;
}
-
ifoRead_PGCI_UT(ifofile);
ifoRead_VTS_TMAPT(ifofile);
ifoRead_C_ADT(ifofile);
@@ -535,12 +534,12 @@ static int ifoRead_VMG(ifo_handle_t *ifo
CHECK_VALUE(vmgi_mat->vmg_nr_of_title_sets != 0);
CHECK_VALUE(vmgi_mat->vmgi_last_byte >= 341);
CHECK_VALUE(vmgi_mat->vmgi_last_byte / DVD_BLOCK_LEN <=
- vmgi_mat->vmgi_last_sector);
+ vmgi_mat->vmgi_last_sector);
/* It seems that first_play_pgc is optional. */
CHECK_VALUE(vmgi_mat->first_play_pgc < vmgi_mat->vmgi_last_byte);
CHECK_VALUE(vmgi_mat->vmgm_vobs == 0 ||
- (vmgi_mat->vmgm_vobs > vmgi_mat->vmgi_last_sector &&
- vmgi_mat->vmgm_vobs < vmgi_mat->vmg_last_sector));
+ (vmgi_mat->vmgm_vobs > vmgi_mat->vmgi_last_sector &&
+ vmgi_mat->vmgm_vobs < vmgi_mat->vmg_last_sector));
CHECK_VALUE(vmgi_mat->tt_srpt <= vmgi_mat->vmgi_last_sector);
CHECK_VALUE(vmgi_mat->vmgm_pgci_ut <= vmgi_mat->vmgi_last_sector);
CHECK_VALUE(vmgi_mat->ptl_mait <= vmgi_mat->vmgi_last_sector);
@@ -632,11 +631,11 @@ static int ifoRead_VTS(ifo_handle_t *ifo
CHECK_VALUE(vtsi_mat->vtsi_last_sector*2 <= vtsi_mat->vts_last_sector);
CHECK_VALUE(vtsi_mat->vtsi_last_byte/DVD_BLOCK_LEN <= vtsi_mat->vtsi_last_sector);
CHECK_VALUE(vtsi_mat->vtsm_vobs == 0 ||
- (vtsi_mat->vtsm_vobs > vtsi_mat->vtsi_last_sector &&
- vtsi_mat->vtsm_vobs < vtsi_mat->vts_last_sector));
+ (vtsi_mat->vtsm_vobs > vtsi_mat->vtsi_last_sector &&
+ vtsi_mat->vtsm_vobs < vtsi_mat->vts_last_sector));
CHECK_VALUE(vtsi_mat->vtstt_vobs == 0 ||
- (vtsi_mat->vtstt_vobs > vtsi_mat->vtsi_last_sector &&
- vtsi_mat->vtstt_vobs < vtsi_mat->vts_last_sector));
+ (vtsi_mat->vtstt_vobs > vtsi_mat->vtsi_last_sector &&
+ vtsi_mat->vtstt_vobs < vtsi_mat->vts_last_sector));
CHECK_VALUE(vtsi_mat->vts_ptt_srpt <= vtsi_mat->vtsi_last_sector);
CHECK_VALUE(vtsi_mat->vts_pgcit <= vtsi_mat->vtsi_last_sector);
CHECK_VALUE(vtsi_mat->vtsm_pgci_ut <= vtsi_mat->vtsi_last_sector);
@@ -786,9 +785,9 @@ static int ifoRead_CELL_PLAYBACK_TBL(ifo
read_cell_playback(&cell_playback[i]);
/* Changed < to <= because this was false in the movie 'Pi'. */
CHECK_VALUE(cell_playback[i].last_vobu_start_sector <=
- cell_playback[i].last_sector);
+ cell_playback[i].last_sector);
CHECK_VALUE(cell_playback[i].first_sector <=
- cell_playback[i].last_vobu_start_sector);
+ cell_playback[i].last_vobu_start_sector);
}
return 1;
@@ -1314,13 +1313,13 @@ int ifoRead_PTL_MAIT(ifo_handle_t *ifofi
return 0;
}
if(!(DVDReadBytes(ifofile->file, pf_temp, info_length))) {
- fprintf(stderr, "libdvdread: Unable to read PTL_MAIT table.\n");
- free(pf_temp);
- free_ptl_mait(ptl_mait, i);
- return 0;
+ fprintf(stderr, "libdvdread: Unable to read PTL_MAIT table.\n");
+ free(pf_temp);
+ free_ptl_mait(ptl_mait, i);
+ return 0;
}
for (j = 0; j < ((ptl_mait->nr_of_vtss + 1) * 8); j++) {
- B2N_16(pf_temp[j]);
+ B2N_16(pf_temp[j]);
}
ptl_mait->countries[i].pf_ptl_mai = (pf_level_t *)malloc(info_length);
if(!ptl_mait->countries[i].pf_ptl_mai) {
@@ -1350,7 +1349,7 @@ void ifoFree_PTL_MAIT(ifo_handle_t *ifof
if(ifofile->ptl_mait) {
for(i = 0; i < ifofile->ptl_mait->nr_of_countries; i++) {
- free(ifofile->ptl_mait->countries[i].pf_ptl_mai);
+ free(ifofile->ptl_mait->countries[i].pf_ptl_mai);
}
free(ifofile->ptl_mait->countries);
free(ifofile->ptl_mait);
@@ -1420,7 +1419,7 @@ int ifoRead_VTS_TMAPT(ifo_handle_t *ifof
}
for (i = 0; i < vts_tmapt->nr_of_tmaps; i++) {
- B2N_32(vts_tmap_srp[i]);
+ B2N_32(vts_tmap_srp[i]);
}
@@ -1600,7 +1599,7 @@ static int ifoRead_C_ADT_internal(ifo_ha
CHECK_VALUE(c_adt->cell_adr_table[i].vob_id <= c_adt->nr_of_vobs);
CHECK_VALUE(c_adt->cell_adr_table[i].cell_id > 0);
CHECK_VALUE(c_adt->cell_adr_table[i].start_sector <
- c_adt->cell_adr_table[i].last_sector);
+ c_adt->cell_adr_table[i].last_sector);
}
return 1;
@@ -1934,7 +1933,7 @@ int ifoRead_PGCI_UT(ifo_handle_t *ifofil
free(data);
free(pgci_ut);
ifofile->pgci_ut = 0;
- return 0;
+ return 0;
}
ptr = data;
for(i = 0; i < pgci_ut->nr_of_lus; i++) {
@@ -1948,7 +1947,7 @@ int ifoRead_PGCI_UT(ifo_handle_t *ifofil
for(i = 0; i < pgci_ut->nr_of_lus; i++) {
/* Maybe this is only defined for v1.1 and later titles? */
/* If the bits in 'lu[i].exists' are enumerated abcd efgh then:
- VTS_x_yy.IFO VIDEO_TS.IFO
+ VTS_x_yy.IFO VIDEO_TS.IFO
a == 0x83 "Root" 0x82 "Title"
b == 0x84 "Subpicture"
c == 0x85 "Audio"
@@ -1985,10 +1984,8 @@ int ifoRead_PGCI_UT(ifo_handle_t *ifofil
ifofile->pgci_ut = 0;
return 0;
}
- /*
- * FIXME: Iterate and verify that all menus that should exists accordingly
- * to pgci_ut->lu[i].exists really do?
- */
+ /* FIXME: Iterate and verify that all menus that should exists accordingly
+ * to pgci_ut->lu[i].exists really do? */
}
return 1;
@@ -2102,7 +2099,7 @@ int ifoRead_VTS_ATRT(ifo_handle_t *ifofi
CHECK_VALUE(vts_atrt->nr_of_vtss != 0);
CHECK_VALUE(vts_atrt->nr_of_vtss < 100); /* ?? */
CHECK_VALUE((uint32_t)vts_atrt->nr_of_vtss * (4 + VTS_ATTRIBUTES_MIN_SIZE) +
- VTS_ATRT_SIZE < vts_atrt->last_byte + 1);
+ VTS_ATRT_SIZE < vts_atrt->last_byte + 1);
info_length = vts_atrt->nr_of_vtss * sizeof(uint32_t);
data = (uint32_t *)malloc(info_length);
@@ -2209,4 +2206,3 @@ void ifoFree_TXTDT_MGI(ifo_handle_t *ifo
ifofile->txtdt_mgi = 0;
}
}
-
Modified: trunk/libdvdread/src/ifo_types.h
==============================================================================
--- trunk/libdvdread/src/ifo_types.h (original)
+++ trunk/libdvdread/src/ifo_types.h Thu Sep 25 11:17:42 2008
@@ -211,6 +211,7 @@ typedef struct {
unsigned int interleaved : 1;
unsigned int stc_discontinuity: 1;
unsigned int seamless_angle : 1;
+
unsigned int playback_mode : 1; /**< When set, enter StillMode after each VOBU */
unsigned int restricted : 1; /**< ?? drop out of fastforward? */
unsigned int unknown2 : 6;
Modified: trunk/libdvdread/src/md5.c
==============================================================================
--- trunk/libdvdread/src/md5.c (original)
+++ trunk/libdvdread/src/md5.c Thu Sep 25 11:17:42 2008
@@ -41,7 +41,7 @@
#ifdef WORDS_BIGENDIAN
# define SWAP(n) \
- (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
+ (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
#else
# define SWAP(n) (n)
#endif
@@ -160,7 +160,7 @@ md5_stream (stream, resblock)
break;
/* Process buffer with BLOCKSIZE bytes. Note that
- BLOCKSIZE % 64 == 0
+ BLOCKSIZE % 64 == 0
*/
md5_process_block (buffer, BLOCKSIZE, &ctx);
}
@@ -294,14 +294,14 @@ md5_process_block (buffer, len, ctx)
before the computation. To reduce the work for the next steps
we store the swapped words in the array CORRECT_WORDS. */
-#define OP(a, b, c, d, s, T) \
- do \
- { \
- a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \
- ++words; \
- a = rol (a, s); \
- a += b; \
- } \
+#define OP(a, b, c, d, s, T) \
+ do \
+ { \
+ a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \
+ ++words; \
+ a = rol (a, s); \
+ a += b; \
+ } \
while (0)
/* Before we start, one word to the strange constants.
@@ -333,13 +333,13 @@ md5_process_block (buffer, len, ctx)
in CORRECT_WORDS. Redefine the macro to take an additional first
argument specifying the function to use. */
#undef OP
-#define OP(f, a, b, c, d, k, s, T) \
- do \
- { \
- a += f (b, c, d) + correct_words[k] + T; \
- a = rol (a, s); \
- a += b; \
- } \
+#define OP(f, a, b, c, d, k, s, T) \
+ do \
+ { \
+ a += f (b, c, d) + correct_words[k] + T; \
+ a = rol (a, s); \
+ a += b; \
+ } \
while (0)
/* Round 2. */
Modified: trunk/libdvdread/src/md5.h
==============================================================================
--- trunk/libdvdread/src/md5.h (original)
+++ trunk/libdvdread/src/md5.h Thu Sep 25 11:17:42 2008
@@ -54,17 +54,17 @@ typedef u_int32_t md5_uint32;
# endif
# if UINT_MAX == UINT_MAX_32_BITS
- typedef unsigned int md5_uint32;
+typedef unsigned int md5_uint32;
# else
# if USHRT_MAX == UINT_MAX_32_BITS
- typedef unsigned short md5_uint32;
+typedef unsigned short md5_uint32;
# else
# if ULONG_MAX == UINT_MAX_32_BITS
- typedef unsigned long md5_uint32;
+typedef unsigned long md5_uint32;
# else
- /* The following line is intended to evoke an error.
- Using #error is not portable enough. */
- "Cannot determine unsigned 32-bit data type."
+/* The following line is intended to evoke an error.
+ Using #error is not portable enough. */
+"Cannot determine unsigned 32-bit data type."
# endif
# endif
# endif
Modified: trunk/libdvdread/src/nav_print.c
==============================================================================
--- trunk/libdvdread/src/nav_print.c (original)
+++ trunk/libdvdread/src/nav_print.c Thu Sep 25 11:17:42 2008
@@ -248,5 +248,3 @@ void navPrint_DSI(dsi_t *dsi) {
navPrint_VOBU_SRI(&dsi->vobu_sri);
navPrint_SYNCI(&dsi->synci);
}
-
-
Modified: trunk/libdvdread/src/nav_read.c
==============================================================================
--- trunk/libdvdread/src/nav_read.c (original)
+++ trunk/libdvdread/src/nav_read.c Thu Sep 25 11:17:42 2008
@@ -140,7 +140,6 @@ void navRead_PCI(pci_t *pci, unsigned ch
}
-
#ifndef NDEBUG
/* Asserts */
@@ -160,7 +159,7 @@ void navRead_PCI(pci_t *pci, unsigned ch
CHECK_VALUE(pci->hli.hl_gi.btngr_ns != 0);
} else {
CHECK_VALUE((pci->hli.hl_gi.btn_ns != 0 && pci->hli.hl_gi.btngr_ns != 0)
- || (pci->hli.hl_gi.btn_ns == 0 && pci->hli.hl_gi.btngr_ns == 0));
+ || (pci->hli.hl_gi.btn_ns == 0 && pci->hli.hl_gi.btngr_ns == 0));
}
/* pci hli btnit */
@@ -264,4 +263,3 @@ void navRead_DSI(dsi_t *dsi, unsigned ch
/* dsi dsi gi */
CHECK_VALUE(dsi->dsi_gi.zero1 == 0);
}
-
Modified: trunk/libdvdread/src/nav_types.h
==============================================================================
--- trunk/libdvdread/src/nav_types.h (original)
+++ trunk/libdvdread/src/nav_types.h Thu Sep 25 11:17:42 2008
@@ -195,8 +195,8 @@ typedef struct {
* Seamless Angle Infromation for one angle
*/
typedef struct {
- uint32_t address; /**< offset to next ILVU, high bit is before/after */
- uint16_t size; /**< byte size of the ILVU pointed to by address */
+ uint32_t address; /**< offset to next ILVU, high bit is before/after */
+ uint16_t size; /**< byte size of the ILVU pointed to by address */
} ATTRIBUTE_PACKED sml_agl_data_t;
/**
1
0
What are the plans regarding libdvdread? The version that was released
here is based on libdvdread 0.9.4 (IIRC), but upstream has reached 0.9.7
in the meantime. Is there intention to sync both versions?
Diego
3
9
Author: diego
Date: Tue Sep 23 11:14:45 2008
New Revision: 1149
Log:
cosmetics: Convert all tabs to spaces.
Modified:
trunk/libdvdread/misc/dvdread-config.in
trunk/libdvdread/misc/dvdread-config.sh
trunk/libdvdread/misc/libdvdread.spec.in
trunk/libdvdread/misc/relchk.sh.in
trunk/libdvdread/msvc/contrib/getopt.c
trunk/libdvdread/msvc/contrib/timer/timer.c
trunk/libdvdread/msvc/contrib/timer/timer.h
trunk/libdvdread/msvc/include/dlfcn.h
trunk/libdvdread/msvc/include/getopt.h
trunk/libdvdread/msvc/include/os_types.h
trunk/libdvdread/msvc/include/pthreads/pthread.h
trunk/libdvdread/msvc/include/sys/time.h
trunk/libdvdread/msvc/include/timer.h
trunk/libdvdread/msvc/include/unistd.h
trunk/libdvdread/src/dvd_input.c
trunk/libdvdread/src/dvd_reader.c
trunk/libdvdread/src/dvd_reader.h
trunk/libdvdread/src/dvd_udf.c
trunk/libdvdread/src/dvd_udf.h
trunk/libdvdread/src/ifo_print.c
trunk/libdvdread/src/ifo_read.c
trunk/libdvdread/src/md5.c
trunk/libdvdread/src/md5.h
trunk/libdvdread/src/nav_print.c
trunk/libdvdread/src/nav_read.c
Modified: trunk/libdvdread/misc/dvdread-config.in
==============================================================================
--- trunk/libdvdread/misc/dvdread-config.in (original)
+++ trunk/libdvdread/misc/dvdread-config.in Tue Sep 23 11:14:45 2008
@@ -8,20 +8,20 @@ exec_prefix_set=no
usage()
{
- cat <<EOF
+ cat <<EOF
Usage: dvdnav-config [OPTIONS] [LIBRARIES]
Options:
- [--prefix[=DIR]]
- [--exec-prefix[=DIR]]
- [--version]
+ [--prefix[=DIR]]
+ [--exec-prefix[=DIR]]
+ [--version]
[--libs]
- [--cflags]
+ [--cflags]
EOF
- exit $1
+ exit $1
}
if test $# -eq 0; then
- usage 1 1>&2
+ usage 1 1>&2
fi
while test $# -gt 0; do
@@ -64,11 +64,11 @@ while test $# -gt 0; do
done
if test "$echo_prefix" = "yes"; then
- echo $prefix
+ echo $prefix
fi
if test "$echo_exec_prefix" = "yes"; then
- echo $exec_prefix
+ echo $exec_prefix
fi
if test "$echo_cflags" = "yes"; then
Modified: trunk/libdvdread/misc/dvdread-config.sh
==============================================================================
--- trunk/libdvdread/misc/dvdread-config.sh (original)
+++ trunk/libdvdread/misc/dvdread-config.sh Tue Sep 23 11:14:45 2008
@@ -2,19 +2,19 @@ dvdreadlib="-ldvdread"
usage()
{
- cat <<EOF
+ cat <<EOF
Usage: dvdread-config [OPTIONS] [LIBRARIES]
Options:
- [--prefix[=DIR]]
- [--version]
+ [--prefix[=DIR]]
+ [--version]
[--libs]
- [--cflags]
+ [--cflags]
EOF
- exit $1
+ exit $1
}
if test $# -eq 0; then
- usage 1 1>&2
+ usage 1 1>&2
fi
while test $# -gt 0; do
@@ -44,7 +44,7 @@ while test $# -gt 0; do
done
if test "$echo_prefix" = "yes"; then
- echo $prefix
+ echo $prefix
fi
if test "$echo_cflags" = "yes"; then
@@ -53,4 +53,4 @@ fi
if test "$echo_libs" = "yes"; then
echo -L$libdir $dvdreadlib
-fi
+fi
Modified: trunk/libdvdread/misc/libdvdread.spec.in
==============================================================================
--- trunk/libdvdread/misc/libdvdread.spec.in (original)
+++ trunk/libdvdread/misc/libdvdread.spec.in Tue Sep 23 11:14:45 2008
@@ -1,17 +1,17 @@
-%define prefix @prefix@
+%define prefix @prefix@
%define name @PACKAGE_NAME@
%define ver @PACKAGE_VERSION@
%define rel 0
-Name: %{name}
-Summary: Low level DVD access library
-Version: %{ver}
-Release: %{rel}
-Group: Development/Libraries
-Copyright: GPL
-Url: http://dvd.sourceforge.net/
-Source: %{name}-%{version}.tar.gz
-Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root
+Name: %{name}
+Summary: Low level DVD access library
+Version: %{ver}
+Release: %{rel}
+Group: Development/Libraries
+Copyright: GPL
+Url: http://dvd.sourceforge.net/
+Source: %{name}-%{version}.tar.gz
+Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root
%description
libdvdread provides support to applications wishing to make use of basic
@@ -21,7 +21,7 @@ DVD reading features.
%setup
%build
-CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix}
+CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix}
make
%install
Modified: trunk/libdvdread/misc/relchk.sh.in
==============================================================================
--- trunk/libdvdread/misc/relchk.sh.in (original)
+++ trunk/libdvdread/misc/relchk.sh.in Tue Sep 23 11:14:45 2008
@@ -14,7 +14,7 @@ getdir() {
else
filelist=`ls`
fi
-
+
for file in $filelist; do
if test -d $file -a $file != "CVS" -a $file != $distdir; then
@@ -33,7 +33,7 @@ getdir() {
if test ! -e $distfile; then
missingfile=${orifile##$topdir}
- echo "${missingfile#/} is missing in tarball" >> $logerror
+ echo "${missingfile#/} is missing in tarball" >> $logerror
fi
fi
@@ -60,7 +60,7 @@ main() {
echo " * Log is ${log##*/}"
echo " * Error log is ${logerror##*/}"
-
+
}
main
Modified: trunk/libdvdread/msvc/contrib/getopt.c
==============================================================================
--- trunk/libdvdread/msvc/contrib/getopt.c (original)
+++ trunk/libdvdread/msvc/contrib/getopt.c Tue Sep 23 11:14:45 2008
@@ -64,7 +64,7 @@
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
-#ifdef __GNU_LIBRARY__
+#ifdef __GNU_LIBRARY__
/* Don't include stdlib.h for non-GNU C libraries because some of them
contain conflicting prototypes for getopt. */
#include <stdlib.h>
@@ -92,9 +92,9 @@
When compiling libc, the _ macro is predefined. */
#ifdef HAVE_LIBINTL_H
#include <libintl.h>
-#define _(msgid) gettext (msgid)
+#define _(msgid) gettext (msgid)
#else
-#define _(msgid) (msgid)
+#define _(msgid) (msgid)
#endif
#endif
@@ -194,20 +194,20 @@ int optopt = '?';
static enum
{
- REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
+ REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
}
ordering;
/* Value of POSIXLY_CORRECT environment variable. */
static char *posixly_correct;
-#ifdef __GNU_LIBRARY__
+#ifdef __GNU_LIBRARY__
/* We want to avoid inclusion of string.h with non-GNU libraries
because there are many ways it can cause trouble.
On some systems, it contains special magic macros that don't work
in GCC. */
#include <string.h>
-#define my_index strchr
+#define my_index strchr
#else
/* Avoid depending on library functions or files
@@ -220,13 +220,13 @@ static char *
const char *str;
int chr;
{
- while (*str)
- {
- if (*str == chr)
- return (char *) str;
- str++;
- }
- return 0;
+ while (*str)
+ {
+ if (*str == chr)
+ return (char *) str;
+ str++;
+ }
+ return 0;
}
/* If using GCC, we can safely declare strlen this way.
@@ -270,10 +270,10 @@ static void store_args(int argc, char *c
static void
store_args(int argc, char *const *argv)
{
- /* XXX This is no good solution. We should rather copy the args so
- that we can compare them later. But we must not use malloc(3). */
- original_argc = argc;
- original_argv = argv;
+ /* XXX This is no good solution. We should rather copy the args so
+ that we can compare them later. But we must not use malloc(3). */
+ original_argc = argc;
+ original_argv = argv;
}
text_set_element(__libc_subinit, store_args);
#endif
@@ -296,56 +296,56 @@ static void
exchange(argv)
char **argv;
{
- int bottom = first_nonopt;
- int middle = last_nonopt;
- int top = optind;
- char *tem;
+ int bottom = first_nonopt;
+ int middle = last_nonopt;
+ int top = optind;
+ char *tem;
- /* Exchange the shorter segment with the far end of the longer segment.
- That puts the shorter segment into the right place.
- It leaves the longer segment in the right place overall,
- but it consists of two parts that need to be swapped next. */
+ /* Exchange the shorter segment with the far end of the longer segment.
+ That puts the shorter segment into the right place.
+ It leaves the longer segment in the right place overall,
+ but it consists of two parts that need to be swapped next. */
- while (top > middle && middle > bottom)
- {
- if (top - middle > middle - bottom)
- {
- /* Bottom segment is the short one. */
- int len = middle - bottom;
- register int i;
+ while (top > middle && middle > bottom)
+ {
+ if (top - middle > middle - bottom)
+ {
+ /* Bottom segment is the short one. */
+ int len = middle - bottom;
+ register int i;
- /* Swap it with the top part of the top segment. */
- for (i = 0; i < len; i++)
- {
- tem = argv[bottom + i];
- argv[bottom + i] = argv[top - (middle - bottom) + i];
- argv[top - (middle - bottom) + i] = tem;
- }
- /* Exclude the moved bottom segment from further swapping. */
- top -= len;
- }
- else
- {
- /* Top segment is the short one. */
- int len = top - middle;
- register int i;
+ /* Swap it with the top part of the top segment. */
+ for (i = 0; i < len; i++)
+ {
+ tem = argv[bottom + i];
+ argv[bottom + i] = argv[top - (middle - bottom) + i];
+ argv[top - (middle - bottom) + i] = tem;
+ }
+ /* Exclude the moved bottom segment from further swapping. */
+ top -= len;
+ }
+ else
+ {
+ /* Top segment is the short one. */
+ int len = top - middle;
+ register int i;
- /* Swap it with the bottom part of the bottom segment. */
- for (i = 0; i < len; i++)
- {
- tem = argv[bottom + i];
- argv[bottom + i] = argv[middle + i];
- argv[middle + i] = tem;
- }
- /* Exclude the moved top segment from further swapping. */
- bottom += len;
- }
- }
+ /* Swap it with the bottom part of the bottom segment. */
+ for (i = 0; i < len; i++)
+ {
+ tem = argv[bottom + i];
+ argv[bottom + i] = argv[middle + i];
+ argv[middle + i] = tem;
+ }
+ /* Exclude the moved top segment from further swapping. */
+ bottom += len;
+ }
+ }
- /* Update records for the slots the non-options now occupy. */
+ /* Update records for the slots the non-options now occupy. */
- first_nonopt += (optind - last_nonopt);
- last_nonopt = optind;
+ first_nonopt += (optind - last_nonopt);
+ last_nonopt = optind;
}
/* Initialize the internal data when the first call is made. */
@@ -360,55 +360,55 @@ static const char *
char *const *argv;
const char *optstring;
{
- /* Start processing options with ARGV-element 1 (since ARGV-element 0
- is the program name); the sequence of previously skipped
- non-option ARGV-elements is empty. */
+ /* Start processing options with ARGV-element 1 (since ARGV-element 0
+ is the program name); the sequence of previously skipped
+ non-option ARGV-elements is empty. */
- first_nonopt = last_nonopt = optind = 1;
+ first_nonopt = last_nonopt = optind = 1;
- nextchar = NULL;
+ nextchar = NULL;
- posixly_correct = getenv("POSIXLY_CORRECT");
+ posixly_correct = getenv("POSIXLY_CORRECT");
- /* Determine how to handle the ordering of options and nonoptions. */
+ /* Determine how to handle the ordering of options and nonoptions. */
- if (optstring[0] == '-')
- {
- ordering = RETURN_IN_ORDER;
- ++optstring;
- }
- else if (optstring[0] == '+')
- {
- ordering = REQUIRE_ORDER;
- ++optstring;
- }
- else if (posixly_correct != NULL)
- ordering = REQUIRE_ORDER;
- else
- ordering = PERMUTE;
+ if (optstring[0] == '-')
+ {
+ ordering = RETURN_IN_ORDER;
+ ++optstring;
+ }
+ else if (optstring[0] == '+')
+ {
+ ordering = REQUIRE_ORDER;
+ ++optstring;
+ }
+ else if (posixly_correct != NULL)
+ ordering = REQUIRE_ORDER;
+ else
+ ordering = PERMUTE;
#ifdef _LIBC
- if (posixly_correct == NULL
- && argc == original_argc && argv == original_argv)
- {
- /* Bash 2.0 puts a special variable in the environment for each
- command it runs, specifying which ARGV elements are the results of
- file name wildcard expansion and therefore should not be
- considered as options. */
- char var[100];
+ if (posixly_correct == NULL
+ && argc == original_argc && argv == original_argv)
+ {
+ /* Bash 2.0 puts a special variable in the environment for each
+ command it runs, specifying which ARGV elements are the results of
+ file name wildcard expansion and therefore should not be
+ considered as options. */
+ char var[100];
- sprintf(var, "_%d_GNU_nonoption_argv_flags_", getpid());
- nonoption_flags = getenv(var);
- if (nonoption_flags == NULL)
- nonoption_flags_len = 0;
- else
- nonoption_flags_len = strlen(nonoption_flags);
- }
- else
- nonoption_flags_len = 0;
+ sprintf(var, "_%d_GNU_nonoption_argv_flags_", getpid());
+ nonoption_flags = getenv(var);
+ if (nonoption_flags == NULL)
+ nonoption_flags_len = 0;
+ else
+ nonoption_flags_len = strlen(nonoption_flags);
+ }
+ else
+ nonoption_flags_len = 0;
#endif
- return optstring;
+ return optstring;
}
/* Scan elements of ARGV (whose length is ARGC) for option characters
@@ -476,450 +476,450 @@ int
int *longind;
int long_only;
{
- optarg = NULL;
+ optarg = NULL;
- if (!__getopt_initialized || optind == 0)
- {
- optstring = _getopt_initialize(argc, argv, optstring);
- optind = 1; /* Don't scan ARGV[0], the program name. */
- __getopt_initialized = 1;
- }
+ if (!__getopt_initialized || optind == 0)
+ {
+ optstring = _getopt_initialize(argc, argv, optstring);
+ optind = 1; /* Don't scan ARGV[0], the program name. */
+ __getopt_initialized = 1;
+ }
- /* Test whether ARGV[optind] points to a non-option argument.
- Either it does not have option syntax, or there is an environment flag
- from the shell indicating it is not an option. The later information
- is only used when the used in the GNU libc. */
+ /* Test whether ARGV[optind] points to a non-option argument.
+ Either it does not have option syntax, or there is an environment flag
+ from the shell indicating it is not an option. The later information
+ is only used when the used in the GNU libc. */
#ifdef _LIBC
-#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
- || (optind < nonoption_flags_len \
- && nonoption_flags[optind] == '1'))
+#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
+ || (optind < nonoption_flags_len \
+ && nonoption_flags[optind] == '1'))
#else
#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
#endif
- if (nextchar == NULL || *nextchar == '\0')
- {
- /* Advance to the next ARGV-element. */
+ if (nextchar == NULL || *nextchar == '\0')
+ {
+ /* Advance to the next ARGV-element. */
- /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
- moved back by the user (who may also have changed the arguments). */
- if (last_nonopt > optind)
- last_nonopt = optind;
- if (first_nonopt > optind)
- first_nonopt = optind;
+ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
+ moved back by the user (who may also have changed the arguments). */
+ if (last_nonopt > optind)
+ last_nonopt = optind;
+ if (first_nonopt > optind)
+ first_nonopt = optind;
- if (ordering == PERMUTE)
- {
- /* If we have just processed some options following some non-options,
- exchange them so that the options come first. */
+ if (ordering == PERMUTE)
+ {
+ /* If we have just processed some options following some non-options,
+ exchange them so that the options come first. */
- if (first_nonopt != last_nonopt && last_nonopt != optind)
- exchange((char **) argv);
- else if (last_nonopt != optind)
- first_nonopt = optind;
+ if (first_nonopt != last_nonopt && last_nonopt != optind)
+ exchange((char **) argv);
+ else if (last_nonopt != optind)
+ first_nonopt = optind;
- /* Skip any additional non-options
- and extend the range of non-options previously skipped. */
+ /* Skip any additional non-options
+ and extend the range of non-options previously skipped. */
- while (optind < argc && NONOPTION_P)
- optind++;
- last_nonopt = optind;
- }
+ while (optind < argc && NONOPTION_P)
+ optind++;
+ last_nonopt = optind;
+ }
- /* The special ARGV-element `--' means premature end of options.
- Skip it like a null option,
- then exchange with previous non-options as if it were an option,
- then skip everything else like a non-option. */
+ /* The special ARGV-element `--' means premature end of options.
+ Skip it like a null option,
+ then exchange with previous non-options as if it were an option,
+ then skip everything else like a non-option. */
- if (optind != argc && !strcmp(argv[optind], "--"))
- {
- optind++;
+ if (optind != argc && !strcmp(argv[optind], "--"))
+ {
+ optind++;
- if (first_nonopt != last_nonopt && last_nonopt != optind)
- exchange((char **) argv);
- else if (first_nonopt == last_nonopt)
- first_nonopt = optind;
- last_nonopt = argc;
+ if (first_nonopt != last_nonopt && last_nonopt != optind)
+ exchange((char **) argv);
+ else if (first_nonopt == last_nonopt)
+ first_nonopt = optind;
+ last_nonopt = argc;
- optind = argc;
- }
+ optind = argc;
+ }
- /* If we have done all the ARGV-elements, stop the scan
- and back over any non-options that we skipped and permuted. */
+ /* If we have done all the ARGV-elements, stop the scan
+ and back over any non-options that we skipped and permuted. */
- if (optind == argc)
- {
- /* Set the next-arg-index to point at the non-options
- that we previously skipped, so the caller will digest them. */
- if (first_nonopt != last_nonopt)
- optind = first_nonopt;
- return -1;
- }
+ if (optind == argc)
+ {
+ /* Set the next-arg-index to point at the non-options
+ that we previously skipped, so the caller will digest them. */
+ if (first_nonopt != last_nonopt)
+ optind = first_nonopt;
+ return -1;
+ }
- /* If we have come to a non-option and did not permute it,
- either stop the scan or describe it to the caller and pass it by. */
+ /* If we have come to a non-option and did not permute it,
+ either stop the scan or describe it to the caller and pass it by. */
- if (NONOPTION_P)
- {
- if (ordering == REQUIRE_ORDER)
- return -1;
- optarg = argv[optind++];
- return 1;
- }
+ if (NONOPTION_P)
+ {
+ if (ordering == REQUIRE_ORDER)
+ return -1;
+ optarg = argv[optind++];
+ return 1;
+ }
- /* We have found another option-ARGV-element.
- Skip the initial punctuation. */
+ /* We have found another option-ARGV-element.
+ Skip the initial punctuation. */
- nextchar = (argv[optind] + 1
- + (longopts != NULL && argv[optind][1] == '-'));
- }
+ nextchar = (argv[optind] + 1
+ + (longopts != NULL && argv[optind][1] == '-'));
+ }
- /* Decode the current option-ARGV-element. */
+ /* Decode the current option-ARGV-element. */
- /* Check whether the ARGV-element is a long option.
+ /* Check whether the ARGV-element is a long option.
- If long_only and the ARGV-element has the form "-f", where f is
- a valid short option, don't consider it an abbreviated form of
- a long option that starts with f. Otherwise there would be no
- way to give the -f short option.
+ If long_only and the ARGV-element has the form "-f", where f is
+ a valid short option, don't consider it an abbreviated form of
+ a long option that starts with f. Otherwise there would be no
+ way to give the -f short option.
- On the other hand, if there's a long option "fubar" and
- the ARGV-element is "-fu", do consider that an abbreviation of
- the long option, just like "--fu", and not "-f" with arg "u".
+ On the other hand, if there's a long option "fubar" and
+ the ARGV-element is "-fu", do consider that an abbreviation of
+ the long option, just like "--fu", and not "-f" with arg "u".
- This distinction seems to be the most useful approach. */
+ This distinction seems to be the most useful approach. */
- if (longopts != NULL
- && (argv[optind][1] == '-'
- || (long_only && (argv[optind][2] || !my_index(optstring, argv[optind][1])))))
- {
- char *nameend;
- const struct option *p;
- const struct option *pfound = NULL;
- int exact = 0;
- int ambig = 0;
- int indfound = -1;
- int option_index;
+ if (longopts != NULL
+ && (argv[optind][1] == '-'
+ || (long_only && (argv[optind][2] || !my_index(optstring, argv[optind][1])))))
+ {
+ char *nameend;
+ const struct option *p;
+ const struct option *pfound = NULL;
+ int exact = 0;
+ int ambig = 0;
+ int indfound = -1;
+ int option_index;
- for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
- /* Do nothing. */ ;
+ for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
+ /* Do nothing. */ ;
- /* Test all long options for either exact match
- or abbreviated matches. */
- for (p = longopts, option_index = 0; p->name; p++, option_index++)
- if (!strncmp(p->name, nextchar, nameend - nextchar))
- {
- if ((unsigned int) (nameend - nextchar)
- == (unsigned int) strlen(p->name))
- {
- /* Exact match found. */
- pfound = p;
- indfound = option_index;
- exact = 1;
- break;
- }
- else if (pfound == NULL)
- {
- /* First nonexact match found. */
- pfound = p;
- indfound = option_index;
- }
- else
- /* Second or later nonexact match found. */
- ambig = 1;
- }
+ /* Test all long options for either exact match
+ or abbreviated matches. */
+ for (p = longopts, option_index = 0; p->name; p++, option_index++)
+ if (!strncmp(p->name, nextchar, nameend - nextchar))
+ {
+ if ((unsigned int) (nameend - nextchar)
+ == (unsigned int) strlen(p->name))
+ {
+ /* Exact match found. */
+ pfound = p;
+ indfound = option_index;
+ exact = 1;
+ break;
+ }
+ else if (pfound == NULL)
+ {
+ /* First nonexact match found. */
+ pfound = p;
+ indfound = option_index;
+ }
+ else
+ /* Second or later nonexact match found. */
+ ambig = 1;
+ }
- if (ambig && !exact)
- {
- if (opterr)
- fprintf(stderr, _("%s: option `%s' is ambiguous\n"),
- argv[0], argv[optind]);
- nextchar += strlen(nextchar);
- optind++;
- optopt = 0;
- return '?';
- }
+ if (ambig && !exact)
+ {
+ if (opterr)
+ fprintf(stderr, _("%s: option `%s' is ambiguous\n"),
+ argv[0], argv[optind]);
+ nextchar += strlen(nextchar);
+ optind++;
+ optopt = 0;
+ return '?';
+ }
- if (pfound != NULL)
- {
- option_index = indfound;
- optind++;
- if (*nameend)
- {
- /* Don't test has_arg with >, because some C compilers don't
- allow it to be used on enums. */
- if (pfound->has_arg)
- optarg = nameend + 1;
- else
- {
- if (opterr)
- {
- if (argv[optind - 1][1] == '-')
- /* --option */
- fprintf(stderr,
- _("%s: option `--%s' doesn't allow an argument\n"),
- argv[0], pfound->name);
- else
- /* +option or -option */
- fprintf(stderr,
- _("%s: option `%c%s' doesn't allow an argument\n"),
- argv[0], argv[optind - 1][0], pfound->name);
- }
+ if (pfound != NULL)
+ {
+ option_index = indfound;
+ optind++;
+ if (*nameend)
+ {
+ /* Don't test has_arg with >, because some C compilers don't
+ allow it to be used on enums. */
+ if (pfound->has_arg)
+ optarg = nameend + 1;
+ else
+ {
+ if (opterr)
+ {
+ if (argv[optind - 1][1] == '-')
+ /* --option */
+ fprintf(stderr,
+ _("%s: option `--%s' doesn't allow an argument\n"),
+ argv[0], pfound->name);
+ else
+ /* +option or -option */
+ fprintf(stderr,
+ _("%s: option `%c%s' doesn't allow an argument\n"),
+ argv[0], argv[optind - 1][0], pfound->name);
+ }
- nextchar += strlen(nextchar);
+ nextchar += strlen(nextchar);
- optopt = pfound->val;
- return '?';
- }
- }
- else if (pfound->has_arg == 1)
- {
- if (optind < argc)
- optarg = argv[optind++];
- else
- {
- if (opterr)
- fprintf(stderr,
- _("%s: option `%s' requires an argument\n"),
- argv[0], argv[optind - 1]);
- nextchar += strlen(nextchar);
- optopt = pfound->val;
- return optstring[0] == ':' ? ':' : '?';
- }
- }
- nextchar += strlen(nextchar);
- if (longind != NULL)
- *longind = option_index;
- if (pfound->flag)
- {
- *(pfound->flag) = pfound->val;
- return 0;
- }
- return pfound->val;
- }
+ optopt = pfound->val;
+ return '?';
+ }
+ }
+ else if (pfound->has_arg == 1)
+ {
+ if (optind < argc)
+ optarg = argv[optind++];
+ else
+ {
+ if (opterr)
+ fprintf(stderr,
+ _("%s: option `%s' requires an argument\n"),
+ argv[0], argv[optind - 1]);
+ nextchar += strlen(nextchar);
+ optopt = pfound->val;
+ return optstring[0] == ':' ? ':' : '?';
+ }
+ }
+ nextchar += strlen(nextchar);
+ if (longind != NULL)
+ *longind = option_index;
+ if (pfound->flag)
+ {
+ *(pfound->flag) = pfound->val;
+ return 0;
+ }
+ return pfound->val;
+ }
- /* Can't find it as a long option. If this is not getopt_long_only,
- or the option starts with '--' or is not a valid short
- option, then it's an error.
- Otherwise interpret it as a short option. */
- if (!long_only || argv[optind][1] == '-'
- || my_index(optstring, *nextchar) == NULL)
- {
- if (opterr)
- {
- if (argv[optind][1] == '-')
- /* --option */
- fprintf(stderr, _("%s: unrecognized option `--%s'\n"),
- argv[0], nextchar);
- else
- /* +option or -option */
- fprintf(stderr, _("%s: unrecognized option `%c%s'\n"),
- argv[0], argv[optind][0], nextchar);
- }
- nextchar = (char *) "";
- optind++;
- optopt = 0;
- return '?';
- }
- }
+ /* Can't find it as a long option. If this is not getopt_long_only,
+ or the option starts with '--' or is not a valid short
+ option, then it's an error.
+ Otherwise interpret it as a short option. */
+ if (!long_only || argv[optind][1] == '-'
+ || my_index(optstring, *nextchar) == NULL)
+ {
+ if (opterr)
+ {
+ if (argv[optind][1] == '-')
+ /* --option */
+ fprintf(stderr, _("%s: unrecognized option `--%s'\n"),
+ argv[0], nextchar);
+ else
+ /* +option or -option */
+ fprintf(stderr, _("%s: unrecognized option `%c%s'\n"),
+ argv[0], argv[optind][0], nextchar);
+ }
+ nextchar = (char *) "";
+ optind++;
+ optopt = 0;
+ return '?';
+ }
+ }
- /* Look at and handle the next short option-character. */
+ /* Look at and handle the next short option-character. */
- {
- char c = *nextchar++;
- char *temp = my_index(optstring, c);
+ {
+ char c = *nextchar++;
+ char *temp = my_index(optstring, c);
- /* Increment `optind' when we start to process its last character. */
- if (*nextchar == '\0')
- ++optind;
+ /* Increment `optind' when we start to process its last character. */
+ if (*nextchar == '\0')
+ ++optind;
- if (temp == NULL || c == ':')
- {
- if (opterr)
- {
- if (posixly_correct)
- /* 1003.2 specifies the format of this message. */
- fprintf(stderr, _("%s: illegal option -- %c\n"),
- argv[0], c);
- else
- fprintf(stderr, _("%s: invalid option -- %c\n"),
- argv[0], c);
- }
- optopt = c;
- return '?';
- }
- /* Convenience. Treat POSIX -W foo same as long option --foo */
- if (temp[0] == 'W' && temp[1] == ';')
- {
- char *nameend;
- const struct option *p;
- const struct option *pfound = NULL;
- int exact = 0;
- int ambig = 0;
- int indfound = 0;
- int option_index;
+ if (temp == NULL || c == ':')
+ {
+ if (opterr)
+ {
+ if (posixly_correct)
+ /* 1003.2 specifies the format of this message. */
+ fprintf(stderr, _("%s: illegal option -- %c\n"),
+ argv[0], c);
+ else
+ fprintf(stderr, _("%s: invalid option -- %c\n"),
+ argv[0], c);
+ }
+ optopt = c;
+ return '?';
+ }
+ /* Convenience. Treat POSIX -W foo same as long option --foo */
+ if (temp[0] == 'W' && temp[1] == ';')
+ {
+ char *nameend;
+ const struct option *p;
+ const struct option *pfound = NULL;
+ int exact = 0;
+ int ambig = 0;
+ int indfound = 0;
+ int option_index;
- /* This is an option that requires an argument. */
- if (*nextchar != '\0')
- {
- optarg = nextchar;
- /* If we end this ARGV-element by taking the rest as an arg,
- we must advance to the next element now. */
- optind++;
- }
- else if (optind == argc)
- {
- if (opterr)
- {
- /* 1003.2 specifies the format of this message. */
- fprintf(stderr, _("%s: option requires an argument -- %c\n"),
- argv[0], c);
- }
- optopt = c;
- if (optstring[0] == ':')
- c = ':';
- else
- c = '?';
- return c;
- }
- else
- /* We already incremented `optind' once;
- increment it again when taking next ARGV-elt as argument. */
- optarg = argv[optind++];
+ /* This is an option that requires an argument. */
+ if (*nextchar != '\0')
+ {
+ optarg = nextchar;
+ /* If we end this ARGV-element by taking the rest as an arg,
+ we must advance to the next element now. */
+ optind++;
+ }
+ else if (optind == argc)
+ {
+ if (opterr)
+ {
+ /* 1003.2 specifies the format of this message. */
+ fprintf(stderr, _("%s: option requires an argument -- %c\n"),
+ argv[0], c);
+ }
+ optopt = c;
+ if (optstring[0] == ':')
+ c = ':';
+ else
+ c = '?';
+ return c;
+ }
+ else
+ /* We already incremented `optind' once;
+ increment it again when taking next ARGV-elt as argument. */
+ optarg = argv[optind++];
- /* optarg is now the argument, see if it's in the
- table of longopts. */
+ /* optarg is now the argument, see if it's in the
+ table of longopts. */
- for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
- /* Do nothing. */ ;
+ for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
+ /* Do nothing. */ ;
- /* Test all long options for either exact match
- or abbreviated matches. */
- for (p = longopts, option_index = 0; p->name; p++, option_index++)
- if (!strncmp(p->name, nextchar, nameend - nextchar))
- {
- if ((unsigned int) (nameend - nextchar) == strlen(p->name))
- {
- /* Exact match found. */
- pfound = p;
- indfound = option_index;
- exact = 1;
- break;
- }
- else if (pfound == NULL)
- {
- /* First nonexact match found. */
- pfound = p;
- indfound = option_index;
- }
- else
- /* Second or later nonexact match found. */
- ambig = 1;
- }
- if (ambig && !exact)
- {
- if (opterr)
- fprintf(stderr, _("%s: option `-W %s' is ambiguous\n"),
- argv[0], argv[optind]);
- nextchar += strlen(nextchar);
- optind++;
- return '?';
- }
- if (pfound != NULL)
- {
- option_index = indfound;
- if (*nameend)
- {
- /* Don't test has_arg with >, because some C compilers don't
- allow it to be used on enums. */
- if (pfound->has_arg)
- optarg = nameend + 1;
- else
- {
- if (opterr)
- fprintf(stderr, _("\
+ /* Test all long options for either exact match
+ or abbreviated matches. */
+ for (p = longopts, option_index = 0; p->name; p++, option_index++)
+ if (!strncmp(p->name, nextchar, nameend - nextchar))
+ {
+ if ((unsigned int) (nameend - nextchar) == strlen(p->name))
+ {
+ /* Exact match found. */
+ pfound = p;
+ indfound = option_index;
+ exact = 1;
+ break;
+ }
+ else if (pfound == NULL)
+ {
+ /* First nonexact match found. */
+ pfound = p;
+ indfound = option_index;
+ }
+ else
+ /* Second or later nonexact match found. */
+ ambig = 1;
+ }
+ if (ambig && !exact)
+ {
+ if (opterr)
+ fprintf(stderr, _("%s: option `-W %s' is ambiguous\n"),
+ argv[0], argv[optind]);
+ nextchar += strlen(nextchar);
+ optind++;
+ return '?';
+ }
+ if (pfound != NULL)
+ {
+ option_index = indfound;
+ if (*nameend)
+ {
+ /* Don't test has_arg with >, because some C compilers don't
+ allow it to be used on enums. */
+ if (pfound->has_arg)
+ optarg = nameend + 1;
+ else
+ {
+ if (opterr)
+ fprintf(stderr, _("\
%s: option `-W %s' doesn't allow an argument\n"),
- argv[0], pfound->name);
+ argv[0], pfound->name);
- nextchar += strlen(nextchar);
- return '?';
- }
- }
- else if (pfound->has_arg == 1)
- {
- if (optind < argc)
- optarg = argv[optind++];
- else
- {
- if (opterr)
- fprintf(stderr,
- _("%s: option `%s' requires an argument\n"),
- argv[0], argv[optind - 1]);
- nextchar += strlen(nextchar);
- return optstring[0] == ':' ? ':' : '?';
- }
- }
- nextchar += strlen(nextchar);
- if (longind != NULL)
- *longind = option_index;
- if (pfound->flag)
- {
- *(pfound->flag) = pfound->val;
- return 0;
- }
- return pfound->val;
- }
- nextchar = NULL;
- return 'W'; /* Let the application handle it. */
- }
- if (temp[1] == ':')
- {
- if (temp[2] == ':')
- {
- /* This is an option that accepts an argument optionally. */
- if (*nextchar != '\0')
- {
- optarg = nextchar;
- optind++;
- }
- else
- optarg = NULL;
- nextchar = NULL;
- }
- else
- {
- /* This is an option that requires an argument. */
- if (*nextchar != '\0')
- {
- optarg = nextchar;
- /* If we end this ARGV-element by taking the rest as an arg,
- we must advance to the next element now. */
- optind++;
- }
- else if (optind == argc)
- {
- if (opterr)
- {
- /* 1003.2 specifies the format of this message. */
- fprintf(stderr,
- _("%s: option requires an argument -- %c\n"),
- argv[0], c);
- }
- optopt = c;
- if (optstring[0] == ':')
- c = ':';
- else
- c = '?';
- }
- else
- /* We already incremented `optind' once;
- increment it again when taking next ARGV-elt as argument. */
- optarg = argv[optind++];
- nextchar = NULL;
- }
- }
- return c;
- }
+ nextchar += strlen(nextchar);
+ return '?';
+ }
+ }
+ else if (pfound->has_arg == 1)
+ {
+ if (optind < argc)
+ optarg = argv[optind++];
+ else
+ {
+ if (opterr)
+ fprintf(stderr,
+ _("%s: option `%s' requires an argument\n"),
+ argv[0], argv[optind - 1]);
+ nextchar += strlen(nextchar);
+ return optstring[0] == ':' ? ':' : '?';
+ }
+ }
+ nextchar += strlen(nextchar);
+ if (longind != NULL)
+ *longind = option_index;
+ if (pfound->flag)
+ {
+ *(pfound->flag) = pfound->val;
+ return 0;
+ }
+ return pfound->val;
+ }
+ nextchar = NULL;
+ return 'W'; /* Let the application handle it. */
+ }
+ if (temp[1] == ':')
+ {
+ if (temp[2] == ':')
+ {
+ /* This is an option that accepts an argument optionally. */
+ if (*nextchar != '\0')
+ {
+ optarg = nextchar;
+ optind++;
+ }
+ else
+ optarg = NULL;
+ nextchar = NULL;
+ }
+ else
+ {
+ /* This is an option that requires an argument. */
+ if (*nextchar != '\0')
+ {
+ optarg = nextchar;
+ /* If we end this ARGV-element by taking the rest as an arg,
+ we must advance to the next element now. */
+ optind++;
+ }
+ else if (optind == argc)
+ {
+ if (opterr)
+ {
+ /* 1003.2 specifies the format of this message. */
+ fprintf(stderr,
+ _("%s: option requires an argument -- %c\n"),
+ argv[0], c);
+ }
+ optopt = c;
+ if (optstring[0] == ':')
+ c = ':';
+ else
+ c = '?';
+ }
+ else
+ /* We already incremented `optind' once;
+ increment it again when taking next ARGV-elt as argument. */
+ optarg = argv[optind++];
+ nextchar = NULL;
+ }
+ }
+ return c;
+ }
}
int
@@ -928,10 +928,10 @@ int
char *const *argv;
const char *optstring;
{
- return _getopt_internal(argc, argv, optstring,
- (const struct option *) 0,
- (int *) 0,
- 0);
+ return _getopt_internal(argc, argv, optstring,
+ (const struct option *) 0,
+ (int *) 0,
+ 0);
}
#endif /* Not ELIDE_CODE. */
@@ -946,64 +946,64 @@ int
int argc;
char **argv;
{
- int c;
- int digit_optind = 0;
+ int c;
+ int digit_optind = 0;
- while (1)
- {
- int this_option_optind = optind ? optind : 1;
+ while (1)
+ {
+ int this_option_optind = optind ? optind : 1;
- c = getopt(argc, argv, "abc:d:0123456789");
- if (c == -1)
- break;
+ c = getopt(argc, argv, "abc:d:0123456789");
+ if (c == -1)
+ break;
- switch (c)
- {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (digit_optind != 0 && digit_optind != this_option_optind)
- printf("digits occur in two different argv-elements.\n");
- digit_optind = this_option_optind;
- printf("option %c\n", c);
- break;
+ switch (c)
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ if (digit_optind != 0 && digit_optind != this_option_optind)
+ printf("digits occur in two different argv-elements.\n");
+ digit_optind = this_option_optind;
+ printf("option %c\n", c);
+ break;
- case 'a':
- printf("option a\n");
- break;
+ case 'a':
+ printf("option a\n");
+ break;
- case 'b':
- printf("option b\n");
- break;
+ case 'b':
+ printf("option b\n");
+ break;
- case 'c':
- printf("option c with value `%s'\n", optarg);
- break;
+ case 'c':
+ printf("option c with value `%s'\n", optarg);
+ break;
- case '?':
- break;
+ case '?':
+ break;
- default:
- printf("?? getopt returned character code 0%o ??\n", c);
- }
- }
+ default:
+ printf("?? getopt returned character code 0%o ??\n", c);
+ }
+ }
- if (optind < argc)
- {
- printf("non-option ARGV-elements: ");
- while (optind < argc)
- printf("%s ", argv[optind++]);
- printf("\n");
- }
+ if (optind < argc)
+ {
+ printf("non-option ARGV-elements: ");
+ while (optind < argc)
+ printf("%s ", argv[optind++]);
+ printf("\n");
+ }
- exit(0);
+ exit(0);
}
#endif /* TEST */
Modified: trunk/libdvdread/msvc/contrib/timer/timer.c
==============================================================================
--- trunk/libdvdread/msvc/contrib/timer/timer.c (original)
+++ trunk/libdvdread/msvc/contrib/timer/timer.c Tue Sep 23 11:14:45 2008
@@ -28,75 +28,75 @@
#include "timer.h"
/*
- this function returns somewhat
- accurate unix time with the data
- accurate to the first call to get
- of day and the resolution accurate
- to ~ miliseconds.
+ this function returns somewhat
+ accurate unix time with the data
+ accurate to the first call to get
+ of day and the resolution accurate
+ to ~ miliseconds.
*/
static time_t startseconds = 0;
int gettimeofday( struct timeval *tp, struct timezone *tzp )
{
- MMTIME mmtime;
+ MMTIME mmtime;
- // clock() returns time in miliseconds
+ // clock() returns time in miliseconds
- if( !startseconds )
- startseconds = time( 0 );
+ if( !startseconds )
+ startseconds = time( 0 );
- timeGetSystemTime( &mmtime, sizeof( mmtime ) );
+ timeGetSystemTime( &mmtime, sizeof( mmtime ) );
- tp->tv_sec = ( mmtime.u.ms / 1000 ) + startseconds;
- tp->tv_usec = ( mmtime.u.ms % 1000 ) * 1000;
+ tp->tv_sec = ( mmtime.u.ms / 1000 ) + startseconds;
+ tp->tv_usec = ( mmtime.u.ms % 1000 ) * 1000;
- return 0;
+ return 0;
};
/*
- These functions are designed to mimick
- a subset of itimer for use with the
- alarm signal on win32. This is just
- enough for xine to work.
+ These functions are designed to mimick
+ a subset of itimer for use with the
+ alarm signal on win32. This is just
+ enough for xine to work.
*/
static HANDLE sigalarm = 0;
int setitimer( int which, struct itimerval * value, struct itimerval *ovalue )
{
- long int miliseconds;
+ long int miliseconds;
- if( !sigalarm )
- sigalarm = CreateEvent( 0, FALSE, TRUE, "SIGALARM" );
+ if( !sigalarm )
+ sigalarm = CreateEvent( 0, FALSE, TRUE, "SIGALARM" );
miliseconds = value->it_value.tv_usec / 1000;
- timeSetEvent( miliseconds, 0, ( LPTIMECALLBACK ) sigalarm, 0, TIME_PERIODIC | TIME_CALLBACK_EVENT_PULSE );
+ timeSetEvent( miliseconds, 0, ( LPTIMECALLBACK ) sigalarm, 0, TIME_PERIODIC | TIME_CALLBACK_EVENT_PULSE );
- return 0;
+ return 0;
}
/*
- Wait for sigalarm to wake the thread
+ Wait for sigalarm to wake the thread
*/
int pause( void )
{
- WaitForSingleObject( sigalarm, INFINITE );
+ WaitForSingleObject( sigalarm, INFINITE );
- return 0;
+ return 0;
}
int nanosleep( const struct timespec * rqtp, struct timespec * rmtp )
{
- Sleep( rqtp->tv_nsec / 1000000 );
+ Sleep( rqtp->tv_nsec / 1000000 );
- return 0;
+ return 0;
}
unsigned int sleep( unsigned int seconds )
{
- Sleep( seconds * 1000 );
- return 0;
+ Sleep( seconds * 1000 );
+ return 0;
}
Modified: trunk/libdvdread/msvc/contrib/timer/timer.h
==============================================================================
--- trunk/libdvdread/msvc/contrib/timer/timer.h (original)
+++ trunk/libdvdread/msvc/contrib/timer/timer.h Tue Sep 23 11:14:45 2008
@@ -5,23 +5,23 @@
#ifndef _ITIMER_
#define _ITIMER_
-#define ITIMER_REAL 0
-#define ITIMER_VIRTUAL 1
+#define ITIMER_REAL 0
+#define ITIMER_VIRTUAL 1
-// time reference
-// ----------------------------------
+// time reference
+// ----------------------------------
//
-// 1,000 milliseconds / sec
-// 1,000,000 microseconds / sec
-// 1,000,000,000 nanoseconds / sec
+// 1,000 milliseconds / sec
+// 1,000,000 microseconds / sec
+// 1,000,000,000 nanoseconds / sec
//
// timeval.time_sec = seconds
// timeval.time_usec = microseconds
struct itimerval
{
- struct timeval it_interval; /* timer interval */
- struct timeval it_value; /* current value */
+ struct timeval it_interval; /* timer interval */
+ struct timeval it_value; /* current value */
};
struct timezone {
@@ -36,4 +36,4 @@ int pause( void );
unsigned int sleep( unsigned int seconds );
int nanosleep( const struct timespec *rqtp, struct timespec *rmtp );
-#endif
\ No newline at end of file
+#endif
Modified: trunk/libdvdread/msvc/include/dlfcn.h
==============================================================================
--- trunk/libdvdread/msvc/include/dlfcn.h (original)
+++ trunk/libdvdread/msvc/include/dlfcn.h Tue Sep 23 11:14:45 2008
@@ -9,10 +9,10 @@ extern char *dlerror (void);
/* These don't mean anything on windows */
#define RTLD_NEXT ((void *) -1l)
#define RTLD_DEFAULT ((void *) 0)
-#define RTLD_LAZY -1
-#define RTLD_NOW -1
+#define RTLD_LAZY -1
+#define RTLD_NOW -1
#define RTLD_BINDING_MASK -1
-#define RTLD_NOLOAD -1
-#define RTLD_GLOBAL -1
+#define RTLD_NOLOAD -1
+#define RTLD_GLOBAL -1
#endif /* __DLFCN_H__ */
Modified: trunk/libdvdread/msvc/include/getopt.h
==============================================================================
--- trunk/libdvdread/msvc/include/getopt.h (original)
+++ trunk/libdvdread/msvc/include/getopt.h Tue Sep 23 11:14:45 2008
@@ -22,7 +22,7 @@
#ifndef _GETOPT_H
#define _GETOPT_H 1
-#ifdef __cplusplus
+#ifdef __cplusplus
extern "C"
{
#endif
@@ -33,7 +33,7 @@ extern "C"
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
- extern char *optarg;
+ extern char *optarg;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
@@ -47,16 +47,16 @@ extern "C"
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
- extern int optind;
+ extern int optind;
/* Callers store zero here to inhibit the error message `getopt' prints
for unrecognized options. */
- extern int opterr;
+ extern int opterr;
/* Set to an option character which was unrecognized. */
- extern int optopt;
+ extern int optopt;
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
@@ -79,56 +79,56 @@ extern "C"
one). For long options that have a zero `flag' field, `getopt'
returns the contents of the `val' field. */
- struct option
- {
+ struct option
+ {
#if defined (__STDC__) && __STDC__
- const char *name;
+ const char *name;
#else
- char *name;
+ char *name;
#endif
- /* has_arg can't be an enum because some compilers complain about
- type mismatches in all the code that assumes it is an int. */
- int has_arg;
- int *flag;
- int val;
- };
+ /* has_arg can't be an enum because some compilers complain about
+ type mismatches in all the code that assumes it is an int. */
+ int has_arg;
+ int *flag;
+ int val;
+ };
/* Names for the values of the `has_arg' field of `struct option'. */
-#define no_argument 0
-#define required_argument 1
-#define optional_argument 2
+#define no_argument 0
+#define required_argument 1
+#define optional_argument 2
#if defined (__STDC__) && __STDC__
#ifdef __GNU_LIBRARY__
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
- extern int getopt(int argc, char *const *argv, const char *shortopts);
-#else /* not __GNU_LIBRARY__ */
- extern int getopt();
-#endif /* __GNU_LIBRARY__ */
- extern int getopt_long(int argc, char *const *argv, const char *shortopts,
- const struct option *longopts, int *longind);
- extern int getopt_long_only(int argc, char *const *argv,
- const char *shortopts,
- const struct option *longopts, int *longind);
+ extern int getopt(int argc, char *const *argv, const char *shortopts);
+#else /* not __GNU_LIBRARY__ */
+ extern int getopt();
+#endif /* __GNU_LIBRARY__ */
+ extern int getopt_long(int argc, char *const *argv, const char *shortopts,
+ const struct option *longopts, int *longind);
+ extern int getopt_long_only(int argc, char *const *argv,
+ const char *shortopts,
+ const struct option *longopts, int *longind);
/* Internal only. Users should not call this directly. */
- extern int _getopt_internal(int argc, char *const *argv,
- const char *shortopts,
- const struct option *longopts, int *longind,
- int long_only);
-#else /* not __STDC__ */
- extern int getopt();
- extern int getopt_long();
- extern int getopt_long_only();
+ extern int _getopt_internal(int argc, char *const *argv,
+ const char *shortopts,
+ const struct option *longopts, int *longind,
+ int long_only);
+#else /* not __STDC__ */
+ extern int getopt();
+ extern int getopt_long();
+ extern int getopt_long_only();
- extern int _getopt_internal();
-#endif /* __STDC__ */
+ extern int _getopt_internal();
+#endif /* __STDC__ */
-#ifdef __cplusplus
+#ifdef __cplusplus
}
#endif
-#endif /* _GETOPT_H */
+#endif /* _GETOPT_H */
Modified: trunk/libdvdread/msvc/include/os_types.h
==============================================================================
--- trunk/libdvdread/msvc/include/os_types.h (original)
+++ trunk/libdvdread/msvc/include/os_types.h Tue Sep 23 11:14:45 2008
@@ -5,12 +5,12 @@
* 04 Sept 2001 - Chris Wolf create.
*/
-typedef unsigned char uint_8;
-typedef unsigned short uint_16;
-typedef unsigned int uint_32;
-typedef signed char sint_32;
-typedef signed short sint_16;
-typedef signed int sint_8;
+typedef unsigned char uint_8;
+typedef unsigned short uint_16;
+typedef unsigned int uint_32;
+typedef signed char sint_32;
+typedef signed short sint_16;
+typedef signed int sint_8;
#define snprintf _snprintf
#define M_PI 3.14159265358979323846 /* pi */
Modified: trunk/libdvdread/msvc/include/pthreads/pthread.h
==============================================================================
--- trunk/libdvdread/msvc/include/pthreads/pthread.h (original)
+++ trunk/libdvdread/msvc/include/pthreads/pthread.h Tue Sep 23 11:14:45 2008
@@ -41,57 +41,57 @@
*
* POSIX 1003.1c-1995 (POSIX.1c)
*
- * Parts of the implementation also comply with the
- * Open Group Unix 98 specification in order to enhance
- * code portability between Windows, various commercial
- * Unix implementations, and Linux.
+ * Parts of the implementation also comply with the
+ * Open Group Unix 98 specification in order to enhance
+ * code portability between Windows, various commercial
+ * Unix implementations, and Linux.
*
* Authors:
- * There have been many contributors to this library.
- * The initial implementation was contributed by
- * John Bossom, and several others have provided major
- * sections or revisions of parts of the implementation.
- * Often significant effort has been contributed to
- * find and fix important bugs and other problems to
- * improve the reliability of the library, which sometimes
- * is not reflected in the amount of code which changed as
- * result.
- * As much as possible, the contributors are acknowledged
- * in the ChangeLog file in the source code distribution
- * where their changes are noted in detail.
+ * There have been many contributors to this library.
+ * The initial implementation was contributed by
+ * John Bossom, and several others have provided major
+ * sections or revisions of parts of the implementation.
+ * Often significant effort has been contributed to
+ * find and fix important bugs and other problems to
+ * improve the reliability of the library, which sometimes
+ * is not reflected in the amount of code which changed as
+ * result.
+ * As much as possible, the contributors are acknowledged
+ * in the ChangeLog file in the source code distribution
+ * where their changes are noted in detail.
*
* Contributors are listed in the MAINTAINERS file.
*
- * As usual, all bouquets go to the contributors, and all
- * brickbats go to the project maintainer.
+ * As usual, all bouquets go to the contributors, and all
+ * brickbats go to the project maintainer.
*
* Maintainer:
- * The code base for this project is coordinated and
- * eventually pre-tested, packaged, and made available by
+ * The code base for this project is coordinated and
+ * eventually pre-tested, packaged, and made available by
*
- * Ross Johnson <rpj(a)ise.canberra.edu.au>
+ * Ross Johnson <rpj(a)ise.canberra.edu.au>
*
* QA Testers:
- * Ultimately, the library is tested in the real world by
- * a host of competent and demanding scientists and
- * engineers who report bugs and/or provide solutions
- * which are then fixed or incorporated into subsequent
- * versions of the library. Each time a bug is fixed, a
- * test case is written to prove the fix and ensure
- * that later changes to the code don't reintroduce the
- * same error. The number of test cases is slowly growing
- * and therefore so is the code reliability.
+ * Ultimately, the library is tested in the real world by
+ * a host of competent and demanding scientists and
+ * engineers who report bugs and/or provide solutions
+ * which are then fixed or incorporated into subsequent
+ * versions of the library. Each time a bug is fixed, a
+ * test case is written to prove the fix and ensure
+ * that later changes to the code don't reintroduce the
+ * same error. The number of test cases is slowly growing
+ * and therefore so is the code reliability.
*
* Compliance:
- * See the file ANNOUNCE for the list of implemented
- * and not-implemented routines and defined options.
- * Of course, these are all defined is this file as well.
+ * See the file ANNOUNCE for the list of implemented
+ * and not-implemented routines and defined options.
+ * Of course, these are all defined is this file as well.
*
* Web site:
- * The source code and other information about this library
- * are available from
+ * The source code and other information about this library
+ * are available from
*
- * http://sources.redhat.com/pthreads-win32/
+ * http://sources.redhat.com/pthreads-win32/
*
* -------------------------------------------------------------
*/
@@ -122,8 +122,8 @@
#ifndef HAVE_STRUCT_TIMESPEC
struct timespec {
- long tv_sec;
- long tv_nsec;
+ long tv_sec;
+ long tv_nsec;
};
#endif /* HAVE_STRUCT_TIMESPEC */
@@ -170,7 +170,7 @@ struct timespec {
#ifdef __cplusplus
extern "C"
{
-#endif /* __cplusplus */
+#endif /* __cplusplus */
/*
* -------------------------------------------------------------
@@ -313,7 +313,7 @@ extern "C"
#define _POSIX_THREAD_PRIO_PROTECT
#define _POSIX_THREAD_PROCESS_SHARED
-#endif /* KLUDGE */
+#endif /* KLUDGE */
/*
* POSIX Limits
@@ -341,14 +341,14 @@ extern "C"
* revealed this approximate number.
*
*/
-#define PTHREAD_DESTRUCTOR_ITERATIONS 4
-#define PTHREAD_KEYS_MAX 64
-#define PTHREAD_STACK_MIN 0
-#define PTHREAD_THREADS_MAX 2019
+#define PTHREAD_DESTRUCTOR_ITERATIONS 4
+#define PTHREAD_KEYS_MAX 64
+#define PTHREAD_STACK_MIN 0
+#define PTHREAD_THREADS_MAX 2019
#ifdef _UWIN
-# include <sys/types.h>
+# include <sys/types.h>
#else
typedef struct pthread_t_ *pthread_t;
typedef struct pthread_attr_t_ *pthread_attr_t;
@@ -377,39 +377,39 @@ enum {
/*
* pthread_attr_{get,set}detachstate
*/
- PTHREAD_CREATE_JOINABLE = 0, /* Default */
- PTHREAD_CREATE_DETACHED = 1,
+ PTHREAD_CREATE_JOINABLE = 0, /* Default */
+ PTHREAD_CREATE_DETACHED = 1,
/*
* pthread_attr_{get,set}inheritsched
*/
- PTHREAD_INHERIT_SCHED = 0,
- PTHREAD_EXPLICIT_SCHED = 1, /* Default */
+ PTHREAD_INHERIT_SCHED = 0,
+ PTHREAD_EXPLICIT_SCHED = 1, /* Default */
/*
* pthread_{get,set}scope
*/
- PTHREAD_SCOPE_PROCESS = 0,
- PTHREAD_SCOPE_SYSTEM = 1, /* Default */
+ PTHREAD_SCOPE_PROCESS = 0,
+ PTHREAD_SCOPE_SYSTEM = 1, /* Default */
/*
* pthread_setcancelstate paramters
*/
- PTHREAD_CANCEL_ENABLE = 0, /* Default */
- PTHREAD_CANCEL_DISABLE = 1,
+ PTHREAD_CANCEL_ENABLE = 0, /* Default */
+ PTHREAD_CANCEL_DISABLE = 1,
/*
* pthread_setcanceltype parameters
*/
- PTHREAD_CANCEL_ASYNCHRONOUS = 0,
- PTHREAD_CANCEL_DEFERRED = 1, /* Default */
+ PTHREAD_CANCEL_ASYNCHRONOUS = 0,
+ PTHREAD_CANCEL_DEFERRED = 1, /* Default */
/*
* pthread_mutexattr_{get,set}pshared
* pthread_condattr_{get,set}pshared
*/
- PTHREAD_PROCESS_PRIVATE = 0,
- PTHREAD_PROCESS_SHARED = 1,
+ PTHREAD_PROCESS_PRIVATE = 0,
+ PTHREAD_PROCESS_SHARED = 1,
/*
* pthread_barrier_wait
@@ -522,125 +522,125 @@ struct ptw32_cleanup_t
};
#ifdef __CLEANUP_SEH
- /*
- * WIN32 SEH version of cancel cleanup.
- */
+ /*
+ * WIN32 SEH version of cancel cleanup.
+ */
#define pthread_cleanup_push( _rout, _arg ) \
- { \
- ptw32_cleanup_t _cleanup; \
- \
- _cleanup.routine = (ptw32_cleanup_callback_t)(_rout); \
- _cleanup.arg = (_arg); \
- __try \
- { \
+ { \
+ ptw32_cleanup_t _cleanup; \
+ \
+ _cleanup.routine = (ptw32_cleanup_callback_t)(_rout); \
+ _cleanup.arg = (_arg); \
+ __try \
+ { \
#define pthread_cleanup_pop( _execute ) \
- } \
- __finally \
- { \
- if( _execute || AbnormalTermination()) \
- { \
- (*(_cleanup.routine))( _cleanup.arg ); \
- } \
- } \
- }
+ } \
+ __finally \
+ { \
+ if( _execute || AbnormalTermination()) \
+ { \
+ (*(_cleanup.routine))( _cleanup.arg ); \
+ } \
+ } \
+ }
#else /* __CLEANUP_SEH */
#ifdef __CLEANUP_C
- /*
- * C implementation of PThreads cancel cleanup
- */
+ /*
+ * C implementation of PThreads cancel cleanup
+ */
#define pthread_cleanup_push( _rout, _arg ) \
- { \
- ptw32_cleanup_t _cleanup; \
+ { \
+ ptw32_cleanup_t _cleanup; \
\
- ptw32_push_cleanup( &_cleanup, (ptw32_cleanup_callback_t) (_rout), (_arg) ); \
+ ptw32_push_cleanup( &_cleanup, (ptw32_cleanup_callback_t) (_rout), (_arg) ); \
#define pthread_cleanup_pop( _execute ) \
- (void) ptw32_pop_cleanup( _execute ); \
- }
+ (void) ptw32_pop_cleanup( _execute ); \
+ }
#else /* __CLEANUP_C */
#ifdef __CLEANUP_CXX
- /*
- * C++ version of cancel cleanup.
- * - John E. Bossom.
- */
+ /*
+ * C++ version of cancel cleanup.
+ * - John E. Bossom.
+ */
- class PThreadCleanup {
- /*
- * PThreadCleanup
- *
- * Purpose
- * This class is a C++ helper class that is
- * used to implement pthread_cleanup_push/
- * pthread_cleanup_pop.
- * The destructor of this class automatically
- * pops the pushed cleanup routine regardless
- * of how the code exits the scope
- * (i.e. such as by an exception)
- */
+ class PThreadCleanup {
+ /*
+ * PThreadCleanup
+ *
+ * Purpose
+ * This class is a C++ helper class that is
+ * used to implement pthread_cleanup_push/
+ * pthread_cleanup_pop.
+ * The destructor of this class automatically
+ * pops the pushed cleanup routine regardless
+ * of how the code exits the scope
+ * (i.e. such as by an exception)
+ */
ptw32_cleanup_callback_t cleanUpRout;
- void * obj;
- int executeIt;
+ void * obj;
+ int executeIt;
- public:
- PThreadCleanup() :
- cleanUpRout( NULL ),
- obj( NULL ),
- executeIt( 0 )
- /*
- * No cleanup performed
- */
- {
- }
+ public:
+ PThreadCleanup() :
+ cleanUpRout( NULL ),
+ obj( NULL ),
+ executeIt( 0 )
+ /*
+ * No cleanup performed
+ */
+ {
+ }
- PThreadCleanup(
+ PThreadCleanup(
ptw32_cleanup_callback_t routine,
- void * arg ) :
- cleanUpRout( routine ),
- obj( arg ),
- executeIt( 1 )
- /*
+ void * arg ) :
+ cleanUpRout( routine ),
+ obj( arg ),
+ executeIt( 1 )
+ /*
* Registers a cleanup routine for 'arg'
*/
- {
- }
+ {
+ }
- ~PThreadCleanup()
- {
- if ( executeIt && ((void *) cleanUpRout != NULL) )
- {
+ ~PThreadCleanup()
+ {
+ if ( executeIt && ((void *) cleanUpRout != NULL) )
+ {
(void) (*cleanUpRout)( obj );
- }
- }
+ }
+ }
- void execute( int exec )
- {
- executeIt = exec;
- }
- };
+ void execute( int exec )
+ {
+ executeIt = exec;
+ }
+ };
- /*
- * C++ implementation of PThreads cancel cleanup;
- * This implementation takes advantage of a helper
- * class who's destructor automatically calls the
- * cleanup routine if we exit our scope weirdly
- */
+ /*
+ * C++ implementation of PThreads cancel cleanup;
+ * This implementation takes advantage of a helper
+ * class who's destructor automatically calls the
+ * cleanup routine if we exit our scope weirdly
+ */
#define pthread_cleanup_push( _rout, _arg ) \
{ \
- PThreadCleanup cleanup((ptw32_cleanup_callback_t)(_rout), \
- (void *) (_arg) );
+ PThreadCleanup cleanup((ptw32_cleanup_callback_t)(_rout), \
+ (void *) (_arg) );
#define pthread_cleanup_pop( _execute ) \
- cleanup.execute( _execute ); \
- }
+ cleanup.execute( _execute ); \
+ }
#else
@@ -668,22 +668,22 @@ int pthread_attr_init (pthread_attr_t *
int pthread_attr_destroy (pthread_attr_t * attr);
int pthread_attr_getdetachstate (const pthread_attr_t * attr,
- int *detachstate);
+ int *detachstate);
int pthread_attr_getstackaddr (const pthread_attr_t * attr,
- void **stackaddr);
+ void **stackaddr);
int pthread_attr_getstacksize (const pthread_attr_t * attr,
- size_t * stacksize);
+ size_t * stacksize);
int pthread_attr_setdetachstate (pthread_attr_t * attr,
- int detachstate);
+ int detachstate);
int pthread_attr_setstackaddr (pthread_attr_t * attr,
- void *stackaddr);
+ void *stackaddr);
int pthread_attr_setstacksize (pthread_attr_t * attr,
- size_t stacksize);
+ size_t stacksize);
int pthread_attr_getschedparam (const pthread_attr_t *attr,
struct sched_param *param);
@@ -713,51 +713,51 @@ int pthread_attr_getscope (const pthread
* PThread Functions
*/
int pthread_create (pthread_t * tid,
- const pthread_attr_t * attr,
- void *(*start) (void *),
- void *arg);
+ const pthread_attr_t * attr,
+ void *(*start) (void *),
+ void *arg);
int pthread_detach (pthread_t tid);
int pthread_equal (pthread_t t1,
- pthread_t t2);
+ pthread_t t2);
void pthread_exit (void *value_ptr);
int pthread_join (pthread_t thread,
- void **value_ptr);
+ void **value_ptr);
pthread_t pthread_self (void);
int pthread_cancel (pthread_t thread);
int pthread_setcancelstate (int state,
- int *oldstate);
+ int *oldstate);
int pthread_setcanceltype (int type,
- int *oldtype);
+ int *oldtype);
void pthread_testcancel (void);
int pthread_once (pthread_once_t * once_control,
- void (*init_routine) (void));
+ void (*init_routine) (void));
ptw32_cleanup_t *ptw32_pop_cleanup (int execute);
void ptw32_push_cleanup (ptw32_cleanup_t * cleanup,
- void (*routine) (void *),
- void *arg);
+ void (*routine) (void *),
+ void *arg);
/*
* Thread Specific Data Functions
*/
int pthread_key_create (pthread_key_t * key,
- void (*destructor) (void *));
+ void (*destructor) (void *));
int pthread_key_delete (pthread_key_t key);
int pthread_setspecific (pthread_key_t key,
- const void *value);
+ const void *value);
void *pthread_getspecific (pthread_key_t key);
@@ -770,11 +770,11 @@ int pthread_mutexattr_init (pthread_mute
int pthread_mutexattr_destroy (pthread_mutexattr_t * attr);
int pthread_mutexattr_getpshared (const pthread_mutexattr_t
- * attr,
- int *pshared);
+ * attr,
+ int *pshared);
int pthread_mutexattr_setpshared (pthread_mutexattr_t * attr,
- int pshared);
+ int pshared);
int pthread_mutexattr_settype (pthread_mutexattr_t * attr, int kind);
int pthread_mutexattr_gettype (pthread_mutexattr_t * attr, int *kind);
@@ -787,17 +787,17 @@ int pthread_barrierattr_init (pthread_ba
int pthread_barrierattr_destroy (pthread_barrierattr_t * attr);
int pthread_barrierattr_getpshared (const pthread_barrierattr_t
- * attr,
- int *pshared);
+ * attr,
+ int *pshared);
int pthread_barrierattr_setpshared (pthread_barrierattr_t * attr,
- int pshared);
+ int pshared);
/*
* Mutex Functions
*/
int pthread_mutex_init (pthread_mutex_t * mutex,
- const pthread_mutexattr_t * attr);
+ const pthread_mutexattr_t * attr);
int pthread_mutex_destroy (pthread_mutex_t * mutex);
@@ -824,7 +824,7 @@ int pthread_spin_unlock (pthread_spinloc
* Barrier Functions
*/
int pthread_barrier_init (pthread_barrier_t * barrier,
- const pthread_barrierattr_t * attr,
+ const pthread_barrierattr_t * attr,
unsigned int count);
int pthread_barrier_destroy (pthread_barrier_t * barrier);
@@ -839,25 +839,25 @@ int pthread_condattr_init (pthread_conda
int pthread_condattr_destroy (pthread_condattr_t * attr);
int pthread_condattr_getpshared (const pthread_condattr_t * attr,
- int *pshared);
+ int *pshared);
int pthread_condattr_setpshared (pthread_condattr_t * attr,
- int pshared);
+ int pshared);
/*
* Condition Variable Functions
*/
int pthread_cond_init (pthread_cond_t * cond,
- const pthread_condattr_t * attr);
+ const pthread_condattr_t * attr);
int pthread_cond_destroy (pthread_cond_t * cond);
int pthread_cond_wait (pthread_cond_t * cond,
- pthread_mutex_t * mutex);
+ pthread_mutex_t * mutex);
int pthread_cond_timedwait (pthread_cond_t * cond,
- pthread_mutex_t * mutex,
- const struct timespec *abstime);
+ pthread_mutex_t * mutex,
+ const struct timespec *abstime);
int pthread_cond_signal (pthread_cond_t * cond);
@@ -867,12 +867,12 @@ int pthread_cond_broadcast (pthread_cond
* Scheduling
*/
int pthread_setschedparam (pthread_t thread,
- int policy,
- const struct sched_param *param);
+ int policy,
+ const struct sched_param *param);
int pthread_getschedparam (pthread_t thread,
- int *policy,
- struct sched_param *param);
+ int *policy,
+ struct sched_param *param);
int pthread_setconcurrency (int);
@@ -980,27 +980,27 @@ int * _errno( void );
#if !defined(__MINGW32__)
#define strtok_r( _s, _sep, _lasts ) \
- ( *(_lasts) = strtok( (_s), (_sep) ) )
+ ( *(_lasts) = strtok( (_s), (_sep) ) )
#endif /* !__MINGW32__ */
#define asctime_r( _tm, _buf ) \
- ( strcpy( (_buf), asctime( (_tm) ) ), \
- (_buf) )
+ ( strcpy( (_buf), asctime( (_tm) ) ), \
+ (_buf) )
#define ctime_r( _clock, _buf ) \
- ( strcpy( (_buf), ctime( (_clock) ) ), \
+ ( strcpy( (_buf), ctime( (_clock) ) ), \
(_buf) )
#define gmtime_r( _clock, _result ) \
- ( *(_result) = *gmtime( (_clock) ), \
- (_result) )
+ ( *(_result) = *gmtime( (_clock) ), \
+ (_result) )
#define localtime_r( _clock, _result ) \
- ( *(_result) = *localtime( (_clock) ), \
- (_result) )
+ ( *(_result) = *localtime( (_clock) ), \
+ (_result) )
#define rand_r( _seed ) \
- ( _seed == _seed? rand() : rand() )
+ ( _seed == _seed? rand() : rand() )
#ifdef __cplusplus
@@ -1030,7 +1030,7 @@ DWORD ptw32_get_exception_services_code(
*/
#define __except( E ) \
__except( ( GetExceptionCode() == ptw32_get_exception_services_code() ) \
- ? EXCEPTION_CONTINUE_SEARCH : ( E ) )
+ ? EXCEPTION_CONTINUE_SEARCH : ( E ) )
#endif /* __CLEANUP_SEH */
@@ -1071,7 +1071,7 @@ DWORD ptw32_get_exception_services_code(
#endif /* ! PTW32_BUILD */
#ifdef __cplusplus
-} /* End of extern "C" */
-#endif /* __cplusplus */
+} /* End of extern "C" */
+#endif /* __cplusplus */
#endif /* PTHREAD_H */
Modified: trunk/libdvdread/msvc/include/sys/time.h
==============================================================================
--- trunk/libdvdread/msvc/include/sys/time.h (original)
+++ trunk/libdvdread/msvc/include/sys/time.h Tue Sep 23 11:14:45 2008
@@ -22,7 +22,7 @@
*
* sys/time.h - There is no seperate sys/time.h for win32 so we simply
* include the standard time header as well as our xine
- * timer functions.
+ * timer functions.
*/
#include <time.h>
Modified: trunk/libdvdread/msvc/include/timer.h
==============================================================================
--- trunk/libdvdread/msvc/include/timer.h (original)
+++ trunk/libdvdread/msvc/include/timer.h Tue Sep 23 11:14:45 2008
@@ -5,23 +5,23 @@
#ifndef _ITIMER_
#define _ITIMER_
-#define ITIMER_REAL 0
-#define ITIMER_VIRTUAL 1
+#define ITIMER_REAL 0
+#define ITIMER_VIRTUAL 1
-// time reference
-// ----------------------------------
+// time reference
+// ----------------------------------
//
-// 1,000 milliseconds / sec
-// 1,000,000 microseconds / sec
-// 1,000,000,000 nanoseconds / sec
+// 1,000 milliseconds / sec
+// 1,000,000 microseconds / sec
+// 1,000,000,000 nanoseconds / sec
//
// timeval.time_sec = seconds
// timeval.time_usec = microseconds
struct itimerval
{
- struct timeval it_interval; /* timer interval */
- struct timeval it_value; /* current value */
+ struct timeval it_interval; /* timer interval */
+ struct timeval it_value; /* current value */
};
struct timezone {
@@ -36,4 +36,4 @@ int pause( void );
unsigned int sleep( unsigned int seconds );
int nanosleep( const struct timespec *rqtp, struct timespec *rmtp );
-#endif
\ No newline at end of file
+#endif
Modified: trunk/libdvdread/msvc/include/unistd.h
==============================================================================
--- trunk/libdvdread/msvc/include/unistd.h (original)
+++ trunk/libdvdread/msvc/include/unistd.h Tue Sep 23 11:14:45 2008
@@ -37,18 +37,18 @@
#define inline __inline
-#define mkdir( A, B ) _mkdir( A )
-#define lstat stat
+#define mkdir( A, B ) _mkdir( A )
+#define lstat stat
#ifndef S_ISDIR
-#define S_ISDIR(A) ( S_IFDIR & A )
+#define S_ISDIR(A) ( S_IFDIR & A )
#endif
-#define S_IXUSR S_IEXEC
-#define S_IXGRP S_IEXEC
-#define S_IXOTH S_IEXEC
+#define S_IXUSR S_IEXEC
+#define S_IXGRP S_IEXEC
+#define S_IXOTH S_IEXEC
-#define M_PI 3.14159265358979323846 /* pi */
+#define M_PI 3.14159265358979323846 /* pi */
#define bzero( A, B ) memset( A, 0, B )
Modified: trunk/libdvdread/src/dvd_input.c
==============================================================================
--- trunk/libdvdread/src/dvd_input.c (original)
+++ trunk/libdvdread/src/dvd_input.c Tue Sep 23 11:14:45 2008
@@ -316,15 +316,15 @@ int dvdinput_setup(void)
if(dlsym(dvdcss_library, U_S "dvdcss_crack")) {
fprintf(stderr,
- "libdvdread: Old (pre-0.0.2) version of libdvdcss found.\n"
- "libdvdread: You should get the latest version from "
- "http://www.videolan.org/\n" );
+ "libdvdread: Old (pre-0.0.2) version of libdvdcss found.\n"
+ "libdvdread: You should get the latest version from "
+ "http://www.videolan.org/\n" );
dlclose(dvdcss_library);
dvdcss_library = NULL;
} else if(!DVDcss_open || !DVDcss_close || !DVDcss_title || !DVDcss_seek
- || !DVDcss_read || !DVDcss_error || !dvdcss_version) {
+ || !DVDcss_read || !DVDcss_error || !dvdcss_version) {
fprintf(stderr, "libdvdread: Missing symbols in %s, "
- "this shouldn't happen !\n", CSS_LIB);
+ "this shouldn't happen !\n", CSS_LIB);
dlclose(dvdcss_library);
}
}
@@ -338,7 +338,7 @@ int dvdinput_setup(void)
fprintf(stderr, "DVDCSS_VERBOSE %s\n", psz_verbose);
*/
fprintf(stderr, "libdvdread: Using libdvdcss version %s for DVD access\n",
- dvdcss_version ? *dvdcss_version : "");
+ dvdcss_version ? *dvdcss_version : "");
/* libdvdcss wrapper functions */
dvdinput_open = css_open;
Modified: trunk/libdvdread/src/dvd_reader.c
==============================================================================
--- trunk/libdvdread/src/dvd_reader.c (original)
+++ trunk/libdvdread/src/dvd_reader.c Tue Sep 23 11:14:45 2008
@@ -169,53 +169,53 @@ static int initAllCSSKeys( dvd_reader_t
fprintf( stderr, "\n" );
fprintf( stderr, "libdvdread: Attempting to retrieve all CSS keys\n" );
fprintf( stderr, "libdvdread: This can take a _long_ time, "
- "please be patient\n\n" );
+ "please be patient\n\n" );
gettimeofday(&all_s, NULL);
for( title = 0; title < 100; title++ ) {
- gettimeofday( &t_s, NULL );
- if( title == 0 ) {
- sprintf( filename, "/VIDEO_TS/VIDEO_TS.VOB" );
- } else {
- sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, 0 );
- }
- start = UDFFindFile( dvd, filename, &len );
- if( start != 0 && len != 0 ) {
- /* Perform CSS key cracking for this title. */
- fprintf( stderr, "libdvdread: Get key for %s at 0x%08x\n",
- filename, start );
- if( dvdinput_title( dvd->dev, (int)start ) < 0 ) {
- fprintf( stderr, "libdvdread: Error cracking CSS key for %s (0x%08x)\n", filename, start);
- }
- gettimeofday( &t_e, NULL );
- fprintf( stderr, "libdvdread: Elapsed time %ld\n",
- (long int) t_e.tv_sec - t_s.tv_sec );
- }
+ gettimeofday( &t_s, NULL );
+ if( title == 0 ) {
+ sprintf( filename, "/VIDEO_TS/VIDEO_TS.VOB" );
+ } else {
+ sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, 0 );
+ }
+ start = UDFFindFile( dvd, filename, &len );
+ if( start != 0 && len != 0 ) {
+ /* Perform CSS key cracking for this title. */
+ fprintf( stderr, "libdvdread: Get key for %s at 0x%08x\n",
+ filename, start );
+ if( dvdinput_title( dvd->dev, (int)start ) < 0 ) {
+ fprintf( stderr, "libdvdread: Error cracking CSS key for %s (0x%08x)\n", filename, start);
+ }
+ gettimeofday( &t_e, NULL );
+ fprintf( stderr, "libdvdread: Elapsed time %ld\n",
+ (long int) t_e.tv_sec - t_s.tv_sec );
+ }
- if( title == 0 ) continue;
+ if( title == 0 ) continue;
- gettimeofday( &t_s, NULL );
- sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, 1 );
- start = UDFFindFile( dvd, filename, &len );
- if( start == 0 || len == 0 ) break;
+ gettimeofday( &t_s, NULL );
+ sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, 1 );
+ start = UDFFindFile( dvd, filename, &len );
+ if( start == 0 || len == 0 ) break;
- /* Perform CSS key cracking for this title. */
- fprintf( stderr, "libdvdread: Get key for %s at 0x%08x\n",
- filename, start );
- if( dvdinput_title( dvd->dev, (int)start ) < 0 ) {
- fprintf( stderr, "libdvdread: Error cracking CSS key for %s (0x%08x)!!\n", filename, start);
- }
- gettimeofday( &t_e, NULL );
- fprintf( stderr, "libdvdread: Elapsed time %ld\n",
- (long int) t_e.tv_sec - t_s.tv_sec );
+ /* Perform CSS key cracking for this title. */
+ fprintf( stderr, "libdvdread: Get key for %s at 0x%08x\n",
+ filename, start );
+ if( dvdinput_title( dvd->dev, (int)start ) < 0 ) {
+ fprintf( stderr, "libdvdread: Error cracking CSS key for %s (0x%08x)!!\n", filename, start);
+ }
+ gettimeofday( &t_e, NULL );
+ fprintf( stderr, "libdvdread: Elapsed time %ld\n",
+ (long int) t_e.tv_sec - t_s.tv_sec );
}
title--;
fprintf( stderr, "libdvdread: Found %d VTS's\n", title );
gettimeofday(&all_e, NULL);
fprintf( stderr, "libdvdread: Elapsed time %ld\n",
- (long int) all_e.tv_sec - all_s.tv_sec );
+ (long int) all_e.tv_sec - all_s.tv_sec );
return 0;
}
@@ -232,8 +232,8 @@ static dvd_reader_t *DVDOpenImageFile( c
dev = dvdinput_open( location );
if( !dev ) {
- fprintf( stderr, "libdvdread: Can't open %s for reading\n", location );
- return NULL;
+ fprintf( stderr, "libdvdread: Can't open %s for reading\n", location );
+ return NULL;
}
dvd = (dvd_reader_t *) malloc( sizeof( dvd_reader_t ) );
@@ -333,18 +333,18 @@ dvd_reader_t *DVDOpen( const char *ppath
struct stat fileinfo;
int ret;
int have_css;
- dvd_reader_t *ret_val = NULL;
+ dvd_reader_t *ret_val = NULL;
char *dev_name = NULL;
- char *path;
+ char *path;
#ifdef _MSC_VER
- int len;
+ int len;
#endif
if( ppath == NULL )
return 0;
- path = strdup(ppath);
+ path = strdup(ppath);
if( path == NULL )
return 0;
@@ -352,14 +352,14 @@ dvd_reader_t *DVDOpen( const char *ppath
have_css = dvdinput_setup();
#ifdef _MSC_VER
- /* Strip off the trailing \ if it is not a drive */
- len = strlen(path);
- if ((len > 1) &&
- (path[len - 1] == '\\') &&
- (path[len - 2] != ':'))
- {
- path[len-1] = '\0';
- }
+ /* Strip off the trailing \ if it is not a drive */
+ len = strlen(path);
+ if ((len > 1) &&
+ (path[len - 1] == '\\') &&
+ (path[len - 2] != ':'))
+ {
+ path[len-1] = '\0';
+ }
#endif
ret = stat( path, &fileinfo );
@@ -368,127 +368,127 @@ dvd_reader_t *DVDOpen( const char *ppath
/* maybe "host:port" url? try opening it with acCeSS library */
if( strchr(path,':') ) {
- ret_val = DVDOpenImageFile( path, have_css );
- free(path);
- return ret_val;
+ ret_val = DVDOpenImageFile( path, have_css );
+ free(path);
+ return ret_val;
}
- /* If we can't stat the file, give up */
- fprintf( stderr, "libdvdread: Can't stat %s\n", path );
- perror("");
- free(path);
- return NULL;
+ /* If we can't stat the file, give up */
+ fprintf( stderr, "libdvdread: Can't stat %s\n", path );
+ perror("");
+ free(path);
+ return NULL;
}
/* First check if this is a block/char device or a file*/
if( S_ISBLK( fileinfo.st_mode ) ||
- S_ISCHR( fileinfo.st_mode ) ||
- S_ISREG( fileinfo.st_mode ) ) {
+ S_ISCHR( fileinfo.st_mode ) ||
+ S_ISREG( fileinfo.st_mode ) ) {
- /**
- * Block devices and regular files are assumed to be DVD-Video images.
- */
+ /**
+ * Block devices and regular files are assumed to be DVD-Video images.
+ */
#if defined(__sun)
- ret_val = DVDOpenImageFile( sun_block2char( path ), have_css );
+ ret_val = DVDOpenImageFile( sun_block2char( path ), have_css );
#elif defined(SYS_BSD)
- ret_val = DVDOpenImageFile( bsd_block2char( path ), have_css );
+ ret_val = DVDOpenImageFile( bsd_block2char( path ), have_css );
#else
- ret_val = DVDOpenImageFile( path, have_css );
+ ret_val = DVDOpenImageFile( path, have_css );
#endif
- free(path);
- return ret_val;
+ free(path);
+ return ret_val;
} else if( S_ISDIR( fileinfo.st_mode ) ) {
- dvd_reader_t *auth_drive = 0;
- char *path_copy;
+ dvd_reader_t *auth_drive = 0;
+ char *path_copy;
#if defined(SYS_BSD)
- struct fstab* fe;
+ struct fstab* fe;
#elif defined(__sun) || defined(__linux__)
- FILE *mntfile;
+ FILE *mntfile;
#endif
- /* XXX: We should scream real loud here. */
- if( !(path_copy = strdup( path ) ) ) {
- free(path);
- return NULL;
- }
+ /* XXX: We should scream real loud here. */
+ if( !(path_copy = strdup( path ) ) ) {
+ free(path);
+ return NULL;
+ }
#ifndef WIN32 /* don't have fchdir, and getcwd( NULL, ... ) is strange */
/* Also WIN32 does not have symlinks, so we don't need this bit of code. */
- /* Resolve any symlinks and get the absolut dir name. */
- {
- char *new_path;
- int cdir = open( ".", O_RDONLY );
+ /* Resolve any symlinks and get the absolut dir name. */
+ {
+ char *new_path;
+ int cdir = open( ".", O_RDONLY );
- if( cdir >= 0 ) {
- chdir( path_copy );
- new_path = malloc(PATH_MAX+1);
- if(!new_path) {
- free(path);
- return NULL;
- }
- getcwd(new_path, PATH_MAX );
- fchdir( cdir );
- close( cdir );
- free( path_copy );
- path_copy = new_path;
- }
- }
+ if( cdir >= 0 ) {
+ chdir( path_copy );
+ new_path = malloc(PATH_MAX+1);
+ if(!new_path) {
+ free(path);
+ return NULL;
+ }
+ getcwd(new_path, PATH_MAX );
+ fchdir( cdir );
+ close( cdir );
+ free( path_copy );
+ path_copy = new_path;
+ }
+ }
#endif
- /**
- * If we're being asked to open a directory, check if that directory
- * is the mountpoint for a DVD-ROM which we can use instead.
- */
+ /**
+ * If we're being asked to open a directory, check if that directory
+ * is the mountpoint for a DVD-ROM which we can use instead.
+ */
- if( strlen( path_copy ) > 1 ) {
- if( path_copy[ strlen( path_copy ) - 1 ] == '/' )
- path_copy[ strlen( path_copy ) - 1 ] = '\0';
- }
+ if( strlen( path_copy ) > 1 ) {
+ if( path_copy[ strlen( path_copy ) - 1 ] == '/' )
+ path_copy[ strlen( path_copy ) - 1 ] = '\0';
+ }
- if( strlen( path_copy ) > TITLES_MAX ) {
- if( !strcasecmp( &(path_copy[ strlen( path_copy ) - TITLES_MAX ]),
- "/video_ts" ) ) {
- path_copy[ strlen( path_copy ) - TITLES_MAX ] = '\0';
- }
- }
+ if( strlen( path_copy ) > TITLES_MAX ) {
+ if( !strcasecmp( &(path_copy[ strlen( path_copy ) - TITLES_MAX ]),
+ "/video_ts" ) ) {
+ path_copy[ strlen( path_copy ) - TITLES_MAX ] = '\0';
+ }
+ }
- if(path_copy[0] == '\0') {
- path_copy[0] = '/';
- path_copy[1] = '\0';
- }
+ if(path_copy[0] == '\0') {
+ path_copy[0] = '/';
+ path_copy[1] = '\0';
+ }
#if defined(SYS_BSD)
- if( ( fe = getfsfile( path_copy ) ) ) {
- dev_name = bsd_block2char( fe->fs_spec );
- fprintf( stderr,
- "libdvdread: Attempting to use device %s"
- " mounted on %s for CSS authentication\n",
- dev_name,
- fe->fs_file );
- auth_drive = DVDOpenImageFile( dev_name, have_css );
- }
+ if( ( fe = getfsfile( path_copy ) ) ) {
+ dev_name = bsd_block2char( fe->fs_spec );
+ fprintf( stderr,
+ "libdvdread: Attempting to use device %s"
+ " mounted on %s for CSS authentication\n",
+ dev_name,
+ fe->fs_file );
+ auth_drive = DVDOpenImageFile( dev_name, have_css );
+ }
#elif defined(__sun)
- mntfile = fopen( MNTTAB, "r" );
- if( mntfile ) {
- struct mnttab mp;
- int res;
+ mntfile = fopen( MNTTAB, "r" );
+ if( mntfile ) {
+ struct mnttab mp;
+ int res;
- while( ( res = getmntent( mntfile, &mp ) ) != -1 ) {
- if( res == 0 && !strcmp( mp.mnt_mountp, path_copy ) ) {
- dev_name = sun_block2char( mp.mnt_special );
- fprintf( stderr,
- "libdvdread: Attempting to use device %s"
- " mounted on %s for CSS authentication\n",
- dev_name,
- mp.mnt_mountp );
- auth_drive = DVDOpenImageFile( dev_name, have_css );
- break;
- }
- }
- fclose( mntfile );
- }
+ while( ( res = getmntent( mntfile, &mp ) ) != -1 ) {
+ if( res == 0 && !strcmp( mp.mnt_mountp, path_copy ) ) {
+ dev_name = sun_block2char( mp.mnt_special );
+ fprintf( stderr,
+ "libdvdread: Attempting to use device %s"
+ " mounted on %s for CSS authentication\n",
+ dev_name,
+ mp.mnt_mountp );
+ auth_drive = DVDOpenImageFile( dev_name, have_css );
+ break;
+ }
+ }
+ fclose( mntfile );
+ }
#elif defined(__linux__)
mntfile = fopen( MOUNTED, "r" );
if( mntfile ) {
@@ -496,58 +496,58 @@ dvd_reader_t *DVDOpen( const char *ppath
while( ( me = getmntent( mntfile ) ) ) {
if( !strcmp( me->mnt_dir, path_copy ) ) {
- fprintf( stderr,
- "libdvdread: Attempting to use device %s"
- " mounted on %s for CSS authentication\n",
- me->mnt_fsname,
- me->mnt_dir );
+ fprintf( stderr,
+ "libdvdread: Attempting to use device %s"
+ " mounted on %s for CSS authentication\n",
+ me->mnt_fsname,
+ me->mnt_dir );
auth_drive = DVDOpenImageFile( me->mnt_fsname, have_css );
- dev_name = strdup(me->mnt_fsname);
+ dev_name = strdup(me->mnt_fsname);
break;
}
}
fclose( mntfile );
- }
+ }
#elif defined(_MSC_VER)
auth_drive = DVDOpenImageFile( path, have_css );
#endif
#ifndef _MSC_VER
- if( !dev_name ) {
- fprintf( stderr, "libdvdread: Couldn't find device name.\n" );
- } else if( !auth_drive ) {
- fprintf( stderr, "libdvdread: Device %s inaccessible, "
- "CSS authentication not available.\n", dev_name );
- }
+ if( !dev_name ) {
+ fprintf( stderr, "libdvdread: Couldn't find device name.\n" );
+ } else if( !auth_drive ) {
+ fprintf( stderr, "libdvdread: Device %s inaccessible, "
+ "CSS authentication not available.\n", dev_name );
+ }
#else
- if( !auth_drive ) {
- fprintf( stderr, "libdvdread: Device %s inaccessible, "
- "CSS authentication not available.\n", dev_name );
- }
+ if( !auth_drive ) {
+ fprintf( stderr, "libdvdread: Device %s inaccessible, "
+ "CSS authentication not available.\n", dev_name );
+ }
#endif
- free( dev_name );
- free( path_copy );
+ free( dev_name );
+ free( path_copy );
/**
* If we've opened a drive, just use that.
*/
- if( auth_drive ) {
- free(path);
- return auth_drive;
- }
+ if( auth_drive ) {
+ free(path);
+ return auth_drive;
+ }
/**
* Otherwise, we now try to open the directory tree instead.
*/
ret_val = DVDOpenPath( path );
- free( path );
- return ret_val;
+ free( path );
+ return ret_val;
}
/* If it's none of the above, screw it. */
fprintf( stderr, "libdvdread: Could not open %s\n", path );
- free( path );
+ free( path );
return NULL;
}
@@ -556,7 +556,7 @@ void DVDClose( dvd_reader_t *dvd )
if( dvd ) {
if( dvd->dev ) dvdinput_close( dvd->dev );
if( dvd->path_root ) free( dvd->path_root );
- if( dvd->udfcache ) FreeUDFCache( dvd->udfcache );
+ if( dvd->udfcache ) FreeUDFCache( dvd->udfcache );
free( dvd );
}
}
@@ -733,12 +733,12 @@ static dvd_file_t *DVDOpenVOBUDF( dvd_re
if( dvd->css_state == 1 /* Need key init */ ) {
initAllCSSKeys( dvd );
- dvd->css_state = 2;
+ dvd->css_state = 2;
}
/*
if( dvdinput_title( dvd_file->dvd->dev, (int)start ) < 0 ) {
fprintf( stderr, "libdvdread: Error cracking CSS key for %s\n",
- filename );
+ filename );
}
*/
@@ -790,7 +790,7 @@ static dvd_file_t *DVDOpenVOBPath( dvd_r
}
dvd_file->title_sizes[ 0 ] = fileinfo.st_size / DVD_VIDEO_LB_LEN;
dvd_file->title_devs[ 0 ] = dev;
- dvdinput_title( dvd_file->title_devs[0], 0);
+ dvdinput_title( dvd_file->title_devs[0], 0);
dvd_file->filesize = dvd_file->title_sizes[ 0 ];
} else {
@@ -808,7 +808,7 @@ static dvd_file_t *DVDOpenVOBPath( dvd_r
dvd_file->title_sizes[ i ] = fileinfo.st_size / DVD_VIDEO_LB_LEN;
dvd_file->title_devs[ i ] = dvdinput_open( full_path );
- dvdinput_title( dvd_file->title_devs[ i ], 0 );
+ dvdinput_title( dvd_file->title_devs[ i ], 0 );
dvd_file->filesize += dvd_file->title_sizes[ i ];
}
if( !dvd_file->title_devs[ 0 ] ) {
@@ -821,7 +821,7 @@ static dvd_file_t *DVDOpenVOBPath( dvd_r
}
dvd_file_t *DVDOpenFile( dvd_reader_t *dvd, int titlenum,
- dvd_read_domain_t domain )
+ dvd_read_domain_t domain )
{
char filename[ MAX_UDF_FILE_NAME_LEN ];
@@ -877,8 +877,8 @@ void DVDCloseFile( dvd_file_t *dvd_file
if( dvd_file ) {
if( dvd_file->dvd->isImageFile ) {
- ;
- } else {
+ ;
+ } else {
for( i = 0; i < TITLES_MAX; ++i ) {
if( dvd_file->title_devs[ i ] ) {
dvdinput_close( dvd_file->title_devs[i] );
@@ -893,23 +893,23 @@ void DVDCloseFile( dvd_file_t *dvd_file
/* Internal, but used from dvd_udf.c */
int UDFReadBlocksRaw( dvd_reader_t *device, uint32_t lb_number,
- size_t block_count, unsigned char *data,
- int encrypted )
+ size_t block_count, unsigned char *data,
+ int encrypted )
{
int ret;
if( !device->dev ) {
- fprintf( stderr, "libdvdread: Fatal error in block read.\n" );
- return 0;
+ fprintf( stderr, "libdvdread: Fatal error in block read.\n" );
+ return 0;
}
ret = dvdinput_seek( device->dev, (int) lb_number );
if( ret != (int) lb_number ) {
- fprintf( stderr, "libdvdread: Can't seek to block %u\n", lb_number );
- return 0;
+ fprintf( stderr, "libdvdread: Can't seek to block %u\n", lb_number );
+ return 0;
}
ret = dvdinput_read( device->dev, (char *) data,
- (int) block_count, encrypted );
+ (int) block_count, encrypted );
return ret;
}
@@ -920,11 +920,11 @@ int UDFReadBlocksRaw( dvd_reader_t *devi
* descramble the data if it's encrypted. Returning either an
* negative error or the number of blocks read. */
static int DVDReadBlocksUDF( dvd_file_t *dvd_file, uint32_t offset,
- size_t block_count, unsigned char *data,
- int encrypted )
+ size_t block_count, unsigned char *data,
+ int encrypted )
{
return UDFReadBlocksRaw( dvd_file->dvd, dvd_file->lb_start + offset,
- block_count, data, encrypted );
+ block_count, data, encrypted );
}
/* This is using possibly several inputs and starting from an offset of '0'.
@@ -934,8 +934,8 @@ static int DVDReadBlocksUDF( dvd_file_t
* descramble the data if it's encrypted. Returning either an
* negative error or the number of blocks read. */
static int DVDReadBlocksPath( dvd_file_t *dvd_file, unsigned int offset,
- size_t block_count, unsigned char *data,
- int encrypted )
+ size_t block_count, unsigned char *data,
+ int encrypted )
{
int i;
int ret, ret2, off;
@@ -947,51 +947,51 @@ static int DVDReadBlocksPath( dvd_file_t
if( offset < dvd_file->title_sizes[ i ] ) {
if( ( offset + block_count ) <= dvd_file->title_sizes[ i ] ) {
- off = dvdinput_seek( dvd_file->title_devs[ i ], (int)offset );
+ off = dvdinput_seek( dvd_file->title_devs[ i ], (int)offset );
if( off < 0 || off != (int)offset ) {
- fprintf( stderr, "libdvdread: Can't seek to block %d\n",
- offset );
- return off < 0 ? off : 0;
- }
+ fprintf( stderr, "libdvdread: Can't seek to block %d\n",
+ offset );
+ return off < 0 ? off : 0;
+ }
ret = dvdinput_read( dvd_file->title_devs[ i ], data,
- (int)block_count, encrypted );
+ (int)block_count, encrypted );
break;
} else {
size_t part1_size = dvd_file->title_sizes[ i ] - offset;
- /* FIXME: Really needs to be a while loop.
+ /* FIXME: Really needs to be a while loop.
* (This is only true if you try and read >1GB at a time) */
/* Read part 1 */
off = dvdinput_seek( dvd_file->title_devs[ i ], (int)offset );
if( off < 0 || off != (int)offset ) {
- fprintf( stderr, "libdvdread: Can't seek to block %d\n",
- offset );
- return off < 0 ? off : 0;
- }
+ fprintf( stderr, "libdvdread: Can't seek to block %d\n",
+ offset );
+ return off < 0 ? off : 0;
+ }
ret = dvdinput_read( dvd_file->title_devs[ i ], data,
- (int)part1_size, encrypted );
- if( ret < 0 ) return ret;
- /* FIXME: This is wrong if i is the last file in the set.
+ (int)part1_size, encrypted );
+ if( ret < 0 ) return ret;
+ /* FIXME: This is wrong if i is the last file in the set.
* also error from this read will not show in ret. */
- /* Does the next part exist? If not then return now. */
- if( i + 1 >= TITLES_MAX || !dvd_file->title_devs[ i + 1 ] )
+ /* Does the next part exist? If not then return now. */
+ if( i + 1 >= TITLES_MAX || !dvd_file->title_devs[ i + 1 ] )
return ret;
/* Read part 2 */
off = dvdinput_seek( dvd_file->title_devs[ i + 1 ], 0 );
if( off < 0 || off != 0 ) {
- fprintf( stderr, "libdvdread: Can't seek to block %d\n",
- 0 );
- return off < 0 ? off : 0;
- }
+ fprintf( stderr, "libdvdread: Can't seek to block %d\n",
+ 0 );
+ return off < 0 ? off : 0;
+ }
ret2 = dvdinput_read( dvd_file->title_devs[ i + 1 ],
- data + ( part1_size
- * (int64_t)DVD_VIDEO_LB_LEN ),
- (int)(block_count - part1_size),
- encrypted );
+ data + ( part1_size
+ * (int64_t)DVD_VIDEO_LB_LEN ),
+ (int)(block_count - part1_size),
+ encrypted );
if( ret2 < 0 ) return ret2;
- break;
+ break;
}
} else {
offset -= dvd_file->title_sizes[ i ];
@@ -1003,7 +1003,7 @@ static int DVDReadBlocksPath( dvd_file_t
/* This is broken reading more than 2Gb at a time is ssize_t is 32-bit. */
ssize_t DVDReadBlocks( dvd_file_t *dvd_file, int offset,
- size_t block_count, unsigned char *data )
+ size_t block_count, unsigned char *data )
{
int ret;
/* Check arguments. */
@@ -1014,20 +1014,20 @@ ssize_t DVDReadBlocks( dvd_file_t *dvd_f
if( dvd_file->dvd->css_title != dvd_file->css_title ) {
dvd_file->dvd->css_title = dvd_file->css_title;
if( dvd_file->dvd->isImageFile ) {
- dvdinput_title( dvd_file->dvd->dev, (int)dvd_file->lb_start );
+ dvdinput_title( dvd_file->dvd->dev, (int)dvd_file->lb_start );
}
/* Here each vobu has it's own dvdcss handle, so no need to update
else {
- dvdinput_title( dvd_file->title_devs[ 0 ], (int)dvd_file->lb_start );
+ dvdinput_title( dvd_file->title_devs[ 0 ], (int)dvd_file->lb_start );
}*/
}
if( dvd_file->dvd->isImageFile ) {
- ret = DVDReadBlocksUDF( dvd_file, (uint32_t)offset,
- block_count, data, DVDINPUT_READ_DECRYPT );
+ ret = DVDReadBlocksUDF( dvd_file, (uint32_t)offset,
+ block_count, data, DVDINPUT_READ_DECRYPT );
} else {
- ret = DVDReadBlocksPath( dvd_file, (unsigned int)offset,
- block_count, data, DVDINPUT_READ_DECRYPT );
+ ret = DVDReadBlocksPath( dvd_file, (unsigned int)offset,
+ block_count, data, DVDINPUT_READ_DECRYPT );
}
return (ssize_t)ret;
@@ -1087,17 +1087,17 @@ ssize_t DVDReadBytes( dvd_file_t *dvd_fi
secbuf_base = (unsigned char *) malloc( numsec * DVD_VIDEO_LB_LEN + 2048 );
secbuf = (unsigned char *)(((uintptr_t)secbuf_base & ~((uintptr_t)2047)) + 2048);
if( !secbuf_base ) {
- fprintf( stderr, "libdvdread: Can't allocate memory "
- "for file read!\n" );
+ fprintf( stderr, "libdvdread: Can't allocate memory "
+ "for file read!\n" );
return 0;
}
if( dvd_file->dvd->isImageFile ) {
- ret = DVDReadBlocksUDF( dvd_file, (uint32_t) seek_sector,
- (size_t) numsec, secbuf, DVDINPUT_NOFLAGS );
+ ret = DVDReadBlocksUDF( dvd_file, (uint32_t) seek_sector,
+ (size_t) numsec, secbuf, DVDINPUT_NOFLAGS );
} else {
- ret = DVDReadBlocksPath( dvd_file, seek_sector,
- (size_t) numsec, secbuf, DVDINPUT_NOFLAGS );
+ ret = DVDReadBlocksPath( dvd_file, seek_sector,
+ (size_t) numsec, secbuf, DVDINPUT_NOFLAGS );
}
if( ret != (int) numsec ) {
@@ -1135,34 +1135,34 @@ int DVDDiscID( dvd_reader_t *dvd, unsign
* and md5sum them, i.e VIDEO_TS.IFO and VTS_0?_0.IFO */
md5_init_ctx( &ctx );
for( title = 0; title < 10; title++ ) {
- dvd_file_t *dvd_file = DVDOpenFile( dvd, title, DVD_READ_INFO_FILE );
- if( dvd_file != NULL ) {
- ssize_t bytes_read;
- size_t file_size = dvd_file->filesize * DVD_VIDEO_LB_LEN;
- char *buffer_base = malloc( file_size + 2048 );
- char *buffer = (char *)(((uintptr_t)buffer_base & ~((uintptr_t)2047)) + 2048);
+ dvd_file_t *dvd_file = DVDOpenFile( dvd, title, DVD_READ_INFO_FILE );
+ if( dvd_file != NULL ) {
+ ssize_t bytes_read;
+ size_t file_size = dvd_file->filesize * DVD_VIDEO_LB_LEN;
+ char *buffer_base = malloc( file_size + 2048 );
+ char *buffer = (char *)(((uintptr_t)buffer_base & ~((uintptr_t)2047)) + 2048);
- if( buffer_base == NULL ) {
- DVDCloseFile( dvd_file );
- fprintf( stderr, "libdvdread: DVDDiscId, failed to "
- "allocate memory for file read!\n" );
- return -1;
- }
- bytes_read = DVDReadBytes( dvd_file, buffer, file_size );
- if( bytes_read != file_size ) {
- fprintf( stderr, "libdvdread: DVDDiscId read returned %zd bytes"
- ", wanted %zd\n", bytes_read, file_size );
- DVDCloseFile( dvd_file );
- free( buffer_base );
- return -1;
- }
+ if( buffer_base == NULL ) {
+ DVDCloseFile( dvd_file );
+ fprintf( stderr, "libdvdread: DVDDiscId, failed to "
+ "allocate memory for file read!\n" );
+ return -1;
+ }
+ bytes_read = DVDReadBytes( dvd_file, buffer, file_size );
+ if( bytes_read != file_size ) {
+ fprintf( stderr, "libdvdread: DVDDiscId read returned %zd bytes"
+ ", wanted %zd\n", bytes_read, file_size );
+ DVDCloseFile( dvd_file );
+ free( buffer_base );
+ return -1;
+ }
- md5_process_bytes( buffer, file_size, &ctx );
+ md5_process_bytes( buffer, file_size, &ctx );
- DVDCloseFile( dvd_file );
- free( buffer_base );
- nr_of_files++;
- }
+ DVDCloseFile( dvd_file );
+ free( buffer_base );
+ nr_of_files++;
+ }
}
md5_finish_ctx( &ctx, discid );
if(!nr_of_files)
@@ -1173,8 +1173,8 @@ int DVDDiscID( dvd_reader_t *dvd, unsign
int DVDISOVolumeInfo( dvd_reader_t *dvd,
- char *volid, unsigned int volid_size,
- unsigned char *volsetid, unsigned int volsetid_size )
+ char *volid, unsigned int volid_size,
+ unsigned char *volsetid, unsigned int volsetid_size )
{
unsigned char *buffer, *buffer_base;
int ret;
@@ -1193,14 +1193,14 @@ int DVDISOVolumeInfo( dvd_reader_t *dvd,
if( buffer_base == NULL ) {
fprintf( stderr, "libdvdread: DVDISOVolumeInfo, failed to "
- "allocate memory for file read!\n" );
+ "allocate memory for file read!\n" );
return -1;
}
ret = UDFReadBlocksRaw( dvd, 16, 1, buffer, 0 );
if( ret != 1 ) {
fprintf( stderr, "libdvdread: DVDISOVolumeInfo, failed to "
- "read ISO9660 Primary Volume Descriptor!\n" );
+ "read ISO9660 Primary Volume Descriptor!\n" );
free( buffer_base );
return -1;
}
@@ -1209,7 +1209,7 @@ int DVDISOVolumeInfo( dvd_reader_t *dvd,
unsigned int n;
for(n = 0; n < 32; n++) {
if(buffer[40+n] == 0x20) {
- break;
+ break;
}
}
@@ -1233,8 +1233,8 @@ int DVDISOVolumeInfo( dvd_reader_t *dvd,
int DVDUDFVolumeInfo( dvd_reader_t *dvd,
- char *volid, unsigned int volid_size,
- unsigned char *volsetid, unsigned int volsetid_size )
+ char *volid, unsigned int volid_size,
+ unsigned char *volsetid, unsigned int volsetid_size )
{
int ret;
/* Check arguments. */
Modified: trunk/libdvdread/src/dvd_reader.h
==============================================================================
--- trunk/libdvdread/src/dvd_reader.h (original)
+++ trunk/libdvdread/src/dvd_reader.h Tue Sep 23 11:14:45 2008
@@ -112,8 +112,8 @@ typedef enum {
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. */
+ the title set are opened and read as a
+ single file. */
} dvd_read_domain_t;
/**
@@ -229,7 +229,7 @@ int DVDDiscID( dvd_reader_t *, unsigned
* @return 0 on success, -1 on error.
*/
int DVDUDFVolumeInfo( dvd_reader_t *, char *, unsigned int,
- unsigned char *, unsigned int );
+ unsigned char *, unsigned int );
int DVDFileSeekForce( dvd_file_t *, int offset, int force_size);
@@ -255,7 +255,7 @@ int DVDFileSeekForce( dvd_file_t *, int
* @return 0 on success, -1 on error.
*/
int DVDISOVolumeInfo( dvd_reader_t *, char *, unsigned int,
- unsigned char *, unsigned int );
+ unsigned char *, unsigned int );
/**
* Sets the level of caching that is done when reading from a device
Modified: trunk/libdvdread/src/dvd_udf.c
==============================================================================
--- trunk/libdvdread/src/dvd_udf.c (original)
+++ trunk/libdvdread/src/dvd_udf.c Tue Sep 23 11:14:45 2008
@@ -44,13 +44,13 @@
/* Private but located in/shared with dvd_reader.c */
extern int UDFReadBlocksRaw( dvd_reader_t *device, uint32_t lb_number,
- size_t block_count, unsigned char *data,
- int encrypted );
+ size_t block_count, unsigned char *data,
+ int encrypted );
/* It's required to either fail or deliver all the blocks asked for. */
static int DVDReadLBUDF( dvd_reader_t *device, uint32_t lb_number,
- size_t block_count, unsigned char *data,
- int encrypted )
+ size_t block_count, unsigned char *data,
+ int encrypted )
{
int ret;
size_t count = block_count;
@@ -160,7 +160,7 @@ void FreeUDFCache(void *cache)
static int GetUDFCache(dvd_reader_t *device, UDFCacheType type,
- uint32_t nr, void *data)
+ uint32_t nr, void *data)
{
int n;
struct udf_cache *c;
@@ -222,7 +222,7 @@ static int GetUDFCache(dvd_reader_t *dev
}
static int SetUDFCache(dvd_reader_t *device, UDFCacheType type,
- uint32_t nr, void *data)
+ uint32_t nr, void *data)
{
int n;
struct udf_cache *c;
@@ -323,11 +323,11 @@ static int SetUDFCache(dvd_reader_t *dev
#define GETN1(p) ((uint8_t)data[p])
#define GETN2(p) ((uint16_t)data[p] | ((uint16_t)data[(p) + 1] << 8))
#define GETN3(p) ((uint32_t)data[p] | ((uint32_t)data[(p) + 1] << 8) \
- | ((uint32_t)data[(p) + 2] << 16))
+ | ((uint32_t)data[(p) + 2] << 16))
#define GETN4(p) ((uint32_t)data[p] \
- | ((uint32_t)data[(p) + 1] << 8) \
- | ((uint32_t)data[(p) + 2] << 16) \
- | ((uint32_t)data[(p) + 3] << 24))
+ | ((uint32_t)data[(p) + 1] << 8) \
+ | ((uint32_t)data[(p) + 2] << 16) \
+ | ((uint32_t)data[(p) + 3] << 24))
/* This is wrong with regard to endianess */
#define GETN(p, n, target) memcpy(target, &data[p], n)
@@ -361,7 +361,7 @@ static int UDFExtentAD( uint8_t *data, u
}
static int UDFShortAD( uint8_t *data, struct AD *ad,
- struct Partition *partition )
+ struct Partition *partition )
{
ad->Length = GETN4(0);
ad->Flags = ad->Length >> 30;
@@ -402,7 +402,7 @@ static int UDFICB( uint8_t *data, uint8_
static int UDFPartition( uint8_t *data, uint16_t *Flags, uint16_t *Number,
- char *Contents, uint32_t *Start, uint32_t *Length )
+ char *Contents, uint32_t *Start, uint32_t *Length )
{
*Flags = GETN2(20);
*Number = GETN2(22);
@@ -428,7 +428,7 @@ static int UDFLogVolume( uint8_t *data,
}
static int UDFFileEntry( uint8_t *data, uint8_t *FileType,
- struct Partition *partition, struct AD *ad )
+ struct Partition *partition, struct AD *ad )
{
uint16_t flags;
uint32_t L_EA, L_AD;
@@ -466,7 +466,7 @@ static int UDFFileEntry( uint8_t *data,
}
static int UDFFileIdentifier( uint8_t *data, uint8_t *FileCharacteristics,
- char *FileName, struct AD *FileICB )
+ char *FileName, struct AD *FileICB )
{
uint8_t L_FI;
uint16_t L_IU;
@@ -488,7 +488,7 @@ static int UDFFileIdentifier( uint8_t *d
* return 1 on success, 0 on error;
*/
static int UDFMapICB( dvd_reader_t *device, struct AD ICB, uint8_t *FileType,
- struct Partition *partition, struct AD *File )
+ struct Partition *partition, struct AD *File )
{
uint8_t LogBlock_base[DVD_VIDEO_LB_LEN + 2048];
uint8_t *LogBlock = (uint8_t *)(((uintptr_t)LogBlock_base & ~((uintptr_t)2047)) + 2048);
@@ -531,7 +531,7 @@ static int UDFMapICB( dvd_reader_t *devi
*/
static int UDFScanDir( dvd_reader_t *device, struct AD Dir, char *FileName,
struct Partition *partition, struct AD *FileICB,
- int cache_file_info)
+ int cache_file_info)
{
char filename[ MAX_UDF_FILE_NAME_LEN ];
uint8_t directory_base[ 2 * DVD_VIDEO_LB_LEN + 2048];
@@ -641,7 +641,7 @@ static int UDFScanDir( dvd_reader_t *dev
static int UDFGetAVDP( dvd_reader_t *device,
- struct avdp_t *avdp)
+ struct avdp_t *avdp)
{
uint8_t Anchor_base[ DVD_VIDEO_LB_LEN + 2048 ];
uint8_t *Anchor = (uint8_t *)(((uintptr_t)Anchor_base & ~((uintptr_t)2047)) + 2048);
@@ -710,7 +710,7 @@ static int UDFGetAVDP( dvd_reader_t *dev
* part: structure to fill with the partition information
*/
static int UDFFindPartition( dvd_reader_t *device, int partnum,
- struct Partition *part )
+ struct Partition *part )
{
uint8_t LogBlock_base[ DVD_VIDEO_LB_LEN + 2048 ];
uint8_t *LogBlock = (uint8_t *)(((uintptr_t)LogBlock_base & ~((uintptr_t)2047)) + 2048);
@@ -769,7 +769,7 @@ static int UDFFindPartition( dvd_reader_
}
uint32_t UDFFindFile( dvd_reader_t *device, char *filename,
- uint32_t *filesize )
+ uint32_t *filesize )
{
uint8_t LogBlock_base[ DVD_VIDEO_LB_LEN + 2048 ];
uint8_t *LogBlock = (uint8_t *)(((uintptr_t)LogBlock_base & ~((uintptr_t)2047)) + 2048);
@@ -851,7 +851,7 @@ uint32_t UDFFindFile( dvd_reader_t *devi
* bufsize, size of BlockBuf (must be >= DVD_VIDEO_LB_LEN).
*/
static int UDFGetDescriptor( dvd_reader_t *device, int id,
- uint8_t *descriptor, int bufsize)
+ uint8_t *descriptor, int bufsize)
{
uint32_t lbnum, MVDS_location, MVDS_length;
struct avdp_t avdp;
@@ -885,8 +885,8 @@ static int UDFGetDescriptor( dvd_reader_
/* Descriptor */
desc_found = 1;
} while( ( lbnum <= MVDS_location + ( MVDS_length - 1 )
- / DVD_VIDEO_LB_LEN ) && ( TagID != 8 )
- && ( !desc_found) );
+ / DVD_VIDEO_LB_LEN ) && ( TagID != 8 )
+ && ( !desc_found) );
if( !desc_found ) {
/* Backup volume descriptor */
@@ -922,7 +922,7 @@ static int UDFGetPVD(dvd_reader_t *devic
* returns the size of buffer needed for all data
*/
int UDFGetVolumeIdentifier(dvd_reader_t *device, char *volid,
- unsigned int volid_size)
+ unsigned int volid_size)
{
struct pvd_t pvd;
unsigned int volid_len;
@@ -951,7 +951,7 @@ int UDFGetVolumeIdentifier(dvd_reader_t
* or 0 on error
*/
int UDFGetVolumeSetIdentifier(dvd_reader_t *device, uint8_t *volsetid,
- unsigned int volsetid_size)
+ unsigned int volsetid_size)
{
struct pvd_t pvd;
Modified: trunk/libdvdread/src/dvd_udf.h
==============================================================================
--- trunk/libdvdread/src/dvd_udf.h (original)
+++ trunk/libdvdread/src/dvd_udf.h Tue Sep 23 11:14:45 2008
@@ -50,9 +50,9 @@ uint32_t UDFFindFile( dvd_reader_t *devi
void FreeUDFCache(void *cache);
int UDFGetVolumeIdentifier(dvd_reader_t *device,
- char *volid, unsigned int volid_size);
+ char *volid, unsigned int volid_size);
int UDFGetVolumeSetIdentifier(dvd_reader_t *device,
- uint8_t *volsetid, unsigned int volsetid_size);
+ uint8_t *volsetid, unsigned int volsetid_size);
void *GetUDFCacheHandle(dvd_reader_t *device);
void SetUDFCacheHandle(dvd_reader_t *device, void *cache);
Modified: trunk/libdvdread/src/ifo_print.c
==============================================================================
--- trunk/libdvdread/src/ifo_print.c (original)
+++ trunk/libdvdread/src/ifo_print.c Tue Sep 23 11:14:45 2008
@@ -37,10 +37,10 @@ static void ifo_print_time(int level, dv
assert((dtime->frame_u&0xf) < 0xa);
printf("%02x:%02x:%02x.%02x",
- dtime->hour,
- dtime->minute,
- dtime->second,
- dtime->frame_u & 0x3f);
+ dtime->hour,
+ dtime->minute,
+ dtime->second,
+ dtime->frame_u & 0x3f);
switch((dtime->frame_u & 0xc0) >> 6) {
case 1:
rate = "25.00";
@@ -316,7 +316,7 @@ static void ifo_print_audio_attributes(i
break;
default:
printf("sample_frequency %i (please send a bug report) ",
- attr->sample_frequency);
+ attr->sample_frequency);
}
printf("%dCh ", attr->channels + 1);
@@ -364,7 +364,7 @@ static void ifo_print_subp_attributes(in
printf("%c%c ", attr->lang_code >> 8, attr->lang_code & 0xff);
} else {
printf("%02x%02x ", 0xff & (unsigned)(attr->lang_code >> 8),
- 0xff & (unsigned)(attr->lang_code & 0xff));
+ 0xff & (unsigned)(attr->lang_code & 0xff));
}
printf("%d ", attr->zero1);
@@ -501,8 +501,8 @@ void ifo_print_VMGI_MAT(vmgi_mat_t *vmgi
printf("Last Sector of VMG: %08x\n", vmgi_mat->vmg_last_sector);
printf("Last Sector of VMGI: %08x\n", vmgi_mat->vmgi_last_sector);
printf("Specification version number: %01x.%01x\n",
- vmgi_mat->specification_version >> 4,
- vmgi_mat->specification_version & 0xf);
+ vmgi_mat->specification_version >> 4,
+ vmgi_mat->specification_version & 0xf);
/* Byte 2 of 'VMG Category' (00xx0000) is the Region Code */
printf("VMG Category: %08x (Region Code=%02x)\n", vmgi_mat->vmg_category, ((vmgi_mat->vmg_category >> 16) & 0xff) ^0xff);
printf("VMG Number of Volumes: %i\n", vmgi_mat->vmg_nr_of_volumes);
@@ -514,7 +514,7 @@ void ifo_print_VMGI_MAT(vmgi_mat_t *vmgi
printf("%08x\n", (uint32_t)vmgi_mat->vmg_pos_code);
printf("End byte of VMGI_MAT: %08x\n", vmgi_mat->vmgi_last_byte);
printf("Start byte of First Play PGC (FP PGC): %08x\n",
- vmgi_mat->first_play_pgc);
+ vmgi_mat->first_play_pgc);
printf("Start sector of VMGM_VOBS: %08x\n", vmgi_mat->vmgm_vobs);
printf("Start sector of TT_SRPT: %08x\n", vmgi_mat->tt_srpt);
printf("Start sector of VMGM_PGCI_UT: %08x\n", vmgi_mat->vmgm_pgci_ut);
@@ -523,19 +523,19 @@ void ifo_print_VMGI_MAT(vmgi_mat_t *vmgi
printf("Start sector of TXTDT_MG: %08x\n", vmgi_mat->txtdt_mgi);
printf("Start sector of VMGM_C_ADT: %08x\n", vmgi_mat->vmgm_c_adt);
printf("Start sector of VMGM_VOBU_ADMAP: %08x\n",
- vmgi_mat->vmgm_vobu_admap);
+ vmgi_mat->vmgm_vobu_admap);
printf("Video attributes of VMGM_VOBS: ");
ifo_print_video_attributes(5, &vmgi_mat->vmgm_video_attr);
printf("\n");
printf("VMGM Number of Audio attributes: %i\n",
- vmgi_mat->nr_of_vmgm_audio_streams);
+ vmgi_mat->nr_of_vmgm_audio_streams);
if(vmgi_mat->nr_of_vmgm_audio_streams > 0) {
printf("\tstream %i status: ", 1);
ifo_print_audio_attributes(5, &vmgi_mat->vmgm_audio_attr);
printf("\n");
}
printf("VMGM Number of Sub-picture attributes: %i\n",
- vmgi_mat->nr_of_vmgm_subp_streams);
+ vmgi_mat->nr_of_vmgm_subp_streams);
if(vmgi_mat->nr_of_vmgm_subp_streams > 0) {
printf("\tstream %2i status: ", 1);
ifo_print_subp_attributes(5, &vmgi_mat->vmgm_subp_attr);
@@ -551,8 +551,8 @@ void ifo_print_VTSI_MAT(vtsi_mat_t *vtsi
printf("Last Sector of VTS: %08x\n", vtsi_mat->vts_last_sector);
printf("Last Sector of VTSI: %08x\n", vtsi_mat->vtsi_last_sector);
printf("Specification version number: %01x.%01x\n",
- vtsi_mat->specification_version>>4,
- vtsi_mat->specification_version&0xf);
+ vtsi_mat->specification_version>>4,
+ vtsi_mat->specification_version&0xf);
printf("VTS Category: %08x\n", vtsi_mat->vts_category);
printf("End byte of VTSI_MAT: %08x\n", vtsi_mat->vtsi_last_byte);
printf("Start sector of VTSM_VOBS: %08x\n", vtsi_mat->vtsm_vobs);
@@ -571,7 +571,7 @@ void ifo_print_VTSI_MAT(vtsi_mat_t *vtsi
printf("\n");
printf("VTSM Number of Audio attributes: %i\n",
- vtsi_mat->nr_of_vtsm_audio_streams);
+ vtsi_mat->nr_of_vtsm_audio_streams);
if(vtsi_mat->nr_of_vtsm_audio_streams > 0) {
printf("\tstream %i status: ", 1);
ifo_print_audio_attributes(5, &vtsi_mat->vtsm_audio_attr);
@@ -579,7 +579,7 @@ void ifo_print_VTSI_MAT(vtsi_mat_t *vtsi
}
printf("VTSM Number of Sub-picture attributes: %i\n",
- vtsi_mat->nr_of_vtsm_subp_streams);
+ vtsi_mat->nr_of_vtsm_subp_streams);
if(vtsi_mat->nr_of_vtsm_subp_streams > 0) {
printf("\tstream %2i status: ", 1);
ifo_print_subp_attributes(5, &vtsi_mat->vtsm_subp_attr);
@@ -591,7 +591,7 @@ void ifo_print_VTSI_MAT(vtsi_mat_t *vtsi
printf("\n");
printf("VTS Number of Audio attributes: %i\n",
- vtsi_mat->nr_of_vts_audio_streams);
+ vtsi_mat->nr_of_vts_audio_streams);
for(i = 0; i < vtsi_mat->nr_of_vts_audio_streams; i++) {
printf("\tstream %i status: ", i);
ifo_print_audio_attributes(5, &vtsi_mat->vts_audio_attr[i]);
@@ -599,7 +599,7 @@ void ifo_print_VTSI_MAT(vtsi_mat_t *vtsi
}
printf("VTS Number of Subpicture attributes: %i\n",
- vtsi_mat->nr_of_vts_subp_streams);
+ vtsi_mat->nr_of_vts_subp_streams);
for(i = 0; i < vtsi_mat->nr_of_vts_subp_streams; i++) {
printf("\tstream %2i status: ", i);
ifo_print_subp_attributes(5, &vtsi_mat->vts_subp_attr[i]);
@@ -665,28 +665,28 @@ static void ifo_print_CELL_PLAYBACK(cell
const char *s;
switch(cell_playback[i].block_mode) {
case 0:
- s = "not a"; break;
+ s = "not a"; break;
case 1:
- s = "the first"; break;
+ s = "the first"; break;
case 2:
default:
- s = ""; break;
+ s = ""; break;
case 3:
- s = "last"; break;
+ s = "last"; break;
}
printf("%s cell in the block ", s);
switch(cell_playback[i].block_type) {
case 0:
- printf("not part of the block ");
- break;
+ printf("not part of the block ");
+ break;
case 1:
- printf("angle block ");
- break;
+ printf("angle block ");
+ break;
case 2:
case 3:
- printf("(send bug repport) ");
- break;
+ printf("(send bug repport) ");
+ break;
}
}
if(cell_playback[i].seamless_play)
@@ -709,11 +709,11 @@ static void ifo_print_CELL_PLAYBACK(cell
printf("cell command %d", cell_playback[i].cell_cmd_nr);
printf("\n\tStart sector: %08x\tFirst ILVU end sector: %08x\n",
- cell_playback[i].first_sector,
- cell_playback[i].first_ilvu_end_sector);
+ cell_playback[i].first_sector,
+ cell_playback[i].first_ilvu_end_sector);
printf("\tEnd sector: %08x\tLast VOBU start sector: %08x\n",
- cell_playback[i].last_sector,
- cell_playback[i].last_vobu_start_sector);
+ cell_playback[i].last_sector,
+ cell_playback[i].last_vobu_start_sector);
}
}
@@ -727,7 +727,7 @@ static void ifo_print_CELL_POSITION(cell
for(i=0;i<nr;i++) {
printf("Cell: %3i has VOB ID: %3i, Cell ID: %3i\n", i + 1,
- cell_position[i].vob_id_nr, cell_position[i].cell_nr);
+ cell_position[i].vob_id_nr, cell_position[i].cell_nr);
}
}
@@ -751,19 +751,19 @@ void ifo_print_PGC(pgc_t *pgc) {
for(i = 0; i < 8; i++) {
if(pgc->audio_control[i] & 0x8000) { /* The 'is present' bit */
- printf("Audio stream %i control: %04x\n",
- i, pgc->audio_control[i]);
+ printf("Audio stream %i control: %04x\n",
+ i, pgc->audio_control[i]);
}
}
for(i = 0; i < 32; i++) {
if(pgc->subp_control[i] & 0x80000000) { /* The 'is present' bit */
printf("Subpicture stream %2i control: %08x: 4:3=%d, Wide=%d, Letterbox=%d, Pan-Scan=%d\n",
- i, pgc->subp_control[i],
- (pgc->subp_control[i] >>24) & 0x1f,
- (pgc->subp_control[i] >>16) & 0x1f,
- (pgc->subp_control[i] >>8) & 0x1f,
- (pgc->subp_control[i] ) & 0x1f);
+ i, pgc->subp_control[i],
+ (pgc->subp_control[i] >>24) & 0x1f,
+ (pgc->subp_control[i] >>16) & 0x1f,
+ (pgc->subp_control[i] >>8) & 0x1f,
+ (pgc->subp_control[i] ) & 0x1f);
}
}
@@ -793,18 +793,18 @@ void ifo_print_TT_SRPT(tt_srpt_t *tt_srp
int i;
printf("Number of TitleTrack search pointers: %i\n",
- tt_srpt->nr_of_srpts);
+ tt_srpt->nr_of_srpts);
for(i=0;i<tt_srpt->nr_of_srpts;i++) {
printf("Title Track index %i\n", i + 1);
printf("\tTitle set number (VTS): %i",
- tt_srpt->title[i].title_set_nr);
+ tt_srpt->title[i].title_set_nr);
printf("\tVTS_TTN: %i\n", tt_srpt->title[i].vts_ttn);
printf("\tNumber of PTTs: %i\n", tt_srpt->title[i].nr_of_ptts);
printf("\tNumber of angles: %i\n",
- tt_srpt->title[i].nr_of_angles);
+ tt_srpt->title[i].nr_of_angles);
printf("\tTitle playback type: (%02x)\n",
- *(uint8_t *)&(tt_srpt->title[i].pb_ty));
+ *(uint8_t *)&(tt_srpt->title[i].pb_ty));
printf("\t\t%s\n",
tt_srpt->title[i].pb_ty.multi_or_random_pgc_title ? "Random or Shuffle" : "Sequencial");
if (tt_srpt->title[i].pb_ty.jlc_exists_in_cell_cmd) printf("\t\tJump/Link/Call exists in cell cmd\n");
@@ -815,9 +815,9 @@ void ifo_print_TT_SRPT(tt_srpt_t *tt_srp
printf("\t\tChapter search or play:%d\n", tt_srpt->title[i].pb_ty.chapter_search_or_play);
printf("\tParental ID field: %04x\n",
- tt_srpt->title[i].parental_id);
+ tt_srpt->title[i].parental_id);
printf("\tTitle set starting sector %08x\n",
- tt_srpt->title[i].title_set_sector);
+ tt_srpt->title[i].title_set_sector);
}
}
@@ -825,14 +825,14 @@ void ifo_print_TT_SRPT(tt_srpt_t *tt_srp
void ifo_print_VTS_PTT_SRPT(vts_ptt_srpt_t *vts_ptt_srpt) {
int i, j;
printf(" nr_of_srpts %i last byte %i\n",
- vts_ptt_srpt->nr_of_srpts,
- vts_ptt_srpt->last_byte);
+ vts_ptt_srpt->nr_of_srpts,
+ vts_ptt_srpt->last_byte);
for(i=0;i<vts_ptt_srpt->nr_of_srpts;i++) {
for(j=0;j<vts_ptt_srpt->title[i].nr_of_ptts;j++) {
printf("VTS_PTT_SRPT - Title %3i part %3i: PGC: %3i PG: %3i\n",
- i + 1, j + 1,
- vts_ptt_srpt->title[i].ptt[j].pgcn,
- vts_ptt_srpt->title[i].ptt[j].pgn );
+ i + 1, j + 1,
+ vts_ptt_srpt->title[i].ptt[j].pgcn,
+ vts_ptt_srpt->title[i].ptt[j].pgn );
}
}
}
@@ -852,8 +852,8 @@ void ifo_print_PTL_MAIT(ptl_mait_t *ptl_
for(i = 0; i < ptl_mait->nr_of_countries; i++) {
printf("Country code: %c%c\n",
- ptl_mait->countries[i].country_code >> 8,
- ptl_mait->countries[i].country_code & 0xff);
+ ptl_mait->countries[i].country_code >> 8,
+ ptl_mait->countries[i].country_code & 0xff);
/*
printf("Start byte: %04x %i\n",
ptl_mait->countries[i].pf_ptl_mai_start_byte,
@@ -865,8 +865,8 @@ void ifo_print_PTL_MAIT(ptl_mait_t *ptl_
If it is for the menu it probably the first entry. */
for(j=0;j<8;j++) {
hexdump( (uint8_t *)ptl_mait->countries - PTL_MAIT_COUNTRY_SIZE
- + ptl_mait->countries[i].pf_ptl_mai_start_byte
- + j*(ptl_mait->nr_of_vtss+1)*2, (ptl_mait->nr_of_vtss+1)*2);
+ + ptl_mait->countries[i].pf_ptl_mai_start_byte
+ + j*(ptl_mait->nr_of_vtss+1)*2, (ptl_mait->nr_of_vtss+1)*2);
printf("\n");
}
}
@@ -904,10 +904,10 @@ void ifo_print_C_ADT(c_adt_t *c_adt) {
for(i = 0; i < entries; i++) {
printf("VOB ID: %3i, Cell ID: %3i ",
- c_adt->cell_adr_table[i].vob_id, c_adt->cell_adr_table[i].cell_id);
+ c_adt->cell_adr_table[i].vob_id, c_adt->cell_adr_table[i].cell_id);
printf("Sector (first): 0x%08x (last): 0x%08x\n",
- c_adt->cell_adr_table[i].start_sector,
- c_adt->cell_adr_table[i].last_sector);
+ c_adt->cell_adr_table[i].start_sector,
+ c_adt->cell_adr_table[i].last_sector);
}
}
@@ -918,7 +918,7 @@ void ifo_print_VOBU_ADMAP(vobu_admap_t *
entries = (vobu_admap->last_byte + 1 - VOBU_ADMAP_SIZE)/4;
for(i = 0; i < entries; i++) {
printf("VOBU %5i First sector: 0x%08x\n", i + 1,
- vobu_admap->vobu_start_sectors[i]);
+ vobu_admap->vobu_start_sectors[i]);
}
}
@@ -983,8 +983,8 @@ void ifo_print_PGCI_UT(pgci_ut_t *pgci_u
for(i = 0; i < pgci_ut->nr_of_lus; i++) {
printf("\nMenu Language Unit %d\n", i+1);
printf("\nMenu Language Code: %c%c\n",
- pgci_ut->lu[i].lang_code >> 8,
- pgci_ut->lu[i].lang_code & 0xff);
+ pgci_ut->lu[i].lang_code >> 8,
+ pgci_ut->lu[i].lang_code & 0xff);
menu = pgci_ut->lu[i].exists;
printf("Menu Existence: %02x: ", menu);
@@ -1030,14 +1030,14 @@ static void ifo_print_VTS_ATTRIBUTES(vts
ifo_print_video_attributes(5, &vts_attributes->vtsm_vobs_attr);
printf("\n");
printf("Number of Audio streams: %i\n",
- vts_attributes->nr_of_vtsm_audio_streams);
+ vts_attributes->nr_of_vtsm_audio_streams);
if(vts_attributes->nr_of_vtsm_audio_streams > 0) {
printf("\tstream %i attributes: ", 1);
ifo_print_audio_attributes(5, &vts_attributes->vtsm_audio_attr);
printf("\n");
}
printf("Number of Subpicture streams: %i\n",
- vts_attributes->nr_of_vtsm_subp_streams);
+ vts_attributes->nr_of_vtsm_subp_streams);
if(vts_attributes->nr_of_vtsm_subp_streams > 0) {
printf("\tstream %2i attributes: ", 1);
ifo_print_subp_attributes(5, &vts_attributes->vtsm_subp_attr);
@@ -1048,7 +1048,7 @@ static void ifo_print_VTS_ATTRIBUTES(vts
ifo_print_video_attributes(5, &vts_attributes->vtstt_vobs_video_attr);
printf("\n");
printf("Number of Audio streams: %i\n",
- vts_attributes->nr_of_vtstt_audio_streams);
+ vts_attributes->nr_of_vtstt_audio_streams);
for(i = 0; i < vts_attributes->nr_of_vtstt_audio_streams; i++) {
printf("\tstream %i attributes: ", i);
ifo_print_audio_attributes(5, &vts_attributes->vtstt_audio_attr[i]);
@@ -1056,7 +1056,7 @@ static void ifo_print_VTS_ATTRIBUTES(vts
}
printf("Number of Subpicture streams: %i\n",
- vts_attributes->nr_of_vtstt_subp_streams);
+ vts_attributes->nr_of_vtstt_subp_streams);
for(i = 0; i < vts_attributes->nr_of_vtstt_subp_streams; i++) {
printf("\tstream %2i attributes: ", i);
ifo_print_subp_attributes(5, &vts_attributes->vtstt_subp_attr[i]);
Modified: trunk/libdvdread/src/ifo_read.c
==============================================================================
--- trunk/libdvdread/src/ifo_read.c (original)
+++ trunk/libdvdread/src/ifo_read.c Tue Sep 23 11:14:45 2008
@@ -66,7 +66,7 @@ static int ifoRead_VTS(ifo_handle_t *ifo
static int ifoRead_PGC(ifo_handle_t *ifofile, pgc_t *pgc, unsigned int offset);
static int ifoRead_PGC_COMMAND_TBL(ifo_handle_t *ifofile,
pgc_command_tbl_t *cmd_tbl,
- unsigned int offset);
+ unsigned int offset);
static int ifoRead_PGC_PROGRAM_MAP(ifo_handle_t *ifofile,
pgc_program_map_t *program_map,
unsigned int nr, unsigned int offset);
@@ -83,7 +83,7 @@ static int ifoRead_C_ADT_internal(ifo_ha
unsigned int sector);
static int ifoRead_VOBU_ADMAP_internal(ifo_handle_t *ifofile,
vobu_admap_t *vobu_admap,
- unsigned int sector);
+ unsigned int sector);
static int ifoRead_PGCIT_internal(ifo_handle_t *ifofile, pgcit_t *pgcit,
unsigned int offset);
@@ -363,7 +363,7 @@ ifo_handle_t *ifoOpen(dvd_reader_t *dvd,
if(title) {
fprintf(stderr, "libdvdread: Invalid IFO for title %d (VTS_%02d_0.IFO).\n",
- title, title);
+ title, title);
} else {
fprintf(stderr, "libdvdread: Invalid IFO for VMGM (VIDEO_TS.IFO).\n");
}
@@ -673,7 +673,7 @@ static int ifoRead_VTS(ifo_handle_t *ifo
static int ifoRead_PGC_COMMAND_TBL(ifo_handle_t *ifofile,
pgc_command_tbl_t *cmd_tbl,
- unsigned int offset) {
+ unsigned int offset) {
memset(cmd_tbl, 0, sizeof(pgc_command_tbl_t));
@@ -706,12 +706,12 @@ static int ifoRead_PGC_COMMAND_TBL(ifo_h
cmd_tbl->post_cmds = (vm_cmd_t *)malloc(post_cmds_size);
if(!cmd_tbl->post_cmds) {
if(cmd_tbl->pre_cmds)
- free(cmd_tbl->pre_cmds);
+ free(cmd_tbl->pre_cmds);
return 0;
}
if(!(DVDReadBytes(ifofile->file, cmd_tbl->post_cmds, post_cmds_size))) {
if(cmd_tbl->pre_cmds)
- free(cmd_tbl->pre_cmds);
+ free(cmd_tbl->pre_cmds);
free(cmd_tbl->post_cmds);
return 0;
}
@@ -722,16 +722,16 @@ static int ifoRead_PGC_COMMAND_TBL(ifo_h
cmd_tbl->cell_cmds = (vm_cmd_t *)malloc(cell_cmds_size);
if(!cmd_tbl->cell_cmds) {
if(cmd_tbl->pre_cmds)
- free(cmd_tbl->pre_cmds);
+ free(cmd_tbl->pre_cmds);
if(cmd_tbl->post_cmds)
- free(cmd_tbl->post_cmds);
+ free(cmd_tbl->post_cmds);
return 0;
}
if(!(DVDReadBytes(ifofile->file, cmd_tbl->cell_cmds, cell_cmds_size))) {
if(cmd_tbl->pre_cmds)
- free(cmd_tbl->pre_cmds);
+ free(cmd_tbl->pre_cmds);
if(cmd_tbl->post_cmds)
- free(cmd_tbl->post_cmds);
+ free(cmd_tbl->post_cmds);
free(cmd_tbl->cell_cmds);
return 0;
}
@@ -758,7 +758,7 @@ static void ifoFree_PGC_COMMAND_TBL(pgc_
static int ifoRead_PGC_PROGRAM_MAP(ifo_handle_t *ifofile,
pgc_program_map_t *program_map,
- unsigned int nr, unsigned int offset) {
+ unsigned int nr, unsigned int offset) {
unsigned int size = nr * sizeof(pgc_program_map_t);
if(!DVDFileSeek_(ifofile->file, offset))
@@ -899,15 +899,15 @@ static int ifoRead_PGC(ifo_handle_t *ifo
if(!pgc->cell_playback) {
ifoFree_PGC_COMMAND_TBL(pgc->command_tbl);
if(pgc->program_map)
- free(pgc->program_map);
+ free(pgc->program_map);
return 0;
}
if(!ifoRead_CELL_PLAYBACK_TBL(ifofile, pgc->cell_playback,
- pgc->nr_of_cells,
+ pgc->nr_of_cells,
offset + pgc->cell_playback_offset)) {
ifoFree_PGC_COMMAND_TBL(pgc->command_tbl);
if(pgc->program_map)
- free(pgc->program_map);
+ free(pgc->program_map);
free(pgc->cell_playback);
return 0;
}
@@ -922,7 +922,7 @@ static int ifoRead_PGC(ifo_handle_t *ifo
return 0;
}
if(!ifoRead_CELL_POSITION_TBL(ifofile, pgc->cell_position,
- pgc->nr_of_cells,
+ pgc->nr_of_cells,
offset + pgc->cell_position_offset)) {
ifoFree_PGC(pgc);
return 0;
@@ -1101,7 +1101,7 @@ int ifoRead_VTS_PTT_SRPT(ifo_handle_t *i
return 0;
if(!DVDFileSeek_(ifofile->file,
- ifofile->vtsi_mat->vts_ptt_srpt * DVD_BLOCK_LEN))
+ ifofile->vtsi_mat->vts_ptt_srpt * DVD_BLOCK_LEN))
return 0;
vts_ptt_srpt = (vts_ptt_srpt_t *)malloc(sizeof(vts_ptt_srpt_t));
@@ -1264,7 +1264,7 @@ int ifoRead_PTL_MAIT(ifo_handle_t *ifofi
CHECK_VALUE(ptl_mait->nr_of_vtss != 0);
CHECK_VALUE(ptl_mait->nr_of_vtss < 100); /* ?? */
CHECK_VALUE(ptl_mait->nr_of_countries * PTL_MAIT_COUNTRY_SIZE
- <= ptl_mait->last_byte + 1 - PTL_MAIT_SIZE);
+ <= ptl_mait->last_byte + 1 - PTL_MAIT_SIZE);
info_length = ptl_mait->nr_of_countries * sizeof(ptl_mait_country_t);
ptl_mait->countries = (ptl_mait_country_t *)malloc(info_length);
@@ -1293,14 +1293,14 @@ int ifoRead_PTL_MAIT(ifo_handle_t *ifofi
CHECK_ZERO(ptl_mait->countries[i].zero_1);
CHECK_ZERO(ptl_mait->countries[i].zero_2);
CHECK_VALUE(ptl_mait->countries[i].pf_ptl_mai_start_byte
- + 8*2 * (ptl_mait->nr_of_vtss + 1) <= ptl_mait->last_byte + 1);
+ + 8*2 * (ptl_mait->nr_of_vtss + 1) <= ptl_mait->last_byte + 1);
}
for(i = 0; i < ptl_mait->nr_of_countries; i++) {
uint16_t *pf_temp;
if(!DVDFileSeek_(ifofile->file,
- ifofile->vmgi_mat->ptl_mait * DVD_BLOCK_LEN
+ ifofile->vmgi_mat->ptl_mait * DVD_BLOCK_LEN
+ ptl_mait->countries[i].pf_ptl_mai_start_byte)) {
fprintf(stderr, "libdvdread: Unable to seak PTL_MAIT table.\n");
free(ptl_mait->countries);
@@ -1331,10 +1331,10 @@ int ifoRead_PTL_MAIT(ifo_handle_t *ifofi
{ /* Transpose the array so we can use C indexing. */
int level, vts;
for(level = 0; level < 8; level++) {
- for(vts = 0; vts <= ptl_mait->nr_of_vtss; vts++) {
- ptl_mait->countries[i].pf_ptl_mai[vts][level] =
- pf_temp[(7-level)*(ptl_mait->nr_of_vtss+1) + vts];
- }
+ for(vts = 0; vts <= ptl_mait->nr_of_vtss; vts++) {
+ ptl_mait->countries[i].pf_ptl_mai[vts][level] =
+ pf_temp[(7-level)*(ptl_mait->nr_of_vtss+1) + vts];
+ }
}
free(pf_temp);
}
@@ -1486,7 +1486,7 @@ void ifoFree_VTS_TMAPT(ifo_handle_t *ifo
if(ifofile->vts_tmapt) {
for(i = 0; i < ifofile->vts_tmapt->nr_of_tmaps; i++)
if(ifofile->vts_tmapt->tmap[i].map_ent)
- free(ifofile->vts_tmapt->tmap[i].map_ent);
+ free(ifofile->vts_tmapt->tmap[i].map_ent);
free(ifofile->vts_tmapt->tmap);
free(ifofile->vts_tmapt->tmap_offset);
free(ifofile->vts_tmapt);
@@ -1600,7 +1600,7 @@ static int ifoRead_C_ADT_internal(ifo_ha
CHECK_VALUE(c_adt->cell_adr_table[i].vob_id <= c_adt->nr_of_vobs);
CHECK_VALUE(c_adt->cell_adr_table[i].cell_id > 0);
CHECK_VALUE(c_adt->cell_adr_table[i].start_sector <
- c_adt->cell_adr_table[i].last_sector);
+ c_adt->cell_adr_table[i].last_sector);
}
return 1;
@@ -1687,7 +1687,7 @@ int ifoRead_VOBU_ADMAP(ifo_handle_t *ifo
static int ifoRead_VOBU_ADMAP_internal(ifo_handle_t *ifofile,
vobu_admap_t *vobu_admap,
- unsigned int sector) {
+ unsigned int sector) {
unsigned int i;
int info_length;
@@ -1711,7 +1711,7 @@ static int ifoRead_VOBU_ADMAP_internal(i
}
if(info_length &&
!(DVDReadBytes(ifofile->file,
- vobu_admap->vobu_start_sectors, info_length))) {
+ vobu_admap->vobu_start_sectors, info_length))) {
free(vobu_admap->vobu_start_sectors);
return 0;
}
@@ -1986,9 +1986,9 @@ int ifoRead_PGCI_UT(ifo_handle_t *ifofil
return 0;
}
/*
- * FIXME: Iterate and verify that all menus that should exists accordingly
- * to pgci_ut->lu[i].exists really do?
- */
+ * FIXME: Iterate and verify that all menus that should exists accordingly
+ * to pgci_ut->lu[i].exists really do?
+ */
}
return 1;
@@ -2180,7 +2180,7 @@ int ifoRead_TXTDT_MGI(ifo_handle_t *ifof
return 1;
if(!DVDFileSeek_(ifofile->file,
- ifofile->vmgi_mat->txtdt_mgi * DVD_BLOCK_LEN))
+ ifofile->vmgi_mat->txtdt_mgi * DVD_BLOCK_LEN))
return 0;
txtdt_mgi = (txtdt_mgi_t *)malloc(sizeof(txtdt_mgi_t));
Modified: trunk/libdvdread/src/md5.c
==============================================================================
--- trunk/libdvdread/src/md5.c (original)
+++ trunk/libdvdread/src/md5.c Tue Sep 23 11:14:45 2008
@@ -40,7 +40,7 @@
#endif
#ifdef WORDS_BIGENDIAN
-# define SWAP(n) \
+# define SWAP(n) \
(((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
#else
# define SWAP(n) (n)
@@ -110,7 +110,7 @@ md5_finish_ctx (ctx, resbuf)
/* Put the 64-bit file length in *bits* at the end of the buffer. */
*(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3);
*(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) |
- (ctx->total[0] >> 29));
+ (ctx->total[0] >> 29));
/* Process last bytes. */
md5_process_block (ctx->buffer, bytes + pad + 8, ctx);
@@ -139,28 +139,28 @@ md5_stream (stream, resblock)
while (1)
{
/* We read the file in blocks of BLOCKSIZE bytes. One call of the
- computation function processes the whole buffer so that with the
- next round of the loop another block can be read. */
+ computation function processes the whole buffer so that with the
+ next round of the loop another block can be read. */
size_t n;
sum = 0;
/* Read block. Take care for partial reads. */
do
- {
- n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
+ {
+ n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
- sum += n;
- }
+ sum += n;
+ }
while (sum < BLOCKSIZE && n != 0);
if (n == 0 && ferror (stream))
return 1;
/* If end of file is reached, end the loop. */
if (n == 0)
- break;
+ break;
/* Process buffer with BLOCKSIZE bytes. Note that
- BLOCKSIZE % 64 == 0
+ BLOCKSIZE % 64 == 0
*/
md5_process_block (buffer, BLOCKSIZE, &ctx);
}
@@ -214,13 +214,13 @@ md5_process_bytes (buffer, len, ctx)
ctx->buflen += add;
if (left_over + add > 64)
- {
- md5_process_block (ctx->buffer, (left_over + add) & ~63, ctx);
- /* The regions in the following copy operation cannot overlap. */
- memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
- (left_over + add) & 63);
- ctx->buflen = (left_over + add) & 63;
- }
+ {
+ md5_process_block (ctx->buffer, (left_over + add) & ~63, ctx);
+ /* The regions in the following copy operation cannot overlap. */
+ memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
+ (left_over + add) & 63);
+ ctx->buflen = (left_over + add) & 63;
+ }
buffer = (const char *) buffer + add;
len -= add;
@@ -288,27 +288,27 @@ md5_process_block (buffer, len, ctx)
md5_uint32 D_save = D;
/* First round: using the given function, the context and a constant
- the next context is computed. Because the algorithms processing
- unit is a 32-bit word and it is determined to work on words in
- little endian byte order we perhaps have to change the byte order
- before the computation. To reduce the work for the next steps
- we store the swapped words in the array CORRECT_WORDS. */
+ the next context is computed. Because the algorithms processing
+ unit is a 32-bit word and it is determined to work on words in
+ little endian byte order we perhaps have to change the byte order
+ before the computation. To reduce the work for the next steps
+ we store the swapped words in the array CORRECT_WORDS. */
-#define OP(a, b, c, d, s, T) \
- do \
- { \
- a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \
- ++words; \
- a = rol (a, s); \
- a += b; \
- } \
+#define OP(a, b, c, d, s, T) \
+ do \
+ { \
+ a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \
+ ++words; \
+ a = rol (a, s); \
+ a += b; \
+ } \
while (0)
/* Before we start, one word to the strange constants.
- They are defined in RFC 1321 as
+ They are defined in RFC 1321 as
- T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64, or
- perl -e 'foreach(1..64){printf "0x%08x\n", int (4294967296 * abs (sin $_))}'
+ T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64, or
+ perl -e 'foreach(1..64){printf "0x%08x\n", int (4294967296 * abs (sin $_))}'
*/
/* Round 1. */
@@ -330,16 +330,16 @@ md5_process_block (buffer, len, ctx)
OP (B, C, D, A, 22, 0x49b40821);
/* For the second to fourth round we have the possibly swapped words
- in CORRECT_WORDS. Redefine the macro to take an additional first
- argument specifying the function to use. */
+ in CORRECT_WORDS. Redefine the macro to take an additional first
+ argument specifying the function to use. */
#undef OP
-#define OP(f, a, b, c, d, k, s, T) \
- do \
- { \
- a += f (b, c, d) + correct_words[k] + T; \
- a = rol (a, s); \
- a += b; \
- } \
+#define OP(f, a, b, c, d, k, s, T) \
+ do \
+ { \
+ a += f (b, c, d) + correct_words[k] + T; \
+ a = rol (a, s); \
+ a += b; \
+ } \
while (0)
/* Round 2. */
Modified: trunk/libdvdread/src/md5.h
==============================================================================
--- trunk/libdvdread/src/md5.h (original)
+++ trunk/libdvdread/src/md5.h Tue Sep 23 11:14:45 2008
@@ -72,9 +72,9 @@ typedef u_int32_t md5_uint32;
#undef __P
#if defined (__STDC__) && __STDC__
-#define __P(x) x
+#define __P(x) x
#else
-#define __P(x) ()
+#define __P(x) ()
#endif
/* Structure to save state of computation between the single steps. */
@@ -104,14 +104,14 @@ extern void md5_init_ctx __P ((struct md
starting at BUFFER.
It is necessary that LEN is a multiple of 64!!! */
extern void md5_process_block __P ((const void *buffer, size_t len,
- struct md5_ctx *ctx));
+ struct md5_ctx *ctx));
/* Starting with the result of former calls of this function (or the
initialization function update the context for the next LEN bytes
starting at BUFFER.
It is NOT required that LEN is a multiple of 64. */
extern void md5_process_bytes __P ((const void *buffer, size_t len,
- struct md5_ctx *ctx));
+ struct md5_ctx *ctx));
/* Process the remaining bytes in the buffer and put result from CTX
in first 16 bytes following RESBUF. The result is always in little
@@ -150,8 +150,8 @@ static inline md5_uint32
rol(md5_uint32 x, int n)
{
__asm__("roll %%cl,%0"
- :"=r" (x)
- :"0" (x),"c" (n));
+ :"=r" (x)
+ :"0" (x),"c" (n));
return x;
}
#else
Modified: trunk/libdvdread/src/nav_print.c
==============================================================================
--- trunk/libdvdread/src/nav_print.c (original)
+++ trunk/libdvdread/src/nav_print.c Tue Sep 23 11:14:45 2008
@@ -69,7 +69,7 @@ static void navPrint_NSML_AGLI(nsml_agli
for(i = 0; i < 9; i++)
if(nsml_agli->nsml_agl_dsta[i])
printf("nsml_agl_c%d_dsta 0x%08x\n", i + 1,
- nsml_agli->nsml_agl_dsta[i]);
+ nsml_agli->nsml_agl_dsta[i]);
}
static void navPrint_HL_GI(hl_gi_t *hl_gi, int *btngr_ns, int *btn_ns) {
@@ -110,8 +110,8 @@ static void navPrint_BTN_COLIT(btn_colit
for(i = 0; i < 3; i++)
for(j = 0; j < 2; j++)
printf("btn_cqoli %d %s_coli: %08x\n",
- i, (j == 0) ? "sl" : "ac",
- btn_colit->btn_coli[i][j]);
+ i, (j == 0) ? "sl" : "ac",
+ btn_colit->btn_coli[i][j]);
}
static void navPrint_BTNIT(btni_t *btni_table, int btngr_ns, int btn_ns) {
@@ -127,21 +127,21 @@ static void navPrint_BTNIT(btni_t *btni_
for(i = 0; i < btngr_ns; i++) {
for(j = 0; j < (36 / btngr_ns); j++) {
if(j < btn_ns) {
- btni_t *btni = &btni_table[(36 / btngr_ns) * i + j];
+ btni_t *btni = &btni_table[(36 / btngr_ns) * i + j];
- printf("group %d btni %d: ", i+1, j+1);
- printf("btn_coln %d, auto_action_mode %d\n",
- btni->btn_coln, btni->auto_action_mode);
- printf("coords (%d, %d) .. (%d, %d)\n",
- btni->x_start, btni->y_start, btni->x_end, btni->y_end);
+ printf("group %d btni %d: ", i+1, j+1);
+ printf("btn_coln %d, auto_action_mode %d\n",
+ btni->btn_coln, btni->auto_action_mode);
+ printf("coords (%d, %d) .. (%d, %d)\n",
+ btni->x_start, btni->y_start, btni->x_end, btni->y_end);
- printf("up %d, ", btni->up);
- printf("down %d, ", btni->down);
- printf("left %d, ", btni->left);
- printf("right %d\n", btni->right);
+ printf("up %d, ", btni->up);
+ printf("down %d, ", btni->down);
+ printf("left %d, ", btni->left);
+ printf("right %d\n", btni->right);
- /* ifoPrint_COMMAND(&btni->cmd); */
- printf("\n");
+ /* ifoPrint_COMMAND(&btni->cmd); */
+ printf("\n");
}
}
}
@@ -205,14 +205,14 @@ static void navPrint_SML_AGLI(sml_agli_t
printf("sml_agli:\n");
for(i = 0; i < 9; i++) {
printf("agl_c%d address: 0x%08x size 0x%04x\n", i,
- sml_agli->data[i].address, sml_agli->data[i].size);
+ sml_agli->data[i].address, sml_agli->data[i].size);
}
}
static void navPrint_VOBU_SRI(vobu_sri_t *vobu_sri) {
int i;
int stime[19] = { 240, 120, 60, 20, 15, 14, 13, 12, 11,
- 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
+ 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
printf("vobu_sri:\n");
printf("Next VOBU with Video %08x\n", vobu_sri->next_video);
for(i = 0; i < 19; i++) {
Modified: trunk/libdvdread/src/nav_read.c
==============================================================================
--- trunk/libdvdread/src/nav_read.c (original)
+++ trunk/libdvdread/src/nav_read.c Tue Sep 23 11:14:45 2008
@@ -160,7 +160,7 @@ void navRead_PCI(pci_t *pci, unsigned ch
CHECK_VALUE(pci->hli.hl_gi.btngr_ns != 0);
} else {
CHECK_VALUE((pci->hli.hl_gi.btn_ns != 0 && pci->hli.hl_gi.btngr_ns != 0)
- || (pci->hli.hl_gi.btn_ns == 0 && pci->hli.hl_gi.btngr_ns == 0));
+ || (pci->hli.hl_gi.btn_ns == 0 && pci->hli.hl_gi.btngr_ns == 0));
}
/* pci hli btnit */
@@ -175,27 +175,27 @@ void navRead_PCI(pci_t *pci, unsigned ch
CHECK_VALUE(pci->hli.btnit[n].zero6 == 0);
if (j < pci->hli.hl_gi.btn_ns) {
- CHECK_VALUE(pci->hli.btnit[n].x_start <= pci->hli.btnit[n].x_end);
- CHECK_VALUE(pci->hli.btnit[n].y_start <= pci->hli.btnit[n].y_end);
- CHECK_VALUE(pci->hli.btnit[n].up <= pci->hli.hl_gi.btn_ns);
- CHECK_VALUE(pci->hli.btnit[n].down <= pci->hli.hl_gi.btn_ns);
- CHECK_VALUE(pci->hli.btnit[n].left <= pci->hli.hl_gi.btn_ns);
- CHECK_VALUE(pci->hli.btnit[n].right <= pci->hli.hl_gi.btn_ns);
- /* vmcmd_verify(pci->hli.btnit[n].cmd); */
+ CHECK_VALUE(pci->hli.btnit[n].x_start <= pci->hli.btnit[n].x_end);
+ CHECK_VALUE(pci->hli.btnit[n].y_start <= pci->hli.btnit[n].y_end);
+ CHECK_VALUE(pci->hli.btnit[n].up <= pci->hli.hl_gi.btn_ns);
+ CHECK_VALUE(pci->hli.btnit[n].down <= pci->hli.hl_gi.btn_ns);
+ CHECK_VALUE(pci->hli.btnit[n].left <= pci->hli.hl_gi.btn_ns);
+ CHECK_VALUE(pci->hli.btnit[n].right <= pci->hli.hl_gi.btn_ns);
+ /* vmcmd_verify(pci->hli.btnit[n].cmd); */
} else {
- int k;
- CHECK_VALUE(pci->hli.btnit[n].btn_coln == 0);
- CHECK_VALUE(pci->hli.btnit[n].auto_action_mode == 0);
- CHECK_VALUE(pci->hli.btnit[n].x_start == 0);
- CHECK_VALUE(pci->hli.btnit[n].y_start == 0);
- CHECK_VALUE(pci->hli.btnit[n].x_end == 0);
- CHECK_VALUE(pci->hli.btnit[n].y_end == 0);
- CHECK_VALUE(pci->hli.btnit[n].up == 0);
- CHECK_VALUE(pci->hli.btnit[n].down == 0);
- CHECK_VALUE(pci->hli.btnit[n].left == 0);
- CHECK_VALUE(pci->hli.btnit[n].right == 0);
- for (k = 0; k < 8; k++)
- CHECK_VALUE(pci->hli.btnit[n].cmd.bytes[k] == 0); /* CHECK_ZERO? */
+ int k;
+ CHECK_VALUE(pci->hli.btnit[n].btn_coln == 0);
+ CHECK_VALUE(pci->hli.btnit[n].auto_action_mode == 0);
+ CHECK_VALUE(pci->hli.btnit[n].x_start == 0);
+ CHECK_VALUE(pci->hli.btnit[n].y_start == 0);
+ CHECK_VALUE(pci->hli.btnit[n].x_end == 0);
+ CHECK_VALUE(pci->hli.btnit[n].y_end == 0);
+ CHECK_VALUE(pci->hli.btnit[n].up == 0);
+ CHECK_VALUE(pci->hli.btnit[n].down == 0);
+ CHECK_VALUE(pci->hli.btnit[n].left == 0);
+ CHECK_VALUE(pci->hli.btnit[n].right == 0);
+ for (k = 0; k < 8; k++)
+ CHECK_VALUE(pci->hli.btnit[n].cmd.bytes[k] == 0); /* CHECK_ZERO? */
}
}
}
1
0
Hello list,
So as a status update to my progress.
I think my patching is probably quite different from your average
libdvdread user, so there would probably too much work to include them
in mplayers repository. But they are all available on my public CVS
should someone else be seeking the same information.
I have found the following patches needed;
1. Back-ported the DVDFileStat() functions so I can get VOB filesizes
more easily.
2. Added ExtFileInfo (262) support for UDF2.50
3. Added Filetype 250, which seems to be a homegrown re-direct block,
this enables libdvdread to process UDF2.50 images.
4. Unfortunately, libdvdread developers cheated an used "struct AD" both
for AD use, and to carry back file-size information. AD's Location
(number of blocks) is correctly 32bits, but filesizes in UDF are 64bit.
Since DVD images are always <= 1GB, this has not been a problem so far.
I updated "struct AD" to also have a 64bit value for filesize, which is
not the correct solution, but the one with the least changes.
5. Unfortunately, libdvdread developers cheated when reading AD's from
FileInfo data. It will parse them all, and return the last one found.
Again, because DVDs are <= 1GB, there is only one AD chained and hence,
no problem. For UDF2.50, and larger files, I needed extra patching to
fetch the correct chain. Not entirely sure how best to fix this yet.
6. Since I can't really parse BD-ISO with "domain, title, part", I
implemented opendir/readdir/closedir API functions. I used POSIX
extension dt_type for quick type testing, and hacked in dt_filesize to
save on stat() API calls. But perhaps, stat() should also be implemented.
7. Added DVDOpenFilename() to allow opening of a direct filename instead
of "domain, title, part".
8. DVDFileSize() will return very strange values, and I find it hard to
believe that it will ever return the correct number. (Generally only
used for .IFO files). Anyone actually used it?
9. Added dvd_input methods for popen()ing "unrar" allowing for direct
ISO access inside RAR storage container.
That is all for now.
Lund
--
Jorgen Lundman | <lundman(a)lundman.net>
Unix Administrator | +81 (0)3 -5456-2687 ext 1017 (work)
Shibuya-ku, Tokyo | +81 (0)90-5578-8500 (cell)
Japan | +81 (0)3 -3375-1767 (home)
4
8