summaryrefslogtreecommitdiff
path: root/libavcodec/dpx.c
diff options
context:
space:
mode:
authorHarry Mallon <harry.mallon@codex.online>2020-12-07 10:32:10 +0000
committerPaul B Mahol <onemda@gmail.com>2020-12-17 13:02:49 +0100
commit6623421454c55890a720b8dd818bb9304e9ff529 (patch)
treedd9c0d926dcdefe593a8ade1a6b71b322e530907 /libavcodec/dpx.c
parent4bdfbd688fff4450b0e94abb1befe16902a6660b (diff)
downloadffmpeg-6623421454c55890a720b8dd818bb9304e9ff529.tar.gz
avcodec/dpx: Read alternative frame rate from television header
Signed-off-by: Harry Mallon <harry.mallon@codex.online>
Diffstat (limited to 'libavcodec/dpx.c')
-rw-r--r--libavcodec/dpx.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
index b1833ed9ef..7e3ac0af2e 100644
--- a/libavcodec/dpx.c
+++ b/libavcodec/dpx.c
@@ -216,10 +216,23 @@ 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 (offset >= 1940 + 4 &&
+ !(avctx->framerate.num && avctx->framerate.den)) {
+ 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)
avctx->framerate = q;