summaryrefslogtreecommitdiff
path: root/libavformat/rdt.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-02-25 00:03:52 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-02-25 00:03:52 +0100
commitd52bf89d21b744344cf6cda1bfe156786f24772a (patch)
tree25cfd43e57273d606a09be92a020650f16f206c6 /libavformat/rdt.c
parent99c76902cdc3f815d58ba16ccfc83e75acec1f4a (diff)
parent78791c086bcaf9eb084c27555b31fea8bbb7624a (diff)
downloadffmpeg-d52bf89d21b744344cf6cda1bfe156786f24772a.tar.gz
Merge commit '78791c086bcaf9eb084c27555b31fea8bbb7624a'
* commit '78791c086bcaf9eb084c27555b31fea8bbb7624a': rtpdec: Use .init instead of .alloc to set default values Conflicts: libavformat/rdt.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/rdt.c')
-rw-r--r--libavformat/rdt.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/libavformat/rdt.c b/libavformat/rdt.c
index e799770fe2..68ad814851 100644
--- a/libavformat/rdt.c
+++ b/libavformat/rdt.c
@@ -298,6 +298,9 @@ rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st,
int seq = 1, res;
AVIOContext pb;
+ if (!rdt->rmctx)
+ return AVERROR(EINVAL);
+
if (rdt->audio_pkt_cnt == 0) {
int pos;
@@ -521,25 +524,16 @@ ff_real_parse_sdp_a_line (AVFormatContext *s, int stream_index,
real_parse_asm_rulebook(s, s->streams[stream_index], p);
}
-static PayloadContext *
-rdt_new_context (void)
-{
- PayloadContext *rdt = av_mallocz(sizeof(PayloadContext));
- if (!rdt)
- return NULL;
-
- rdt->rmctx = avformat_alloc_context();
- if (!rdt->rmctx)
- av_freep(&rdt);
- return rdt;
-}
-static int
-rdt_init_context (AVFormatContext *s, int st_index, PayloadContext *rdt)
+static av_cold int rdt_init(AVFormatContext *s, int st_index, PayloadContext *rdt)
{
int ret;
+ rdt->rmctx = avformat_alloc_context();
+ if (!rdt->rmctx)
+ return AVERROR(ENOMEM);
+
if ((ret = ff_copy_whitelists(rdt->rmctx, s)) < 0)
return ret;
@@ -568,9 +562,9 @@ static RTPDynamicProtocolHandler rdt_ ## n ## _handler = { \
.enc_name = s, \
.codec_type = t, \
.codec_id = AV_CODEC_ID_NONE, \
+ .priv_data_size = sizeof(PayloadContext), \
+ .init = rdt_init, \
.parse_sdp_a_line = rdt_parse_sdp_line, \
- .alloc = rdt_new_context, \
- .init = rdt_init_context, \
.free = rdt_free_context, \
.parse_packet = rdt_parse_packet \
}