[MPlayer-dev-eng] [PATCH] DVB TS subtitle not working if corresponding PID doesn't occur at beginning for -demux lavf
KS Ng - dmbth
hk.dmbth at gmail.com
Sun Oct 3 02:40:16 CEST 2010
Hello,
Subtitles in DVB broadcast very often occur dynamically, i.e. subtitle
streams and their respective PID information in the PMT occur only when
present. It is found that the lavf demux (mplayer invoked with -demux
lavf) is not aware of such subtitle streams if their PIDs are not
present when opening the transport stream.
Below is a small patch to fix this issue.
I've uploaded a file HK_DVB_w_subtitle.ts for your testing. 2 subtitle
streams occur a few seconds from the end of the video clip.
Please kindly review!
Thanks,
K.S. Ng
PS. I notice there's call for samples of video clips with subtitling
working using lavf demuxer but not with mplayer's
(libmpdemux/demux_ts.c). The file I've uploaded can probably be one such
sample as it only works using lavf demuxer with my patch.
Patch:
Index: libmpdemux/demux_lavf.c
===================================================================
--- libmpdemux/demux_lavf.c (revision 32358)
+++ libmpdemux/demux_lavf.c (working copy)
@@ -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) {
@@ -573,6 +574,8 @@
demuxer->video->id=-2; // audio-only
} //else if (best_video > 0 && demuxer->video->id == -1)
demuxer->video->id = best_video;
+ priv->nb_streams_last = priv->avfc->nb_streams;
+
return demuxer;
}
@@ -581,7 +584,7 @@
AVPacket pkt;
demux_packet_t *dp;
demux_stream_t *ds;
- int id;
+ int id, i;
mp_msg(MSGT_DEMUX,MSGL_DBG2,"demux_lavf_fill_buffer()\n");
demux->filepos=stream_tell(demux->stream);
@@ -589,6 +592,14 @@
if(av_read_frame(priv->avfc, &pkt) < 0)
return 0;
+ if( priv->nb_streams_last != priv->avfc->nb_streams ) {
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "Nb streams changed %d %d\n",
priv->nb_streams_last, priv->avfc->nb_streams);
+ for(i=priv->nb_streams_last; i<priv->avfc->nb_streams; i++) {
+ handle_stream(demux, priv->avfc, i);
+ }
+ }
+ priv->nb_streams_last = priv->avfc->nb_streams;
+
id= pkt.stream_index;
if(id==demux->audio->id){
More information about the MPlayer-dev-eng
mailing list