[FFmpeg-devel] [PATCH 4/6] lavf: add support for loop points
Rodger Combs
rodger.combs at gmail.com
Wed Jun 17 00:28:16 CEST 2015
---
libavformat/avformat.h | 12 ++++++++++++
libavformat/options_table.h | 2 ++
libavformat/utils.c | 2 +-
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 719c23b..8158874 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. */
--
2.4.1
More information about the ffmpeg-devel
mailing list