[FFmpeg-devel] [PATCH] fix for issue 1676 - file.c doesn't understand file URLs
Michael Niedermayer
michaelni
Fri Feb 5 11:52:07 CET 2010
On Wed, Jan 13, 2010 at 11:21:43AM +0200, aviad rozenhek wrote:
> >
> > 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
> >
> file.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
> b6030b885770d4b2f875ce4414007b2a6a5020ff allow_file_urls.patch
> 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);
please someone explain why the /// handling is not in url_split() ?
no i dont mind it in file.c, iam just asking
> +
> + // remove the scheme [file://] part of the URL
> + filename = path;
> +
tabs, trailing whitespace
> + // for well-formed file url, like file:///c:/temp/myfile.avi, skip the first '/' in the filename
better comment needed
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I hate to see young programmers poisoned by the kind of thinking
Ulrich Drepper puts forward since it is simply too narrow -- Roman Shaposhnik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100205/2c9cab22/attachment.pgp>
More information about the ffmpeg-devel
mailing list