[FFmpeg-cvslog] avformat/utils: Move ff_format_output_open() to mux_utils.c

Andreas Rheinhardt git at videolan.org
Tue May 10 09:35:05 EEST 2022


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Fri May  6 16:45:00 2022 +0200| [437484a66a3c1d002ab6683eab6eba90d517a35a] | committer: Andreas Rheinhardt

avformat/utils: Move ff_format_output_open() to mux_utils.c

It is obviously a muxing-only function.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=437484a66a3c1d002ab6683eab6eba90d517a35a
---

 libavformat/fifo.c      |  1 +
 libavformat/internal.h  | 10 ----------
 libavformat/mux.h       | 10 ++++++++++
 libavformat/mux_utils.c | 10 ++++++++++
 libavformat/tee.c       |  2 +-
 libavformat/utils.c     | 10 ----------
 6 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/libavformat/fifo.c b/libavformat/fifo.c
index 86e5d369b5..ead2bdc5cf 100644
--- a/libavformat/fifo.c
+++ b/libavformat/fifo.c
@@ -28,6 +28,7 @@
 #include "libavutil/threadmessage.h"
 #include "avformat.h"
 #include "internal.h"
+#include "mux.h"
 
 #define FIFO_DEFAULT_QUEUE_SIZE              60
 #define FIFO_DEFAULT_MAX_RECOVERY_ATTEMPTS   0
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 03b9bb8e37..51deb1c49f 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -849,16 +849,6 @@ int ff_copy_whiteblacklists(AVFormatContext *dst, const AVFormatContext *src);
  */
 #define FFERROR_REDO FFERRTAG('R','E','D','O')
 
-/**
- * Utility function to open IO stream of output format.
- *
- * @param s AVFormatContext
- * @param url URL or file name to open for writing
- * @options optional options which will be passed to io_open callback
- * @return >=0 on success, negative AVERROR in case of failure
- */
-int ff_format_output_open(AVFormatContext *s, const char *url, AVDictionary **options);
-
 /*
  * A wrapper around AVFormatContext.io_close that should be used
  * instead of calling the pointer directly.
diff --git a/libavformat/mux.h b/libavformat/mux.h
index 246101f0c8..1bfcaf795f 100644
--- a/libavformat/mux.h
+++ b/libavformat/mux.h
@@ -103,6 +103,16 @@ enum AVWriteUncodedFrameFlags {
  */
 int ff_format_shift_data(AVFormatContext *s, int64_t read_start, int shift_size);
 
+/**
+ * Utility function to open IO stream of output format.
+ *
+ * @param s AVFormatContext
+ * @param url URL or file name to open for writing
+ * @options optional options which will be passed to io_open callback
+ * @return >=0 on success, negative AVERROR in case of failure
+ */
+int ff_format_output_open(AVFormatContext *s, const char *url, AVDictionary **options);
+
 /**
  * Parse creation_time in AVFormatContext metadata if exists and warn if the
  * parsing fails.
diff --git a/libavformat/mux_utils.c b/libavformat/mux_utils.c
index df264fc6a0..83c1482540 100644
--- a/libavformat/mux_utils.c
+++ b/libavformat/mux_utils.c
@@ -85,6 +85,16 @@ end:
     return ret;
 }
 
+int ff_format_output_open(AVFormatContext *s, const char *url, AVDictionary **options)
+{
+    if (!s->oformat)
+        return AVERROR(EINVAL);
+
+    if (!(s->oformat->flags & AVFMT_NOFILE))
+        return s->io_open(s, &s->pb, url, AVIO_FLAG_WRITE, options);
+    return 0;
+}
+
 int ff_parse_creation_time_metadata(AVFormatContext *s, int64_t *timestamp, int return_seconds)
 {
     AVDictionaryEntry *entry;
diff --git a/libavformat/tee.c b/libavformat/tee.c
index b3bcd70b9f..f1f2a9d2a5 100644
--- a/libavformat/tee.c
+++ b/libavformat/tee.c
@@ -26,7 +26,7 @@
 #include "libavcodec/bsf.h"
 #include "internal.h"
 #include "avformat.h"
-#include "avio_internal.h"
+#include "mux.h"
 #include "tee_common.h"
 
 typedef enum {
diff --git a/libavformat/utils.c b/libavformat/utils.c
index a695f19b03..58d2524457 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1655,16 +1655,6 @@ uint8_t *av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type,
     return data;
 }
 
-int ff_format_output_open(AVFormatContext *s, const char *url, AVDictionary **options)
-{
-    if (!s->oformat)
-        return AVERROR(EINVAL);
-
-    if (!(s->oformat->flags & AVFMT_NOFILE))
-        return s->io_open(s, &s->pb, url, AVIO_FLAG_WRITE, options);
-    return 0;
-}
-
 void ff_format_io_close_default(AVFormatContext *s, AVIOContext *pb)
 {
     avio_close(pb);



More information about the ffmpeg-cvslog mailing list