[MPlayer-cvslog] r32439 - trunk/libmpdemux/demux_lavf.c
reimar
subversion at mplayerhq.hu
Mon Oct 4 20:12:36 CEST 2010
Author: reimar
Date: Mon Oct 4 20:12:36 2010
New Revision: 32439
Log:
Handle libavformat adding additional streams during playback.
Based on patch by KS Ng - dmbth [hk.dmbth gmail com]
Modified:
trunk/libmpdemux/demux_lavf.c
Modified: trunk/libmpdemux/demux_lavf.c
==============================================================================
--- trunk/libmpdemux/demux_lavf.c Mon Oct 4 08:40:32 2010 (r32438)
+++ trunk/libmpdemux/demux_lavf.c Mon Oct 4 20:12:36 2010 (r32439)
@@ -77,6 +77,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) {
@@ -552,6 +553,8 @@ static demuxer_t* demux_open_lavf(demuxe
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 @@ static int demux_lavf_fill_buffer(demuxe
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){
More information about the MPlayer-cvslog
mailing list