ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | 
Mon Jul  8 19:36:36 2024 +0200| [0d1bc9666cda3eca61b29530a21920be1bbd8a08] | 
committer: Andreas Rheinhardt

avformat/matroskaenc: Only write useful cropping values

Reviewed-by: James Almer <jamr...@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0d1bc9666cda3eca61b29530a21920be1bbd8a08
---

 libavformat/matroskaenc.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 4b91283119..a98d33abf3 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1799,10 +1799,14 @@ static int mkv_write_track_video(AVFormatContext *s, 
MatroskaMuxContext *mkv,
             return AVERROR(EINVAL);
         }
 
-        ebml_writer_add_uint(&writer, MATROSKA_ID_VIDEOPIXELCROPB, bottom);
-        ebml_writer_add_uint(&writer, MATROSKA_ID_VIDEOPIXELCROPT, top);
-        ebml_writer_add_uint(&writer, MATROSKA_ID_VIDEOPIXELCROPL, left);
-        ebml_writer_add_uint(&writer, MATROSKA_ID_VIDEOPIXELCROPR, right);
+        if (bottom)
+            ebml_writer_add_uint(&writer, MATROSKA_ID_VIDEOPIXELCROPB, bottom);
+        if (top)
+            ebml_writer_add_uint(&writer, MATROSKA_ID_VIDEOPIXELCROPT, top);
+        if (left)
+            ebml_writer_add_uint(&writer, MATROSKA_ID_VIDEOPIXELCROPL, left);
+        if (right)
+            ebml_writer_add_uint(&writer, MATROSKA_ID_VIDEOPIXELCROPR, right);
 
         cropped_width  -= left + right;
         cropped_height -= top + bottom;

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to