[FFmpeg-devel] fix for issue 1676 - file.c doesn't understand file URLs

aviad rozenhek aviadr1
Mon Jan 11 11:44:10 CET 2010


as in $subj
the purpose of this patch is to allow files to also be accessed via
well-formed URLs such as file:///c:/temp/myfile.avi

Index: file.c
===================================================================
--- file.c (revision 62965)
+++ file.c (working copy)
@@ -37,8 +37,16 @@
 {
     int access;
     int fd;
+ char path[1024] = "";

-    av_strstart(filename, "file:", &filename);
+    url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path, sizeof(path),
filename);
+
+    // remove the scheme [file://] part of the URL
+    filename = path;
+
+ // for well-formed file url, like file:///c:/temp/myfile.avi, skip the
first '/' in the filename
+    if(path[0] == '/' && path[2] == ':')
+ filename++;

     if (flags & URL_RDWR) {
         access = O_CREAT | O_TRUNC | O_RDWR;


-- 
Aviad Rozenhek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: allow_file_urls.patch
Type: application/octet-stream
Size: 668 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100111/2ff5c36c/attachment.obj>



More information about the ffmpeg-devel mailing list