[FFmpeg-devel] [PATCH] RTMP client support for lavf

Kostya kostya.shishkov
Tue Jul 21 10:58:56 CEST 2009


On Tue, Jul 21, 2009 at 10:23:33AM +0200, Diego Biurrun wrote:
> On Tue, Jul 21, 2009 at 11:04:09AM +0300, Kostya wrote:
> > 
> > --- libavformat/rtmpproto.c	(revision 0)
> > +++ libavformat/rtmpproto.c	(revision 0)
> > @@ -0,0 +1,630 @@
> > +static void gen_play(URLContext *s, RTMPContext *rt)
> > +{
> > +    RTMPPacket pkt;
> > +    uint8_t *p;
> > +
> > +    //av_log(s, AV_LOG_DEBUG, "Sending play command for '%s'\n", rt->playpath);
> > +    ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0,
> > +                       29 + strlen(rt->playpath));
> 
> indentation
> 
> > --- libavformat/rtmppkt.c	(revision 0)
> > +++ libavformat/rtmppkt.c	(revision 0)
> > @@ -0,0 +1,261 @@
> > +int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
> > +                     int chunk_size, RTMPPacket *prev_pkt)
> 
> indentation

fixed in all places where I found that
 
> > +    if (url_read(h, &hdr, 1) != 1) {
> > +        return AVERROR(EIO);
> > +    }
> 
> pointless {}

Here and below there used to be error messages, so they are leftovers.
Removed though.

> > +    if (hdr == RTMP_PS_ONEBYTE) {
> > +        //todo
> > +        return -1;
> > +    } else {
> > +        if (url_read_complete(h, buf, 3) != 3) {
> > +            return AVERROR(EIO);
> > +        }
> 
> ditto
> 
> > +        timestamp = AV_RB24(buf);
> > +        if (hdr != RTMP_PS_FOURBYTES) {
> > +            if (url_read_complete(h, buf, 3) != 3) {
> > +                return AVERROR(EIO);
> > +            }
> 
> ditto
> 
> > +            data_size = AV_RB24(buf);
> > +            if (url_read_complete(h, &type, 1) != 1) {
> > +                return AVERROR(EIO);
> > +            }
> 
> ditto
> 
> > +            if (hdr == RTMP_PS_TWELVEBYTES) {
> > +                if (url_read_complete(h, buf, 4) != 4) {
> > +                    return AVERROR(EIO);
> > +                }
> 
> ditto
> 
> > +    while (data_size > 0) {
> > +        int toread = FFMIN(data_size, chunk_size);
> > +        int r;
> > +        if ((r = url_read_complete(h, p->data + offset, toread)) != toread) {
> > +            ff_rtmp_packet_destroy(p);
> > +            return AVERROR(EIO);
> > +        }
> > +        data_size -= chunk_size;
> > +        offset    += chunk_size;
> > +        if (data_size > 0) {
> > +            url_read_complete(h, &t, 1); //marker
> > +            if (t != (0xC0 + channel_id)) {
> > +                return -1;
> > +            }
> 
> ditto
> 
> > +int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
> > +                      int chunk_size, RTMPPacket *prev_pkt)
> 
> indentation
> 
> > --- libavformat/rtmppkt.h	(revision 0)
> > +++ libavformat/rtmppkt.h	(revision 0)
> > @@ -0,0 +1,210 @@
> > +
> > +int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,
> > +                          int timestamp, int size);
> 
> nit: long line
 
extremely long, I should say - 640 bits but it fits exactly into one
terminal line unless it's quoted like above.
 
> You don't employ an editor that does the right thing (TM) when you hit
> the tab key?

I do - it inserts 4 spaces which is a right thing (TM).

> Diego
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rtmp.patch
Type: text/x-diff
Size: 40218 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090721/c6ad2394/attachment.patch>



More information about the ffmpeg-devel mailing list