X-Git-Url: http://git.ffmpeg.org/gitweb/ffmpeg.git/blobdiff_plain/179a5c37e070f619f14289bdc0fa66a08219eed9..df07c07b3de0a5e8890078944de1eb5cb8372ef8:/libavformat/rtpdec_h263_rfc2190.c diff --git a/libavformat/rtpdec_h263_rfc2190.c b/libavformat/rtpdec_h263_rfc2190.c index 4957b337c7..d507ef7ef3 100644 --- a/libavformat/rtpdec_h263_rfc2190.c +++ b/libavformat/rtpdec_h263_rfc2190.c @@ -27,6 +27,7 @@ #include "avformat.h" #include "rtpdec_formats.h" +#include "libavutil/attributes.h" #include "libavutil/intreadwrite.h" #include "libavcodec/get_bits.h" @@ -55,9 +56,18 @@ static void h263_free_context(PayloadContext *data) av_free(data); } +static av_cold int h263_init(AVFormatContext *ctx, int st_index, PayloadContext *data) +{ + if (st_index < 0) + return 0; + ctx->streams[st_index]->need_parsing = AVSTREAM_PARSE_FULL; + return 0; +} + static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data, AVStream *st, AVPacket *pkt, uint32_t *timestamp, - const uint8_t *buf, int len, int flags) + const uint8_t *buf, int len, uint16_t seq, + int flags) { /* Corresponding to header fields in the RFC */ int f, p, i, sbit, ebit, src, r; @@ -65,7 +75,7 @@ static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data, if (data->newformat) return ff_h263_handle_packet(ctx, data, st, pkt, timestamp, buf, len, - flags); + seq, flags); if (data->buf && data->timestamp != *timestamp) { /* Dropping old buffered, unfinished data */ @@ -73,6 +83,7 @@ static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data, avio_close_dyn_buf(data->buf, &p); av_free(p); data->buf = NULL; + data->endbyte_bits = 0; } if (len < 4) { @@ -122,7 +133,7 @@ static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data, "signalled with a static payload type.\n"); data->newformat = 1; return ff_h263_handle_packet(ctx, data, st, pkt, timestamp, buf, - len, flags); + len, seq, flags); } } @@ -197,6 +208,7 @@ static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data, RTPDynamicProtocolHandler ff_h263_rfc2190_dynamic_handler = { .codec_type = AVMEDIA_TYPE_VIDEO, .codec_id = AV_CODEC_ID_H263, + .init = h263_init, .parse_packet = h263_handle_packet, .alloc = h263_new_context, .free = h263_free_context,