[rtmpdump] [PATCH] AMF Object Callback

Chris Larsen clarsen at euphoriaaudio.com
Tue Aug 2 17:56:58 CEST 2011

Thank you very much for your post Adam, it's a huge help and now I know a bit more about what Howard's after. I modified your first patch with the linked list and such as Howard specified.

> Updated the patch and examples as per suggestions, as well as changing the callback parameter from an AMFObject to a more generic, extendible custom 
> struct with a union, similar to how AMFObjectProperty stores data, so future callback hooks can return something other than an AMFObject.

I don't know if the response needs to be a union since we're only creating a callback for AMF data and not other types, but if ya'll want to use a union that's cool.

> As for comment 2, I disagree here. The code distinguishes between the three states, however the default is that an error in the callback will continue librtmp's 
> processing rather than aborting it, as more often when an error occurs you'd want librtmp to do the sane thing rather than dropping the packet completely. 
> However, for when that's needed I've also included RTMP_CB_ERROR_ABORT return code. 

It is nice to have the ability for the callback to return a number of different responses so I implemented Howard's types and added some logging lines to let the user know exactly what the callback did within libRTMP.

> For testing, can rtmpsrv be used (or modified) to test auth schemes using callbacks, or is it too much of a 'stub'? Or do we have some list of public rtmp servers 
> using custom crypto to test this on?

Unfortunately I don't have any public servers to use (and I would have included the authentication code directly in HandleInvoke but an NDA is preventing me, hence the desire for a callback). But I did run tests with this patch on Windows and Ubuntu and it worked properly and let me perform the authentication I needed as well as extract status codes for use in my app.

This version also blocks duplicate callback subscriptions. It will also execute all callbacks until one callback tells it to abort. That way you can have a logging callback that watches all messages and then a separate one that takes action on a certain type.

Let me know what ya'll think, thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: amf_callback_v7.patch
Type: application/octet-stream
Size: 8166 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/rtmpdump/attachments/20110802/15fa9f8d/attachment.obj>

More information about the rtmpdump mailing list