rtpdec: Set need_parsing via a handler field

This avoids implementing a full function just to set this one
field.

Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Martin Storsjö
2015-02-23 21:51:05 +02:00
parent b7a4c319fd
commit 2b982e92f4
11 changed files with 13 additions and 120 deletions

View File

@@ -23,14 +23,6 @@
#include "libavutil/intreadwrite.h"
#include "rtpdec_formats.h"
static av_cold int mpeg_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 mpeg_parse_packet(AVFormatContext *ctx, PayloadContext *data,
AVStream *st, AVPacket *pkt, uint32_t *timestamp,
const uint8_t *buf, int len, uint16_t seq,
@@ -59,7 +51,7 @@ static int mpeg_parse_packet(AVFormatContext *ctx, PayloadContext *data,
RTPDynamicProtocolHandler ff_mpeg_audio_dynamic_handler = {
.codec_type = AVMEDIA_TYPE_AUDIO,
.codec_id = AV_CODEC_ID_MP3,
.init = mpeg_init,
.need_parsing = AVSTREAM_PARSE_FULL,
.parse_packet = mpeg_parse_packet,
.static_payload_id = 14,
};
@@ -67,7 +59,7 @@ RTPDynamicProtocolHandler ff_mpeg_audio_dynamic_handler = {
RTPDynamicProtocolHandler ff_mpeg_video_dynamic_handler = {
.codec_type = AVMEDIA_TYPE_VIDEO,
.codec_id = AV_CODEC_ID_MPEG2VIDEO,
.init = mpeg_init,
.need_parsing = AVSTREAM_PARSE_FULL,
.parse_packet = mpeg_parse_packet,
.static_payload_id = 32,
};