aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-07-08 19:36:36 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-07-08 20:11:27 +0200
commit0d1bc9666cda3eca61b29530a21920be1bbd8a08 (patch)
tree9325343b40e8f760cc53031bf162861500b456a6
parent9ffac78eba3887f2d7c113937162607d05180e0c (diff)
downloadffmpeg-0d1bc9666cda3eca61b29530a21920be1bbd8a08.tar.gz
avformat/matroskaenc: Only write useful cropping values
Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavformat/matroskaenc.c12
1 files 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;