gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog libamf/buffer.cpp libamf/elemen...


From: Rob Savoye
Subject: [Gnash-commit] gnash ChangeLog libamf/buffer.cpp libamf/elemen...
Date: Tue, 10 Jun 2008 01:03:22 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Rob Savoye <rsavoye>    08/06/10 01:03:21

Modified files:
        .              : ChangeLog 
        libamf         : buffer.cpp element.cpp 
        libnet         : http.cpp rtmp_client.cpp 
        testsuite/libnet.all: test_rtmp.cpp 

Log message:
                * libamf/element.cpp: Actually calculate the size of the output
                buffer when encoding AMF0 Objects.
                * libnet/rtmp_client.cpp: Add the "ObjectEncoding" property when
                creating a NetConnection object.
                * testsuite/libnet.all/test_rtmp.cpp: Add a test for creating a
                NetConnection object.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6875&r2=1.6876
http://cvs.savannah.gnu.org/viewcvs/gnash/libamf/buffer.cpp?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/libamf/element.cpp?cvsroot=gnash&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/gnash/libnet/http.cpp?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/libnet/rtmp_client.cpp?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/libnet.all/test_rtmp.cpp?cvsroot=gnash&r1=1.3&r2=1.4

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6875
retrieving revision 1.6876
diff -u -b -r1.6875 -r1.6876
--- ChangeLog   9 Jun 2008 20:53:46 -0000       1.6875
+++ ChangeLog   10 Jun 2008 01:03:20 -0000      1.6876
@@ -1,3 +1,12 @@
+2008-06-09  Rob Savoye  <address@hidden>
+
+       * libamf/element.cpp: Actually calculate the size of the output
+       buffer when encoding AMF0 Objects.
+       * libnet/rtmp_client.cpp: Add the "ObjectEncoding" property when
+       creating a NetConnection object.
+       * testsuite/libnet.all/test_rtmp.cpp: Add a test for creating a
+       NetConnection object.
+
 2008-06-09 Patrice Dumas  <pertusus at free.fr>
 
        (patch #6525)

Index: libamf/buffer.cpp
===================================================================
RCS file: /sources/gnash/gnash/libamf/buffer.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- libamf/buffer.cpp   16 May 2008 03:46:20 -0000      1.10
+++ libamf/buffer.cpp   10 Jun 2008 01:03:21 -0000      1.11
@@ -142,7 +142,7 @@
 void
 Buffer::copy(const string &str)
 {    
-    GNASH_REPORT_FUNCTION;
+//    GNASH_REPORT_FUNCTION;
     std::copy(str.begin(), str.end(), _ptr);
     _seekptr = _ptr + str.size();
 }

Index: libamf/element.cpp
===================================================================
RCS file: /sources/gnash/gnash/libamf/element.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- libamf/element.cpp  6 Jun 2008 14:21:32 -0000       1.27
+++ libamf/element.cpp  10 Jun 2008 01:03:21 -0000      1.28
@@ -398,10 +398,14 @@
 {
     GNASH_REPORT_FUNCTION;
     Buffer *buf = 0;
+    size_t size = 0;
     if (_type == Element::OBJECT_AMF0) {
        // FIXME: we probably want a better size, to avoid the other
        // appends from having to resize and copy the data all the time.
-       buf = new Buffer(300);  // FIXME: calculate a sensible size
+       for (size_t i=0; i<_properties.size(); i++) {
+           size += _properties[i]->getLength() + _properties[i]->getNameSize() 
+ AMF_VAR_HEADER_SIZE;
+       }
+       buf = new Buffer(size);
        buf->clear();           // FIXME: temporary, makes buffers cleaner in 
gdb.
        buf->append(Element::OBJECT_AMF0);
        if (_name > 0) {
@@ -426,7 +430,7 @@
                break;
            }
        }
-//     log_debug("FIXME: Terminating object");
+       log_debug("FIXME: Terminating object");
        Network::byte_t pad = 0;
        buf->append(pad);
        buf->append(pad);

Index: libnet/http.cpp
===================================================================
RCS file: /sources/gnash/gnash/libnet/http.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- libnet/http.cpp     16 May 2008 03:46:25 -0000      1.10
+++ libnet/http.cpp     10 Jun 2008 01:03:21 -0000      1.11
@@ -22,9 +22,9 @@
 #endif
 
 #include <boost/thread/mutex.hpp>
-#include <boost/date_time/gregorian/gregorian.hpp>
 //#include <boost/date_time/local_time/local_time.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/date_time/gregorian/gregorian.hpp>
 //#include <boost/date_time/time_zone_base.hpp>
 #include <sys/types.h>
 #include <sys/stat.h>

Index: libnet/rtmp_client.cpp
===================================================================
RCS file: /sources/gnash/gnash/libnet/rtmp_client.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libnet/rtmp_client.cpp      6 Jun 2008 14:21:32 -0000       1.2
+++ libnet/rtmp_client.cpp      10 Jun 2008 01:03:21 -0000      1.3
@@ -143,6 +143,10 @@
     pageUrlnode->makeString("pageUrl", pageUrl);
     obj.addProperty(pageUrlnode);
 
+    Element *objencodingnode = new Element;
+    objencodingnode->makeNumber("objectEncoding", 0.0);
+    obj.addProperty(objencodingnode);
+    
 //    size_t total_size = 227;
 //     Buffer *out = encodeHeader(0x3, RTMP::HEADER_12, total_size,
 //                                      RTMP::INVOKE, RTMP::FROM_CLIENT);
@@ -158,8 +162,6 @@
     buf->append(numobj);
     buf->append(encobj);
 
-    // Now that we have an encoded buffer, nuke the Element
-    
     return buf;
 }
 

Index: testsuite/libnet.all/test_rtmp.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/libnet.all/test_rtmp.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- testsuite/libnet.all/test_rtmp.cpp  6 Jun 2008 14:21:32 -0000       1.3
+++ testsuite/libnet.all/test_rtmp.cpp  10 Jun 2008 01:03:21 -0000      1.4
@@ -174,8 +174,8 @@
     
     test_header();
     test_system();
-    test_results();
     test_client();
+    test_results();
 //    test_types();
 }
 
@@ -466,8 +466,20 @@
     GNASH_REPORT_FUNCTION;
     RTMPClient rtmp;
 
-    Buffer *buf1 = hex2mem("02 00 04 70 6c 61 79 00 00 00 00 00 00 00 00 00 05 
01 00");
-    Buffer *buf2 = rtmp.encodeStreamOp(0, RTMP::STREAM_PLAY, false);
+    Buffer *buf1 = hex2mem("02 00 07 63 6f 6e 6e 65 63 74 00 3f f0 00 00 00 00 
00 00 03 00 03 61 70 70 02 00 0f 6d 70 33 5f 61 70 70 2f 69 64 33 74 65 73 74 
00 08 66 6c 61 73 68 56 65 72 02 00 0c 4c 4e 58 20 39 2c 30 2c 33 31 2c 30 00 
06 73 77 66 55 72 6c 02 00 29 68 74 74 70 3a 2f 2f 72 65 6e 61 75 6e 2e 63 6f 
6d 2f 66 6c 65 78 32 2f 70 6f 73 74 73 2f 4d 50 33 54 65 73 74 2e 73 77 66 00 
05 74 63 55 72 6c 02 00 21 72 74 6d 70 3a 2f 2f 72 65 6e 61 75 6e 2e 63 6f 6d 
2f 6d 70 33 5f 61 70 70 2f 69 64 33 74 65 73 74 00 04 66 70 61 64 01 00 00 0b 
61 75 64 69 6f 43 6f 64 65 63 73 00 40 83 38 00 00 00 00 00 00 0b 76 69 64 65 
6f 43 6f 64 65 63 73 00 40 5f 00 00 00 00 00 00 00 0d 76 69 64 65 6f 46 75 6e 
63 74 69 6f 6e 00 3f f0 00 00 00 00 00 00 00 07 70 61 67 65 55 72 6c 02 00 2a 
68 74 74 70 3a 2f 2f 72 65 6e 61 75 6e 2e 63 6f 6d 2f 66 6c 65 78 32 2f 70 6f 
73 74 73 2f 4d 50 33 54 65 73 74 2e 68 74 6d 6c 00 0e 6f 62 6a 65 63 74 45 6e 
63 6f 64 69 6e 67 00 00 00 00 00 00 00 00 00 00 00 09");
+    Buffer *buf2 = rtmp.encodeConnect("mp3_app/id3test", 
"http://renaun.com/flex2/posts/MP3Test.swf";, 
"rtmp://renaun.com/mp3_app/id3test", 615, 124, 1, 
"http://renaun.com/flex2/posts/MP3Test.html";);
+//     cerr << hexify(buf1->begin(), buf1->size(), false) << endl;
+//     cerr << hexify(buf2->begin(), buf1->size(), false) << endl;
+    if ((memcmp(buf1->reference(), buf2->reference(), buf1->size()) == 0)) {
+        runtest.pass("Encoded RTMPClient::encodeConnect()");
+    } else {
+        runtest.fail("Encoded RTMPClient::encodeConnect()");
+    }
+    delete buf1;
+    delete buf2;
+    
+    buf1 = hex2mem("02 00 04 70 6c 61 79 00 00 00 00 00 00 00 00 00 05 01 00");
+    buf2 = rtmp.encodeStreamOp(0, RTMP::STREAM_PLAY, false);
     if ((memcmp(buf1->reference(), buf2->reference(), buf1->size()) == 0)) {
         runtest.pass("Encoded RTMPClient::encodeStreamOp(RTMP::STREAM_PLAY)");
     } else {




reply via email to

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