Author: tack
Date: Thu Dec 28 17:00:52 2006
New Revision: 2292
Modified:
trunk/metadata/src/video/asf.py
trunk/metadata/src/video/core.py
trunk/metadata/src/video/mkv.py
trunk/metadata/src/video/real.py
Log:
Make mkv parser more robust with broken files; length property should be
float, not int.
Modified: trunk/metadata/src/video/asf.py
==============================================================================
--- trunk/metadata/src/video/asf.py (original)
+++ trunk/metadata/src/video/asf.py Thu Dec 28 17:00:52 2006
@@ -247,7 +247,7 @@
(fileid, size, date, packetcount, duration, \
senddur, preroll, flags, minpack, maxpack, maxbr) = \
val
- self.length = duration/10000000
+ self.length = duration/10000000.0
elif guid == GUIDS['ASF_Stream_Properties_Object']:
log.debug("Stream Properties Object [%d]" % objsize)
Modified: trunk/metadata/src/video/core.py
==============================================================================
--- trunk/metadata/src/video/core.py (original)
+++ trunk/metadata/src/video/core.py Thu Dec 28 17:00:52 2006
@@ -101,4 +101,4 @@
self.length = self.video[0].length
for container in [ self ] + self.video + self.audio:
if container.length:
- container.length = int(container.length)
+ container.length = container.length
Modified: trunk/metadata/src/video/mkv.py
==============================================================================
--- trunk/metadata/src/video/mkv.py (original)
+++ trunk/metadata/src/video/mkv.py Thu Dec 28 17:00:52 2006
@@ -170,10 +170,10 @@
def compute_id(self, inbuf):
+ self.id_len = 0
if len(inbuf) < 1:
return 0
first = ord(inbuf[0])
- self.id_len = 0
if first & 0x80:
self.id_len = 1
self.entity_id = first
@@ -361,7 +361,11 @@
elif sub_elem.get_id() == MATROSKA_SEEK_POSITION_ID:
self.file.seek(self.segment.offset + sub_elem.get_value())
buffer = self.file.read(100)
- elem = EbmlEntity(buffer)
+ try:
+ elem = EbmlEntity(buffer)
+ except core.ParseError:
+ continue
+
# Fetch all data necessary for this element.
elem.add_data(self.file.read(elem.ebml_length))
self.process_elem(elem)
Modified: trunk/metadata/src/video/real.py
==============================================================================
--- trunk/metadata/src/video/real.py (original)
+++ trunk/metadata/src/video/real.py Thu Dec 28 17:00:52 2006
@@ -71,7 +71,7 @@
if object_id == 'MDPR':
mdpr = struct.unpack('>H7I', s[:30])
log.debug(mdpr)
- self.length = mdpr[7]/1000
+ self.length = mdpr[7]/1000.0
(stream_name_size,) = struct.unpack('>B', s[30:31])
stream_name = s[31:31+stream_name_size]
pos = 31+stream_name_size
-------------------------------------------------------------------------
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