[vlc-devel] [vlc-commits] vout:android: don't set the output format until we're sure it's correct

Steve Lhomme robux4 at ycbcr.xyz
Tue Aug 28 07:21:41 CEST 2018


You're right. My cherry-pick lost this part.


On 27/08/2018 17:31, Zhao Zhili wrote:
>
>
> On 2018年08月27日 23:14, Steve Lhomme wrote:
>> vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Aug 27 
>> 13:21:46 2018 +0200| [937513b874ec8691d922404983111db121f21f55] | 
>> committer: Steve Lhomme
>>
>> vout:android: don't set the output format until we're sure it's correct
>>
>>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=937513b874ec8691d922404983111db121f21f55 
>>>
>> ---
>>
>>   modules/video_output/android/display.c | 23 ++++++++++++-----------
>>   1 file changed, 12 insertions(+), 11 deletions(-)
>>
>> diff --git a/modules/video_output/android/display.c 
>> b/modules/video_output/android/display.c
>> index 80639f6204..e48a6d6ab2 100644
>> --- a/modules/video_output/android/display.c
>> +++ b/modules/video_output/android/display.c
>> @@ -503,7 +503,7 @@ static void SetRGBMask(video_format_t *p_fmt)
>>   static int OpenCommon(vout_display_t *vd)
>>   {
>>       vout_display_sys_t *sys;
>> -    video_format_t sub_fmt;
>> +    video_format_t fmt, sub_fmt;
>>         vout_window_t *embed =
>>           vout_display_NewWindow(vd, VOUT_WINDOW_TYPE_ANDROID_NATIVE);
>> @@ -532,34 +532,34 @@ static int OpenCommon(vout_display_t *vd)
>>       sys->i_display_width = vd->cfg->display.width;
>>       sys->i_display_height = vd->cfg->display.height;
>>   -    if (vd->fmt.i_chroma != VLC_CODEC_ANDROID_OPAQUE) {
>> +    if (fmt.i_chroma != VLC_CODEC_ANDROID_OPAQUE) {
>
> fmt is uninitialized?
>
>>           /* Setup chroma */
>>           char *psz_fcc = var_InheritString(vd, CFG_PREFIX "chroma");
>>           if (psz_fcc) {
>> -            vd->fmt.i_chroma = 
>> vlc_fourcc_GetCodecFromString(VIDEO_ES, psz_fcc);
>> +            fmt.i_chroma = vlc_fourcc_GetCodecFromString(VIDEO_ES, 
>> psz_fcc);
>>               free(psz_fcc);
>>           } else
>> -            vd->fmt.i_chroma = VLC_CODEC_RGB32;
>> +            fmt.i_chroma = VLC_CODEC_RGB32;
>>   -        switch(vd->fmt.i_chroma) {
>> +        switch(fmt.i_chroma) {
>>               case VLC_CODEC_YV12:
>>                   /* avoid swscale usage by asking for I420 instead 
>> since the
>>                    * vout already has code to swap the buffers */
>> -                vd->fmt.i_chroma = VLC_CODEC_I420;
>> +                fmt.i_chroma = VLC_CODEC_I420;
>>               case VLC_CODEC_I420:
>>                   break;
>>               case VLC_CODEC_RGB16:
>>               case VLC_CODEC_RGB32:
>>               case VLC_CODEC_RGBA:
>> -                SetRGBMask(&vd->fmt);
>> -                video_format_FixRgb(&vd->fmt);
>> +                SetRGBMask(&fmt);
>> +                video_format_FixRgb(&fmt);
>>                   break;
>>               default:
>>                   goto error;
>>           }
>>       }
>>   -    sys->p_window = AndroidWindow_New(vd, &vd->fmt, AWindow_Video);
>> +    sys->p_window = AndroidWindow_New(vd, &fmt, AWindow_Video);
>>       if (!sys->p_window)
>>           goto error;
>>   @@ -568,11 +568,11 @@ static int OpenCommon(vout_display_t *vd)
>>         /* use software rotation if we don't do opaque */
>>       if (!sys->p_window->b_opaque)
>> -        video_format_TransformTo(&vd->fmt, ORIENT_NORMAL);
>> +        video_format_TransformTo(&fmt, ORIENT_NORMAL);
>>         msg_Dbg(vd, "using %s", sys->p_window->b_opaque ? "opaque" : 
>> "ANW");
>>   -    video_format_ApplyRotation(&sub_fmt, &vd->fmt);
>> +    video_format_ApplyRotation(&sub_fmt, &fmt);
>>       sub_fmt.i_chroma = subpicture_chromas[0];
>>       SetRGBMask(&sub_fmt);
>>       video_format_FixRgb(&sub_fmt);
>> @@ -592,6 +592,7 @@ static int OpenCommon(vout_display_t *vd)
>>           goto error;
>>       }
>>   +    vd->fmt = fmt;
>>       /* Setup vout_display */
>>       vd->pool    = Pool;
>>       vd->prepare = Prepare;
>>
>> _______________________________________________
>> vlc-commits mailing list
>> vlc-commits at videolan.org
>> https://mailman.videolan.org/listinfo/vlc-commits
>
>
>
> _______________________________________________
> 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