summaryrefslogtreecommitdiff
path: root/libavutil/internal.h
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2022-05-20 14:45:21 +0300
committerMartin Storsjö <martin@martin.st>2022-05-23 13:52:26 +0300
commit4cdc14aa955805931b918d30d9c7349ab924dd52 (patch)
treec3ff5f04579badeba3c89b3aeba0691984937c40 /libavutil/internal.h
parent3fb924464244bc317a5d19ab25625ae35abde512 (diff)
downloadffmpeg-4cdc14aa955805931b918d30d9c7349ab924dd52.tar.gz
libavutil: Deprecate av_fopen_utf8, provide an avpriv version
Since every DLL can use an individual CRT on Windows, having an exported function that opens a FILE* won't work if that FILE* is going to be used from a different DLL (or from user application code). Internally within the libraries, the issue can be worked around by duplicating the function in all libraries (this already happened implicitly because the function resided in file_open.c) and renaming the function to ff_fopen_utf8 (so that it doesn't end up exported from the DLLs) and duplicating it in all libraries that use it. This makes the avpriv_fopen_utf8 / ff_fopen_utf8 function work in the exact same way as the existing avpriv_open / ff_open, with the same setup as introduced in e743e7ae6ee7e535c4394bec6fe6650d2b0dbf65. That mechanism doesn't work for external users, thus deprecate the existing function. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavutil/internal.h')
-rw-r--r--libavutil/internal.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 79c2130be0..b44cbaaa7b 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -37,6 +37,7 @@
#include <stdint.h>
#include <stddef.h>
#include <assert.h>
+#include <stdio.h>
#include "config.h"
#include "attributes.h"
#include "timer.h"
@@ -183,8 +184,10 @@ 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
@@ -257,6 +260,11 @@ 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.