diff options
-rw-r--r-- | demux/demux_lavf.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index 85fa2a9be1..ad4f521052 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -578,7 +578,6 @@ static demuxer_t *demux_open_lavf(demuxer_t *demuxer) AVDictionaryEntry *t = NULL; lavf_priv_t *priv = demuxer->priv; int i; - char mp_filename[256] = "mp:"; stream_seek(demuxer->stream, 0); @@ -620,16 +619,18 @@ static demuxer_t *demux_open_lavf(demuxer_t *demuxer) } } - if (demuxer->stream->url) { + char *filename = demuxer->stream->url; + + if (filename) { if (demuxer->stream->lavf_type && !strcmp(demuxer->stream->lavf_type, "rtsp")) { // Remove possible leading ffmpeg:// or lavf:// - char *name = strstr(demuxer->stream->url, "rtsp:"); - av_strlcpy(mp_filename, name, sizeof(mp_filename)); - } else - av_strlcat(mp_filename, demuxer->stream->url, sizeof(mp_filename)); + char *name = strstr(filename, "rtsp:"); + if (name) + filename = name; + } } else - av_strlcat(mp_filename, "foobar.dummy", sizeof(mp_filename)); + filename = "mp:unknown"; if (!(priv->avif->flags & AVFMT_NOFILE)) { priv->pb = avio_alloc_context(priv->buffer, BIO_BUFFER_SIZE, 0, @@ -641,7 +642,7 @@ static demuxer_t *demux_open_lavf(demuxer_t *demuxer) avfc->pb = priv->pb; } - if (avformat_open_input(&avfc, mp_filename, priv->avif, NULL) < 0) { + if (avformat_open_input(&avfc, filename, priv->avif, NULL) < 0) { mp_msg(MSGT_HEADER, MSGL_ERR, "LAVF_header: avformat_open_input() failed\n"); return NULL; |