[FFmpeg-trac] #5620(avutil:open): av_tempfile failed to create file on android
FFmpeg
trac at avcodec.org
Sat Jun 11 19:43:30 CEST 2016
#5620: av_tempfile failed to create file on android
-------------------------------------+-------------------------------------
Reporter: chinshou | Owner:
Type: defect | Status: open
Priority: important | Component: avutil
Version: git-master | Resolution:
Keywords: android | Blocked By:
cache regression | Reproduced by developer: 1
Blocking: |
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Comment (by cehoyos):
The following works as expected:
{{{
diff --git a/libavutil/file_open.c b/libavutil/file_open.c
index 6e58cc1..34070d9 100644
--- a/libavutil/file_open.c
+++ b/libavutil/file_open.c
@@ -134,7 +134,7 @@ int avpriv_tempfile(const char *prefix, char
**filename, int log_offset, void *l
#else
snprintf(*filename, len, "/tmp/%sXXXXXX", prefix);
fd = mkstemp(*filename);
-#ifdef _WIN32
+#if defined(_WIN32) || defined (__ANDROID__)
if (fd < 0) {
snprintf(*filename, len, "./%sXXXXXX", prefix);
fd = mkstemp(*filename);
}}}
/sdcard leads to an error message when testing:
{{{
$ ffmpeg -i cache:fate-suite/4xm/dracula.4xm
ffmpeg version N-80268-g9e9286e Copyright (c) 2000-2016 the FFmpeg
developers
built with gcc 4.9 (GCC) 20140827 (prerelease)
configuration: --cross-prefix=../android-ndk-r10e/toolchains/arm-linux-
androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
--arch=arm --target-os=linux --sysroot=../android-ndk-
r10e/platforms/android-17/arch-arm/ --enable-gpl --cpu=cortex-a8
libavutil 55. 24.100 / 55. 24.100
libavcodec 57. 46.100 / 57. 46.100
libavformat 57. 37.101 / 57. 37.101
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 46.101 / 6. 46.101
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
[cache @ 0x158a7a0] seek in cache failed
Last message repeated 2 times
[4xm @ 0x158a0f0] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for Input Stream #0.1 : stereo
Guessed Channel Layout for Input Stream #0.2 : stereo
Guessed Channel Layout for Input Stream #0.3 : stereo
Guessed Channel Layout for Input Stream #0.4 : stereo
Guessed Channel Layout for Input Stream #0.5 : stereo
Guessed Channel Layout for Input Stream #0.6 : stereo
Input #0, 4xm, from 'cache:fate-suite/4xm/dracula.4xm':
Duration: 00:00:01.93, start: 0.000000, bitrate: 4236 kb/s
Stream #0:0: Video: 4xm, rgb565le, 640x480, 15 tbr, 15 tbn, 15 tbc
Stream #0:1: Audio: adpcm_4xm, 22050 Hz, 2 channels, s16p, 705 kb/s
Stream #0:2: Audio: adpcm_4xm, 22050 Hz, 2 channels, s16p, 705 kb/s
Stream #0:3: Audio: adpcm_4xm, 22050 Hz, 2 channels, s16p, 705 kb/s
Stream #0:4: Audio: adpcm_4xm, 22050 Hz, 2 channels, s16p, 705 kb/s
Stream #0:5: Audio: adpcm_4xm, 22050 Hz, 2 channels, s16p, 705 kb/s
Stream #0:6: Audio: adpcm_4xm, 22050 Hz, 2 channels, s16p, 705 kb/s
At least one output file must be specified
[cache @ 0x158a7a0] Statistics, cache hits:0 cache misses:3
}}}
{{{
diff --git a/libavutil/file_open.c b/libavutil/file_open.c
index 6e58cc1..4d05267 100644
--- a/libavutil/file_open.c
+++ b/libavutil/file_open.c
@@ -132,7 +132,7 @@ int avpriv_tempfile(const char *prefix, char
**filename, int log_offset, void *l
# endif
fd = open(*filename, O_RDWR | O_BINARY | O_CREAT | O_EXCL, 0600);
#else
- snprintf(*filename, len, "/tmp/%sXXXXXX", prefix);
+ snprintf(*filename, len, "/sdcard/%sXXXXXX", prefix);
fd = mkstemp(*filename);
#ifdef _WIN32
if (fd < 0) {
}}}
--
Ticket URL: <https://trac.ffmpeg.org/ticket/5620#comment:4>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list