[FFmpeg-cvslog] lavf/smacker: export sample_aspect_ratio

Anton Khirnov git at videolan.org
Sun Nov 5 12:57:33 EET 2023


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Fri Oct 27 09:52:42 2023 +0200| [ad3df6bf35825fe94a673e2be515067acd61769c] | committer: Anton Khirnov

lavf/smacker: export sample_aspect_ratio

Partially fixes #10617

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

 libavformat/smacker.c        | 5 +++++
 tests/ref/fate/smacker-video | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/smacker.c b/libavformat/smacker.c
index 1d54e8e917..d04c8b91a6 100644
--- a/libavformat/smacker.c
+++ b/libavformat/smacker.c
@@ -34,6 +34,8 @@
 
 #define SMACKER_PAL 0x01
 #define SMACKER_FLAG_RING_FRAME 0x01
+#define SMACKER_FLAG_Y_INTERLACE (1 << 1)
+#define SMACKER_FLAG_Y_DOUBLE    (1 << 2)
 
 enum SAudFlags {
     SMK_AUD_PACKED  = 0x80,
@@ -144,6 +146,9 @@ static int smacker_read_header(AVFormatContext *s)
     avpriv_set_pts_info(st, 33, pts_inc, tbase);
     st->duration = smk->frames;
 
+    st->sample_aspect_ratio = (AVRational){ 1, 1 +
+        !!(flags & (SMACKER_FLAG_Y_INTERLACE | SMACKER_FLAG_Y_DOUBLE)) };
+
     /* init video codec */
     par = st->codecpar;
     par->width      = width;
diff --git a/tests/ref/fate/smacker-video b/tests/ref/fate/smacker-video
index 9325d91a22..4635ef55f1 100644
--- a/tests/ref/fate/smacker-video
+++ b/tests/ref/fate/smacker-video
@@ -2,7 +2,7 @@
 #media_type 0: video
 #codec_id 0: rawvideo
 #dimensions 0: 320x200
-#sar 0: 0/1
+#sar 0: 1/1
 0,          0,          0,        1,   192000, 0x8926d7fc
 0,          1,          1,        1,   192000, 0x2506d384
 0,          2,          2,        1,   192000, 0x9a8dc93a



More information about the ffmpeg-cvslog mailing list