Commit 56e7865d authored by Sébastien Escudier's avatar Sébastien Escudier

avformat : add an option to force a specific format

parent a71e35fa
......@@ -32,6 +32,9 @@
#include "avformat.h"
#define FORMAT_TEXT N_( "Format name" )
#define FORMAT_LONGTEXT N_( "Internal libavcodec format name" )
vlc_module_begin ()
#endif /* MERGE_FFMPEG */
add_shortcut( "ffmpeg", "avformat" )
......@@ -41,6 +44,7 @@ vlc_module_begin ()
set_shortname( N_("Avformat") )
set_capability( "demux", 2 )
set_callbacks( OpenDemux, CloseDemux )
add_string( "ffmpeg-format", NULL, FORMAT_TEXT, FORMAT_LONGTEXT, true )
#ifdef ENABLE_SOUT
/* mux submodule */
......
......@@ -112,7 +112,7 @@ int OpenDemux( vlc_object_t *p_this )
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys;
AVProbeData pd;
AVInputFormat *fmt;
AVInputFormat *fmt = NULL;
unsigned int i;
int64_t i_start_time = -1;
bool b_can_seek;
......@@ -141,8 +141,16 @@ int OpenDemux( vlc_object_t *p_this )
av_register_all(); /* Can be called several times */
vlc_avcodec_unlock();
char *psz_format = var_InheritString( p_this, "ffmpeg-format" );
if( psz_format )
{
if( fmt = av_find_input_format(psz_format) )
msg_Dbg( p_demux, "forcing format: %s", fmt->name );
free( psz_format );
}
/* Guess format */
if( !( fmt = av_probe_input_format( &pd, 1 ) ) )
if( !fmt && !( fmt = av_probe_input_format( &pd, 1 ) ) )
{
msg_Dbg( p_demux, "couldn't guess format" );
free( psz_url );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment