[vlc-commits] image: clean resetting of the es_format on metadata change

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


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Feb  7 13:24:40 2019 +0100| [94f1b134e51f2970136230943354c2ae87c4633d] | committer: Steve Lhomme

image: clean resetting of the es_format on metadata change

The formats are always cleaned in DeleteConverter() so they need to be safe.

Technically converters probably don't handle on the fly size change but that's
a different issue.

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

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

diff --git a/src/misc/image.c b/src/misc/image.c
index a7f591157d..00e09c3952 100644
--- a/src/misc/image.c
+++ b/src/misc/image.c
@@ -255,8 +255,10 @@ static picture_t *ImageRead( image_handler_t *p_image, block_t *p_block,
         else
         {
             /* Filters should handle on-the-fly size changes */
-            p_image->p_converter->fmt_in = p_image->p_dec->fmt_out;
-            p_image->p_converter->fmt_out.video = *p_fmt_out;
+            es_format_Clean( &p_image->p_converter->fmt_in );
+            es_format_Copy( &p_image->p_converter->fmt_in, &p_image->p_dec->fmt_out );
+            video_format_Clean( &p_image->p_converter->fmt_out.video );
+            video_format_Copy( &p_image->p_converter->fmt_out.video, p_fmt_out);
         }
 
         p_pic = p_image->p_converter->pf_video_filter( p_image->p_converter, p_pic );
@@ -419,8 +421,10 @@ static block_t *ImageWrite( image_handler_t *p_image, picture_t *p_pic,
         else
         {
             /* Filters should handle on-the-fly size changes */
-            p_image->p_converter->fmt_in.video = *p_fmt_in;
-            p_image->p_converter->fmt_out.video = p_image->p_enc->fmt_in.video;
+            es_format_Clean( &p_image->p_converter->fmt_in );
+            es_format_InitFromVideo( &p_image->p_converter->fmt_in, p_fmt_in );
+            es_format_Clean( &p_image->p_converter->fmt_out );
+            es_format_Copy( &p_image->p_converter->fmt_out, &p_image->p_enc->fmt_in );
         }
 
         picture_Hold( p_pic );
@@ -553,8 +557,10 @@ static picture_t *ImageConvert( image_handler_t *p_image, picture_t *p_pic,
     else
     {
         /* Filters should handle on-the-fly size changes */
-        p_image->p_converter->fmt_in.video = *p_fmt_in;
-        p_image->p_converter->fmt_out.video = *p_fmt_out;
+        es_format_Clean( &p_image->p_converter->fmt_in );
+        es_format_InitFromVideo( &p_image->p_converter->fmt_in, p_fmt_in );
+        es_format_Clean( &p_image->p_converter->fmt_out );
+        es_format_InitFromVideo( &p_image->p_converter->fmt_out, p_fmt_out );
     }
 
     picture_Hold( p_pic );



More information about the vlc-commits mailing list