[MPlayer-dev-eng] [PATCH] set is_streamed correctly in lavf URLContext

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Dec 15 16:30:10 CET 2007


Hello,
I know it looks a bit hackish by modifying the file name.
A different way I just realized is of course having two different
protocols (only differing in the open function I guess).
Any opinions or better suggestions?

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libmpdemux/demux_lavf.c
===================================================================
--- libmpdemux/demux_lavf.c	(revision 25408)
+++ libmpdemux/demux_lavf.c	(working copy)
@@ -127,6 +127,8 @@
 const struct AVCodecTag *mp_bmp_taglists[] = {codec_bmp_tags, mp_bmp_tags, 0};
 
 static int mp_open(URLContext *h, const char *filename, int flags){
+    if (strlen(filename) > 3)
+        h->is_streamed = filename[3] == 's';
     return 0;
 }
 
@@ -464,10 +466,12 @@
         if(!opt) mp_msg(MSGT_HEADER,MSGL_ERR, "demux_lavf, couldn't set option analyzeduration to %u\n", opt_analyzeduration);
     }
 
+    // streamed or normal
+    mp_filename[3] = demuxer->stream->end_pos ? 'n' : 's';
     if(demuxer->stream->url)
-        strncpy(mp_filename + 3, demuxer->stream->url, sizeof(mp_filename)-3);
+        strncpy(mp_filename + 4, demuxer->stream->url, sizeof(mp_filename)-4);
     else
-        strncpy(mp_filename + 3, "foobar.dummy", sizeof(mp_filename)-3);
+        strncpy(mp_filename + 4, "foobar.dummy", sizeof(mp_filename)-4);
     
     url_fopen(&priv->pb, mp_filename, URL_RDONLY);
     


More information about the MPlayer-dev-eng mailing list