diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-10-04 18:12:36 +0000 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-11-02 04:18:08 +0200 |
commit | c310aa46283fb62ea7e6c0533a247eb3afe672c4 (patch) | |
tree | 67bd94e552b6f6c4d94ff49a8655cc6e43182537 /libmpdemux | |
parent | db90a65d11116cced00efafc7235ba01bbdf7564 (diff) |
demux_lavf: handle new streams appearing during playback
Based on patch by KS Ng - dmbth [hk.dmbth gmail com]
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32439 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r-- | libmpdemux/demux_lavf.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index 098ee3786d..21ff9514d3 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -73,6 +73,7 @@ typedef struct lavf_priv { 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) { @@ -565,6 +566,8 @@ static demuxer_t* demux_open_lavf(demuxer_t *demuxer){ 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++) { @@ -604,6 +607,11 @@ static int demux_lavf_fill_buffer(demuxer_t *demux, demux_stream_t *dsds){ 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){ |