[vlc-commits] avformat : add an option to force a specific format
Sébastien Escudier
git at videolan.org
Tue Feb 21 13:24:12 CET 2012
vlc/vlc-2.0 | branch: master | Sébastien Escudier <sebastien-devel at celeos.eu> | Thu Feb 16 15:08:33 2012 +0100| [cba4df235c0000fa2de179b1c50c77876baa5aeb] | committer: Sébastien Escudier
avformat : add an option to force a specific format
(cherry picked from commit 56e7865dce209276279eae8d9c388c7e88737776)
Signed-off-by: Sébastien Escudier <sebastien-devel at celeos.eu>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=cba4df235c0000fa2de179b1c50c77876baa5aeb
---
modules/demux/avformat/avformat.c | 4 ++++
modules/demux/avformat/demux.c | 12 ++++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/modules/demux/avformat/avformat.c b/modules/demux/avformat/avformat.c
index 70ce57f..18f8640 100644
--- a/modules/demux/avformat/avformat.c
+++ b/modules/demux/avformat/avformat.c
@@ -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 */
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 01f06d9..4785ff5 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -104,7 +104,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;
@@ -131,8 +131,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 );
More information about the vlc-commits
mailing list