summaryrefslogtreecommitdiff
path: root/libavformat/rtpdec_vp8.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2015-02-24 12:43:07 +0200
committerMartin Storsjö <martin@martin.st>2015-02-24 23:07:28 +0200
commit78791c086bcaf9eb084c27555b31fea8bbb7624a (patch)
tree5cd03f411521fa68d70de76a58efc2fbdae537ae /libavformat/rtpdec_vp8.c
parent88434f9725e7c9484dcbcf323566ae88a2904f32 (diff)
rtpdec: Use .init instead of .alloc to set default values
The ugly error handling in rdt gets improved in a later commit. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/rtpdec_vp8.c')
-rw-r--r--libavformat/rtpdec_vp8.c10
1 files changed, 4 insertions, 6 deletions
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,