[FFmpeg-devel] [PATCH 3/3] h264/pic_timing: support multiple timecodes

Carl Eugen Hoyos ceffmpeg at gmail.com
Tue Oct 9 23:03:38 EEST 2018


2018-10-09 15:32 GMT+02:00, joshdk at ob-encoder.com <joshdk at ob-encoder.com>:
> From: Josh de Kock <joshdk at obe.tv>

> -        /* For SMPTE 12-M timecodes, frame count is a special case if > 30
> FPS.
> -           See SMPTE ST 12-1:2014 Sec 12.1 for more info. */
> -        if (av_cmp_q(h->avctx->framerate, (AVRational) {30, 1}) == 1) {
> -            frames = h->sei.picture_timing.tc_frames / 2;
> -            if (h->sei.picture_timing.tc_frames % 2 == 1) {
> -                if (av_cmp_q(h->avctx->framerate, (AVRational) {50, 1}) ==
> 0)
> -                    tc |= (1 << 7);
> -                else
> -                    tc |= (1 << 23);
> +        tc_sd = (uint32_t*)tcside->data;
> +        tc_sd[0] = h->sei.picture_timing.timecode_cnt;
> +
> +        for (int i = 0; i < tc_sd[0]; i++) {
> +            uint32_t frames;
> +
> +            /* For SMPTE 12-M timecodes, frame count is a special case if >
> 30 FPS.
> +               See SMPTE ST 12-1:2014 Sec 12.1 for more info. */
> +            if (av_cmp_q(h->avctx->framerate, (AVRational) {30, 1}) == 1) {
> +                frames = h->sei.picture_timing.timecode[i].frame / 2;
> +                if (h->sei.picture_timing.timecode[i].frame % 2 == 1) {
> +                    if (av_cmp_q(h->avctx->framerate, (AVRational) {50, 1})
> == 0)
> +                        tc |= (1 << 7);
> +                    else
> +                        tc |= (1 << 23);
> +                }
> +            } else {
> +                frames = h->sei.picture_timing.timecode[i].frame;
>              }
> -        } else {
> -            frames = h->sei.picture_timing.tc_frames;
> -        }
>
> -        tc |= h->sei.picture_timing.tc_dropframe << 30;
> -        tc |= (frames / 10) << 28;
> -        tc |= (frames % 10) << 24;
> -        tc |= (h->sei.picture_timing.tc_seconds / 10) << 20;
> -        tc |= (h->sei.picture_timing.tc_seconds % 10) << 16;
> -        tc |= (h->sei.picture_timing.tc_minutes / 10) << 12;
> -        tc |= (h->sei.picture_timing.tc_minutes % 10) << 8;
> -        tc |= (h->sei.picture_timing.tc_hours / 10) << 4;
> -        tc |= (h->sei.picture_timing.tc_hours % 10);
> +            tc |= h->sei.picture_timing.timecode[i].dropframe << 30;
> +            tc |= (frames / 10) << 28;
> +            tc |= (frames % 10) << 24;
> +            tc |= (h->sei.picture_timing.timecode[i].seconds / 10) << 20;
> +            tc |= (h->sei.picture_timing.timecode[i].seconds % 10) << 16;
> +            tc |= (h->sei.picture_timing.timecode[i].minutes / 10) << 12;
> +            tc |= (h->sei.picture_timing.timecode[i].minutes % 10) << 8;
> +            tc |= (h->sei.picture_timing.timecode[i].hours / 10) << 4;
> +            tc |= (h->sei.picture_timing.timecode[i].hours % 10);
>
> -        memcpy(tcside->data, &tc, sizeof(uint32_t));
> -        h->sei.picture_timing.fulltc_received = 0;
> +            tc_sd[i + 1] = tc;
> +        }
> +        h->sei.picture_timing.timecode_cnt = 0;

If the first patch gets committed as-is, please split this one
in a functional and a cosmetic patch, above is unreviewable.

Thank you, Carl Eugen


More information about the ffmpeg-devel mailing list