aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-08-27 23:33:06 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-09-03 15:41:44 +0200
commit72c601e0f71d3c71a53d43bdac935489ed86e3c5 (patch)
tree38e07e928f79486d8f4a264f67eb22394f53a481
parent04b72178724ed08934e276c959a6f1a154e1e7d4 (diff)
downloadffmpeg-72c601e0f71d3c71a53d43bdac935489ed86e3c5.tar.gz
avutil/internal: Move avpriv-file API to a header of its own
It is not used by the large majority of files that include lavu/internal.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/dvdsubdec.c1
-rw-r--r--libavcodec/libxvid.c2
-rw-r--r--libavdevice/bktr.c1
-rw-r--r--libavdevice/fbdev_common.c1
-rw-r--r--libavdevice/fbdev_dec.c1
-rw-r--r--libavdevice/fbdev_enc.c1
-rw-r--r--libavdevice/oss.c1
-rw-r--r--libavfilter/af_arnndn.c4
-rw-r--r--libavfilter/af_firequalizer.c1
-rw-r--r--libavfilter/opencl.c1
-rw-r--r--libavfilter/vf_curves.c2
-rw-r--r--libavfilter/vf_deshake.c2
-rw-r--r--libavfilter/vf_dnn_classify.c6
-rw-r--r--libavfilter/vf_dnn_detect.c6
-rw-r--r--libavfilter/vf_fieldhint.c1
-rw-r--r--libavfilter/vf_lut3d.c4
-rw-r--r--libavfilter/vf_nnedi.c2
-rw-r--r--libavfilter/vf_paletteuse.c1
-rw-r--r--libavfilter/vf_psnr.c3
-rw-r--r--libavfilter/vf_signature.c4
-rw-r--r--libavfilter/vf_ssim.c3
-rw-r--r--libavfilter/vf_vidstabdetect.c3
-rw-r--r--libavfilter/vf_vidstabtransform.c3
-rw-r--r--libavfilter/vf_vmafmotion.c1
-rw-r--r--libavformat/cache.c4
-rw-r--r--libavformat/file.c3
-rw-r--r--libavformat/ipfsgateway.c1
-rw-r--r--libavutil/file.c1
-rw-r--r--libavutil/file_open.c3
-rw-r--r--libavutil/file_open.h57
-rw-r--r--libavutil/internal.h28
-rw-r--r--libavutil/random_seed.c1
32 files changed, 92 insertions, 61 deletions
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index 3338cd6b92..e1ae441880 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -27,6 +27,7 @@
#include "libavutil/attributes.h"
#include "libavutil/colorspace.h"
+#include "libavutil/file_open.h"
#include "libavutil/opt.h"
#include "libavutil/bswap.h"
diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c
index aed8699fe1..3845905555 100644
--- a/libavcodec/libxvid.c
+++ b/libavcodec/libxvid.c
@@ -30,7 +30,7 @@
#include <xvid.h>
#include "libavutil/avassert.h"
-#include "libavutil/file.h"
+#include "libavutil/file_open.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c
index e96c4a359e..196637852f 100644
--- a/libavdevice/bktr.c
+++ b/libavdevice/bktr.c
@@ -25,6 +25,7 @@
*/
#include "libavformat/internal.h"
+#include "libavutil/file_open.h"
#include "libavutil/internal.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
diff --git a/libavdevice/fbdev_common.c b/libavdevice/fbdev_common.c
index 91bd8e1a91..47e7edde5c 100644
--- a/libavdevice/fbdev_common.c
+++ b/libavdevice/fbdev_common.c
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include "fbdev_common.h"
#include "libavutil/common.h"
+#include "libavutil/file_open.h"
#include "avdevice.h"
struct rgb_pixfmt_map_entry {
diff --git a/libavdevice/fbdev_dec.c b/libavdevice/fbdev_dec.c
index 368907037b..460a71d13f 100644
--- a/libavdevice/fbdev_dec.c
+++ b/libavdevice/fbdev_dec.c
@@ -34,6 +34,7 @@
#include <time.h>
#include <linux/fb.h>
+#include "libavutil/file_open.h"
#include "libavutil/internal.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
diff --git a/libavdevice/fbdev_enc.c b/libavdevice/fbdev_enc.c
index 84ec6733ff..77233880e7 100644
--- a/libavdevice/fbdev_enc.c
+++ b/libavdevice/fbdev_enc.c
@@ -23,6 +23,7 @@
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <linux/fb.h>
+#include "libavutil/file_open.h"
#include "libavutil/pixdesc.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
diff --git a/libavdevice/oss.c b/libavdevice/oss.c
index b042f58875..5c3eb6d4c3 100644
--- a/libavdevice/oss.c
+++ b/libavdevice/oss.c
@@ -30,6 +30,7 @@
#include <sys/ioctl.h>
#include <sys/soundcard.h>
+#include "libavutil/file_open.h"
#include "libavutil/log.h"
#include "avdevice.h"
diff --git a/libavfilter/af_arnndn.c b/libavfilter/af_arnndn.c
index 5e3403ca6a..3ef222bc8e 100644
--- a/libavfilter/af_arnndn.c
+++ b/libavfilter/af_arnndn.c
@@ -31,10 +31,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <float.h>
-
#include "libavutil/avassert.h"
-#include "libavutil/avstring.h"
+#include "libavutil/file_open.h"
#include "libavutil/float_dsp.h"
#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
diff --git a/libavfilter/af_firequalizer.c b/libavfilter/af_firequalizer.c
index 85bdb59209..e0f35c139e 100644
--- a/libavfilter/af_firequalizer.c
+++ b/libavfilter/af_firequalizer.c
@@ -19,6 +19,7 @@
*/
#include "libavutil/channel_layout.h"
+#include "libavutil/file_open.h"
#include "libavutil/opt.h"
#include "libavutil/eval.h"
#include "libavutil/avassert.h"
diff --git a/libavfilter/opencl.c b/libavfilter/opencl.c
index c8e7e6e1a5..5d1e297af8 100644
--- a/libavfilter/opencl.c
+++ b/libavfilter/opencl.c
@@ -19,6 +19,7 @@
#include <stdio.h>
#include <string.h>
+#include "libavutil/file_open.h"
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c
index 82e2753f01..498b06f6e5 100644
--- a/libavfilter/vf_curves.c
+++ b/libavfilter/vf_curves.c
@@ -22,12 +22,12 @@
#include "libavutil/bprint.h"
#include "libavutil/eval.h"
#include "libavutil/file.h"
+#include "libavutil/file_open.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/avassert.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "drawutils.h"
-#include "formats.h"
#include "internal.h"
#include "video.h"
diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c
index b37cffba9d..142f88541d 100644
--- a/libavfilter/vf_deshake.c
+++ b/libavfilter/vf_deshake.c
@@ -50,10 +50,10 @@
*/
#include "avfilter.h"
-#include "formats.h"
#include "internal.h"
#include "video.h"
#include "libavutil/common.h"
+#include "libavutil/file_open.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
diff --git a/libavfilter/vf_dnn_classify.c b/libavfilter/vf_dnn_classify.c
index 852f5ddcee..d242aebcfb 100644
--- a/libavfilter/vf_dnn_classify.c
+++ b/libavfilter/vf_dnn_classify.c
@@ -21,14 +21,10 @@
* implementing an classification filter using deep learning networks.
*/
-#include "libavformat/avio.h"
+#include "libavutil/file_open.h"
#include "libavutil/opt.h"
-#include "libavutil/pixdesc.h"
-#include "libavutil/avassert.h"
-#include "libavutil/imgutils.h"
#include "filters.h"
#include "dnn_filter_common.h"
-#include "formats.h"
#include "internal.h"
#include "libavutil/time.h"
#include "libavutil/avstring.h"
diff --git a/libavfilter/vf_dnn_detect.c b/libavfilter/vf_dnn_detect.c
index 68bd2cd0c3..7e133f6af5 100644
--- a/libavfilter/vf_dnn_detect.c
+++ b/libavfilter/vf_dnn_detect.c
@@ -21,14 +21,10 @@
* implementing an object detecting filter using deep learning networks.
*/
-#include "libavformat/avio.h"
+#include "libavutil/file_open.h"
#include "libavutil/opt.h"
-#include "libavutil/pixdesc.h"
-#include "libavutil/avassert.h"
-#include "libavutil/imgutils.h"
#include "filters.h"
#include "dnn_filter_common.h"
-#include "formats.h"
#include "internal.h"
#include "libavutil/time.h"
#include "libavutil/avstring.h"
diff --git a/libavfilter/vf_fieldhint.c b/libavfilter/vf_fieldhint.c
index e6061c6d3c..4af9e26925 100644
--- a/libavfilter/vf_fieldhint.c
+++ b/libavfilter/vf_fieldhint.c
@@ -19,6 +19,7 @@
*/
#include "libavutil/avassert.h"
+#include "libavutil/file_open.h"
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
diff --git a/libavfilter/vf_lut3d.c b/libavfilter/vf_lut3d.c
index 358fe13e09..1ca448fcb3 100644
--- a/libavfilter/vf_lut3d.c
+++ b/libavfilter/vf_lut3d.c
@@ -29,13 +29,11 @@
#include "float.h"
#include "libavutil/opt.h"
-#include "libavutil/file.h"
-#include "libavutil/intreadwrite.h"
+#include "libavutil/file_open.h"
#include "libavutil/intfloat.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "drawutils.h"
-#include "formats.h"
#include "internal.h"
#include "video.h"
#include "lut3d.h"
diff --git a/libavfilter/vf_nnedi.c b/libavfilter/vf_nnedi.c
index e5a16918bd..63b83e5efd 100644
--- a/libavfilter/vf_nnedi.c
+++ b/libavfilter/vf_nnedi.c
@@ -22,13 +22,13 @@
#include <float.h>
#include "libavutil/common.h"
+#include "libavutil/file_open.h"
#include "libavutil/float_dsp.h"
#include "libavutil/imgutils.h"
#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
-#include "formats.h"
#include "internal.h"
#include "video.h"
diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c
index 5c491a290c..a6b5d5a5fa 100644
--- a/libavfilter/vf_paletteuse.c
+++ b/libavfilter/vf_paletteuse.c
@@ -24,6 +24,7 @@
*/
#include "libavutil/bprint.h"
+#include "libavutil/file_open.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/qsort.h"
diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c
index fa2e887e9b..15cde7e8c8 100644
--- a/libavfilter/vf_psnr.c
+++ b/libavfilter/vf_psnr.c
@@ -26,15 +26,14 @@
*/
#include "libavutil/avstring.h"
+#include "libavutil/file_open.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "drawutils.h"
-#include "formats.h"
#include "framesync.h"
#include "internal.h"
#include "psnr.h"
-#include "video.h"
typedef struct PSNRContext {
const AVClass *class;
diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c
index 7d434328b7..4896e8f2c1 100644
--- a/libavfilter/vf_signature.c
+++ b/libavfilter/vf_signature.c
@@ -24,13 +24,11 @@
* @see http://epubs.surrey.ac.uk/531590/1/MPEG-7%20Video%20Signature%20Author%27s%20Copy.pdf
*/
-#include <float.h>
#include "libavcodec/put_bits.h"
#include "libavformat/avformat.h"
#include "libavutil/opt.h"
#include "libavutil/avstring.h"
-#include "libavutil/intreadwrite.h"
-#include "libavutil/timestamp.h"
+#include "libavutil/file_open.h"
#include "avfilter.h"
#include "internal.h"
#include "signature.h"
diff --git a/libavfilter/vf_ssim.c b/libavfilter/vf_ssim.c
index 37094b23f9..1933b9b82d 100644
--- a/libavfilter/vf_ssim.c
+++ b/libavfilter/vf_ssim.c
@@ -35,15 +35,14 @@
*/
#include "libavutil/avstring.h"
+#include "libavutil/file_open.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "drawutils.h"
-#include "formats.h"
#include "framesync.h"
#include "internal.h"
#include "ssim.h"
-#include "video.h"
typedef struct SSIMContext {
const AVClass *class;
diff --git a/libavfilter/vf_vidstabdetect.c b/libavfilter/vf_vidstabdetect.c
index 044911ec27..62b998e171 100644
--- a/libavfilter/vf_vidstabdetect.c
+++ b/libavfilter/vf_vidstabdetect.c
@@ -23,8 +23,9 @@
#include <vid.stab/libvidstab.h>
#include "libavutil/common.h"
+#include "libavutil/file_open.h"
#include "libavutil/opt.h"
-#include "libavutil/imgutils.h"
+#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "internal.h"
diff --git a/libavfilter/vf_vidstabtransform.c b/libavfilter/vf_vidstabtransform.c
index de303554cd..1914d7b348 100644
--- a/libavfilter/vf_vidstabtransform.c
+++ b/libavfilter/vf_vidstabtransform.c
@@ -23,8 +23,9 @@
#include <vid.stab/libvidstab.h>
#include "libavutil/common.h"
+#include "libavutil/file_open.h"
#include "libavutil/opt.h"
-#include "libavutil/imgutils.h"
+#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "internal.h"
diff --git a/libavfilter/vf_vmafmotion.c b/libavfilter/vf_vmafmotion.c
index 6ae968f7e9..137afd9245 100644
--- a/libavfilter/vf_vmafmotion.c
+++ b/libavfilter/vf_vmafmotion.c
@@ -24,6 +24,7 @@
* Calculate VMAF Motion score.
*/
+#include "libavutil/file_open.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
diff --git a/libavformat/cache.c b/libavformat/cache.c
index 1e19dafc6a..115c2c2490 100644
--- a/libavformat/cache.c
+++ b/libavformat/cache.c
@@ -29,10 +29,10 @@
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
-#include "libavutil/internal.h"
+#include "libavutil/file_open.h"
#include "libavutil/opt.h"
#include "libavutil/tree.h"
-#include "avformat.h"
+#include "avio.h"
#include <fcntl.h>
#if HAVE_IO_H
#include <io.h>
diff --git a/libavformat/file.c b/libavformat/file.c
index 98c9e81bcb..6103c37b34 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -22,9 +22,10 @@
#include "config_components.h"
#include "libavutil/avstring.h"
+#include "libavutil/file_open.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
-#include "avformat.h"
+#include "avio.h"
#if HAVE_DIRENT_H
#include <dirent.h>
#endif
diff --git a/libavformat/ipfsgateway.c b/libavformat/ipfsgateway.c
index 907b61b017..ce69d9055a 100644
--- a/libavformat/ipfsgateway.c
+++ b/libavformat/ipfsgateway.c
@@ -20,6 +20,7 @@
*/
#include "libavutil/avstring.h"
+#include "libavutil/file_open.h"
#include "libavutil/getenv_utf8.h"
#include "libavutil/opt.h"
#include <sys/stat.h>
diff --git a/libavutil/file.c b/libavutil/file.c
index f228b723ec..edee6aaf80 100644
--- a/libavutil/file.c
+++ b/libavutil/file.c
@@ -18,6 +18,7 @@
#include "config.h"
#include "file.h"
+#include "file_open.h"
#include "internal.h"
#include "log.h"
#include "mem.h"
diff --git a/libavutil/file_open.c b/libavutil/file_open.c
index 58a6073353..9aa4e4ac61 100644
--- a/libavutil/file_open.c
+++ b/libavutil/file_open.c
@@ -17,7 +17,8 @@
*/
#include "config.h"
-#include "internal.h"
+#include "avutil.h"
+#include "file_open.h"
#include "mem.h"
#include <stdarg.h>
#include <fcntl.h>
diff --git a/libavutil/file_open.h b/libavutil/file_open.h
new file mode 100644
index 0000000000..6a00004741
--- /dev/null
+++ b/libavutil/file_open.h
@@ -0,0 +1,57 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_FILE_OPEN_H
+#define AVUTIL_FILE_OPEN_H
+
+#include <stdio.h>
+
+#include "config.h"
+#include "attributes.h"
+
+#if HAVE_LIBC_MSVCRT
+#define avpriv_fopen_utf8 ff_fopen_utf8
+#define avpriv_open ff_open
+#define avpriv_tempfile ff_tempfile
+#endif
+
+ /**
+ * A wrapper for open() setting O_CLOEXEC.
+ */
+av_warn_unused_result
+int avpriv_open(const char *filename, int flags, ...);
+
+/**
+ * Open a file using a UTF-8 filename.
+ */
+FILE *avpriv_fopen_utf8(const char *path, const char *mode);
+
+/**
+ * Wrapper to work around the lack of mkstemp() on mingw.
+ * Also, tries to create file in /tmp first, if possible.
+ * *prefix can be a character constant; *filename will be allocated internally.
+ * @return file descriptor of opened file (or negative value corresponding to an
+ * AVERROR code on error)
+ * and opened file name in **filename.
+ * @note On very old libcs it is necessary to set a secure umask before
+ * calling this, av_tempfile() can't call umask itself as it is used in
+ * libraries and could interfere with the calling application.
+ */
+int avpriv_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx);
+
+#endif /* AVUTIL_FILE_OPEN_H */
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 8bdc7b3ac8..14f3acec58 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -155,10 +155,6 @@ void avpriv_request_sample(void *avc,
#pragma comment(linker, "/include:" EXTERN_PREFIX "avpriv_snprintf")
#endif
-#define avpriv_fopen_utf8 ff_fopen_utf8
-#define avpriv_open ff_open
-#define avpriv_tempfile ff_tempfile
-
#define PTRDIFF_SPECIFIER "Id"
#define SIZE_SPECIFIER "Iu"
#else
@@ -188,30 +184,6 @@ void avpriv_request_sample(void *avc,
#define SUINT32 uint32_t
#endif
-/**
- * A wrapper for open() setting O_CLOEXEC.
- */
-av_warn_unused_result
-int avpriv_open(const char *filename, int flags, ...);
-
-/**
- * Open a file using a UTF-8 filename.
- */
-FILE *avpriv_fopen_utf8(const char *path, const char *mode);
-
-/**
- * Wrapper to work around the lack of mkstemp() on mingw.
- * Also, tries to create file in /tmp first, if possible.
- * *prefix can be a character constant; *filename will be allocated internally.
- * @return file descriptor of opened file (or negative value corresponding to an
- * AVERROR code on error)
- * and opened file name in **filename.
- * @note On very old libcs it is necessary to set a secure umask before
- * calling this, av_tempfile() can't call umask itself as it is used in
- * libraries and could interfere with the calling application.
- */
-int avpriv_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx);
-
int avpriv_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt);
static av_always_inline av_const int avpriv_mirror(int x, int w)
diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c
index 70dc509d2f..66dd504ef0 100644
--- a/libavutil/random_seed.c
+++ b/libavutil/random_seed.c
@@ -35,6 +35,7 @@
#include <time.h>
#include <string.h>
#include "avassert.h"
+#include "file_open.h"
#include "internal.h"
#include "intreadwrite.h"
#include "timer.h"