[vlc-commits] image: clean video_format_t input/output usages of image_Read() callers

Steve Lhomme git at videolan.org
Thu Feb 7 16:36:10 CET 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Feb  7 16:27:58 2019 +0100| [29bb8badcafed34f66655fd54dd0f99a99a5adce] | committer: Steve Lhomme

image: clean video_format_t input/output usages of image_Read() callers

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=29bb8badcafed34f66655fd54dd0f99a99a5adce
---

 modules/codec/subsusf.c       | 9 ++++-----
 modules/codec/ttml/substtml.c | 2 ++
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/modules/codec/subsusf.c b/modules/codec/subsusf.c
index 9db7508ada..9131e3f693 100644
--- a/modules/codec/subsusf.c
+++ b/modules/codec/subsusf.c
@@ -512,11 +512,8 @@ static int ParseImageAttachments( decoder_t *p_dec )
 
                     memcpy( p_block->p_buffer, p_attach->p_data, p_attach->i_data );
 
-                    memset( &fmt_in,  0, sizeof( video_format_t));
-                    memset( &fmt_out, 0, sizeof( video_format_t));
-
-                    fmt_in.i_chroma  = type;
-                    fmt_out.i_chroma = VLC_CODEC_YUVA;
+                    video_format_Init( &fmt_in,  type );
+                    video_format_Init( &fmt_out, VLC_CODEC_YUVA );
 
                     /* Find a suitable decoder module */
                     if( module_exists( "sdl_image" ) )
@@ -530,6 +527,8 @@ static int ParseImageAttachments( decoder_t *p_dec )
 
                     p_pic = image_Read( p_image, p_block, &fmt_in, &fmt_out );
                     var_Destroy( p_dec, "codec" );
+                    video_format_Clean( &fmt_in );
+                    video_format_Clean( &fmt_out );
                 }
 
                 image_HandlerDelete( p_image );
diff --git a/modules/codec/ttml/substtml.c b/modules/codec/ttml/substtml.c
index 084113d3ef..0320858788 100644
--- a/modules/codec/ttml/substtml.c
+++ b/modules/codec/ttml/substtml.c
@@ -1180,6 +1180,8 @@ static picture_t * picture_CreateFromPNG( decoder_t *p_dec,
     }
     else block_Release( p_block );
     p_dec->obj.flags = i_flags;
+    video_format_Clean( &fmt_in );
+    video_format_Clean( &fmt_out );
 
     return p_pic;
 }



More information about the vlc-commits mailing list