diff mbox series

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

Message ID CAHGNH3Eb-5FmK9rmb9dzdjsHWbxd_Z_cJ-zRpPazqvZbj7czHA@mail.gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,v2] avcodec/dpx: Read alternative frame rate from television header | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

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

Comments

Harry Mallon Sept. 28, 2020, 2:52 p.m. UTC | #1
> On 14 Aug 2020, at 11:03, Harry Mallon <harry.mallon@codex.online> wrote:
> 
> Signed-off-by: Harry Mallon <harry.mallon@codex.online>
> ---
> libavcodec/dpx.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
> 
> 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;
> -- 
> 2.28.0
> 

Bump, does anyone have anything on this?

Best,
Harry
diff mbox series

Patch

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;