gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/rtmp r9575: Support onMetaData the way lib


From: rob
Subject: [Gnash-commit] /srv/bzr/gnash/rtmp r9575: Support onMetaData the way libmedia/FLVParser wants it, which is missing
Date: Thu, 07 Aug 2008 22:39:08 -0600
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9575
committer: address@hidden
branch nick: rtmp
timestamp: Thu 2008-08-07 22:39:08 -0600
message:
  Support onMetaData the way libmedia/FLVParser wants it, which is missing
  the type field. So we cheat, and if the onMetaData string is found, we assume
  it's ok to not have a type field after all.
modified:
  libamf/amf.cpp
  libamf/flv.cpp
  testsuite/libamf.all/test_flv.cpp
=== modified file 'libamf/amf.cpp'
--- a/libamf/amf.cpp    2008-08-05 16:08:09 +0000
+++ b/libamf/amf.cpp    2008-08-08 04:39:08 +0000
@@ -857,7 +857,7 @@
     // sanity check the length of the data. The length is usually only zero if
     // we've gone all the way to the end of the object.
 
-    // valrind comlains length is unintialized, which as we just set
+    // valgrind complains if length is unintialized, which as we just set
     // length to a value, this is tottaly bogus, and I'm tired of
     // braindamaging code to keep valgrind happy.
     if (length <= 0) {

=== modified file 'libamf/flv.cpp'
--- a/libamf/flv.cpp    2008-08-08 02:16:19 +0000
+++ b/libamf/flv.cpp    2008-08-08 04:39:08 +0000
@@ -142,21 +142,38 @@
     AMF amf;
     Network::byte_t *ptr = buf;
     Network::byte_t *tooFar = ptr + size;
-
+    const char *name = 0;
+    
     // Extract the onMetaData object name
-    Element *name = amf.extractAMF(ptr, tooFar);
-    if (name == 0) {
-        log_error("Failed to get the onMetaData string");
-        return 0;
+    // In disk files, I always see the 0x2 type field for
+    // a string, but not always in streaming, at leat according to
+    // Gnash's libmedia/FLVParser code. So if we see the begining
+    // of "onMetaData", then just grab the length without the type
+    // field.
+    if ((*ptr == 0) && (*ptr+3 == 'o')) {
+       boost::uint32_t length;
+       length = convert24(ptr);
+       ptr += 3;               // the size is a 24bit integer
+       name = new char(length);
+       std::copy(name, name + length, ptr);
+       ptr += length + 3;
+    } else {   
+       Element *objname = amf.extractAMF(ptr, tooFar);
+       if (objname == 0) {
+           log_error("Failed to get the onMetaData string");
+           return 0;
+       }
+       ptr += objname->getLength() + AMF_HEADER_SIZE;
+       name = objname->to_string();
     }
-    ptr += name->getLength() + AMF_HEADER_SIZE;
+    
     
     // Extract the properties for this metadata object.
     Element *el = amf.extractAMF(ptr, tooFar);
     ptr += amf.totalsize();
 
     if (name) {
-        el->setName(name->to_string());
+        el->setName(name);
     }
 
     return el;

=== modified file 'testsuite/libamf.all/test_flv.cpp'
--- a/testsuite/libamf.all/test_flv.cpp 2008-08-08 00:35:57 +0000
+++ b/testsuite/libamf.all/test_flv.cpp 2008-08-08 04:39:08 +0000
@@ -165,7 +165,7 @@
 // 02 00 0a 6f 6e 4d 65 74 61 44 61 74 61              <--- onMetaData
 // 08 00 00 00 00
 //  00 08 64 75 72 61 74 69 6f 6e                      duration
-//      00 40 6d 6e 24 dd 2f 1a a0
+//     00 40 6d 6e 24 dd 2f 1a a0
 //  00 0c 76 69 64 65 6f 63 6f 64 65 63 69 64  videocodecid
 //     00 40 00 00 00 00 00 00 00
 //  00 0c 61 75 64 69 6f 63 6f 64 65 63 69 64  audiocodecid


reply via email to

[Prev in Thread] Current Thread [Next in Thread]