AVIOContext pb;
if (rdt->audio_pkt_cnt == 0) {
- int pos;
+ int pos, rmflags;
ffio_init_context(&pb, (uint8_t *)buf, len, 0, NULL, NULL, NULL, NULL);
- flags = (flags & RTP_FLAG_KEY) ? 2 : 0;
+ rmflags = (flags & RTP_FLAG_KEY) ? 2 : 0;
res = ff_rm_parse_packet (rdt->rmctx, &pb, st, rdt->rmst[st->index], len, pkt,
- &seq, flags, *timestamp);
+ &seq, rmflags, *timestamp);
pos = avio_tell(&pb);
if (res < 0)
return res;
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;
}
static void
-rdt_free_context (PayloadContext *rdt)
+rdt_close_context (PayloadContext *rdt)
{
int i;
avformat_close_input(&rdt->rmctx);
av_freep(&rdt->mlti_data);
av_freep(&rdt->rmst);
- av_free(rdt);
}
#define RDT_HANDLER(n, s, t) \
.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, \
+ .close = rdt_close_context, \
.parse_packet = rdt_parse_packet \
}