Changeset e2f5d13ac472c338e77e5a0cb74c88f7063a7a7e

Show
Ignore:
Timestamp:
06/01/06 13:31:19 (3 years ago)
Author:
Damien Fouilleul <damienf@videolan.org>
git-committer:
Damien Fouilleul <damienf@videolan.org> 1136550679 +0000
git-parent:

[7f5244def1cb5811180e648d09d8066ac89578bf]

git-author:
Damien Fouilleul <damienf@videolan.org> 1136550679 +0000
Message:

dvdnav.patch: changed code that read DVD title to use dvdread APIs, so that WIN32 and non-unix platforms can also read it
dvdnav.c: add DVD title to meta information

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • extras/contrib/src/Patches/dvdnav.patch

    r209591e re2f5d13  
    272272  
    273273 /* 
     274@@ -126,24 +130,25 @@ 
     275 } 
     276 #endif 
     277  
     278+#include <dvdread/dvd_input.h> 
     279+ 
     280 static void dvd_read_name(char *name, const char *device) { 
     281     /* Because we are compiling with _FILE_OFFSET_BITS=64 
     282      * all off_t are 64bit. 
     283      */ 
     284     off_t off; 
     285-    int fd, i; 
     286+    dvd_input_t fd; int i; 
     287     uint8_t data[DVD_VIDEO_LB_LEN]; 
     288  
     289     /* Read DVD name */ 
     290-    fd = open(device, O_RDONLY); 
     291+    fd = dvdinput_open(device); 
     292     if (fd > 0) {  
     293-      off = lseek( fd, 32 * (off_t) DVD_VIDEO_LB_LEN, SEEK_SET ); 
     294-      if( off == ( 32 * (off_t) DVD_VIDEO_LB_LEN ) ) { 
     295-        off = read( fd, data, DVD_VIDEO_LB_LEN );  
     296-        close(fd); 
     297-        if (off == ( (off_t) DVD_VIDEO_LB_LEN )) { 
     298+      off = dvdinput_seek( fd, 16 ); 
     299+      if( off == 16 ) { 
     300+        off = dvdinput_read( fd, data, 1, DVDINPUT_NOFLAGS );  
     301+        if (off == 1 ) { 
     302           fprintf(MSG_OUT, "libdvdnav: DVD Title: "); 
     303-          for(i=25; i < 73; i++ ) { 
     304+          for(i=40; i < 73; i++ ) { 
     305             if((data[i] == 0)) break; 
     306             if((data[i] > 32) && (data[i] < 127)) { 
     307               fprintf(MSG_OUT, "%c", data[i]); 
     308@@ -151,10 +156,12 @@ 
     309               fprintf(MSG_OUT, " "); 
     310             } 
     311           } 
     312-          strncpy(name, &data[25], 48); 
     313-          name[48] = 0; 
     314+          strncpy(name, &data[40], 32); 
     315+          i=31; 
     316+          while( (i >= 0) && (name[i] <= ' ')) --i; 
     317+          name[i+1] = '\0'; 
     318           fprintf(MSG_OUT, "\nlibdvdnav: DVD Serial Number: "); 
     319-          for(i=73; i < 89; i++ ) { 
     320+          for(i=813; i < 829; i++ ) { 
     321             if((data[i] == 0)) break; 
     322             if((data[i] > 32) && (data[i] < 127)) { 
     323               fprintf(MSG_OUT, "%c", data[i]); 
     324@@ -178,7 +185,7 @@ 
     325       } else { 
     326         fprintf(MSG_OUT, "libdvdnav: Can't seek to block %u\n", 32 ); 
     327       } 
     328-      close(fd); 
     329+      dvdinput_close(fd); 
     330     } else { 
     331     fprintf(MSG_OUT, "NAME OPEN FAILED\n"); 
     332   } 
    274333--- libdvdnav/misc/dvdnav-config.in 2003-04-27 02:26:17.000000000 +0100 
    275334+++ libdvdnav.new/misc/dvdnav-config.in 2005-12-02 09:29:48.265625000 +0000 
  • modules/access/dvdnav.c

    rd57ee9c re2f5d13  
    537537            return VLC_SUCCESS; 
    538538 
     539        case DEMUX_GET_META: 
     540        { 
     541            const char *title_name = NULL; 
     542 
     543            dvdnav_get_title_string(p_sys->dvdnav, &title_name); 
     544            if( (NULL != title_name) && ('\0' != title_name[0]) ) 
     545            { 
     546                vlc_meta_t **pp_meta = (vlc_meta_t**)va_arg( args, vlc_meta_t** ); 
     547                vlc_meta_t *meta; 
     548                *pp_meta = meta = vlc_meta_New(); 
     549                vlc_meta_Add( meta, VLC_META_TITLE, title_name ); 
     550                return VLC_SUCCESS; 
     551            } 
     552            return VLC_EGENERIC; 
     553        } 
     554 
    539555        /* TODO implement others */ 
    540556        default: