[vlc-devel] [PATCH] libvlc: add function to get track id from video setup callback.

Rémi Denis-Courmont remi at remlab.net
Mon Mar 3 15:51:27 CET 2014


On Mon,  3 Mar 2014 13:20:05 +0100, Jerome Forissier <jerome at taodyne.com>
wrote:
> diff --git a/include/vlc_es.h b/include/vlc_es.h
> index 38d63da..536883e 100644
> --- a/include/vlc_es.h
> +++ b/include/vlc_es.h
> @@ -202,6 +202,8 @@ struct video_format_t
>      int i_rbshift, i_lbshift;
>      video_palette_t *p_palette;              /**< video palette from
>      demuxer */
>      video_orientation_t orientation;                /**< picture
>      orientation */
> +
> +    int i_dec_es_id;                  /**< elementary stream ID from
> decoder */

IMHO, the ES id is meta-data which does not belong in the physical video
format. Furthermore, this is a reference and the video format is supposed
to be self-contained. And even otherwise, I suspect a lot of code paths
would leave the value undefined as of now.

>  };
>  
>  /**
> diff --git a/modules/video_output/vmem.c b/modules/video_output/vmem.c
> index 2575f75..8acfcb1 100644
> --- a/modules/video_output/vmem.c
> +++ b/modules/video_output/vmem.c
> @@ -92,6 +92,8 @@ struct vout_display_sys_t {
>      unsigned        count;
>  
>      void *opaque;
> +    int  track_id; /* Keep at (int *)(opaque + 1) --
> +                      see libvlc_video_format_cb_get_track_id() */

Does this really need to be retained in sys?

>      void *(*lock)(void *sys, void **plane);
>      void (*unlock)(void *sys, void *id, void *const *plane);
>      void (*display)(void *sys, void *id);
> @@ -136,6 +138,7 @@ static int Open(vlc_object_t *object)
>      sys->display = var_InheritAddress(vd, "vmem-display");
>      sys->cleanup = var_InheritAddress(vd, "vmem-cleanup");
>      sys->opaque = var_InheritAddress(vd, "vmem-data");
> +    sys->track_id = vd->fmt.i_dec_es_id;
>      sys->pool = NULL;
>  
>      /* Define the video format */
> diff --git a/src/input/decoder.c b/src/input/decoder.c
> index 46129fc..892a3c7 100644
> --- a/src/input/decoder.c
> +++ b/src/input/decoder.c
> @@ -2060,6 +2060,7 @@ static picture_t *vout_new_buffer( decoder_t
*p_dec )
>  
>          video_format_t fmt = p_dec->fmt_out.video;
>          fmt.i_chroma = p_dec->fmt_out.i_codec;
> +        fmt.i_dec_es_id = p_dec->fmt_in.i_id;

I guess this will not work if the format is unchanged, but the track ID is
(kind of relates to the first comment).

>          p_owner->video = fmt;
>  
>          if( vlc_fourcc_IsYUV( fmt.i_chroma ) )

-- 
Rémi Denis-Courmont
Sent from my collocated server



More information about the vlc-devel mailing list