[MPlayer-dev-eng] [PATCH] DVB TS subtitle not working if corresponding PID doesn't occur at beginning for -demux lavf

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Oct 3 09:32:47 CEST 2010


On Sun, Oct 03, 2010 at 08:40:16AM +0800, KS Ng - dmbth wrote:
> --- 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;
> +

Your mailer mangled the patch.
The indentation doesn't match the surrounding one.
Also, I think it would be better for long-term
maintainability to put this assignment right
after the handle_stream loop.

> @@ -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;

Remove the mp_msg (we should usually get some output from
handle_stream anyway).
Then you can simplify it to

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;


More information about the MPlayer-dev-eng mailing list