[vlc-devel] [PATCH]: fix regression in ImageReadUrl

erwan.tulou at gmail.com erwan.tulou at gmail.com
Wed Feb 20 14:34:00 CET 2019


Hi,

On 20/02/2019 13:03, Steve Lhomme wrote:
> Hi,
>
> On 19/02/2019 14:11, erwan.tulou at gmail.com wrote:
>> Hello,
>>
>>    The patch is intended to fix i_codec (within es_format_t) no 
>> longer properly initialized after some recent refactoring.
>
> The patch seems complicated for a single missing value.
>
> Instead of the es_format_InitFromVideo() you could just set the 
> i_codec to the i_chroma value. Or set the i_codec value at the same 
> time as the i_chroma is set in that function.
>
>
Yes, i_codec can directly be set. It's just one additional line of code.

The patch just opted to rely on the constructors/destructors available 
for es_format_t and the likes. This helps stay away from what may appear 
a detail of implementation (having two different variables to initialize).

But, either way is okay. If no one else objects to it, I'll follow your 
remark.

>>
>> 0001-image-fix-ImageReadUrl.patch
>>
>>  From 88bdf864f9b4d6c51c83933c6938c9fd5d15841f Mon Sep 17 00:00:00 2001
>> From: Erwan Tulou <erwan10 at videolan.org>
>> Date: Tue, 19 Feb 2019 13:08:58 +0100
>> Subject: [PATCH] image: fix ImageReadUrl()
>>
>> i_codec (within es_format_t) was no longer properly initialized after 
>> some
>> recent refactoring, therefore failing to decode any image. This 
>> accounted
>> for the skins2 engine no longer able to display anything.
>> ---
>>   src/misc/image.c | 13 ++++++++-----
>>   1 file changed, 8 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/misc/image.c b/src/misc/image.c
>> index 52edd0ff67..a21b82f498 100644
>> --- a/src/misc/image.c
>> +++ b/src/misc/image.c
>> @@ -301,22 +301,25 @@ static picture_t *ImageReadUrl( image_handler_t 
>> *p_image, const char *psz_url,
>>       if( p_block == NULL )
>>           goto error;
>>   -    es_format_t fmtin;
>> -    es_format_Init( &fmtin, VIDEO_ES, 0 ); /* no chroma, the MIME 
>> type of the picture will be used */
>> +    video_format_t fmtvideo;
>> +    video_format_Init( &fmtvideo, 0 );
>>         char *psz_mime = stream_MimeType( p_stream );
>>       if( psz_mime != NULL )
>>       {
>> -        fmtin.video.i_chroma = image_Mime2Fourcc( psz_mime );
>> +        fmtvideo.i_chroma = image_Mime2Fourcc( psz_mime );
>>           free( psz_mime );
>>       }
>> -    if( !fmtin.video.i_chroma )
>> +    if( !fmtvideo.i_chroma )
>>       {
>>          /* Try to guess format from file name */
>> -       fmtin.video.i_chroma = image_Ext2Fourcc( psz_url );
>> +       fmtvideo.i_chroma = image_Ext2Fourcc( psz_url );
>>       }
>>       vlc_stream_Delete( p_stream );
>>   +    es_format_t fmtin;
>> +    es_format_InitFromVideo( &fmtin, &fmtvideo );
>> +    video_format_Clean( &fmtvideo );
>>         p_pic = ImageRead( p_image, p_block, &fmtin, p_fmt_out );
>>   --
>> 2.20.1
>>
>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
>
> _______________________________________________
> 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