[matroska] r809 - in trunk/DvdMenuXtractor/libdvdread: dvdread win32

[email protected]
Newsgroups gmane.comp.multimedia.matroska.cvs
Message-ID <[email protected]>
Author: robux4
Date: 2004-09-15 16:42:35 +0400 (Wed, 15 Sep 2004)
New Revision: 809

Modified:
   trunk/DvdMenuXtractor/libdvdread/dvdread/dvd_input.c
   trunk/DvdMenuXtractor/libdvdread/dvdread/dvd_udf.c
   trunk/DvdMenuXtractor/libdvdread/dvdread/ifo_print.c
   trunk/DvdMenuXtractor/libdvdread/dvdread/ifo_read.c
   trunk/DvdMenuXtractor/libdvdread/win32/config.h
Log:
allow rerouting of error logs

Modified: trunk/DvdMenuXtractor/libdvdread/dvdread/dvd_input.c
===================================================================
--- trunk/DvdMenuXtractor/libdvdread/dvdread/dvd_input.c	2004-09-14 21:18:06 UTC (rev 808)
+++ trunk/DvdMenuXtractor/libdvdread/dvdread/dvd_input.c	2004-09-15 12:42:35 UTC (rev 809)
@@ -80,14 +80,14 @@
   /* Allocate the handle structure */
   dev = (dvd_input_t) malloc(sizeof(struct dvd_input_s));
   if(dev == NULL) {
-    fprintf(stderr, "libdvdread: Could not allocate memory.\n");
+    LOG_ERROR( "libdvdread: Could not allocate memory.\n");
     return NULL;
   }
   
   /* Really open it with libdvdcss */
   dev->dvdcss = DVDcss_open(target);
   if(dev->dvdcss == 0) {
-    fprintf(stderr, "libdvdread: Could not open %s with libdvdcss.\n", target);
+    LOG_ERROR( "libdvdread: Could not open %s with libdvdcss.\n", target);
     free(dev);
     return NULL;
   }
@@ -160,7 +160,7 @@
   /* Allocate the library structure */
   dev = (dvd_input_t) malloc(sizeof(struct dvd_input_s));
   if(dev == NULL) {
-    fprintf(stderr, "libdvdread: Could not allocate memory.\n");
+    LOG_ERROR( "libdvdread: Could not allocate memory.\n");
     return NULL;
   }
   
@@ -310,7 +310,7 @@
     dvdcss_version = (char **)dlsym(dvdcss_library, U_S "dvdcss_interface_2");
 
     if(dlsym(dvdcss_library, U_S "dvdcss_crack")) {
-      fprintf(stderr, 
+      LOG_ERROR( 
 	      "libdvdread: Old (pre-0.0.2) version of libdvdcss found.\n"
 	      "libdvdread: You should get the latest version from "
 	      "http://www.videolan.org/\n" );
@@ -318,7 +318,7 @@
       dvdcss_library = NULL;
     } else if(!DVDcss_open  || !DVDcss_close || !DVDcss_title || !DVDcss_seek
 	      || !DVDcss_read || !DVDcss_error || !dvdcss_version) {
-      fprintf(stderr,  "libdvdread: Missing symbols in libdvdcss.so.2, "
+      LOG_ERROR( "libdvdread: Missing symbols in libdvdcss.so.2, "
 	      "this shouldn't happen !\n");
       dlclose(dvdcss_library);
     }
@@ -329,10 +329,10 @@
     /*
     char *psz_method = getenv( "DVDCSS_METHOD" );
     char *psz_verbose = getenv( "DVDCSS_VERBOSE" );
-    fprintf(stderr, "DVDCSS_METHOD %s\n", psz_method);
-    fprintf(stderr, "DVDCSS_VERBOSE %s\n", psz_verbose);
+    LOG_ERROR( "DVDCSS_METHOD %s\n", psz_method);
+    LOG_ERROR( "DVDCSS_VERBOSE %s\n", psz_verbose);
     */
-    fprintf(stderr, "libdvdread: Using libdvdcss version %s for DVD access\n",
+    LOG_ERROR( "libdvdread: Using libdvdcss version %s for DVD access\n",
 	    *dvdcss_version);
     
     /* libdvdcss wrapper functions */
@@ -345,7 +345,7 @@
     return 1;
     
   } else {
-    fprintf(stderr, "libdvdread: Encrypted DVD support unavailable.\n");
+    LOG_ERROR( "libdvdread: Encrypted DVD support unavailable.\n");
 
     /* libdvdcss replacement functions */
     dvdinput_open  = file_open;

Modified: trunk/DvdMenuXtractor/libdvdread/dvdread/dvd_udf.c
===================================================================
--- trunk/DvdMenuXtractor/libdvdread/dvdread/dvd_udf.c	2004-09-14 21:18:06 UTC (rev 808)
+++ trunk/DvdMenuXtractor/libdvdread/dvdread/dvd_udf.c	2004-09-15 12:42:35 UTC (rev 809)
@@ -241,7 +241,7 @@
   
   if(c == NULL) {
     c = calloc(1, sizeof(struct udf_cache));    
-    //    fprintf(stderr, "calloc: %d\n", sizeof(struct udf_cache));    
+    //    LOG_ERROR( "calloc: %d\n", sizeof(struct udf_cache));    
     if(c == NULL) {
       return 0;
     }
@@ -278,7 +278,7 @@
     c->lb_num++;
     c->lbs = realloc(c->lbs, c->lb_num * sizeof(struct lbudf));
     /*
-    fprintf(stderr, "realloc lb: %d * %d = %d\n",
+    LOG_ERROR( "realloc lb: %d * %d = %d\n",
 	    c->lb_num, sizeof(struct lbudf),
 	    c->lb_num * sizeof(struct lbudf));
     */
@@ -301,7 +301,7 @@
     c->map_num++;
     c->maps = realloc(c->maps, c->map_num * sizeof(struct icbmap));
     /*
-    fprintf(stderr, "realloc maps: %d * %d = %d\n",
+    LOG_ERROR( "realloc maps: %d * %d = %d\n",
 	    c->map_num, sizeof(struct icbmap),
 	    c->map_num * sizeof(struct icbmap));
     */
@@ -563,7 +563,7 @@
 	}
 	/*
 	if(cached_dir) {
-	  fprintf(stderr, "malloc dir: %d\n",
+	  LOG_ERROR( "malloc dir: %d\n",
 		  dir_lba * DVD_VIDEO_LB_LEN);
 	}
 	*/

Modified: trunk/DvdMenuXtractor/libdvdread/dvdread/ifo_print.c
===================================================================
--- trunk/DvdMenuXtractor/libdvdread/dvdread/ifo_print.c	2004-09-14 21:18:06 UTC (rev 808)
+++ trunk/DvdMenuXtractor/libdvdread/dvdread/ifo_print.c	2004-09-15 12:42:35 UTC (rev 809)
@@ -34,6 +34,13 @@
 #include "ifo_print.h"
 #include "dvdread_internal.h"
 
+int internal_error(const char*format, ...)
+{
+    va_list args;
+    va_start(args, format);
+	return vfprintf(stderr, format, args);
+}
+
 /* Put this in some other file / package?  It's used in nav_print too. */
 static void ifoPrint_time(dvd_time_t *dtime) {
   const char *rate;
@@ -1028,7 +1035,7 @@
 
   ifohandle = ifoOpen(dvd, title);
   if(!ifohandle) {
-    LOG_ERROR( "Can't open info file for title %d\n", title);
+    LOG_ERROR( "Can't open info file for title %d\n", title );
     return;
   }
   
@@ -1147,10 +1154,3 @@
 
   ifoClose(ifohandle);
 }
-
-int internal_error(const char*format, ...)
-{
-    va_list args;
-    va_start(args, format);
-	return vfprintf(stderr, format, args);
-}

Modified: trunk/DvdMenuXtractor/libdvdread/dvdread/ifo_read.c
===================================================================
--- trunk/DvdMenuXtractor/libdvdread/dvdread/ifo_read.c	2004-09-14 21:18:06 UTC (rev 808)
+++ trunk/DvdMenuXtractor/libdvdread/dvdread/ifo_read.c	2004-09-15 12:42:35 UTC (rev 809)
@@ -38,17 +38,17 @@
 #ifndef NDEBUG
 #define CHECK_ZERO0(arg) \
   if(arg != 0) { \
-    fprintf(stderr, "*** Zero check failed in %s:%i\n    for %s = 0x%x\n", \
+    LOG_ERROR( "*** Zero check failed in %s:%i\n    for %s = 0x%x\n", \
             __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", \
+    LOG_ERROR( "*** 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"); \
+      LOG_ERROR( "%02x", *((uint8_t *)&arg + i_CZ)); \
+    LOG_ERROR( "\n"); \
   }
 static const uint8_t my_friendly_zeros[2048];
 #else
@@ -108,20 +108,20 @@
     ifofile->file = DVDOpenFile(dvd, title, DVD_READ_INFO_BACKUP_FILE);
   if(!ifofile->file) {
     if(title) {
-      fprintf(stderr, "libdvdread: Can't open file VTS_%02d_0.IFO.\n", title);
+      LOG_ERROR( "libdvdread: Can't open file VTS_%02d_0.IFO.\n", title);
     } else {
-      fprintf(stderr, "libdvdread: Can't open file VIDEO_TS.IFO.\n");
+      LOG_ERROR( "libdvdread: Can't open file VIDEO_TS.IFO.\n");
     }
     free(ifofile);
     return 0;
   }
-
+
   /* First check if this is a VMGI file. */
   if(ifoRead_VMG(ifofile)) {
 
     /* These are both mandatory. */
     if(!ifoRead_FP_PGC(ifofile) || !ifoRead_TT_SRPT(ifofile)) {
-      fprintf(stderr, "libdvdread: Invalid main menu IFO (VIDEO_TS.IFO).\n");
+      LOG_ERROR( "libdvdread: Invalid main menu IFO (VIDEO_TS.IFO).\n");
       ifoClose(ifofile);
       return 0;
     }
@@ -131,7 +131,7 @@
 
     /* This is also mandatory. */
     if(!ifoRead_VTS_ATRT(ifofile)) {
-      fprintf(stderr, "libdvdread: Invalid main menu IFO (VIDEO_TS.IFO).\n");
+      LOG_ERROR( "libdvdread: Invalid main menu IFO (VIDEO_TS.IFO).\n");
       ifoClose(ifofile);
       return 0;
     }
@@ -146,7 +146,7 @@
   if(ifoRead_VTS(ifofile)) {
 
     if(!ifoRead_VTS_PTT_SRPT(ifofile) || !ifoRead_PGCIT(ifofile)) {
-      fprintf(stderr, "libdvdread: Invalid title IFO (VTS_%02d_0.IFO).\n",
+      LOG_ERROR( "libdvdread: Invalid title IFO (VTS_%02d_0.IFO).\n",
               title);
       ifoClose(ifofile);
       return 0;
@@ -159,7 +159,7 @@
     ifoRead_VOBU_ADMAP(ifofile);
 
     if(!ifoRead_TITLE_C_ADT(ifofile) || !ifoRead_TITLE_VOBU_ADMAP(ifofile)) {
-      fprintf(stderr, "libdvdread: Invalid title IFO (VTS_%02d_0.IFO).\n",
+      LOG_ERROR( "libdvdread: Invalid title IFO (VTS_%02d_0.IFO).\n",
               title);
       ifoClose(ifofile);
       return 0;
@@ -169,10 +169,10 @@
   }
 
   if(title) {
-    fprintf(stderr, "libdvdread: Invalid IFO for title %d (VTS_%02d_0.IFO).\n",
+    LOG_ERROR( "libdvdread: Invalid IFO for title %d (VTS_%02d_0.IFO).\n",
 	    title, title);
   } else {
-    fprintf(stderr, "libdvdread: Invalid IFO for VMGM (VIDEO_TS.IFO).\n");
+    LOG_ERROR( "libdvdread: Invalid IFO for VMGM (VIDEO_TS.IFO).\n");
   }
   ifoClose(ifofile);
   return 0;
@@ -192,7 +192,7 @@
   if(!ifofile->file) /* Should really catch any error and try to fallback */
     ifofile->file = DVDOpenFile(dvd, 0, DVD_READ_INFO_BACKUP_FILE);
   if(!ifofile->file) {
-    fprintf(stderr, "libdvdread: Can't open file VIDEO_TS.IFO.\n");
+    LOG_ERROR( "libdvdread: Can't open file VIDEO_TS.IFO.\n");
     free(ifofile);
     return 0;
   }
@@ -200,7 +200,7 @@
   if(ifoRead_VMG(ifofile))
     return ifofile;
 
-  fprintf(stderr, "libdvdread: Invalid main menu IFO (VIDEO_TS.IFO).\n");
+  LOG_ERROR( "libdvdread: Invalid main menu IFO (VIDEO_TS.IFO).\n");
   ifoClose(ifofile);
   return 0;
 }
@@ -216,7 +216,7 @@
   memset(ifofile, 0, sizeof(ifo_handle_t));
   
   if(title <= 0 || title > 99) {
-    fprintf(stderr, "libdvdread: ifoOpenVTSI invalid title (%d).\n", title);
+    LOG_ERROR( "libdvdread: ifoOpenVTSI invalid title (%d).\n", title);
     free(ifofile);
     return 0;
   }
@@ -225,7 +225,7 @@
   if(!ifofile->file) /* Should really catch any error and try to fallback */
     ifofile->file = DVDOpenFile(dvd, title, DVD_READ_INFO_BACKUP_FILE);
   if(!ifofile->file) {
-    fprintf(stderr, "libdvdread: Can't open file VTS_%02d_0.IFO.\n", title);
+    LOG_ERROR( "libdvdread: Can't open file VTS_%02d_0.IFO.\n", title);
     free(ifofile);
     return 0;
   }
@@ -234,7 +234,7 @@
   if(ifofile->vtsi_mat)
     return ifofile;
 
-  fprintf(stderr, "libdvdread: Invalid IFO for title %d (VTS_%02d_0.IFO).\n",
+  LOG_ERROR( "libdvdread: Invalid IFO for title %d (VTS_%02d_0.IFO).\n",
           title, title);
   ifoClose(ifofile);
   return 0;
@@ -813,7 +813,7 @@
   ifofile->tt_srpt = tt_srpt;
   
   if(!(DVDReadBytes(ifofile->file, tt_srpt, TT_SRPT_SIZE))) {
-    fprintf(stderr, "libdvdread: Unable to read read TT_SRPT.\n");
+    LOG_ERROR( "libdvdread: Unable to read read TT_SRPT.\n");
     free(tt_srpt);
     return 0;
   }
@@ -830,7 +830,7 @@
     return 0;
   }
   if(!(DVDReadBytes(ifofile->file, tt_srpt->title, info_length))) {
-    fprintf(stderr, "libdvdread: Unable to read read TT_SRPT.\n");
+    LOG_ERROR( "libdvdread: Unable to read read TT_SRPT.\n");
     ifoFree_TT_SRPT(ifofile);
     return 0;
   }
@@ -867,7 +867,7 @@
             tt_srpt->nr_of_srpts * sizeof(title_info_t), 
             my_friendly_zeros, 
             info_length - tt_srpt->nr_of_srpts * sizeof(title_info_t))) {
-    fprintf(stderr, "VMG_PTT_SRPT slack is != 0, ");
+    LOG_ERROR( "VMG_PTT_SRPT slack is != 0, ");
     hexdump((uint8_t *)tt_srpt->title + 
             tt_srpt->nr_of_srpts * sizeof(title_info_t), 
             info_length - tt_srpt->nr_of_srpts * sizeof(title_info_t));
@@ -915,7 +915,7 @@
   ifofile->vts_ptt_srpt = vts_ptt_srpt;
 
   if(!(DVDReadBytes(ifofile->file, vts_ptt_srpt, VTS_PTT_SRPT_SIZE))) {
-    fprintf(stderr, "libdvdread: Unable to read PTT search table.\n");
+    LOG_ERROR( "libdvdread: Unable to read PTT search table.\n");
     free(vts_ptt_srpt);
     return 0;
   }
@@ -936,7 +936,7 @@
     return 0;
   }
   if(!(DVDReadBytes(ifofile->file, data, info_length))) {
-    fprintf(stderr, "libdvdread: Unable to read PTT search table.\n");
+    LOG_ERROR( "libdvdread: Unable to read PTT search table.\n");
     free(vts_ptt_srpt);
     free(data);
     ifofile->vts_ptt_srpt = 0;
@@ -1080,7 +1080,7 @@
   
   for(i = 0; i < ptl_mait->nr_of_countries; i++) {
     if(!(DVDReadBytes(ifofile->file, &ptl_mait->countries[i], PTL_MAIT_COUNTRY_SIZE))) {
-      fprintf(stderr, "libdvdread: Unable to read PTL_MAIT.\n");
+      LOG_ERROR( "libdvdread: Unable to read PTL_MAIT.\n");
       free(ptl_mait->countries);
       free(ptl_mait);
       ifofile->ptl_mait = 0;
@@ -1106,7 +1106,7 @@
     if(!DVDFileSeek_(ifofile->file, 
 		     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");
+      LOG_ERROR( "libdvdread: Unable to seak PTL_MAIT table.\n");
       free(ptl_mait->countries);
       free(ptl_mait);
       return 0;
@@ -1122,7 +1122,7 @@
       return 0;
     }
     if(!(DVDReadBytes(ifofile->file, pf_temp, info_length))) {
-       fprintf(stderr, "libdvdread: Unable to read PTL_MAIT table.\n");
+       LOG_ERROR( "libdvdread: Unable to read PTL_MAIT table.\n");
        free(pf_temp);
        for(j = 0; j < i ; j++) {
 	  free(ptl_mait->countries[j].pf_ptl_mai);
@@ -1205,7 +1205,7 @@
   ifofile->vts_tmapt = vts_tmapt;
   
   if(!(DVDReadBytes(ifofile->file, vts_tmapt, VTS_TMAPT_SIZE))) {
-    fprintf(stderr, "libdvdread: Unable to read VTS_TMAPT.\n");
+    LOG_ERROR( "libdvdread: Unable to read VTS_TMAPT.\n");
     free(vts_tmapt);
     ifofile->vts_tmapt = NULL;
     return 0;
@@ -1228,7 +1228,7 @@
   vts_tmapt->tmap_offset = vts_tmap_srp;
   
   if(!(DVDReadBytes(ifofile->file, vts_tmap_srp, info_length))) {
-    fprintf(stderr, "libdvdread: Unable to read VTS_TMAPT.\n");
+    LOG_ERROR( "libdvdread: Unable to read VTS_TMAPT.\n");
     free(vts_tmap_srp);
     free(vts_tmapt);
     ifofile->vts_tmapt = NULL;
@@ -1259,7 +1259,7 @@
     }
 
     if(!(DVDReadBytes(ifofile->file, &vts_tmapt->tmap[i], VTS_TMAP_SIZE))) {
-      fprintf(stderr, "libdvdread: Unable to read VTS_TMAP.\n");
+      LOG_ERROR( "libdvdread: Unable to read VTS_TMAP.\n");
       ifoFree_VTS_TMAPT(ifofile);
       return 0;
     }
@@ -1281,7 +1281,7 @@
     }
 
     if(!(DVDReadBytes(ifofile->file, vts_tmapt->tmap[i].map_ent, info_length))) {
-      fprintf(stderr, "libdvdread: Unable to read VTS_TMAP_ENT.\n");
+      LOG_ERROR( "libdvdread: Unable to read VTS_TMAP_ENT.\n");
       ifoFree_VTS_TMAPT(ifofile);
       return 0;
     }
@@ -1392,7 +1392,7 @@
      Enemy of the State region 2 (de) has Titles where nr_of_vobs field
      is to high, they high ones are never referenced though. */
   if(info_length / sizeof(cell_adr_t) < c_adt->nr_of_vobs) {
-    fprintf(stderr, "libdvdread: *C_ADT nr_of_vobs > avaiable info entries\n");
+    LOG_ERROR( "libdvdread: *C_ADT nr_of_vobs > avaiable info entries\n");
     c_adt->nr_of_vobs = info_length / sizeof(cell_adr_t);
   }
   
@@ -2000,13 +2000,13 @@
   ifofile->txtdt_mgi = txtdt_mgi;
 
   if(!(DVDReadBytes(ifofile->file, txtdt_mgi, TXTDT_MGI_SIZE))) {
-    fprintf(stderr, "libdvdread: Unable to read TXTDT_MGI.\n");
+    LOG_ERROR( "libdvdread: Unable to read TXTDT_MGI.\n");
     free(txtdt_mgi);
     ifofile->txtdt_mgi = 0;
     return 0;
   }
 
-  // fprintf(stderr, "-- Not done yet --\n");
+  // LOG_ERROR( "-- Not done yet --\n");
   return 1;
 }
 

Modified: trunk/DvdMenuXtractor/libdvdread/win32/config.h
===================================================================
--- trunk/DvdMenuXtractor/libdvdread/win32/config.h	2004-09-14 21:18:06 UTC (rev 808)
+++ trunk/DvdMenuXtractor/libdvdread/win32/config.h	2004-09-15 12:42:35 UTC (rev 809)
@@ -106,7 +106,9 @@
 /* Define to `unsigned' if <sys/types.h> does not define. */
 /* #undef size_t */
 
-#define PATH_MAX 512
+#define _POSIX_ /* for PATH_MAX */
+#include <limits.h>
+#undef _POSIX_
 
 #ifndef LOG_ERROR
 #define LOG_ERROR internal_error
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.