From 78791c086bcaf9eb084c27555b31fea8bbb7624a Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Tue, 24 Feb 2015 12:43:07 +0200 Subject: rtpdec: Use .init instead of .alloc to set default values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ugly error handling in rdt gets improved in a later commit. Signed-off-by: Martin Storsjö --- libavformat/rtpdec_vp8.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'libavformat/rtpdec_vp8.c') diff --git a/libavformat/rtpdec_vp8.c b/libavformat/rtpdec_vp8.c index 1a7124054d..4701316b2f 100644 --- a/libavformat/rtpdec_vp8.c +++ b/libavformat/rtpdec_vp8.c @@ -269,13 +269,10 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8, return AVERROR(EAGAIN); } -static PayloadContext *vp8_new_context(void) +static av_cold int vp8_init(AVFormatContext *s, int st_index, PayloadContext *vp8) { - PayloadContext *vp8 = av_mallocz(sizeof(PayloadContext)); - if (!vp8) - return NULL; vp8->sequence_ok = 1; - return vp8; + return 0; } static void vp8_free_context(PayloadContext *vp8) @@ -293,7 +290,8 @@ RTPDynamicProtocolHandler ff_vp8_dynamic_handler = { .enc_name = "VP8", .codec_type = AVMEDIA_TYPE_VIDEO, .codec_id = AV_CODEC_ID_VP8, - .alloc = vp8_new_context, + .priv_data_size = sizeof(PayloadContext), + .init = vp8_init, .free = vp8_free_context, .parse_packet = vp8_handle_packet, .need_keyframe = vp8_need_keyframe, -- cgit v1.2.3