diff mbox

[FFmpeg-devel,v2,3/3] avformat/dashenc: configuring container format options

Message ID 1525687082-6126-1-git-send-email-vdixit@akamai.com
State New
Headers show

Commit Message

Dixit, Vishwanath May 7, 2018, 9:58 a.m. UTC
From: Vishwanath Dixit <vdixit@akamai.com>

---
 doc/muxers.texi       | 4 ++++
 libavformat/dashenc.c | 7 +++++++
 2 files changed, 11 insertions(+)

Comments

Jeyapal, Karthick May 15, 2018, 6:21 a.m. UTC | #1
Pushed.

On 5/7/18 3:28 PM, vdixit@akamai.com wrote:
> From: Vishwanath Dixit <vdixit@akamai.com>

>

> ---

>  doc/muxers.texi       | 4 ++++

>  libavformat/dashenc.c | 7 +++++++

>  2 files changed, 11 insertions(+)

>

> diff --git a/doc/muxers.texi b/doc/muxers.texi

> index db81901..e9082a4 100644

> --- a/doc/muxers.texi

> +++ b/doc/muxers.texi

> @@ -282,6 +282,10 @@ corrects that index value.

>  Typically this logic is needed in live streaming use cases. The network bandwidth

>  fluctuations are common during long run streaming. Each fluctuation can cause

>  the segment indexes fall behind the expected real time position.

> +@item -format_options @var{options_list}

> +Set container format (mp4/webm) options using a @code{:} separated list of

> +key=value parameters. Values containing @code{:} special characters must be

> +escaped.

>  @end table

>  

>  @anchor{framecrc}

> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c

> index 1dd6333..e27b61c 100644

> --- a/libavformat/dashenc.c

> +++ b/libavformat/dashenc.c

> @@ -125,6 +125,7 @@ typedef struct DASHContext {

>      int streaming;

>      int64_t timeout;

>      int index_correction;

> +    char *format_options_str;

>  } DASHContext;

>  

>  static struct codec_string {

> @@ -1017,6 +1018,11 @@ static int dash_init(AVFormatContext *s)

>          av_dict_free(&opts);

>          os->init_start_pos = 0;

>  

> +        if (c->format_options_str) {

> +            ret = av_dict_parse_string(&opts, c->format_options_str, "=", ":", 0);

> +            if (ret < 0)

> +                return ret;

> +        }

>          if (!strcmp(os->format_name, "mp4")) {

>              if (c->streaming)

>                  av_dict_set(&opts, "movflags", "frag_every_frame+dash+delay_moov", 0);

> @@ -1538,6 +1544,7 @@ static const AVOption options[] = {

>      { "streaming", "Enable/Disable streaming mode of output. Each frame will be moof fragment", OFFSET(streaming), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E },

>      { "timeout", "set timeout for socket I/O operations", OFFSET(timeout), AV_OPT_TYPE_DURATION, { .i64 = -1 }, -1, INT_MAX, .flags = E },

>      { "index_correction", "Enable/Disable segment index correction logic", OFFSET(index_correction), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E },

> +    { "format_options","set list of options for the container format (mp4/webm) used for dash", OFFSET(format_options_str), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0, E},

>      { NULL },

>  };

>
diff mbox

Patch

diff --git a/doc/muxers.texi b/doc/muxers.texi
index db81901..e9082a4 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -282,6 +282,10 @@  corrects that index value.
 Typically this logic is needed in live streaming use cases. The network bandwidth
 fluctuations are common during long run streaming. Each fluctuation can cause
 the segment indexes fall behind the expected real time position.
+@item -format_options @var{options_list}
+Set container format (mp4/webm) options using a @code{:} separated list of
+key=value parameters. Values containing @code{:} special characters must be
+escaped.
 @end table
 
 @anchor{framecrc}
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 1dd6333..e27b61c 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -125,6 +125,7 @@  typedef struct DASHContext {
     int streaming;
     int64_t timeout;
     int index_correction;
+    char *format_options_str;
 } DASHContext;
 
 static struct codec_string {
@@ -1017,6 +1018,11 @@  static int dash_init(AVFormatContext *s)
         av_dict_free(&opts);
         os->init_start_pos = 0;
 
+        if (c->format_options_str) {
+            ret = av_dict_parse_string(&opts, c->format_options_str, "=", ":", 0);
+            if (ret < 0)
+                return ret;
+        }
         if (!strcmp(os->format_name, "mp4")) {
             if (c->streaming)
                 av_dict_set(&opts, "movflags", "frag_every_frame+dash+delay_moov", 0);
@@ -1538,6 +1544,7 @@  static const AVOption options[] = {
     { "streaming", "Enable/Disable streaming mode of output. Each frame will be moof fragment", OFFSET(streaming), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E },
     { "timeout", "set timeout for socket I/O operations", OFFSET(timeout), AV_OPT_TYPE_DURATION, { .i64 = -1 }, -1, INT_MAX, .flags = E },
     { "index_correction", "Enable/Disable segment index correction logic", OFFSET(index_correction), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E },
+    { "format_options","set list of options for the container format (mp4/webm) used for dash", OFFSET(format_options_str), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0, E},
     { NULL },
 };