diff mbox

[FFmpeg-devel,2/2] avformat/teeproto: Support parsing protocol options

Message ID 1470012717-17764-2-git-send-email-michael@niedermayer.cc
State Accepted
Commit b1ce8003727655c627fc3f80a8120d7e9c191c69
Headers show

Commit Message

Michael Niedermayer Aug. 1, 2016, 12:51 a.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/Makefile   |    2 +-
 libavformat/teeproto.c |   19 ++++++++++++++-----
 2 files changed, 15 insertions(+), 6 deletions(-)

Comments

Michael Niedermayer Aug. 3, 2016, 5:35 p.m. UTC | #1
On Mon, Aug 01, 2016 at 02:51:57AM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/Makefile   |    2 +-
>  libavformat/teeproto.c |   19 ++++++++++++++-----
>  2 files changed, 15 insertions(+), 6 deletions(-)

applied

[...]
diff mbox

Patch

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 783b96a..ac0c2ca 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -568,7 +568,7 @@  OBJS-$(CONFIG_RTP_PROTOCOL)              += rtpproto.o
 OBJS-$(CONFIG_SCTP_PROTOCOL)             += sctp.o
 OBJS-$(CONFIG_SRTP_PROTOCOL)             += srtpproto.o srtp.o
 OBJS-$(CONFIG_SUBFILE_PROTOCOL)          += subfile.o
-OBJS-$(CONFIG_TEE_PROTOCOL)              += teeproto.o
+OBJS-$(CONFIG_TEE_PROTOCOL)              += teeproto.o tee_common.o
 OBJS-$(CONFIG_TCP_PROTOCOL)              += tcp.o
 OBJS-$(CONFIG_TLS_GNUTLS_PROTOCOL)       += tls_gnutls.o tls.o
 OBJS-$(CONFIG_TLS_OPENSSL_PROTOCOL)      += tls_openssl.o tls.o
diff --git a/libavformat/teeproto.c b/libavformat/teeproto.c
index 12d5423..e22fba2 100644
--- a/libavformat/teeproto.c
+++ b/libavformat/teeproto.c
@@ -23,6 +23,7 @@ 
 #include "libavutil/opt.h"
 #include "avformat.h"
 #include "avio_internal.h"
+#include "tee_common.h"
 
 typedef struct ChildContext {
     URLContext *url_context;
@@ -89,9 +90,11 @@  static int tee_open(URLContext *h, const char *filename, int flags)
         return AVERROR(ENOSYS);
 
     while (*filename) {
-        char *child_name = av_get_token(&filename, child_delim);
+        char *child_string = av_get_token(&filename, child_delim);
+        char *child_name = NULL;
         void *tmp;
-        if (!child_name) {
+        AVDictionary *options = NULL;
+        if (!child_string) {
             ret = AVERROR(ENOMEM);
             goto fail;
         }
@@ -99,16 +102,22 @@  static int tee_open(URLContext *h, const char *filename, int flags)
         tmp = av_realloc_array(c->child, c->child_count + 1, sizeof(*c->child));
         if (!tmp) {
             ret = AVERROR(ENOMEM);
-            goto fail;
+            goto loop_fail;
         }
         c->child = tmp;
         memset(&c->child[c->child_count], 0, sizeof(c->child[c->child_count]));
 
+        ret = ff_tee_parse_slave_options(h, child_string, &options, &child_name);
+        if (ret < 0)
+            goto loop_fail;
+
         ret = ffurl_open_whitelist(&c->child[c->child_count].url_context, child_name, flags,
-                                   &h->interrupt_callback, /*AVDictionary **options*/NULL,
+                                   &h->interrupt_callback, &options,
                                    h->protocol_whitelist, h->protocol_blacklist,
                                    h);
-        av_free(child_name);
+loop_fail:
+        av_freep(&child_string);
+        av_dict_free(&options);
         if (ret < 0)
             goto fail;
         c->child_count++;