[vlc-devel] [PATCH 1/7] video_output: keep track of the vout modules that can switch stereo modes dynamically

Steve Lhomme robux4 at ycbcr.xyz
Fri Aug 17 08:34:09 CEST 2018


On 16/08/2018 18:56, Rémi Denis-Courmont wrote:
> Le torstaina 16. elokuuta 2018, 12.00.43 EEST Steve Lhomme a écrit :
>> ---
>>   include/vlc_vout_display.h       | 1 +
>>   src/video_output/display.c       | 1 +
>>   src/video_output/video_output.c  | 6 ++++++
>>   src/video_output/vout_internal.h | 5 +++++
>>   4 files changed, 13 insertions(+)
>>
>> diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
>> index 86eb1bced0..830cbf053f 100644
>> --- a/include/vlc_vout_display.h
>> +++ b/include/vlc_vout_display.h
>> @@ -112,6 +112,7 @@ typedef struct {
>>       bool is_slow;                           /* The picture memory has slow
>> read/write */ bool has_double_click;                  /* Is double-click
>> generated */ bool has_pictures_invalid;              /* Will
>> VOUT_DISPLAY_EVENT_PICTURES_INVALID be used */ +    int stereo_modes;
>>                  /* bitmask of multiview modes supported dynamically */
>> const vlc_fourcc_t *subpicture_chromas; /* List of supported chromas for
>> subpicture rendering. */ } vout_display_info_t;
>>
>> diff --git a/src/video_output/display.c b/src/video_output/display.c
>> index b0c0fdbb3e..a06b441d7f 100644
>> --- a/src/video_output/display.c
>> +++ b/src/video_output/display.c
>> @@ -93,6 +93,7 @@ static vout_display_t *vout_display_New(vlc_object_t *obj,
>> vd->info.has_double_click = false;
>>       vd->info.has_pictures_invalid = false;
>>       vd->info.subpicture_chromas = NULL;
>> +    vd->info.stereo_modes = (1 << MULTIVIEW_2D);
>>
>>       vd->cfg = cfg;
>>       vd->pool = NULL;
>> diff --git a/src/video_output/video_output.c
>> b/src/video_output/video_output.c index da8022a8f3..23ea32c139 100644
>> --- a/src/video_output/video_output.c
>> +++ b/src/video_output/video_output.c
>> @@ -498,6 +498,12 @@ int vout_GetSnapshot(vout_thread_t *vout,
>>       return VLC_SUCCESS;
>>   }
>>
>> +bool vout_CanHandleStereoInput(vout_thread_t *vout, video_multiview_mode_t
>> mode) +{
>> +    vout_display_t *vd = vout->p->display.vd;
>> +    return vd && vd->info.stereo_modes & (1<<mode);
>> +}
>> +
> That looks like a violation of the current video output threading model.

Yes. for now display->vd is not protected even internally, it's not set 
to NULL in vout_CloseWrapper() for example. So even if there was a lock 
we might still read freed memory. But that can be solved. It's created 
and released in the VOUT thread so a lock to read/write it should work.

The vout->p is not a problem, it's just a pointer to internal vout data 
(vout->p=(vout_thread_sys_t*)&vout[1];) so if vout exists, p exists.

>
>>   void vout_ChangeAspectRatio( vout_thread_t *p_vout,
>>                                unsigned int i_num, unsigned int i_den )
>>   {
>> diff --git a/src/video_output/vout_internal.h
>> b/src/video_output/vout_internal.h index 8eaac0dee9..d3608da38b 100644
>> --- a/src/video_output/vout_internal.h
>> +++ b/src/video_output/vout_internal.h
>> @@ -280,6 +280,11 @@ void vout_DisplayTitle( vout_thread_t *p_vout, const
>> char *psz_title ); */
>>   bool vout_IsEmpty( vout_thread_t *p_vout );
>>
>> +/**
>> + * Returns true if the vout can handle the multiview input switch
>> dynamically. + */
>> +bool vout_CanHandleStereoInput(vout_thread_t *, video_multiview_mode_t);
>> +
>>   void vout_SetSpuHighlight( vout_thread_t *p_vout, const vlc_spu_highlight_t
>> * );
>>
>>   #endif
>
> -- 
> Rémi Denis-Courmont
> http://www.remlab.net/
>
>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel



More information about the vlc-devel mailing list