[FFmpeg-devel] [PATCH] avformat/rdt: Forward whitelists to rdt demuxer

Michael Niedermayer michaelni at gmx.at
Fri Oct 24 00:35:33 CEST 2014


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavformat/rdt.c |   21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/libavformat/rdt.c b/libavformat/rdt.c
index e8dc8f5..fd99bb1 100644
--- a/libavformat/rdt.c
+++ b/libavformat/rdt.c
@@ -523,18 +523,26 @@ static PayloadContext *
 rdt_new_context (void)
 {
     PayloadContext *rdt = av_mallocz(sizeof(PayloadContext));
-    int ret;
     if (!rdt)
         return NULL;
-    ret = avformat_open_input(&rdt->rmctx, "", &ff_rdt_demuxer, NULL);
-    if (ret < 0) {
-        av_free(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)
+{
+    av_assert0(!rdt->rmctx->codec_whitelist && !rdt->rmctx->format_whitelist);
+    rdt->rmctx-> codec_whitelist = av_strdup(s->codec_whitelist);
+    rdt->rmctx->format_whitelist = av_strdup(s->format_whitelist);
+
+    return avformat_open_input(&rdt->rmctx, "", &ff_rdt_demuxer, NULL);
+}
+
 static void
 rdt_free_context (PayloadContext *rdt)
 {
@@ -559,6 +567,7 @@ static RTPDynamicProtocolHandler rdt_ ## n ## _handler = { \
     .codec_id         = AV_CODEC_ID_NONE, \
     .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 \
 }
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list