gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/rtmp r9751: merge in strk's changes to bra


From: rob
Subject: [Gnash-commit] /srv/bzr/gnash/rtmp r9751: merge in strk's changes to branch.
Date: Wed, 19 Nov 2008 13:13:25 -0700
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9751
committer: address@hidden
branch nick: rtmp
timestamp: Wed 2008-11-19 13:13:25 -0700
message:
  merge in strk's changes to branch.
modified:
  .bzrignore
  libamf/amf.cpp
  libamf/amf.h
  libamf/buffer.cpp
  libamf/buffer.h
  libamf/element.cpp
  libamf/element.h
  libbase/URL.cpp
  libnet/cque.cpp
  libnet/diskstream.cpp
  libnet/handler.cpp
  libnet/http.cpp
  libnet/rtmp.cpp
  libnet/rtmp_client.cpp
  testsuite/libbase/URLTest.cpp
  utilities/Makefile.am
  utilities/rtmpget.cpp
    ------------------------------------------------------------
    revno: 9745.1.1
    committer: strk <address@hidden>
    branch nick: rtmp
    timestamp: Tue 2008-11-18 17:58:00 +0100
    message:
      Fix rtmpget build
    modified:
      utilities/Makefile.am
      utilities/rtmpget.cpp
    ------------------------------------------------------------
    revno: 9745.1.2
    committer: strk <address@hidden>
    branch nick: rtmp
    timestamp: Tue 2008-11-18 18:06:16 +0100
    message:
      4 spaces tabs
    modified:
      utilities/rtmpget.cpp
    ------------------------------------------------------------
    revno: 9745.1.3
    committer: strk <address@hidden>
    branch nick: rtmp
    timestamp: Tue 2008-11-18 19:03:57 +0100
    message:
      Merge from trunk
    removed:
      libcore/asobj/xmlattrs.cpp
      macros/libXML.m4
    added:
      libcore/swf.cpp
    modified:
      configure.ac
      gui/Player.cpp
      gui/gtk.cpp
      gui/gui.cpp
      libbase/URL.cpp
      libbase/utf8.h
      libcore/Makefile.am
      libcore/array.cpp
      libcore/array.h
      libcore/as_value.cpp
      libcore/as_value.h
      libcore/asobj/Makefile.am
      libcore/asobj/MovieClipLoader.cpp
      libcore/asobj/NetStream_as.cpp
      libcore/asobj/XMLNode_as.cpp
      libcore/asobj/XMLNode_as.h
      libcore/asobj/XML_as.cpp
      libcore/asobj/XML_as.h
      libcore/asobj/flash/display/BitmapData_as.cpp
      libcore/asobj/xmlattrs.h
      libcore/character.cpp
      libcore/swf.h
      libcore/vm/Machine.cpp
      libmedia/FLVParser.cpp
      testsuite/actionscript.all/MovieClip.as
      testsuite/actionscript.all/XML.as
      testsuite/libbase/URLTest.cpp
      testsuite/libcore.all/AsValueTest.cpp
      testsuite/swfdec/PASSING
        ------------------------------------------------------------
        revno: 9483.1.813
        committer: strk <address@hidden>
        branch nick: trunk
        timestamp: Tue 2008-11-18 18:41:29 +0100
        message:
          Add test for rtmp url (over paranoia, just that url didn't seem to 
work fine in the rtmp branch, so I was wondering
        modified:
          testsuite/libbase/URLTest.cpp
        ------------------------------------------------------------
        revno: 9483.1.814
        committer: strk <address@hidden>
        branch nick: trunk
        timestamp: Tue 2008-11-18 18:44:25 +0100
        message:
          Ah, found the offending url failure vi testsuite/libbase/URLTest.cpp 
        modified:
          testsuite/libbase/URLTest.cpp
        ------------------------------------------------------------
        revno: 9483.1.815
        committer: strk <address@hidden>
        branch nick: trunk
        timestamp: Tue 2008-11-18 18:50:10 +0100
        message:
          Fix parsing of URLs with a port number but no path component
        modified:
          libbase/URL.cpp
          testsuite/libbase/URLTest.cpp
    ------------------------------------------------------------
    revno: 9745.1.4
    committer: strk <address@hidden>
    branch nick: rtmp
    timestamp: Tue 2008-11-18 19:07:28 +0100
    message:
      Use gnash::URL for parsing urls
    modified:
      utilities/rtmpget.cpp
    ------------------------------------------------------------
    revno: 9745.1.5
    committer: strk <address@hidden>
    branch nick: rtmp
    timestamp: Tue 2008-11-18 19:24:14 +0100
    message:
      Don't forbid connecting to unprivileged remote ports
    modified:
      libnet/network.cpp
    ------------------------------------------------------------
    revno: 9745.1.6
    committer: strk <address@hidden>
    branch nick: rtmp
    timestamp: Tue 2008-11-18 20:44:36 +0100
    message:
      Construct the RTMPClient after having set verbosity level,
      to get more debugging options; have user-defined path and filename
      override the one extracted from url.
    modified:
      utilities/rtmpget.cpp
    ------------------------------------------------------------
    revno: 9745.1.7
    committer: strk <address@hidden>
    branch nick: rtmp
    timestamp: Tue 2008-11-18 20:45:44 +0100
    message:
      Fix RTMP constructor
    modified:
      libnet/rtmp.cpp
    ------------------------------------------------------------
    revno: 9745.1.8
    committer: strk <address@hidden>
    branch nick: rtmp
    timestamp: Tue 2008-11-18 20:49:16 +0100
    message:
      Return what advertised (fix control reaches end of non-void returnign 
func)
    modified:
      libnet/rtmp.cpp
    ------------------------------------------------------------
    revno: 9745.1.9
    committer: strk <address@hidden>
    branch nick: rtmp
    timestamp: Tue 2008-11-18 20:55:56 +0100
    message:
      update ignores
    modified:
      .bzrignore
    ------------------------------------------------------------
    revno: 9745.1.10
    committer: strk <address@hidden>
    branch nick: rtmp
    timestamp: Tue 2008-11-18 21:21:20 +0100
    message:
      don't stack-allocate Element objects, as Element::encode would kill such 
constructed ones
    modified:
      libnet/rtmp_client.cpp
    ------------------------------------------------------------
    revno: 9745.1.11
    committer: strk <address@hidden>
    branch nick: rtmp
    timestamp: Tue 2008-11-18 23:14:38 +0100
    message:
      few dox cleanups
    modified:
      libnet/network.h
    ------------------------------------------------------------
    revno: 9745.1.12
    committer: strk <address@hidden>
    branch nick: rtmp
    timestamp: Tue 2008-11-18 23:17:11 +0100
    message:
      Fix computation of output size in ::encodeElment, take code from
      ::encodeProperty. Fixes the exception with rtmpget, exposes next
      bug: munmap_chunk(): invalid pointer: 0x000000000062b9b0 ***
    modified:
      libamf/amf.cpp
    ------------------------------------------------------------
    revno: 9745.1.13
    committer: strk <address@hidden>
    branch nick: rtmp
    timestamp: Tue 2008-11-18 23:56:10 +0100
    message:
      some const correctness, and add AMF::encodeElement taking Element by 
const ref
    modified:
      libamf/amf.cpp
      libamf/amf.h
      libamf/buffer.h
      libamf/element.cpp
      libamf/element.h
    ------------------------------------------------------------
    revno: 9745.1.14
    committer: strk <address@hidden>
    branch nick: rtmp
    timestamp: Tue 2008-11-18 23:58:05 +0100
    message:
      don't put 'this' into a shared_ptr
    modified:
      libamf/element.cpp
    ------------------------------------------------------------
    revno: 9745.1.15
    committer: strk <address@hidden>
    branch nick: rtmp
    timestamp: Wed 2008-11-19 08:51:22 +0100
    message:
      Don't forget to allocate an Element before dereferencing its pointer
    modified:
      libnet/rtmp_client.cpp
    ------------------------------------------------------------
    revno: 9745.1.16
    committer: strk <address@hidden>
    branch nick: rtmp
    timestamp: Wed 2008-11-19 08:53:39 +0100
    message:
      fix buffer size computation in ::encodeStream
    modified:
      libnet/rtmp_client.cpp
    ------------------------------------------------------------
    revno: 9745.1.17
    committer: strk <address@hidden>
    branch nick: rtmp
    timestamp: Wed 2008-11-19 09:02:56 +0100
    message:
      Initialize filedes to -1, fix assignment op to return what it advertise
    modified:
      libnet/network.cpp
    ------------------------------------------------------------
    revno: 9745.1.18
    committer: strk <address@hidden>
    branch nick: rtmp
    timestamp: Wed 2008-11-19 09:11:24 +0100
    message:
      make error message cleaner
    modified:
      libamf/buffer.cpp
    ------------------------------------------------------------
    revno: 9745.1.19
    committer: strk <address@hidden>
    branch nick: rtmp
    timestamp: Wed 2008-11-19 11:09:12 +0100
    message:
      fix missing return
    modified:
      libnet/cque.cpp
    ------------------------------------------------------------
    revno: 9745.1.20
    committer: strk <address@hidden>
    branch nick: rtmp
    timestamp: Wed 2008-11-19 11:13:56 +0100
    message:
      fix missing returns
    modified:
      libnet/diskstream.cpp
      libnet/handler.cpp
      libnet/http.cpp
    ------------------------------------------------------------
    revno: 9745.1.21
    committer: strk <address@hidden>
    branch nick: rtmp
    timestamp: Wed 2008-11-19 12:16:13 +0100
    message:
      fix uninitialized vars use
    modified:
      libnet/handler.cpp
=== modified file '.bzrignore'
--- a/.bzrignore        2008-09-16 05:50:42 +0000
+++ b/.bzrignore        2008-11-18 19:55:56 +0000
@@ -299,3 +299,20 @@
 cygnal/testsuite/cygnal.all/cygnalrc
 gui/Info.plist
 gui/klash.moc
+testsuite/Dejagnu.swf
+testsuite/tmpSharedObject
+testsuite/libamf.all/test_flv
+testsuite/libbase/Point2dTest
+testsuite/libbase/Range2dTest
+testsuite/libbase/snappingrangetest
+testsuite/libbase/string_tableTest
+testsuite/libnet.all/site.bak
+testsuite/libnet.all/test_cache
+testsuite/misc-ming.all/BitmapDataTest
+testsuite/misc-ming.all/EmbeddedSoundTest
+testsuite/misc-ming.all/LoadVarsTest
+testsuite/misc-ming.all/XMLSocketTest
+testsuite/misc-ming.all/XMLSocketTest
+testsuite/misc-ming.all/loadImageTest
+utilities/rtmpget
+testsuite/libnet.all/test_diskstream

=== modified file 'libamf/amf.cpp'
--- a/libamf/amf.cpp    2008-10-26 23:35:38 +0000
+++ b/libamf/amf.cpp    2008-11-18 22:56:10 +0000
@@ -224,7 +224,7 @@
 /// 
 /// @return a binary AMF packet in big endian format
 boost::shared_ptr<Buffer>
-AMF::encodeDate(Network::byte_t *data)
+AMF::encodeDate(const Network::byte_t *data)
 {
 //    GNASH_REPORT_FUNCTION;
     boost::shared_ptr<Buffer> buf(new Buffer(AMF_HEADER_SIZE));
@@ -259,7 +259,7 @@
 ///
 /// @return a binary AMF packet in big endian format
 boost::shared_ptr<Buffer>
-AMF::encodeXMLObject(Network::byte_t * /*data */, size_t /* size */)
+AMF::encodeXMLObject(const Network::byte_t * /*data */, size_t /* size */)
 {
 //    GNASH_REPORT_FUNCTION;
     boost::shared_ptr<Buffer> buf;
@@ -293,7 +293,7 @@
 ///
 /// @return a binary AMF packet in big endian format (header,data)
 boost::shared_ptr<Buffer>
-AMF::encodeReference(Network::byte_t * /* data */, size_t /* size */)
+AMF::encodeReference(const Network::byte_t * /* data */, size_t /* size */)
 {
 //    GNASH_REPORT_FUNCTION;
     boost::shared_ptr<Buffer> buf;
@@ -310,7 +310,7 @@
 ///
 /// @return a binary AMF packet in big endian format (header,data)
 boost::shared_ptr<Buffer>
-AMF::encodeMovieClip(Network::byte_t * /*data */, size_t /* size */)
+AMF::encodeMovieClip(const Network::byte_t * /*data */, size_t /* size */)
 {
 //    GNASH_REPORT_FUNCTION;
     boost::shared_ptr<Buffer> buf;
@@ -329,7 +329,7 @@
 ///
 /// @return a binary AMF packet in big endian format
 boost::shared_ptr<Buffer>
-AMF::encodeECMAArray(Network::byte_t * /*data */, size_t /* size */)
+AMF::encodeECMAArray(const Network::byte_t * /*data */, size_t /* size */)
 {
 //    GNASH_REPORT_FUNCTION;
     boost::shared_ptr<Buffer> buf;
@@ -346,7 +346,7 @@
 ///
 /// @return a binary AMF packet in big endian format
 boost::shared_ptr<Buffer>
-AMF::encodeLongString(Network::byte_t * /* data */, size_t /* size */)
+AMF::encodeLongString(const Network::byte_t * /* data */, size_t /* size */)
 {
 //    GNASH_REPORT_FUNCTION;
     boost::shared_ptr<Buffer> buf;
@@ -363,7 +363,7 @@
 ///
 /// @return a binary AMF packet in big endian format
 boost::shared_ptr<Buffer>
-AMF::encodeRecordSet(Network::byte_t * /* data */, size_t /* size */)
+AMF::encodeRecordSet(const Network::byte_t * /* data */, size_t /* size */)
 {
 //    GNASH_REPORT_FUNCTION;
     boost::shared_ptr<Buffer> buf;
@@ -382,7 +382,7 @@
 ///
 /// @return a binary AMF packet in big endian format (header,data)
 boost::shared_ptr<Buffer>
-AMF::encodeStrictArray(Network::byte_t * /* data */, size_t /* size */)
+AMF::encodeStrictArray(const Network::byte_t * /* data */, size_t /* size */)
 {
 //    GNASH_REPORT_FUNCTION;
     boost::shared_ptr<Buffer> buf;
@@ -479,66 +479,63 @@
 boost::shared_ptr<Buffer>
 AMF::encodeElement(boost::shared_ptr<amf::Element> el)
 {
+    return encodeElement(*el);
+}
+
+boost::shared_ptr<Buffer>
+AMF::encodeElement(const amf::Element& el)
+{
 //    GNASH_REPORT_FUNCTION;
-    size_t outsize;
-    if (el->getType() == Element::BOOLEAN_AMF0) {
-       outsize = el->getNameSize() + 2;
-    } else {
-       outsize = el->getNameSize() + el->getDataSize() + AMF_PROP_HEADER_SIZE;
-    }
-    // A NULL object is a single byte
-    if (el->getType() == Element::NULL_AMF0) {
-       outsize = 1;
-    }
-    
+    size_t outsize = el.getNameSize() + el.getDataSize() + 
AMF_PROP_HEADER_SIZE;
+
     boost::shared_ptr<Buffer> buf(new Buffer(outsize));
 //    log_debug("AMF::%s: Outsize is: %d", __FUNCTION__, outsize);
     // If the name field is set, it's a property, followed by the data
-    if (el->getName()) {
+    if (el.getName()) {
        // Add the length of the string for the name of the variable
-       size_t length = el->getNameSize();
+       size_t length = el.getNameSize();
        boost::uint16_t enclength = length;
        swapBytes(&enclength, 2);
        *buf = enclength;
        // Now the name itself
-       string name = el->getName();
+       string name = el.getName();
        if (name.size() > 0) {
            *buf += name;
        }
     }
 
     // Encode the element's data
-    switch (el->getType()) {
+    switch (el.getType()) {
       case Element::NOTYPE:
          return buf;
          break;
       case Element::NUMBER_AMF0:
       {
-         boost::shared_ptr<Buffer> encnum = AMF::encodeNumber(el->to_number());
+         boost::shared_ptr<Buffer> encnum = AMF::encodeNumber(el.to_number());
          *buf += encnum;
-//       *buf += encodeNumber(el->to_number());
+//       *buf += encodeNumber(el.to_number());
           break;
       }
       case Element::BOOLEAN_AMF0:
       {
-         boost::shared_ptr<Buffer> encbool = AMF::encodeBoolean(el->to_bool());
-         *buf += encodeBoolean(el->to_bool());
+         boost::shared_ptr<Buffer> encbool = AMF::encodeBoolean(el.to_bool());
+         *buf += encodeBoolean(el.to_bool());
          *buf += encbool;
           break;
       }
       case Element::STRING_AMF0:
       {
-         boost::shared_ptr<Buffer> encstr = AMF::encodeString(el->to_string());
+         boost::shared_ptr<Buffer> encstr = AMF::encodeString(el.to_string());
          *buf += encstr;
-//       *buf += encodeString(el->to_reference(), el->getDataSize());
+//       *buf += encodeString(el.to_reference(), el.getDataSize());
          break;
       }
       case Element::OBJECT_AMF0:
-         // tmp = el->encode();
+         // tmp = el.encode();
          log_unimpl("FIXME: Element::encode() temporarily disabled.");
           break;
       case Element::MOVIECLIP_AMF0:
-         *buf += encodeMovieClip(el->to_reference(), el->getDataSize());
+         *buf += encodeMovieClip(el.to_reference(), el.getDataSize());
           break;
       case Element::NULL_AMF0:
          *buf += encodeNull();
@@ -547,37 +544,37 @@
          *buf += encodeUndefined();
          break;
       case Element::REFERENCE_AMF0:
-         *buf += encodeReference(el->to_reference(), el->getDataSize());
+         *buf += encodeReference(el.to_reference(), el.getDataSize());
           break;
       case Element::ECMA_ARRAY_AMF0:
-         *buf += encodeECMAArray(el->to_reference(), el->getDataSize());
+         *buf += encodeECMAArray(el.to_reference(), el.getDataSize());
           break;
          // The Object End gets added when creating the object, so we can just 
ignore it here.
       case Element::OBJECT_END_AMF0:
          *buf += encodeObjectEnd();
           break;
       case Element::STRICT_ARRAY_AMF0:
-         *buf += encodeStrictArray(el->to_reference(), el->getDataSize());
+         *buf += encodeStrictArray(el.to_reference(), el.getDataSize());
           break;
       case Element::DATE_AMF0:
-         *buf += encodeDate(el->to_reference());
+         *buf += encodeDate(el.to_reference());
           break;
       case Element::LONG_STRING_AMF0:
-         *buf += encodeLongString(el->to_reference(), el->getDataSize());
+         *buf += encodeLongString(el.to_reference(), el.getDataSize());
           break;
       case Element::UNSUPPORTED_AMF0:
          *buf += encodeUnsupported();
           break;
       case Element::RECORD_SET_AMF0:
-         *buf += encodeRecordSet(el->to_reference(), el->getDataSize());
+         *buf += encodeRecordSet(el.to_reference(), el.getDataSize());
           break;
       case Element::XML_OBJECT_AMF0:
-         *buf += encodeXMLObject(el->to_reference(), el->getDataSize());
+         *buf += encodeXMLObject(el.to_reference(), el.getDataSize());
           // Encode an XML object. The data follows a 4 byte length
           // field. (which must be big-endian)
           break;
       case Element::TYPED_OBJECT_AMF0:
-//       tmp = encodeTypedObject(el->to_reference(), el->getDataSize());
+//       tmp = encodeTypedObject(el.to_reference(), el.getDataSize());
          buf.reset();
           break;
 //       // This is a Gnash specific value

=== modified file 'libamf/amf.h'
--- a/libamf/amf.h      2008-10-27 07:04:10 +0000
+++ b/libamf/amf.h      2008-11-18 22:56:10 +0000
@@ -197,7 +197,7 @@
     ///
     /// @return a binary AMF packet in big endian format
     ///
-    static boost::shared_ptr<Buffer> encodeXMLObject(gnash::Network::byte_t 
*data, size_t nbytes);
+    static boost::shared_ptr<Buffer> encodeXMLObject(const 
gnash::Network::byte_t *data, size_t nbytes);
 
     /// Encode a Typed Object to its serialized representation.
     //
@@ -217,7 +217,7 @@
     ///
     /// @return a binary AMF packet in big endian format (header,data)
     ///
-    static boost::shared_ptr<Buffer> encodeReference(gnash::Network::byte_t 
*data, size_t size);
+    static boost::shared_ptr<Buffer> encodeReference(const 
gnash::Network::byte_t *data, size_t size);
 
     /// Encode a Movie Clip (swf data) to its serialized representation.
     //
@@ -227,7 +227,7 @@
     ///
     /// @return a binary AMF packet in big endian format (header,data)
     ///
-    static boost::shared_ptr<Buffer> encodeMovieClip(gnash::Network::byte_t 
*data, size_t size);
+    static boost::shared_ptr<Buffer> encodeMovieClip(const 
gnash::Network::byte_t *data, size_t size);
 
     /// Encode an ECMA Array to its serialized representation.
     //
@@ -240,7 +240,7 @@
     ///
     /// @return a binary AMF packet in big endian format
     ///
-    static boost::shared_ptr<Buffer> encodeECMAArray(gnash::Network::byte_t 
*data, size_t size);
+    static boost::shared_ptr<Buffer> encodeECMAArray(const 
gnash::Network::byte_t *data, size_t size);
 
     /// Encode a Long String to its serialized representation.
     //
@@ -250,7 +250,7 @@
     ///
     /// @return a binary AMF packet in big endian format
     ///
-    static boost::shared_ptr<Buffer> encodeLongString(gnash::Network::byte_t 
*data, size_t size);
+    static boost::shared_ptr<Buffer> encodeLongString(const 
gnash::Network::byte_t *data, size_t size);
 
     /// Encode a Record Set to its serialized representation.
     //
@@ -260,7 +260,7 @@
     ///
     /// @return a binary AMF packet in big endian format
     ///
-    static boost::shared_ptr<Buffer> encodeRecordSet(gnash::Network::byte_t 
*data, size_t size);
+    static boost::shared_ptr<Buffer> encodeRecordSet(const 
gnash::Network::byte_t *data, size_t size);
 
     /// Encode a Date to its serialized representation.
     //
@@ -268,7 +268,7 @@
     /// 
     /// @return a binary AMF packet in big endian format
     ///
-    static boost::shared_ptr<Buffer> encodeDate(gnash::Network::byte_t *data);
+    static boost::shared_ptr<Buffer> encodeDate(const gnash::Network::byte_t 
*data);
 
     /// Encode a Strict Array to its serialized representation.
     //
@@ -281,7 +281,7 @@
     ///
     /// @return a binary AMF packet in big endian format (header,data)
     ///
-    static boost::shared_ptr<Buffer> encodeStrictArray(gnash::Network::byte_t 
*data, size_t size);
+    static boost::shared_ptr<Buffer> encodeStrictArray(const 
gnash::Network::byte_t *data, size_t size);
     
     /// Encode an object to its serialized representation.
     //
@@ -313,6 +313,14 @@
     ///
     static boost::shared_ptr<Buffer> 
encodeElement(boost::shared_ptr<amf::Element> el);
 
+    /// Encode an Element to its serialized representation.
+    //
+    /// @param el the Element to encode.
+    ///
+    /// @return a binary AMF packet in big endian format
+    ///
+    static boost::shared_ptr<Buffer> encodeElement(const amf::Element& el);
+
     /// Encode a variable to its serialized representation.
     //
     /// @param el A smart pointer to the Element to encode.

=== modified file 'libamf/buffer.cpp'
--- a/libamf/buffer.cpp 2008-11-18 02:55:44 +0000
+++ b/libamf/buffer.cpp 2008-11-19 08:11:24 +0000
@@ -653,7 +653,7 @@
        // deleted when this method returns.
        // We loose data if we resize smaller than the data currently held.
        if (size < used) {
-           log_error("Truncating data (%d bytes) while resizing!", used - 
size);
+           log_error("amf::Buffer::resize(%d): Truncating data (%d bytes) 
while resizing!", size, used - size);
            used = size;
        }
        Network::byte_t *newptr = new Network::byte_t[size];

=== modified file 'libamf/buffer.h'
--- a/libamf/buffer.h   2008-11-18 02:55:44 +0000
+++ b/libamf/buffer.h   2008-11-18 22:56:10 +0000
@@ -275,6 +275,8 @@
     /// @return A real pointer to the base address of the Buffer.
     gnash::Network::byte_t *begin() { return _data.get() ; };
     gnash::Network::byte_t *reference() { return _data.get(); }
+    const gnash::Network::byte_t *reference() const { return _data.get(); }
+
     /// \brief Return the last address of the Buffer
     ///                Which is the base address plus the total size of the
     ///                Buffer.

=== modified file 'libamf/element.cpp'
--- a/libamf/element.cpp        2008-10-27 12:10:36 +0000
+++ b/libamf/element.cpp        2008-11-18 22:58:05 +0000
@@ -297,6 +297,16 @@
     return 0;
 };
 
+const gnash::Network::byte_t *
+Element::to_reference() const
+{
+//    GNASH_REPORT_FUNCTION;
+    if (_buffer) {
+       return _buffer->reference();
+    }
+    return 0;
+};
+
 /// \brief Test equivalance against another Element.
 ///    This compares all the data and the data type in the
 ///    current Element with the supplied one, so it can be a
@@ -417,8 +427,7 @@
        *buf += TERMINATOR;
        return buf;
     } else {
-       boost::shared_ptr<amf::Element> el(this);
-       return AMF::encodeElement(el);
+           return AMF::encodeElement(*this);
     }
     
     return buf;
@@ -1193,7 +1202,7 @@
 ///
 /// @return The size of the name string.
 size_t
-Element::getNameSize()
+Element::getNameSize() const
 {
 //    GNASH_REPORT_FUNCTION;
     if (_name) {

=== modified file 'libamf/element.h'
--- a/libamf/element.h  2008-11-17 17:06:29 +0000
+++ b/libamf/element.h  2008-11-18 22:56:10 +0000
@@ -627,6 +627,7 @@
     ///
     /// @return A real pointer to the base address of the raw data in memory.
     gnash::Network::byte_t *to_reference();
+    const gnash::Network::byte_t *to_reference() const;
 
     // Manipulate the name of a property
 
@@ -634,7 +635,7 @@
     ///                Only top level Objects or properties have a name.
     ///
     /// @return The size of the name string.
-    size_t getNameSize();
+    size_t getNameSize() const;
     
     /// \brief Get the name of this Element.
     ///                Only top level Objects or properties have a name.

=== modified file 'libbase/URL.cpp'
--- a/libbase/URL.cpp   2008-10-26 10:39:03 +0000
+++ b/libbase/URL.cpp   2008-11-18 17:50:10 +0000
@@ -78,6 +78,10 @@
                        // no slashes ? all hostname, I presume
                        _host = in.substr(pos);
                        _path = "/";
+
+            // Extract the port number from the hostname, if any
+            split_port_from_host();
+
                        return;
                }
 

=== modified file 'libnet/cque.cpp'
--- a/libnet/cque.cpp   2008-09-22 18:25:27 +0000
+++ b/libnet/cque.cpp   2008-11-19 10:09:12 +0000
@@ -140,6 +140,7 @@
     if (_que.size()) {
         return _que.front();
     }
+    return boost::shared_ptr<amf::Buffer>();
 }
 
 // Return the size of the queues

=== modified file 'libnet/diskstream.cpp'
--- a/libnet/diskstream.cpp     2008-11-19 17:40:29 +0000
+++ b/libnet/diskstream.cpp     2008-11-19 20:13:25 +0000
@@ -595,6 +595,7 @@
     return FILETYPE_XML;
   }
   
+  return FILETYPE_NONE;
 }
 
 ///  \brief Dump the internal data of this class in a human readable form.

=== modified file 'libnet/handler.cpp'
--- a/libnet/handler.cpp        2008-11-06 22:45:16 +0000
+++ b/libnet/handler.cpp        2008-11-19 11:16:13 +0000
@@ -129,7 +129,7 @@
            return _incoming.peek();
        }
     }    
-//    FIXME: return ;
+    return boost::shared_ptr<amf::Buffer>();
 }
 
 // Return the size of the queues
@@ -289,10 +289,10 @@
     log_debug(_("Starting Handlers for port %d, tid %ld"),
              args->port, get_thread_id());
 
-    struct pollfd *fds;
+    struct pollfd fds; // FIXME: never initialized ?
     int nfds = 1;
     Network net;
-    boost::shared_ptr<vector<struct pollfd> > hits = net.waitForNetData(nfds, 
fds);
+    boost::shared_ptr<vector<struct pollfd> > hits = net.waitForNetData(nfds, 
&fds);
     vector<int>::const_iterator it;
 #if 0
     for (it = _pollfds.begin(); it != _pollfds.end(); it++) {
@@ -330,8 +330,8 @@
 {
     GNASH_REPORT_FUNCTION;
 
-    Network *net = reinterpret_cast<Network *>(args->handler);
-    size_t ret;
+    //Network *net = reinterpret_cast<Network *>(args->handler);
+    size_t ret=0;
 
     log_debug("Starting to wait for data in net for fd #%d", args->netfd);
     

=== modified file 'libnet/http.cpp'
--- a/libnet/http.cpp   2008-11-19 17:42:19 +0000
+++ b/libnet/http.cpp   2008-11-19 20:13:25 +0000
@@ -1345,6 +1345,7 @@
 {
     GNASH_REPORT_FUNCTION;
     
+    return 0; // FIXME
 }
 
 /// \brief Send a message to the other end of the network connection.
@@ -1359,6 +1360,7 @@
 {
     GNASH_REPORT_FUNCTION;
     
+    return 0; // FIXME
 }
 
 /// \brief Send a message to the other end of the network connection.
@@ -1370,12 +1372,12 @@
 ///
 /// @return The number of bytes sent
 int DSOEXPORT
-HTTP::sendMsg(const Network::byte_t *, size_t size)
+HTTP::sendMsg(const Network::byte_t *data, size_t size)
 {
     GNASH_REPORT_FUNCTION;
 //    _header
 
-//    return Network::writeNet(buf->reference(), buf->size());
+    return Network::writeNet(data, size);
 }
 
 int

=== modified file 'libnet/rtmp.cpp'
--- a/libnet/rtmp.cpp   2008-10-25 17:25:58 +0000
+++ b/libnet/rtmp.cpp   2008-11-18 19:49:16 +0000
@@ -27,6 +27,7 @@
 #include <vector>
 #include <boost/detail/endian.hpp>
 #include <boost/shared_ptr.hpp>
+#include <boost/format.hpp>
 
 #if ! (defined(_WIN32) || defined(WIN32))
 #      include <netinet/in.h>
@@ -184,15 +185,17 @@
       _timeout(1)
 {
 //    GNASH_REPORT_FUNCTION;
-//    _queues.resize(MAX_AMF_INDEXES);
+
     // Initialize all of the queues
-    for (size_t i=0; i<MAX_AMF_INDEXES; i++) {
-       string name = "channel #";
-       for (size_t i=0; i<10; i++) {
-           name[9] = i+'0';
-           _queues[i].setName(name.c_str()); // this name is only used for 
debugging
-           _chunksize[i] = RTMP_VIDEO_PACKET_SIZE; // each channel can have a 
different chunksize
-       }
+    for (int i=0; i<MAX_AMF_INDEXES; i++)
+    {
+        // Name is only used for debugging
+        boost::format fmt("channel #%s");
+           string name = (fmt % i).str();
+           _queues[i].setName(name.c_str());
+
+        // each channel can have a different chunksize
+           _chunksize[i] = RTMP_VIDEO_PACKET_SIZE;
     }
 }
 
@@ -673,6 +676,7 @@
 {
     GNASH_REPORT_FUNCTION;
     log_unimpl(__PRETTY_FUNCTION__);
+    return boost::shared_ptr<amf::Buffer>((amf::Buffer*)0);
 }
 
 void
@@ -687,6 +691,7 @@
 {
     GNASH_REPORT_FUNCTION;
     log_unimpl(__PRETTY_FUNCTION__);
+    return boost::shared_ptr<amf::Buffer>((amf::Buffer*)0);
 }
 
 void
@@ -701,6 +706,7 @@
 {
     GNASH_REPORT_FUNCTION;
     log_unimpl(__PRETTY_FUNCTION__);
+    return boost::shared_ptr<amf::Buffer>((amf::Buffer*)0);
 }
 
 void 
@@ -715,6 +721,7 @@
 {
     GNASH_REPORT_FUNCTION;
     log_unimpl(__PRETTY_FUNCTION__);
+    return boost::shared_ptr<amf::Buffer>((amf::Buffer*)0);
 }
 
 void 
@@ -729,6 +736,7 @@
 {
     GNASH_REPORT_FUNCTION;
     log_unimpl(__PRETTY_FUNCTION__);
+    return boost::shared_ptr<amf::Buffer>((amf::Buffer*)0);
 }
 
 void 
@@ -743,6 +751,7 @@
 {
     GNASH_REPORT_FUNCTION;
     log_unimpl(__PRETTY_FUNCTION__);
+    return boost::shared_ptr<amf::Buffer>((amf::Buffer*)0);
 }
 
 void 
@@ -757,6 +766,7 @@
 {
     GNASH_REPORT_FUNCTION;
     log_unimpl(__PRETTY_FUNCTION__);
+    return boost::shared_ptr<amf::Buffer>((amf::Buffer*)0);
 }
 
 void 
@@ -771,6 +781,7 @@
 {
     GNASH_REPORT_FUNCTION;
     log_unimpl(__PRETTY_FUNCTION__);
+    return boost::shared_ptr<amf::Buffer>((amf::Buffer*)0);
 }
 
 void 
@@ -785,6 +796,7 @@
 {
     GNASH_REPORT_FUNCTION;
     log_unimpl(__PRETTY_FUNCTION__);
+    return boost::shared_ptr<amf::Buffer>((amf::Buffer*)0);
 }
 void 
 RTMP::decodeInvoke()

=== modified file 'libnet/rtmp_client.cpp'
--- a/libnet/rtmp_client.cpp    2008-10-17 10:21:46 +0000
+++ b/libnet/rtmp_client.cpp    2008-11-19 07:53:39 +0000
@@ -46,6 +46,8 @@
 using namespace std;
 using namespace amf;
 
+typedef boost::shared_ptr<amf::Element> ElementSharedPtr;
+
 namespace gnash
 {
 
@@ -81,22 +83,22 @@
     
     AMF amf_obj;
 
-    Element connect;
-    connect.makeString("connect");
+    ElementSharedPtr connect(new amf::Element);
+    connect->makeString("connect");
 
-    Element connum;
+    ElementSharedPtr connum(new amf::Element);
     // update the counter for the number of connections. This number is used 
heavily
     // in RTMP to help keep communications clear when there are multiple 
streams.
     _connections++;
-    connum.makeNumber(_connections);
+    connum->makeNumber(_connections);
     
     // Make the top level object
-    Element obj;
-    obj.makeObject();
+    ElementSharedPtr obj(new amf::Element);
+    obj->makeObject();
     
-    boost::shared_ptr<amf::Element> appnode(new Element);
+    ElementSharedPtr appnode(new amf::Element);
     appnode->makeString("app", app);
-    obj.addProperty(appnode);
+    obj->addProperty(appnode);
 
     const char *version = 0;
     if (rcfile.getFlashVersionString().size() > 0) {
@@ -105,56 +107,56 @@
         version = "LNX 9,0,31,0";
     }  
 
-    boost::shared_ptr<amf::Element> flashVer(new Element);
+    ElementSharedPtr flashVer(new amf::Element);
     flashVer->makeString("flashVer", "LNX 9,0,31,0");
-    obj.addProperty(flashVer);
+    obj->addProperty(flashVer);
     
-    boost::shared_ptr<amf::Element> swfUrlnode(new Element);
+    ElementSharedPtr swfUrlnode(new amf::Element);
 //    swfUrl->makeString("swfUrl", 
"http://192.168.1.70/software/gnash/tests/ofla_demo.swf";);
     swfUrlnode->makeString("swfUrl", swfUrl);
-    obj.addProperty(swfUrlnode);
+    obj->addProperty(swfUrlnode);
 
 //    filespec = "rtmp://localhost/oflaDemo";
-    boost::shared_ptr<amf::Element> tcUrlnode(new Element);
+    ElementSharedPtr tcUrlnode(new amf::Element);
     tcUrlnode->makeString("tcUrl", tcUrl);
-    obj.addProperty(tcUrlnode);
+    obj->addProperty(tcUrlnode);
 
-    boost::shared_ptr<amf::Element> fpad(new Element);
+    ElementSharedPtr fpad(new amf::Element);
     fpad->makeBoolean("fpad", false);
-    obj.addProperty(fpad);
+    obj->addProperty(fpad);
 
-    boost::shared_ptr<amf::Element> audioCodecsnode(new Element);
+    ElementSharedPtr audioCodecsnode(new Element);
 //    audioCodecsnode->makeNumber("audioCodecs", 615);
     audioCodecsnode->makeNumber("audioCodecs", audioCodecs);
-    obj.addProperty(audioCodecsnode);
+    obj->addProperty(audioCodecsnode);
     
-    boost::shared_ptr<amf::Element> videoCodecsnode(new Element);
+    ElementSharedPtr videoCodecsnode(new Element);
 //    videoCodecsnode->makeNumber("videoCodecs", 124);
     videoCodecsnode->makeNumber("videoCodecs", videoCodecs);
-    obj.addProperty(videoCodecsnode);
+    obj->addProperty(videoCodecsnode);
 
-    boost::shared_ptr<amf::Element> videoFunctionnode(new Element);
+    ElementSharedPtr videoFunctionnode(new Element);
 //    videoFunctionnode->makeNumber("videoFunction", 0x1);
     videoFunctionnode->makeNumber("videoFunction", videoFunction);
-    obj.addProperty(videoFunctionnode);
+    obj->addProperty(videoFunctionnode);
 
-    boost::shared_ptr<amf::Element> pageUrlnode(new Element);
+    ElementSharedPtr pageUrlnode(new Element);
 //    pageUrlnode->makeString("pageUrl", 
"http://x86-ubuntu/software/gnash/tests/";);
     pageUrlnode->makeString("pageUrl", pageUrl);
-    obj.addProperty(pageUrlnode);
+    obj->addProperty(pageUrlnode);
 
-    boost::shared_ptr<amf::Element> objencodingnode(new Element);
+    ElementSharedPtr objencodingnode(new Element);
     objencodingnode->makeNumber("objectEncoding", 0.0);
-    obj.addProperty(objencodingnode);
+    obj->addProperty(objencodingnode);
     
 //    size_t total_size = 227;
 //     Buffer *out = encodeHeader(0x3, RTMP::HEADER_12, total_size,
 //                                      RTMP::INVOKE, RTMP::FROM_CLIENT);
 //     const char *rtmpStr = "03 00 00 04 00 01 1f 14 00 00 00 00";
 //     Buffer *rtmpBuf = hex2mem(rtmpStr);
-    boost::shared_ptr<Buffer> conobj = connect.encode();
-    boost::shared_ptr<Buffer> numobj = connum.encode();
-    boost::shared_ptr<Buffer> encobj = obj.encode();
+    boost::shared_ptr<Buffer> conobj = connect->encode();
+    boost::shared_ptr<Buffer> numobj = connum->encode();
+    boost::shared_ptr<Buffer> encobj = obj->encode();
 
     boost::shared_ptr<Buffer> buf(new Buffer(conobj->size() + numobj->size() + 
encobj->size()));
     *buf += conobj;
@@ -175,21 +177,23 @@
     struct timespec now;
     clock_gettime (CLOCK_REALTIME, &now);
 
-    boost::shared_ptr<amf::Element> str(new Element);
+    boost::shared_ptr<amf::Element> str(new amf::Element);
     str->makeString("createStream");
     boost::shared_ptr<Buffer> strobj = str->encode();
   
-    boost::shared_ptr<amf::Element>  num(new Element);
+    boost::shared_ptr<amf::Element>  num(new amf::Element);
     num->makeNumber(id);
     boost::shared_ptr<Buffer> numobj = num->encode();
 
-    boost::shared_ptr<Buffer> buf(new Buffer(strobj->size() + numobj->size()));
-
     // Set the NULL object element that follows the stream ID
-    boost::shared_ptr<amf::Element> null;
+    boost::shared_ptr<amf::Element> null(new amf::Element);
     null->makeNull();
     boost::shared_ptr<Buffer> nullobj = null->encode();    
 
+    size_t totalsize = strobj->size() + numobj->size() + nullobj->size();
+
+    boost::shared_ptr<Buffer> buf(new Buffer(totalsize));
+
     *buf += strobj;
     *buf += numobj;
     *buf += nullobj;

=== modified file 'testsuite/libbase/URLTest.cpp'
--- a/testsuite/libbase/URLTest.cpp     2008-10-20 20:16:01 +0000
+++ b/testsuite/libbase/URLTest.cpp     2008-11-18 17:50:10 +0000
@@ -226,6 +226,18 @@
        check_equals (u27.hostname(), "localhost");
        check_equals (u27.path(), "/");
 
+    URL u28("rtmp://pms.youtube.com:443/");
+    check_equals (u28.protocol(), "rtmp");
+    check_equals (u28.hostname(), "pms.youtube.com");
+    check_equals (u28.port(), "443");
+    check_equals (u28.path(), "/");
+
+    URL u29("rtmp://pms.youtube.com:443");
+    check_equals (u29.protocol(), "rtmp");
+    check_equals (u29.hostname(), "pms.youtube.com");
+    check_equals (u29.port(), "443");
+    check_equals (u29.path(), "/");
+
 
        // TODO: Samba paths
 }

=== modified file 'utilities/Makefile.am'
--- a/utilities/Makefile.am     2008-11-08 18:20:08 +0000
+++ b/utilities/Makefile.am     2008-11-18 16:58:00 +0000
@@ -81,7 +81,7 @@
  GNASH_LIBS += $(GLIB_LIBS) $(GSTREAMER_LIBS)
 #endif
 
-bin_PROGRAMS = gprocessor soldumper dumpshm flvdumper # rtmpget
+bin_PROGRAMS = gprocessor soldumper dumpshm flvdumper rtmpget
 #check_PROGRAMS = gdebug.swf
 
 gprocessor_SOURCES = processor.cpp
@@ -92,8 +92,8 @@
 dumpshm_SOURCES = dumpshm.cpp
 dumpshm_LDADD = $(GNASH_LIBS)
 
-# rtmpget_SOURCES = rtmpget.cpp
-# rtmpget_LDADD = $(GNASH_LIBS)
+rtmpget_SOURCES = rtmpget.cpp
+rtmpget_LDADD = $(GNASH_LIBS)
 
 soldumper_SOURCES = soldumper.cpp
 soldumper_LDADD = $(GNASH_LIBS)

=== modified file 'utilities/rtmpget.cpp'
--- a/utilities/rtmpget.cpp     2008-09-03 21:51:37 +0000
+++ b/utilities/rtmpget.cpp     2008-11-18 19:44:36 +0000
@@ -22,16 +22,6 @@
 #include "gnashconfig.h"
 #endif
 
-#include <string>
-#include <iostream>
-#include <sstream>
-#include <csignal>
-#include <vector>
-#include <sys/mman.h>
-#include <cerrno>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
 #include "gettext.h"
 
 // classes internal to Gnash
@@ -61,11 +51,23 @@
 #include <locale.h>
 #endif
 
+#include <string>
+#include <iostream>
+#include <sstream>
+#include <csignal>
+#include <vector>
+#include <sys/mman.h>
+#include <cerrno>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
 #include <boost/date_time/gregorian/gregorian.hpp>
 #include <boost/date_time/time_zone_base.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
 #include <boost/thread/thread.hpp>
 #include <boost/bind.hpp>
+#include <boost/shared_ptr.hpp>
 
 using gnash::log_debug;
 using namespace std;
@@ -97,6 +99,9 @@
 // it's safe to use these without a mutex, as all threads share the
 // same read-only value.
 
+typedef boost::shared_ptr<amf::Buffer> BufferSharedPtr;
+typedef boost::shared_ptr<amf::Element> ElementSharedPtr;
+
 // end of globals
 
 int
@@ -126,14 +131,14 @@
         { 'a', "app",           Arg_parser::yes  },
         { 'p', "path",          Arg_parser::yes  },
         { 'f', "filename",      Arg_parser::yes  },
-        { 't', "tcurl",                Arg_parser::yes  },
-        { 's', "swfurl",       Arg_parser::yes  },
-        { 'u', "url",          Arg_parser::yes  },
+        { 't', "tcurl",     Arg_parser::yes  },
+        { 's', "swfurl",    Arg_parser::yes  },
+        { 'u', "url",           Arg_parser::yes  },
         { 'n', "netdebug",      Arg_parser::no  }
         };
 
     Arg_parser parser(argc, argv, opts);
-    if( ! parser.error().empty() )     
+    if( ! parser.error().empty() )  
     {
         cout << parser.error() << endl;
         exit(EXIT_FAILURE);
@@ -147,68 +152,62 @@
         dbglogfile.setVerbosity(rcfile.verbosityLevel());
     }    
 
-    RTMPClient client;    
-    short port = 0;
-    string protocol;           // the network protocol, rtmp or http
-    string app;                        // the application name
-    string path;               // the path to the file on the server
-    string query;              // any queries for the host
-    string filename;           // the filename to play
-    string tcUrl;              // the tcUrl field
-    string swfUrl;             // the swfUrl field
-    string pageUrl;            // the pageUrl field
-    string hostname;           // the hostname of the server
-       
+    string app; // the application name
+    string path; // the path to the file on the server
+    string tcUrl; // the tcUrl field
+    string swfUrl; // the swfUrl field
+    string filename; // the filename to play
+
     // Handle command line arguments
     for( int i = 0; i < parser.arguments(); ++i ) {
-       const int code = parser.code(i);
-       try {
-           switch( code ) {
-             case 'h':
-                 version_and_copyright();
-                 usage();
-                 exit(0);
-             case 'V':
-                 version_and_copyright();
-                 exit(0);
-             case 'v':
-                 dbglogfile.setVerbosity();
-                 log_debug (_("Verbose output turned on"));
-                 break;
-             case 'a':
-                 app = parser.argument(i);
-                 break;
-             case 'p':
-                 path = parser.argument(i);
-                 break;
-             case 't':
-                 tcUrl = parser.argument(i);
-                 break;
-             case 's':
-                 swfUrl = parser.argument(i);
-                 break;
-             case 'f':
-                 filename = parser.argument(i);
-                 break;
-             case 'n':
-                 netdebug = true;
-                 break;
-             case 'd':
-                 rcfile.dump();
-                 exit(0);
-                 break;
-             case 0:
-                 infiles.push_back(parser.argument(i));
-                 break;
-             default:
-                 log_error (_("Extraneous argument: %s"), 
parser.argument(i).c_str());
-           }
-       }
-       
-       catch (Arg_parser::ArgParserException &e) {
-           cerr << _("Error parsing command line options: ") << e.what() << 
endl;
-           cerr << _("This is a Gnash bug.") << endl;
-       }
+        const int code = parser.code(i);
+        try {
+            switch( code ) {
+              case 'h':
+                  version_and_copyright();
+                  usage();
+                  exit(0);
+              case 'V':
+                  version_and_copyright();
+                  exit(0);
+              case 'v':
+                  dbglogfile.setVerbosity();
+                  log_debug (_("Verbose output turned on"));
+                  break;
+              case 'a':
+                  app = parser.argument(i);
+                  break;
+              case 'p':
+                  path = parser.argument(i);
+                  break;
+              case 't':
+                  tcUrl = parser.argument(i);
+                  break;
+              case 's':
+                  swfUrl = parser.argument(i);
+                  break;
+              case 'f':
+                  filename = parser.argument(i);
+                  break;
+              case 'n':
+                  netdebug = true;
+                  break;
+              case 'd':
+                  rcfile.dump();
+                  exit(0);
+                  break;
+              case 0:
+                  infiles.push_back(parser.argument(i));
+                  break;
+              default:
+                  log_error (_("Extraneous argument: %s"), 
parser.argument(i).c_str());
+            }
+        }
+        
+        catch (Arg_parser::ArgParserException &e) {
+            cerr << _("Error parsing command line options: ") << e.what() << 
endl;
+            cerr << _("This is a Gnash bug.") << endl;
+        }
     }
     
     if (infiles.empty()) {
@@ -216,102 +215,103 @@
         usage();
         return EXIT_FAILURE;
     }
+
+    RTMPClient client;    
+    short port = 0;
+    string protocol;        // the network protocol, rtmp or http
+    string query;       // any queries for the host
+    string pageUrl;     // the pageUrl field
+    string hostname;        // the hostname of the server
     
-    string url = infiles[0];
+    URL url( infiles[0] );
     string portstr;
     
     // Trap ^C (SIGINT) so we can kill all the threads
     act.sa_handler = cntrlc_handler;
     sigaction (SIGINT, &act, NULL);
 
-    // Take a standard URL apart.
-    string::size_type start = url.find(':', 0);
-    if (start != string::npos) {
-       protocol = url.substr(0, start);
-       start += 3;             // skip past the "://" part after the protocol
-    }
-    string::size_type end = url.find('/', start);
-    if (end != string::npos) {
-       string::size_type pos = url.find(':', start);
-       if (pos != string::npos) {
-           hostname = url.substr(start, pos - start);
-           portstr = url.substr(pos + 1, (end - pos) - 1);
-           port = strtol(portstr.c_str(), NULL, 0) & 0xffff;
-       } else {
-           hostname = url.substr(start, end - start);
-           if ((protocol == "http") || (protocol == "rtmpt")) {
-               port = RTMPT_PORT;
-           }
-           if (protocol == "rtmp") {
-               port = RTMP_PORT;
-           }
-       }
-       start = end;
-    }
-    end = url.rfind('/');
-    if (end != string::npos) {
-       path = url.substr(start + 1, end - start - 1);
-       start = end;
-       filename = url.substr(end + 1);
-    }
-
-    start = path.find('?', 0);
-    if (start != string::npos) {
-       end = path.find('/', 0);
-       query = path.substr(0, end);
-       app = query;
-       path = path.substr(end, path.size());
-    } else {
-       app = path;
-    }
+    protocol = url.protocol();
+    hostname = url.hostname();
+    log_debug("hostname: %s", hostname);
+    portstr = url.port();
+    query = url.querystring();
+
+    if ( portstr.empty() )
+    {
+        if ((protocol == "http") || (protocol == "rtmpt")) {
+            port = RTMPT_PORT;
+        }
+        if (protocol == "rtmp") {
+            port = RTMP_PORT;
+        }
+    }
+    else
+    {
+        port = strtol(portstr.c_str(), NULL, 0) & 0xffff;
+    }
+
+
+    if ( path.empty() )
+    {
+        path = url.path();
+    }
+
+    if ( filename.empty() )
+    {
+        string::size_type end = path.rfind('/');
+        if (end != string::npos) {
+            filename = path.substr(end + 1);
+        }
+    }
+
 
     if (tcUrl.empty()) {
-       tcUrl = protocol + "://" + hostname;
-       if (!portstr.empty()) {
-           tcUrl += ":" + portstr;
-       }
-       if (!query.empty()) {
-           tcUrl += "/" + query;
-       } else {
-           tcUrl += "/" + path;
-       }
+        tcUrl = protocol + "://" + hostname;
+        if (!portstr.empty()) {
+            tcUrl += ":" + portstr;
+        }
+        if (!query.empty()) {
+            tcUrl += "/" + query;
+        } else {
+            tcUrl += "/" + path;
+        }
     }
     
     if (app.empty()) {
-       // Get the application name
-       app = path;
-       
-       if (!query.empty()) {
-           app = path;
-           app += "?" + query;
-       }
+        // Get the application name
+        app = path;
+        
+        if (!query.empty()) {
+            app = path;
+            app += "?" + query;
+        }
     }
 
     if (swfUrl.empty()) {
-       swfUrl = "mediaplayer.swf";
+        swfUrl = "mediaplayer.swf";
     }
     if (pageUrl.empty()) {
-       pageUrl = "http://gnashdev.org";;
+        pageUrl = "http://gnashdev.org";;
     }
     
     if (netdebug) {
-       cerr << "URL is " << url << endl;
-       cerr << "Protocol is " << protocol << endl;
-       cerr << "Host is "  << hostname << endl;
-       cerr << "Port is "  << port << endl;
-       cerr << "Path is "  << path << endl;
-       cerr << "Filename is "  << filename << endl;
-       cerr << "App is "   << app << endl;
-       cerr << "Query is " << query << endl;
-       cerr << "tcUrl is " << tcUrl << endl;
-       cerr << "swfUrl is " << swfUrl << endl;
-       cerr << "pageUrl is " << pageUrl << endl;
+        cerr << "URL is " << url << endl;
+        cerr << "Protocol is " << protocol << endl;
+        cerr << "Host is "  << hostname << endl;
+        cerr << "Port is "  << port << endl;
+        cerr << "Path is "  << path << endl;
+        cerr << "Filename is "  << filename << endl;
+        cerr << "App is "   << app << endl;
+        cerr << "Query is " << query << endl;
+        cerr << "tcUrl is " << tcUrl << endl;
+        cerr << "swfUrl is " << swfUrl << endl;
+        cerr << "pageUrl is " << pageUrl << endl;
     }
 
     client.toggleDebug(netdebug);
     if (client.createClient(hostname, port) == false) {
-       log_error("Can't connect to RTMP server %s", hostname);
-       exit(-1);
+        log_error("Can't connect to RTMP server %s", hostname);
+        exit(-1);
     }
     
     client.handShakeRequest();
@@ -320,106 +320,106 @@
     
     // Make a buffer to hold the handshake data.
     Buffer buf(1537);
-    RTMP::rtmp_head_t *rthead = 0;
-    int ret = 0;
+    // RTMP::rtmp_head_t *rthead = 0;
+    // int ret = 0;
     log_debug("Sending NetConnection Connect message,");
-    Buffer *buf2 = client.encodeConnect(app.c_str(), swfUrl.c_str(), 
tcUrl.c_str(), 615, 124, 1, pageUrl.c_str());
-//    Buffer *buf2 = 
client.encodeConnect("video/2006/sekt/gate06/tablan_valentin", 
"mediaplayer.swf", 
"rtmp://velblod.videolectures.net/video/2006/sekt/gate06/tablan_valentin", 615, 
124, 1, "http://gnashdev.org";);
-//    Buffer *buf2 = client.encodeConnect("oflaDemo", 
"http://192.168.1.70/software/gnash/tests/ofla_demo.swf";, 
"rtmp://localhost/oflaDemo/stream", 615, 124, 1, 
"http://192.168.1.70/software/gnash/tests/index.html";);
+    BufferSharedPtr buf2 = client.encodeConnect(app.c_str(), swfUrl.c_str(), 
tcUrl.c_str(), 615, 124, 1, pageUrl.c_str());
+//    BufferSharedPtr buf2 = 
client.encodeConnect("video/2006/sekt/gate06/tablan_valentin", 
"mediaplayer.swf", 
"rtmp://velblod.videolectures.net/video/2006/sekt/gate06/tablan_valentin", 615, 
124, 1, "http://gnashdev.org";);
+//    BufferSharedPtr buf2 = client.encodeConnect("oflaDemo", 
"http://192.168.1.70/software/gnash/tests/ofla_demo.swf";, 
"rtmp://localhost/oflaDemo/stream", 615, 124, 1, 
"http://192.168.1.70/software/gnash/tests/index.html";);
     buf2->resize(buf2->size() - 6); // FIXME: encodeConnect returns the wrong 
size for the buffer!
     size_t total_size = buf2->size();    
     RTMPMsg *msg1 = client.sendRecvMsg(0x3, RTMP::HEADER_12, total_size, 
RTMP::INVOKE, RTMPMsg::FROM_CLIENT, buf2);
     
     if (msg1) {
-               msg1->dump();
-               if (msg1->getStatus() ==  RTMPMsg::NC_CONNECT_SUCCESS) {
-               log_debug("Sent NetConnection Connect message sucessfully");
-               } else {
-           log_error("Couldn't send NetConnection Connect message,");
-       //          exit(-1);
-               }
+        msg1->dump();
+        if (msg1->getStatus() ==  RTMPMsg::NC_CONNECT_SUCCESS) {
+            log_debug("Sent NetConnection Connect message sucessfully");
+        } else {
+        log_error("Couldn't send NetConnection Connect message,");
+    //      exit(-1);
+        }
     }
     
     // make the createStream for ID 3 encoded object
     log_debug("Sending NetStream::createStream message,");
-    Buffer *buf3 = client.encodeStream(0x2);
+    BufferSharedPtr buf3 = client.encodeStream(0x2);
 //    buf3->dump();
     total_size = buf3->size();
     RTMPMsg *msg2 = client.sendRecvMsg(0x3, RTMP::HEADER_12, total_size, 
RTMP::INVOKE, RTMPMsg::FROM_CLIENT, buf3);
     double streamID = 0.0;
     if (msg2) {
-       msg2->dump();
-       log_debug("Sent NetStream::createStream message successfully.");
-       std::vector<amf::Element *> hell = msg2->getElements();
-       if (hell.size() > 0) {
-           streamID = hell[0]->to_number();
-       } else {
-           if (msg2->getMethodName() == "close") {     
-               log_debug("Got close packet!!! Exiting...");
-               exit(0);
-           }
-           streamID = 0.0;
-       }
+        msg2->dump();
+        log_debug("Sent NetStream::createStream message successfully.");
+        std::vector<ElementSharedPtr> hell = msg2->getElements();
+        if (hell.size() > 0) {
+            streamID = hell[0]->to_number();
+        } else {
+            if (msg2->getMethodName() == "close") { 
+            log_debug("Got close packet!!! Exiting...");
+            exit(0);
+            }
+            streamID = 0.0;
+        }
     } else {
-       log_error("Couldn't send NetStream::createStream message,");
-//     exit(-1);
+        log_error("Couldn't send NetStream::createStream message,");
+    //  exit(-1);
     }
     int id = int(streamID);
     log_debug("Stream ID returned from createStream is: %d", id);
     
     // make the NetStream::play() operations for ID 2 encoded object
 //    log_debug("Sending NetStream play message,");
-    Buffer *buf4 = client.encodeStreamOp(0, RTMP::STREAM_PLAY, false, 
filename.c_str());
-//    Buffer *buf4 = client.encodeStreamOp(0, RTMP::STREAM_PLAY, false, 
"gate06_tablan_bcueu_01");
+    BufferSharedPtr buf4 = client.encodeStreamOp(0, RTMP::STREAM_PLAY, false, 
filename.c_str());
+//    BufferSharedPtr buf4 = client.encodeStreamOp(0, RTMP::STREAM_PLAY, 
false, "gate06_tablan_bcueu_01");
 //     log_debug("TRACE: buf4: %s", hexify(buf4->reference(), buf4->size(), 
true));
     total_size = buf4->size();
     RTMPMsg *msg3 = client.sendRecvMsg(0x8, RTMP::HEADER_12, total_size, 
RTMP::INVOKE, RTMPMsg::FROM_CLIENT, buf4);
     if (msg3) {
         msg3->dump();
         if (msg3->getStatus() ==  RTMPMsg::NS_PLAY_START) {
-           log_debug("Sent NetStream::play message sucessfully.");
-       } else {
-           log_error("Couldn't send NetStream::play message,");
-//         exit(-1);
-       }
+            log_debug("Sent NetStream::play message sucessfully.");
+        } else {
+            log_error("Couldn't send NetStream::play message,");
+//          exit(-1);
+        }
     }
 
     int loop = 20;
     do {
-       Buffer *msgs = client.recvMsg(1);       // use a 1 second timeout
-       if (msgs == 0) {
-           log_error("Never got any data!");
-           exit(-1);
-       }
-       RTMP::queues_t *que = client.split(msgs);
-       if (que == 0) {
-           log_error("Never got any messages!");
-           exit(-1);
-       }
+        BufferSharedPtr msgs = client.recvMsg(1);   // use a 1 second timeout
+        if (msgs == 0) {
+            log_error("Never got any data!");
+            exit(-1);
+        }
+        RTMP::queues_t *que = client.split(msgs);
+        if (que == 0) {
+            log_error("Never got any messages!");
+            exit(-1);
+        }
 
 #if 0
-       deque<CQue *>::iterator it;
-       for (it = que->begin(); it != que->end(); it++) {
-           CQue *q = *(it);
-           q->dump();
-       }
+        deque<CQue *>::iterator it;
+        for (it = que->begin(); it != que->end(); it++) {
+            CQue *q = *(it);
+            q->dump();
+        }
 #endif
-       while (que->size()) {
-           cerr << "QUE SIZE: " << que->size() << endl;
-           Buffer *ptr = que->front()->pop();
-           if ((ptr->size() >= 0) && (ptr->size() <= 0xffff)) {
-               que->pop_front();       // delete the item from the queue
-               RTMP::rtmp_head_t *rthead = client.decodeHeader(ptr);
-               msg2 = client.decodeMsgBody(ptr);
-               if (msg2 == 0) {
-//                 log_error("Couldn't process the RTMP message!");
-                   continue;
-               }
-           } else {
-               log_error("Buffer size (%d) out of range at %d", ptr->size(), 
__LINE__);
-               break;
-           }
-       }
+        while (que->size()) {
+            cerr << "QUE SIZE: " << que->size() << endl;
+            BufferSharedPtr ptr = que->front()->pop();
+            if (!ptr->empty()) {
+                que->pop_front();   // delete the item from the queue
+                /* RTMP::rtmp_head_t *rthead = */ client.decodeHeader(ptr);
+                msg2 = client.decodeMsgBody(ptr);
+                if (msg2 == 0) {
+    //              log_error("Couldn't process the RTMP message!");
+                    continue;
+                }
+            } else {
+                log_error("Buffer size (%d) out of range at %d", ptr->size(), 
__LINE__);
+                break;
+            }
+        }
     } while(loop--);
 
 //     std::vector<amf::Element *> hell = msg2->getElements();
@@ -438,11 +438,11 @@
 
 //     Element *eell = hell[0]->findProperty("level");
 //     if (eell) {
-//     eell->dump();
+//  eell->dump();
 //     }
 //     *eell = hell[0]->findProperty("code");
 //     if (eell) {
-//     eell->dump();
+//  eell->dump();
 //     }
 
 #if 0
@@ -478,22 +478,22 @@
         "Cygnal comes with NO WARRANTY, to the extent permitted by law.\n"
         "You may redistribute copies of Cygnal under the terms of the GNU 
General\n"
         "Public License.  For more information, see the file named COPYING.\n")
-    << endl;
+        << endl;
 }
 
 
 static void
 usage()
 {
-       cout << _("rtmpget -- a file downloaded that uses RTMP.") << endl
-       << endl
-       << _("Usage: rtmpget     [options...]") << endl
-       << _("  -h,  --help          Print this help and exit") << endl
-       << _("  -V,  --version       Print version information and exit") << 
endl
-       << _("  -v,  --verbose       Output verbose debug info") << endl
-       << _("  -n,  --netdebug      Verbose networking debug info") << endl
-       << _("  -d,  --dump          display init file to terminal") << endl
-       << endl;
+    cout << _("rtmpget -- a file downloaded that uses RTMP.") << endl
+        << endl
+        << _("Usage: rtmpget [options...] <url>") << endl
+        << _("  -h,  --help          Print this help and exit") << endl
+        << _("  -V,  --version       Print version information and exit") << 
endl
+        << _("  -v,  --verbose       Output verbose debug info") << endl
+        << _("  -n,  --netdebug      Verbose networking debug info") << endl
+        << _("  -d,  --dump          display init file to terminal") << endl
+        << endl;
 }
 
 // local Variables:


reply via email to

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