[FFmpeg-devel] [PATCH 10/13] lavf: add support for loop points

wm4 nfxjfg at googlemail.com
Thu Jun 18 20:18:21 CEST 2015


On Thu, 18 Jun 2015 04:03:08 -0500
Rodger Combs <rodger.combs at gmail.com> wrote:

> ---
>  Changelog                   |  1 +
>  libavformat/avformat.h      | 12 ++++++++++++
>  libavformat/options_table.h |  2 ++
>  libavformat/utils.c         |  2 +-
>  libavformat/version.h       |  2 +-
>  5 files changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/Changelog b/Changelog
> index a5c6b82..f350a84 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -5,6 +5,7 @@ version <next>:
>  - colorkey video filter
>  - BFSTM/BCSTM demuxer
>  - little-endian ADPCM_THP decoder
> +- loop point support
>  
>  
>  version 2.7:
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index fb69852..9e10bed 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -1799,6 +1799,18 @@ typedef struct AVFormatContext {
>       * Demuxing: Set by user.
>       */
>      int (*open_cb)(struct AVFormatContext *s, AVIOContext **p, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options);
> +
> +    /**
> +     * Suggested timestamps to start and end a loop at, in
> +     * AV_TIME_BASE fractional seconds. AV_NOPTS_VALUE for loop_start indicates
> +     * no looping. AV_NOPTS_VALUE for loop_end indicates the end of the file.
> +     * loop_end before loop_start indicates ping-pong looping.
> +     *
> +     * - muxing: Set by user
> +     * - demuxing: Set by avformat
> +     */
> +    int64_t loop_start;
> +    int64_t loop_end;
>  } AVFormatContext;
>  
>  int av_format_get_probe_score(const AVFormatContext *s);
> diff --git a/libavformat/options_table.h b/libavformat/options_table.h
> index 58670b0..8dec7e5 100644
> --- a/libavformat/options_table.h
> +++ b/libavformat/options_table.h
> @@ -100,6 +100,8 @@ static const AVOption avformat_options[] = {
>  {"dump_separator", "set information dump field separator", OFFSET(dump_separator), AV_OPT_TYPE_STRING, {.str = ", "}, CHAR_MIN, CHAR_MAX, D|E},
>  {"codec_whitelist", "List of decoders that are allowed to be used", OFFSET(codec_whitelist), AV_OPT_TYPE_STRING, { .str = NULL },  CHAR_MIN, CHAR_MAX, D },
>  {"format_whitelist", "List of demuxers that are allowed to be used", OFFSET(format_whitelist), AV_OPT_TYPE_STRING, { .str = NULL },  CHAR_MIN, CHAR_MAX, D },
> +{"loop_start", "start time of a loop", OFFSET(loop_start), AV_OPT_TYPE_INT64, {.i64 = AV_NOPTS_VALUE}, INT64_MIN, INT64_MAX, E},
> +{"loop_end", "start time of a loop", OFFSET(loop_end), AV_OPT_TYPE_INT64, {.i64 = AV_NOPTS_VALUE}, INT64_MIN, INT64_MAX, E},
>  {NULL},
>  };
>  
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index caa15ab..36961f0 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -445,7 +445,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename,
>          }
>      }
>  
> -    s->duration = s->start_time = AV_NOPTS_VALUE;
> +    s->duration = s->start_time = s->loop_start = s->loop_end = AV_NOPTS_VALUE;
>      av_strlcpy(s->filename, filename ? filename : "", sizeof(s->filename));
>  
>      /* Allocate private data. */
> diff --git a/libavformat/version.h b/libavformat/version.h
> index 99b7190..ec84570 100644
> --- a/libavformat/version.h
> +++ b/libavformat/version.h
> @@ -30,7 +30,7 @@
>  #include "libavutil/version.h"
>  
>  #define LIBAVFORMAT_VERSION_MAJOR 56
> -#define LIBAVFORMAT_VERSION_MINOR  37
> +#define LIBAVFORMAT_VERSION_MINOR  38
>  #define LIBAVFORMAT_VERSION_MICRO 100
>  
>  #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \

Maybe it would be better to use AVStream side data for this...


More information about the ffmpeg-devel mailing list