[rtmpdump] [PATCH] AMF Callback

Chris Larsen clarsen at euphoriaaudio.com
Wed Sep 22 23:12:12 CEST 2010


Hi all, here's an important patch that may be useful for a lot of people.
It's a simple little callback for AMF objects so that your app can process
any AMF codes returned from the server. If you don't use the callback,
nothing happens. I use it to parse NetStream status events and such. Let me
know what ya'll think, thanks.

 

Sincerely,

Chris Larsen

Euphoria Audio, LLC

www.euphoriaaudio.com

 

Index: amf.c

===================================================================

--- amf.c               (revision 548)

+++ amf.c            (working copy)

@@ -1144,6 +1144,11 @@

void

AMF_Dump(AMFObject *obj)

{

+             // send to the callback

+             if (amfcb){

+                             amfcb(obj);

+             }

+

   int n;

   RTMP_Log(RTMP_LOGDEBUG, "(object begin)");

   for (n = 0; n < obj->o_num; n++)

@@ -1184,3 +1189,8 @@

     return (AVal *)&AV_empty;

   return &cd->cd_props[nIndex];

}

+

+void 

+AMF_ObjectSetCallback(AMF_ObjectCallback *cb){

+             amfcb = cb;

+}

Index: amf.h

===================================================================

--- amf.h              (revision 548)

+++ amf.h           (working copy)

@@ -154,6 +154,10 @@

   void AMF3CD_AddProp(AMF3ClassDef * cd, AVal * prop);

   AVal *AMF3CD_GetProp(AMF3ClassDef * cd, int idx);

+  typedef void (AMF_ObjectCallback)(AMFObject *);

+  static AMF_ObjectCallback *amfcb;

+  void AMF_ObjectSetCallback(AMF_ObjectCallback *cb);

+

#ifdef __cplusplus

}

#endif

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mplayerhq.hu/pipermail/rtmpdump/attachments/20100922/768bccf4/attachment.htm>


More information about the rtmpdump mailing list