32 #if defined(_WIN32) && !defined(__MINGW32CE__)
42 static int win32_open(
const char *filename_utf8,
int oflag,
int pmode)
48 if (utf8towchar(filename_utf8, &filename_w))
53 fd = _wsopen(filename_w, oflag, SH_DENYNO, pmode);
56 if (fd != -1 || (oflag & O_CREAT))
61 return _sopen(filename_utf8, oflag, SH_DENYNO, pmode);
63 #define open win32_open
69 unsigned int mode = 0;
74 mode = va_arg(ap,
unsigned int);
84 fd = open(filename, flags, mode);
87 if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
106 int avpriv_tempfile(
const char *prefix,
char **filename,
int log_offset,
void *log_ctx)
111 void *ptr= tempnam(
NULL, prefix);
113 ptr= tempnam(
".", prefix);
118 size_t len = strlen(prefix) + 12;
135 snprintf(*filename, len,
"/tmp/%sXXXXXX", prefix);
136 fd = mkstemp(*filename);
137 #if defined(_WIN32) || defined (__ANDROID__)
139 snprintf(*filename, len,
"./%sXXXXXX", prefix);
140 fd = mkstemp(*filename);
147 av_log(&file_log_ctx,
AV_LOG_ERROR,
"ff_tempfile: Cannot open temporary file %s\n", *filename);
158 const char *
m =
mode;
161 case 'r': access = O_RDONLY;
break;
162 case 'w': access = O_CREAT|O_WRONLY|O_TRUNC;
break;
163 case 'a': access = O_CREAT|O_WRONLY|O_APPEND;
break;
170 access &= ~(O_RDONLY | O_WRONLY);
172 }
else if (*m ==
'b') {
185 return fdopen(fd, mode);
#define LIBAVUTIL_VERSION_INT
memory handling functions
FILE * av_fopen_utf8(const char *path, const char *mode)
Open a file using a UTF-8 filename.
int avpriv_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx)
Wrapper to work around the lack of mkstemp() on mingw.
int avpriv_open(const char *filename, int flags,...)
A wrapper for open() setting O_CLOEXEC.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
common internal API header
char * av_strdup(const char *s)
Duplicate the string s.
static const AVClass file_log_ctx_class
Describe the class of an AVClass context structure.