[FFmpeg-devel] [PATCH v2] Enable dash output to work when the output isn't a local file

Raymond Hilseth rhi at vizrt.com
Wed Jan 6 09:57:41 CET 2016


Use avpriv_io_move instead of ff_rename to support more than only
the file protocol.

Enabled the implementation of file_move in libavformat/file.c for
systems not having unistd.h since it only requires the rename function
from os_support.h.

Signed-off-by: Raymond Hilseth <rhi at vizrt.com>
---
 libavformat/dashenc.c | 4 ++--
 libavformat/file.c    | 4 ----
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 4509ee4..378c4e4 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -549,7 +549,7 @@ static int write_manifest(AVFormatContext *s, int final)
     avio_printf(out, "</MPD>\n");
     avio_flush(out);
     avio_close(out);
-    return ff_rename(temp_filename, s->filename, s);
+    return avpriv_io_move(temp_filename, s->filename);
 }
 
 static int dash_write_header(AVFormatContext *s)
@@ -856,7 +856,7 @@ static int dash_flush(AVFormatContext *s, int final, int stream)
         } else {
             ffurl_close(os->out);
             os->out = NULL;
-            ret = ff_rename(temp_path, full_path, s);
+            ret = avpriv_io_move(temp_path, full_path);
             if (ret < 0)
                 break;
         }
diff --git a/libavformat/file.c b/libavformat/file.c
index a318408..e56ea79 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -176,7 +176,6 @@ static int file_delete(URLContext *h)
 
 static int file_move(URLContext *h_src, URLContext *h_dst)
 {
-#if HAVE_UNISTD_H
     const char *filename_src = h_src->filename;
     const char *filename_dst = h_dst->filename;
     av_strstart(filename_src, "file:", &filename_src);
@@ -186,9 +185,6 @@ static int file_move(URLContext *h_src, URLContext *h_dst)
         return AVERROR(errno);
 
     return 0;
-#else
-    return AVERROR(ENOSYS);
-#endif /* HAVE_UNISTD_H */
 }
 
 #if CONFIG_FILE_PROTOCOL
-- 
2.4.3



More information about the ffmpeg-devel mailing list