[vlc-devel] [PATCH] libvlc: add function to get track id from video setup callback.
Jérôme Forissier
jerome at taodyne.com
Mon Mar 3 16:38:37 CET 2014
On 3 mars 2014, at 15:51, Rémi Denis-Courmont wrote:
> 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.
Agreed. But then how would you recommend I pass this ID from vout_new_buffer()
to the Open() function of vmem.c? That's all I'm trying to accomplish...
> And even otherwise, I suspect a lot of code paths
> would leave the value undefined as of now.
Right, I forgot to update video_format_Init() / video_formar_Clean().
>> };
>>
>> /**
>> 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?
No. It just has to be sitting next to opaque for the duration of the setup()
callback, which can indeed be accomplished inside Open() without changing
vout_display_sys_t.
>
>> 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).
Probably, but the purpose of the patch it just to be able to get the track ID at
the time the vout is created.
Thanks.
--
Jérôme
More information about the vlc-devel
mailing list