gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r12185: Some fixes to LocalConnectio


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r12185: Some fixes to LocalConnection and shared memory.
Date: Tue, 18 May 2010 11:52:31 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 12185 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Tue 2010-05-18 11:52:31 +0200
message:
  Some fixes to LocalConnection and shared memory.
  
  Minor cleanups and renames for coding style.
modified:
  gui/gui.cpp
  libbase/AMF.cpp
  libbase/AMF.h
  libbase/RTMP.cpp
  libbase/SharedMem.cpp
  libcore/AMFConverter.cpp
  libcore/AMFConverter.h
  libcore/as_value.cpp
  libcore/as_value.h
  libcore/asobj/flash/net/LocalConnection_as.cpp
  libcore/asobj/flash/net/NetConnection_as.cpp
  libcore/asobj/flash/net/NetStream_as.cpp
  libcore/asobj/flash/net/SharedObject_as.cpp
  librender/Renderer.h
  utilities/rtmpget.cpp
=== modified file 'gui/gui.cpp'
--- a/gui/gui.cpp       2010-05-04 20:58:55 +0000
+++ b/gui/gui.cpp       2010-05-18 08:34:47 +0000
@@ -113,8 +113,6 @@
     //       before and destroyed after _virtualClock !
     ,_systemClock()
     ,_virtualClock(_systemClock)
-//     ,_hwaccel_backend("none")
-//     ,_renderer_backend("agg")
 #ifdef ENABLE_KEYBOARD_MOUSE_MOVEMENTS 
     ,_xpointer(0)
     ,_ypointer(0)
@@ -159,9 +157,6 @@
     //       before and destroyed after _virtualClock !
     ,_systemClock()
     ,_virtualClock(_systemClock)
-//     ,_hwaccel_backend("none")
-//     ,_renderer_backend("agg")
-
 #ifdef ENABLE_KEYBOARD_MOUSE_MOVEMENTS 
     ,_xpointer(0)
     ,_ypointer(0)

=== modified file 'libbase/AMF.cpp'
--- a/libbase/AMF.cpp   2010-04-21 18:29:59 +0000
+++ b/libbase/AMF.cpp   2010-05-18 08:00:19 +0000
@@ -35,7 +35,7 @@
 
 namespace gnash {
 
-namespace AMF {
+namespace amf {
 
 bool
 readBoolean(const boost::uint8_t*& pos, const boost::uint8_t* _end)
@@ -190,5 +190,5 @@
 }
 
 
-} // namespace AMF
+} // namespace amf
 } // namespace gnash

=== modified file 'libbase/AMF.h'
--- a/libbase/AMF.h     2010-04-21 18:29:59 +0000
+++ b/libbase/AMF.h     2010-05-18 08:00:19 +0000
@@ -40,7 +40,7 @@
 /// AMF is a simple serialization format for ActionScript objects and values,
 /// allowing them to be stored and transmitted. The AMF namespace provides
 /// both low-level and high-level conversion to and from AMF buffers.
-namespace AMF {
+namespace amf {
 
 enum Type {
     NOTYPE            = -1,
@@ -174,7 +174,8 @@
 /// This does not encode a type byte; it is used for cases where a string is
 /// required, such as for the name of an object property, and therefore does
 /// not use a type byte.
-DSOEXPORT void writePlainString(SimpleBuffer& buf, const std::string& str, 
Type t);
+DSOEXPORT void writePlainString(SimpleBuffer& buf, const std::string& str,
+        Type t);
 
 /// Encode a string-value pair.
 //

=== modified file 'libbase/RTMP.cpp'
--- a/libbase/RTMP.cpp  2010-03-11 01:47:08 +0000
+++ b/libbase/RTMP.cpp  2010-05-18 08:00:19 +0000
@@ -522,7 +522,7 @@
               __FUNCTION__);
               return false;
             }
-          hr._timestamp = AMF::readNetworkLong(header+nSize);
+          hr._timestamp = amf::readNetworkLong(header+nSize);
           hSize += 4;
         
     }
@@ -833,10 +833,10 @@
 
     /* we invoked a remote method */
     if (hr.packetType == PACKET_TYPE_INVOKE) {
-        assert(payloadData(packet)[0] == AMF::STRING_AMF0);
+        assert(payloadData(packet)[0] == amf::STRING_AMF0);
         const boost::uint8_t* pos = payloadData(packet) + 1;
         const boost::uint8_t* end = payloadEnd(packet);
-        const std::string& s = AMF::readString(pos, end);
+        const std::string& s = amf::readString(pos, end);
         log_debug( "Calling remote method %s", s);
     }
 
@@ -1099,7 +1099,7 @@
 handleChangeChunkSize(RTMP& r, const RTMPPacket& packet)
 {
     if (payloadSize(packet) >= 4) {
-        r._inChunkSize = AMF::readNetworkLong(payloadData(packet));
+        r._inChunkSize = amf::readNetworkLong(payloadData(packet));
         log_debug( "Changed chunk size to %d", r._inChunkSize);
     }
 }
@@ -1116,14 +1116,14 @@
     }
     
     const ControlType t = 
-        static_cast<ControlType>(AMF::readNetworkShort(payloadData(packet)));
+        static_cast<ControlType>(amf::readNetworkShort(payloadData(packet)));
     
     if (size < 6) {
         log_error("Control packet (%s) data too short", t);
         return;
     }
     
-    const int arg = AMF::readNetworkLong(payloadData(packet) + 2);
+    const int arg = amf::readNetworkLong(payloadData(packet) + 2);
     log_debug( "Received control packet %s with argument %s", t, arg);
   
     switch (t)
@@ -1166,7 +1166,7 @@
 void
 handleServerBW(RTMP& r, const RTMPPacket& packet)
 {
-    const boost::uint32_t bw = AMF::readNetworkLong(payloadData(packet));
+    const boost::uint32_t bw = amf::readNetworkLong(payloadData(packet));
     log_debug( "Server bandwidth is %s", bw);
     r.setServerBandwidth(bw);
 }
@@ -1174,7 +1174,7 @@
 void
 handleClientBW(RTMP& r, const RTMPPacket& packet)
 {
-    const boost::uint32_t bw = AMF::readNetworkLong(payloadData(packet));
+    const boost::uint32_t bw = amf::readNetworkLong(payloadData(packet));
 
     r.setBandwidth(bw);
 

=== modified file 'libbase/SharedMem.cpp'
--- a/libbase/SharedMem.cpp     2010-04-14 11:18:29 +0000
+++ b/libbase/SharedMem.cpp     2010-05-18 07:51:05 +0000
@@ -74,14 +74,24 @@
 SharedMem::~SharedMem()
 {
 #ifndef _WIN32
-    shmdt(_addr);
-    struct shmid_ds ds;
-    shmctl(_shmid, IPC_STAT, &ds);
+    if (::shmdt(_addr) < 0) {
+        const int err = errno;
+        log_error("Error detaching shared memory: %s", std::strerror(err));
+    }
 
-    // Note that this isn't completely reliable.
-    if (!ds.shm_nattch) {
-        log_debug("No shared memory users left. Removing segment.");
-        shmctl(_shmid, IPC_RMID, 0);
+    // We can still try to shut it down.
+    struct ::shmid_ds ds;
+    if (::shmctl(_shmid, IPC_STAT, &ds) < 0) {
+        const int err = errno;
+        log_error("Error during stat of shared memory segment: %s",
+                std::strerror(err));
+    }
+    else {
+        // Note that this isn't completely reliable.
+        if (!ds.shm_nattch) {
+            log_debug("No shared memory users left. Removing segment.");
+            ::shmctl(_shmid, IPC_RMID, 0);
+        }
     }
 #else
     // Windows code here.

=== modified file 'libcore/AMFConverter.cpp'
--- a/libcore/AMFConverter.cpp  2010-03-11 01:47:08 +0000
+++ b/libcore/AMFConverter.cpp  2010-05-18 08:00:19 +0000
@@ -42,7 +42,7 @@
 
 namespace gnash {
 
-namespace AMF {
+namespace amf {
 
 namespace {
 
@@ -480,7 +480,7 @@
         // followed by an OBJECT_END_AMF0 (0x09) byte
         if (!strlen) {
             // expect an object terminator here
-            if (*_pos != AMF::OBJECT_END_AMF0) {
+            if (*_pos != amf::OBJECT_END_AMF0) {
                 log_error("MALFORMED AMF: empty member name not "
                         "followed by OBJECT_END_AMF0 byte");
             }
@@ -527,9 +527,9 @@
 
     as_value tmp;
     std::string keyString;
-    for(;;) {
+    for (;;) {
 
-        if (!operator()(tmp, AMF::STRING_AMF0)) {
+        if (!operator()(tmp, amf::STRING_AMF0)) {
             throw AMFException("Could not read object property name");
         }
         keyString = tmp.to_string();
@@ -614,5 +614,5 @@
     return date;
 }
 
-} // namespace AMF
+} // namespace amf
 } // namespace gnash

=== modified file 'libcore/AMFConverter.h'
--- a/libcore/AMFConverter.h    2010-03-11 17:03:04 +0000
+++ b/libcore/AMFConverter.h    2010-05-18 08:00:19 +0000
@@ -41,11 +41,11 @@
 /// AMF is a simple serialization format for ActionScript objects and values,
 /// allowing them to be stored and transmitted. These classes convert between
 /// AMF buffers and the objects they contain.
-namespace AMF {
+namespace amf {
 
 /// A class to compose AMF buffers.
 //
-/// A single AMF::Writer class can take successive values and encode them
+/// A single amf::Writer class can take successive values and encode them
 /// in a single buffer. The class takes care of object references.
 //
 /// This class merely encodes basic types such as strings, numbers, and
@@ -124,7 +124,7 @@
 
     /// Construct a Reader with pointers into an AMF buffer.
     //
-    /// You can use the AMF::Reader in combination with other reads on the
+    /// You can use the amf::Reader in combination with other reads on the
     /// data as long as the read position is never moved after end.
     //
     /// @param pos      The read position in the buffer. This is moved after

=== modified file 'libcore/as_value.cpp'
--- a/libcore/as_value.cpp      2010-04-21 02:33:58 +0000
+++ b/libcore/as_value.cpp      2010-05-18 08:01:01 +0000
@@ -1004,7 +1004,7 @@
 }
 
 bool
-as_value::writeAMF0(AMF::Writer& w) const
+as_value::writeAMF0(amf::Writer& w) const
 {
 
     assert (!is_exception());

=== modified file 'libcore/as_value.h'
--- a/libcore/as_value.h        2010-04-21 00:43:23 +0000
+++ b/libcore/as_value.h        2010-05-18 08:00:19 +0000
@@ -41,7 +41,7 @@
        class as_function;
        class MovieClip;
        class DisplayObject;
-    namespace AMF {
+    namespace amf {
         class Writer;
     }
 }
@@ -368,7 +368,7 @@
     /// @param allowStrictArray
     ///     If true strict arrays will be encoded a STRICT_ARRAY types.
     ///
-    bool writeAMF0(AMF::Writer& w) const;
+    bool writeAMF0(amf::Writer& w) const;
 
 private:
 

=== modified file 'libcore/asobj/flash/net/LocalConnection_as.cpp'
--- a/libcore/asobj/flash/net/LocalConnection_as.cpp    2010-02-20 07:55:10 
+0000
+++ b/libcore/asobj/flash/net/LocalConnection_as.cpp    2010-05-18 08:00:19 
+0000
@@ -137,9 +137,10 @@
     bool findListener(const std::string& name, SharedMem& mem);
     void getMarker(SharedMem::iterator& i, SharedMem::iterator end);
     void markRead(SharedMem& m);
+    inline boost::uint32_t getTimestamp(const VM& vm);
 
     /// Read the AMF data and invoke the function.
-    void executeAMFFunction(as_object& owner, AMF::Reader& rd);
+    void executeAMFFunction(as_object& owner, amf::Reader& rd);
 
     struct ConnectionData
     {
@@ -225,8 +226,7 @@
     {
         assert(d.get());
         VM& vm = getVM(owner());
-        const boost::uint32_t time = vm.getTime();
-        d->ts = time;
+        d->ts = getTimestamp(vm);
         _queue.push_back(d);
         
         // Register callback so we can send the data on the next advance.
@@ -325,7 +325,7 @@
         // End at reported size of AMF sequence.
         const boost::uint8_t* end = b + size;
 
-        AMF::Reader rd(b, end, getGlobal(owner()));
+        amf::Reader rd(b, end, getGlobal(owner()));
         as_value a;
 
         // Get the connection name. That's all we need to remove expired
@@ -343,7 +343,7 @@
             const size_t timeout = 4 * 1000;
 
             VM& vm = getVM(owner());
-            const boost::uint32_t timeNow = vm.getTime();
+            const boost::uint32_t timeNow = getTimestamp(vm);
 
             if (timeNow - timestamp > timeout) {
                 log_debug("Data %s expired at %s. Removing its target "
@@ -671,7 +671,7 @@
     SimpleBuffer& buf = cd->data;
 
     // Don't know whether strict arrays are allowed
-    AMF::Writer w(buf, false);
+    amf::Writer w(buf, false);
     const std::string& domain = relay->domain();
     
     w.writeString(domain + ":" + name);
@@ -887,7 +887,7 @@
 //
 /// This function does not mark the data for overwriting.
 void
-executeAMFFunction(as_object& o, AMF::Reader& rd)
+executeAMFFunction(as_object& o, amf::Reader& rd)
 {
     as_value a;
 
@@ -958,6 +958,22 @@
 {
     std::fill_n(m.begin() + 8, 8, 0);
 }
+    
+/// Return a number usable as a timestamp.
+//
+/// Different players use different values here. The Linux players use:
+/// Version 9: the time since player startup
+/// Version 10: the system uptime.
+//
+/// Version 10 fails if it recieves a value outside the signed 32-bit int
+/// range, so we surmise that there is an undocumented conversion to signed
+/// in that player. We make sure the value never exceeds 0x7fffffff.
+inline boost::uint32_t
+getTimestamp(const VM& vm)
+{
+    return vm.getTime() & 0x7fffffff;
+}
+
 } // anonymous namespace
 
 } // end of gnash namespace

=== modified file 'libcore/asobj/flash/net/NetConnection_as.cpp'
--- a/libcore/asobj/flash/net/NetConnection_as.cpp      2010-05-06 10:19:43 
+0000
+++ b/libcore/asobj/flash/net/NetConnection_as.cpp      2010-05-18 08:00:19 
+0000
@@ -379,7 +379,7 @@
                 const boost::uint8_t *b = reply.data() + reply_start;
                 const boost::uint8_t *end = reply.data() + reply.size();
                 
-                AMF::Reader rd(b, end, getGlobal(_nc.owner()));
+                amf::Reader rd(b, end, getGlobal(_nc.owner()));
 
                 // parse header
                 b += 2; // skip version indicator and client id
@@ -626,11 +626,11 @@
     buf.append("\000\000\000\000", 4); // total size to be filled in later
 
     // encode array of arguments to remote method
-    buf.appendByte(AMF::STRICT_ARRAY_AMF0);
+    buf.appendByte(amf::STRICT_ARRAY_AMF0);
     buf.appendNetworkLong(args.size() - firstArg);
 
     // STRICT_ARRAY encoding is allowed for remoting
-    AMF::Writer w(buf, true);
+    amf::Writer w(buf, true);
 
     for (unsigned int i = firstArg; i < args.size(); ++i)
     {

=== modified file 'libcore/asobj/flash/net/NetStream_as.cpp'
--- a/libcore/asobj/flash/net/NetStream_as.cpp  2010-03-11 01:47:08 +0000
+++ b/libcore/asobj/flash/net/NetStream_as.cpp  2010-05-18 08:10:43 +0000
@@ -1946,7 +1946,7 @@
        string_table& st = getStringTable(thisPtr);
        string_table::key funcKey = st.find(funcName);
 
-    AMF::Reader rd(ptr, endptr, getGlobal(thisPtr));
+    amf::Reader rd(ptr, endptr, getGlobal(thisPtr));
 
        as_value arg;
        if (!rd(arg)) {

=== modified file 'libcore/asobj/flash/net/SharedObject_as.cpp'
--- a/libcore/asobj/flash/net/SharedObject_as.cpp       2010-03-11 01:47:08 
+0000
+++ b/libcore/asobj/flash/net/SharedObject_as.cpp       2010-05-18 08:10:43 
+0000
@@ -109,7 +109,7 @@
 
 public:
 
-    SOLPropsBufSerializer(AMF::Writer w, string_table& st)
+    SOLPropsBufSerializer(amf::Writer w, string_table& st)
         :
         _writer(w),
         _st(st),
@@ -177,7 +177,7 @@
 
 private:
 
-    AMF::Writer _writer;
+    amf::Writer _writer;
 
     /// String table for looking up property names as strings.
     string_table& _st;
@@ -934,7 +934,7 @@
             return data;
         }
 
-        AMF::Reader rd(buf, end, gl);
+        amf::Reader rd(buf, end, gl);
 
         while (buf != end) {
 
@@ -1055,7 +1055,7 @@
     
     // see http://osflash.org/documentation/amf/envelopes/sharedobject
     // Do not encode strict arrays!
-    AMF::Writer w(buf, false);
+    amf::Writer w(buf, false);
     string_table& st = getStringTable(data);
 
     SOLPropsBufSerializer props(w, st);

=== modified file 'librender/Renderer.h'
--- a/librender/Renderer.h      2010-03-14 06:02:38 +0000
+++ b/librender/Renderer.h      2010-05-18 08:11:33 +0000
@@ -180,21 +180,6 @@
 
 namespace gnash {
 
-class DSOEXPORT render_cache_manager
-{
-public:
-    //Virtual dtor, removes compiler warning.
-    virtual ~render_cache_manager(){}
-
-    /// Clears the cache completely (necessary for runtime shapes / drawing 
API)
-    virtual void clear() 
-    {
-        // TODO: Make this abstract to force real implementation!!
-        // nop
-    } 
-};
-
-
 /// Base class for render handlers.
 //
 /// You must define a subclass of Renderer, and pass an

=== modified file 'utilities/rtmpget.cpp'
--- a/utilities/rtmpget.cpp     2010-03-11 01:47:08 +0000
+++ b/utilities/rtmpget.cpp     2010-05-18 08:55:25 +0000
@@ -204,26 +204,26 @@
 
     SimpleBuffer buf;
 
-    AMF::write(buf, "connect");
+    amf::write(buf, "connect");
     const size_t cn = nc.callNumber();
     
     /// Call number?
-    AMF::write(buf, static_cast<double>(cn));
+    amf::write(buf, static_cast<double>(cn));
 
-    buf.appendByte(AMF::OBJECT_AMF0);
-    if (!app.empty()) AMF::writeProperty(buf, "app", app);
-    if (!ver.empty()) AMF::writeProperty(buf, "flashVer", ver);
-    if (!swfurl.empty()) AMF::writeProperty(buf, "swfUrl", swfurl);
-    if (!tcurl.empty()) AMF::writeProperty(buf, "tcUrl", tcurl);
-    AMF::writeProperty(buf, "fpad", false);
-    AMF::writeProperty(buf, "capabilities", 15.0);
-    AMF::writeProperty(buf, "audioCodecs", 3191.0);
-    AMF::writeProperty(buf, "videoCodecs", 252.0);
-    AMF::writeProperty(buf, "videoFunction", 1.0);
-    if (!pageurl.empty()) AMF::writeProperty(buf, "pageUrl", pageurl);
-    buf.appendByte(0);
-    buf.appendByte(0);
-    buf.appendByte(AMF::OBJECT_END_AMF0);
+    buf.appendByte(amf::OBJECT_AMF0);
+    if (!app.empty()) amf::writeProperty(buf, "app", app);
+    if (!ver.empty()) amf::writeProperty(buf, "flashVer", ver);
+    if (!swfurl.empty()) amf::writeProperty(buf, "swfUrl", swfurl);
+    if (!tcurl.empty()) amf::writeProperty(buf, "tcUrl", tcurl);
+    amf::writeProperty(buf, "fpad", false);
+    amf::writeProperty(buf, "capabilities", 15.0);
+    amf::writeProperty(buf, "audioCodecs", 3191.0);
+    amf::writeProperty(buf, "videoCodecs", 252.0);
+    amf::writeProperty(buf, "videoFunction", 1.0);
+    if (!pageurl.empty()) amf::writeProperty(buf, "pageUrl", pageurl);
+    buf.appendByte(0);
+    buf.appendByte(0);
+    buf.appendByte(amf::OBJECT_END_AMF0);
 
     nc.queueCall(cn, "connect");
     r.call(buf);
@@ -237,9 +237,9 @@
     
     const size_t cn = nc.callNumber();
 
-    AMF::write(buf, "_checkbw");
-    AMF::write(buf, static_cast<double>(cn));
-    buf.appendByte(AMF::NULL_AMF0);
+    amf::write(buf, "_checkbw");
+    amf::write(buf, static_cast<double>(cn));
+    buf.appendByte(amf::NULL_AMF0);
 
     nc.queueCall(cn, "_checkbw");
     r.call(buf);
@@ -250,10 +250,10 @@
 {
     // Infofield1?
     SimpleBuffer buf;
-    AMF::write(buf, "_result");
-    AMF::write(buf, txn);
-    buf.appendByte(AMF::NULL_AMF0);
-    AMF::write(buf, 0.0);
+    amf::write(buf, "_result");
+    amf::write(buf, txn);
+    buf.appendByte(amf::NULL_AMF0);
+    amf::write(buf, 0.0);
     
     r.call(buf);
 
@@ -266,17 +266,17 @@
 
     SimpleBuffer buf;
 
-    AMF::write(buf, "pause");
+    amf::write(buf, "pause");
 
     // What is this? The play stream? Call number?
-    AMF::write(buf, 0.0);
-    buf.appendByte(AMF::NULL_AMF0);
+    amf::write(buf, 0.0);
+    buf.appendByte(amf::NULL_AMF0);
 
     log_debug( "Pause: flag=%s, time=%d", flag, time);
-    AMF::write(buf, flag);
+    amf::write(buf, flag);
 
     // "this.time", i.e. NetStream.time.
-    AMF::write(buf, time * 1000.0);
+    amf::write(buf, time * 1000.0);
 
     r.play(buf, streamid);
 }
@@ -297,15 +297,15 @@
 
     SimpleBuffer buf;
 
-    AMF::write(buf, "play");
+    amf::write(buf, "play");
 
     // What is this? The play stream? Call number?
-    AMF::write(buf, 0.0);
-    buf.appendByte(AMF::NULL_AMF0);
+    amf::write(buf, 0.0);
+    buf.appendByte(amf::NULL_AMF0);
 
     log_debug( "seekTime=%.2f, dLength=%d, sending play: %s",
         seektime, length, nc.playpath());
-    AMF::write(buf, nc.playpath());
+    amf::write(buf, nc.playpath());
 
     // Optional parameters start and len.
     //
@@ -314,14 +314,14 @@
     //  any open a live stream
     //  -1: plays a live stream
     // >=0: plays a recorded streams from 'start' milliseconds
-    AMF::write(buf, seektime);
+    amf::write(buf, seektime);
 
     // len: -1, 0, positive number
     //  -1: plays live or recorded stream to the end (default)
     //   0: plays a frame 'start' ms away from the beginning
     //  >0: plays a live or recoded stream for 'len' milliseconds
     //enc += EncodeNumber(enc, -1.0); // len
-    AMF::write(buf, length);
+    amf::write(buf, length);
     
     r.play(buf, streamid);
 }
@@ -332,9 +332,9 @@
     const size_t cn = nc.callNumber();
 
     SimpleBuffer buf;
-    AMF::write(buf, "createStream");
-    AMF::write(buf, static_cast<double>(cn));
-    buf.appendByte(AMF::NULL_AMF0);
+    amf::write(buf, "createStream");
+    amf::write(buf, static_cast<double>(cn));
+    buf.appendByte(amf::NULL_AMF0);
     nc.queueCall(cn, "createStream");
     r.call(buf);
 }
@@ -344,12 +344,12 @@
     const size_t cn = nc.callNumber();
 
     SimpleBuffer buf;
-    AMF::write(buf, "deleteStream");
+    amf::write(buf, "deleteStream");
 
     // Call number?
-    AMF::write(buf, static_cast<double>(cn));
-    buf.appendByte(AMF::NULL_AMF0);
-    AMF::write(buf, id);
+    amf::write(buf, static_cast<double>(cn));
+    buf.appendByte(amf::NULL_AMF0);
+    amf::write(buf, id);
     nc.queueCall(cn, "deleteStream");
     r.call(buf);
 }
@@ -360,12 +360,12 @@
     const size_t cn = nc.callNumber();
 
     SimpleBuffer buf;
-    AMF::write(buf, "FCSubscribe");
+    amf::write(buf, "FCSubscribe");
 
     // What is this?
-    AMF::write(buf, static_cast<double>(cn));
-    buf.appendByte(AMF::NULL_AMF0);
-    AMF::write(buf, subscribepath);
+    amf::write(buf, static_cast<double>(cn));
+    buf.appendByte(amf::NULL_AMF0);
+    amf::write(buf, subscribepath);
 
     nc.queueCall(cn, "FCSubscribe");
     r.call(buf);
@@ -550,10 +550,10 @@
     }
 
     ++payload;
-    std::string method = AMF::readString(payload, end);
+    std::string method = amf::readString(payload, end);
 
     log_debug("Invoke: read method string %s", method);
-    if (*payload != AMF::NUMBER_AMF0) return false;
+    if (*payload != amf::NUMBER_AMF0) return false;
     ++payload;
 
 
@@ -565,7 +565,7 @@
     /// by us.
     if (method == "_result") {
         
-        const double txn = AMF::readNumber(payload, end);
+        const double txn = amf::readNumber(payload, end);
         std::string calledMethod = nc.getCall(txn);
 
         log_debug("Received result for method call %s (%s)",
@@ -580,15 +580,15 @@
         else if (calledMethod == "createStream") {
             
             log_debug("createStream invoked");
-            if (*payload != AMF::NULL_AMF0) return false;
+            if (*payload != amf::NULL_AMF0) return false;
             ++payload;
             
             log_debug("AMF buffer for createStream: %s\n",
                     hexify(payload, end - payload, false));
 
-            if (*payload != AMF::NUMBER_AMF0) return false;
+            if (*payload != amf::NUMBER_AMF0) return false;
             ++payload;
-            double sid = AMF::readNumber(payload, end);
+            double sid = amf::readNumber(payload, end);
 
             log_debug("Stream ID: %s", sid);
             nc.setStreamID(sid);
@@ -608,7 +608,7 @@
 
     /// These are remote function calls initiated by the server .
 
-    const double txn = AMF::readNumber(payload, end);
+    const double txn = amf::readNumber(payload, end);
     log_debug("Received server call %s %s",
             boost::io::group(std::setprecision(15), txn),
             txn ? "" : "(no reply expected)");
@@ -641,14 +641,14 @@
 
     if (method == "_onbwdone") {
 
-        if (*payload != AMF::NULL_AMF0) return false;
+        if (*payload != amf::NULL_AMF0) return false;
         ++payload;
 
         log_debug("AMF buffer for _onbwdone: %s\n",
                 hexify(payload, end - payload, false));
 
-        double latency = AMF::readNumber(payload, end);
-        double bandwidth = AMF::readNumber(payload, end);
+        double latency = amf::readNumber(payload, end);
+        double bandwidth = amf::readNumber(payload, end);
         log_debug("Latency: %s, bandwidth %s", latency, bandwidth);
         return ret;
     }
@@ -677,13 +677,13 @@
     }
     
     if (method == "onStatus") {
-        if (*payload != AMF::NULL_AMF0) return false;
+        if (*payload != amf::NULL_AMF0) return false;
         ++payload;
 #if 1
         log_debug("AMF buffer for onstatus: %s",
                 hexify(payload, end - payload, true));
 #endif
-        if (*payload != AMF::OBJECT_AMF0) {
+        if (*payload != amf::OBJECT_AMF0) {
             log_debug("not an object");
             return false;
         }
@@ -695,9 +695,9 @@
         try {
 
             // Hack.
-            while (payload < end && *payload != AMF::OBJECT_END_AMF0) {
+            while (payload < end && *payload != amf::OBJECT_END_AMF0) {
 
-                const std::string& n = AMF::readString(payload, end);
+                const std::string& n = amf::readString(payload, end);
                 if (n.empty()) continue;
 
                 //log_debug("read string %s", n);
@@ -705,20 +705,20 @@
 
                 // There's no guarantee that all members are strings, but
                 // it's usually enough for this.
-                if (*payload != AMF::STRING_AMF0) {
+                if (*payload != amf::STRING_AMF0) {
                     break;
                 }
 
                 ++payload;
                 if (payload == end) break;
 
-                const std::string& v = AMF::readString(payload, end);
+                const std::string& v = amf::readString(payload, end);
                 if (payload == end) break;
                 if (n == "code") code = v;
                 if (n == "level") level = v;
             }
         }
-        catch (const AMF::AMFException& e) {
+        catch (const amf::AMFException& e) {
             throw;
             return false;
         }


reply via email to

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