diff mbox series

[FFmpeg-devel] avcodec/dpx: Read alternative frame rate from television header

Message ID CAHGNH3EsQj_a7pp10KSsOhXO9gphu6E3HWxX24ByMmbY9SSNzg@mail.gmail.com
State Superseded
Headers show
Series [FFmpeg-devel] avcodec/dpx: Read alternative frame rate from television header | expand

Checks

Context Check Description
andriy/default pending
andriy/configure warning Failed to apply patch

Commit Message

Harry Mallon Aug. 13, 2020, 4:54 p.m. UTC
Signed-off-by: Harry Mallon <harry.mallon@codex.online>
---
 libavcodec/dpx.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

                 avctx->framerate = q;
diff mbox series

Patch

diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
index b1833ed9ef..694deb27c5 100644
--- a/libavcodec/dpx.c
+++ b/libavcodec/dpx.c
@@ -216,10 +216,22 @@  static int decode_frame(AVCodecContext *avctx,
     else
         avctx->sample_aspect_ratio = (AVRational){ 0, 1 };

+    /* preferred frame rate from Motion-picture film header */
     if (offset >= 1724 + 4) {
         buf = avpkt->data + 1724;
         i = read32(&buf, endian);
-        if(i) {
+        if(i && i != 0xFFFFFFFF) {
+            AVRational q = av_d2q(av_int2float(i), 4096);
+            if (q.num > 0 && q.den > 0)
+                avctx->framerate = q;
+        }
+    }
+
+    /* alternative frame rate from television header */
+    if (!(avctx->framerate.num && avctx->framerate.den) && offset >=
1940 + 4) {
+        buf = avpkt->data + 1940;
+        i = read32(&buf, endian);
+        if(i && i != 0xFFFFFFFF) {
             AVRational q = av_d2q(av_int2float(i), 4096);
             if (q.num > 0 && q.den > 0)