[FFmpeg-devel] [PATCH] astenc: add an option to set the loop flag

James Almer jamrial at gmail.com
Fri Dec 7 05:55:04 CET 2012


Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavformat/astenc.c     |    5 ++++-
 libavformat/version.h    |    2 +-
 tests/lavf-regression.sh |    2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavformat/astenc.c b/libavformat/astenc.c
index 2c4afb7..774f781 100644
--- a/libavformat/astenc.c
+++ b/libavformat/astenc.c
@@ -33,6 +33,7 @@ typedef struct ASTMuxContext {
     int64_t  loopstart;
     int64_t  loopend;
     int      fbs;
+    int      flags;
 } ASTMuxContext;
 
 #define CHECK_LOOP(type) \
@@ -85,7 +86,7 @@ static int ast_write_header(AVFormatContext *s)
     avio_wb16(pb, codec_tag);
     avio_wb16(pb, 16); /* Bit depth */
     avio_wb16(pb, enc->channels);
-    avio_wb16(pb, 0xFFFF);
+    avio_wb16(pb, ast->flags ? 0xFFFF : 0); /* Loop flag */
     avio_wb32(pb, enc->sample_rate);
 
     ast->samples = avio_tell(pb);
@@ -175,6 +176,8 @@ static int ast_write_trailer(AVFormatContext *s)
 
 #define OFFSET(obj) offsetof(ASTMuxContext, obj)
 static const AVOption options[] = {
+  { "astflags",  "AST Muxer flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "astflags" },
+  { "loop",      "Enable looping",  0,             AV_OPT_TYPE_CONST, {.i64 = 1}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "astflags" },
   { "loopstart", "Loopstart position in milliseconds.", OFFSET(loopstart), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
   { "loopend",   "Loopend position in milliseconds.",   OFFSET(loopend),   AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
   { NULL },
diff --git a/libavformat/version.h b/libavformat/version.h
index 1572335..4204ec1 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
 
 #define LIBAVFORMAT_VERSION_MAJOR 54
 #define LIBAVFORMAT_VERSION_MINOR 47
-#define LIBAVFORMAT_VERSION_MICRO 100
+#define LIBAVFORMAT_VERSION_MICRO 101
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \
diff --git a/tests/lavf-regression.sh b/tests/lavf-regression.sh
index 4afc29a..ba814c1 100755
--- a/tests/lavf-regression.sh
+++ b/tests/lavf-regression.sh
@@ -327,7 +327,7 @@ do_audio_only caf
 fi
 
 if [ -n "$do_ast" ] ; then
-do_audio_only ast "-ac 2" "-loopstart 1 -loopend 10"
+do_audio_only ast "-ac 2" "-astflags loop -loopstart 1 -loopend 10"
 fi
 
 if [ -n "$do_ircam" ] ; then
-- 
1.7.8.6



More information about the ffmpeg-devel mailing list