stream_ffmpeg, demux_lavf: Use flv demuxer for rtmp streams

Use lavf's flv demuxer for rtmp/rtmps/... stream types. Letting
generic format probing handle this could work, but with the current
probing implementation it'd at least depend on not-really-guaranteed
details of the stream layer (probing different formats and then
decoding depends on seeking back in between; rtmp streams don't
support such seeking directly so would need to rely on details of
caching behavior).
This commit is contained in:
Uoti Urpala 2010-04-23 22:57:25 +03:00
parent 4583c12a2c
commit 1d4d1bff82
3 changed files with 15 additions and 5 deletions

View File

@ -135,15 +135,17 @@ static int lavf_check_file(demuxer_t *demuxer){
av_register_all();
if (lavfdopts->format) {
if (strcmp(lavfdopts->format, "help") == 0) {
char *format = lavfdopts->format;
if (!format)
format = demuxer->stream->lavf_type;
if (format) {
if (strcmp(format, "help") == 0) {
list_formats();
return 0;
}
priv->avif= av_find_input_format(lavfdopts->format);
priv->avif = av_find_input_format(format);
if (!priv->avif) {
mp_msg(MSGT_DEMUX,MSGL_FATAL,"Unknown lavf format %s\n",
lavfdopts->format);
mp_msg(MSGT_DEMUX, MSGL_FATAL, "Unknown lavf format %s\n", format);
return 0;
}
mp_msg(MSGT_DEMUX,MSGL_INFO,"Forced lavf %s demuxer\n", priv->avif->long_name);

View File

@ -160,6 +160,7 @@ typedef struct stream {
void* cache_data;
void* priv; // used for DVD, TV, RTSP etc
char* url; // strdup() of filename/url
char *lavf_type; // name of expected demuxer type for lavf
struct MPOpts *opts;
#ifdef CONFIG_NETWORK
streaming_ctrl_t *streaming_ctrl;

View File

@ -24,6 +24,7 @@
#include "stream.h"
#include "m_option.h"
#include "m_struct.h"
#include "libmpdemux/demuxer.h"
static int fill_buffer(stream_t *s, char *buffer, int max_len)
{
@ -102,6 +103,12 @@ static int open_f(stream_t *stream, int mode, void *opts, int *file_format)
if (!dummy && url_open(&ctx, filename, flags) < 0)
goto out;
mp_msg(MSGT_OPEN, MSGL_V, "[ffmpeg] libavformat URL type: %s\n",
ctx->prot->name);
if (!strncmp("rtmp", ctx->prot->name, 4)) {
*file_format = DEMUXER_TYPE_LAVF;
stream->lavf_type = "flv";
}
stream->priv = ctx;
size = dummy ? 0 : url_filesize(ctx);
if (size >= 0)