[vlc-commits] image: use an intermediate es_format_t to do the extra data copy

Steve Lhomme git at videolan.org
Thu Feb 7 13:40:21 CET 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Jan 31 15:50:47 2019 +0100| [7ba24fe389624e7fa6d20f03e75d771cf5e363bb] | committer: Steve Lhomme

image: use an intermediate es_format_t to do the extra data copy

es_forma_Copy will take care of everything

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

 src/misc/image.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/misc/image.c b/src/misc/image.c
index d174949119..8767c97cc1 100644
--- a/src/misc/image.c
+++ b/src/misc/image.c
@@ -685,16 +685,14 @@ static decoder_t *CreateDecoder( image_handler_t *p_image, const video_format_t
     p_owner->p_image = p_image;
 
     p_dec->p_module = NULL;
-    es_format_InitFromVideo( &p_dec->fmt_in, fmt );
-    if( i_extra )
-    {
-        p_dec->fmt_in.p_extra = malloc( i_extra );
-        if( p_dec->fmt_in.p_extra )
-        {
-            memcpy( p_dec->fmt_in.p_extra, p_extra, i_extra );
-            p_dec->fmt_in.i_extra = i_extra;
-        }
-    }
+
+    es_format_t es_fmt;
+    es_format_InitFromVideo( &es_fmt, fmt );
+    if ( es_fmt.p_extra ) free( es_fmt.p_extra );
+    es_fmt.p_extra = p_extra;
+    es_fmt.i_extra = i_extra;
+
+    es_format_Copy( &p_dec->fmt_in, &es_fmt );
     es_format_Init( &p_dec->fmt_out, VIDEO_ES, 0 );
     p_dec->b_frame_drop_allowed = false;
 



More information about the vlc-commits mailing list