diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-11-01 14:03:04 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-11-02 07:58:37 +0100 |
commit | 179a5c37e070f619f14289bdc0fa66a08219eed9 (patch) | |
tree | 2713046a1df6cefc885e1411a79f8a508c784b84 /libavformat/rtpdec_h263_rfc2190.c | |
parent | f70381ab9d53132be2d009d6db9649b3cad8288b (diff) | |
download | ffmpeg-179a5c37e070f619f14289bdc0fa66a08219eed9.tar.gz |
rtpdec: factorize identical code used in several handlers
Diffstat (limited to 'libavformat/rtpdec_h263_rfc2190.c')
-rw-r--r-- | libavformat/rtpdec_h263_rfc2190.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/libavformat/rtpdec_h263_rfc2190.c b/libavformat/rtpdec_h263_rfc2190.c index 163d4eaba7..4957b337c7 100644 --- a/libavformat/rtpdec_h263_rfc2190.c +++ b/libavformat/rtpdec_h263_rfc2190.c @@ -61,7 +61,7 @@ static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data, { /* Corresponding to header fields in the RFC */ int f, p, i, sbit, ebit, src, r; - int header_size; + int header_size, ret; if (data->newformat) return ff_h263_handle_packet(ctx, data, st, pkt, timestamp, buf, len, @@ -133,7 +133,7 @@ static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data, /* Check the picture start code, only start buffering a new frame * if this is correct */ if (len > 4 && AV_RB32(buf) >> 10 == 0x20) { - int ret = avio_open_dyn_buf(&data->buf); + ret = avio_open_dyn_buf(&data->buf); if (ret < 0) return ret; data->timestamp = *timestamp; @@ -185,13 +185,11 @@ static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data, avio_w8(data->buf, data->endbyte); data->endbyte_bits = 0; - av_init_packet(pkt); - pkt->size = avio_close_dyn_buf(data->buf, &pkt->data); - pkt->destruct = av_destruct_packet; - pkt->stream_index = st->index; + ret = ff_rtp_finalize_packet(pkt, &data->buf, st->index); + if (ret < 0) + return ret; if (!i) pkt->flags |= AV_PKT_FLAG_KEY; - data->buf = NULL; return 0; } |