Mercurial > mplayer.hg
diff libmpdemux/demux_lavf.c @ 32353:a5ed4bcb1149
Handle libavformat adding additional streams during playback.
Based on patch by KS Ng - dmbth [hk.dmbth gmail com]
author | reimar |
---|---|
date | Mon, 04 Oct 2010 18:12:36 +0000 |
parents | 7c8d240d37a6 |
children | fbe5c829c69b |
line wrap: on
line diff
--- a/libmpdemux/demux_lavf.c Mon Oct 04 06:40:32 2010 +0000 +++ b/libmpdemux/demux_lavf.c Mon Oct 04 18:12:36 2010 +0000 @@ -77,6 +77,7 @@ int vstreams[MAX_V_STREAMS]; int sstreams[MAX_S_STREAMS]; int cur_program; + int nb_streams_last; }lavf_priv_t; static int mp_read(void *opaque, uint8_t *buf, int size) { @@ -552,6 +553,8 @@ for(i=0; i<avfc->nb_streams; i++) handle_stream(demuxer, avfc, i); + priv->nb_streams_last = avfc->nb_streams; + if(avfc->nb_programs) { int p; for (p = 0; p < avfc->nb_programs; p++) { @@ -589,6 +592,11 @@ if(av_read_frame(priv->avfc, &pkt) < 0) return 0; + // handle any new streams that might have been added + for (id = priv->nb_streams_last; id < priv->avfc->nb_streams; id++) + handle_stream(demux, priv->avfc, id); + priv->nb_streams_last = priv->avfc->nb_streams; + id= pkt.stream_index; if(id==demux->audio->id){