From: Michael Niedermayer via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Cc: Michael Niedermayer <michael@niedermayer.cc>
Subject: [FFmpeg-devel] Re: [PATCH 6/7] matroskadec: read timecode in BlockAddition
Date: Sat, 13 Sep 2025 13:02:20 +0200
Message-ID: <20250913110220.GE29660@pb2> (raw)
In-Reply-To: <64007e4f-bdb2-47f9-b50d-418584ac16a7@mediaarea.net>
[-- Attachment #1.1: Type: text/plain, Size: 4199 bytes --]
Hi Jerome
On Tue, Sep 09, 2025 at 02:41:39PM +0200, Jerome Martinez via ffmpeg-devel wrote:
> matroska.h | 1 +
> matroskadec.c | 34 ++++++++++++++++++++++++++++++++++
> 2 files changed, 35 insertions(+)
> 83b42253e7a0ca4f220f658b0671e4056e719592 0006-matroskadec-read-timecode-in-BlockAddition.patch
> >From 887508f9f4e4ab21431a41cc78bea48039811cba Mon Sep 17 00:00:00 2001
> From: Jerome Martinez <jerome@mediaarea.net>
> Date: Thu, 4 Sep 2025 20:17:55 +0200
> Subject: [PATCH 6/7] matroskadec: read timecode in BlockAddition
>
> ---
> libavformat/matroska.h | 1 +
> libavformat/matroskadec.c | 34 ++++++++++++++++++++++++++++++++++
> 2 files changed, 35 insertions(+)
>
> diff --git a/libavformat/matroska.h b/libavformat/matroska.h
> index 719f2ef796..d78b33d4b2 100644
> --- a/libavformat/matroska.h
> +++ b/libavformat/matroska.h
> @@ -361,6 +361,7 @@ typedef enum {
> MATROSKA_BLOCK_ADD_ID_TYPE_DEFAULT = 0,
> MATROSKA_BLOCK_ADD_ID_TYPE_OPAQUE = 1,
> MATROSKA_BLOCK_ADD_ID_TYPE_ITU_T_T35 = 4,
> + MATROSKA_BLOCK_ADD_ID_TYPE_SMPTE_12M = 121,
> MATROSKA_BLOCK_ADD_ID_TYPE_DVCC = 0x64766343, // MKBETAG('d','v','c','C')
> MATROSKA_BLOCK_ADD_ID_TYPE_DVVC = 0x64767643, // MKBETAG('d','v','v','C')
> } MatroskaBlockAddIDType;
> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> index 1e0c75c51b..d8800b48a6 100644
> --- a/libavformat/matroskadec.c
> +++ b/libavformat/matroskadec.c
> @@ -295,6 +295,7 @@ typedef struct MatroskaTrack {
>
> uint32_t palette[AVPALETTE_COUNT];
> int has_palette;
> + int add_block_timecode_count;
> } MatroskaTrack;
>
> typedef struct MatroskaAttachment {
> @@ -2530,6 +2531,9 @@ static int mkv_parse_block_addition_mappings(AVFormatContext *s, AVStream *st, M
> return AVERROR_INVALIDDATA;
> }
> break;
> + case MATROSKA_BLOCK_ADD_ID_TYPE_SMPTE_12M:
> + track->add_block_timecode_count++;
> + break;
> case MATROSKA_BLOCK_ADD_ID_TYPE_DVCC:
> case MATROSKA_BLOCK_ADD_ID_TYPE_DVVC:
> if ((ret = mkv_parse_dvcc_dvvc(s, st, track, &mapping->extradata)) < 0)
> @@ -3954,6 +3958,36 @@ static int matroska_parse_block_additional(MatroskaDemuxContext *matroska,
>
> return 0;
> }
> + case MATROSKA_BLOCK_ADD_ID_TYPE_SMPTE_12M: {
> + if (size < 8) {
> + av_log(matroska->ctx, AV_LOG_WARNING, "SMPTE timecode from BlockAdditional is malformed.\n");
> + break;
> + }
> +
> + size_t sd_size = 0;
> + uint8_t *sd = av_packet_get_side_data(pkt, AV_PKT_DATA_S12M_TIMECODE, &sd_size);
> + uint64_t count = sd ? *((uint64_t*)sd) : 0;
> + if (!count) {
> + sd_size = sizeof(uint64_t) * (1 + track->add_block_timecode_count);
> + sd = av_packet_new_side_data(pkt, AV_PKT_DATA_S12M_TIMECODE, sd_size);
> + count = 0;
count is already 0 here
> + }
> +
> + if (count >= track->add_block_timecode_count) {
> + av_log(matroska->ctx, AV_LOG_DEBUG, "There are more timecodes in the block than the count indicated in the track header, extra timecodes are ignored.\n");
> + }
> + else if (sd) {
> + uint64_t tc = *((uint64_t*)data);
is this aligned correctly for uint64_t ?
> + av_log(matroska->ctx, AV_LOG_DEBUG, "Reading SMPTE timecode from BlockAdditional: 0x%016lX (RFC 5484)\n", tc);
> +
> + uint64_t *sd_64 = (uint64_t*)sd;
> + count++;
> + *sd_64 = count;
> + AV_WB64(sd_64 + count, tc);
> + }
> +
Trailing whitespace
> + return 0;
> + }
the {} is unneeded
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 163 bytes --]
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
next prev parent reply other threads:[~2025-09-13 11:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-09 12:37 [FFmpeg-devel] [PATCH 0/7] matroska: support of timecode Jerome Martinez via ffmpeg-devel
2025-09-09 12:38 ` [FFmpeg-devel] [PATCH 1/7] matroskaenc: remove unused MaxBlockAdditionID Jerome Martinez via ffmpeg-devel
2025-09-12 14:52 ` [FFmpeg-devel] " Michael Niedermayer via ffmpeg-devel
2025-09-12 14:57 ` James Almer via ffmpeg-devel
2025-09-09 12:39 ` [FFmpeg-devel] [PATCH 2/7] matroskaenc: reserve_video_track_space option Jerome Martinez via ffmpeg-devel
2025-09-09 12:39 ` [FFmpeg-devel] [PATCH 3/7] matroskaenc: increase default for reserved bytes in video Jerome Martinez via ffmpeg-devel
2025-09-09 12:40 ` [FFmpeg-devel] [PATCH 4/7] 32-bit timecode to 64-bit RFC 5484 timecode functions Jerome Martinez via ffmpeg-devel
2025-09-13 11:11 ` [FFmpeg-devel] " Michael Niedermayer via ffmpeg-devel
2025-09-09 12:41 ` [FFmpeg-devel] [PATCH 5/7] decklink_dec: store timecode in 64-bit RFC 5484 format Jerome Martinez via ffmpeg-devel
2025-09-09 12:41 ` [FFmpeg-devel] [PATCH 6/7] matroskadec: read timecode in BlockAddition Jerome Martinez via ffmpeg-devel
2025-09-13 11:02 ` Michael Niedermayer via ffmpeg-devel [this message]
2025-09-09 12:41 ` [FFmpeg-devel] [PATCH 7/7] matroskaenc: write " Jerome Martinez via ffmpeg-devel
2025-09-11 15:52 ` [FFmpeg-devel] Re: [PATCH 0/7] matroska: support of timecode Dave Rice via ffmpeg-devel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250913110220.GE29660@pb2 \
--to=ffmpeg-devel@ffmpeg.org \
--cc=michael@niedermayer.cc \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git