[MPlayer-cvslog] r30498 - in trunk: libmpdemux/demux_lavf.c stream/stream_ffmpeg.c

reimar subversion at mplayerhq.hu
Wed Feb 3 23:32:48 CET 2010


Author: reimar
Date: Wed Feb  3 23:32:48 2010
New Revision: 30498

Log:
Add support for FFmpeg's rtsp dummy URL-with-pseudo-demuxer scheme.
ffmpeg://rtsp://... will play a rtsp stream via FFmpeg.

Modified:
   trunk/libmpdemux/demux_lavf.c
   trunk/stream/stream_ffmpeg.c

Modified: trunk/libmpdemux/demux_lavf.c
==============================================================================
--- trunk/libmpdemux/demux_lavf.c	Wed Feb  3 22:12:23 2010	(r30497)
+++ trunk/libmpdemux/demux_lavf.c	Wed Feb  3 23:32:48 2010	(r30498)
@@ -155,13 +155,15 @@ static int lavf_check_file(demuxer_t *de
     }
 
     probe_data_size = stream_read(demuxer->stream, priv->buffer, PROBE_BUF_SIZE);
-    if(probe_data_size <= 0)
+    if(probe_data_size < 0)
         return 0;
     avpd.filename= demuxer->stream->url;
+    if (!strncmp(avpd.filename, "ffmpeg://", 9))
+        avpd.filename += 9;
     avpd.buf= priv->buffer;
     avpd.buf_size= probe_data_size;
 
-    priv->avif= av_probe_input_format(&avpd, 1);
+    priv->avif= av_probe_input_format(&avpd, probe_data_size > 0);
     if(!priv->avif){
         mp_msg(MSGT_HEADER,MSGL_V,"LAVF_check: no clue about this gibberish!\n");
         return 0;
@@ -458,9 +460,12 @@ static demuxer_t* demux_open_lavf(demuxe
         }
     }
 
-    if(demuxer->stream->url)
+    if(demuxer->stream->url) {
+        if (!strncmp(demuxer->stream->url, "ffmpeg://rtsp:", 14))
+            strncpy(mp_filename, demuxer->stream->url + 9, sizeof(mp_filename)-3);
+        else
         strncpy(mp_filename + 3, demuxer->stream->url, sizeof(mp_filename)-3);
-    else
+    } else
         strncpy(mp_filename + 3, "foobar.dummy", sizeof(mp_filename)-3);
 
     priv->pb = av_alloc_put_byte(priv->buffer, BIO_BUFFER_SIZE, 0,

Modified: trunk/stream/stream_ffmpeg.c
==============================================================================
--- trunk/stream/stream_ffmpeg.c	Wed Feb  3 22:12:23 2010	(r30497)
+++ trunk/stream/stream_ffmpeg.c	Wed Feb  3 23:32:48 2010	(r30498)
@@ -75,6 +75,7 @@ static int open_f(stream_t *stream, int 
     URLContext *ctx = NULL;
     int res = STREAM_ERROR;
     int64_t size;
+    int dummy;
 
     av_register_all();
     if (mode == STREAM_READ)
@@ -95,25 +96,28 @@ static int open_f(stream_t *stream, int 
     }
     if (!strncmp(filename, prefix, strlen(prefix)))
         filename += strlen(prefix);
+    dummy = !strncmp(filename, "rtsp:", 5);
     mp_msg(MSGT_OPEN, MSGL_V, "[ffmpeg] Opening %s\n", filename);
 
-    if (url_open(&ctx, filename, flags) < 0)
+    if (!dummy && url_open(&ctx, filename, flags) < 0)
         goto out;
 
     stream->priv = ctx;
-    size = url_filesize(ctx);
+    size = dummy ? 0 : url_filesize(ctx);
     if (size >= 0)
         stream->end_pos = size;
     stream->type = STREAMTYPE_FILE;
     stream->seek = seek;
-    if (ctx->is_streamed) {
+    if (dummy || ctx->is_streamed) {
         stream->type = STREAMTYPE_STREAM;
         stream->seek = NULL;
     }
+    if (!dummy) {
     stream->fill_buffer = fill_buffer;
     stream->write_buffer = write_buffer;
     stream->control = control;
     stream->close = close_f;
+    }
     res = STREAM_OK;
 
 out:


More information about the MPlayer-cvslog mailing list