ffmpeg-cvslog
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
September 2025
- 1 participants
- 195 discussions
[ffmpeg] branch master updated. 8accbbdf9a avcodec/vvc/data: Mark tables as hidden
by ffmpeg-git@ffmpeg.org 17 Sep '25
by ffmpeg-git@ffmpeg.org 17 Sep '25
17 Sep '25
The branch, master has been updated
via 8accbbdf9a99a1999e7e0c19f6cc91085b3b1905 (commit)
from efd484cb2dc3e3aa0eaf1855535186ccde3dc97c (commit)
- Log -----------------------------------------------------------------
commit 8accbbdf9a99a1999e7e0c19f6cc91085b3b1905
Author: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
AuthorDate: Sat Sep 13 05:00:32 2025 +0200
Commit: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
CommitDate: Wed Sep 17 22:48:39 2025 +0200
avcodec/vvc/data: Mark tables as hidden
This allows compilers to optimize accesses like
ff_vvc_diag_scan_x[2][2][x] by baking the offset derived
from [2][2] into the relocation (so that it is performed
at link-time).
Reviewed-by: Wu Jianhua <toqsxw(a)outlook.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
diff --git a/libavcodec/vvc/data.h b/libavcodec/vvc/data.h
index a0512e626b..a28150484d 100644
--- a/libavcodec/vvc/data.h
+++ b/libavcodec/vvc/data.h
@@ -23,6 +23,9 @@
#include <stdint.h>
+#include "libavutil/attributes_internal.h"
+
+FF_VISIBILITY_PUSH_HIDDEN
extern const uint8_t ff_vvc_diag_scan_x[5][5][16 * 16];
extern const uint8_t ff_vvc_diag_scan_y[5][5][16 * 16];
@@ -80,5 +83,6 @@ extern const uint8_t ff_vvc_alf_class_to_filt_map[16][25];
extern const uint8_t ff_vvc_alf_aps_class_to_filt_map[25];
const uint8_t* ff_vvc_get_mip_matrix(const int size_id, const int mode_idx);
+FF_VISIBILITY_POP_HIDDEN
#endif /* AVCODEC_VVC_DATA_H */
-----------------------------------------------------------------------
Summary of changes:
libavcodec/vvc/data.h | 4 ++++
1 file changed, 4 insertions(+)
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. efd484cb2d avutil/hwcontext_d3d11va: remove D3D11_BIND_RENDER_TARGET restriction for array textures
by ffmpeg-git@ffmpeg.org 17 Sep '25
by ffmpeg-git@ffmpeg.org 17 Sep '25
17 Sep '25
The branch, master has been updated
via efd484cb2dc3e3aa0eaf1855535186ccde3dc97c (commit)
via 00ddb408c53c39b8462931a06b28f56bd64bf8af (commit)
from a0936b9769718f13662812eb9ea4ae377916c6a8 (commit)
- Log -----------------------------------------------------------------
commit efd484cb2dc3e3aa0eaf1855535186ccde3dc97c
Author: Timo Rothenpieler <timo(a)rothenpieler.org>
AuthorDate: Tue Sep 9 21:46:25 2025 +0200
Commit: Timo Rothenpieler <timo(a)rothenpieler.org>
CommitDate: Wed Sep 17 14:50:41 2025 +0000
avutil/hwcontext_d3d11va: remove D3D11_BIND_RENDER_TARGET restriction for array textures
This was added in 4f78711f9c28b11dae4e4b96be46b6b4925eb8c6, with the
commit message claiming that it's a Microsoft restriction that array
textures with ArraySize > 2 cannot be created with
D3D11_BIND_RENDER_TARGET.
I was unable to find any documentation or other references on that, and
a quick test also found it to not be the case. So this patch removes
that restriction.
This enables frame sources, like the d3d11 capture filters, to output
frames in an array texture, which is neccesary to pass those frames as
input to some hardware encoders.
diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c
index 9831f530c1..83414ad0d4 100644
--- a/libavutil/hwcontext_d3d11va.c
+++ b/libavutil/hwcontext_d3d11va.c
@@ -318,7 +318,7 @@ static int d3d11va_frames_init(AVHWFramesContext *ctx)
ctx->initial_pool_size = texDesc2.ArraySize;
hwctx->BindFlags = texDesc2.BindFlags;
hwctx->MiscFlags = texDesc2.MiscFlags;
- } else if (!(texDesc.BindFlags & D3D11_BIND_RENDER_TARGET) && texDesc.ArraySize > 0) {
+ } else if (texDesc.ArraySize > 0) {
hr = ID3D11Device_CreateTexture2D(device_hwctx->device, &texDesc, NULL, &hwctx->texture);
if (FAILED(hr)) {
av_log(ctx, AV_LOG_ERROR, "Could not create the texture (%lx)\n", (long)hr);
commit 00ddb408c53c39b8462931a06b28f56bd64bf8af
Author: Timo Rothenpieler <timo(a)rothenpieler.org>
AuthorDate: Tue Sep 9 20:08:22 2025 +0200
Commit: Timo Rothenpieler <timo(a)rothenpieler.org>
CommitDate: Wed Sep 17 14:50:41 2025 +0000
avfilter/vsrc_ddagrab: support rendering mouse cursor onto array textures
diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c
index 6533e2b66e..e035ac9bc4 100644
--- a/libavfilter/vsrc_ddagrab.c
+++ b/libavfilter/vsrc_ddagrab.c
@@ -818,6 +818,8 @@ static av_cold int init_hwframes_ctx(AVFilterContext *avctx)
dda->frames_ctx->format = AV_PIX_FMT_D3D11;
dda->frames_ctx->width = dda->width;
dda->frames_ctx->height = dda->height;
+ if (avctx->extra_hw_frames > 0)
+ dda->frames_ctx->initial_pool_size = 8 + avctx->extra_hw_frames;
switch (dda->raw_format) {
case DXGI_FORMAT_B8G8R8A8_UNORM:
@@ -936,7 +938,7 @@ static int draw_mouse_pointer(AVFilterContext *avctx, AVFrame *frame)
D3D11_RENDER_TARGET_VIEW_DESC target_desc = { 0 };
ID3D11RenderTargetView* target_view = NULL;
ID3D11Buffer *mouse_vertex_buffer = NULL;
- D3D11_TEXTURE2D_DESC tex_desc;
+ D3D11_TEXTURE2D_DESC tex_desc, frame_desc;
int num_vertices = 0;
int x, y;
HRESULT hr;
@@ -946,6 +948,7 @@ static int draw_mouse_pointer(AVFilterContext *avctx, AVFrame *frame)
return 0;
ID3D11Texture2D_GetDesc(dda->mouse_texture, &tex_desc);
+ ID3D11Texture2D_GetDesc(frame_tex, &frame_desc);
x = dda->mouse_x - dda->offset_x;
y = dda->mouse_y - dda->offset_y;
@@ -954,9 +957,17 @@ static int draw_mouse_pointer(AVFilterContext *avctx, AVFrame *frame)
-x >= (int)tex_desc.Width || -y >= (int)tex_desc.Height)
return 0;
- target_desc.Format = dda->raw_format;
- target_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
- target_desc.Texture2D.MipSlice = 0;
+ target_desc.Format = frame_desc.Format;
+
+ if (frame_desc.ArraySize > 1) {
+ target_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
+ target_desc.Texture2DArray.ArraySize = 1;
+ target_desc.Texture2DArray.FirstArraySlice = (uintptr_t)frame->data[1];
+ target_desc.Texture2DArray.MipSlice = 0;
+ } else {
+ target_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
+ target_desc.Texture2D.MipSlice = 0;
+ }
hr = ID3D11Device_CreateRenderTargetView(dda->device_hwctx->device,
(ID3D11Resource*)frame_tex,
-----------------------------------------------------------------------
Summary of changes:
libavfilter/vsrc_ddagrab.c | 19 +++++++++++++++----
libavutil/hwcontext_d3d11va.c | 2 +-
2 files changed, 16 insertions(+), 5 deletions(-)
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. a0936b9769 avcodec/vaapi_encode: skip AVBR if HRD parameters are set
by ffmpeg-git@ffmpeg.org 17 Sep '25
by ffmpeg-git@ffmpeg.org 17 Sep '25
17 Sep '25
The branch, master has been updated
via a0936b9769718f13662812eb9ea4ae377916c6a8 (commit)
from c6297b689f1a0ec28d45a9991bc02127e7a2abbd (commit)
- Log -----------------------------------------------------------------
commit a0936b9769718f13662812eb9ea4ae377916c6a8
Author: Cameron Gutman <aicommander(a)gmail.com>
AuthorDate: Tue Apr 1 23:11:20 2025 -0500
Commit: Tong Wu <wutong1208(a)outlook.com>
CommitDate: Wed Sep 17 06:40:16 2025 +0000
avcodec/vaapi_encode: skip AVBR if HRD parameters are set
AVBR does not use VAEncMiscParameterTypeHRD, so attempting to set
rc_buffer_size and bit_rate together will cause the rc_buffer_size
to be ignored if the VAAPI driver supports AVBR. We should prefer
regular VBR for that case.
Signed-off-by: Cameron Gutman <aicommander(a)gmail.com>
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 8960e6b20a..ed62347c06 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -1294,7 +1294,8 @@ static av_cold int vaapi_encode_init_rate_control(AVCodecContext *avctx)
// * If bitrate and quality are both set, try QVBR.
// * If quality is set, try ICQ, then CQP.
// * If bitrate and maxrate are set and have the same value, try CBR.
- // * If a bitrate is set, try AVBR, then VBR, then CBR.
+ // * If bitrate is set and RC buffer size/occupancy is not, try AVBR.
+ // * If a bitrate is set, try VBR, then CBR.
// * If no bitrate is set, try ICQ, then CQP.
#define TRY_RC_MODE(mode, fail) do { \
@@ -1338,7 +1339,10 @@ static av_cold int vaapi_encode_init_rate_control(AVCodecContext *avctx)
TRY_RC_MODE(RC_MODE_CBR, 0);
if (avctx->bit_rate > 0) {
- TRY_RC_MODE(RC_MODE_AVBR, 0);
+ // AVBR does not enforce RC buffer constraints
+ if (!avctx->rc_buffer_size && !avctx->rc_initial_buffer_occupancy)
+ TRY_RC_MODE(RC_MODE_AVBR, 0);
+
TRY_RC_MODE(RC_MODE_VBR, 0);
TRY_RC_MODE(RC_MODE_CBR, 0);
} else {
-----------------------------------------------------------------------
Summary of changes:
libavcodec/vaapi_encode.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. c6297b689f tests/fate/image: add Exif rotation metadata tests
by ffmpeg-git@ffmpeg.org 17 Sep '25
by ffmpeg-git@ffmpeg.org 17 Sep '25
17 Sep '25
The branch, master has been updated
via c6297b689f1a0ec28d45a9991bc02127e7a2abbd (commit)
via ca72b2d7123315c30296385871149bd1c78c2e9b (commit)
from 796b3ba63ba8eb0deba0248b30b10727920448ad (commit)
- Log -----------------------------------------------------------------
commit c6297b689f1a0ec28d45a9991bc02127e7a2abbd
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Mon Sep 15 00:21:39 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Wed Sep 17 02:17:09 2025 +0000
tests/fate/image: add Exif rotation metadata tests
Signed-off-by: James Almer <jamrial(a)gmail.com>
diff --git a/tests/fate/image.mak b/tests/fate/image.mak
index 98c4e0fdcc..3facd8aaa8 100644
--- a/tests/fate/image.mak
+++ b/tests/fate/image.mak
@@ -360,6 +360,13 @@ fate-jpg-rgb-5: CMD = framecrc -idct simple -i $(TARGET_SAMPLES)/jpg/jpg-8930-5.
FATE_JPG_TRANSCODE-$(call TRANSCODE, MJPEG, MJPEG IMAGE_JPEG_PIPE, IMAGE_PNG_PIPE_DEMUXER PNG_DECODER SCALE_FILTER) += fate-jpg-icc
fate-jpg-icc: CMD = transcode png_pipe $(TARGET_SAMPLES)/png1/lena-int_rgb24.png mjpeg "-vf scale" "" "-show_frames"
+FATE_JPG_TRANSCODE-$(call TRANSCODE, TIFF, IMAGE2 IMAGE_JPEG_PIPE, IMAGE_TIFF_PIPE_DEMUXER MJPEG_DECODER SCALE_FILTER) += fate-jpg-exif-autorotate fate-jpg-exif-rotation-override
+fate-jpg-exif-autorotate: CMD = transcode jpeg_pipe $(TARGET_SAMPLES)/jpg/Landscape_5.jpg image2 "-c:v tiff -vf scale" "" "-show_frames"
+fate-jpg-exif-rotation-override: CMD = transcode jpeg_pipe $(TARGET_SAMPLES)/jpg/Landscape_5.jpg image2 "-c:v tiff -vf scale" "" "-show_frames" "" "" "-noautorotate -display_rotation 0"
+
+FATE_JPG_TRANSCODE-$(call TRANSCODE, PNG, IMAGE2 IMAGE_JPEG_PIPE, IMAGE_PNG_PIPE_DEMUXER MJPEG_DECODER SCALE_FILTER) += fate-jpg-exif-noautorotate
+fate-jpg-exif-noautorotate: CMD = transcode jpeg_pipe $(TARGET_SAMPLES)/jpg/Landscape_5.jpg image2 "-c:v png -vf scale" "" "-show_frames" "" "-noautorotate" "-noautorotate"
+
FATE_JPG-$(call FRAMECRC, IMAGE2, MJPEG) += $(FATE_JPG)
FATE_IMAGE_FRAMECRC += $(FATE_JPG-yes)
FATE_IMAGE_TRANSCODE += $(FATE_JPG_TRANSCODE-yes)
diff --git a/tests/ref/fate/jpg-exif-autorotate b/tests/ref/fate/jpg-exif-autorotate
new file mode 100644
index 0000000000..07321ee336
--- /dev/null
+++ b/tests/ref/fate/jpg-exif-autorotate
@@ -0,0 +1,64 @@
+fb7725b8ccdfb537a600d9e16697078e *tests/data/fate/jpg-exif-autorotate.image2
+90658 tests/data/fate/jpg-exif-autorotate.image2
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 300x200
+#sar 0: 1/1
+0, 0, 0, 1, 90000, 0x458a544e
+[FRAME]
+media_type=video
+stream_index=0
+key_frame=1
+pts=0
+pts_time=0.000000
+pkt_dts=0
+pkt_dts_time=0.000000
+best_effort_timestamp=0
+best_effort_timestamp_time=0.000000
+duration=1
+duration_time=0.040000
+pkt_pos=0
+pkt_size=90658
+width=300
+height=200
+crop_top=0
+crop_bottom=0
+crop_left=0
+crop_right=0
+pix_fmt=yuv420p
+sample_aspect_ratio=1:1
+pict_type=I
+interlaced_frame=0
+top_field_first=0
+lossless=0
+repeat_pict=0
+color_range=unknown
+color_space=unknown
+color_primaries=unknown
+color_transfer=unknown
+chroma_location=unspecified
+alpha_mode=unspecified
+TAG:0x00FE= 0
+TAG:ImageWidth= 300
+TAG:ImageLength= 200
+TAG:BitsPerSample= 8, 8, 8
+TAG:Compression= 32773
+TAG:PhotometricInterpretation= 6
+TAG:StripOffsets= 8, 8085, 16195, 24339, 32486, 40643, 48791, 56934
+ 65084, 73197, 81294, 89409
+TAG:SamplesPerPixel= 3
+TAG:RowsPerStrip= 18
+TAG:StripByteCounts= 8077, 8110, 8144, 8147, 8157, 8148, 8143, 8150
+ 8113, 8097, 8115, 897
+TAG:XResolution= 72:1
+TAG:YResolution= 72:1
+TAG:ResolutionUnit= 2
+TAG:YCbCrSubSampling= 2, 2
+TAG:ReferenceBlackWhite= 15:1 , 235:1 , 128:1 , 240:1
+ 128:1 , 240:1
+[SIDE_DATA]
+side_data_type=EXIF metadata
+size=360
+[/SIDE_DATA]
+[/FRAME]
diff --git a/tests/ref/fate/jpg-exif-noautorotate b/tests/ref/fate/jpg-exif-noautorotate
new file mode 100644
index 0000000000..c18cdfff91
--- /dev/null
+++ b/tests/ref/fate/jpg-exif-noautorotate
@@ -0,0 +1,63 @@
+e3f1a70f55d680145fca061e4a515133 *tests/data/fate/jpg-exif-noautorotate.image2
+93327 tests/data/fate/jpg-exif-noautorotate.image2
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 200x300
+#sar 0: 1/1
+0, 0, 0, 1, 180000, 0x4c43539a
+[FRAME]
+media_type=video
+stream_index=0
+key_frame=1
+pts=0
+pts_time=0.000000
+pkt_dts=0
+pkt_dts_time=0.000000
+best_effort_timestamp=0
+best_effort_timestamp_time=0.000000
+duration=1
+duration_time=0.040000
+pkt_pos=0
+pkt_size=93327
+width=200
+height=300
+crop_top=0
+crop_bottom=0
+crop_left=0
+crop_right=0
+pix_fmt=rgb24
+sample_aspect_ratio=1:1
+pict_type=I
+interlaced_frame=0
+top_field_first=0
+lossless=0
+repeat_pict=0
+color_range=pc
+color_space=gbr
+color_primaries=unknown
+color_transfer=unknown
+chroma_location=unspecified
+alpha_mode=unspecified
+TAG:XResolution= 1:1
+TAG:YResolution= 1:1
+TAG:ResolutionUnit= 1
+TAG:YCbCrPositioning= 1
+TAG:ImageWidth= 200
+TAG:ImageLength= 300
+TAG:ExifIFD/PixelXDimension= 200
+TAG:ExifIFD/PixelYDimension= 300
+[SIDE_DATA]
+side_data_type=3x3 displaymatrix
+displaymatrix=
+00000000: 0 65536 0
+00000001: 65536 0 0
+00000002: 0 0 1073741824
+
+rotation=-90
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=EXIF metadata
+size=144
+[/SIDE_DATA]
+[/FRAME]
diff --git a/tests/ref/fate/jpg-exif-rotation-override b/tests/ref/fate/jpg-exif-rotation-override
new file mode 100644
index 0000000000..e76ffb727f
--- /dev/null
+++ b/tests/ref/fate/jpg-exif-rotation-override
@@ -0,0 +1,73 @@
+0fd5facf5235c64ddc984bbd83db6b89 *tests/data/fate/jpg-exif-rotation-override.image2
+90688 tests/data/fate/jpg-exif-rotation-override.image2
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 200x300
+#sar 0: 1/1
+0, 0, 0, 1, 90000, 0x157a544e
+[FRAME]
+media_type=video
+stream_index=0
+key_frame=1
+pts=0
+pts_time=0.000000
+pkt_dts=0
+pkt_dts_time=0.000000
+best_effort_timestamp=0
+best_effort_timestamp_time=0.000000
+duration=1
+duration_time=0.040000
+pkt_pos=0
+pkt_size=90688
+width=200
+height=300
+crop_top=0
+crop_bottom=0
+crop_left=0
+crop_right=0
+pix_fmt=yuv420p
+sample_aspect_ratio=1:1
+pict_type=I
+interlaced_frame=0
+top_field_first=0
+lossless=0
+repeat_pict=0
+color_range=unknown
+color_space=unknown
+color_primaries=unknown
+color_transfer=unknown
+chroma_location=unspecified
+alpha_mode=unspecified
+TAG:0x00FE= 0
+TAG:ImageWidth= 200
+TAG:ImageLength= 300
+TAG:BitsPerSample= 8, 8, 8
+TAG:Compression= 32773
+TAG:PhotometricInterpretation= 6
+TAG:StripOffsets= 8, 8464, 16902, 25347, 33787, 42187, 50628, 59079
+ 67494, 75928, 84353
+TAG:SamplesPerPixel= 3
+TAG:RowsPerStrip= 28
+TAG:StripByteCounts= 8456, 8438, 8445, 8440, 8400, 8441, 8451, 8415
+ 8434, 8425, 5979
+TAG:XResolution= 72:1
+TAG:YResolution= 72:1
+TAG:ResolutionUnit= 2
+TAG:YCbCrSubSampling= 2, 2
+TAG:ReferenceBlackWhite= 15:1 , 235:1 , 128:1 , 240:1
+ 128:1 , 240:1
+[SIDE_DATA]
+side_data_type=3x3 displaymatrix
+displaymatrix=
+00000000: 65536 0 0
+00000001: 0 65536 0
+00000002: 0 0 1073741824
+
+rotation=0
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=EXIF metadata
+size=352
+[/SIDE_DATA]
+[/FRAME]
commit ca72b2d7123315c30296385871149bd1c78c2e9b
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Mon Sep 15 18:10:04 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Wed Sep 17 02:17:09 2025 +0000
avcodec/tiffenc: support writing Orientation tag
Signed-off-by: James Almer <jamrial(a)gmail.com>
diff --git a/libavcodec/tiff.h b/libavcodec/tiff.h
index 12afcfa6e5..dc44eda015 100644
--- a/libavcodec/tiff.h
+++ b/libavcodec/tiff.h
@@ -54,6 +54,7 @@ enum TiffTags {
TIFF_MAKE = 0x10F,
TIFF_MODEL = 0x110,
TIFF_STRIP_OFFS = 0x111,
+ TIFF_ORIENTATION = 0x112,
TIFF_SAMPLES_PER_PIXEL = 0x115,
TIFF_ROWSPERSTRIP = 0x116,
TIFF_STRIP_SIZE,
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index 9a5291c257..1916db9a31 100644
--- a/libavcodec/tiffenc.c
+++ b/libavcodec/tiffenc.c
@@ -464,6 +464,13 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
ADD_ENTRY1(s, TIFF_PHOTOMETRIC, AV_TIFF_SHORT, s->photometric_interpretation);
ADD_ENTRY(s, TIFF_STRIP_OFFS, AV_TIFF_LONG, strips, s->strip_offsets);
+ AVFrameSideData *sd = av_frame_get_side_data(pict, AV_FRAME_DATA_DISPLAYMATRIX);
+ if (sd) {
+ int orientation = av_exif_matrix_to_orientation((int32_t *) sd->data);
+ if (orientation >= 1 && orientation <= 8)
+ ADD_ENTRY1(s, TIFF_ORIENTATION, AV_TIFF_SHORT, orientation);
+ }
+
if (s->bpp_tab_size)
ADD_ENTRY1(s, TIFF_SAMPLES_PER_PIXEL, AV_TIFF_SHORT, s->bpp_tab_size);
-----------------------------------------------------------------------
Summary of changes:
libavcodec/tiff.h | 1 +
libavcodec/tiffenc.c | 7 +++
tests/fate/image.mak | 7 +++
tests/ref/fate/jpg-exif-autorotate | 64 +++++++++++++++++++++++++++
tests/ref/fate/jpg-exif-noautorotate | 63 ++++++++++++++++++++++++++
tests/ref/fate/jpg-exif-rotation-override | 73 +++++++++++++++++++++++++++++++
6 files changed, 215 insertions(+)
create mode 100644 tests/ref/fate/jpg-exif-autorotate
create mode 100644 tests/ref/fate/jpg-exif-noautorotate
create mode 100644 tests/ref/fate/jpg-exif-rotation-override
hooks/post-receive
--
1
0
[ffmpeg] branch release/7.1 updated. ab05459692 avcodec/decode: sync initial_pict_type and intra_only_flag with thread worker's avctx
by ffmpeg-git@ffmpeg.org 16 Sep '25
by ffmpeg-git@ffmpeg.org 16 Sep '25
16 Sep '25
The branch, release/7.1 has been updated
via ab0545969279dc832d431500be11f61e3dadcf91 (commit)
from 8bb4f60459ec4663476be11cc0fe294d705fa7dd (commit)
- Log -----------------------------------------------------------------
commit ab0545969279dc832d431500be11f61e3dadcf91
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Tue Sep 16 13:56:18 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Tue Sep 16 15:56:16 2025 -0300
avcodec/decode: sync initial_pict_type and intra_only_flag with thread worker's avctx
Regression since 5acbdd2264d3b90dc11369f9e031e762f260882e, which removed
setting both values from PerThreadContext.
Given the pthread code calls ff_decode_receive_frame_internal() on the frame,
any value set before it will be overwritten, so instead sync each thread's
DecodeContext and let ff_decode_receive_frame_internal() handle these values.
Fixes issue #20534.
Signed-off-by: James Almer <jamrial(a)gmail.com>
(cherry picked from commit 26f4230082dad1a6a0f2384694037562f73bb2fd)
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 828013197c..d8d3bd4d11 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -2329,6 +2329,8 @@ void ff_decode_internal_sync(AVCodecContext *dst, const AVCodecContext *src)
const DecodeContext *src_dc = decode_ctx(src->internal);
DecodeContext *dst_dc = decode_ctx(dst->internal);
+ dst_dc->initial_pict_type = src_dc->initial_pict_type;
+ dst_dc->intra_only_flag = src_dc->intra_only_flag;
ff_refstruct_replace(&dst_dc->lcevc, src_dc->lcevc);
}
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 1b1b96623f..5b4b0b342c 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -115,10 +115,6 @@ typedef struct PerThreadContext {
int hwaccel_threadsafe;
atomic_int debug_threads; ///< Set if the FF_DEBUG_THREADS option is set.
-
- /// The following two fields have the same semantics as the DecodeContext field
- int intra_only_flag;
- enum AVPictureType initial_pict_type;
} PerThreadContext;
/**
@@ -821,13 +817,6 @@ static av_cold int init_thread(PerThreadContext *p, int *threads_to_free,
AVCodecContext *copy;
int err;
- p->initial_pict_type = AV_PICTURE_TYPE_NONE;
- if (avctx->codec_descriptor->props & AV_CODEC_PROP_INTRA_ONLY) {
- p->intra_only_flag = AV_FRAME_FLAG_KEY;
- if (avctx->codec_type == AVMEDIA_TYPE_VIDEO)
- p->initial_pict_type = AV_PICTURE_TYPE_I;
- }
-
atomic_init(&p->state, STATE_INPUT_READY);
copy = av_memdup(avctx, sizeof(*avctx));
-----------------------------------------------------------------------
Summary of changes:
libavcodec/decode.c | 2 ++
libavcodec/pthread_frame.c | 11 -----------
2 files changed, 2 insertions(+), 11 deletions(-)
hooks/post-receive
--
1
0
[ffmpeg] branch release/8.0 updated. e322e2e5d9 avcodec/decode: sync initial_pict_type and intra_only_flag with thread worker's avctx
by ffmpeg-git@ffmpeg.org 16 Sep '25
by ffmpeg-git@ffmpeg.org 16 Sep '25
16 Sep '25
The branch, release/8.0 has been updated
via e322e2e5d94100a2be0853033d6c124ec8249b78 (commit)
from 61c50407fd429a5e2ec616e2e846c3fe3743879a (commit)
- Log -----------------------------------------------------------------
commit e322e2e5d94100a2be0853033d6c124ec8249b78
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Tue Sep 16 13:56:18 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Tue Sep 16 15:55:22 2025 -0300
avcodec/decode: sync initial_pict_type and intra_only_flag with thread worker's avctx
Regression since 5acbdd2264d3b90dc11369f9e031e762f260882e, which removed
setting both values from PerThreadContext.
Given the pthread code calls ff_decode_receive_frame_internal() on the frame,
any value set before it will be overwritten, so instead sync each thread's
DecodeContext and let ff_decode_receive_frame_internal() handle these values.
Fixes issue #20534.
Signed-off-by: James Almer <jamrial(a)gmail.com>
(cherry picked from commit 26f4230082dad1a6a0f2384694037562f73bb2fd)
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 2319e76e4b..730d4f90fe 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -2235,6 +2235,8 @@ void ff_decode_internal_sync(AVCodecContext *dst, const AVCodecContext *src)
const DecodeContext *src_dc = decode_ctx(src->internal);
DecodeContext *dst_dc = decode_ctx(dst->internal);
+ dst_dc->initial_pict_type = src_dc->initial_pict_type;
+ dst_dc->intra_only_flag = src_dc->intra_only_flag;
av_refstruct_replace(&dst_dc->lcevc, src_dc->lcevc);
}
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 4ea5dd3698..abf0d5a199 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -115,10 +115,6 @@ typedef struct PerThreadContext {
int hwaccel_threadsafe;
atomic_int debug_threads; ///< Set if the FF_DEBUG_THREADS option is set.
-
- /// The following two fields have the same semantics as the DecodeContext field
- int intra_only_flag;
- enum AVPictureType initial_pict_type;
} PerThreadContext;
/**
@@ -820,13 +816,6 @@ static av_cold int init_thread(PerThreadContext *p, int *threads_to_free,
AVCodecContext *copy;
int err;
- p->initial_pict_type = AV_PICTURE_TYPE_NONE;
- if (avctx->codec_descriptor->props & AV_CODEC_PROP_INTRA_ONLY) {
- p->intra_only_flag = AV_FRAME_FLAG_KEY;
- if (avctx->codec_type == AVMEDIA_TYPE_VIDEO)
- p->initial_pict_type = AV_PICTURE_TYPE_I;
- }
-
atomic_init(&p->state, STATE_INPUT_READY);
copy = av_memdup(avctx, sizeof(*avctx));
-----------------------------------------------------------------------
Summary of changes:
libavcodec/decode.c | 2 ++
libavcodec/pthread_frame.c | 11 -----------
2 files changed, 2 insertions(+), 11 deletions(-)
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. 796b3ba63b tests/fate/prores: add a probe test
by ffmpeg-git@ffmpeg.org 16 Sep '25
by ffmpeg-git@ffmpeg.org 16 Sep '25
16 Sep '25
The branch, master has been updated
via 796b3ba63ba8eb0deba0248b30b10727920448ad (commit)
via e0ddb4ac828e065f4bd77c7bdb9e28c56bee952b (commit)
via fdb5f709b77bd1ee0136d8afa354cd8c683ae494 (commit)
via 26f4230082dad1a6a0f2384694037562f73bb2fd (commit)
from f47b270b415d988437ae9eec56a761a8caf73d03 (commit)
- Log -----------------------------------------------------------------
commit 796b3ba63ba8eb0deba0248b30b10727920448ad
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Tue Sep 16 14:44:18 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Tue Sep 16 15:42:03 2025 -0300
tests/fate/prores: add a probe test
Signed-off-by: James Almer <jamrial(a)gmail.com>
diff --git a/tests/fate/prores.mak b/tests/fate/prores.mak
index 612be1a061..e3759dfb50 100644
--- a/tests/fate/prores.mak
+++ b/tests/fate/prores.mak
@@ -25,4 +25,7 @@ fate-prores-gray: CMD = framecrc -flags +bitexact -c:a aac_fixed -i $(TARGE
FATE_PRORES_METADATA_BSF += fate-prores-metadata
fate-prores-metadata: CMD = md5 -i $(TARGET_SAMPLES)/prores/Sequence_1-Apple_ProRes_422_Proxy.mov -c:v copy -bsf:v prores_metadata=color_primaries=bt470bg:color_trc=bt709:colorspace=smpte170m -bitexact -f mov
+FATE_SAMPLES_FFMPEG_FFPROBE-$(call FRAMECRC, MOV, PRORES,) += fate-prores-probe
+fate-prores-probe: CMD = stream_demux mov $(TARGET_SAMPLES)/prores/Sequence_1-Apple_ProRes_422_HQ.mov "" "-c:v copy" "-show_frames"
+
FATE_SAMPLES_FFMPEG-$(call DEMMUX, MOV, MOV, PRORES_METADATA_BSF) += $(FATE_PRORES_METADATA_BSF)
diff --git a/tests/ref/fate/prores-probe b/tests/ref/fate/prores-probe
new file mode 100644
index 0000000000..8a7808f393
--- /dev/null
+++ b/tests/ref/fate/prores-probe
@@ -0,0 +1,75 @@
+#tb 0: 1/2997
+#media_type 0: video
+#codec_id 0: prores
+#dimensions 0: 1920x1080
+#sar 0: 0/1
+0, 0, 0, 100, 91824, 0x90ea4134
+0, 100, 100, 100, 91824, 0x90ea4134
+[FRAME]
+media_type=video
+stream_index=0
+key_frame=1
+pts=0
+pts_time=0.000000
+pkt_dts=0
+pkt_dts_time=0.000000
+best_effort_timestamp=0
+best_effort_timestamp_time=0.000000
+duration=100
+duration_time=0.033367
+pkt_pos=36
+pkt_size=91824
+width=1920
+height=1080
+crop_top=0
+crop_bottom=0
+crop_left=0
+crop_right=0
+pix_fmt=yuv422p10
+sample_aspect_ratio=N/A
+pict_type=I
+interlaced_frame=1
+top_field_first=0
+lossless=0
+repeat_pict=0
+color_range=tv
+color_space=bt709
+color_primaries=unknown
+color_transfer=unknown
+chroma_location=unspecified
+alpha_mode=unspecified
+[/FRAME]
+[FRAME]
+media_type=video
+stream_index=0
+key_frame=1
+pts=100
+pts_time=0.033367
+pkt_dts=100
+pkt_dts_time=0.033367
+best_effort_timestamp=100
+best_effort_timestamp_time=0.033367
+duration=100
+duration_time=0.033367
+pkt_pos=91860
+pkt_size=91824
+width=1920
+height=1080
+crop_top=0
+crop_bottom=0
+crop_left=0
+crop_right=0
+pix_fmt=yuv422p10
+sample_aspect_ratio=N/A
+pict_type=I
+interlaced_frame=1
+top_field_first=0
+lossless=0
+repeat_pict=0
+color_range=tv
+color_space=bt709
+color_primaries=unknown
+color_transfer=unknown
+chroma_location=unspecified
+alpha_mode=unspecified
+[/FRAME]
commit e0ddb4ac828e065f4bd77c7bdb9e28c56bee952b
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Tue Sep 16 14:43:34 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Tue Sep 16 15:42:03 2025 -0300
tests/fate-run: pass threads argument to ffprobe
Ensures it honors the THREADS variable if set to anything other than 1, which will be
useful to detect bugs.
Signed-off-by: James Almer <jamrial(a)gmail.com>
diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index 247f4e461b..6d1fe1185c 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -95,19 +95,19 @@ runecho(){
}
probefmt(){
- run ffprobe${PROGSUF}${EXECSUF} -bitexact -show_entries format=format_name -print_format default=nw=1:nk=1 "$@"
+ run ffprobe${PROGSUF}${EXECSUF} -bitexact -threads $threads -show_entries format=format_name -print_format default=nw=1:nk=1 "$@"
}
probecodec(){
- run ffprobe${PROGSUF}${EXECSUF} -bitexact -show_entries stream=codec_name -print_format default=nw=1:nk=1 "$@"
+ run ffprobe${PROGSUF}${EXECSUF} -bitexact -threads $threads -show_entries stream=codec_name -print_format default=nw=1:nk=1 "$@"
}
probeaudiostream(){
- run ffprobe${PROGSUF}${EXECSUF} -bitexact -show_entries stream=codec_name,codec_time_base,sample_fmt,channels,channel_layout:side_data "$@"
+ run ffprobe${PROGSUF}${EXECSUF} -bitexact -threads $threads -show_entries stream=codec_name,codec_time_base,sample_fmt,channels,channel_layout:side_data "$@"
}
probetags(){
- run ffprobe${PROGSUF}${EXECSUF} -bitexact -show_entries format_tags "$@"
+ run ffprobe${PROGSUF}${EXECSUF} -bitexact -threads $threads -show_entries format_tags "$@"
}
runlocal(){
@@ -116,28 +116,28 @@ runlocal(){
}
probeframes(){
- run ffprobe${PROGSUF}${EXECSUF} -bitexact -show_frames "$@"
+ run ffprobe${PROGSUF}${EXECSUF} -bitexact -threads $threads -show_frames "$@"
}
probechapters(){
- run ffprobe${PROGSUF}${EXECSUF} -bitexact -show_chapters "$@"
+ run ffprobe${PROGSUF}${EXECSUF} -bitexact -threads $threads -show_chapters "$@"
}
probe(){
- run ffprobe${PROGSUF}${EXECSUF} -bitexact "$@"
+ run ffprobe${PROGSUF}${EXECSUF} -bitexact -threads $threads "$@"
}
probegaplessinfo(){
filename="$1"
shift
- run ffprobe${PROGSUF}${EXECSUF} -bitexact -select_streams a -show_entries format=start_time,duration:stream=index,start_pts,duration_ts "$filename" "$@"
+ run ffprobe${PROGSUF}${EXECSUF} -bitexact -threads $threads -select_streams a -show_entries format=start_time,duration:stream=index,start_pts,duration_ts "$filename" "$@"
pktfile1="${outdir}/${test}.pkts"
framefile1="${outdir}/${test}.frames"
cleanfiles="$cleanfiles $pktfile1 $framefile1"
- run ffprobe${PROGSUF}${EXECSUF} -bitexact -select_streams a -of compact -count_packets -show_entries packet=pts,dts,duration,flags:stream=nb_read_packets "$filename" "$@" > "$pktfile1"
+ run ffprobe${PROGSUF}${EXECSUF} -bitexact -threads $threads -select_streams a -of compact -count_packets -show_entries packet=pts,dts,duration,flags:stream=nb_read_packets "$filename" "$@" > "$pktfile1"
head -n 8 "$pktfile1"
tail -n 9 "$pktfile1"
- run ffprobe${PROGSUF}${EXECSUF} -bitexact -select_streams a -of compact -count_frames -show_entries frame=pts,pkt_dts,best_effort_timestamp,pkt_duration,nb_samples:stream=nb_read_frames "$filename" "$@" > "$framefile1"
+ run ffprobe${PROGSUF}${EXECSUF} -bitexact -threads $threads -select_streams a -of compact -count_frames -show_entries frame=pts,pkt_dts,best_effort_timestamp,pkt_duration,nb_samples:stream=nb_read_frames "$filename" "$@" > "$framefile1"
head -n 8 "$framefile1"
tail -n 9 "$framefile1"
}
@@ -157,7 +157,7 @@ ffprobe_demux(){
shift
print_filename=$(basename "$filename")
run ffprobe${PROGSUF}${EXECSUF} -print_filename "${print_filename}" \
- -of compact -bitexact -show_format -show_streams -show_packets \
+ -of compact -bitexact -threads $threads -show_format -show_streams -show_packets \
-show_data_hash CRC32 "$filename" "$@"
}
@@ -253,7 +253,7 @@ enc_dec(){
do_md5sum $decfile
tests/tiny_psnr${HOSTEXECSUF} $srcfile $decfile $cmp_unit $cmp_shift
test -z "$ffprobe_opts" || \
- run ffprobe${PROGSUF}${EXECSUF} -bitexact $ffprobe_opts $tencfile || return
+ run ffprobe${PROGSUF}${EXECSUF} -bitexact -threads $threads $ffprobe_opts $tencfile || return
}
transcode(){
@@ -280,7 +280,7 @@ transcode(){
ffmpeg $DEC_OPTS $final_decode -i $tencfile $ENC_OPTS $FLAGS $final_encode \
-f $final_encode_muxer - || return
test -z "$ffprobe_opts" || \
- run ffprobe${PROGSUF}${EXECSUF} -bitexact $ffprobe_opts $tencfile || return
+ run ffprobe${PROGSUF}${EXECSUF} -bitexact -threads $threads $ffprobe_opts $tencfile || return
}
stream_demux(){
@@ -293,7 +293,7 @@ stream_demux(){
ffmpeg $DEC_OPTS -f $src_fmt $src_opts -i $tsrcfile $ENC_OPTS $FLAGS $enc_opts \
-f framecrc - || return
test -z "$ffprobe_opts" || \
- run ffprobe${PROGSUF}${EXECSUF} -bitexact $ffprobe_opts $tsrcfile || return
+ run ffprobe${PROGSUF}${EXECSUF} -bitexact -threads $threads $ffprobe_opts $tsrcfile || return
}
stream_remux(){
@@ -314,7 +314,7 @@ stream_remux(){
ffmpeg $DEC_OPTS $final_decode -i $tencfile $ENC_OPTS $FLAGS $final_encode \
-f framecrc - || return
test -z "$ffprobe_opts" || \
- run ffprobe${PROGSUF}${EXECSUF} -bitexact $ffprobe_opts $tencfile || return
+ run ffprobe${PROGSUF}${EXECSUF} -bitexact -threads $threads $ffprobe_opts $tencfile || return
}
# this function is for testing external encoders,
@@ -331,7 +331,7 @@ enc_external(){
test "$keep" -ge 1 || cleanfiles="$cleanfiles $encfile"
ffmpeg -i $srcfile $enc_opt -f $enc_fmt -y $encfile || return
- run ffprobe${PROGSUF}${EXECSUF} -bitexact $probe_opt $encfile || return
+ run ffprobe${PROGSUF}${EXECSUF} -bitexact -threads $threads $probe_opt $encfile || return
}
# FIXME: There is a certain duplication between the avconv-related helper
@@ -656,10 +656,10 @@ concat(){
awk "{gsub(/%SRCFILE%/, \"$sample\"); print}" $template > $concatfile
if [ "$mode" = "md5" ]; then
- run ffprobe${PROGSUF}${EXECSUF} -bitexact -show_streams -show_packets -safe 0 $extra_args $(target_path $concatfile) | tr -d '\r' > $packetfile
+ run ffprobe${PROGSUF}${EXECSUF} -bitexact -threads $threads -show_streams -show_packets -safe 0 $extra_args $(target_path $concatfile) | tr -d '\r' > $packetfile
do_md5sum $packetfile
else
- run ffprobe${PROGSUF}${EXECSUF} -bitexact -show_streams -show_packets -of compact=p=0:nk=1 -safe 0 $extra_args $(target_path $concatfile)
+ run ffprobe${PROGSUF}${EXECSUF} -bitexact -threads $threads -show_streams -show_packets -of compact=p=0:nk=1 -safe 0 $extra_args $(target_path $concatfile)
fi
}
commit fdb5f709b77bd1ee0136d8afa354cd8c683ae494
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Tue Sep 16 14:41:37 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Tue Sep 16 15:42:03 2025 -0300
avcodec/h2645_sei: add missing ambient_viewing_environment copy in ff_h2645_sei_ctx_replace()
Signed-off-by: James Almer <jamrial(a)gmail.com>
diff --git a/libavcodec/h2645_sei.c b/libavcodec/h2645_sei.c
index 04432b6a8d..f3ce3da9eb 100644
--- a/libavcodec/h2645_sei.c
+++ b/libavcodec/h2645_sei.c
@@ -539,6 +539,7 @@ int ff_h2645_sei_ctx_replace(H2645SEI *dst, const H2645SEI *src)
}
dst->aom_film_grain.enable = src->aom_film_grain.enable;
+ dst->ambient_viewing_environment = src->ambient_viewing_environment;
dst->mastering_display = src->mastering_display;
dst->content_light = src->content_light;
commit 26f4230082dad1a6a0f2384694037562f73bb2fd
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Tue Sep 16 13:56:18 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Tue Sep 16 15:41:50 2025 -0300
avcodec/decode: sync initial_pict_type and intra_only_flag with thread worker's avctx
Regression since 5acbdd2264d3b90dc11369f9e031e762f260882e, which removed
setting both values from PerThreadContext.
Given the pthread code calls ff_decode_receive_frame_internal() on the frame,
any value set before it will be overwritten, so instead sync each thread's
DecodeContext and let ff_decode_receive_frame_internal() handle these values.
Fixes issue #20534.
Signed-off-by: James Almer <jamrial(a)gmail.com>
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index ae86e270df..d8e523f327 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -2320,6 +2320,8 @@ void ff_decode_internal_sync(AVCodecContext *dst, const AVCodecContext *src)
const DecodeContext *src_dc = decode_ctx(src->internal);
DecodeContext *dst_dc = decode_ctx(dst->internal);
+ dst_dc->initial_pict_type = src_dc->initial_pict_type;
+ dst_dc->intra_only_flag = src_dc->intra_only_flag;
av_refstruct_replace(&dst_dc->lcevc, src_dc->lcevc);
}
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 4ea5dd3698..abf0d5a199 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -115,10 +115,6 @@ typedef struct PerThreadContext {
int hwaccel_threadsafe;
atomic_int debug_threads; ///< Set if the FF_DEBUG_THREADS option is set.
-
- /// The following two fields have the same semantics as the DecodeContext field
- int intra_only_flag;
- enum AVPictureType initial_pict_type;
} PerThreadContext;
/**
@@ -820,13 +816,6 @@ static av_cold int init_thread(PerThreadContext *p, int *threads_to_free,
AVCodecContext *copy;
int err;
- p->initial_pict_type = AV_PICTURE_TYPE_NONE;
- if (avctx->codec_descriptor->props & AV_CODEC_PROP_INTRA_ONLY) {
- p->intra_only_flag = AV_FRAME_FLAG_KEY;
- if (avctx->codec_type == AVMEDIA_TYPE_VIDEO)
- p->initial_pict_type = AV_PICTURE_TYPE_I;
- }
-
atomic_init(&p->state, STATE_INPUT_READY);
copy = av_memdup(avctx, sizeof(*avctx));
-----------------------------------------------------------------------
Summary of changes:
libavcodec/decode.c | 2 ++
libavcodec/h2645_sei.c | 1 +
libavcodec/pthread_frame.c | 11 -------
tests/fate-run.sh | 36 +++++++++++-----------
tests/fate/prores.mak | 3 ++
tests/ref/fate/prores-probe | 75 +++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 99 insertions(+), 29 deletions(-)
create mode 100644 tests/ref/fate/prores-probe
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. f47b270b41 avfilter/vf_colordetect: Move ff_color_detect_dsp_init() out of .c file
by ffmpeg-git@ffmpeg.org 16 Sep '25
by ffmpeg-git@ffmpeg.org 16 Sep '25
16 Sep '25
The branch, master has been updated
via f47b270b415d988437ae9eec56a761a8caf73d03 (commit)
via fe0a31329931e0771814b5dbc093f0604986adae (commit)
via a35c91dc14e5b4d3e724a5d9656f46b6b5298fef (commit)
from b8256b82f5341d9ae5774f77779507db09f97b96 (commit)
- Log -----------------------------------------------------------------
commit f47b270b415d988437ae9eec56a761a8caf73d03
Author: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
AuthorDate: Mon Sep 15 19:33:41 2025 +0200
Commit: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
CommitDate: Tue Sep 16 18:23:52 2025 +0200
avfilter/vf_colordetect: Move ff_color_detect_dsp_init() out of .c file
Otherwise checkasm pulls in vf_colordetect.o and then all of
libavfilter.
Reviewed-by: Martin Storsjö <martin(a)martin.st>
Reviewed-by: Niklas Haas <ffmpeg(a)haasn.dev>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
diff --git a/libavfilter/vf_colordetect.c b/libavfilter/vf_colordetect.c
index ee4288c839..14b75b72ce 100644
--- a/libavfilter/vf_colordetect.c
+++ b/libavfilter/vf_colordetect.c
@@ -233,23 +233,6 @@ static av_cold void uninit(AVFilterContext *ctx)
}
}
-av_cold void ff_color_detect_dsp_init(FFColorDetectDSPContext *dsp, int depth,
- enum AVColorRange color_range)
-{
- dsp->detect_range = depth > 8 ? ff_detect_range16_c : ff_detect_range_c;
- if (color_range == AVCOL_RANGE_JPEG) {
- dsp->detect_alpha = depth > 8 ? ff_detect_alpha16_full_c : ff_detect_alpha_full_c;
- } else {
- dsp->detect_alpha = depth > 8 ? ff_detect_alpha16_limited_c : ff_detect_alpha_limited_c;
- }
-
-#if ARCH_AARCH64
- ff_color_detect_dsp_init_aarch64(dsp, depth, color_range);
-#elif ARCH_X86
- ff_color_detect_dsp_init_x86(dsp, depth, color_range);
-#endif
-}
-
static const AVFilterPad colordetect_inputs[] = {
{
.name = "default",
diff --git a/libavfilter/vf_colordetectdsp.h b/libavfilter/vf_colordetectdsp.h
index 2ce3d061a3..7a57e7aa73 100644
--- a/libavfilter/vf_colordetectdsp.h
+++ b/libavfilter/vf_colordetectdsp.h
@@ -22,6 +22,9 @@
#include <stddef.h>
#include <stdint.h>
+#include "config.h"
+
+#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "libavutil/pixfmt.h"
@@ -46,9 +49,6 @@ typedef struct FFColorDetectDSPContext {
int alpha_max, int mpeg_range, int offset);
} FFColorDetectDSPContext;
-void ff_color_detect_dsp_init(FFColorDetectDSPContext *dsp, int depth,
- enum AVColorRange color_range);
-
void ff_color_detect_dsp_init_aarch64(FFColorDetectDSPContext *dsp, int depth,
enum AVColorRange color_range);
void ff_color_detect_dsp_init_x86(FFColorDetectDSPContext *dsp, int depth,
@@ -195,4 +195,22 @@ ff_detect_alpha16_limited_c(const uint8_t *color, ptrdiff_t color_stride,
return transparent ? FF_ALPHA_TRANSPARENT : 0;
}
+static av_cold inline void
+ff_color_detect_dsp_init(FFColorDetectDSPContext *dsp, int depth,
+ enum AVColorRange color_range)
+{
+ dsp->detect_range = depth > 8 ? ff_detect_range16_c : ff_detect_range_c;
+ if (color_range == AVCOL_RANGE_JPEG) {
+ dsp->detect_alpha = depth > 8 ? ff_detect_alpha16_full_c : ff_detect_alpha_full_c;
+ } else {
+ dsp->detect_alpha = depth > 8 ? ff_detect_alpha16_limited_c : ff_detect_alpha_limited_c;
+ }
+
+#if ARCH_AARCH64
+ ff_color_detect_dsp_init_aarch64(dsp, depth, color_range);
+#elif ARCH_X86
+ ff_color_detect_dsp_init_x86(dsp, depth, color_range);
+#endif
+}
+
#endif /* AVFILTER_COLORDETECTDSP_H */
commit fe0a31329931e0771814b5dbc093f0604986adae
Author: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
AuthorDate: Mon Sep 15 19:14:39 2025 +0200
Commit: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
CommitDate: Tue Sep 16 18:23:45 2025 +0200
avfilter/vf_colordetect: Avoid sequentially consistent atomics
Reviewed-by: Martin Storsjö <martin(a)martin.st>
Reviewed-by: Niklas Haas <ffmpeg(a)haasn.dev>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
diff --git a/libavfilter/vf_colordetect.c b/libavfilter/vf_colordetect.c
index 7abe6659a3..ee4288c839 100644
--- a/libavfilter/vf_colordetect.c
+++ b/libavfilter/vf_colordetect.c
@@ -138,7 +138,8 @@ static int detect_range(AVFilterContext *ctx, void *arg,
if (s->dsp.detect_range(in->data[0] + y_start * stride, stride,
in->width, h_slice, s->mpeg_min, s->mpeg_max))
- atomic_store(&s->detected_range, AVCOL_RANGE_JPEG);
+ atomic_store_explicit(&s->detected_range, AVCOL_RANGE_JPEG,
+ memory_order_relaxed);
return 0;
}
@@ -194,11 +195,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
ColorDetectContext *s = ctx->priv;
const int nb_threads = FFMIN(inlink->h, s->nb_threads);
- if (s->mode & COLOR_DETECT_COLOR_RANGE && s->detected_range == AVCOL_RANGE_UNSPECIFIED)
+ enum AVColorRange detected_range = atomic_load_explicit(&s->detected_range, memory_order_relaxed);
+ if (s->mode & COLOR_DETECT_COLOR_RANGE && detected_range == AVCOL_RANGE_UNSPECIFIED)
ff_filter_execute(ctx, detect_range, in, NULL, nb_threads);
- if (s->mode & COLOR_DETECT_ALPHA_MODE && s->detected_alpha != FF_ALPHA_NONE &&
- s->detected_alpha != FF_ALPHA_STRAIGHT)
+ enum FFAlphaDetect detected_alpha = atomic_load_explicit(&s->detected_alpha, memory_order_relaxed);
+ if (s->mode & COLOR_DETECT_ALPHA_MODE && detected_alpha != FF_ALPHA_NONE &&
+ detected_alpha != FF_ALPHA_STRAIGHT)
ff_filter_execute(ctx, detect_alpha, in, NULL, nb_threads);
return ff_filter_frame(inlink->dst->outputs[0], in);
@@ -212,17 +215,21 @@ static av_cold void uninit(AVFilterContext *ctx)
av_log(ctx, AV_LOG_INFO, "Detected color properties:\n");
if (s->mode & COLOR_DETECT_COLOR_RANGE) {
+ enum AVColorRange detected_range = atomic_load_explicit(&s->detected_range,
+ memory_order_relaxed);
av_log(ctx, AV_LOG_INFO, " Color range: %s\n",
- s->detected_range == AVCOL_RANGE_JPEG ? "JPEG / full range"
- : "undetermined");
+ detected_range == AVCOL_RANGE_JPEG ? "JPEG / full range"
+ : "undetermined");
}
if (s->mode & COLOR_DETECT_ALPHA_MODE) {
+ enum FFAlphaDetect detected_alpha = atomic_load_explicit(&s->detected_alpha,
+ memory_order_relaxed);
av_log(ctx, AV_LOG_INFO, " Alpha mode: %s\n",
- s->detected_alpha == FF_ALPHA_NONE ? "none" :
- s->detected_alpha == FF_ALPHA_STRAIGHT ? "straight" :
- s->detected_alpha == FF_ALPHA_TRANSPARENT ? "undetermined"
- : "opaque");
+ detected_alpha == FF_ALPHA_NONE ? "none" :
+ detected_alpha == FF_ALPHA_STRAIGHT ? "straight" :
+ detected_alpha == FF_ALPHA_TRANSPARENT ? "undetermined"
+ : "opaque");
}
}
commit a35c91dc14e5b4d3e724a5d9656f46b6b5298fef
Author: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
AuthorDate: Mon Sep 15 18:45:24 2025 +0200
Commit: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
CommitDate: Tue Sep 16 18:22:24 2025 +0200
avfilter/vf_colordetect: Rename header to vf_colordetectdsp.h
It is more in line with our naming conventions.
Reviewed-by: Martin Storsjö <martin(a)martin.st>
Reviewed-by: Niklas Haas <ffmpeg(a)haasn.dev>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
diff --git a/libavfilter/aarch64/vf_colordetect_init.c b/libavfilter/aarch64/vf_colordetect_init.c
index 4db6b90542..2fd23513e3 100644
--- a/libavfilter/aarch64/vf_colordetect_init.c
+++ b/libavfilter/aarch64/vf_colordetect_init.c
@@ -19,7 +19,7 @@
*/
#include "libavutil/aarch64/cpu.h"
-#include "libavfilter/vf_colordetect.h"
+#include "libavfilter/vf_colordetectdsp.h"
int ff_detect_alpha_full_neon(const uint8_t *color, ptrdiff_t color_stride,
const uint8_t *alpha, ptrdiff_t alpha_stride,
diff --git a/libavfilter/vf_colordetect.c b/libavfilter/vf_colordetect.c
index ef7fb25130..7abe6659a3 100644
--- a/libavfilter/vf_colordetect.c
+++ b/libavfilter/vf_colordetect.c
@@ -37,7 +37,7 @@
#include "formats.h"
#include "video.h"
-#include "vf_colordetect.h"
+#include "vf_colordetectdsp.h"
enum ColorDetectMode {
COLOR_DETECT_COLOR_RANGE = 1 << 0,
diff --git a/libavfilter/vf_colordetect.h b/libavfilter/vf_colordetectdsp.h
similarity index 98%
rename from libavfilter/vf_colordetect.h
rename to libavfilter/vf_colordetectdsp.h
index aa974bb1fd..2ce3d061a3 100644
--- a/libavfilter/vf_colordetect.h
+++ b/libavfilter/vf_colordetectdsp.h
@@ -16,8 +16,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef AVFILTER_COLORDETECT_H
-#define AVFILTER_COLORDETECT_H
+#ifndef AVFILTER_COLORDETECTDSP_H
+#define AVFILTER_COLORDETECTDSP_H
#include <stddef.h>
#include <stdint.h>
@@ -195,4 +195,4 @@ ff_detect_alpha16_limited_c(const uint8_t *color, ptrdiff_t color_stride,
return transparent ? FF_ALPHA_TRANSPARENT : 0;
}
-#endif /* AVFILTER_COLORDETECT_H */
+#endif /* AVFILTER_COLORDETECTDSP_H */
diff --git a/libavfilter/x86/vf_colordetect_init.c b/libavfilter/x86/vf_colordetect_init.c
index 72fa021bf2..7257b5c4f5 100644
--- a/libavfilter/x86/vf_colordetect_init.c
+++ b/libavfilter/x86/vf_colordetect_init.c
@@ -20,7 +20,7 @@
#include "libavutil/attributes.h"
#include "libavutil/x86/cpu.h"
-#include "libavfilter/vf_colordetect.h"
+#include "libavfilter/vf_colordetectdsp.h"
#define DETECT_RANGE_FUNC(FUNC_NAME, ASM_FUNC_NAME, C_FUNC_NAME, SHIFT, MMSIZE) \
int ASM_FUNC_NAME(const uint8_t *src, ptrdiff_t stride, \
diff --git a/tests/checkasm/vf_colordetect.c b/tests/checkasm/vf_colordetect.c
index 18472e9b66..471f77fcc7 100644
--- a/tests/checkasm/vf_colordetect.c
+++ b/tests/checkasm/vf_colordetect.c
@@ -19,7 +19,7 @@
#include <string.h>
#include "checkasm.h"
-#include "libavfilter/vf_colordetect.h"
+#include "libavfilter/vf_colordetectdsp.h"
#include "libavutil/mem_internal.h"
#define WIDTH 540
-----------------------------------------------------------------------
Summary of changes:
libavfilter/aarch64/vf_colordetect_init.c | 2 +-
libavfilter/vf_colordetect.c | 46 +++++++++-------------
.../{vf_colordetect.h => vf_colordetectdsp.h} | 30 +++++++++++---
libavfilter/x86/vf_colordetect_init.c | 2 +-
tests/checkasm/vf_colordetect.c | 2 +-
5 files changed, 45 insertions(+), 37 deletions(-)
rename libavfilter/{vf_colordetect.h => vf_colordetectdsp.h} (89%)
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. b8256b82f5 avfilter/vsrc_gfxcapture: remove needless use of atomics
by ffmpeg-git@ffmpeg.org 16 Sep '25
by ffmpeg-git@ffmpeg.org 16 Sep '25
16 Sep '25
The branch, master has been updated
via b8256b82f5341d9ae5774f77779507db09f97b96 (commit)
via 61378d6b911d30ef7ec095bcbb25b243ea07673c (commit)
from af35a13f6d269a2400fd36ecc70b74ea2da1f1a8 (commit)
- Log -----------------------------------------------------------------
commit b8256b82f5341d9ae5774f77779507db09f97b96
Author: Timo Rothenpieler <timo(a)rothenpieler.org>
AuthorDate: Tue Sep 16 15:32:10 2025 +0200
Commit: Timo Rothenpieler <timo(a)rothenpieler.org>
CommitDate: Tue Sep 16 15:52:11 2025 +0000
avfilter/vsrc_gfxcapture: remove needless use of atomics
diff --git a/libavfilter/vsrc_gfxcapture_winrt.cpp b/libavfilter/vsrc_gfxcapture_winrt.cpp
index 0849380b3a..9562863d7f 100644
--- a/libavfilter/vsrc_gfxcapture_winrt.cpp
+++ b/libavfilter/vsrc_gfxcapture_winrt.cpp
@@ -47,7 +47,6 @@ extern "C" {
#include "vsrc_gfxcapture.h"
}
-#include <atomic>
#include <cinttypes>
#include <condition_variable>
#include <cwchar>
@@ -709,21 +708,19 @@ static int run_on_wgc_thread(AVFilterContext *avctx, F &&cb)
struct CBData {
std::mutex mutex;
std::condition_variable cond;
- std::atomic<bool> done { false };
- std::atomic<bool> cancel { false };
- int ret = AVERROR_BUG;
+ bool done { false };
+ bool cancel { false };
+ int ret { AVERROR_BUG };
};
auto cbdata = std::make_shared<CBData>();
- std::unique_lock cblock(cbdata->mutex);
-
boolean res = 0;
CHECK_HR_RET(wgctx->dispatcher_queue->TryEnqueue(
create_cb_handler<IDispatcherQueueHandler>(
[cb = std::forward<F>(cb), cbdata]() {
{
std::lock_guard lock(cbdata->mutex);
- if (cbdata->cancel.load(std::memory_order_acquire))
+ if (cbdata->cancel)
return S_OK;
try {
@@ -734,7 +731,7 @@ static int run_on_wgc_thread(AVFilterContext *avctx, F &&cb)
cbdata->ret = AVERROR_BUG;
}
- cbdata->done.store(true, std::memory_order_release);
+ cbdata->done = true;
}
cbdata->cond.notify_one();
@@ -745,8 +742,9 @@ static int run_on_wgc_thread(AVFilterContext *avctx, F &&cb)
return AVERROR_EXTERNAL;
}
- if (!cbdata->cond.wait_for(cblock, std::chrono::seconds(1), [&]() { return cbdata->done.load(std::memory_order_acquire); })) {
- cbdata->cancel.store(true, std::memory_order_release);
+ std::unique_lock cblock(cbdata->mutex);
+ if (!cbdata->cond.wait_for(cblock, std::chrono::seconds(1), [&]() { return cbdata->done; })) {
+ cbdata->cancel = true;
av_log(avctx, AV_LOG_ERROR, "WGC thread callback timed out\n");
return AVERROR(ETIMEDOUT);
}
commit 61378d6b911d30ef7ec095bcbb25b243ea07673c
Author: Timo Rothenpieler <timo(a)rothenpieler.org>
AuthorDate: Tue Sep 16 00:13:46 2025 +0200
Commit: Timo Rothenpieler <timo(a)rothenpieler.org>
CommitDate: Tue Sep 16 15:52:11 2025 +0000
avfilter/vsrc_gfxcapture: fix possible missed wakeup race in capture loop
diff --git a/libavfilter/vsrc_gfxcapture_winrt.cpp b/libavfilter/vsrc_gfxcapture_winrt.cpp
index 6477e56918..0849380b3a 100644
--- a/libavfilter/vsrc_gfxcapture_winrt.cpp
+++ b/libavfilter/vsrc_gfxcapture_winrt.cpp
@@ -123,8 +123,8 @@ struct GfxCaptureContextWgc {
std::mutex frame_arrived_mutex;
std::condition_variable frame_arrived_cond;
- std::atomic<bool> window_closed { false };
- std::atomic<uint64_t> frame_seq { 0 };
+ bool window_closed { false };
+ uint64_t frame_seq { 0 };
SizeInt32 cap_size { 0, 0 };
RECT client_area_offsets { 0, 0, 0, 0 };
@@ -196,12 +196,18 @@ static HRESULT get_activation_factory(GfxCaptureContextCpp *ctx, PCWSTR clsid, T
****************************************************/
static void wgc_frame_arrived_handler(const std::unique_ptr<GfxCaptureContextWgc> &wgctx) {
- wgctx->frame_seq.fetch_add(1, std::memory_order_release);
+ {
+ std::lock_guard lock(wgctx->frame_arrived_mutex);
+ wgctx->frame_seq += 1;
+ }
wgctx->frame_arrived_cond.notify_one();
}
static void wgc_closed_handler(const std::unique_ptr<GfxCaptureContextWgc> &wgctx) {
- wgctx->window_closed.store(true, std::memory_order_release);
+ {
+ std::lock_guard lock(wgctx->frame_arrived_mutex);
+ wgctx->window_closed = true;
+ }
wgctx->frame_arrived_cond.notify_one();
}
@@ -1455,23 +1461,22 @@ static int gfxcapture_activate(AVFilterContext *avctx)
if (!ff_outlink_frame_wanted(outlink))
return FFERROR_NOT_READY;
- std::unique_lock frame_lock(wgctx->frame_arrived_mutex);
-
for (;;) {
- uint64_t last_seq = wgctx->frame_seq.load(std::memory_order_acquire);
+ uint64_t last_seq = wgctx->frame_seq;
int ret = process_frame_if_exists(outlink);
if (ret != AVERROR(EAGAIN))
return ret;
- if (wgctx->window_closed.load(std::memory_order_acquire)) {
+ std::unique_lock frame_lock(wgctx->frame_arrived_mutex);
+
+ if (wgctx->window_closed && wgctx->frame_seq == last_seq) {
ff_outlink_set_status(outlink, AVERROR_EOF, ctx->last_pts - ctx->first_pts + 1);
break;
}
if (!wgctx->frame_arrived_cond.wait_for(frame_lock, std::chrono::seconds(1), [&]() {
- return wgctx->frame_seq.load(std::memory_order_acquire) != last_seq ||
- wgctx->window_closed.load(std::memory_order_acquire);
+ return wgctx->frame_seq != last_seq || wgctx->window_closed;
}))
break;
}
-----------------------------------------------------------------------
Summary of changes:
libavfilter/vsrc_gfxcapture_winrt.cpp | 43 +++++++++++++++++++----------------
1 file changed, 23 insertions(+), 20 deletions(-)
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. af35a13f6d avformat/movenc: add support for fragmented TTML muxing
by ffmpeg-git@ffmpeg.org 16 Sep '25
by ffmpeg-git@ffmpeg.org 16 Sep '25
16 Sep '25
The branch, master has been updated
via af35a13f6d269a2400fd36ecc70b74ea2da1f1a8 (commit)
via 8dcc65a0fc18a4741d82c2c11c3e064580c27b30 (commit)
via 5c222d7adef3cb08af0561112787193a75f26cec (commit)
from 9e4ff4732c0d389a6b67f47c47b7823a1992cd40 (commit)
- Log -----------------------------------------------------------------
commit af35a13f6d269a2400fd36ecc70b74ea2da1f1a8
Author: Jan Ekström <jan.ekstrom(a)24i.com>
AuthorDate: Mon Nov 22 14:07:04 2021 +0200
Commit: Jan Ekström <jeebjp(a)gmail.com>
CommitDate: Tue Sep 16 16:29:48 2025 +0300
avformat/movenc: add support for fragmented TTML muxing
Attempts to base the fragmentation timing on other streams
as most receivers expect media fragments to be more or less
aligned.
Currently does not support fragmentation on subtitle track
only, as the subtitle packet queue timings would have to be
checked in addition to the current fragmentation timing logic.
Signed-off-by: Jan Ekström <jan.ekstrom(a)24i.com>
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index e67a14a7d6..bfe76a2034 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -8254,15 +8254,6 @@ static int mov_init(AVFormatContext *s)
track->squash_fragment_samples_to_one =
ff_is_ttml_stream_paragraph_based(track->par);
- if (mov->flags & FF_MOV_FLAG_FRAGMENT &&
- track->squash_fragment_samples_to_one) {
- av_log(s, AV_LOG_ERROR,
- "Fragmentation is not currently supported for "
- "TTML in MP4/ISMV (track synchronization between "
- "subtitles and other media is not yet implemented)!\n");
- return AVERROR_PATCHWELCOME;
- }
-
if (track->mode != MODE_ISM &&
track->par->codec_tag == MOV_ISMV_TTML_TAG &&
s->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
diff --git a/libavformat/movenc_ttml.c b/libavformat/movenc_ttml.c
index 413eccfc0f..c5232e589c 100644
--- a/libavformat/movenc_ttml.c
+++ b/libavformat/movenc_ttml.c
@@ -55,6 +55,48 @@ static int mov_init_ttml_writer(MOVTrack *track, AVFormatContext **out_ctx)
return 0;
}
+static void mov_calculate_start_and_end_of_other_tracks(
+ AVFormatContext *s, MOVTrack *track, int64_t *start_pts, int64_t *end_pts)
+{
+ MOVMuxContext *mov = s->priv_data;
+
+ // Initialize at the end of the previous document/fragment, which is NOPTS
+ // until the first fragment is created.
+ int64_t max_track_end_dts = *start_pts = track->end_pts;
+
+ for (unsigned int i = 0; i < s->nb_streams; i++) {
+ MOVTrack *other_track = &mov->tracks[i];
+
+ // Skip our own track, any other track that needs squashing,
+ // or any track which still has its start_dts at NOPTS or
+ // any track that did not yet get any packets.
+ if (track == other_track ||
+ other_track->squash_fragment_samples_to_one ||
+ other_track->start_dts == AV_NOPTS_VALUE ||
+ !other_track->entry) {
+ continue;
+ }
+
+ int64_t picked_start = av_rescale_q_rnd(other_track->cluster[0].dts + other_track->cluster[0].cts,
+ other_track->st->time_base,
+ track->st->time_base,
+ AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX);
+ int64_t picked_end = av_rescale_q_rnd(other_track->end_pts,
+ other_track->st->time_base,
+ track->st->time_base,
+ AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX);
+
+ if (*start_pts == AV_NOPTS_VALUE)
+ *start_pts = picked_start;
+ else if (picked_start >= track->end_pts)
+ *start_pts = FFMIN(*start_pts, picked_start);
+
+ max_track_end_dts = FFMAX(max_track_end_dts, picked_end);
+ }
+
+ *end_pts = max_track_end_dts;
+}
+
static int mov_write_ttml_document_from_queue(AVFormatContext *s,
AVFormatContext *ttml_ctx,
MOVTrack *track,
@@ -66,13 +108,85 @@ static int mov_write_ttml_document_from_queue(AVFormatContext *s,
int64_t start_ts = track->start_dts == AV_NOPTS_VALUE ?
0 : (track->start_dts + track->track_duration);
int64_t end_ts = start_ts;
+ unsigned int time_limited = 0;
+ PacketList back_to_queue_list = { 0 };
+
+ if (*out_start_ts != AV_NOPTS_VALUE) {
+ // we have non-nopts values here, thus we have been given a time range
+ time_limited = 1;
+ start_ts = *out_start_ts;
+ end_ts = *out_start_ts + *out_duration;
+ }
if ((ret = avformat_write_header(ttml_ctx, NULL)) < 0) {
return ret;
}
while (!avpriv_packet_list_get(&track->squashed_packet_queue, pkt)) {
- end_ts = FFMAX(end_ts, pkt->pts + pkt->duration);
+ int64_t pts_before = pkt->pts;
+ int64_t duration_before = pkt->duration;
+
+ if (time_limited) {
+ // special cases first:
+ if (pkt->pts + pkt->duration < start_ts) {
+ // too late for our fragment, unfortunately
+ // unref and proceed to next packet in queue.
+ av_log(s, AV_LOG_WARNING,
+ "Very late TTML packet in queue, dropping packet with "
+ "pts: %"PRId64", duration: %"PRId64"\n",
+ pkt->pts, pkt->duration);
+ av_packet_unref(pkt);
+ continue;
+ } else if (pkt->pts >= end_ts) {
+ // starts after this fragment, put back to original queue
+ ret = avpriv_packet_list_put(&track->squashed_packet_queue,
+ pkt, av_packet_ref,
+ FF_PACKETLIST_FLAG_PREPEND);
+ if (ret < 0)
+ goto cleanup;
+
+ break;
+ }
+
+ // limit packet pts to start_ts
+ if (pkt->pts < start_ts) {
+ pkt->duration -= start_ts - pkt->pts;
+ pkt->pts = start_ts;
+ }
+
+ if (pkt->pts + pkt->duration > end_ts) {
+ // goes over our current fragment, create duplicate and
+ // put it back to list after iteration has finished in
+ // order to handle multiple subtitles at the same time.
+ int64_t offset = end_ts - pkt->pts;
+
+ ret = avpriv_packet_list_put(&back_to_queue_list,
+ pkt, av_packet_ref,
+ FF_PACKETLIST_FLAG_PREPEND);
+ if (ret < 0)
+ goto cleanup;
+
+ back_to_queue_list.head->pkt.pts =
+ back_to_queue_list.head->pkt.dts =
+ back_to_queue_list.head->pkt.pts + offset;
+ back_to_queue_list.head->pkt.duration -= offset;
+
+ // and for our normal packet we just set duration to offset
+ pkt->duration = offset;
+ }
+ } else {
+ end_ts = FFMAX(end_ts, pkt->pts + pkt->duration);
+ }
+
+ av_log(s, AV_LOG_TRACE,
+ "TTML packet writeout: pts: %"PRId64" (%"PRId64"), "
+ "duration: %"PRId64"\n",
+ pkt->pts, pkt->pts - start_ts, pkt->duration);
+ if (pkt->pts != pts_before || pkt->duration != duration_before) {
+ av_log(s, AV_LOG_TRACE,
+ "Adjustments: pts: %"PRId64", duration: %"PRId64"\n",
+ pkt->pts - pts_before, pkt->duration - duration_before);
+ }
// in case of the 'dfxp' muxing mode, each written document is offset
// to its containing sample's beginning.
@@ -101,15 +215,30 @@ static int mov_write_ttml_document_from_queue(AVFormatContext *s,
ret = 0;
cleanup:
+ while (!avpriv_packet_list_get(&back_to_queue_list, pkt)) {
+ ret = avpriv_packet_list_put(&track->squashed_packet_queue,
+ pkt, av_packet_ref,
+ FF_PACKETLIST_FLAG_PREPEND);
+
+ // unrelated to whether we succeed or not, we unref the packet
+ // received from the temporary list.
+ av_packet_unref(pkt);
+
+ if (ret < 0) {
+ avpriv_packet_list_free(&back_to_queue_list);
+ break;
+ }
+ }
return ret;
}
int ff_mov_generate_squashed_ttml_packet(AVFormatContext *s,
MOVTrack *track, AVPacket *pkt)
{
+ MOVMuxContext *mov = s->priv_data;
AVFormatContext *ttml_ctx = NULL;
// values for the generated AVPacket
- int64_t start_ts = 0;
+ int64_t start_ts = AV_NOPTS_VALUE;
int64_t duration = 0;
int ret = AVERROR_BUG;
@@ -120,12 +249,30 @@ int ff_mov_generate_squashed_ttml_packet(AVFormatContext *s,
goto cleanup;
}
+ if (mov->flags & FF_MOV_FLAG_FRAGMENT) {
+ int64_t calculated_start = AV_NOPTS_VALUE;
+ int64_t calculated_end = AV_NOPTS_VALUE;
+
+ mov_calculate_start_and_end_of_other_tracks(s, track, &calculated_start, &calculated_end);
+
+ if (calculated_start != AV_NOPTS_VALUE) {
+ start_ts = calculated_start;
+ duration = calculated_end - calculated_start;
+ av_log(s, AV_LOG_VERBOSE,
+ "Calculated subtitle fragment start: %"PRId64", "
+ "duration: %"PRId64"\n",
+ start_ts, duration);
+ }
+ }
+
if (!track->squashed_packet_queue.head) {
// empty queue, write minimal empty document with zero duration
avio_write(ttml_ctx->pb, empty_ttml_document,
sizeof(empty_ttml_document) - 1);
- start_ts = 0;
- duration = 0;
+ if (start_ts == AV_NOPTS_VALUE) {
+ start_ts = 0;
+ duration = 0;
+ }
goto generate_packet;
}
diff --git a/libavformat/version.h b/libavformat/version.h
index e2634b85ae..384cbd49cc 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
#include "version_major.h"
#define LIBAVFORMAT_VERSION_MINOR 5
-#define LIBAVFORMAT_VERSION_MICRO 100
+#define LIBAVFORMAT_VERSION_MICRO 101
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index c43f260dd3..eb666c5865 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -158,6 +158,27 @@ FATE_MOV_FFMPEG_FFPROBE_SAMPLES-$(call TRANSCODE, TTML SUBRIP, MP4 MOV, SRT_DEMU
fate-mov-mp4-ttml-stpp: CMD = transcode srt $(TARGET_SAMPLES)/sub/SubRip_capability_tester.srt mp4 "-map 0:s -c:s ttml -time_base:s 1:1000" "-map 0 -c copy" "-of json -show_entries packet:stream=index,codec_type,codec_tag_string,codec_tag,codec_name,time_base,start_time,duration_ts,duration,nb_frames,nb_read_packets:stream_tags"
fate-mov-mp4-ttml-dfxp: CMD = transcode srt $(TARGET_SAMPLES)/sub/SubRip_capability_tester.srt mp4 "-map 0:s -c:s ttml -time_base:s 1:1000 -tag:s dfxp -strict unofficial" "-map 0 -c copy" "-of json -show_entries packet:stream=index,codec_type,codec_tag_string,codec_tag,codec_name,time_base,start_time,duration_ts,duration,nb_frames,nb_read_packets:stream_tags"
+FATE_MOV_FFMPEG_FFPROBE_SAMPLES-$(call TRANSCODE, TTML SUBRIP, MP4 MOV, LAVFI_INDEV SMPTEHDBARS_FILTER SRT_DEMUXER MPEG2VIDEO_ENCODER TTML_MUXER RAWVIDEO_MUXER) += fate-mov-mp4-fragmented-ttml-stpp
+fate-mov-mp4-fragmented-ttml-stpp: CMD = transcode srt $(TARGET_SAMPLES)/sub/SubRip_capability_tester.srt mp4 \
+ "-map 1:v -map 0:s \
+ -c:v mpeg2video -b:v 2M -g 48 -sc_threshold 1000000000 \
+ -c:s ttml -time_base:s 1:1000 \
+ -movflags +cmaf" \
+ "-map 0:s -c copy" \
+ "-select_streams s -of csv -show_packets -show_data_hash crc32" \
+ "-f lavfi -i smptehdbars=duration=24.5245:size=320x180:rate=24000/1001,format=yuv420p" \
+ "" "" "data"
+
+FATE_MOV_FFMPEG_FFPROBE_SAMPLES-$(call TRANSCODE, TTML SUBRIP, ISMV MOV, LAVFI_INDEV SMPTEHDBARS_FILTER SRT_DEMUXER MPEG2VIDEO_ENCODER TTML_MUXER RAWVIDEO_MUXER) += fate-mov-mp4-fragmented-ttml-dfxp
+fate-mov-mp4-fragmented-ttml-dfxp: CMD = transcode srt $(TARGET_SAMPLES)/sub/SubRip_capability_tester.srt ismv \
+ "-map 1:v -map 0:s \
+ -c:v mpeg2video -b:v 2M -g 48 -sc_threshold 1000000000 \
+ -c:s ttml -tag:s dfxp -time_base:s 1:1000" \
+ "-map 0:s -c copy" \
+ "-select_streams s -of csv -show_packets -show_data_hash crc32" \
+ "-f lavfi -i smptehdbars=duration=24.5245:size=320x180:rate=24000/1001,format=yuv420p" \
+ "" "" "data"
+
# 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
diff --git a/tests/ref/fate/mov-mp4-fragmented-ttml-dfxp b/tests/ref/fate/mov-mp4-fragmented-ttml-dfxp
new file mode 100644
index 0000000000..ee1189cebf
--- /dev/null
+++ b/tests/ref/fate/mov-mp4-fragmented-ttml-dfxp
@@ -0,0 +1,430 @@
+09836de7062020ab760fc949875b7e2b *tests/data/fate/mov-mp4-fragmented-ttml-dfxp.ismv
+189404 tests/data/fate/mov-mp4-fragmented-ttml-dfxp.ismv
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:00.000"
+ end="00:00:00.000"><span region="Default">Don't show this text it may be used to insert hidden data</span></p>
+ <p
+ begin="00:00:01.500"
+ end="00:00:02.002"><span region="Default">SubRip subtitles capability tester 1.3o by ale5000<br/>Use VLC 1.1 or higher as reference for most things and MPC Home Cinema for others<br/>This text should be blue<br/>This text should be red<br/>This text should be black<br/>If you see this with the normal font, the player don't (fully) support font face</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:00.000"
+ end="00:00:02.002"><span region="Default">SubRip subtitles capability tester 1.3o by ale5000<br/>Use VLC 1.1 or higher as reference for most things and MPC Home Cinema for others<br/>This text should be blue<br/>This text should be red<br/>This text should be black<br/>If you see this with the normal font, the player don't (fully) support font face</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:00.000"
+ end="00:00:00.496"><span region="Default">SubRip subtitles capability tester 1.3o by ale5000<br/>Use VLC 1.1 or higher as reference for most things and MPC Home Cinema for others<br/>This text should be blue<br/>This text should be red<br/>This text should be black<br/>If you see this with the normal font, the player don't (fully) support font face</span></p>
+ <p
+ begin="00:00:00.496"
+ end="00:00:00.496"><span region="Default">Hidden</span></p>
+ <p
+ begin="00:00:00.497"
+ end="00:00:02.002"><span region="Default">This text should be small<br/>This text should be normal<br/>This text should be big</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:00.000"
+ end="00:00:01.494"><span region="Default">This text should be small<br/>This text should be normal<br/>This text should be big</span></p>
+ <p
+ begin="00:00:01.495"
+ end="00:00:02.002"><span region="Default">This should be an E with an accent: È<br/>日本語<br/>This text should be bold, italics and underline<br/>This text should be small and green<br/>This text should be small and red<br/>This text should be big and brown</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:00.000"
+ end="00:00:02.002"><span region="Default">This should be an E with an accent: È<br/>日本語<br/>This text should be bold, italics and underline<br/>This text should be small and green<br/>This text should be small and red<br/>This text should be big and brown</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:00.000"
+ end="00:00:01.490"><span region="Default">This should be an E with an accent: È<br/>日本語<br/>This text should be bold, italics and underline<br/>This text should be small and green<br/>This text should be small and red<br/>This text should be big and brown</span></p>
+ <p
+ begin="00:00:01.491"
+ end="00:00:02.002"><span region="Default">This line should be bold<br/>This line should be italics<br/>This line should be underline<br/>This line should be strikethrough<br/>Both lines<br/>should be underline</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:00.000"
+ end="00:00:02.002"><span region="Default">This line should be bold<br/>This line should be italics<br/>This line should be underline<br/>This line should be strikethrough<br/>Both lines<br/>should be underline</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:00.000"
+ end="00:00:00.486"><span region="Default">This line should be bold<br/>This line should be italics<br/>This line should be underline<br/>This line should be strikethrough<br/>Both lines<br/>should be underline</span></p>
+ <p
+ begin="00:00:00.487"
+ end="00:00:02.002"><span region="Default">><br/>It would be a good thing to<br/>hide invalid html tags that are closed and show the text in them<br/>but show un-closed invalid html tags<br/>Show not opened tags<br/><</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:00.000"
+ end="00:00:01.484"><span region="Default">><br/>It would be a good thing to<br/>hide invalid html tags that are closed and show the text in them<br/>but show un-closed invalid html tags<br/>Show not opened tags<br/><</span></p>
+ <p
+ begin="00:00:01.485"
+ end="00:00:02.002"><span region="Default">and also<br/>hide invalid html tags with parameters that are closed and show the text in them<br/>but show un-closed invalid html tags<br/>This text should be showed underlined without problems also: 2<3,5>1,4<6<br/>This shouldn't be underlined</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:00.000"
+ end="00:00:02.002"><span region="Default">and also<br/>hide invalid html tags with parameters that are closed and show the text in them<br/>but show un-closed invalid html tags<br/>This text should be showed underlined without problems also: 2<3,5>1,4<6<br/>This shouldn't be underlined</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:00.000"
+ end="00:00:00.480"><span region="Default">and also<br/>hide invalid html tags with parameters that are closed and show the text in them<br/>but show un-closed invalid html tags<br/>This text should be showed underlined without problems also: 2<3,5>1,4<6<br/>This shouldn't be underlined</span></p>
+ <p
+ begin="00:00:00.481"
+ end="00:00:01.480"><span region="Default">This text should be in the normal position...</span></p>
+ <p
+ begin="00:00:01.481"
+ end="00:00:02.002"><span region="Default">This text should NOT be in the normal position</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:00.000"
+ end="00:00:00.478"><span region="Default">This text should NOT be in the normal position</span></p>
+ <p
+ begin="00:00:00.479"
+ end="00:00:02.002"><span region="Default">Implementation is the same of the ASS tag<br/>This text should be at the<br/>top and horizontally centered</span></p>
+ <p
+ begin="00:00:00.479"
+ end="00:00:02.002"><span region="Default">This text should be at the<br/>middle and horizontally centered</span></p>
+ <p
+ begin="00:00:00.479"
+ end="00:00:02.002"><span region="Default">This text should be at the<br/>bottom and horizontally centered</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:00.000"
+ end="00:00:00.476"><span region="Default">Implementation is the same of the ASS tag<br/>This text should be at the<br/>top and horizontally centered</span></p>
+ <p
+ begin="00:00:00.000"
+ end="00:00:00.476"><span region="Default">This text should be at the<br/>middle and horizontally centered</span></p>
+ <p
+ begin="00:00:00.000"
+ end="00:00:00.476"><span region="Default">This text should be at the<br/>bottom and horizontally centered</span></p>
+ <p
+ begin="00:00:00.477"
+ end="00:00:00.501"><span region="Default">This text should be at the<br/>top and horizontally at the left</span></p>
+ <p
+ begin="00:00:00.477"
+ end="00:00:00.500"><span region="Default">This text should be at the<br/>middle and horizontally at the left<br/>(The second position must be ignored)</span></p>
+ <p
+ begin="00:00:00.477"
+ end="00:00:00.500"><span region="Default">This text should be at the<br/>bottom and horizontally at the left</span></p>
+ </div>
+ </body>
+</tt>
+packet,subtitle,1,0,0.000000,0,0.000000,20020000,2.002000,1172,14746,K__,CRC32:bde7afa1
+packet,subtitle,1,20020000,2.002000,20020000,2.002000,20020000,2.002000,1015,29540,K__,CRC32:c1cb78f2
+packet,subtitle,1,40040000,4.004000,40040000,4.004000,20020000,2.002000,1305,44177,K__,CRC32:267b17fe
+packet,subtitle,1,60060000,6.006000,60060000,6.006000,20020000,2.002000,1111,59104,K__,CRC32:d6aaf284
+packet,subtitle,1,80080000,8.008000,80080000,8.008000,20020000,2.002000,927,73837,K__,CRC32:0ee24ad7
+packet,subtitle,1,100100000,10.010000,100100000,10.010000,20020000,2.002000,1194,88386,K__,CRC32:a9816515
+packet,subtitle,1,120120000,12.012000,120120000,12.012000,20020000,2.002000,874,103202,K__,CRC32:c47ebb4e
+packet,subtitle,1,140140000,14.014000,140140000,14.014000,20020000,2.002000,1154,117698,K__,CRC32:09b26179
+packet,subtitle,1,160160000,16.016000,160160000,16.016000,20020000,2.002000,1240,132474,K__,CRC32:d7e3067e
+packet,subtitle,1,180180000,18.018000,180180000,18.018000,20020000,2.002000,960,147336,K__,CRC32:d2d99797
+packet,subtitle,1,200200000,20.020000,200200000,20.020000,20020000,2.002000,1251,161918,K__,CRC32:1857892c
+packet,subtitle,1,220220000,22.022000,220220000,22.022000,20020000,2.002000,1285,176791,K__,CRC32:76bd9787
+packet,subtitle,1,240240000,24.024000,240240000,24.024000,5005000,0.500500,1676,187162,K__,CRC32:b519ec6f
diff --git a/tests/ref/fate/mov-mp4-fragmented-ttml-stpp b/tests/ref/fate/mov-mp4-fragmented-ttml-stpp
new file mode 100644
index 0000000000..3e3371afad
--- /dev/null
+++ b/tests/ref/fate/mov-mp4-fragmented-ttml-stpp
@@ -0,0 +1,430 @@
+d7c6570fbe8c1ec630c2f1639ae16fcb *tests/data/fate/mov-mp4-fragmented-ttml-stpp.mp4
+183872 tests/data/fate/mov-mp4-fragmented-ttml-stpp.mp4
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:00.000"
+ end="00:00:00.000"><span region="Default">Don't show this text it may be used to insert hidden data</span></p>
+ <p
+ begin="00:00:01.500"
+ end="00:00:02.002"><span region="Default">SubRip subtitles capability tester 1.3o by ale5000<br/>Use VLC 1.1 or higher as reference for most things and MPC Home Cinema for others<br/>This text should be blue<br/>This text should be red<br/>This text should be black<br/>If you see this with the normal font, the player don't (fully) support font face</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:02.002"
+ end="00:00:04.004"><span region="Default">SubRip subtitles capability tester 1.3o by ale5000<br/>Use VLC 1.1 or higher as reference for most things and MPC Home Cinema for others<br/>This text should be blue<br/>This text should be red<br/>This text should be black<br/>If you see this with the normal font, the player don't (fully) support font face</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:04.004"
+ end="00:00:04.500"><span region="Default">SubRip subtitles capability tester 1.3o by ale5000<br/>Use VLC 1.1 or higher as reference for most things and MPC Home Cinema for others<br/>This text should be blue<br/>This text should be red<br/>This text should be black<br/>If you see this with the normal font, the player don't (fully) support font face</span></p>
+ <p
+ begin="00:00:04.500"
+ end="00:00:04.500"><span region="Default">Hidden</span></p>
+ <p
+ begin="00:00:04.501"
+ end="00:00:06.006"><span region="Default">This text should be small<br/>This text should be normal<br/>This text should be big</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:06.006"
+ end="00:00:07.500"><span region="Default">This text should be small<br/>This text should be normal<br/>This text should be big</span></p>
+ <p
+ begin="00:00:07.501"
+ end="00:00:08.008"><span region="Default">This should be an E with an accent: È<br/>日本語<br/>This text should be bold, italics and underline<br/>This text should be small and green<br/>This text should be small and red<br/>This text should be big and brown</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:08.008"
+ end="00:00:10.010"><span region="Default">This should be an E with an accent: È<br/>日本語<br/>This text should be bold, italics and underline<br/>This text should be small and green<br/>This text should be small and red<br/>This text should be big and brown</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:10.010"
+ end="00:00:11.500"><span region="Default">This should be an E with an accent: È<br/>日本語<br/>This text should be bold, italics and underline<br/>This text should be small and green<br/>This text should be small and red<br/>This text should be big and brown</span></p>
+ <p
+ begin="00:00:11.501"
+ end="00:00:12.012"><span region="Default">This line should be bold<br/>This line should be italics<br/>This line should be underline<br/>This line should be strikethrough<br/>Both lines<br/>should be underline</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:12.012"
+ end="00:00:14.014"><span region="Default">This line should be bold<br/>This line should be italics<br/>This line should be underline<br/>This line should be strikethrough<br/>Both lines<br/>should be underline</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:14.014"
+ end="00:00:14.500"><span region="Default">This line should be bold<br/>This line should be italics<br/>This line should be underline<br/>This line should be strikethrough<br/>Both lines<br/>should be underline</span></p>
+ <p
+ begin="00:00:14.501"
+ end="00:00:16.016"><span region="Default">><br/>It would be a good thing to<br/>hide invalid html tags that are closed and show the text in them<br/>but show un-closed invalid html tags<br/>Show not opened tags<br/><</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:16.016"
+ end="00:00:17.500"><span region="Default">><br/>It would be a good thing to<br/>hide invalid html tags that are closed and show the text in them<br/>but show un-closed invalid html tags<br/>Show not opened tags<br/><</span></p>
+ <p
+ begin="00:00:17.501"
+ end="00:00:18.018"><span region="Default">and also<br/>hide invalid html tags with parameters that are closed and show the text in them<br/>but show un-closed invalid html tags<br/>This text should be showed underlined without problems also: 2<3,5>1,4<6<br/>This shouldn't be underlined</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:18.018"
+ end="00:00:20.020"><span region="Default">and also<br/>hide invalid html tags with parameters that are closed and show the text in them<br/>but show un-closed invalid html tags<br/>This text should be showed underlined without problems also: 2<3,5>1,4<6<br/>This shouldn't be underlined</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:20.020"
+ end="00:00:20.500"><span region="Default">and also<br/>hide invalid html tags with parameters that are closed and show the text in them<br/>but show un-closed invalid html tags<br/>This text should be showed underlined without problems also: 2<3,5>1,4<6<br/>This shouldn't be underlined</span></p>
+ <p
+ begin="00:00:20.501"
+ end="00:00:21.500"><span region="Default">This text should be in the normal position...</span></p>
+ <p
+ begin="00:00:21.501"
+ end="00:00:22.022"><span region="Default">This text should NOT be in the normal position</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:22.022"
+ end="00:00:22.500"><span region="Default">This text should NOT be in the normal position</span></p>
+ <p
+ begin="00:00:22.501"
+ end="00:00:24.024"><span region="Default">Implementation is the same of the ASS tag<br/>This text should be at the<br/>top and horizontally centered</span></p>
+ <p
+ begin="00:00:22.502"
+ end="00:00:24.024"><span region="Default">This text should be at the<br/>middle and horizontally centered</span></p>
+ <p
+ begin="00:00:22.503"
+ end="00:00:24.024"><span region="Default">This text should be at the<br/>bottom and horizontally centered</span></p>
+ </div>
+ </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+ xmlns="http://www.w3.org/ns/ttml"
+ xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+ xmlns:tts="http://www.w3.org/ns/ttml#styling"
+ xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+ ttp:cellResolution="384 288"
+ xml:lang="">
+ <head>
+ <layout>
+ <region xml:id="Default"
+ tts:origin="3% 0%"
+ tts:extent="97% 97%"
+ tts:displayAlign="after"
+ tts:textAlign="center"
+ tts:fontSize="16c"
+ tts:fontFamily="Arial"
+ tts:overflow="visible" />
+ </layout>
+ </head>
+ <body>
+ <div>
+ <p
+ begin="00:00:24.024"
+ end="00:00:24.500"><span region="Default">Implementation is the same of the ASS tag<br/>This text should be at the<br/>top and horizontally centered</span></p>
+ <p
+ begin="00:00:24.024"
+ end="00:00:24.501"><span region="Default">This text should be at the<br/>middle and horizontally centered</span></p>
+ <p
+ begin="00:00:24.024"
+ end="00:00:24.502"><span region="Default">This text should be at the<br/>bottom and horizontally centered</span></p>
+ <p
+ begin="00:00:24.501"
+ end="00:00:24.525"><span region="Default">This text should be at the<br/>top and horizontally at the left</span></p>
+ <p
+ begin="00:00:24.502"
+ end="00:00:24.525"><span region="Default">This text should be at the<br/>middle and horizontally at the left<br/>(The second position must be ignored)</span></p>
+ <p
+ begin="00:00:24.503"
+ end="00:00:24.525"><span region="Default">This text should be at the<br/>bottom and horizontally at the left</span></p>
+ </div>
+ </body>
+</tt>
+packet,subtitle,1,0,0.000000,0,0.000000,2002,2.002000,1172,14302,K__,CRC32:bde7afa1
+packet,subtitle,1,2002,2.002000,2002,2.002000,2002,2.002000,1015,28648,K__,CRC32:bd3bd4bc
+packet,subtitle,1,4004,4.004000,4004,4.004000,2002,2.002000,1305,42837,K__,CRC32:c8ff5017
+packet,subtitle,1,6006,6.006000,6006,6.006000,2002,2.002000,1111,57316,K__,CRC32:f0b10da6
+packet,subtitle,1,8008,8.008000,8008,8.008000,2002,2.002000,927,71601,K__,CRC32:55a7bb1b
+packet,subtitle,1,10010,10.010000,10010,10.010000,2002,2.002000,1194,85702,K__,CRC32:03dc4753
+packet,subtitle,1,12012,12.012000,12012,12.012000,2002,2.002000,874,100070,K__,CRC32:c7a092d4
+packet,subtitle,1,14014,14.014000,14014,14.014000,2002,2.002000,1154,114118,K__,CRC32:b476fe9c
+packet,subtitle,1,16016,16.016000,16016,16.016000,2002,2.002000,1240,128446,K__,CRC32:912e694c
+packet,subtitle,1,18018,18.018000,18018,18.018000,2002,2.002000,960,142860,K__,CRC32:bba73912
+packet,subtitle,1,20020,20.020000,20020,20.020000,2002,2.002000,1251,156994,K__,CRC32:4c7b87d8
+packet,subtitle,1,22022,22.022000,22022,22.022000,2002,2.002000,1285,171419,K__,CRC32:c0368927
+packet,subtitle,1,24024,24.024000,24024,24.024000,501,0.501000,1676,181630,K__,CRC32:812a103f
commit 8dcc65a0fc18a4741d82c2c11c3e064580c27b30
Author: Jan Ekström <jan.ekstrom(a)24i.com>
AuthorDate: Tue Sep 24 14:32:36 2019 +0300
Commit: Jan Ekström <jeebjp(a)gmail.com>
CommitDate: Tue Sep 16 16:28:12 2025 +0300
avcodec/packet: add functionality to prepend to AVPacketLists
Signed-off-by: Jan Ekström <jan.ekstrom(a)24i.com>
diff --git a/libavcodec/packet.c b/libavcodec/packet.c
index 9420c10be0..4736b1fef2 100644
--- a/libavcodec/packet.c
+++ b/libavcodec/packet.c
@@ -550,6 +550,7 @@ int avpriv_packet_list_put(PacketList *packet_buffer,
int flags)
{
PacketListEntry *pktl = av_malloc(sizeof(*pktl));
+ unsigned int update_end_point = 1;
int ret;
if (!pktl)
@@ -573,13 +574,22 @@ int avpriv_packet_list_put(PacketList *packet_buffer,
pktl->next = NULL;
- if (packet_buffer->head)
- packet_buffer->tail->next = pktl;
- else
+ if (packet_buffer->head) {
+ if (flags & FF_PACKETLIST_FLAG_PREPEND) {
+ pktl->next = packet_buffer->head;
+ packet_buffer->head = pktl;
+ update_end_point = 0;
+ } else {
+ packet_buffer->tail->next = pktl;
+ }
+ } else
packet_buffer->head = pktl;
- /* Add the packet in the buffered packet list. */
- packet_buffer->tail = pktl;
+ if (update_end_point) {
+ /* Add the packet in the buffered packet list. */
+ packet_buffer->tail = pktl;
+ }
+
return 0;
}
diff --git a/libavcodec/packet_internal.h b/libavcodec/packet_internal.h
index 52fa6d9be9..9c0f4fead5 100644
--- a/libavcodec/packet_internal.h
+++ b/libavcodec/packet_internal.h
@@ -34,6 +34,8 @@ typedef struct PacketList {
PacketListEntry *head, *tail;
} PacketList;
+#define FF_PACKETLIST_FLAG_PREPEND (1 << 0) /**< Prepend created AVPacketList instead of appending */
+
/**
* Append an AVPacket to the list.
*
commit 5c222d7adef3cb08af0561112787193a75f26cec
Author: Jan Ekström <jan.ekstrom(a)24i.com>
AuthorDate: Fri Sep 1 16:22:37 2023 +0300
Commit: Jan Ekström <jeebjp(a)gmail.com>
CommitDate: Tue Sep 16 15:17:12 2025 +0300
tests/fate-run: add support for specifying the final encode muxer in `transcode`
This allows for direct dumping of the packets' contents (useful for
text based formats), while getting the timestamps/sizes etc from
ffprobe.
If used via TRANSCODE, the actually utilized muxer should be added
within the last argument as an additional dependency, as that is not
done automatically.
Signed-off-by: Jan Ekström <jan.ekstrom(a)24i.com>
diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index efc8b3bc6a..247f4e461b 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -266,7 +266,9 @@ transcode(){
additional_input=$7
final_decode=$8
enc_opt_in=$9
+ final_encode_muxer="${10}"
test -z "$additional_input" || additional_input="$DEC_OPTS $additional_input"
+ test -z "$final_encode_muxer" && final_encode_muxer="framecrc"
encfile="${outdir}/${test}.${enc_fmt}"
test $keep -ge 1 || cleanfiles="$cleanfiles $encfile"
tsrcfile=$(target_path $srcfile)
@@ -276,7 +278,7 @@ transcode(){
do_md5sum $encfile
echo $(wc -c $encfile)
ffmpeg $DEC_OPTS $final_decode -i $tencfile $ENC_OPTS $FLAGS $final_encode \
- -f framecrc - || return
+ -f $final_encode_muxer - || return
test -z "$ffprobe_opts" || \
run ffprobe${PROGSUF}${EXECSUF} -bitexact $ffprobe_opts $tencfile || return
}
-----------------------------------------------------------------------
Summary of changes:
libavcodec/packet.c | 20 +-
libavcodec/packet_internal.h | 2 +
libavformat/movenc.c | 9 -
libavformat/movenc_ttml.c | 155 +++++++++-
libavformat/version.h | 2 +-
tests/fate-run.sh | 4 +-
tests/fate/mov.mak | 21 ++
tests/ref/fate/mov-mp4-fragmented-ttml-dfxp | 430 ++++++++++++++++++++++++++++
tests/ref/fate/mov-mp4-fragmented-ttml-stpp | 430 ++++++++++++++++++++++++++++
9 files changed, 1053 insertions(+), 20 deletions(-)
create mode 100644 tests/ref/fate/mov-mp4-fragmented-ttml-dfxp
create mode 100644 tests/ref/fate/mov-mp4-fragmented-ttml-stpp
hooks/post-receive
--
1
0