Author: dmeyer
Date: Wed Dec  6 21:56:28 2006
New Revision: 2165

Modified:
   trunk/metadata/src/disc/dvdinfo.py
   trunk/metadata/src/disc/ifomodule.c
   trunk/metadata/src/fourcc.py
   trunk/metadata/src/mediainfo.py

Log:
use fourcc codes for dvd audio

Modified: trunk/metadata/src/disc/dvdinfo.py
==============================================================================
--- trunk/metadata/src/disc/dvdinfo.py  (original)
+++ trunk/metadata/src/disc/dvdinfo.py  Wed Dec  6 21:56:28 2006
@@ -61,11 +61,14 @@
         self.height = _video_height[data[5]]
 
 class DVDAudio(mediainfo.AudioInfo):
+
+    _keys = mediainfo.AudioInfo._keys + [ 'id' ]
+
     def __init__(self, pos, info):
         mediainfo.AudioInfo.__init__(self)
         self.id = 128 + pos
         self.language, self.codec, self.channels, self.samplerate = info
-        if self.codec == 'dts':
+        if self.codec == '0x2001':      # DTS
             # dts uses the same counter as ac3 but is always +8
             self.id += 8
 
@@ -87,7 +90,7 @@
             self.audio.append(DVDAudio(pos, a))
 
         for pos, s in enumerate(info[-1]):
-            self.subtitles.append(s)
+            self.subtitles.append(mediainfo.SubtitleInfo(s))
 
 
 class DVDInfo(DiscInfo):

Modified: trunk/metadata/src/disc/ifomodule.c
==============================================================================
--- trunk/metadata/src/disc/ifomodule.c (original)
+++ trunk/metadata/src/disc/ifomodule.c Wed Dec  6 21:56:28 2006
@@ -49,7 +49,7 @@
 #include <dvdread/ifo_read.h>
 
 static PyObject * ifoinfo_get_audio_tracks(ifo_handle_t *vtsfile, int id) {
-    char audioformat[10];
+    char audioformat[7];
     char audiolang[5];
     int audiochannels;
     int audiofreq;
@@ -76,28 +76,22 @@
     /* audio format */
     switch (attr->audio_format) {
     case 0:
-        snprintf(audioformat, 10, "ac3");
-        break;
-    case 1:
-        snprintf(audioformat, 10, "N/A");
+        snprintf(audioformat, 7, "0x2000");
         break;
     case 2:
-        snprintf(audioformat, 10, "mpeg1");
+        snprintf(audioformat, 7, "0x0050");
         break;
     case 3:
-        snprintf(audioformat, 10, "mpeg2ext");
+        snprintf(audioformat, 5, "MP2A");
         break;
     case 4:
-        snprintf(audioformat, 10, "lpcm");
-        break;
-    case 5:
-        snprintf(audioformat, 10, "N/A");
+        snprintf(audioformat, 7, "0x0001");
         break;
     case 6:
-        snprintf(audioformat, 10, "dts");
+        snprintf(audioformat, 7, "0x2001");
         break;
     default:
-        snprintf(audioformat, 10, "N/A");
+        snprintf(audioformat, 7, "%02x%02x", 0, 0);
     }
 
     switch (attr->lang_type) {

Modified: trunk/metadata/src/fourcc.py
==============================================================================
--- trunk/metadata/src/fourcc.py        (original)
+++ trunk/metadata/src/fourcc.py        Wed Dec  6 21:56:28 2006
@@ -4,6 +4,8 @@
     """
     Transform a twocc or fourcc code into a name.
     """
+    if isinstance(code, str) and code.startswith('0x'):
+        code = int(code[2:], 16)
     if isinstance(code, (int, long)):
         if code in TWOCC:
             return u'0x%04x' % code, unicode(TWOCC[code])
@@ -69,7 +71,7 @@
     0x0042: 'MSG723',
     0x0043: 'IBM AVC ADPCM',
     0x0045: 'ITU-T G.726 ADPCM',
-    0x0050: 'MPEG',
+    0x0050: 'MPEG 1, Layer 1,2',
     0x0052: 'RT24',
     0x0053: 'PAC',
     0x0055: 'MPEG Layer 3',

Modified: trunk/metadata/src/mediainfo.py
==============================================================================
--- trunk/metadata/src/mediainfo.py     (original)
+++ trunk/metadata/src/mediainfo.py     Wed Dec  6 21:56:28 2006
@@ -347,7 +347,11 @@
     _keys = ['language', 'trackno', 'title']
     media = 'subtitle'
 
+    def __init__(self, language=None):
+        MediaInfo.__init__(self)
+        self.language = language
 
+        
 class AVInfo(MediaInfo):
     """
     Container for Audio and Video streams. This is the Container Type for

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to