[FFmpeg-devel] [PATCH 5/5] avformat/hlsenc: use AV_OPT_TYPE_DURATION

Moritz Barsnick barsnick at gmx.net
Fri Jan 15 15:27:44 EET 2021


On Wed, Jan 06, 2021 at 23:35:31 +0800, lance.lmwang at gmail.com wrote:
> From: Limin Wang <lance.lmwang at gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> ---
>  doc/muxers.texi      |  4 ++--
>  libavformat/hlsenc.c | 18 +++++++++---------
>  2 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index 8e12aca..044c16b 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -609,13 +609,13 @@ segmentation.
>  This muxer supports the following options:
>
>  @table @option
> - at item hls_init_time @var{seconds}
> + at item hls_init_time @var{duration}
>  Set the initial target segment length in seconds. Default value is @var{0}.
>  Segment will be cut on the next key frame after this time has passed on the first m3u8 list.
>  After the initial playlist is filled @command{ffmpeg} will cut segments
>  at duration equal to @code{hls_time}

AV_OPT_TYPE_DURATION is not strictly seconds. It can use other
syntaxes. You could refer to the appropriate section:

> see @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.


>  Set the target segment length in seconds. Default value is 2.

Ditto.

> -    {"hls_time",      "set segment length in seconds",           OFFSET(time),    AV_OPT_TYPE_FLOAT,  {.dbl = 2},     0, FLT_MAX, E},
> -    {"hls_init_time", "set segment length in seconds at init list",           OFFSET(init_time),    AV_OPT_TYPE_FLOAT,  {.dbl = 0},     0, FLT_MAX, E},
> +    {"hls_time",      "set segment length in seconds",           OFFSET(time),    AV_OPT_TYPE_DURATION,  {.i64 = 2000000},     0, INT64_MAX, E},
> +    {"hls_init_time", "set segment length in seconds at init list",           OFFSET(init_time),    AV_OPT_TYPE_DURATION,  {.i64 = 0},     0, INT64_MAX, E},

Ditto, just "set segment length".

Cheers,
Moritz


More information about the ffmpeg-devel mailing list