Deprecate AVFormatContext.loop_input.
---
 libavformat/avformat.h |    7 ++++++-
 libavformat/img2.c     |    9 ++++++++-
 libavformat/version.h  |    3 +++
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 9abc9c5..ecc008c 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -732,7 +732,12 @@ typedef struct AVFormatContext {
 #endif
 #define AVFMT_FLAG_CUSTOM_IO    0x0080 ///< The caller has supplied a custom 
AVIOContext, don't avio_close() it.
 
-    int loop_input;
+#if FF_API_LOOP_INPUT
+    /**
+     * @deprecated, use the loop_input img2 demuxer private option.
+     */
+    attribute_deprecated int loop_input;
+#endif
 
     /**
      * decoding: size of data to probe; encoding: unused.
diff --git a/libavformat/img2.c b/libavformat/img2.c
index ec37a38..99ef7a8 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -42,6 +42,7 @@ typedef struct {
     char *pixel_format;     /**< Set by a private option. */
     char *video_size;       /**< Set by a private option. */
     char *framerate;        /**< Set by a private option. */
+    int loop_input;
 } VideoData;
 
 typedef struct {
@@ -242,6 +243,11 @@ static int read_header(AVFormatContext *s1, 
AVFormatParameters *ap)
         framerate = (AVRational){ap->time_base.den, ap->time_base.num};
 #endif
 
+#if FF_API_LOOP_INPUT
+    if (s1->loop_input)
+        s->loop_input = s1->loop_input;
+#endif
+
     av_strlcpy(s->path, s1->filename, sizeof(s->path));
     s->img_number = 0;
     s->img_count = 0;
@@ -299,7 +305,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt)
 
     if (!s->is_pipe) {
         /* loop over input */
-        if (s1->loop_input && s->img_number > s->img_last) {
+        if (s->loop_input && s->img_number > s->img_last) {
             s->img_number = s->img_first;
         }
         if (s->img_number > s->img_last)
@@ -457,6 +463,7 @@ static const AVOption options[] = {
     { "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str = 
NULL}, 0, 0, DEC },
     { "video_size",   "", OFFSET(video_size),   FF_OPT_TYPE_STRING, {.str = 
NULL}, 0, 0, DEC },
     { "framerate",    "", OFFSET(framerate),    FF_OPT_TYPE_STRING, {.str = 
"25"}, 0, 0, DEC },
+    { "loop_input",   "", OFFSET(loop_input),   FF_OPT_TYPE_INT,    {.dbl = 
0},    0, 1, DEC },
     { NULL },
 };
 
diff --git a/libavformat/version.h b/libavformat/version.h
index 3cc1718..7ddea20 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -74,5 +74,8 @@
 #ifndef FF_API_FLAG_RTP_HINT
 #define FF_API_FLAG_RTP_HINT           (LIBAVFORMAT_VERSION_MAJOR < 54)
 #endif
+#ifndef FF_API_LOOP_INPUT
+#define FF_API_LOOP_INPUT              (LIBAVFORMAT_VERSION_MAJOR < 54)
+#endif
 
 #endif /* AVFORMAT_VERSION_H */
-- 
1.7.5.3

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to