[vlc-commits] avformat demux: AVFormatContext->nb_streams == 0 is valid
Rafaël Carré
git at videolan.org
Tue Oct 9 23:48:47 CEST 2012
vlc | branch: master | Rafaël Carré <funman at videolan.org> | Tue Oct 9 23:40:55 2012 +0200| [88671de6d9f8d4ccb91e92c250335dced54ce10d] | committer: Rafaël Carré
avformat demux: AVFormatContext->nb_streams == 0 is valid
Set the options correctly in this case.
This happens with some .ts files for example.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=88671de6d9f8d4ccb91e92c250335dced54ce10d
---
modules/demux/avformat/demux.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 5557bf1..fa1ea75 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -252,8 +252,9 @@ int OpenDemux( vlc_object_t *p_this )
#if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(26<<8)+0)
char *psz_opts = var_InheritString( p_demux, "avformat-options" );
- AVDictionary *options[p_sys->ic->nb_streams];
- for (unsigned i = 0; i < p_sys->ic->nb_streams; i++)
+ AVDictionary *options[p_sys->ic->nb_streams ? p_sys->ic->nb_streams : 1];
+ options[0] = NULL;
+ for (unsigned i = 1; i < p_sys->ic->nb_streams; i++)
options[i] = NULL;
if (psz_opts && *psz_opts) {
options[0] = vlc_av_get_options(psz_opts);
@@ -269,7 +270,8 @@ int OpenDemux( vlc_object_t *p_this )
while ((t = av_dict_get(options[0], "", t, AV_DICT_IGNORE_SUFFIX))) {
msg_Err( p_demux, "Unknown option \"%s\"", t->key );
}
- for (unsigned i = 0; i < p_sys->ic->nb_streams; i++) {
+ av_dict_free(&options[0]);
+ for (unsigned i = 1; i < p_sys->ic->nb_streams; i++) {
av_dict_free(&options[i]);
}
#else
More information about the vlc-commits
mailing list