gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/rtmp r9834: merge in upstream changes.


From: rob
Subject: [Gnash-commit] /srv/bzr/gnash/rtmp r9834: merge in upstream changes.
Date: Sun, 14 Dec 2008 21:03:10 -0700
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9834
committer: address@hidden
branch nick: rtmp
timestamp: Sun 2008-12-14 21:03:10 -0700
message:
  merge in upstream changes.
modified:
  .bzrignore
  TODO
  testsuite/check.h
  testsuite/libamf.all/test_amf.cpp
  utilities/rtmpget.cpp
    ------------------------------------------------------------
    revno: 9828.1.1
    committer: Sandro Santilli <address@hidden>
    branch nick: rtmp
    timestamp: Mon 2008-12-08 21:53:36 +0100
    message:
      add IO redesign on the TODO list (more a commit mail hook test then 
anything else)
    modified:
      TODO
    ------------------------------------------------------------
    revno: 9828.1.2
    committer: Sandro Santilli <address@hidden>
    branch nick: rtmp
    timestamp: Tue 2008-12-09 11:41:06 +0100
    message:
      Fix extraction of appname from url (should be 'oflaDemo' from 
rtmp://localhost/oflaDemo/DarkKnight)
    modified:
      utilities/rtmpget.cpp
    ------------------------------------------------------------
    revno: 9828.1.3
    committer: Sandro Santilli <address@hidden>
    branch nick: rtmp
    timestamp: Tue 2008-12-09 16:13:55 +0100
    message:
      add unresolved method to the custom TestState class
    modified:
      testsuite/check.h
    ------------------------------------------------------------
    revno: 9828.1.4
    committer: Sandro Santilli <address@hidden>
    branch nick: rtmp
    timestamp: Tue 2008-12-09 16:42:49 +0100
    message:
      Test encoding elements of type string. More tests to add, switched to use 
testsuite/check.h which gives more information on failure.
    modified:
      testsuite/libamf.all/test_amf.cpp
    ------------------------------------------------------------
    revno: 9828.1.5
    committer: Sandro Santilli <address@hidden>
    branch nick: rtmp
    timestamp: Fri 2008-12-12 17:57:22 +0100
    message:
      ignores
    modified:
      .bzrignore
=== modified file '.bzrignore'
--- a/.bzrignore        2008-11-18 19:55:56 +0000
+++ b/.bzrignore        2008-12-12 16:57:22 +0000
@@ -316,3 +316,18 @@
 testsuite/misc-ming.all/loadImageTest
 utilities/rtmpget
 testsuite/libnet.all/test_diskstream
+testsuite/misc-ming.all/LoadVarsTestRunner
+testsuite/misc-ming.all/EmbeddedSoundTest-Runner
+testsuite/misc-ming.all/DepthLimitsTestrunner
+testsuite/misc-haxe.all/site.bak
+testsuite/misc-ming.all/site.bak
+testsuite/misc-mtasc.all/site.bak
+testsuite/misc-swfc.all/site.bak
+testsuite/misc-swfmill.all/site.bak
+testsuite/movies.all/site.bak
+testsuite/samples/site.bak
+testsuite/libcore.all/site.bak
+testsuite/libbase/site.bak
+testsuite/actionscript.all/site.bak
+testsuite/libamf.all/site.bak
+testsuite/libnet.all/generate_amfbins

=== modified file 'TODO'
--- a/TODO      2008-09-30 21:55:37 +0000
+++ b/TODO      2008-12-08 20:53:36 +0000
@@ -5,6 +5,7 @@
     for blend modes and bitmap filters.
   - SWF 9 / AVM2 support.
   - RTMP support.
+  - IO redesign.
   - Performance improvements, and reducing the footprint.
   - Custom ActionScript plugins (think MySQL support in Flash).
   - Implement all the missing player classes/methods.

=== modified file 'testsuite/check.h'
--- a/testsuite/check.h 2008-01-21 23:26:48 +0000
+++ b/testsuite/check.h 2008-12-09 15:13:55 +0000
@@ -25,6 +25,7 @@
   void xpass(std::string s) { std::cout << "XPASSED: " << s << std::endl;  };
   void fail(std::string s) { std::cout << "FAILED: " << s << std::endl;  };
   void xfail(std::string s) { std::cout << "XFAILED: " << s << std::endl;  };
+  void unresolved(std::string s) { std::cout << "UNRESOLVED: " << s << 
std::endl;  };
 };
 
 #define info(x) { printf("NOTE: "); printf x; putchar('\n'); }

=== modified file 'testsuite/libamf.all/test_amf.cpp'
--- a/testsuite/libamf.all/test_amf.cpp 2008-09-22 22:56:11 +0000
+++ b/testsuite/libamf.all/test_amf.cpp 2008-12-09 15:42:49 +0000
@@ -34,7 +34,8 @@
 #include <boost/shared_ptr.hpp>
 
 #include "GnashException.h"
-#include "dejagnu.h"
+#include "check.h"
+//#include "dejagnu.h"
 #include "as_object.h"
 #include "arg_parser.h"
 #include "amf.h"
@@ -66,7 +67,7 @@
 Memory *mem = 0;
 #endif
 
-TestState runtest;
+TestState& runtest=_runtest;
 LogFile& dbglogfile = LogFile::getDefaultInstance();
 RcInitFile& rcfile = RcInitFile::getDefaultInstance();
 
@@ -183,81 +184,93 @@
     
     // Encode a boolean. Although we know a bool is only one character, for 
AMF,
     // it's actually a two byte short instead.
-    bool flag = true;
-    boost::shared_ptr<Buffer> buf2(new Buffer("01 01"));
-    boost::uint16_t sht = *(boost::uint16_t *)buf2->reference();
-    swapBytes(&sht, sizeof(boost::uint16_t)); // we always encode in big 
endian format
+    {
+        bool flag = true;
+        boost::shared_ptr<Buffer> buf2(new Buffer("01 01"));
+        boost::uint16_t sht = *(boost::uint16_t *)buf2->reference();
+        swapBytes(&sht, sizeof(boost::uint16_t)); // we always encode in big 
endian format
 #if defined(HAVE_MALLINFO) && defined(USE_STATS_MEMORY)
-    if (memdebug) {
-        mem->addStats(__LINE__);             // take a sample
-    }
+        if (memdebug) {
+            mem->addStats(__LINE__);             // take a sample
+        }
 #endif
-    boost::shared_ptr<Buffer> encbool = AMF::encodeBoolean(flag);
+        boost::shared_ptr<Buffer> encbool = AMF::encodeBoolean(flag);
 #if defined(HAVE_MALLINFO) && defined(USE_STATS_MEMORY)
-    if (memdebug) {
-        mem->addStats(__LINE__);             // take a sample
-    }
+        if (memdebug) {
+            mem->addStats(__LINE__);             // take a sample
+        }
 #endif
     
-    // A boolean AMF object has only one header byte, which is the type field.
-    // AMF3 changes this to being two different type, FALSE & TRUE
-    // which are finally only one byte apiece.
-    if ((*encbool->reference() == Element::BOOLEAN_AMF0) &&
-        (encbool->size() == 2) &&
-        (memcmp(buf2->reference(), encbool->reference(), 
sizeof(boost::uint16_t)) == 0)) {
-        runtest.pass("Encoded AMF Boolean");
-    } else {
-        runtest.fail("Encoded AMF Boolean");
+        // A boolean AMF object has only one header byte, which is the type 
field.
+        // AMF3 changes this to being two different type, FALSE & TRUE
+        // which are finally only one byte apiece.
+        if ((*encbool->reference() == Element::BOOLEAN_AMF0) &&
+            (encbool->size() == 2) &&
+            (memcmp(buf2->reference(), encbool->reference(), 
sizeof(boost::uint16_t)) == 0)) {
+            runtest.pass("Encoded AMF Boolean");
+        } else {
+            runtest.fail("Encoded AMF Boolean");
+        }
     }
-//     delete buf2;
-//     delete encbool;
     
     // Encode a String.
-    string str = "Jerry Garcia rules";
-#if defined(HAVE_MALLINFO) && defined(USE_STATS_MEMORY)
-    if (memdebug) {
-        mem->addStats(__LINE__);             // take a sample
-    }
-#endif
-    boost::shared_ptr<Buffer> encstr = AMF::encodeString(str);
-#if defined(HAVE_MALLINFO) && defined(USE_STATS_MEMORY)
-    if (memdebug) {
-        mem->addStats(__LINE__);             // take a sample
-    }
-#endif
+    {
+        string str = "Jerry Garcia rules";
+#if defined(HAVE_MALLINFO) && defined(USE_STATS_MEMORY)
+        if (memdebug) {
+            mem->addStats(__LINE__);             // take a sample
+        }
+#endif
+        boost::shared_ptr<Buffer> buf = AMF::encodeString(str);
+#if defined(HAVE_MALLINFO) && defined(USE_STATS_MEMORY)
+        if (memdebug) {
+            mem->addStats(__LINE__);             // take a sample
+        }
+#endif
+        check_equals(*buf->reference(), Element::STRING_AMF0);
+        check_equals(buf->size(), str.size()+AMF_HEADER_SIZE);
+        // A String AMF object has a 3 bytes head, the type, and a two byte 
length.
+        check((memcmp(buf->reference() + 3, str.c_str(), str.size()) == 0));
 
-    // A String AMF object has a 3 bytes head, the type, and a two byte length.
-    if ((*encstr->reference() == Element::STRING_AMF0) &&
-        (encstr->size() == str.size() + AMF_HEADER_SIZE) &&
-        (memcmp(encstr->reference() + 3, str.c_str(), str.size()) == 0)) {
-        runtest.pass("Encoded AMF String");
-    } else {
-        runtest.fail("Encoded AMF String");
+        Element el(str);
+        buf = AMF::encodeElement(el);
+        
+        check_equals(*buf->reference(), Element::STRING_AMF0);
+        check_equals(buf->size(), str.size()+AMF_HEADER_SIZE);
+        // A String AMF object has a 3 bytes head, the type, and a two byte 
length.
+        check((memcmp(buf->reference() + 3, str.c_str(), str.size()) == 0));
     }
-//    delete encstr;
     
     // Encode a NULL String.
-#if defined(HAVE_MALLINFO) && defined(USE_STATS_MEMORY)
-    if (memdebug) {
-        mem->addStats(__LINE__);             // take a sample
-    }
-#endif
-    boost::shared_ptr<Buffer> encnull = AMF::encodeNullString();
-#if defined(HAVE_MALLINFO) && defined(USE_STATS_MEMORY)
-    if (memdebug) {
-        mem->addStats(__LINE__);             // take a sample
-    }
-#endif
-    boost::uint16_t len = *(boost::uint16_t *)(encnull->reference() + 1);
-    // A NULL String AMF object has just 3 bytes, the type, and a two byte 
length, which is zero.
-    if ((*encnull->reference() == Element::STRING_AMF0) &&
-        (encnull->size() == AMF_HEADER_SIZE) && 
-        (len == 0)) {
-        runtest.pass("Encoded AMF NULL String");
-    } else {
-        runtest.fail("Encoded AMF NULL String");
-    }
-//    delete encnull;
+    {
+#if defined(HAVE_MALLINFO) && defined(USE_STATS_MEMORY)
+        if (memdebug) {
+            mem->addStats(__LINE__);             // take a sample
+        }
+#endif
+        boost::shared_ptr<Buffer> buf = AMF::encodeNullString();
+#if defined(HAVE_MALLINFO) && defined(USE_STATS_MEMORY)
+        if (memdebug) {
+            mem->addStats(__LINE__);             // take a sample
+        }
+#endif
+        boost::uint16_t len = *(boost::uint16_t *)(buf->reference() + 1);
+
+        // A NULL String AMF object has just 3 bytes, the type, and a two byte 
length, which is zero.
+        check_equals(*buf->reference(), Element::STRING_AMF0);
+        check_equals(buf->size(), (size_t)AMF_HEADER_SIZE);
+        check_equals(len, 0);
+
+        Element el;
+        el.makeNullString();
+        buf = AMF::encodeElement(el);
+        len = *(boost::uint16_t *)(buf->reference() + 1);
+
+        // A NULL String AMF object has just 3 bytes, the type, and a two byte 
length, which is zero.
+        check_equals(*buf->reference(), Element::STRING_AMF0);
+        check_equals(buf->size(), (size_t)AMF_HEADER_SIZE);
+        check_equals(len, 0);
+    }
 
 // amf::AMF::encodeECMAArray(unsigned char*, int)
 }

=== modified file 'utilities/rtmpget.cpp'
--- a/utilities/rtmpget.cpp     2008-11-29 01:43:18 +0000
+++ b/utilities/rtmpget.cpp     2008-12-09 10:41:06 +0000
@@ -277,9 +277,31 @@
         }
     }
     
-    if (app.empty()) {
+    if (app.empty())
+    {
+
         // Get the application name
+        // rtmp://localhost/application/resource
+        //                  ^^^^^^^^^^^ <-- appname is this
+        //
         app = path;
+       if ( ! filename.empty() )
+       {
+               string::size_type end = app.rfind(filename);
+               if (end != string::npos) {
+                   app = app.substr(0, end);
+               }
+       }
+
+       // drop slashes
+        string::size_type end = app.find_first_not_of('/');
+       if (end != string::npos) {
+           app = app.substr(end);
+       }
+        end = app.find_last_not_of('/');
+       if (end != string::npos) {
+           app = app.substr(0, end+1);
+       }
         
         if (!query.empty()) {
             app = path;
@@ -348,7 +370,7 @@
         log_error("Couldn't send NetConnection Connect message,");
         //exit(-1);
     }
-    
+
     // make the createStream for ID 3 encoded object
     log_debug("Sending NetStream::createStream message,");
     BufferSharedPtr buf3 = client.encodeStream(0x2);


reply via email to

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