avformat/cbs: move AV1 feature definition to their own header

The lavf AV1 CBS implementation disables metadata, tile lists and padding,
but movenccenc.c sees the default AV1RawOBU definition. On 32-bit MinGW,
the metadata member raises the union alignment from four to eight bytes,
placing obu at offset 16 in the caller instead of offset 12 in CBS.
Consequently AV1 CENC reads the wrong fields and fails to write tiles.

Move the feature definitions into the common lavf CBS header so that the
parser and its callers use the same AV1RawOBU layout. Keep the reduced
set of parsed OBU types.

Add a FATE encryption/decryption test using the existing nonuniform-tile
AV1 sample. The test fails before this change with GCC -m32 -malign-double
(which reproduces the relevant MinGW layout) and passes afterwards with
the same reference on that configuration and AArch64.

Fixes #23069.

Assisted-by: Fairy
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer committed 2026-09-10 22:38:20 -03:00
1 parent 3a165c77dc
commit 05bd55ff6e
5 files changed
+69 -5

No files matched your search

+1 -4
View File
@@ -16,8 +16,5 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define CBS_AV1_OBU_TILE_LIST 0
#define CBS_AV1_OBU_METADATA 0
#define CBS_AV1_OBU_PADDING 0
#include "cbs.h"
#include "cbs_av1.h"
#include "libavcodec/cbs_av1.c"
+30
View File
@@ -0,0 +1,30 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVFORMAT_CBS_AV1_H
#define AVFORMAT_CBS_AV1_H
#include "cbs.h"
#define CBS_AV1_OBU_TILE_LIST 0
#define CBS_AV1_OBU_METADATA 0
#define CBS_AV1_OBU_PADDING 0
#include "libavcodec/cbs_av1.h"
#endif /* AVFORMAT_CBS_AV1_H */
+1 -1
View File
@@ -21,7 +21,7 @@
#include "movenccenc.h"
#include "libavcodec/av1_parse.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/cbs_av1.h"
#include "libavformat/cbs_av1.h"
#include "libavutil/attributes.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
+5
View File
@@ -208,6 +208,11 @@ fate-mov-mp4-fragmented-ttml-dfxp: CMD = transcode srt $(TARGET_SAMPLES)/sub/Sub
"-f lavfi -i smptehdbars=duration=24.5245:size=320x180:rate=24000/1001,format=yuv420p" \
"" "" "data"
FATE_MOV_FFMPEG_SAMPLES-$(call REMUX, MP4 IVF, MOV_DEMUXER AV1_PARSER EXTRACT_EXTRADATA_BSF) += fate-mov-av1-cenc
fate-mov-av1-cenc: CMD = transcode ivf $(TARGET_SAMPLES)/av1/non_uniform_tiling.ivf mp4 \
"-c:v copy -encryption_scheme cenc-aes-ctr -encryption_key 00112233445566778899aabbccddeeff -encryption_kid 00112233445566778899aabbccddeeff" \
"-c:v copy" "" "" "-decryption_key 00112233445566778899aabbccddeeff"
# avif demuxing - still image with 1 item.
FATE_MOV_FFMPEG_SAMPLES-$(call FRAMECRC, MOV, AV1, AV1_PARSER) \
+= fate-mov-avif-demux-still-image-1-item
+32
View File
@@ -0,0 +1,32 @@
4c0d58049d04303b98cd7c07013a1183 *tests/data/fate/mov-av1-cenc.mp4
39366 tests/data/fate/mov-av1-cenc.mp4
#extradata 0: 17, 0x197103ea
#tb 0: 1/12288
#media_type 0: video
#codec_id 0: av1
#dimensions 0: 720x300
#sar 0: 1/1
0, 0, 0, 512, 17049, 0x6d66f097
0, 512, 512, 512, 8365, 0x9c48024d, F=0x0
0, 1024, 1024, 512, 77, 0x88251d4e, F=0x0
0, 1536, 1536, 512, 232, 0x3c31706f, F=0x0
0, 2048, 2048, 512, 245, 0x8195753f, F=0x0
0, 2560, 2560, 512, 271, 0x134f86cc, F=0x0
0, 3072, 3072, 512, 246, 0x04b777cf, F=0x0
0, 3584, 3584, 512, 143, 0x6cbd43a3, F=0x0
0, 4096, 4096, 512, 215, 0x88d66733, F=0x0
0, 4608, 4608, 512, 83, 0xb2d22362, F=0x0
0, 5120, 5120, 512, 50, 0x75d211e2, F=0x0
0, 5632, 5632, 512, 5087, 0x505ec5f3, F=0x0
0, 6144, 6144, 512, 242, 0x70fe6f2c, F=0x0
0, 6656, 6656, 512, 366, 0xcb0caedc, F=0x0
0, 7168, 7168, 512, 644, 0xf72e3623, F=0x0
0, 7680, 7680, 512, 668, 0x0cff4537, F=0x0
0, 8192, 8192, 512, 239, 0x364c77a4, F=0x0
0, 8704, 8704, 512, 400, 0x7e3bbaef, F=0x0
0, 9216, 9216, 512, 404, 0x175cb5db, F=0x0
0, 9728, 9728, 512, 277, 0x113185c5, F=0x0
0, 10240, 10240, 512, 46, 0x0c860cfa, F=0x0
0, 10752, 10752, 512, 659, 0x501b392a, F=0x0
0, 11264, 11264, 512, 478, 0x0503e8ec, F=0x0
0, 11776, 11776, 512, 1132, 0x952a1543, F=0x0