* [FFmpeg-devel] [PATCH 02/21] fftools/ffmpeg_dec: simplify process_subtitle()
2023-06-14 16:48 [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
@ 2023-06-14 16:48 ` Anton Khirnov
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 03/21] tests/fate: rename ffmpeg-streamloop to ffmpeg-streamloop-copy Anton Khirnov
` (19 subsequent siblings)
20 siblings, 0 replies; 37+ messages in thread
From: Anton Khirnov @ 2023-06-14 16:48 UTC (permalink / raw)
To: ffmpeg-devel
Its got_output argument always points to 1.
---
fftools/ffmpeg.c | 3 +--
fftools/ffmpeg.h | 2 +-
fftools/ffmpeg_dec.c | 9 +++++----
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index d62ccc56c9..45e71ed626 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -731,7 +731,6 @@ cleanup:
static int fix_sub_duration_heartbeat(InputStream *ist, int64_t signal_pts)
{
int ret = AVERROR_BUG;
- int got_output = 1;
AVSubtitle *prev_subtitle = &ist->prev_sub.subtitle;
AVSubtitle subtitle;
@@ -744,7 +743,7 @@ static int fix_sub_duration_heartbeat(InputStream *ist, int64_t signal_pts)
subtitle.pts = signal_pts;
- return process_subtitle(ist, &subtitle, &got_output);
+ return process_subtitle(ist, &subtitle);
}
int trigger_fix_sub_duration_heartbeat(OutputStream *ost, const AVPacket *pkt)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 7b38812f74..7189629ad4 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -884,7 +884,7 @@ OutputStream *ost_iter(OutputStream *prev);
void close_output_stream(OutputStream *ost);
int trigger_fix_sub_duration_heartbeat(OutputStream *ost, const AVPacket *pkt);
-int process_subtitle(InputStream *ist, AVSubtitle *subtitle, int *got_output);
+int process_subtitle(InputStream *ist, AVSubtitle *subtitle);
void update_benchmark(const char *fmt, ...);
/**
diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index c0c242147f..6582917a39 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -328,8 +328,9 @@ static void sub2video_flush(InputStream *ist)
}
}
-int process_subtitle(InputStream *ist, AVSubtitle *subtitle, int *got_output)
+int process_subtitle(InputStream *ist, AVSubtitle *subtitle)
{
+ int got_output = 1;
int ret = 0;
if (ist->fix_sub_duration) {
@@ -345,13 +346,13 @@ int process_subtitle(InputStream *ist, AVSubtitle *subtitle, int *got_output)
ist->prev_sub.subtitle.end_display_time = end;
}
}
- FFSWAP(int, *got_output, ist->prev_sub.got_output);
+ FFSWAP(int, got_output, ist->prev_sub.got_output);
FFSWAP(AVSubtitle, *subtitle, ist->prev_sub.subtitle);
if (end <= 0)
goto out;
}
- if (!*got_output)
+ if (!got_output)
return 0;
for (int i = 0; i < ist->nb_filters; i++) {
@@ -402,7 +403,7 @@ static int transcode_subtitles(InputStream *ist, const AVPacket *pkt)
ist->frames_decoded++;
- return process_subtitle(ist, &subtitle, &got_output);
+ return process_subtitle(ist, &subtitle);
}
static int send_filter_eof(InputStream *ist)
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* [FFmpeg-devel] [PATCH 03/21] tests/fate: rename ffmpeg-streamloop to ffmpeg-streamloop-copy
2023-06-14 16:48 [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 02/21] fftools/ffmpeg_dec: simplify process_subtitle() Anton Khirnov
@ 2023-06-14 16:48 ` Anton Khirnov
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 04/21] tests/fate: add a test for -streamloop with transcoding video+audio Anton Khirnov
` (18 subsequent siblings)
20 siblings, 0 replies; 37+ messages in thread
From: Anton Khirnov @ 2023-06-14 16:48 UTC (permalink / raw)
To: ffmpeg-devel
Makes it clear that this tests -streamloop with streamcopy, to
distinguish it from further -streamloop tests added in future commits.
---
tests/fate/ffmpeg.mak | 4 ++--
tests/ref/fate/{ffmpeg-streamloop => ffmpeg-streamloop-copy} | 0
2 files changed, 2 insertions(+), 2 deletions(-)
rename tests/ref/fate/{ffmpeg-streamloop => ffmpeg-streamloop-copy} (100%)
diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
index 223bc97f8e..c26c748934 100644
--- a/tests/fate/ffmpeg.mak
+++ b/tests/fate/ffmpeg.mak
@@ -167,8 +167,8 @@ FATE_STREAMCOPY-$(call REMUX, PSP MOV, H264_PARSER H264_DECODER) += fate-copy-ps
fate-copy-psp: CMD = transcode "mov" $(TARGET_SAMPLES)/h264/wwwq_cut.mp4\
psp "-c copy" "-codec copy"
-FATE_STREAMCOPY-$(call FRAMEMD5, FLV, H264) += fate-ffmpeg-streamloop
-fate-ffmpeg-streamloop: CMD = framemd5 -stream_loop 2 -i $(TARGET_SAMPLES)/flv/streamloop.flv -c copy
+FATE_STREAMCOPY-$(call FRAMEMD5, FLV, H264) += fate-ffmpeg-streamloop-copy
+fate-ffmpeg-streamloop-copy: CMD = framemd5 -stream_loop 2 -i $(TARGET_SAMPLES)/flv/streamloop.flv -c copy
tests/data/audio_shorter_than_video.nut: TAG = GEN
tests/data/audio_shorter_than_video.nut: tests/data/vsynth_lena.yuv
diff --git a/tests/ref/fate/ffmpeg-streamloop b/tests/ref/fate/ffmpeg-streamloop-copy
similarity index 100%
rename from tests/ref/fate/ffmpeg-streamloop
rename to tests/ref/fate/ffmpeg-streamloop-copy
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* [FFmpeg-devel] [PATCH 04/21] tests/fate: add a test for -streamloop with transcoding video+audio
2023-06-14 16:48 [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 02/21] fftools/ffmpeg_dec: simplify process_subtitle() Anton Khirnov
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 03/21] tests/fate: rename ffmpeg-streamloop to ffmpeg-streamloop-copy Anton Khirnov
@ 2023-06-14 16:48 ` Anton Khirnov
2023-06-14 16:57 ` Andreas Rheinhardt
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 05/21] fftools/ffmpeg_demux: move the loop out of add_input_streams() Anton Khirnov
` (17 subsequent siblings)
20 siblings, 1 reply; 37+ messages in thread
From: Anton Khirnov @ 2023-06-14 16:48 UTC (permalink / raw)
To: ffmpeg-devel
---
tests/fate/ffmpeg.mak | 6 +
tests/ref/fate/ffmpeg-streamloop-transcode-av | 151 ++++++++++++++++++
2 files changed, 157 insertions(+)
create mode 100644 tests/ref/fate/ffmpeg-streamloop-transcode-av
diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
index c26c748934..b97f5ba974 100644
--- a/tests/fate/ffmpeg.mak
+++ b/tests/fate/ffmpeg.mak
@@ -132,6 +132,12 @@ fate-ffmpeg-fix_sub_duration_heartbeat: CMD = fmtstdout srt -fix_sub_duration \
-c:s srt \
-f null -
+FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MATROSKA, H264 AAC, VOLUME_FILTER) += fate-ffmpeg-streamloop-transcode-av
+# audio is float and we don't care about the contents, only timestamps and frame sizes,
+# so zero the data
+fate-ffmpeg-streamloop-transcode-av: CMD = \
+ framecrc -auto_conversion_filters -stream_loop 3 -i $(TARGET_SAMPLES)/mkv/1242-small.mkv -af volume=0
+
FATE_STREAMCOPY-$(call REMUX, MP4 MOV, EAC3_DEMUXER) += fate-copy-trac3074
fate-copy-trac3074: CMD = transcode eac3 $(TARGET_SAMPLES)/eac3/csi_miami_stereo_128_spx.eac3\
mp4 "-codec copy -map 0" "-codec copy"
diff --git a/tests/ref/fate/ffmpeg-streamloop-transcode-av b/tests/ref/fate/ffmpeg-streamloop-transcode-av
new file mode 100644
index 0000000000..bd2d50c4cf
--- /dev/null
+++ b/tests/ref/fate/ffmpeg-streamloop-transcode-av
@@ -0,0 +1,151 @@
+#tb 0: 125/2997
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 1280x718
+#sar 0: 1/1
+#tb 1: 1/48000
+#media_type 1: audio
+#codec_id 1: pcm_s16le
+#sample_rate 1: 48000
+#channel_layout_name 1: stereo
+0, 0, 0, 1, 1378560, 0xbaf121ba
+1, 0, 0, 1024, 4096, 0x00000000
+1, 1024, 1024, 1024, 4096, 0x00000000
+0, 1, 1, 1, 1378560, 0xbaf121ba
+1, 2040, 2040, 1024, 4096, 0x00000000
+1, 3048, 3048, 1024, 4096, 0x00000000
+0, 2, 2, 1, 1378560, 0x6579d31a
+1, 4072, 4072, 1024, 4096, 0x00000000
+1, 5096, 5096, 1024, 4096, 0x00000000
+0, 3, 3, 1, 1378560, 0xca1deba8
+1, 6120, 6120, 1024, 4096, 0x00000000
+1, 7128, 7128, 1024, 4096, 0x00000000
+0, 4, 4, 1, 1378560, 0xd4eed467
+1, 8208, 8208, 1024, 4096, 0x00000000
+1, 9232, 9232, 1024, 4096, 0x00000000
+0, 5, 5, 1, 1378560, 0xd6e1d5b7
+1, 10248, 10248, 1024, 4096, 0x00000000
+1, 11256, 11256, 1024, 4096, 0x00000000
+0, 6, 6, 1, 1378560, 0x0b574d39
+1, 12280, 12280, 1024, 4096, 0x00000000
+1, 13304, 13304, 1024, 4096, 0x00000000
+0, 7, 7, 1, 1378560, 0x1bdd4d61
+1, 14328, 14328, 1024, 4096, 0x00000000
+1, 15336, 15336, 1024, 4096, 0x00000000
+0, 8, 8, 1, 1378560, 0x3b28f549
+1, 16360, 16360, 1024, 4096, 0x00000000
+1, 17384, 17384, 1024, 4096, 0x00000000
+0, 9, 9, 1, 1378560, 0x45b2f57b
+1, 18408, 18408, 1024, 4096, 0x00000000
+1, 19416, 19416, 1024, 4096, 0x00000000
+0, 10, 10, 1, 1378560, 0x8955570e
+1, 20440, 20440, 1024, 4096, 0x00000000
+1, 21464, 21464, 1024, 4096, 0x00000000
+1, 22488, 22488, 1024, 4096, 0x00000000
+1, 23496, 23496, 1024, 4096, 0x00000000
+0, 12, 12, 1, 1378560, 0x9c598000
+1, 25488, 25488, 1024, 4096, 0x00000000
+0, 13, 13, 1, 1378560, 0xbaf121ba
+1, 26512, 26512, 1024, 4096, 0x00000000
+1, 27528, 27528, 1024, 4096, 0x00000000
+0, 14, 14, 1, 1378560, 0xbaf121ba
+1, 28552, 28552, 1024, 4096, 0x00000000
+1, 29576, 29576, 1024, 4096, 0x00000000
+0, 15, 15, 1, 1378560, 0x6579d31a
+1, 30600, 30600, 1024, 4096, 0x00000000
+1, 31608, 31608, 1024, 4096, 0x00000000
+0, 16, 16, 1, 1378560, 0xca1deba8
+1, 32688, 32688, 1024, 4096, 0x00000000
+1, 33712, 33712, 1024, 4096, 0x00000000
+0, 17, 17, 1, 1378560, 0xd4eed467
+1, 34728, 34728, 1024, 4096, 0x00000000
+1, 35736, 35736, 1024, 4096, 0x00000000
+0, 18, 18, 1, 1378560, 0xd6e1d5b7
+1, 36760, 36760, 1024, 4096, 0x00000000
+1, 37784, 37784, 1024, 4096, 0x00000000
+0, 19, 19, 1, 1378560, 0x0b574d39
+1, 38808, 38808, 1024, 4096, 0x00000000
+1, 39816, 39816, 1024, 4096, 0x00000000
+0, 20, 20, 1, 1378560, 0x1bdd4d61
+1, 40840, 40840, 1024, 4096, 0x00000000
+1, 41864, 41864, 1024, 4096, 0x00000000
+0, 21, 21, 1, 1378560, 0x3b28f549
+1, 42888, 42888, 1024, 4096, 0x00000000
+1, 43896, 43896, 1024, 4096, 0x00000000
+0, 22, 22, 1, 1378560, 0x45b2f57b
+1, 44920, 44920, 1024, 4096, 0x00000000
+1, 45944, 45944, 1024, 4096, 0x00000000
+0, 23, 23, 1, 1378560, 0x8955570e
+1, 46968, 46968, 1024, 4096, 0x00000000
+1, 47976, 47976, 1024, 4096, 0x00000000
+0, 24, 24, 1, 1378560, 0x9c598000
+1, 49968, 49968, 1024, 4096, 0x00000000
+0, 25, 25, 1, 1378560, 0xbaf121ba
+1, 50992, 50992, 1024, 4096, 0x00000000
+1, 52008, 52008, 1024, 4096, 0x00000000
+0, 26, 26, 1, 1378560, 0xbaf121ba
+1, 53032, 53032, 1024, 4096, 0x00000000
+0, 27, 27, 1, 1378560, 0x6579d31a
+1, 54056, 54056, 1024, 4096, 0x00000000
+1, 55080, 55080, 1024, 4096, 0x00000000
+0, 28, 28, 1, 1378560, 0xca1deba8
+1, 56088, 56088, 1024, 4096, 0x00000000
+1, 57168, 57168, 1024, 4096, 0x00000000
+0, 29, 29, 1, 1378560, 0xd4eed467
+1, 58192, 58192, 1024, 4096, 0x00000000
+1, 59208, 59208, 1024, 4096, 0x00000000
+0, 30, 30, 1, 1378560, 0xd6e1d5b7
+1, 60216, 60216, 1024, 4096, 0x00000000
+1, 61240, 61240, 1024, 4096, 0x00000000
+0, 31, 31, 1, 1378560, 0x0b574d39
+1, 62264, 62264, 1024, 4096, 0x00000000
+1, 63288, 63288, 1024, 4096, 0x00000000
+0, 32, 32, 1, 1378560, 0x1bdd4d61
+1, 64296, 64296, 1024, 4096, 0x00000000
+1, 65320, 65320, 1024, 4096, 0x00000000
+0, 33, 33, 1, 1378560, 0x3b28f549
+1, 66344, 66344, 1024, 4096, 0x00000000
+1, 67368, 67368, 1024, 4096, 0x00000000
+0, 34, 34, 1, 1378560, 0x45b2f57b
+1, 68376, 68376, 1024, 4096, 0x00000000
+1, 69400, 69400, 1024, 4096, 0x00000000
+0, 35, 35, 1, 1378560, 0x8955570e
+1, 70424, 70424, 1024, 4096, 0x00000000
+1, 71448, 71448, 1024, 4096, 0x00000000
+0, 36, 36, 1, 1378560, 0x9c598000
+1, 72456, 72456, 1024, 4096, 0x00000000
+0, 37, 37, 1, 1378560, 0xbaf121ba
+1, 74448, 74448, 1024, 4096, 0x00000000
+1, 75472, 75472, 1024, 4096, 0x00000000
+0, 38, 38, 1, 1378560, 0xbaf121ba
+1, 76488, 76488, 1024, 4096, 0x00000000
+1, 77512, 77512, 1024, 4096, 0x00000000
+0, 39, 39, 1, 1378560, 0x6579d31a
+1, 78536, 78536, 1024, 4096, 0x00000000
+1, 79560, 79560, 1024, 4096, 0x00000000
+0, 40, 40, 1, 1378560, 0xca1deba8
+1, 80568, 80568, 1024, 4096, 0x00000000
+1, 81648, 81648, 1024, 4096, 0x00000000
+0, 41, 41, 1, 1378560, 0xd4eed467
+1, 82672, 82672, 1024, 4096, 0x00000000
+1, 83688, 83688, 1024, 4096, 0x00000000
+0, 42, 42, 1, 1378560, 0xd6e1d5b7
+1, 84696, 84696, 1024, 4096, 0x00000000
+1, 85720, 85720, 1024, 4096, 0x00000000
+0, 43, 43, 1, 1378560, 0x0b574d39
+1, 86744, 86744, 1024, 4096, 0x00000000
+1, 87768, 87768, 1024, 4096, 0x00000000
+0, 44, 44, 1, 1378560, 0x1bdd4d61
+1, 88776, 88776, 1024, 4096, 0x00000000
+1, 89800, 89800, 1024, 4096, 0x00000000
+0, 45, 45, 1, 1378560, 0x3b28f549
+1, 90824, 90824, 1024, 4096, 0x00000000
+1, 91848, 91848, 1024, 4096, 0x00000000
+0, 46, 46, 1, 1378560, 0x45b2f57b
+1, 92856, 92856, 1024, 4096, 0x00000000
+1, 93880, 93880, 1024, 4096, 0x00000000
+0, 47, 47, 1, 1378560, 0x8955570e
+1, 94904, 94904, 1024, 4096, 0x00000000
+1, 95928, 95928, 1024, 4096, 0x00000000
+1, 96936, 96936, 1024, 4096, 0x00000000
+0, 49, 49, 1, 1378560, 0x9c598000
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [FFmpeg-devel] [PATCH 04/21] tests/fate: add a test for -streamloop with transcoding video+audio
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 04/21] tests/fate: add a test for -streamloop with transcoding video+audio Anton Khirnov
@ 2023-06-14 16:57 ` Andreas Rheinhardt
2023-06-16 6:01 ` [FFmpeg-devel] [PATCH 04/21 v2] " Anton Khirnov
0 siblings, 1 reply; 37+ messages in thread
From: Andreas Rheinhardt @ 2023-06-14 16:57 UTC (permalink / raw)
To: ffmpeg-devel
Anton Khirnov:
> ---
> tests/fate/ffmpeg.mak | 6 +
> tests/ref/fate/ffmpeg-streamloop-transcode-av | 151 ++++++++++++++++++
> 2 files changed, 157 insertions(+)
> create mode 100644 tests/ref/fate/ffmpeg-streamloop-transcode-av
>
> diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
> index c26c748934..b97f5ba974 100644
> --- a/tests/fate/ffmpeg.mak
> +++ b/tests/fate/ffmpeg.mak
> @@ -132,6 +132,12 @@ fate-ffmpeg-fix_sub_duration_heartbeat: CMD = fmtstdout srt -fix_sub_duration \
> -c:s srt \
> -f null -
>
> +FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MATROSKA, H264 AAC, VOLUME_FILTER) += fate-ffmpeg-streamloop-transcode-av
> +# audio is float and we don't care about the contents, only timestamps and frame sizes,
> +# so zero the data
We have a fixed-point AAC decoder.
> +fate-ffmpeg-streamloop-transcode-av: CMD = \
> + framecrc -auto_conversion_filters -stream_loop 3 -i $(TARGET_SAMPLES)/mkv/1242-small.mkv -af volume=0
> +
> FATE_STREAMCOPY-$(call REMUX, MP4 MOV, EAC3_DEMUXER) += fate-copy-trac3074
> fate-copy-trac3074: CMD = transcode eac3 $(TARGET_SAMPLES)/eac3/csi_miami_stereo_128_spx.eac3\
> mp4 "-codec copy -map 0" "-codec copy"
> diff --git a/tests/ref/fate/ffmpeg-streamloop-transcode-av b/tests/ref/fate/ffmpeg-streamloop-transcode-av
> new file mode 100644
> index 0000000000..bd2d50c4cf
> --- /dev/null
> +++ b/tests/ref/fate/ffmpeg-streamloop-transcode-av
> @@ -0,0 +1,151 @@
> +#tb 0: 125/2997
> +#media_type 0: video
> +#codec_id 0: rawvideo
> +#dimensions 0: 1280x718
> +#sar 0: 1/1
> +#tb 1: 1/48000
> +#media_type 1: audio
> +#codec_id 1: pcm_s16le
> +#sample_rate 1: 48000
> +#channel_layout_name 1: stereo
> +0, 0, 0, 1, 1378560, 0xbaf121ba
> +1, 0, 0, 1024, 4096, 0x00000000
> +1, 1024, 1024, 1024, 4096, 0x00000000
> +0, 1, 1, 1, 1378560, 0xbaf121ba
> +1, 2040, 2040, 1024, 4096, 0x00000000
> +1, 3048, 3048, 1024, 4096, 0x00000000
> +0, 2, 2, 1, 1378560, 0x6579d31a
> +1, 4072, 4072, 1024, 4096, 0x00000000
> +1, 5096, 5096, 1024, 4096, 0x00000000
> +0, 3, 3, 1, 1378560, 0xca1deba8
> +1, 6120, 6120, 1024, 4096, 0x00000000
> +1, 7128, 7128, 1024, 4096, 0x00000000
> +0, 4, 4, 1, 1378560, 0xd4eed467
> +1, 8208, 8208, 1024, 4096, 0x00000000
> +1, 9232, 9232, 1024, 4096, 0x00000000
> +0, 5, 5, 1, 1378560, 0xd6e1d5b7
> +1, 10248, 10248, 1024, 4096, 0x00000000
> +1, 11256, 11256, 1024, 4096, 0x00000000
> +0, 6, 6, 1, 1378560, 0x0b574d39
> +1, 12280, 12280, 1024, 4096, 0x00000000
> +1, 13304, 13304, 1024, 4096, 0x00000000
> +0, 7, 7, 1, 1378560, 0x1bdd4d61
> +1, 14328, 14328, 1024, 4096, 0x00000000
> +1, 15336, 15336, 1024, 4096, 0x00000000
> +0, 8, 8, 1, 1378560, 0x3b28f549
> +1, 16360, 16360, 1024, 4096, 0x00000000
> +1, 17384, 17384, 1024, 4096, 0x00000000
> +0, 9, 9, 1, 1378560, 0x45b2f57b
> +1, 18408, 18408, 1024, 4096, 0x00000000
> +1, 19416, 19416, 1024, 4096, 0x00000000
> +0, 10, 10, 1, 1378560, 0x8955570e
> +1, 20440, 20440, 1024, 4096, 0x00000000
> +1, 21464, 21464, 1024, 4096, 0x00000000
> +1, 22488, 22488, 1024, 4096, 0x00000000
> +1, 23496, 23496, 1024, 4096, 0x00000000
> +0, 12, 12, 1, 1378560, 0x9c598000
> +1, 25488, 25488, 1024, 4096, 0x00000000
> +0, 13, 13, 1, 1378560, 0xbaf121ba
> +1, 26512, 26512, 1024, 4096, 0x00000000
> +1, 27528, 27528, 1024, 4096, 0x00000000
> +0, 14, 14, 1, 1378560, 0xbaf121ba
> +1, 28552, 28552, 1024, 4096, 0x00000000
> +1, 29576, 29576, 1024, 4096, 0x00000000
> +0, 15, 15, 1, 1378560, 0x6579d31a
> +1, 30600, 30600, 1024, 4096, 0x00000000
> +1, 31608, 31608, 1024, 4096, 0x00000000
> +0, 16, 16, 1, 1378560, 0xca1deba8
> +1, 32688, 32688, 1024, 4096, 0x00000000
> +1, 33712, 33712, 1024, 4096, 0x00000000
> +0, 17, 17, 1, 1378560, 0xd4eed467
> +1, 34728, 34728, 1024, 4096, 0x00000000
> +1, 35736, 35736, 1024, 4096, 0x00000000
> +0, 18, 18, 1, 1378560, 0xd6e1d5b7
> +1, 36760, 36760, 1024, 4096, 0x00000000
> +1, 37784, 37784, 1024, 4096, 0x00000000
> +0, 19, 19, 1, 1378560, 0x0b574d39
> +1, 38808, 38808, 1024, 4096, 0x00000000
> +1, 39816, 39816, 1024, 4096, 0x00000000
> +0, 20, 20, 1, 1378560, 0x1bdd4d61
> +1, 40840, 40840, 1024, 4096, 0x00000000
> +1, 41864, 41864, 1024, 4096, 0x00000000
> +0, 21, 21, 1, 1378560, 0x3b28f549
> +1, 42888, 42888, 1024, 4096, 0x00000000
> +1, 43896, 43896, 1024, 4096, 0x00000000
> +0, 22, 22, 1, 1378560, 0x45b2f57b
> +1, 44920, 44920, 1024, 4096, 0x00000000
> +1, 45944, 45944, 1024, 4096, 0x00000000
> +0, 23, 23, 1, 1378560, 0x8955570e
> +1, 46968, 46968, 1024, 4096, 0x00000000
> +1, 47976, 47976, 1024, 4096, 0x00000000
> +0, 24, 24, 1, 1378560, 0x9c598000
> +1, 49968, 49968, 1024, 4096, 0x00000000
> +0, 25, 25, 1, 1378560, 0xbaf121ba
> +1, 50992, 50992, 1024, 4096, 0x00000000
> +1, 52008, 52008, 1024, 4096, 0x00000000
> +0, 26, 26, 1, 1378560, 0xbaf121ba
> +1, 53032, 53032, 1024, 4096, 0x00000000
> +0, 27, 27, 1, 1378560, 0x6579d31a
> +1, 54056, 54056, 1024, 4096, 0x00000000
> +1, 55080, 55080, 1024, 4096, 0x00000000
> +0, 28, 28, 1, 1378560, 0xca1deba8
> +1, 56088, 56088, 1024, 4096, 0x00000000
> +1, 57168, 57168, 1024, 4096, 0x00000000
> +0, 29, 29, 1, 1378560, 0xd4eed467
> +1, 58192, 58192, 1024, 4096, 0x00000000
> +1, 59208, 59208, 1024, 4096, 0x00000000
> +0, 30, 30, 1, 1378560, 0xd6e1d5b7
> +1, 60216, 60216, 1024, 4096, 0x00000000
> +1, 61240, 61240, 1024, 4096, 0x00000000
> +0, 31, 31, 1, 1378560, 0x0b574d39
> +1, 62264, 62264, 1024, 4096, 0x00000000
> +1, 63288, 63288, 1024, 4096, 0x00000000
> +0, 32, 32, 1, 1378560, 0x1bdd4d61
> +1, 64296, 64296, 1024, 4096, 0x00000000
> +1, 65320, 65320, 1024, 4096, 0x00000000
> +0, 33, 33, 1, 1378560, 0x3b28f549
> +1, 66344, 66344, 1024, 4096, 0x00000000
> +1, 67368, 67368, 1024, 4096, 0x00000000
> +0, 34, 34, 1, 1378560, 0x45b2f57b
> +1, 68376, 68376, 1024, 4096, 0x00000000
> +1, 69400, 69400, 1024, 4096, 0x00000000
> +0, 35, 35, 1, 1378560, 0x8955570e
> +1, 70424, 70424, 1024, 4096, 0x00000000
> +1, 71448, 71448, 1024, 4096, 0x00000000
> +0, 36, 36, 1, 1378560, 0x9c598000
> +1, 72456, 72456, 1024, 4096, 0x00000000
> +0, 37, 37, 1, 1378560, 0xbaf121ba
> +1, 74448, 74448, 1024, 4096, 0x00000000
> +1, 75472, 75472, 1024, 4096, 0x00000000
> +0, 38, 38, 1, 1378560, 0xbaf121ba
> +1, 76488, 76488, 1024, 4096, 0x00000000
> +1, 77512, 77512, 1024, 4096, 0x00000000
> +0, 39, 39, 1, 1378560, 0x6579d31a
> +1, 78536, 78536, 1024, 4096, 0x00000000
> +1, 79560, 79560, 1024, 4096, 0x00000000
> +0, 40, 40, 1, 1378560, 0xca1deba8
> +1, 80568, 80568, 1024, 4096, 0x00000000
> +1, 81648, 81648, 1024, 4096, 0x00000000
> +0, 41, 41, 1, 1378560, 0xd4eed467
> +1, 82672, 82672, 1024, 4096, 0x00000000
> +1, 83688, 83688, 1024, 4096, 0x00000000
> +0, 42, 42, 1, 1378560, 0xd6e1d5b7
> +1, 84696, 84696, 1024, 4096, 0x00000000
> +1, 85720, 85720, 1024, 4096, 0x00000000
> +0, 43, 43, 1, 1378560, 0x0b574d39
> +1, 86744, 86744, 1024, 4096, 0x00000000
> +1, 87768, 87768, 1024, 4096, 0x00000000
> +0, 44, 44, 1, 1378560, 0x1bdd4d61
> +1, 88776, 88776, 1024, 4096, 0x00000000
> +1, 89800, 89800, 1024, 4096, 0x00000000
> +0, 45, 45, 1, 1378560, 0x3b28f549
> +1, 90824, 90824, 1024, 4096, 0x00000000
> +1, 91848, 91848, 1024, 4096, 0x00000000
> +0, 46, 46, 1, 1378560, 0x45b2f57b
> +1, 92856, 92856, 1024, 4096, 0x00000000
> +1, 93880, 93880, 1024, 4096, 0x00000000
> +0, 47, 47, 1, 1378560, 0x8955570e
> +1, 94904, 94904, 1024, 4096, 0x00000000
> +1, 95928, 95928, 1024, 4096, 0x00000000
> +1, 96936, 96936, 1024, 4096, 0x00000000
> +0, 49, 49, 1, 1378560, 0x9c598000
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* [FFmpeg-devel] [PATCH 04/21 v2] tests/fate: add a test for -streamloop with transcoding video+audio
2023-06-14 16:57 ` Andreas Rheinhardt
@ 2023-06-16 6:01 ` Anton Khirnov
2023-06-19 10:52 ` "zhilizhao(赵志立)"
2023-06-19 12:29 ` James Almer
0 siblings, 2 replies; 37+ messages in thread
From: Anton Khirnov @ 2023-06-16 6:01 UTC (permalink / raw)
To: ffmpeg-devel
---
Now using aacdec_fixed with s32le output
---
tests/fate/ffmpeg.mak | 4 +
tests/ref/fate/ffmpeg-streamloop-transcode-av | 151 ++++++++++++++++++
2 files changed, 155 insertions(+)
create mode 100644 tests/ref/fate/ffmpeg-streamloop-transcode-av
diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
index c26c748934..87cd0b46d0 100644
--- a/tests/fate/ffmpeg.mak
+++ b/tests/fate/ffmpeg.mak
@@ -132,6 +132,10 @@ fate-ffmpeg-fix_sub_duration_heartbeat: CMD = fmtstdout srt -fix_sub_duration \
-c:s srt \
-f null -
+FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MATROSKA, H264 AAC_FIXED, PCM_S32LE_ENCODER) += fate-ffmpeg-streamloop-transcode-av
+fate-ffmpeg-streamloop-transcode-av: CMD = \
+ framecrc -auto_conversion_filters -stream_loop 3 -i $(TARGET_SAMPLES)/mkv/1242-small.mkv -c:a pcm_s32le
+
FATE_STREAMCOPY-$(call REMUX, MP4 MOV, EAC3_DEMUXER) += fate-copy-trac3074
fate-copy-trac3074: CMD = transcode eac3 $(TARGET_SAMPLES)/eac3/csi_miami_stereo_128_spx.eac3\
mp4 "-codec copy -map 0" "-codec copy"
diff --git a/tests/ref/fate/ffmpeg-streamloop-transcode-av b/tests/ref/fate/ffmpeg-streamloop-transcode-av
new file mode 100644
index 0000000000..50a626b281
--- /dev/null
+++ b/tests/ref/fate/ffmpeg-streamloop-transcode-av
@@ -0,0 +1,151 @@
+#tb 0: 125/2997
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 1280x718
+#sar 0: 1/1
+#tb 1: 1/48000
+#media_type 1: audio
+#codec_id 1: pcm_s32le
+#sample_rate 1: 48000
+#channel_layout_name 1: stereo
+0, 0, 0, 1, 1378560, 0xbaf121ba
+1, 0, 0, 1024, 8192, 0x00000000
+1, 1024, 1024, 1024, 8192, 0x00000000
+0, 1, 1, 1, 1378560, 0xbaf121ba
+1, 2040, 2040, 1024, 8192, 0x00000000
+1, 3048, 3048, 1024, 8192, 0x00000000
+0, 2, 2, 1, 1378560, 0x6579d31a
+1, 4072, 4072, 1024, 8192, 0x00000000
+1, 5096, 5096, 1024, 8192, 0x00000000
+0, 3, 3, 1, 1378560, 0xca1deba8
+1, 6120, 6120, 1024, 8192, 0x687330d2
+1, 7128, 7128, 1024, 8192, 0x9131462c
+0, 4, 4, 1, 1378560, 0xd4eed467
+1, 8208, 8208, 1024, 8192, 0x48c01c32
+1, 9232, 9232, 1024, 8192, 0x0ccd8d5f
+0, 5, 5, 1, 1378560, 0xd6e1d5b7
+1, 10248, 10248, 1024, 8192, 0xd50cbe9f
+1, 11256, 11256, 1024, 8192, 0xbe069303
+0, 6, 6, 1, 1378560, 0x0b574d39
+1, 12280, 12280, 1024, 8192, 0x85fccf5b
+1, 13304, 13304, 1024, 8192, 0x4180de71
+0, 7, 7, 1, 1378560, 0x1bdd4d61
+1, 14328, 14328, 1024, 8192, 0x0e9b6ac3
+1, 15336, 15336, 1024, 8192, 0x5c33f724
+0, 8, 8, 1, 1378560, 0x3b28f549
+1, 16360, 16360, 1024, 8192, 0x668aaaec
+1, 17384, 17384, 1024, 8192, 0xd137d412
+0, 9, 9, 1, 1378560, 0x45b2f57b
+1, 18408, 18408, 1024, 8192, 0x08e1fbf6
+1, 19416, 19416, 1024, 8192, 0xbf3fb4f6
+0, 10, 10, 1, 1378560, 0x8955570e
+1, 20440, 20440, 1024, 8192, 0x69cd08a4
+1, 21464, 21464, 1024, 8192, 0xe0fe6297
+1, 22488, 22488, 1024, 8192, 0x172867ad
+1, 23496, 23496, 1024, 8192, 0xcbcc1461
+0, 12, 12, 1, 1378560, 0x9c598000
+1, 25488, 25488, 1024, 8192, 0x00000000
+0, 13, 13, 1, 1378560, 0xbaf121ba
+1, 26512, 26512, 1024, 8192, 0x00000000
+1, 27528, 27528, 1024, 8192, 0x00000000
+0, 14, 14, 1, 1378560, 0xbaf121ba
+1, 28552, 28552, 1024, 8192, 0x00000000
+1, 29576, 29576, 1024, 8192, 0x00000000
+0, 15, 15, 1, 1378560, 0x6579d31a
+1, 30600, 30600, 1024, 8192, 0x687330d2
+1, 31608, 31608, 1024, 8192, 0x9131462c
+0, 16, 16, 1, 1378560, 0xca1deba8
+1, 32688, 32688, 1024, 8192, 0x48c01c32
+1, 33712, 33712, 1024, 8192, 0x0ccd8d5f
+0, 17, 17, 1, 1378560, 0xd4eed467
+1, 34728, 34728, 1024, 8192, 0xd50cbe9f
+1, 35736, 35736, 1024, 8192, 0xbe069303
+0, 18, 18, 1, 1378560, 0xd6e1d5b7
+1, 36760, 36760, 1024, 8192, 0x85fccf5b
+1, 37784, 37784, 1024, 8192, 0x4180de71
+0, 19, 19, 1, 1378560, 0x0b574d39
+1, 38808, 38808, 1024, 8192, 0x0e9b6ac3
+1, 39816, 39816, 1024, 8192, 0x5c33f724
+0, 20, 20, 1, 1378560, 0x1bdd4d61
+1, 40840, 40840, 1024, 8192, 0x668aaaec
+1, 41864, 41864, 1024, 8192, 0xd137d412
+0, 21, 21, 1, 1378560, 0x3b28f549
+1, 42888, 42888, 1024, 8192, 0x08e1fbf6
+1, 43896, 43896, 1024, 8192, 0xbf3fb4f6
+0, 22, 22, 1, 1378560, 0x45b2f57b
+1, 44920, 44920, 1024, 8192, 0x69cd08a4
+1, 45944, 45944, 1024, 8192, 0xe0fe6297
+0, 23, 23, 1, 1378560, 0x8955570e
+1, 46968, 46968, 1024, 8192, 0x172867ad
+1, 47976, 47976, 1024, 8192, 0xcbcc1461
+0, 24, 24, 1, 1378560, 0x9c598000
+1, 49968, 49968, 1024, 8192, 0x00000000
+0, 25, 25, 1, 1378560, 0xbaf121ba
+1, 50992, 50992, 1024, 8192, 0x00000000
+1, 52008, 52008, 1024, 8192, 0x00000000
+0, 26, 26, 1, 1378560, 0xbaf121ba
+1, 53032, 53032, 1024, 8192, 0x00000000
+0, 27, 27, 1, 1378560, 0x6579d31a
+1, 54056, 54056, 1024, 8192, 0x00000000
+1, 55080, 55080, 1024, 8192, 0x687330d2
+0, 28, 28, 1, 1378560, 0xca1deba8
+1, 56088, 56088, 1024, 8192, 0x9131462c
+1, 57168, 57168, 1024, 8192, 0x48c01c32
+0, 29, 29, 1, 1378560, 0xd4eed467
+1, 58192, 58192, 1024, 8192, 0x0ccd8d5f
+1, 59208, 59208, 1024, 8192, 0xd50cbe9f
+0, 30, 30, 1, 1378560, 0xd6e1d5b7
+1, 60216, 60216, 1024, 8192, 0xbe069303
+1, 61240, 61240, 1024, 8192, 0x85fccf5b
+0, 31, 31, 1, 1378560, 0x0b574d39
+1, 62264, 62264, 1024, 8192, 0x4180de71
+1, 63288, 63288, 1024, 8192, 0x0e9b6ac3
+0, 32, 32, 1, 1378560, 0x1bdd4d61
+1, 64296, 64296, 1024, 8192, 0x5c33f724
+1, 65320, 65320, 1024, 8192, 0x668aaaec
+0, 33, 33, 1, 1378560, 0x3b28f549
+1, 66344, 66344, 1024, 8192, 0xd137d412
+1, 67368, 67368, 1024, 8192, 0x08e1fbf6
+0, 34, 34, 1, 1378560, 0x45b2f57b
+1, 68376, 68376, 1024, 8192, 0xbf3fb4f6
+1, 69400, 69400, 1024, 8192, 0x69cd08a4
+0, 35, 35, 1, 1378560, 0x8955570e
+1, 70424, 70424, 1024, 8192, 0xe0fe6297
+1, 71448, 71448, 1024, 8192, 0x172867ad
+0, 36, 36, 1, 1378560, 0x9c598000
+1, 72456, 72456, 1024, 8192, 0xcbcc1461
+0, 37, 37, 1, 1378560, 0xbaf121ba
+1, 74448, 74448, 1024, 8192, 0x00000000
+1, 75472, 75472, 1024, 8192, 0x00000000
+0, 38, 38, 1, 1378560, 0xbaf121ba
+1, 76488, 76488, 1024, 8192, 0x00000000
+1, 77512, 77512, 1024, 8192, 0x00000000
+0, 39, 39, 1, 1378560, 0x6579d31a
+1, 78536, 78536, 1024, 8192, 0x00000000
+1, 79560, 79560, 1024, 8192, 0x687330d2
+0, 40, 40, 1, 1378560, 0xca1deba8
+1, 80568, 80568, 1024, 8192, 0x9131462c
+1, 81648, 81648, 1024, 8192, 0x48c01c32
+0, 41, 41, 1, 1378560, 0xd4eed467
+1, 82672, 82672, 1024, 8192, 0x0ccd8d5f
+1, 83688, 83688, 1024, 8192, 0xd50cbe9f
+0, 42, 42, 1, 1378560, 0xd6e1d5b7
+1, 84696, 84696, 1024, 8192, 0xbe069303
+1, 85720, 85720, 1024, 8192, 0x85fccf5b
+0, 43, 43, 1, 1378560, 0x0b574d39
+1, 86744, 86744, 1024, 8192, 0x4180de71
+1, 87768, 87768, 1024, 8192, 0x0e9b6ac3
+0, 44, 44, 1, 1378560, 0x1bdd4d61
+1, 88776, 88776, 1024, 8192, 0x5c33f724
+1, 89800, 89800, 1024, 8192, 0x668aaaec
+0, 45, 45, 1, 1378560, 0x3b28f549
+1, 90824, 90824, 1024, 8192, 0xd137d412
+1, 91848, 91848, 1024, 8192, 0x08e1fbf6
+0, 46, 46, 1, 1378560, 0x45b2f57b
+1, 92856, 92856, 1024, 8192, 0xbf3fb4f6
+1, 93880, 93880, 1024, 8192, 0x69cd08a4
+0, 47, 47, 1, 1378560, 0x8955570e
+1, 94904, 94904, 1024, 8192, 0xe0fe6297
+1, 95928, 95928, 1024, 8192, 0x172867ad
+1, 96936, 96936, 1024, 8192, 0xcbcc1461
+0, 49, 49, 1, 1378560, 0x9c598000
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [FFmpeg-devel] [PATCH 04/21 v2] tests/fate: add a test for -streamloop with transcoding video+audio
2023-06-16 6:01 ` [FFmpeg-devel] [PATCH 04/21 v2] " Anton Khirnov
@ 2023-06-19 10:52 ` "zhilizhao(赵志立)"
2023-06-19 12:29 ` James Almer
1 sibling, 0 replies; 37+ messages in thread
From: "zhilizhao(赵志立)" @ 2023-06-19 10:52 UTC (permalink / raw)
To: FFmpeg development discussions and patches
> On Jun 16, 2023, at 14:01, Anton Khirnov <anton@khirnov.net> wrote:
>
> ---
> Now using aacdec_fixed with s32le output
> ---
> tests/fate/ffmpeg.mak | 4 +
> tests/ref/fate/ffmpeg-streamloop-transcode-av | 151 ++++++++++++++++++
> 2 files changed, 155 insertions(+)
> create mode 100644 tests/ref/fate/ffmpeg-streamloop-transcode-av
>
> diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
> index c26c748934..87cd0b46d0 100644
> --- a/tests/fate/ffmpeg.mak
> +++ b/tests/fate/ffmpeg.mak
> @@ -132,6 +132,10 @@ fate-ffmpeg-fix_sub_duration_heartbeat: CMD = fmtstdout srt -fix_sub_duration \
> -c:s srt \
> -f null -
>
> +FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MATROSKA, H264 AAC_FIXED, PCM_S32LE_ENCODER) += fate-ffmpeg-streamloop-transcode-av
> +fate-ffmpeg-streamloop-transcode-av: CMD = \
> + framecrc -auto_conversion_filters -stream_loop 3 -i $(TARGET_SAMPLES)/mkv/1242-small.mkv -c:a pcm_s32le
> +
This test success on Intel(R) Core(TM) i7-10700 but failed on AMD EPYC 7K62.
--- /home/ubuntu/work/ffmpeg/tests/ref/fate/ffmpeg-streamloop-transcode-av 2023-06-19 18:49:26.666355000 +0800
+++ tests/data/fate/ffmpeg-streamloop-transcode-av 2023-06-19 18:49:40.674355000 +0800
@@ -19,30 +19,30 @@
1, 5096, 5096, 1024, 8192, 0x00000000
0, 3, 3, 1, 1378560, 0xca1deba8
1, 6120, 6120, 1024, 8192, 0x687330d2
-1, 7128, 7128, 1024, 8192, 0x9131462c
+1, 7128, 7128, 1024, 8192, 0x039b4628
0, 4, 4, 1, 1378560, 0xd4eed467
-1, 8208, 8208, 1024, 8192, 0x48c01c32
-1, 9232, 9232, 1024, 8192, 0x0ccd8d5f
+1, 8208, 8208, 1024, 8192, 0x4cbe1c62
+1, 9232, 9232, 1024, 8192, 0x1d8b8ad3
…
> FATE_STREAMCOPY-$(call REMUX, MP4 MOV, EAC3_DEMUXER) += fate-copy-trac3074
> fate-copy-trac3074: CMD = transcode eac3 $(TARGET_SAMPLES)/eac3/csi_miami_stereo_128_spx.eac3\
> mp4 "-codec copy -map 0" "-codec copy"
> diff --git a/tests/ref/fate/ffmpeg-streamloop-transcode-av b/tests/ref/fate/ffmpeg-streamloop-transcode-av
> new file mode 100644
> index 0000000000..50a626b281
> --- /dev/null
> +++ b/tests/ref/fate/ffmpeg-streamloop-transcode-av
> @@ -0,0 +1,151 @@
> +#tb 0: 125/2997
> +#media_type 0: video
> +#codec_id 0: rawvideo
> +#dimensions 0: 1280x718
> +#sar 0: 1/1
> +#tb 1: 1/48000
> +#media_type 1: audio
> +#codec_id 1: pcm_s32le
> +#sample_rate 1: 48000
> +#channel_layout_name 1: stereo
> +0, 0, 0, 1, 1378560, 0xbaf121ba
> +1, 0, 0, 1024, 8192, 0x00000000
> +1, 1024, 1024, 1024, 8192, 0x00000000
> +0, 1, 1, 1, 1378560, 0xbaf121ba
> +1, 2040, 2040, 1024, 8192, 0x00000000
> +1, 3048, 3048, 1024, 8192, 0x00000000
> +0, 2, 2, 1, 1378560, 0x6579d31a
> +1, 4072, 4072, 1024, 8192, 0x00000000
> +1, 5096, 5096, 1024, 8192, 0x00000000
> +0, 3, 3, 1, 1378560, 0xca1deba8
> +1, 6120, 6120, 1024, 8192, 0x687330d2
> +1, 7128, 7128, 1024, 8192, 0x9131462c
> +0, 4, 4, 1, 1378560, 0xd4eed467
> +1, 8208, 8208, 1024, 8192, 0x48c01c32
> +1, 9232, 9232, 1024, 8192, 0x0ccd8d5f
> +0, 5, 5, 1, 1378560, 0xd6e1d5b7
> +1, 10248, 10248, 1024, 8192, 0xd50cbe9f
> +1, 11256, 11256, 1024, 8192, 0xbe069303
> +0, 6, 6, 1, 1378560, 0x0b574d39
> +1, 12280, 12280, 1024, 8192, 0x85fccf5b
> +1, 13304, 13304, 1024, 8192, 0x4180de71
> +0, 7, 7, 1, 1378560, 0x1bdd4d61
> +1, 14328, 14328, 1024, 8192, 0x0e9b6ac3
> +1, 15336, 15336, 1024, 8192, 0x5c33f724
> +0, 8, 8, 1, 1378560, 0x3b28f549
> +1, 16360, 16360, 1024, 8192, 0x668aaaec
> +1, 17384, 17384, 1024, 8192, 0xd137d412
> +0, 9, 9, 1, 1378560, 0x45b2f57b
> +1, 18408, 18408, 1024, 8192, 0x08e1fbf6
> +1, 19416, 19416, 1024, 8192, 0xbf3fb4f6
> +0, 10, 10, 1, 1378560, 0x8955570e
> +1, 20440, 20440, 1024, 8192, 0x69cd08a4
> +1, 21464, 21464, 1024, 8192, 0xe0fe6297
> +1, 22488, 22488, 1024, 8192, 0x172867ad
> +1, 23496, 23496, 1024, 8192, 0xcbcc1461
> +0, 12, 12, 1, 1378560, 0x9c598000
> +1, 25488, 25488, 1024, 8192, 0x00000000
> +0, 13, 13, 1, 1378560, 0xbaf121ba
> +1, 26512, 26512, 1024, 8192, 0x00000000
> +1, 27528, 27528, 1024, 8192, 0x00000000
> +0, 14, 14, 1, 1378560, 0xbaf121ba
> +1, 28552, 28552, 1024, 8192, 0x00000000
> +1, 29576, 29576, 1024, 8192, 0x00000000
> +0, 15, 15, 1, 1378560, 0x6579d31a
> +1, 30600, 30600, 1024, 8192, 0x687330d2
> +1, 31608, 31608, 1024, 8192, 0x9131462c
> +0, 16, 16, 1, 1378560, 0xca1deba8
> +1, 32688, 32688, 1024, 8192, 0x48c01c32
> +1, 33712, 33712, 1024, 8192, 0x0ccd8d5f
> +0, 17, 17, 1, 1378560, 0xd4eed467
> +1, 34728, 34728, 1024, 8192, 0xd50cbe9f
> +1, 35736, 35736, 1024, 8192, 0xbe069303
> +0, 18, 18, 1, 1378560, 0xd6e1d5b7
> +1, 36760, 36760, 1024, 8192, 0x85fccf5b
> +1, 37784, 37784, 1024, 8192, 0x4180de71
> +0, 19, 19, 1, 1378560, 0x0b574d39
> +1, 38808, 38808, 1024, 8192, 0x0e9b6ac3
> +1, 39816, 39816, 1024, 8192, 0x5c33f724
> +0, 20, 20, 1, 1378560, 0x1bdd4d61
> +1, 40840, 40840, 1024, 8192, 0x668aaaec
> +1, 41864, 41864, 1024, 8192, 0xd137d412
> +0, 21, 21, 1, 1378560, 0x3b28f549
> +1, 42888, 42888, 1024, 8192, 0x08e1fbf6
> +1, 43896, 43896, 1024, 8192, 0xbf3fb4f6
> +0, 22, 22, 1, 1378560, 0x45b2f57b
> +1, 44920, 44920, 1024, 8192, 0x69cd08a4
> +1, 45944, 45944, 1024, 8192, 0xe0fe6297
> +0, 23, 23, 1, 1378560, 0x8955570e
> +1, 46968, 46968, 1024, 8192, 0x172867ad
> +1, 47976, 47976, 1024, 8192, 0xcbcc1461
> +0, 24, 24, 1, 1378560, 0x9c598000
> +1, 49968, 49968, 1024, 8192, 0x00000000
> +0, 25, 25, 1, 1378560, 0xbaf121ba
> +1, 50992, 50992, 1024, 8192, 0x00000000
> +1, 52008, 52008, 1024, 8192, 0x00000000
> +0, 26, 26, 1, 1378560, 0xbaf121ba
> +1, 53032, 53032, 1024, 8192, 0x00000000
> +0, 27, 27, 1, 1378560, 0x6579d31a
> +1, 54056, 54056, 1024, 8192, 0x00000000
> +1, 55080, 55080, 1024, 8192, 0x687330d2
> +0, 28, 28, 1, 1378560, 0xca1deba8
> +1, 56088, 56088, 1024, 8192, 0x9131462c
> +1, 57168, 57168, 1024, 8192, 0x48c01c32
> +0, 29, 29, 1, 1378560, 0xd4eed467
> +1, 58192, 58192, 1024, 8192, 0x0ccd8d5f
> +1, 59208, 59208, 1024, 8192, 0xd50cbe9f
> +0, 30, 30, 1, 1378560, 0xd6e1d5b7
> +1, 60216, 60216, 1024, 8192, 0xbe069303
> +1, 61240, 61240, 1024, 8192, 0x85fccf5b
> +0, 31, 31, 1, 1378560, 0x0b574d39
> +1, 62264, 62264, 1024, 8192, 0x4180de71
> +1, 63288, 63288, 1024, 8192, 0x0e9b6ac3
> +0, 32, 32, 1, 1378560, 0x1bdd4d61
> +1, 64296, 64296, 1024, 8192, 0x5c33f724
> +1, 65320, 65320, 1024, 8192, 0x668aaaec
> +0, 33, 33, 1, 1378560, 0x3b28f549
> +1, 66344, 66344, 1024, 8192, 0xd137d412
> +1, 67368, 67368, 1024, 8192, 0x08e1fbf6
> +0, 34, 34, 1, 1378560, 0x45b2f57b
> +1, 68376, 68376, 1024, 8192, 0xbf3fb4f6
> +1, 69400, 69400, 1024, 8192, 0x69cd08a4
> +0, 35, 35, 1, 1378560, 0x8955570e
> +1, 70424, 70424, 1024, 8192, 0xe0fe6297
> +1, 71448, 71448, 1024, 8192, 0x172867ad
> +0, 36, 36, 1, 1378560, 0x9c598000
> +1, 72456, 72456, 1024, 8192, 0xcbcc1461
> +0, 37, 37, 1, 1378560, 0xbaf121ba
> +1, 74448, 74448, 1024, 8192, 0x00000000
> +1, 75472, 75472, 1024, 8192, 0x00000000
> +0, 38, 38, 1, 1378560, 0xbaf121ba
> +1, 76488, 76488, 1024, 8192, 0x00000000
> +1, 77512, 77512, 1024, 8192, 0x00000000
> +0, 39, 39, 1, 1378560, 0x6579d31a
> +1, 78536, 78536, 1024, 8192, 0x00000000
> +1, 79560, 79560, 1024, 8192, 0x687330d2
> +0, 40, 40, 1, 1378560, 0xca1deba8
> +1, 80568, 80568, 1024, 8192, 0x9131462c
> +1, 81648, 81648, 1024, 8192, 0x48c01c32
> +0, 41, 41, 1, 1378560, 0xd4eed467
> +1, 82672, 82672, 1024, 8192, 0x0ccd8d5f
> +1, 83688, 83688, 1024, 8192, 0xd50cbe9f
> +0, 42, 42, 1, 1378560, 0xd6e1d5b7
> +1, 84696, 84696, 1024, 8192, 0xbe069303
> +1, 85720, 85720, 1024, 8192, 0x85fccf5b
> +0, 43, 43, 1, 1378560, 0x0b574d39
> +1, 86744, 86744, 1024, 8192, 0x4180de71
> +1, 87768, 87768, 1024, 8192, 0x0e9b6ac3
> +0, 44, 44, 1, 1378560, 0x1bdd4d61
> +1, 88776, 88776, 1024, 8192, 0x5c33f724
> +1, 89800, 89800, 1024, 8192, 0x668aaaec
> +0, 45, 45, 1, 1378560, 0x3b28f549
> +1, 90824, 90824, 1024, 8192, 0xd137d412
> +1, 91848, 91848, 1024, 8192, 0x08e1fbf6
> +0, 46, 46, 1, 1378560, 0x45b2f57b
> +1, 92856, 92856, 1024, 8192, 0xbf3fb4f6
> +1, 93880, 93880, 1024, 8192, 0x69cd08a4
> +0, 47, 47, 1, 1378560, 0x8955570e
> +1, 94904, 94904, 1024, 8192, 0xe0fe6297
> +1, 95928, 95928, 1024, 8192, 0x172867ad
> +1, 96936, 96936, 1024, 8192, 0xcbcc1461
> +0, 49, 49, 1, 1378560, 0x9c598000
> --
> 2.40.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [FFmpeg-devel] [PATCH 04/21 v2] tests/fate: add a test for -streamloop with transcoding video+audio
2023-06-16 6:01 ` [FFmpeg-devel] [PATCH 04/21 v2] " Anton Khirnov
2023-06-19 10:52 ` "zhilizhao(赵志立)"
@ 2023-06-19 12:29 ` James Almer
2023-06-19 12:34 ` "zhilizhao(赵志立)"
1 sibling, 1 reply; 37+ messages in thread
From: James Almer @ 2023-06-19 12:29 UTC (permalink / raw)
To: ffmpeg-devel
On 6/16/2023 3:01 AM, Anton Khirnov wrote:
> ---
> Now using aacdec_fixed with s32le output
> ---
> tests/fate/ffmpeg.mak | 4 +
> tests/ref/fate/ffmpeg-streamloop-transcode-av | 151 ++++++++++++++++++
> 2 files changed, 155 insertions(+)
> create mode 100644 tests/ref/fate/ffmpeg-streamloop-transcode-av
>
> diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
> index c26c748934..87cd0b46d0 100644
> --- a/tests/fate/ffmpeg.mak
> +++ b/tests/fate/ffmpeg.mak
> @@ -132,6 +132,10 @@ fate-ffmpeg-fix_sub_duration_heartbeat: CMD = fmtstdout srt -fix_sub_duration \
> -c:s srt \
> -f null -
>
> +FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MATROSKA, H264 AAC_FIXED, PCM_S32LE_ENCODER) += fate-ffmpeg-streamloop-transcode-av
> +fate-ffmpeg-streamloop-transcode-av: CMD = \
> + framecrc -auto_conversion_filters -stream_loop 3 -i $(TARGET_SAMPLES)/mkv/1242-small.mkv -c:a pcm_s32le
I think this is missing -c:a ac3_fixed before the -i
> +
> FATE_STREAMCOPY-$(call REMUX, MP4 MOV, EAC3_DEMUXER) += fate-copy-trac3074
> fate-copy-trac3074: CMD = transcode eac3 $(TARGET_SAMPLES)/eac3/csi_miami_stereo_128_spx.eac3\
> mp4 "-codec copy -map 0" "-codec copy"
> diff --git a/tests/ref/fate/ffmpeg-streamloop-transcode-av b/tests/ref/fate/ffmpeg-streamloop-transcode-av
> new file mode 100644
> index 0000000000..50a626b281
> --- /dev/null
> +++ b/tests/ref/fate/ffmpeg-streamloop-transcode-av
> @@ -0,0 +1,151 @@
> +#tb 0: 125/2997
> +#media_type 0: video
> +#codec_id 0: rawvideo
> +#dimensions 0: 1280x718
> +#sar 0: 1/1
> +#tb 1: 1/48000
> +#media_type 1: audio
> +#codec_id 1: pcm_s32le
> +#sample_rate 1: 48000
> +#channel_layout_name 1: stereo
> +0, 0, 0, 1, 1378560, 0xbaf121ba
> +1, 0, 0, 1024, 8192, 0x00000000
> +1, 1024, 1024, 1024, 8192, 0x00000000
> +0, 1, 1, 1, 1378560, 0xbaf121ba
> +1, 2040, 2040, 1024, 8192, 0x00000000
> +1, 3048, 3048, 1024, 8192, 0x00000000
> +0, 2, 2, 1, 1378560, 0x6579d31a
> +1, 4072, 4072, 1024, 8192, 0x00000000
> +1, 5096, 5096, 1024, 8192, 0x00000000
> +0, 3, 3, 1, 1378560, 0xca1deba8
> +1, 6120, 6120, 1024, 8192, 0x687330d2
> +1, 7128, 7128, 1024, 8192, 0x9131462c
> +0, 4, 4, 1, 1378560, 0xd4eed467
> +1, 8208, 8208, 1024, 8192, 0x48c01c32
> +1, 9232, 9232, 1024, 8192, 0x0ccd8d5f
> +0, 5, 5, 1, 1378560, 0xd6e1d5b7
> +1, 10248, 10248, 1024, 8192, 0xd50cbe9f
> +1, 11256, 11256, 1024, 8192, 0xbe069303
> +0, 6, 6, 1, 1378560, 0x0b574d39
> +1, 12280, 12280, 1024, 8192, 0x85fccf5b
> +1, 13304, 13304, 1024, 8192, 0x4180de71
> +0, 7, 7, 1, 1378560, 0x1bdd4d61
> +1, 14328, 14328, 1024, 8192, 0x0e9b6ac3
> +1, 15336, 15336, 1024, 8192, 0x5c33f724
> +0, 8, 8, 1, 1378560, 0x3b28f549
> +1, 16360, 16360, 1024, 8192, 0x668aaaec
> +1, 17384, 17384, 1024, 8192, 0xd137d412
> +0, 9, 9, 1, 1378560, 0x45b2f57b
> +1, 18408, 18408, 1024, 8192, 0x08e1fbf6
> +1, 19416, 19416, 1024, 8192, 0xbf3fb4f6
> +0, 10, 10, 1, 1378560, 0x8955570e
> +1, 20440, 20440, 1024, 8192, 0x69cd08a4
> +1, 21464, 21464, 1024, 8192, 0xe0fe6297
> +1, 22488, 22488, 1024, 8192, 0x172867ad
> +1, 23496, 23496, 1024, 8192, 0xcbcc1461
> +0, 12, 12, 1, 1378560, 0x9c598000
> +1, 25488, 25488, 1024, 8192, 0x00000000
> +0, 13, 13, 1, 1378560, 0xbaf121ba
> +1, 26512, 26512, 1024, 8192, 0x00000000
> +1, 27528, 27528, 1024, 8192, 0x00000000
> +0, 14, 14, 1, 1378560, 0xbaf121ba
> +1, 28552, 28552, 1024, 8192, 0x00000000
> +1, 29576, 29576, 1024, 8192, 0x00000000
> +0, 15, 15, 1, 1378560, 0x6579d31a
> +1, 30600, 30600, 1024, 8192, 0x687330d2
> +1, 31608, 31608, 1024, 8192, 0x9131462c
> +0, 16, 16, 1, 1378560, 0xca1deba8
> +1, 32688, 32688, 1024, 8192, 0x48c01c32
> +1, 33712, 33712, 1024, 8192, 0x0ccd8d5f
> +0, 17, 17, 1, 1378560, 0xd4eed467
> +1, 34728, 34728, 1024, 8192, 0xd50cbe9f
> +1, 35736, 35736, 1024, 8192, 0xbe069303
> +0, 18, 18, 1, 1378560, 0xd6e1d5b7
> +1, 36760, 36760, 1024, 8192, 0x85fccf5b
> +1, 37784, 37784, 1024, 8192, 0x4180de71
> +0, 19, 19, 1, 1378560, 0x0b574d39
> +1, 38808, 38808, 1024, 8192, 0x0e9b6ac3
> +1, 39816, 39816, 1024, 8192, 0x5c33f724
> +0, 20, 20, 1, 1378560, 0x1bdd4d61
> +1, 40840, 40840, 1024, 8192, 0x668aaaec
> +1, 41864, 41864, 1024, 8192, 0xd137d412
> +0, 21, 21, 1, 1378560, 0x3b28f549
> +1, 42888, 42888, 1024, 8192, 0x08e1fbf6
> +1, 43896, 43896, 1024, 8192, 0xbf3fb4f6
> +0, 22, 22, 1, 1378560, 0x45b2f57b
> +1, 44920, 44920, 1024, 8192, 0x69cd08a4
> +1, 45944, 45944, 1024, 8192, 0xe0fe6297
> +0, 23, 23, 1, 1378560, 0x8955570e
> +1, 46968, 46968, 1024, 8192, 0x172867ad
> +1, 47976, 47976, 1024, 8192, 0xcbcc1461
> +0, 24, 24, 1, 1378560, 0x9c598000
> +1, 49968, 49968, 1024, 8192, 0x00000000
> +0, 25, 25, 1, 1378560, 0xbaf121ba
> +1, 50992, 50992, 1024, 8192, 0x00000000
> +1, 52008, 52008, 1024, 8192, 0x00000000
> +0, 26, 26, 1, 1378560, 0xbaf121ba
> +1, 53032, 53032, 1024, 8192, 0x00000000
> +0, 27, 27, 1, 1378560, 0x6579d31a
> +1, 54056, 54056, 1024, 8192, 0x00000000
> +1, 55080, 55080, 1024, 8192, 0x687330d2
> +0, 28, 28, 1, 1378560, 0xca1deba8
> +1, 56088, 56088, 1024, 8192, 0x9131462c
> +1, 57168, 57168, 1024, 8192, 0x48c01c32
> +0, 29, 29, 1, 1378560, 0xd4eed467
> +1, 58192, 58192, 1024, 8192, 0x0ccd8d5f
> +1, 59208, 59208, 1024, 8192, 0xd50cbe9f
> +0, 30, 30, 1, 1378560, 0xd6e1d5b7
> +1, 60216, 60216, 1024, 8192, 0xbe069303
> +1, 61240, 61240, 1024, 8192, 0x85fccf5b
> +0, 31, 31, 1, 1378560, 0x0b574d39
> +1, 62264, 62264, 1024, 8192, 0x4180de71
> +1, 63288, 63288, 1024, 8192, 0x0e9b6ac3
> +0, 32, 32, 1, 1378560, 0x1bdd4d61
> +1, 64296, 64296, 1024, 8192, 0x5c33f724
> +1, 65320, 65320, 1024, 8192, 0x668aaaec
> +0, 33, 33, 1, 1378560, 0x3b28f549
> +1, 66344, 66344, 1024, 8192, 0xd137d412
> +1, 67368, 67368, 1024, 8192, 0x08e1fbf6
> +0, 34, 34, 1, 1378560, 0x45b2f57b
> +1, 68376, 68376, 1024, 8192, 0xbf3fb4f6
> +1, 69400, 69400, 1024, 8192, 0x69cd08a4
> +0, 35, 35, 1, 1378560, 0x8955570e
> +1, 70424, 70424, 1024, 8192, 0xe0fe6297
> +1, 71448, 71448, 1024, 8192, 0x172867ad
> +0, 36, 36, 1, 1378560, 0x9c598000
> +1, 72456, 72456, 1024, 8192, 0xcbcc1461
> +0, 37, 37, 1, 1378560, 0xbaf121ba
> +1, 74448, 74448, 1024, 8192, 0x00000000
> +1, 75472, 75472, 1024, 8192, 0x00000000
> +0, 38, 38, 1, 1378560, 0xbaf121ba
> +1, 76488, 76488, 1024, 8192, 0x00000000
> +1, 77512, 77512, 1024, 8192, 0x00000000
> +0, 39, 39, 1, 1378560, 0x6579d31a
> +1, 78536, 78536, 1024, 8192, 0x00000000
> +1, 79560, 79560, 1024, 8192, 0x687330d2
> +0, 40, 40, 1, 1378560, 0xca1deba8
> +1, 80568, 80568, 1024, 8192, 0x9131462c
> +1, 81648, 81648, 1024, 8192, 0x48c01c32
> +0, 41, 41, 1, 1378560, 0xd4eed467
> +1, 82672, 82672, 1024, 8192, 0x0ccd8d5f
> +1, 83688, 83688, 1024, 8192, 0xd50cbe9f
> +0, 42, 42, 1, 1378560, 0xd6e1d5b7
> +1, 84696, 84696, 1024, 8192, 0xbe069303
> +1, 85720, 85720, 1024, 8192, 0x85fccf5b
> +0, 43, 43, 1, 1378560, 0x0b574d39
> +1, 86744, 86744, 1024, 8192, 0x4180de71
> +1, 87768, 87768, 1024, 8192, 0x0e9b6ac3
> +0, 44, 44, 1, 1378560, 0x1bdd4d61
> +1, 88776, 88776, 1024, 8192, 0x5c33f724
> +1, 89800, 89800, 1024, 8192, 0x668aaaec
> +0, 45, 45, 1, 1378560, 0x3b28f549
> +1, 90824, 90824, 1024, 8192, 0xd137d412
> +1, 91848, 91848, 1024, 8192, 0x08e1fbf6
> +0, 46, 46, 1, 1378560, 0x45b2f57b
> +1, 92856, 92856, 1024, 8192, 0xbf3fb4f6
> +1, 93880, 93880, 1024, 8192, 0x69cd08a4
> +0, 47, 47, 1, 1378560, 0x8955570e
> +1, 94904, 94904, 1024, 8192, 0xe0fe6297
> +1, 95928, 95928, 1024, 8192, 0x172867ad
> +1, 96936, 96936, 1024, 8192, 0xcbcc1461
> +0, 49, 49, 1, 1378560, 0x9c598000
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [FFmpeg-devel] [PATCH 04/21 v2] tests/fate: add a test for -streamloop with transcoding video+audio
2023-06-19 12:29 ` James Almer
@ 2023-06-19 12:34 ` "zhilizhao(赵志立)"
2023-06-19 13:22 ` James Almer
0 siblings, 1 reply; 37+ messages in thread
From: "zhilizhao(赵志立)" @ 2023-06-19 12:34 UTC (permalink / raw)
To: FFmpeg development discussions and patches
> On Jun 19, 2023, at 20:29, James Almer <jamrial@gmail.com> wrote:
>
> On 6/16/2023 3:01 AM, Anton Khirnov wrote:
>> ---
>> Now using aacdec_fixed with s32le output
>> ---
>> tests/fate/ffmpeg.mak | 4 +
>> tests/ref/fate/ffmpeg-streamloop-transcode-av | 151 ++++++++++++++++++
>> 2 files changed, 155 insertions(+)
>> create mode 100644 tests/ref/fate/ffmpeg-streamloop-transcode-av
>> diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
>> index c26c748934..87cd0b46d0 100644
>> --- a/tests/fate/ffmpeg.mak
>> +++ b/tests/fate/ffmpeg.mak
>> @@ -132,6 +132,10 @@ fate-ffmpeg-fix_sub_duration_heartbeat: CMD = fmtstdout srt -fix_sub_duration \
>> -c:s srt \
>> -f null -
>> +FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MATROSKA, H264 AAC_FIXED, PCM_S32LE_ENCODER) += fate-ffmpeg-streamloop-transcode-av
>> +fate-ffmpeg-streamloop-transcode-av: CMD = \
>> + framecrc -auto_conversion_filters -stream_loop 3 -i $(TARGET_SAMPLES)/mkv/1242-small.mkv -c:a pcm_s32le
>
> I think this is missing -c:a ac3_fixed before the -i
You mean aac_fixed? I have tried, but the result on two processor don't match neither.
>
>> +
>> FATE_STREAMCOPY-$(call REMUX, MP4 MOV, EAC3_DEMUXER) += fate-copy-trac3074
>> fate-copy-trac3074: CMD = transcode eac3 $(TARGET_SAMPLES)/eac3/csi_miami_stereo_128_spx.eac3\
>> mp4 "-codec copy -map 0" "-codec copy"
>> diff --git a/tests/ref/fate/ffmpeg-streamloop-transcode-av b/tests/ref/fate/ffmpeg-streamloop-transcode-av
>> new file mode 100644
>> index 0000000000..50a626b281
>> --- /dev/null
>> +++ b/tests/ref/fate/ffmpeg-streamloop-transcode-av
>> @@ -0,0 +1,151 @@
>> +#tb 0: 125/2997
>> +#media_type 0: video
>> +#codec_id 0: rawvideo
>> +#dimensions 0: 1280x718
>> +#sar 0: 1/1
>> +#tb 1: 1/48000
>> +#media_type 1: audio
>> +#codec_id 1: pcm_s32le
>> +#sample_rate 1: 48000
>> +#channel_layout_name 1: stereo
>> +0, 0, 0, 1, 1378560, 0xbaf121ba
>> +1, 0, 0, 1024, 8192, 0x00000000
>> +1, 1024, 1024, 1024, 8192, 0x00000000
>> +0, 1, 1, 1, 1378560, 0xbaf121ba
>> +1, 2040, 2040, 1024, 8192, 0x00000000
>> +1, 3048, 3048, 1024, 8192, 0x00000000
>> +0, 2, 2, 1, 1378560, 0x6579d31a
>> +1, 4072, 4072, 1024, 8192, 0x00000000
>> +1, 5096, 5096, 1024, 8192, 0x00000000
>> +0, 3, 3, 1, 1378560, 0xca1deba8
>> +1, 6120, 6120, 1024, 8192, 0x687330d2
>> +1, 7128, 7128, 1024, 8192, 0x9131462c
>> +0, 4, 4, 1, 1378560, 0xd4eed467
>> +1, 8208, 8208, 1024, 8192, 0x48c01c32
>> +1, 9232, 9232, 1024, 8192, 0x0ccd8d5f
>> +0, 5, 5, 1, 1378560, 0xd6e1d5b7
>> +1, 10248, 10248, 1024, 8192, 0xd50cbe9f
>> +1, 11256, 11256, 1024, 8192, 0xbe069303
>> +0, 6, 6, 1, 1378560, 0x0b574d39
>> +1, 12280, 12280, 1024, 8192, 0x85fccf5b
>> +1, 13304, 13304, 1024, 8192, 0x4180de71
>> +0, 7, 7, 1, 1378560, 0x1bdd4d61
>> +1, 14328, 14328, 1024, 8192, 0x0e9b6ac3
>> +1, 15336, 15336, 1024, 8192, 0x5c33f724
>> +0, 8, 8, 1, 1378560, 0x3b28f549
>> +1, 16360, 16360, 1024, 8192, 0x668aaaec
>> +1, 17384, 17384, 1024, 8192, 0xd137d412
>> +0, 9, 9, 1, 1378560, 0x45b2f57b
>> +1, 18408, 18408, 1024, 8192, 0x08e1fbf6
>> +1, 19416, 19416, 1024, 8192, 0xbf3fb4f6
>> +0, 10, 10, 1, 1378560, 0x8955570e
>> +1, 20440, 20440, 1024, 8192, 0x69cd08a4
>> +1, 21464, 21464, 1024, 8192, 0xe0fe6297
>> +1, 22488, 22488, 1024, 8192, 0x172867ad
>> +1, 23496, 23496, 1024, 8192, 0xcbcc1461
>> +0, 12, 12, 1, 1378560, 0x9c598000
>> +1, 25488, 25488, 1024, 8192, 0x00000000
>> +0, 13, 13, 1, 1378560, 0xbaf121ba
>> +1, 26512, 26512, 1024, 8192, 0x00000000
>> +1, 27528, 27528, 1024, 8192, 0x00000000
>> +0, 14, 14, 1, 1378560, 0xbaf121ba
>> +1, 28552, 28552, 1024, 8192, 0x00000000
>> +1, 29576, 29576, 1024, 8192, 0x00000000
>> +0, 15, 15, 1, 1378560, 0x6579d31a
>> +1, 30600, 30600, 1024, 8192, 0x687330d2
>> +1, 31608, 31608, 1024, 8192, 0x9131462c
>> +0, 16, 16, 1, 1378560, 0xca1deba8
>> +1, 32688, 32688, 1024, 8192, 0x48c01c32
>> +1, 33712, 33712, 1024, 8192, 0x0ccd8d5f
>> +0, 17, 17, 1, 1378560, 0xd4eed467
>> +1, 34728, 34728, 1024, 8192, 0xd50cbe9f
>> +1, 35736, 35736, 1024, 8192, 0xbe069303
>> +0, 18, 18, 1, 1378560, 0xd6e1d5b7
>> +1, 36760, 36760, 1024, 8192, 0x85fccf5b
>> +1, 37784, 37784, 1024, 8192, 0x4180de71
>> +0, 19, 19, 1, 1378560, 0x0b574d39
>> +1, 38808, 38808, 1024, 8192, 0x0e9b6ac3
>> +1, 39816, 39816, 1024, 8192, 0x5c33f724
>> +0, 20, 20, 1, 1378560, 0x1bdd4d61
>> +1, 40840, 40840, 1024, 8192, 0x668aaaec
>> +1, 41864, 41864, 1024, 8192, 0xd137d412
>> +0, 21, 21, 1, 1378560, 0x3b28f549
>> +1, 42888, 42888, 1024, 8192, 0x08e1fbf6
>> +1, 43896, 43896, 1024, 8192, 0xbf3fb4f6
>> +0, 22, 22, 1, 1378560, 0x45b2f57b
>> +1, 44920, 44920, 1024, 8192, 0x69cd08a4
>> +1, 45944, 45944, 1024, 8192, 0xe0fe6297
>> +0, 23, 23, 1, 1378560, 0x8955570e
>> +1, 46968, 46968, 1024, 8192, 0x172867ad
>> +1, 47976, 47976, 1024, 8192, 0xcbcc1461
>> +0, 24, 24, 1, 1378560, 0x9c598000
>> +1, 49968, 49968, 1024, 8192, 0x00000000
>> +0, 25, 25, 1, 1378560, 0xbaf121ba
>> +1, 50992, 50992, 1024, 8192, 0x00000000
>> +1, 52008, 52008, 1024, 8192, 0x00000000
>> +0, 26, 26, 1, 1378560, 0xbaf121ba
>> +1, 53032, 53032, 1024, 8192, 0x00000000
>> +0, 27, 27, 1, 1378560, 0x6579d31a
>> +1, 54056, 54056, 1024, 8192, 0x00000000
>> +1, 55080, 55080, 1024, 8192, 0x687330d2
>> +0, 28, 28, 1, 1378560, 0xca1deba8
>> +1, 56088, 56088, 1024, 8192, 0x9131462c
>> +1, 57168, 57168, 1024, 8192, 0x48c01c32
>> +0, 29, 29, 1, 1378560, 0xd4eed467
>> +1, 58192, 58192, 1024, 8192, 0x0ccd8d5f
>> +1, 59208, 59208, 1024, 8192, 0xd50cbe9f
>> +0, 30, 30, 1, 1378560, 0xd6e1d5b7
>> +1, 60216, 60216, 1024, 8192, 0xbe069303
>> +1, 61240, 61240, 1024, 8192, 0x85fccf5b
>> +0, 31, 31, 1, 1378560, 0x0b574d39
>> +1, 62264, 62264, 1024, 8192, 0x4180de71
>> +1, 63288, 63288, 1024, 8192, 0x0e9b6ac3
>> +0, 32, 32, 1, 1378560, 0x1bdd4d61
>> +1, 64296, 64296, 1024, 8192, 0x5c33f724
>> +1, 65320, 65320, 1024, 8192, 0x668aaaec
>> +0, 33, 33, 1, 1378560, 0x3b28f549
>> +1, 66344, 66344, 1024, 8192, 0xd137d412
>> +1, 67368, 67368, 1024, 8192, 0x08e1fbf6
>> +0, 34, 34, 1, 1378560, 0x45b2f57b
>> +1, 68376, 68376, 1024, 8192, 0xbf3fb4f6
>> +1, 69400, 69400, 1024, 8192, 0x69cd08a4
>> +0, 35, 35, 1, 1378560, 0x8955570e
>> +1, 70424, 70424, 1024, 8192, 0xe0fe6297
>> +1, 71448, 71448, 1024, 8192, 0x172867ad
>> +0, 36, 36, 1, 1378560, 0x9c598000
>> +1, 72456, 72456, 1024, 8192, 0xcbcc1461
>> +0, 37, 37, 1, 1378560, 0xbaf121ba
>> +1, 74448, 74448, 1024, 8192, 0x00000000
>> +1, 75472, 75472, 1024, 8192, 0x00000000
>> +0, 38, 38, 1, 1378560, 0xbaf121ba
>> +1, 76488, 76488, 1024, 8192, 0x00000000
>> +1, 77512, 77512, 1024, 8192, 0x00000000
>> +0, 39, 39, 1, 1378560, 0x6579d31a
>> +1, 78536, 78536, 1024, 8192, 0x00000000
>> +1, 79560, 79560, 1024, 8192, 0x687330d2
>> +0, 40, 40, 1, 1378560, 0xca1deba8
>> +1, 80568, 80568, 1024, 8192, 0x9131462c
>> +1, 81648, 81648, 1024, 8192, 0x48c01c32
>> +0, 41, 41, 1, 1378560, 0xd4eed467
>> +1, 82672, 82672, 1024, 8192, 0x0ccd8d5f
>> +1, 83688, 83688, 1024, 8192, 0xd50cbe9f
>> +0, 42, 42, 1, 1378560, 0xd6e1d5b7
>> +1, 84696, 84696, 1024, 8192, 0xbe069303
>> +1, 85720, 85720, 1024, 8192, 0x85fccf5b
>> +0, 43, 43, 1, 1378560, 0x0b574d39
>> +1, 86744, 86744, 1024, 8192, 0x4180de71
>> +1, 87768, 87768, 1024, 8192, 0x0e9b6ac3
>> +0, 44, 44, 1, 1378560, 0x1bdd4d61
>> +1, 88776, 88776, 1024, 8192, 0x5c33f724
>> +1, 89800, 89800, 1024, 8192, 0x668aaaec
>> +0, 45, 45, 1, 1378560, 0x3b28f549
>> +1, 90824, 90824, 1024, 8192, 0xd137d412
>> +1, 91848, 91848, 1024, 8192, 0x08e1fbf6
>> +0, 46, 46, 1, 1378560, 0x45b2f57b
>> +1, 92856, 92856, 1024, 8192, 0xbf3fb4f6
>> +1, 93880, 93880, 1024, 8192, 0x69cd08a4
>> +0, 47, 47, 1, 1378560, 0x8955570e
>> +1, 94904, 94904, 1024, 8192, 0xe0fe6297
>> +1, 95928, 95928, 1024, 8192, 0x172867ad
>> +1, 96936, 96936, 1024, 8192, 0xcbcc1461
>> +0, 49, 49, 1, 1378560, 0x9c598000
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [FFmpeg-devel] [PATCH 04/21 v2] tests/fate: add a test for -streamloop with transcoding video+audio
2023-06-19 12:34 ` "zhilizhao(赵志立)"
@ 2023-06-19 13:22 ` James Almer
2023-06-19 13:39 ` Zhao Zhili
0 siblings, 1 reply; 37+ messages in thread
From: James Almer @ 2023-06-19 13:22 UTC (permalink / raw)
To: ffmpeg-devel
On 6/19/2023 9:34 AM, "zhilizhao(赵志立)" wrote:
>
>
>> On Jun 19, 2023, at 20:29, James Almer <jamrial@gmail.com> wrote:
>>
>> On 6/16/2023 3:01 AM, Anton Khirnov wrote:
>>> ---
>>> Now using aacdec_fixed with s32le output
>>> ---
>>> tests/fate/ffmpeg.mak | 4 +
>>> tests/ref/fate/ffmpeg-streamloop-transcode-av | 151 ++++++++++++++++++
>>> 2 files changed, 155 insertions(+)
>>> create mode 100644 tests/ref/fate/ffmpeg-streamloop-transcode-av
>>> diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
>>> index c26c748934..87cd0b46d0 100644
>>> --- a/tests/fate/ffmpeg.mak
>>> +++ b/tests/fate/ffmpeg.mak
>>> @@ -132,6 +132,10 @@ fate-ffmpeg-fix_sub_duration_heartbeat: CMD = fmtstdout srt -fix_sub_duration \
>>> -c:s srt \
>>> -f null -
>>> +FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MATROSKA, H264 AAC_FIXED, PCM_S32LE_ENCODER) += fate-ffmpeg-streamloop-transcode-av
>>> +fate-ffmpeg-streamloop-transcode-av: CMD = \
>>> + framecrc -auto_conversion_filters -stream_loop 3 -i $(TARGET_SAMPLES)/mkv/1242-small.mkv -c:a pcm_s32le
>>
>> I think this is missing -c:a ac3_fixed before the -i
>
> You mean aac_fixed? I have tried, but the result on two processor don't match neither.
The output will of course be different than what's in the reference file
in this patch. What matters is that the new output does match across
different CPUs.
>
>>
>>> +
>>> FATE_STREAMCOPY-$(call REMUX, MP4 MOV, EAC3_DEMUXER) += fate-copy-trac3074
>>> fate-copy-trac3074: CMD = transcode eac3 $(TARGET_SAMPLES)/eac3/csi_miami_stereo_128_spx.eac3\
>>> mp4 "-codec copy -map 0" "-codec copy"
>>> diff --git a/tests/ref/fate/ffmpeg-streamloop-transcode-av b/tests/ref/fate/ffmpeg-streamloop-transcode-av
>>> new file mode 100644
>>> index 0000000000..50a626b281
>>> --- /dev/null
>>> +++ b/tests/ref/fate/ffmpeg-streamloop-transcode-av
>>> @@ -0,0 +1,151 @@
>>> +#tb 0: 125/2997
>>> +#media_type 0: video
>>> +#codec_id 0: rawvideo
>>> +#dimensions 0: 1280x718
>>> +#sar 0: 1/1
>>> +#tb 1: 1/48000
>>> +#media_type 1: audio
>>> +#codec_id 1: pcm_s32le
>>> +#sample_rate 1: 48000
>>> +#channel_layout_name 1: stereo
>>> +0, 0, 0, 1, 1378560, 0xbaf121ba
>>> +1, 0, 0, 1024, 8192, 0x00000000
>>> +1, 1024, 1024, 1024, 8192, 0x00000000
>>> +0, 1, 1, 1, 1378560, 0xbaf121ba
>>> +1, 2040, 2040, 1024, 8192, 0x00000000
>>> +1, 3048, 3048, 1024, 8192, 0x00000000
>>> +0, 2, 2, 1, 1378560, 0x6579d31a
>>> +1, 4072, 4072, 1024, 8192, 0x00000000
>>> +1, 5096, 5096, 1024, 8192, 0x00000000
>>> +0, 3, 3, 1, 1378560, 0xca1deba8
>>> +1, 6120, 6120, 1024, 8192, 0x687330d2
>>> +1, 7128, 7128, 1024, 8192, 0x9131462c
>>> +0, 4, 4, 1, 1378560, 0xd4eed467
>>> +1, 8208, 8208, 1024, 8192, 0x48c01c32
>>> +1, 9232, 9232, 1024, 8192, 0x0ccd8d5f
>>> +0, 5, 5, 1, 1378560, 0xd6e1d5b7
>>> +1, 10248, 10248, 1024, 8192, 0xd50cbe9f
>>> +1, 11256, 11256, 1024, 8192, 0xbe069303
>>> +0, 6, 6, 1, 1378560, 0x0b574d39
>>> +1, 12280, 12280, 1024, 8192, 0x85fccf5b
>>> +1, 13304, 13304, 1024, 8192, 0x4180de71
>>> +0, 7, 7, 1, 1378560, 0x1bdd4d61
>>> +1, 14328, 14328, 1024, 8192, 0x0e9b6ac3
>>> +1, 15336, 15336, 1024, 8192, 0x5c33f724
>>> +0, 8, 8, 1, 1378560, 0x3b28f549
>>> +1, 16360, 16360, 1024, 8192, 0x668aaaec
>>> +1, 17384, 17384, 1024, 8192, 0xd137d412
>>> +0, 9, 9, 1, 1378560, 0x45b2f57b
>>> +1, 18408, 18408, 1024, 8192, 0x08e1fbf6
>>> +1, 19416, 19416, 1024, 8192, 0xbf3fb4f6
>>> +0, 10, 10, 1, 1378560, 0x8955570e
>>> +1, 20440, 20440, 1024, 8192, 0x69cd08a4
>>> +1, 21464, 21464, 1024, 8192, 0xe0fe6297
>>> +1, 22488, 22488, 1024, 8192, 0x172867ad
>>> +1, 23496, 23496, 1024, 8192, 0xcbcc1461
>>> +0, 12, 12, 1, 1378560, 0x9c598000
>>> +1, 25488, 25488, 1024, 8192, 0x00000000
>>> +0, 13, 13, 1, 1378560, 0xbaf121ba
>>> +1, 26512, 26512, 1024, 8192, 0x00000000
>>> +1, 27528, 27528, 1024, 8192, 0x00000000
>>> +0, 14, 14, 1, 1378560, 0xbaf121ba
>>> +1, 28552, 28552, 1024, 8192, 0x00000000
>>> +1, 29576, 29576, 1024, 8192, 0x00000000
>>> +0, 15, 15, 1, 1378560, 0x6579d31a
>>> +1, 30600, 30600, 1024, 8192, 0x687330d2
>>> +1, 31608, 31608, 1024, 8192, 0x9131462c
>>> +0, 16, 16, 1, 1378560, 0xca1deba8
>>> +1, 32688, 32688, 1024, 8192, 0x48c01c32
>>> +1, 33712, 33712, 1024, 8192, 0x0ccd8d5f
>>> +0, 17, 17, 1, 1378560, 0xd4eed467
>>> +1, 34728, 34728, 1024, 8192, 0xd50cbe9f
>>> +1, 35736, 35736, 1024, 8192, 0xbe069303
>>> +0, 18, 18, 1, 1378560, 0xd6e1d5b7
>>> +1, 36760, 36760, 1024, 8192, 0x85fccf5b
>>> +1, 37784, 37784, 1024, 8192, 0x4180de71
>>> +0, 19, 19, 1, 1378560, 0x0b574d39
>>> +1, 38808, 38808, 1024, 8192, 0x0e9b6ac3
>>> +1, 39816, 39816, 1024, 8192, 0x5c33f724
>>> +0, 20, 20, 1, 1378560, 0x1bdd4d61
>>> +1, 40840, 40840, 1024, 8192, 0x668aaaec
>>> +1, 41864, 41864, 1024, 8192, 0xd137d412
>>> +0, 21, 21, 1, 1378560, 0x3b28f549
>>> +1, 42888, 42888, 1024, 8192, 0x08e1fbf6
>>> +1, 43896, 43896, 1024, 8192, 0xbf3fb4f6
>>> +0, 22, 22, 1, 1378560, 0x45b2f57b
>>> +1, 44920, 44920, 1024, 8192, 0x69cd08a4
>>> +1, 45944, 45944, 1024, 8192, 0xe0fe6297
>>> +0, 23, 23, 1, 1378560, 0x8955570e
>>> +1, 46968, 46968, 1024, 8192, 0x172867ad
>>> +1, 47976, 47976, 1024, 8192, 0xcbcc1461
>>> +0, 24, 24, 1, 1378560, 0x9c598000
>>> +1, 49968, 49968, 1024, 8192, 0x00000000
>>> +0, 25, 25, 1, 1378560, 0xbaf121ba
>>> +1, 50992, 50992, 1024, 8192, 0x00000000
>>> +1, 52008, 52008, 1024, 8192, 0x00000000
>>> +0, 26, 26, 1, 1378560, 0xbaf121ba
>>> +1, 53032, 53032, 1024, 8192, 0x00000000
>>> +0, 27, 27, 1, 1378560, 0x6579d31a
>>> +1, 54056, 54056, 1024, 8192, 0x00000000
>>> +1, 55080, 55080, 1024, 8192, 0x687330d2
>>> +0, 28, 28, 1, 1378560, 0xca1deba8
>>> +1, 56088, 56088, 1024, 8192, 0x9131462c
>>> +1, 57168, 57168, 1024, 8192, 0x48c01c32
>>> +0, 29, 29, 1, 1378560, 0xd4eed467
>>> +1, 58192, 58192, 1024, 8192, 0x0ccd8d5f
>>> +1, 59208, 59208, 1024, 8192, 0xd50cbe9f
>>> +0, 30, 30, 1, 1378560, 0xd6e1d5b7
>>> +1, 60216, 60216, 1024, 8192, 0xbe069303
>>> +1, 61240, 61240, 1024, 8192, 0x85fccf5b
>>> +0, 31, 31, 1, 1378560, 0x0b574d39
>>> +1, 62264, 62264, 1024, 8192, 0x4180de71
>>> +1, 63288, 63288, 1024, 8192, 0x0e9b6ac3
>>> +0, 32, 32, 1, 1378560, 0x1bdd4d61
>>> +1, 64296, 64296, 1024, 8192, 0x5c33f724
>>> +1, 65320, 65320, 1024, 8192, 0x668aaaec
>>> +0, 33, 33, 1, 1378560, 0x3b28f549
>>> +1, 66344, 66344, 1024, 8192, 0xd137d412
>>> +1, 67368, 67368, 1024, 8192, 0x08e1fbf6
>>> +0, 34, 34, 1, 1378560, 0x45b2f57b
>>> +1, 68376, 68376, 1024, 8192, 0xbf3fb4f6
>>> +1, 69400, 69400, 1024, 8192, 0x69cd08a4
>>> +0, 35, 35, 1, 1378560, 0x8955570e
>>> +1, 70424, 70424, 1024, 8192, 0xe0fe6297
>>> +1, 71448, 71448, 1024, 8192, 0x172867ad
>>> +0, 36, 36, 1, 1378560, 0x9c598000
>>> +1, 72456, 72456, 1024, 8192, 0xcbcc1461
>>> +0, 37, 37, 1, 1378560, 0xbaf121ba
>>> +1, 74448, 74448, 1024, 8192, 0x00000000
>>> +1, 75472, 75472, 1024, 8192, 0x00000000
>>> +0, 38, 38, 1, 1378560, 0xbaf121ba
>>> +1, 76488, 76488, 1024, 8192, 0x00000000
>>> +1, 77512, 77512, 1024, 8192, 0x00000000
>>> +0, 39, 39, 1, 1378560, 0x6579d31a
>>> +1, 78536, 78536, 1024, 8192, 0x00000000
>>> +1, 79560, 79560, 1024, 8192, 0x687330d2
>>> +0, 40, 40, 1, 1378560, 0xca1deba8
>>> +1, 80568, 80568, 1024, 8192, 0x9131462c
>>> +1, 81648, 81648, 1024, 8192, 0x48c01c32
>>> +0, 41, 41, 1, 1378560, 0xd4eed467
>>> +1, 82672, 82672, 1024, 8192, 0x0ccd8d5f
>>> +1, 83688, 83688, 1024, 8192, 0xd50cbe9f
>>> +0, 42, 42, 1, 1378560, 0xd6e1d5b7
>>> +1, 84696, 84696, 1024, 8192, 0xbe069303
>>> +1, 85720, 85720, 1024, 8192, 0x85fccf5b
>>> +0, 43, 43, 1, 1378560, 0x0b574d39
>>> +1, 86744, 86744, 1024, 8192, 0x4180de71
>>> +1, 87768, 87768, 1024, 8192, 0x0e9b6ac3
>>> +0, 44, 44, 1, 1378560, 0x1bdd4d61
>>> +1, 88776, 88776, 1024, 8192, 0x5c33f724
>>> +1, 89800, 89800, 1024, 8192, 0x668aaaec
>>> +0, 45, 45, 1, 1378560, 0x3b28f549
>>> +1, 90824, 90824, 1024, 8192, 0xd137d412
>>> +1, 91848, 91848, 1024, 8192, 0x08e1fbf6
>>> +0, 46, 46, 1, 1378560, 0x45b2f57b
>>> +1, 92856, 92856, 1024, 8192, 0xbf3fb4f6
>>> +1, 93880, 93880, 1024, 8192, 0x69cd08a4
>>> +0, 47, 47, 1, 1378560, 0x8955570e
>>> +1, 94904, 94904, 1024, 8192, 0xe0fe6297
>>> +1, 95928, 95928, 1024, 8192, 0x172867ad
>>> +1, 96936, 96936, 1024, 8192, 0xcbcc1461
>>> +0, 49, 49, 1, 1378560, 0x9c598000
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [FFmpeg-devel] [PATCH 04/21 v2] tests/fate: add a test for -streamloop with transcoding video+audio
2023-06-19 13:22 ` James Almer
@ 2023-06-19 13:39 ` Zhao Zhili
2023-06-19 15:48 ` Lynne
0 siblings, 1 reply; 37+ messages in thread
From: Zhao Zhili @ 2023-06-19 13:39 UTC (permalink / raw)
To: FFmpeg development discussions and patches
> 在 2023年6月19日,21:22,James Almer <jamrial@gmail.com> 写道:
>
> On 6/19/2023 9:34 AM, "zhilizhao(赵志立)" wrote:
>>>> On Jun 19, 2023, at 20:29, James Almer <jamrial@gmail.com> wrote:
>>>
>>> On 6/16/2023 3:01 AM, Anton Khirnov wrote:
>>>> ---
>>>> Now using aacdec_fixed with s32le output
>>>> ---
>>>> tests/fate/ffmpeg.mak | 4 +
>>>> tests/ref/fate/ffmpeg-streamloop-transcode-av | 151 ++++++++++++++++++
>>>> 2 files changed, 155 insertions(+)
>>>> create mode 100644 tests/ref/fate/ffmpeg-streamloop-transcode-av
>>>> diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
>>>> index c26c748934..87cd0b46d0 100644
>>>> --- a/tests/fate/ffmpeg.mak
>>>> +++ b/tests/fate/ffmpeg.mak
>>>> @@ -132,6 +132,10 @@ fate-ffmpeg-fix_sub_duration_heartbeat: CMD = fmtstdout srt -fix_sub_duration \
>>>> -c:s srt \
>>>> -f null -
>>>> +FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MATROSKA, H264 AAC_FIXED, PCM_S32LE_ENCODER) += fate-ffmpeg-streamloop-transcode-av
>>>> +fate-ffmpeg-streamloop-transcode-av: CMD = \
>>>> + framecrc -auto_conversion_filters -stream_loop 3 -i $(TARGET_SAMPLES)/mkv/1242-small.mkv -c:a pcm_s32le
>>>
>>> I think this is missing -c:a ac3_fixed before the -i
>> You mean aac_fixed? I have tried, but the result on two processor don't match neither.
>
> The output will of course be different than what's in the reference file in this patch. What matters is that the new output does match across different CPUs.
Yes I know the idea, what I said is the second case.
>
>>>
>>>> +
>>>> FATE_STREAMCOPY-$(call REMUX, MP4 MOV, EAC3_DEMUXER) += fate-copy-trac3074
>>>> fate-copy-trac3074: CMD = transcode eac3 $(TARGET_SAMPLES)/eac3/csi_miami_stereo_128_spx.eac3\
>>>> mp4 "-codec copy -map 0" "-codec copy"
>>>> diff --git a/tests/ref/fate/ffmpeg-streamloop-transcode-av b/tests/ref/fate/ffmpeg-streamloop-transcode-av
>>>> new file mode 100644
>>>> index 0000000000..50a626b281
>>>> --- /dev/null
>>>> +++ b/tests/ref/fate/ffmpeg-streamloop-transcode-av
>>>> @@ -0,0 +1,151 @@
>>>> +#tb 0: 125/2997
>>>> +#media_type 0: video
>>>> +#codec_id 0: rawvideo
>>>> +#dimensions 0: 1280x718
>>>> +#sar 0: 1/1
>>>> +#tb 1: 1/48000
>>>> +#media_type 1: audio
>>>> +#codec_id 1: pcm_s32le
>>>> +#sample_rate 1: 48000
>>>> +#channel_layout_name 1: stereo
>>>> +0, 0, 0, 1, 1378560, 0xbaf121ba
>>>> +1, 0, 0, 1024, 8192, 0x00000000
>>>> +1, 1024, 1024, 1024, 8192, 0x00000000
>>>> +0, 1, 1, 1, 1378560, 0xbaf121ba
>>>> +1, 2040, 2040, 1024, 8192, 0x00000000
>>>> +1, 3048, 3048, 1024, 8192, 0x00000000
>>>> +0, 2, 2, 1, 1378560, 0x6579d31a
>>>> +1, 4072, 4072, 1024, 8192, 0x00000000
>>>> +1, 5096, 5096, 1024, 8192, 0x00000000
>>>> +0, 3, 3, 1, 1378560, 0xca1deba8
>>>> +1, 6120, 6120, 1024, 8192, 0x687330d2
>>>> +1, 7128, 7128, 1024, 8192, 0x9131462c
>>>> +0, 4, 4, 1, 1378560, 0xd4eed467
>>>> +1, 8208, 8208, 1024, 8192, 0x48c01c32
>>>> +1, 9232, 9232, 1024, 8192, 0x0ccd8d5f
>>>> +0, 5, 5, 1, 1378560, 0xd6e1d5b7
>>>> +1, 10248, 10248, 1024, 8192, 0xd50cbe9f
>>>> +1, 11256, 11256, 1024, 8192, 0xbe069303
>>>> +0, 6, 6, 1, 1378560, 0x0b574d39
>>>> +1, 12280, 12280, 1024, 8192, 0x85fccf5b
>>>> +1, 13304, 13304, 1024, 8192, 0x4180de71
>>>> +0, 7, 7, 1, 1378560, 0x1bdd4d61
>>>> +1, 14328, 14328, 1024, 8192, 0x0e9b6ac3
>>>> +1, 15336, 15336, 1024, 8192, 0x5c33f724
>>>> +0, 8, 8, 1, 1378560, 0x3b28f549
>>>> +1, 16360, 16360, 1024, 8192, 0x668aaaec
>>>> +1, 17384, 17384, 1024, 8192, 0xd137d412
>>>> +0, 9, 9, 1, 1378560, 0x45b2f57b
>>>> +1, 18408, 18408, 1024, 8192, 0x08e1fbf6
>>>> +1, 19416, 19416, 1024, 8192, 0xbf3fb4f6
>>>> +0, 10, 10, 1, 1378560, 0x8955570e
>>>> +1, 20440, 20440, 1024, 8192, 0x69cd08a4
>>>> +1, 21464, 21464, 1024, 8192, 0xe0fe6297
>>>> +1, 22488, 22488, 1024, 8192, 0x172867ad
>>>> +1, 23496, 23496, 1024, 8192, 0xcbcc1461
>>>> +0, 12, 12, 1, 1378560, 0x9c598000
>>>> +1, 25488, 25488, 1024, 8192, 0x00000000
>>>> +0, 13, 13, 1, 1378560, 0xbaf121ba
>>>> +1, 26512, 26512, 1024, 8192, 0x00000000
>>>> +1, 27528, 27528, 1024, 8192, 0x00000000
>>>> +0, 14, 14, 1, 1378560, 0xbaf121ba
>>>> +1, 28552, 28552, 1024, 8192, 0x00000000
>>>> +1, 29576, 29576, 1024, 8192, 0x00000000
>>>> +0, 15, 15, 1, 1378560, 0x6579d31a
>>>> +1, 30600, 30600, 1024, 8192, 0x687330d2
>>>> +1, 31608, 31608, 1024, 8192, 0x9131462c
>>>> +0, 16, 16, 1, 1378560, 0xca1deba8
>>>> +1, 32688, 32688, 1024, 8192, 0x48c01c32
>>>> +1, 33712, 33712, 1024, 8192, 0x0ccd8d5f
>>>> +0, 17, 17, 1, 1378560, 0xd4eed467
>>>> +1, 34728, 34728, 1024, 8192, 0xd50cbe9f
>>>> +1, 35736, 35736, 1024, 8192, 0xbe069303
>>>> +0, 18, 18, 1, 1378560, 0xd6e1d5b7
>>>> +1, 36760, 36760, 1024, 8192, 0x85fccf5b
>>>> +1, 37784, 37784, 1024, 8192, 0x4180de71
>>>> +0, 19, 19, 1, 1378560, 0x0b574d39
>>>> +1, 38808, 38808, 1024, 8192, 0x0e9b6ac3
>>>> +1, 39816, 39816, 1024, 8192, 0x5c33f724
>>>> +0, 20, 20, 1, 1378560, 0x1bdd4d61
>>>> +1, 40840, 40840, 1024, 8192, 0x668aaaec
>>>> +1, 41864, 41864, 1024, 8192, 0xd137d412
>>>> +0, 21, 21, 1, 1378560, 0x3b28f549
>>>> +1, 42888, 42888, 1024, 8192, 0x08e1fbf6
>>>> +1, 43896, 43896, 1024, 8192, 0xbf3fb4f6
>>>> +0, 22, 22, 1, 1378560, 0x45b2f57b
>>>> +1, 44920, 44920, 1024, 8192, 0x69cd08a4
>>>> +1, 45944, 45944, 1024, 8192, 0xe0fe6297
>>>> +0, 23, 23, 1, 1378560, 0x8955570e
>>>> +1, 46968, 46968, 1024, 8192, 0x172867ad
>>>> +1, 47976, 47976, 1024, 8192, 0xcbcc1461
>>>> +0, 24, 24, 1, 1378560, 0x9c598000
>>>> +1, 49968, 49968, 1024, 8192, 0x00000000
>>>> +0, 25, 25, 1, 1378560, 0xbaf121ba
>>>> +1, 50992, 50992, 1024, 8192, 0x00000000
>>>> +1, 52008, 52008, 1024, 8192, 0x00000000
>>>> +0, 26, 26, 1, 1378560, 0xbaf121ba
>>>> +1, 53032, 53032, 1024, 8192, 0x00000000
>>>> +0, 27, 27, 1, 1378560, 0x6579d31a
>>>> +1, 54056, 54056, 1024, 8192, 0x00000000
>>>> +1, 55080, 55080, 1024, 8192, 0x687330d2
>>>> +0, 28, 28, 1, 1378560, 0xca1deba8
>>>> +1, 56088, 56088, 1024, 8192, 0x9131462c
>>>> +1, 57168, 57168, 1024, 8192, 0x48c01c32
>>>> +0, 29, 29, 1, 1378560, 0xd4eed467
>>>> +1, 58192, 58192, 1024, 8192, 0x0ccd8d5f
>>>> +1, 59208, 59208, 1024, 8192, 0xd50cbe9f
>>>> +0, 30, 30, 1, 1378560, 0xd6e1d5b7
>>>> +1, 60216, 60216, 1024, 8192, 0xbe069303
>>>> +1, 61240, 61240, 1024, 8192, 0x85fccf5b
>>>> +0, 31, 31, 1, 1378560, 0x0b574d39
>>>> +1, 62264, 62264, 1024, 8192, 0x4180de71
>>>> +1, 63288, 63288, 1024, 8192, 0x0e9b6ac3
>>>> +0, 32, 32, 1, 1378560, 0x1bdd4d61
>>>> +1, 64296, 64296, 1024, 8192, 0x5c33f724
>>>> +1, 65320, 65320, 1024, 8192, 0x668aaaec
>>>> +0, 33, 33, 1, 1378560, 0x3b28f549
>>>> +1, 66344, 66344, 1024, 8192, 0xd137d412
>>>> +1, 67368, 67368, 1024, 8192, 0x08e1fbf6
>>>> +0, 34, 34, 1, 1378560, 0x45b2f57b
>>>> +1, 68376, 68376, 1024, 8192, 0xbf3fb4f6
>>>> +1, 69400, 69400, 1024, 8192, 0x69cd08a4
>>>> +0, 35, 35, 1, 1378560, 0x8955570e
>>>> +1, 70424, 70424, 1024, 8192, 0xe0fe6297
>>>> +1, 71448, 71448, 1024, 8192, 0x172867ad
>>>> +0, 36, 36, 1, 1378560, 0x9c598000
>>>> +1, 72456, 72456, 1024, 8192, 0xcbcc1461
>>>> +0, 37, 37, 1, 1378560, 0xbaf121ba
>>>> +1, 74448, 74448, 1024, 8192, 0x00000000
>>>> +1, 75472, 75472, 1024, 8192, 0x00000000
>>>> +0, 38, 38, 1, 1378560, 0xbaf121ba
>>>> +1, 76488, 76488, 1024, 8192, 0x00000000
>>>> +1, 77512, 77512, 1024, 8192, 0x00000000
>>>> +0, 39, 39, 1, 1378560, 0x6579d31a
>>>> +1, 78536, 78536, 1024, 8192, 0x00000000
>>>> +1, 79560, 79560, 1024, 8192, 0x687330d2
>>>> +0, 40, 40, 1, 1378560, 0xca1deba8
>>>> +1, 80568, 80568, 1024, 8192, 0x9131462c
>>>> +1, 81648, 81648, 1024, 8192, 0x48c01c32
>>>> +0, 41, 41, 1, 1378560, 0xd4eed467
>>>> +1, 82672, 82672, 1024, 8192, 0x0ccd8d5f
>>>> +1, 83688, 83688, 1024, 8192, 0xd50cbe9f
>>>> +0, 42, 42, 1, 1378560, 0xd6e1d5b7
>>>> +1, 84696, 84696, 1024, 8192, 0xbe069303
>>>> +1, 85720, 85720, 1024, 8192, 0x85fccf5b
>>>> +0, 43, 43, 1, 1378560, 0x0b574d39
>>>> +1, 86744, 86744, 1024, 8192, 0x4180de71
>>>> +1, 87768, 87768, 1024, 8192, 0x0e9b6ac3
>>>> +0, 44, 44, 1, 1378560, 0x1bdd4d61
>>>> +1, 88776, 88776, 1024, 8192, 0x5c33f724
>>>> +1, 89800, 89800, 1024, 8192, 0x668aaaec
>>>> +0, 45, 45, 1, 1378560, 0x3b28f549
>>>> +1, 90824, 90824, 1024, 8192, 0xd137d412
>>>> +1, 91848, 91848, 1024, 8192, 0x08e1fbf6
>>>> +0, 46, 46, 1, 1378560, 0x45b2f57b
>>>> +1, 92856, 92856, 1024, 8192, 0xbf3fb4f6
>>>> +1, 93880, 93880, 1024, 8192, 0x69cd08a4
>>>> +0, 47, 47, 1, 1378560, 0x8955570e
>>>> +1, 94904, 94904, 1024, 8192, 0xe0fe6297
>>>> +1, 95928, 95928, 1024, 8192, 0x172867ad
>>>> +1, 96936, 96936, 1024, 8192, 0xcbcc1461
>>>> +0, 49, 49, 1, 1378560, 0x9c598000
>>> _______________________________________________
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel@ffmpeg.org
>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>
>>> To unsubscribe, visit link above, or email
>>> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpe
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [FFmpeg-devel] [PATCH 04/21 v2] tests/fate: add a test for -streamloop with transcoding video+audio
2023-06-19 13:39 ` Zhao Zhili
@ 2023-06-19 15:48 ` Lynne
2023-06-19 20:33 ` Martin Storsjö
0 siblings, 1 reply; 37+ messages in thread
From: Lynne @ 2023-06-19 15:48 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Jun 19, 2023, 15:40 by quinkblack@foxmail.com:
>> 在 2023年6月19日,21:22,James Almer <jamrial@gmail.com> 写道:
>>
>> On 6/19/2023 9:34 AM, "zhilizhao(赵志立)" wrote:
>>
>>>>> On Jun 19, 2023, at 20:29, James Almer <jamrial@gmail.com> wrote:
>>>>>
>>>>
>>>> On 6/16/2023 3:01 AM, Anton Khirnov wrote:
>>>>
>>>>> ---
>>>>> Now using aacdec_fixed with s32le output
>>>>> ---
>>>>> tests/fate/ffmpeg.mak | 4 +
>>>>> tests/ref/fate/ffmpeg-streamloop-transcode-av | 151 ++++++++++++++++++
>>>>> 2 files changed, 155 insertions(+)
>>>>> create mode 100644 tests/ref/fate/ffmpeg-streamloop-transcode-av
>>>>> diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
>>>>> index c26c748934..87cd0b46d0 100644
>>>>> --- a/tests/fate/ffmpeg.mak
>>>>> +++ b/tests/fate/ffmpeg.mak
>>>>> @@ -132,6 +132,10 @@ fate-ffmpeg-fix_sub_duration_heartbeat: CMD = fmtstdout srt -fix_sub_duration \
>>>>> -c:s srt \
>>>>> -f null -
>>>>> +FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MATROSKA, H264 AAC_FIXED, PCM_S32LE_ENCODER) += fate-ffmpeg-streamloop-transcode-av
>>>>> +fate-ffmpeg-streamloop-transcode-av: CMD = \
>>>>> + framecrc -auto_conversion_filters -stream_loop 3 -i $(TARGET_SAMPLES)/mkv/1242-small.mkv -c:a pcm_s32le
>>>>>
>>>>
>>>> I think this is missing -c:a ac3_fixed before the -i
>>>>
>>> You mean aac_fixed? I have tried, but the result on two processor don't match neither.
>>>
>>
>> The output will of course be different than what's in the reference file in this patch. What matters is that the new output does match across different CPUs.
>>
>
> Yes I know the idea, what I said is the second case.
>
Could you run the test on a system where it fails with
this diff applied: https://0x0.st/HTOD.diff
Thanks
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [FFmpeg-devel] [PATCH 04/21 v2] tests/fate: add a test for -streamloop with transcoding video+audio
2023-06-19 15:48 ` Lynne
@ 2023-06-19 20:33 ` Martin Storsjö
0 siblings, 0 replies; 37+ messages in thread
From: Martin Storsjö @ 2023-06-19 20:33 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Mon, 19 Jun 2023, Lynne wrote:
> Could you run the test on a system where it fails with
> this diff applied: https://0x0.st/HTOD.diff
This patch, on top of Anton's, does get me reproducible results across
i686/x86_64/arm/aarch64 in a couple combinations I've tested. (I guess
it's plausible that since it forces a lot of constants to plain 1, it
might hide another bug - but I don't think that's necessarily the case -
this looks like a quite possible source of inexactness.)
// Martin
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* [FFmpeg-devel] [PATCH 05/21] fftools/ffmpeg_demux: move the loop out of add_input_streams()
2023-06-14 16:48 [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
` (2 preceding siblings ...)
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 04/21] tests/fate: add a test for -streamloop with transcoding video+audio Anton Khirnov
@ 2023-06-14 16:48 ` Anton Khirnov
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 06/21] fftools/ffmpeg_demux: reindent after previous commit Anton Khirnov
` (16 subsequent siblings)
20 siblings, 0 replies; 37+ messages in thread
From: Anton Khirnov @ 2023-06-14 16:48 UTC (permalink / raw)
To: ffmpeg-devel
Make the function process just one input stream at a time and save an
indentation level. Also rename it to ist_add() to be consistent with an
analogous function in ffmpeg_mux_init.
---
fftools/ffmpeg_demux.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 5e5f106368..ea407d1f28 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -1032,15 +1032,9 @@ static DemuxStream *demux_stream_alloc(Demuxer *d, AVStream *st)
return ds;
}
-/* Add all the streams from the given input file to the demuxer */
-static void add_input_streams(const OptionsContext *o, Demuxer *d)
+static void ist_add(const OptionsContext *o, Demuxer *d, AVStream *st)
{
- InputFile *f = &d->f;
- AVFormatContext *ic = f->ctx;
- int i, ret;
-
- for (i = 0; i < ic->nb_streams; i++) {
- AVStream *st = ic->streams[i];
+ AVFormatContext *ic = d->f.ctx;
AVCodecParameters *par = st->codecpar;
DemuxStream *ds;
InputStream *ist;
@@ -1053,6 +1047,7 @@ static void add_input_streams(const OptionsContext *o, Demuxer *d)
const AVClass *cc = avcodec_get_class();
const AVOption *discard_opt = av_opt_find(&cc, "skip_frame", NULL,
0, AV_OPT_SEARCH_FAKE_OBJ);
+ int ret;
ds = demux_stream_alloc(d, st);
ist = &ds->ist;
@@ -1265,7 +1260,6 @@ static void add_input_streams(const OptionsContext *o, Demuxer *d)
}
ist->codec_desc = avcodec_descriptor_get(ist->par->codec_id);
- }
}
static void dump_attachment(InputStream *ist, const char *filename)
@@ -1580,7 +1574,9 @@ int ifile_open(const OptionsContext *o, const char *filename)
d->thread_queue_size = o->thread_queue_size;
- add_input_streams(o, d);
+ /* Add all the streams from the given input file to the demuxer */
+ for (int i = 0; i < ic->nb_streams; i++)
+ ist_add(o, d, ic->streams[i]);
/* dump the file content */
av_dump_format(ic, f->index, filename, 0);
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* [FFmpeg-devel] [PATCH 06/21] fftools/ffmpeg_demux: reindent after previous commit
2023-06-14 16:48 [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
` (3 preceding siblings ...)
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 05/21] fftools/ffmpeg_demux: move the loop out of add_input_streams() Anton Khirnov
@ 2023-06-14 16:48 ` Anton Khirnov
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 07/21] fftools/ffmpeg_hw: inline hwaccel_decode_init() into its caller Anton Khirnov
` (15 subsequent siblings)
20 siblings, 0 replies; 37+ messages in thread
From: Anton Khirnov @ 2023-06-14 16:48 UTC (permalink / raw)
To: ffmpeg-devel
---
fftools/ffmpeg_demux.c | 390 ++++++++++++++++++++---------------------
1 file changed, 195 insertions(+), 195 deletions(-)
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index ea407d1f28..84c286dd65 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -1035,231 +1035,231 @@ static DemuxStream *demux_stream_alloc(Demuxer *d, AVStream *st)
static void ist_add(const OptionsContext *o, Demuxer *d, AVStream *st)
{
AVFormatContext *ic = d->f.ctx;
- AVCodecParameters *par = st->codecpar;
- DemuxStream *ds;
- InputStream *ist;
- char *framerate = NULL, *hwaccel_device = NULL;
- const char *hwaccel = NULL;
- char *hwaccel_output_format = NULL;
- char *codec_tag = NULL;
- char *next;
- char *discard_str = NULL;
- const AVClass *cc = avcodec_get_class();
- const AVOption *discard_opt = av_opt_find(&cc, "skip_frame", NULL,
- 0, AV_OPT_SEARCH_FAKE_OBJ);
- int ret;
+ AVCodecParameters *par = st->codecpar;
+ DemuxStream *ds;
+ InputStream *ist;
+ char *framerate = NULL, *hwaccel_device = NULL;
+ const char *hwaccel = NULL;
+ char *hwaccel_output_format = NULL;
+ char *codec_tag = NULL;
+ char *next;
+ char *discard_str = NULL;
+ const AVClass *cc = avcodec_get_class();
+ const AVOption *discard_opt = av_opt_find(&cc, "skip_frame", NULL,
+ 0, AV_OPT_SEARCH_FAKE_OBJ);
+ int ret;
- ds = demux_stream_alloc(d, st);
- ist = &ds->ist;
+ ds = demux_stream_alloc(d, st);
+ ist = &ds->ist;
- ist->discard = 1;
- st->discard = AVDISCARD_ALL;
- ist->nb_samples = 0;
- ds->first_dts = AV_NOPTS_VALUE;
- ds->next_dts = AV_NOPTS_VALUE;
+ ist->discard = 1;
+ st->discard = AVDISCARD_ALL;
+ ist->nb_samples = 0;
+ ds->first_dts = AV_NOPTS_VALUE;
+ ds->next_dts = AV_NOPTS_VALUE;
- ds->min_pts = INT64_MAX;
- ds->max_pts = INT64_MIN;
+ ds->min_pts = INT64_MAX;
+ ds->max_pts = INT64_MIN;
- ds->ts_scale = 1.0;
- MATCH_PER_STREAM_OPT(ts_scale, dbl, ds->ts_scale, ic, st);
+ ds->ts_scale = 1.0;
+ MATCH_PER_STREAM_OPT(ts_scale, dbl, ds->ts_scale, ic, st);
- ist->autorotate = 1;
- MATCH_PER_STREAM_OPT(autorotate, i, ist->autorotate, ic, st);
+ ist->autorotate = 1;
+ MATCH_PER_STREAM_OPT(autorotate, i, ist->autorotate, ic, st);
- MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, ic, st);
- if (codec_tag) {
- uint32_t tag = strtol(codec_tag, &next, 0);
- if (*next) {
- uint8_t buf[4] = { 0 };
- memcpy(buf, codec_tag, FFMIN(sizeof(buf), strlen(codec_tag)));
- tag = AV_RL32(buf);
- }
-
- st->codecpar->codec_tag = tag;
+ MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, ic, st);
+ if (codec_tag) {
+ uint32_t tag = strtol(codec_tag, &next, 0);
+ if (*next) {
+ uint8_t buf[4] = { 0 };
+ memcpy(buf, codec_tag, FFMIN(sizeof(buf), strlen(codec_tag)));
+ tag = AV_RL32(buf);
}
- if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
- add_display_matrix_to_stream(o, ic, ist);
+ st->codecpar->codec_tag = tag;
+ }
- MATCH_PER_STREAM_OPT(hwaccels, str, hwaccel, ic, st);
- MATCH_PER_STREAM_OPT(hwaccel_output_formats, str,
- hwaccel_output_format, ic, st);
+ if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
+ add_display_matrix_to_stream(o, ic, ist);
- if (!hwaccel_output_format && hwaccel && !strcmp(hwaccel, "cuvid")) {
- av_log(ist, AV_LOG_WARNING,
- "WARNING: defaulting hwaccel_output_format to cuda for compatibility "
- "with old commandlines. This behaviour is DEPRECATED and will be removed "
- "in the future. Please explicitly set \"-hwaccel_output_format cuda\".\n");
- ist->hwaccel_output_format = AV_PIX_FMT_CUDA;
- } else if (!hwaccel_output_format && hwaccel && !strcmp(hwaccel, "qsv")) {
- av_log(ist, AV_LOG_WARNING,
- "WARNING: defaulting hwaccel_output_format to qsv for compatibility "
- "with old commandlines. This behaviour is DEPRECATED and will be removed "
- "in the future. Please explicitly set \"-hwaccel_output_format qsv\".\n");
- ist->hwaccel_output_format = AV_PIX_FMT_QSV;
- } else if (!hwaccel_output_format && hwaccel && !strcmp(hwaccel, "mediacodec")) {
- // There is no real AVHWFrameContext implementation. Set
- // hwaccel_output_format to avoid av_hwframe_transfer_data error.
- ist->hwaccel_output_format = AV_PIX_FMT_MEDIACODEC;
- } else if (hwaccel_output_format) {
- ist->hwaccel_output_format = av_get_pix_fmt(hwaccel_output_format);
- if (ist->hwaccel_output_format == AV_PIX_FMT_NONE) {
- av_log(ist, AV_LOG_FATAL, "Unrecognised hwaccel output "
- "format: %s", hwaccel_output_format);
- }
- } else {
- ist->hwaccel_output_format = AV_PIX_FMT_NONE;
+ MATCH_PER_STREAM_OPT(hwaccels, str, hwaccel, ic, st);
+ MATCH_PER_STREAM_OPT(hwaccel_output_formats, str,
+ hwaccel_output_format, ic, st);
+
+ if (!hwaccel_output_format && hwaccel && !strcmp(hwaccel, "cuvid")) {
+ av_log(ist, AV_LOG_WARNING,
+ "WARNING: defaulting hwaccel_output_format to cuda for compatibility "
+ "with old commandlines. This behaviour is DEPRECATED and will be removed "
+ "in the future. Please explicitly set \"-hwaccel_output_format cuda\".\n");
+ ist->hwaccel_output_format = AV_PIX_FMT_CUDA;
+ } else if (!hwaccel_output_format && hwaccel && !strcmp(hwaccel, "qsv")) {
+ av_log(ist, AV_LOG_WARNING,
+ "WARNING: defaulting hwaccel_output_format to qsv for compatibility "
+ "with old commandlines. This behaviour is DEPRECATED and will be removed "
+ "in the future. Please explicitly set \"-hwaccel_output_format qsv\".\n");
+ ist->hwaccel_output_format = AV_PIX_FMT_QSV;
+ } else if (!hwaccel_output_format && hwaccel && !strcmp(hwaccel, "mediacodec")) {
+ // There is no real AVHWFrameContext implementation. Set
+ // hwaccel_output_format to avoid av_hwframe_transfer_data error.
+ ist->hwaccel_output_format = AV_PIX_FMT_MEDIACODEC;
+ } else if (hwaccel_output_format) {
+ ist->hwaccel_output_format = av_get_pix_fmt(hwaccel_output_format);
+ if (ist->hwaccel_output_format == AV_PIX_FMT_NONE) {
+ av_log(ist, AV_LOG_FATAL, "Unrecognised hwaccel output "
+ "format: %s", hwaccel_output_format);
}
-
- if (hwaccel) {
- // The NVDEC hwaccels use a CUDA device, so remap the name here.
- if (!strcmp(hwaccel, "nvdec") || !strcmp(hwaccel, "cuvid"))
- hwaccel = "cuda";
-
- if (!strcmp(hwaccel, "none"))
- ist->hwaccel_id = HWACCEL_NONE;
- else if (!strcmp(hwaccel, "auto"))
- ist->hwaccel_id = HWACCEL_AUTO;
- else {
- enum AVHWDeviceType type = av_hwdevice_find_type_by_name(hwaccel);
- if (type != AV_HWDEVICE_TYPE_NONE) {
- ist->hwaccel_id = HWACCEL_GENERIC;
- ist->hwaccel_device_type = type;
- }
-
- if (!ist->hwaccel_id) {
- av_log(ist, AV_LOG_FATAL, "Unrecognized hwaccel: %s.\n",
- hwaccel);
- av_log(ist, AV_LOG_FATAL, "Supported hwaccels: ");
- type = AV_HWDEVICE_TYPE_NONE;
- while ((type = av_hwdevice_iterate_types(type)) !=
- AV_HWDEVICE_TYPE_NONE)
- av_log(ist, AV_LOG_FATAL, "%s ",
- av_hwdevice_get_type_name(type));
- av_log(ist, AV_LOG_FATAL, "\n");
- exit_program(1);
- }
- }
- }
-
- MATCH_PER_STREAM_OPT(hwaccel_devices, str, hwaccel_device, ic, st);
- if (hwaccel_device) {
- ist->hwaccel_device = av_strdup(hwaccel_device);
- if (!ist->hwaccel_device)
- report_and_exit(AVERROR(ENOMEM));
- }
-
- ist->hwaccel_pix_fmt = AV_PIX_FMT_NONE;
+ } else {
+ ist->hwaccel_output_format = AV_PIX_FMT_NONE;
}
- ist->dec = choose_decoder(o, ic, st, ist->hwaccel_id, ist->hwaccel_device_type);
- ist->decoder_opts = filter_codec_opts(o->g->codec_opts, ist->st->codecpar->codec_id, ic, st, ist->dec);
+ if (hwaccel) {
+ // The NVDEC hwaccels use a CUDA device, so remap the name here.
+ if (!strcmp(hwaccel, "nvdec") || !strcmp(hwaccel, "cuvid"))
+ hwaccel = "cuda";
- ist->reinit_filters = -1;
- MATCH_PER_STREAM_OPT(reinit_filters, i, ist->reinit_filters, ic, st);
+ if (!strcmp(hwaccel, "none"))
+ ist->hwaccel_id = HWACCEL_NONE;
+ else if (!strcmp(hwaccel, "auto"))
+ ist->hwaccel_id = HWACCEL_AUTO;
+ else {
+ enum AVHWDeviceType type = av_hwdevice_find_type_by_name(hwaccel);
+ if (type != AV_HWDEVICE_TYPE_NONE) {
+ ist->hwaccel_id = HWACCEL_GENERIC;
+ ist->hwaccel_device_type = type;
+ }
- MATCH_PER_STREAM_OPT(discard, str, discard_str, ic, st);
- ist->user_set_discard = AVDISCARD_NONE;
+ if (!ist->hwaccel_id) {
+ av_log(ist, AV_LOG_FATAL, "Unrecognized hwaccel: %s.\n",
+ hwaccel);
+ av_log(ist, AV_LOG_FATAL, "Supported hwaccels: ");
+ type = AV_HWDEVICE_TYPE_NONE;
+ while ((type = av_hwdevice_iterate_types(type)) !=
+ AV_HWDEVICE_TYPE_NONE)
+ av_log(ist, AV_LOG_FATAL, "%s ",
+ av_hwdevice_get_type_name(type));
+ av_log(ist, AV_LOG_FATAL, "\n");
+ exit_program(1);
+ }
+ }
+ }
- if ((o->video_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) ||
- (o->audio_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) ||
- (o->subtitle_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) ||
- (o->data_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_DATA))
- ist->user_set_discard = AVDISCARD_ALL;
+ MATCH_PER_STREAM_OPT(hwaccel_devices, str, hwaccel_device, ic, st);
+ if (hwaccel_device) {
+ ist->hwaccel_device = av_strdup(hwaccel_device);
+ if (!ist->hwaccel_device)
+ report_and_exit(AVERROR(ENOMEM));
+ }
- if (discard_str && av_opt_eval_int(&cc, discard_opt, discard_str, &ist->user_set_discard) < 0) {
- av_log(ist, AV_LOG_ERROR, "Error parsing discard %s.\n",
- discard_str);
+ ist->hwaccel_pix_fmt = AV_PIX_FMT_NONE;
+ }
+
+ ist->dec = choose_decoder(o, ic, st, ist->hwaccel_id, ist->hwaccel_device_type);
+ ist->decoder_opts = filter_codec_opts(o->g->codec_opts, ist->st->codecpar->codec_id, ic, st, ist->dec);
+
+ ist->reinit_filters = -1;
+ MATCH_PER_STREAM_OPT(reinit_filters, i, ist->reinit_filters, ic, st);
+
+ MATCH_PER_STREAM_OPT(discard, str, discard_str, ic, st);
+ ist->user_set_discard = AVDISCARD_NONE;
+
+ if ((o->video_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) ||
+ (o->audio_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) ||
+ (o->subtitle_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) ||
+ (o->data_disable && ist->st->codecpar->codec_type == AVMEDIA_TYPE_DATA))
+ ist->user_set_discard = AVDISCARD_ALL;
+
+ if (discard_str && av_opt_eval_int(&cc, discard_opt, discard_str, &ist->user_set_discard) < 0) {
+ av_log(ist, AV_LOG_ERROR, "Error parsing discard %s.\n",
+ discard_str);
+ exit_program(1);
+ }
+
+ ist->dec_ctx = avcodec_alloc_context3(ist->dec);
+ if (!ist->dec_ctx)
+ report_and_exit(AVERROR(ENOMEM));
+
+ ret = avcodec_parameters_to_context(ist->dec_ctx, par);
+ if (ret < 0) {
+ av_log(ist, AV_LOG_ERROR, "Error initializing the decoder context.\n");
+ exit_program(1);
+ }
+
+ if (o->bitexact)
+ ist->dec_ctx->flags |= AV_CODEC_FLAG_BITEXACT;
+
+ switch (par->codec_type) {
+ case AVMEDIA_TYPE_VIDEO:
+ MATCH_PER_STREAM_OPT(frame_rates, str, framerate, ic, st);
+ if (framerate && av_parse_video_rate(&ist->framerate,
+ framerate) < 0) {
+ av_log(ist, AV_LOG_ERROR, "Error parsing framerate %s.\n",
+ framerate);
exit_program(1);
}
- ist->dec_ctx = avcodec_alloc_context3(ist->dec);
- if (!ist->dec_ctx)
- report_and_exit(AVERROR(ENOMEM));
+ ist->top_field_first = -1;
+ MATCH_PER_STREAM_OPT(top_field_first, i, ist->top_field_first, ic, st);
- ret = avcodec_parameters_to_context(ist->dec_ctx, par);
- if (ret < 0) {
- av_log(ist, AV_LOG_ERROR, "Error initializing the decoder context.\n");
+ ist->framerate_guessed = av_guess_frame_rate(ic, st, NULL);
+
+ break;
+ case AVMEDIA_TYPE_AUDIO: {
+ int guess_layout_max = INT_MAX;
+ MATCH_PER_STREAM_OPT(guess_layout_max, i, guess_layout_max, ic, st);
+ guess_input_channel_layout(ist, guess_layout_max);
+ break;
+ }
+ case AVMEDIA_TYPE_DATA:
+ case AVMEDIA_TYPE_SUBTITLE: {
+ char *canvas_size = NULL;
+ MATCH_PER_STREAM_OPT(fix_sub_duration, i, ist->fix_sub_duration, ic, st);
+ MATCH_PER_STREAM_OPT(canvas_sizes, str, canvas_size, ic, st);
+ if (canvas_size &&
+ av_parse_video_size(&ist->dec_ctx->width, &ist->dec_ctx->height, canvas_size) < 0) {
+ av_log(ist, AV_LOG_FATAL, "Invalid canvas size: %s.\n", canvas_size);
exit_program(1);
}
- if (o->bitexact)
- ist->dec_ctx->flags |= AV_CODEC_FLAG_BITEXACT;
-
- switch (par->codec_type) {
- case AVMEDIA_TYPE_VIDEO:
- MATCH_PER_STREAM_OPT(frame_rates, str, framerate, ic, st);
- if (framerate && av_parse_video_rate(&ist->framerate,
- framerate) < 0) {
- av_log(ist, AV_LOG_ERROR, "Error parsing framerate %s.\n",
- framerate);
- exit_program(1);
- }
-
- ist->top_field_first = -1;
- MATCH_PER_STREAM_OPT(top_field_first, i, ist->top_field_first, ic, st);
-
- ist->framerate_guessed = av_guess_frame_rate(ic, st, NULL);
-
- break;
- case AVMEDIA_TYPE_AUDIO: {
- int guess_layout_max = INT_MAX;
- MATCH_PER_STREAM_OPT(guess_layout_max, i, guess_layout_max, ic, st);
- guess_input_channel_layout(ist, guess_layout_max);
- break;
- }
- case AVMEDIA_TYPE_DATA:
- case AVMEDIA_TYPE_SUBTITLE: {
- char *canvas_size = NULL;
- MATCH_PER_STREAM_OPT(fix_sub_duration, i, ist->fix_sub_duration, ic, st);
- MATCH_PER_STREAM_OPT(canvas_sizes, str, canvas_size, ic, st);
- if (canvas_size &&
- av_parse_video_size(&ist->dec_ctx->width, &ist->dec_ctx->height, canvas_size) < 0) {
- av_log(ist, AV_LOG_FATAL, "Invalid canvas size: %s.\n", canvas_size);
- exit_program(1);
- }
-
- /* Compute the size of the canvas for the subtitles stream.
- If the subtitles codecpar has set a size, use it. Otherwise use the
- maximum dimensions of the video streams in the same file. */
- ist->sub2video.w = ist->dec_ctx->width;
- ist->sub2video.h = ist->dec_ctx->height;
- if (!(ist->sub2video.w && ist->sub2video.h)) {
- for (int j = 0; j < ic->nb_streams; j++) {
- AVCodecParameters *par1 = ic->streams[j]->codecpar;
- if (par1->codec_type == AVMEDIA_TYPE_VIDEO) {
- ist->sub2video.w = FFMAX(ist->sub2video.w, par1->width);
- ist->sub2video.h = FFMAX(ist->sub2video.h, par1->height);
- }
+ /* Compute the size of the canvas for the subtitles stream.
+ If the subtitles codecpar has set a size, use it. Otherwise use the
+ maximum dimensions of the video streams in the same file. */
+ ist->sub2video.w = ist->dec_ctx->width;
+ ist->sub2video.h = ist->dec_ctx->height;
+ if (!(ist->sub2video.w && ist->sub2video.h)) {
+ for (int j = 0; j < ic->nb_streams; j++) {
+ AVCodecParameters *par1 = ic->streams[j]->codecpar;
+ if (par1->codec_type == AVMEDIA_TYPE_VIDEO) {
+ ist->sub2video.w = FFMAX(ist->sub2video.w, par1->width);
+ ist->sub2video.h = FFMAX(ist->sub2video.h, par1->height);
}
}
-
- if (!(ist->sub2video.w && ist->sub2video.h)) {
- ist->sub2video.w = FFMAX(ist->sub2video.w, 720);
- ist->sub2video.h = FFMAX(ist->sub2video.h, 576);
- }
-
- break;
- }
- case AVMEDIA_TYPE_ATTACHMENT:
- case AVMEDIA_TYPE_UNKNOWN:
- break;
- default:
- abort();
}
- ist->par = avcodec_parameters_alloc();
- if (!ist->par)
- report_and_exit(AVERROR(ENOMEM));
-
- ret = avcodec_parameters_from_context(ist->par, ist->dec_ctx);
- if (ret < 0) {
- av_log(ist, AV_LOG_ERROR, "Error initializing the decoder context.\n");
- exit_program(1);
+ if (!(ist->sub2video.w && ist->sub2video.h)) {
+ ist->sub2video.w = FFMAX(ist->sub2video.w, 720);
+ ist->sub2video.h = FFMAX(ist->sub2video.h, 576);
}
- ist->codec_desc = avcodec_descriptor_get(ist->par->codec_id);
+ break;
+ }
+ case AVMEDIA_TYPE_ATTACHMENT:
+ case AVMEDIA_TYPE_UNKNOWN:
+ break;
+ default:
+ abort();
+ }
+
+ ist->par = avcodec_parameters_alloc();
+ if (!ist->par)
+ report_and_exit(AVERROR(ENOMEM));
+
+ ret = avcodec_parameters_from_context(ist->par, ist->dec_ctx);
+ if (ret < 0) {
+ av_log(ist, AV_LOG_ERROR, "Error initializing the decoder context.\n");
+ exit_program(1);
+ }
+
+ ist->codec_desc = avcodec_descriptor_get(ist->par->codec_id);
}
static void dump_attachment(InputStream *ist, const char *filename)
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* [FFmpeg-devel] [PATCH 07/21] fftools/ffmpeg_hw: inline hwaccel_decode_init() into its caller
2023-06-14 16:48 [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
` (4 preceding siblings ...)
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 06/21] fftools/ffmpeg_demux: reindent after previous commit Anton Khirnov
@ 2023-06-14 16:48 ` Anton Khirnov
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 08/21] fftools/ffmpeg_dec: remove pointless InputStream.hwaccel_retrieve_data Anton Khirnov
` (14 subsequent siblings)
20 siblings, 0 replies; 37+ messages in thread
From: Anton Khirnov @ 2023-06-14 16:48 UTC (permalink / raw)
To: ffmpeg-devel
The function is now trivial and cannot fail, so all error handling in
its caller can be removed.
---
fftools/ffmpeg.h | 2 +-
fftools/ffmpeg_dec.c | 15 +--------------
fftools/ffmpeg_hw.c | 11 +----------
3 files changed, 3 insertions(+), 25 deletions(-)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 7189629ad4..aeecf92fe6 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -805,7 +805,7 @@ void hw_device_free_all(void);
*/
AVBufferRef *hw_device_for_filter(void);
-int hwaccel_decode_init(AVCodecContext *avctx);
+int hwaccel_retrieve_data(AVCodecContext *avctx, AVFrame *input);
int dec_open(InputStream *ist);
void dec_free(Decoder **pdec);
diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index 6582917a39..ca9fbb9bd8 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -538,7 +538,6 @@ static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat
{
InputStream *ist = s->opaque;
const enum AVPixelFormat *p;
- int ret;
for (p = pix_fmts; *p != AV_PIX_FMT_NONE; p++) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p);
@@ -562,19 +561,7 @@ static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat
}
}
if (config && config->device_type == ist->hwaccel_device_type) {
- ret = hwaccel_decode_init(s);
- if (ret < 0) {
- if (ist->hwaccel_id == HWACCEL_GENERIC) {
- av_log(NULL, AV_LOG_FATAL,
- "%s hwaccel requested for input stream #%d:%d, "
- "but cannot be initialized.\n",
- av_hwdevice_get_type_name(config->device_type),
- ist->file_index, ist->index);
- return AV_PIX_FMT_NONE;
- }
- continue;
- }
-
+ ist->hwaccel_retrieve_data = hwaccel_retrieve_data;
ist->hwaccel_pix_fmt = *p;
break;
}
diff --git a/fftools/ffmpeg_hw.c b/fftools/ffmpeg_hw.c
index 4a0b346fe1..46bc7e39c2 100644
--- a/fftools/ffmpeg_hw.c
+++ b/fftools/ffmpeg_hw.c
@@ -297,7 +297,7 @@ void hw_device_free_all(void)
nb_hw_devices = 0;
}
-static int hwaccel_retrieve_data(AVCodecContext *avctx, AVFrame *input)
+int hwaccel_retrieve_data(AVCodecContext *avctx, AVFrame *input)
{
InputStream *ist = avctx->opaque;
AVFrame *output = NULL;
@@ -339,15 +339,6 @@ fail:
return err;
}
-int hwaccel_decode_init(AVCodecContext *avctx)
-{
- InputStream *ist = avctx->opaque;
-
- ist->hwaccel_retrieve_data = &hwaccel_retrieve_data;
-
- return 0;
-}
-
AVBufferRef *hw_device_for_filter(void)
{
// Pick the last hardware device if the user doesn't pick the device for
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* [FFmpeg-devel] [PATCH 08/21] fftools/ffmpeg_dec: remove pointless InputStream.hwaccel_retrieve_data
2023-06-14 16:48 [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
` (5 preceding siblings ...)
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 07/21] fftools/ffmpeg_hw: inline hwaccel_decode_init() into its caller Anton Khirnov
@ 2023-06-14 16:48 ` Anton Khirnov
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 09/21] fftools/ffmpeg_dec: move InputStream.hwaccel_pix_fmt to Decoder Anton Khirnov
` (13 subsequent siblings)
20 siblings, 0 replies; 37+ messages in thread
From: Anton Khirnov @ 2023-06-14 16:48 UTC (permalink / raw)
To: ffmpeg-devel
It is always set to hwaccel_retrieve_data() from ffmpeg_hw.c, so that
function can just be called directly instead.
---
fftools/ffmpeg.h | 1 -
fftools/ffmpeg_dec.c | 5 ++---
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index aeecf92fe6..2559225dd6 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -393,7 +393,6 @@ typedef struct InputStream {
char *hwaccel_device;
enum AVPixelFormat hwaccel_output_format;
- int (*hwaccel_retrieve_data)(AVCodecContext *s, AVFrame *frame);
enum AVPixelFormat hwaccel_pix_fmt;
/* stats */
diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index ca9fbb9bd8..85132050d8 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -272,8 +272,8 @@ static int video_frame_process(InputStream *ist, AVFrame *frame)
if(ist->top_field_first>=0)
frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
- if (ist->hwaccel_retrieve_data && frame->format == ist->hwaccel_pix_fmt) {
- int err = ist->hwaccel_retrieve_data(ist->dec_ctx, frame);
+ if (frame->format == ist->hwaccel_pix_fmt) {
+ int err = hwaccel_retrieve_data(ist->dec_ctx, frame);
if (err < 0)
return err;
}
@@ -561,7 +561,6 @@ static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat
}
}
if (config && config->device_type == ist->hwaccel_device_type) {
- ist->hwaccel_retrieve_data = hwaccel_retrieve_data;
ist->hwaccel_pix_fmt = *p;
break;
}
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* [FFmpeg-devel] [PATCH 09/21] fftools/ffmpeg_dec: move InputStream.hwaccel_pix_fmt to Decoder
2023-06-14 16:48 [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
` (6 preceding siblings ...)
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 08/21] fftools/ffmpeg_dec: remove pointless InputStream.hwaccel_retrieve_data Anton Khirnov
@ 2023-06-14 16:48 ` Anton Khirnov
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 10/21] fftools/ffmpeg_enc: move dup_warning global variable to Encoder Anton Khirnov
` (12 subsequent siblings)
20 siblings, 0 replies; 37+ messages in thread
From: Anton Khirnov @ 2023-06-14 16:48 UTC (permalink / raw)
To: ffmpeg-devel
It is purely decoder-internal state.
---
fftools/ffmpeg.h | 2 --
fftools/ffmpeg_dec.c | 8 ++++++--
fftools/ffmpeg_demux.c | 2 --
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 2559225dd6..3c7e819507 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -393,8 +393,6 @@ typedef struct InputStream {
char *hwaccel_device;
enum AVPixelFormat hwaccel_output_format;
- enum AVPixelFormat hwaccel_pix_fmt;
-
/* stats */
// number of frames/samples retrieved from the decoder
uint64_t frames_decoded;
diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index 85132050d8..586be83dc1 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -35,6 +35,8 @@ struct Decoder {
AVFrame *frame;
AVPacket *pkt;
+ enum AVPixelFormat hwaccel_pix_fmt;
+
// pts/estimated duration of the last decoded frame
// * in decoder timebase for video,
// * in last_frame_tb (may change during decoding) for audio
@@ -79,6 +81,7 @@ static int dec_alloc(Decoder **pdec)
dec->last_filter_in_rescale_delta = AV_NOPTS_VALUE;
dec->last_frame_pts = AV_NOPTS_VALUE;
dec->last_frame_tb = (AVRational){ 1, 1 };
+ dec->hwaccel_pix_fmt = AV_PIX_FMT_NONE;
*pdec = dec;
@@ -272,7 +275,7 @@ static int video_frame_process(InputStream *ist, AVFrame *frame)
if(ist->top_field_first>=0)
frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
- if (frame->format == ist->hwaccel_pix_fmt) {
+ if (frame->format == d->hwaccel_pix_fmt) {
int err = hwaccel_retrieve_data(ist->dec_ctx, frame);
if (err < 0)
return err;
@@ -537,6 +540,7 @@ int dec_packet(InputStream *ist, const AVPacket *pkt, int no_eof)
static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts)
{
InputStream *ist = s->opaque;
+ Decoder *d = ist->decoder;
const enum AVPixelFormat *p;
for (p = pix_fmts; *p != AV_PIX_FMT_NONE; p++) {
@@ -561,7 +565,7 @@ static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat
}
}
if (config && config->device_type == ist->hwaccel_device_type) {
- ist->hwaccel_pix_fmt = *p;
+ d->hwaccel_pix_fmt = *p;
break;
}
}
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 84c286dd65..1c6a5aab7b 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -1149,8 +1149,6 @@ static void ist_add(const OptionsContext *o, Demuxer *d, AVStream *st)
if (!ist->hwaccel_device)
report_and_exit(AVERROR(ENOMEM));
}
-
- ist->hwaccel_pix_fmt = AV_PIX_FMT_NONE;
}
ist->dec = choose_decoder(o, ic, st, ist->hwaccel_id, ist->hwaccel_device_type);
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* [FFmpeg-devel] [PATCH 10/21] fftools/ffmpeg_enc: move dup_warning global variable to Encoder
2023-06-14 16:48 [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
` (7 preceding siblings ...)
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 09/21] fftools/ffmpeg_dec: move InputStream.hwaccel_pix_fmt to Decoder Anton Khirnov
@ 2023-06-14 16:48 ` Anton Khirnov
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 11/21] fftools/ffmpeg_filter: add an AVClass to FilterGraph Anton Khirnov
` (11 subsequent siblings)
20 siblings, 0 replies; 37+ messages in thread
From: Anton Khirnov @ 2023-06-14 16:48 UTC (permalink / raw)
To: ffmpeg-devel
---
fftools/ffmpeg_enc.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index 2bf4782a9f..0fdf7e7c4d 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -66,11 +66,11 @@ struct Encoder {
// number of packets received from the encoder
uint64_t packets_encoded;
+ uint64_t dup_warning;
+
int opened;
};
-static uint64_t dup_warning = 1000;
-
void enc_free(Encoder **penc)
{
Encoder *enc = *penc;
@@ -106,6 +106,8 @@ int enc_alloc(Encoder **penc, const AVCodec *codec)
if (!enc->pkt)
goto fail;
+ enc->dup_warning = 1000;
+
*penc = enc;
return 0;
@@ -1070,9 +1072,9 @@ static void do_video_out(OutputFile *of, OutputStream *ost, AVFrame *frame)
}
ost->nb_frames_dup += nb_frames - (nb_frames_prev && ost->last_dropped) - (nb_frames > nb_frames_prev);
av_log(ost, AV_LOG_VERBOSE, "*** %"PRId64" dup!\n", nb_frames - 1);
- if (ost->nb_frames_dup > dup_warning) {
- av_log(ost, AV_LOG_WARNING, "More than %"PRIu64" frames duplicated\n", dup_warning);
- dup_warning *= 10;
+ if (ost->nb_frames_dup > e->dup_warning) {
+ av_log(ost, AV_LOG_WARNING, "More than %"PRIu64" frames duplicated\n", e->dup_warning);
+ e->dup_warning *= 10;
}
}
ost->last_dropped = nb_frames == nb_frames_prev && frame;
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* [FFmpeg-devel] [PATCH 11/21] fftools/ffmpeg_filter: add an AVClass to FilterGraph
2023-06-14 16:48 [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
` (8 preceding siblings ...)
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 10/21] fftools/ffmpeg_enc: move dup_warning global variable to Encoder Anton Khirnov
@ 2023-06-14 16:48 ` Anton Khirnov
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 12/21] fftools/ffmpeg_filter: reject filtergraphs with zero outputs Anton Khirnov
` (10 subsequent siblings)
20 siblings, 0 replies; 37+ messages in thread
From: Anton Khirnov @ 2023-06-14 16:48 UTC (permalink / raw)
To: ffmpeg-devel
Use it for logging.
---
fftools/ffmpeg.h | 1 +
fftools/ffmpeg_filter.c | 59 +++++++++++++++++++++++++++++------------
2 files changed, 43 insertions(+), 17 deletions(-)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 3c7e819507..8de8e94e31 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -311,6 +311,7 @@ typedef struct OutputFilter {
} OutputFilter;
typedef struct FilterGraph {
+ const AVClass *class;
int index;
AVFilterGraph *graph;
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index a2b45a14b8..4f7565e44e 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -41,6 +41,9 @@
typedef struct FilterGraphPriv {
FilterGraph fg;
+ // name used for logging
+ char log_name[32];
+
int is_simple;
const char *graph_desc;
@@ -692,7 +695,7 @@ void ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost)
ret = configure_filtergraph(fg);
if (ret < 0) {
- av_log(NULL, AV_LOG_ERROR, "Error configuring filter graph: %s\n",
+ av_log(fg, AV_LOG_ERROR, "Error configuring filter graph: %s\n",
av_err2str(ret));
exit_program(1);
}
@@ -775,6 +778,20 @@ void fg_free(FilterGraph **pfg)
av_freep(pfg);
}
+static const char *fg_item_name(void *obj)
+{
+ const FilterGraphPriv *fgp = obj;
+
+ return fgp->log_name;
+}
+
+static const AVClass fg_class = {
+ .class_name = "FilterGraph",
+ .version = LIBAVUTIL_VERSION_INT,
+ .item_name = fg_item_name,
+ .category = AV_CLASS_CATEGORY_FILTER,
+};
+
FilterGraph *fg_create(char *graph_desc)
{
FilterGraphPriv *fgp = allocate_array_elem(&filtergraphs, sizeof(*fgp), &nb_filtergraphs);
@@ -784,9 +801,12 @@ FilterGraph *fg_create(char *graph_desc)
AVFilterGraph *graph;
int ret = 0;
+ fg->class = &fg_class;
fg->index = nb_filtergraphs - 1;
fgp->graph_desc = graph_desc;
+ snprintf(fgp->log_name, sizeof(fgp->log_name), "fc#%d", fg->index);
+
fgp->frame = av_frame_alloc();
if (!fgp->frame)
report_and_exit(AVERROR(ENOMEM));
@@ -850,8 +870,12 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost,
fgp->is_simple = 1;
+ snprintf(fgp->log_name, sizeof(fgp->log_name), "%cf#%d:%d",
+ av_get_media_type_string(ost->type)[0],
+ ost->file_index, ost->index);
+
if (fg->nb_inputs != 1 || fg->nb_outputs != 1) {
- av_log(NULL, AV_LOG_ERROR, "Simple filtergraph '%s' was expected "
+ av_log(fg, AV_LOG_ERROR, "Simple filtergraph '%s' was expected "
"to have exactly 1 input and 1 output. "
"However, it had %d input(s) and %d output(s). Please adjust, "
"or use a complex filtergraph (-filter_complex) instead.\n",
@@ -880,7 +904,7 @@ static void init_input_filter(FilterGraph *fg, InputFilter *ifilter)
// TODO: support other filter types
if (type != AVMEDIA_TYPE_VIDEO && type != AVMEDIA_TYPE_AUDIO) {
- av_log(NULL, AV_LOG_FATAL, "Only video and audio filters supported "
+ av_log(fg, AV_LOG_FATAL, "Only video and audio filters supported "
"currently.\n");
exit_program(1);
}
@@ -892,7 +916,7 @@ static void init_input_filter(FilterGraph *fg, InputFilter *ifilter)
int file_idx = strtol(ifp->linklabel, &p, 0);
if (file_idx < 0 || file_idx >= nb_input_files) {
- av_log(NULL, AV_LOG_FATAL, "Invalid file index %d in filtergraph description %s.\n",
+ av_log(fg, AV_LOG_FATAL, "Invalid file index %d in filtergraph description %s.\n",
file_idx, fgp->graph_desc);
exit_program(1);
}
@@ -910,7 +934,7 @@ static void init_input_filter(FilterGraph *fg, InputFilter *ifilter)
}
}
if (!st) {
- av_log(NULL, AV_LOG_FATAL, "Stream specifier '%s' in filtergraph description %s "
+ av_log(fg, AV_LOG_FATAL, "Stream specifier '%s' in filtergraph description %s "
"matches no streams.\n", p, fgp->graph_desc);
exit_program(1);
}
@@ -918,7 +942,7 @@ static void init_input_filter(FilterGraph *fg, InputFilter *ifilter)
} else {
ist = ist_find_unused(type);
if (!ist) {
- av_log(NULL, AV_LOG_FATAL, "Cannot find a matching stream for "
+ av_log(fg, AV_LOG_FATAL, "Cannot find a matching stream for "
"unlabeled input pad %s\n", ifilter->name);
exit_program(1);
}
@@ -927,7 +951,7 @@ static void init_input_filter(FilterGraph *fg, InputFilter *ifilter)
ret = ifilter_bind_ist(ifilter, ist);
if (ret < 0) {
- av_log(NULL, AV_LOG_ERROR,
+ av_log(fg, AV_LOG_ERROR,
"Error binding an input stream to complex filtergraph input %s.\n",
ifilter->name);
exit_program(1);
@@ -1111,7 +1135,7 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter,
#define AUTO_INSERT_FILTER(opt_name, filter_name, arg) do { \
AVFilterContext *filt_ctx; \
\
- av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
+ av_log(fg, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
"similarly to -af " filter_name "=%s.\n", arg); \
\
ret = avfilter_graph_create_filter(&filt_ctx, \
@@ -1200,7 +1224,7 @@ static int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter,
AVFilterInOut *out)
{
if (!ofilter->ost) {
- av_log(NULL, AV_LOG_FATAL, "Filter %s has an unconnected output\n", ofilter->name);
+ av_log(fg, AV_LOG_FATAL, "Filter %s has an unconnected output\n", ofilter->name);
exit_program(1);
}
@@ -1219,7 +1243,8 @@ void check_filter_outputs(void)
for (n = 0; n < filtergraphs[i]->nb_outputs; n++) {
OutputFilter *output = filtergraphs[i]->outputs[n];
if (!output->ost) {
- av_log(NULL, AV_LOG_FATAL, "Filter %s has an unconnected output\n", output->name);
+ av_log(filtergraphs[i], AV_LOG_FATAL,
+ "Filter %s has an unconnected output\n", output->name);
exit_program(1);
}
}
@@ -1261,7 +1286,7 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
par->format = AV_PIX_FMT_NONE;
if (ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
- av_log(NULL, AV_LOG_ERROR, "Cannot connect video filter to audio input\n");
+ av_log(fg, AV_LOG_ERROR, "Cannot connect video filter to audio input\n");
ret = AVERROR(EINVAL);
goto fail;
}
@@ -1376,7 +1401,7 @@ static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter,
int64_t tsoffset = 0;
if (ist->dec_ctx->codec_type != AVMEDIA_TYPE_AUDIO) {
- av_log(NULL, AV_LOG_ERROR, "Cannot connect audio filter to non audio input\n");
+ av_log(fg, AV_LOG_ERROR, "Cannot connect audio filter to non audio input\n");
return AVERROR(EINVAL);
}
@@ -1685,7 +1710,7 @@ int reap_filters(int flush)
AV_BUFFERSINK_FLAG_NO_REQUEST);
if (ret < 0) {
if (ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) {
- av_log(NULL, AV_LOG_WARNING,
+ av_log(fgp, AV_LOG_WARNING,
"Error in av_buffersink_get_frame_flags(): %s\n", av_err2str(ret));
} else if (flush && ret == AVERROR_EOF) {
if (av_buffersink_get_type(filter) == AVMEDIA_TYPE_VIDEO)
@@ -1705,7 +1730,7 @@ int reap_filters(int flush)
filtered_frame->time_base = tb;
if (debug_ts)
- av_log(NULL, AV_LOG_INFO, "filter_raw -> pts:%s pts_time:%s time_base:%d/%d\n",
+ av_log(fgp, AV_LOG_INFO, "filter_raw -> pts:%s pts_time:%s time_base:%d/%d\n",
av_ts2str(filtered_frame->pts),
av_ts2timestr(filtered_frame->pts, &tb),
tb.num, tb.den);
@@ -1896,13 +1921,13 @@ int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame, int keep_reference)
ret = reap_filters(0);
if (ret < 0 && ret != AVERROR_EOF) {
- av_log(NULL, AV_LOG_ERROR, "Error while filtering: %s\n", av_err2str(ret));
+ av_log(fg, AV_LOG_ERROR, "Error while filtering: %s\n", av_err2str(ret));
return ret;
}
ret = configure_filtergraph(fg);
if (ret < 0) {
- av_log(NULL, AV_LOG_ERROR, "Error reinitializing filters!\n");
+ av_log(fg, AV_LOG_ERROR, "Error reinitializing filters!\n");
return ret;
}
}
@@ -1929,7 +1954,7 @@ int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame, int keep_reference)
if (ret < 0) {
av_frame_unref(frame);
if (ret != AVERROR_EOF)
- av_log(NULL, AV_LOG_ERROR, "Error while filtering: %s\n", av_err2str(ret));
+ av_log(fg, AV_LOG_ERROR, "Error while filtering: %s\n", av_err2str(ret));
return ret;
}
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* [FFmpeg-devel] [PATCH 12/21] fftools/ffmpeg_filter: reject filtergraphs with zero outputs
2023-06-14 16:48 [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
` (9 preceding siblings ...)
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 11/21] fftools/ffmpeg_filter: add an AVClass to FilterGraph Anton Khirnov
@ 2023-06-14 16:48 ` Anton Khirnov
2023-06-14 16:53 ` Paul B Mahol
2023-06-14 16:49 ` [FFmpeg-devel] [PATCH 13/21] fftools/ffmpeg_filter: make configure_filtergraph() static Anton Khirnov
` (9 subsequent siblings)
20 siblings, 1 reply; 37+ messages in thread
From: Anton Khirnov @ 2023-06-14 16:48 UTC (permalink / raw)
To: ffmpeg-devel
Nothing useful can be done with them currently.
---
fftools/ffmpeg_filter.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 4f7565e44e..54c7ed1f5c 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -845,6 +845,12 @@ FilterGraph *fg_create(char *graph_desc)
ofilter->name = describe_filter_link(fg, cur, 0);
}
+ if (!fg->nb_outputs) {
+ av_log(fg, AV_LOG_FATAL, "A filtergraph has zero outputs, this is not supported\n");
+ ret = AVERROR(ENOSYS);
+ goto fail;
+ }
+
fail:
avfilter_inout_free(&inputs);
avfilter_inout_free(&outputs);
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [FFmpeg-devel] [PATCH 12/21] fftools/ffmpeg_filter: reject filtergraphs with zero outputs
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 12/21] fftools/ffmpeg_filter: reject filtergraphs with zero outputs Anton Khirnov
@ 2023-06-14 16:53 ` Paul B Mahol
2023-06-14 17:00 ` Anton Khirnov
0 siblings, 1 reply; 37+ messages in thread
From: Paul B Mahol @ 2023-06-14 16:53 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Wed, Jun 14, 2023 at 6:51 PM Anton Khirnov <anton@khirnov.net> wrote:
> Nothing useful can be done with them currently.
> ---
> fftools/ffmpeg_filter.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
> index 4f7565e44e..54c7ed1f5c 100644
> --- a/fftools/ffmpeg_filter.c
> +++ b/fftools/ffmpeg_filter.c
> @@ -845,6 +845,12 @@ FilterGraph *fg_create(char *graph_desc)
> ofilter->name = describe_filter_link(fg, cur, 0);
> }
>
> + if (!fg->nb_outputs) {
> + av_log(fg, AV_LOG_FATAL, "A filtergraph has zero outputs, this is
> not supported\n");
> + ret = AVERROR(ENOSYS);
> + goto fail;
> + }
> +
> fail:
> avfilter_inout_free(&inputs);
> avfilter_inout_free(&outputs);
> --
> 2.40.1
>
>
NAK
This is functionality breaking change.
And why something that is currently supported should be not supported any
more.
That logic is completely flawed.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [FFmpeg-devel] [PATCH 12/21] fftools/ffmpeg_filter: reject filtergraphs with zero outputs
2023-06-14 16:53 ` Paul B Mahol
@ 2023-06-14 17:00 ` Anton Khirnov
2023-06-14 17:11 ` Paul B Mahol
0 siblings, 1 reply; 37+ messages in thread
From: Anton Khirnov @ 2023-06-14 17:00 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Quoting Paul B Mahol (2023-06-14 18:53:52)
> On Wed, Jun 14, 2023 at 6:51 PM Anton Khirnov <anton@khirnov.net> wrote:
>
> > Nothing useful can be done with them currently.
> > ---
> > fftools/ffmpeg_filter.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
> > index 4f7565e44e..54c7ed1f5c 100644
> > --- a/fftools/ffmpeg_filter.c
> > +++ b/fftools/ffmpeg_filter.c
> > @@ -845,6 +845,12 @@ FilterGraph *fg_create(char *graph_desc)
> > ofilter->name = describe_filter_link(fg, cur, 0);
> > }
> >
> > + if (!fg->nb_outputs) {
> > + av_log(fg, AV_LOG_FATAL, "A filtergraph has zero outputs, this is
> > not supported\n");
> > + ret = AVERROR(ENOSYS);
> > + goto fail;
> > + }
> > +
> > fail:
> > avfilter_inout_free(&inputs);
> > avfilter_inout_free(&outputs);
> > --
> > 2.40.1
> >
> >
>
> NAK
>
> This is functionality breaking change.
>
Exactly what useful functionality is broken by this?
> And why something that is currently supported should be not supported any
> more.
It is not really supported. The scheduling logic is based around output
streams and cannot work without them.
--
Anton Khirnov
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [FFmpeg-devel] [PATCH 12/21] fftools/ffmpeg_filter: reject filtergraphs with zero outputs
2023-06-14 17:00 ` Anton Khirnov
@ 2023-06-14 17:11 ` Paul B Mahol
2023-06-14 17:14 ` Anton Khirnov
0 siblings, 1 reply; 37+ messages in thread
From: Paul B Mahol @ 2023-06-14 17:11 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Wed, Jun 14, 2023 at 7:01 PM Anton Khirnov <anton@khirnov.net> wrote:
> Quoting Paul B Mahol (2023-06-14 18:53:52)
> > On Wed, Jun 14, 2023 at 6:51 PM Anton Khirnov <anton@khirnov.net> wrote:
> >
> > > Nothing useful can be done with them currently.
> > > ---
> > > fftools/ffmpeg_filter.c | 6 ++++++
> > > 1 file changed, 6 insertions(+)
> > >
> > > diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
> > > index 4f7565e44e..54c7ed1f5c 100644
> > > --- a/fftools/ffmpeg_filter.c
> > > +++ b/fftools/ffmpeg_filter.c
> > > @@ -845,6 +845,12 @@ FilterGraph *fg_create(char *graph_desc)
> > > ofilter->name = describe_filter_link(fg, cur, 0);
> > > }
> > >
> > > + if (!fg->nb_outputs) {
> > > + av_log(fg, AV_LOG_FATAL, "A filtergraph has zero outputs,
> this is
> > > not supported\n");
> > > + ret = AVERROR(ENOSYS);
> > > + goto fail;
> > > + }
> > > +
> > > fail:
> > > avfilter_inout_free(&inputs);
> > > avfilter_inout_free(&outputs);
> > > --
> > > 2.40.1
> > >
> > >
> >
> > NAK
> >
> > This is functionality breaking change.
> >
>
> Exactly what useful functionality is broken by this?
>
> > And why something that is currently supported should be not supported any
> > more.
>
> It is not really supported. The scheduling logic is based around output
> streams and cannot work without them.
>
This works currently:
ffmpeg -i tom.wav -lavfi astats,anullsink -f null -
> --
> Anton Khirnov
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [FFmpeg-devel] [PATCH 12/21] fftools/ffmpeg_filter: reject filtergraphs with zero outputs
2023-06-14 17:11 ` Paul B Mahol
@ 2023-06-14 17:14 ` Anton Khirnov
0 siblings, 0 replies; 37+ messages in thread
From: Anton Khirnov @ 2023-06-14 17:14 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Quoting Paul B Mahol (2023-06-14 19:11:35)
> On Wed, Jun 14, 2023 at 7:01 PM Anton Khirnov <anton@khirnov.net> wrote:
>
> > Quoting Paul B Mahol (2023-06-14 18:53:52)
> > > On Wed, Jun 14, 2023 at 6:51 PM Anton Khirnov <anton@khirnov.net> wrote:
> > >
> > > > Nothing useful can be done with them currently.
> > > > ---
> > > > fftools/ffmpeg_filter.c | 6 ++++++
> > > > 1 file changed, 6 insertions(+)
> > > >
> > > > diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
> > > > index 4f7565e44e..54c7ed1f5c 100644
> > > > --- a/fftools/ffmpeg_filter.c
> > > > +++ b/fftools/ffmpeg_filter.c
> > > > @@ -845,6 +845,12 @@ FilterGraph *fg_create(char *graph_desc)
> > > > ofilter->name = describe_filter_link(fg, cur, 0);
> > > > }
> > > >
> > > > + if (!fg->nb_outputs) {
> > > > + av_log(fg, AV_LOG_FATAL, "A filtergraph has zero outputs,
> > this is
> > > > not supported\n");
> > > > + ret = AVERROR(ENOSYS);
> > > > + goto fail;
> > > > + }
> > > > +
> > > > fail:
> > > > avfilter_inout_free(&inputs);
> > > > avfilter_inout_free(&outputs);
> > > > --
> > > > 2.40.1
> > > >
> > > >
> > >
> > > NAK
> > >
> > > This is functionality breaking change.
> > >
> >
> > Exactly what useful functionality is broken by this?
> >
> > > And why something that is currently supported should be not supported any
> > > more.
> >
> > It is not really supported. The scheduling logic is based around output
> > streams and cannot work without them.
> >
>
> This works currently:
>
> ffmpeg -i tom.wav -lavfi astats,anullsink -f null -
And what useful functionality is provided by this that you cannot
achieve otherwise?
--
Anton Khirnov
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* [FFmpeg-devel] [PATCH 13/21] fftools/ffmpeg_filter: make configure_filtergraph() static
2023-06-14 16:48 [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
` (10 preceding siblings ...)
2023-06-14 16:48 ` [FFmpeg-devel] [PATCH 12/21] fftools/ffmpeg_filter: reject filtergraphs with zero outputs Anton Khirnov
@ 2023-06-14 16:49 ` Anton Khirnov
2023-06-14 16:49 ` [FFmpeg-devel] [PATCH 14/21] fftools/ffmpeg_dec: stop using Decoder.pkt Anton Khirnov
` (8 subsequent siblings)
20 siblings, 0 replies; 37+ messages in thread
From: Anton Khirnov @ 2023-06-14 16:49 UTC (permalink / raw)
To: ffmpeg-devel
It is no longer used outside of ffmpeg_filter.
---
fftools/ffmpeg.h | 1 -
fftools/ffmpeg_filter.c | 4 +++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 8de8e94e31..80d9ab52bc 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -726,7 +726,6 @@ const AVCodec *find_codec_or_die(void *logctx, const char *name,
enum AVMediaType type, int encoder);
int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global);
-int configure_filtergraph(FilterGraph *fg);
void check_filter_outputs(void);
int filtergraph_is_simple(const FilterGraph *fg);
int init_simple_filtergraph(InputStream *ist, OutputStream *ost,
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 54c7ed1f5c..ccde5b26ec 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -133,6 +133,8 @@ static InputFilterPriv *ifp_from_ifilter(InputFilter *ifilter)
return (InputFilterPriv*)ifilter;
}
+static int configure_filtergraph(FilterGraph *fg);
+
static int sub2video_get_blank_frame(InputFilterPriv *ifp)
{
AVFrame *frame = ifp->sub2video.frame;
@@ -1496,7 +1498,7 @@ static int graph_is_meta(AVFilterGraph *graph)
return 1;
}
-int configure_filtergraph(FilterGraph *fg)
+static int configure_filtergraph(FilterGraph *fg)
{
FilterGraphPriv *fgp = fgp_from_fg(fg);
AVBufferRef *hw_device;
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* [FFmpeg-devel] [PATCH 14/21] fftools/ffmpeg_dec: stop using Decoder.pkt
2023-06-14 16:48 [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
` (11 preceding siblings ...)
2023-06-14 16:49 ` [FFmpeg-devel] [PATCH 13/21] fftools/ffmpeg_filter: make configure_filtergraph() static Anton Khirnov
@ 2023-06-14 16:49 ` Anton Khirnov
2023-06-14 16:49 ` [FFmpeg-devel] [PATCH 15/21] fftools/ffmpeg: attach bits_per_raw_sample information to frames Anton Khirnov
` (7 subsequent siblings)
20 siblings, 0 replies; 37+ messages in thread
From: Anton Khirnov @ 2023-06-14 16:49 UTC (permalink / raw)
To: ffmpeg-devel
It is only used for flushing the subtitle decoder, so allocate a
dedicated packet for that.
Keep Decoder.pkt unused for now, it will be repurposed in future
commits.
---
fftools/ffmpeg_dec.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index 586be83dc1..f9053c424b 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -385,10 +385,20 @@ out:
static int transcode_subtitles(InputStream *ist, const AVPacket *pkt)
{
+ AVPacket *flush_pkt = NULL;
AVSubtitle subtitle;
int got_output;
- int ret = avcodec_decode_subtitle2(ist->dec_ctx,
- &subtitle, &got_output, pkt);
+ int ret;
+
+ if (!pkt) {
+ flush_pkt = av_packet_alloc();
+ if (!flush_pkt)
+ return AVERROR(ENOMEM);
+ }
+
+ ret = avcodec_decode_subtitle2(ist->dec_ctx, &subtitle, &got_output,
+ pkt ? pkt : flush_pkt);
+ av_packet_free(&flush_pkt);
if (ret < 0) {
av_log(ist, AV_LOG_ERROR, "Error decoding subtitles: %s\n",
@@ -399,7 +409,7 @@ static int transcode_subtitles(InputStream *ist, const AVPacket *pkt)
}
if (ret < 0 || !got_output) {
- if (!pkt->size)
+ if (!pkt)
sub2video_flush(ist);
return ret < 0 ? ret : AVERROR_EOF;
}
@@ -432,7 +442,7 @@ int dec_packet(InputStream *ist, const AVPacket *pkt, int no_eof)
int ret;
if (dec->codec_type == AVMEDIA_TYPE_SUBTITLE)
- return transcode_subtitles(ist, pkt ? pkt : d->pkt);
+ return transcode_subtitles(ist, pkt);
// With fate-indeo3-2, we're getting 0-sized packets before EOF for some
// reason. This seems like a semi-critical bug. Don't trigger EOF, and
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* [FFmpeg-devel] [PATCH 15/21] fftools/ffmpeg: attach bits_per_raw_sample information to frames
2023-06-14 16:48 [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
` (12 preceding siblings ...)
2023-06-14 16:49 ` [FFmpeg-devel] [PATCH 14/21] fftools/ffmpeg_dec: stop using Decoder.pkt Anton Khirnov
@ 2023-06-14 16:49 ` Anton Khirnov
2023-06-14 16:49 ` [FFmpeg-devel] [PATCH 16/21] fftools/ffmpeg_dec: move decoding to a separate thread Anton Khirnov
` (6 subsequent siblings)
20 siblings, 0 replies; 37+ messages in thread
From: Anton Khirnov @ 2023-06-14 16:49 UTC (permalink / raw)
To: ffmpeg-devel
This way avoids encoders reaching into filters or decoders for this
information.
---
fftools/ffmpeg.h | 7 ++-----
fftools/ffmpeg_dec.c | 21 ++++++++++-----------
fftools/ffmpeg_enc.c | 13 ++++++-------
fftools/ffmpeg_filter.c | 27 ++++++++++++++++++---------
fftools/ffmpeg_mux_init.c | 14 +++++---------
5 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 80d9ab52bc..abc1a21d73 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -315,9 +315,6 @@ typedef struct FilterGraph {
int index;
AVFilterGraph *graph;
- // true when the filtergraph contains only meta filters
- // that do not modify the frame data
- int is_meta;
InputFilter **inputs;
int nb_inputs;
@@ -339,8 +336,6 @@ typedef struct InputStream {
int decoding_needed; /* non zero if the packets must be decoded in 'raw_fifo', see DECODING_FOR_* */
#define DECODING_FOR_OST 1
#define DECODING_FOR_FILTER 2
- // should attach FrameData as opaque_ref after decoding
- int want_frame_data;
/**
* Codec parameters - to be used by the decoding/streamcopy code.
@@ -653,6 +648,8 @@ typedef struct FrameData {
AVRational tb;
AVRational frame_rate_filter;
+
+ int bits_per_raw_sample;
} FrameData;
extern InputFile **input_files;
diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index f9053c424b..e6c6e22b04 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -472,6 +472,7 @@ int dec_packet(InputStream *ist, const AVPacket *pkt, int no_eof)
while (1) {
AVFrame *frame = d->frame;
+ FrameData *fd;
update_benchmark(NULL);
ret = avcodec_receive_frame(dec, frame);
@@ -508,19 +509,17 @@ int dec_packet(InputStream *ist, const AVPacket *pkt, int no_eof)
exit_program(1);
}
- if (ist->want_frame_data) {
- FrameData *fd;
- av_assert0(!frame->opaque_ref);
- fd = frame_data(frame);
- if (!fd) {
- av_frame_unref(frame);
- report_and_exit(AVERROR(ENOMEM));
- }
- fd->pts = frame->pts;
- fd->tb = dec->pkt_timebase;
- fd->idx = dec->frame_num - 1;
+ av_assert0(!frame->opaque_ref);
+ fd = frame_data(frame);
+ if (!fd) {
+ av_frame_unref(frame);
+ report_and_exit(AVERROR(ENOMEM));
}
+ fd->pts = frame->pts;
+ fd->tb = dec->pkt_timebase;
+ fd->idx = dec->frame_num - 1;
+ fd->bits_per_raw_sample = dec->bits_per_raw_sample;
frame->time_base = dec->pkt_timebase;
diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index 0fdf7e7c4d..f42f4055d6 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -198,6 +198,7 @@ int enc_open(OutputStream *ost, AVFrame *frame)
AVCodecContext *dec_ctx = NULL;
const AVCodec *enc = enc_ctx->codec;
OutputFile *of = output_files[ost->file_index];
+ FrameData *fd = frame ? frame_data(frame) : NULL;
int ret;
if (e->opened)
@@ -219,8 +220,8 @@ int enc_open(OutputStream *ost, AVFrame *frame)
if (ost->bits_per_raw_sample)
enc_ctx->bits_per_raw_sample = ost->bits_per_raw_sample;
- else if (dec_ctx && ost->filter->graph->is_meta)
- enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample,
+ else if (fd)
+ enc_ctx->bits_per_raw_sample = FFMIN(fd->bits_per_raw_sample,
av_get_bytes_per_sample(enc_ctx->sample_fmt) << 3);
enc_ctx->time_base = ost->enc_timebase.num > 0 ? ost->enc_timebase :
@@ -230,10 +231,8 @@ int enc_open(OutputStream *ost, AVFrame *frame)
case AVMEDIA_TYPE_VIDEO: {
AVRational fr = ost->frame_rate;
- if (!fr.num && frame) {
- FrameData *fd = frame_data(frame);
+ if (!fr.num && fd)
fr = fd->frame_rate_filter;
- }
if (!fr.num && !ost->max_frame_rate.num) {
fr = (AVRational){25, 1};
av_log(ost, AV_LOG_WARNING,
@@ -282,8 +281,8 @@ int enc_open(OutputStream *ost, AVFrame *frame)
if (ost->bits_per_raw_sample)
enc_ctx->bits_per_raw_sample = ost->bits_per_raw_sample;
- else if (dec_ctx && ost->filter->graph->is_meta)
- enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample,
+ else if (fd)
+ enc_ctx->bits_per_raw_sample = FFMIN(fd->bits_per_raw_sample,
av_pix_fmt_desc_get(enc_ctx->pix_fmt)->comp[0].depth);
if (frame) {
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index ccde5b26ec..9e6883ccdd 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -45,6 +45,9 @@ typedef struct FilterGraphPriv {
char log_name[32];
int is_simple;
+ // true when the filtergraph contains only meta filters
+ // that do not modify the frame data
+ int is_meta;
const char *graph_desc;
@@ -1566,7 +1569,7 @@ static int configure_filtergraph(FilterGraph *fg)
if ((ret = avfilter_graph_config(fg->graph, NULL)) < 0)
goto fail;
- fg->is_meta = graph_is_meta(fg->graph);
+ fgp->is_meta = graph_is_meta(fg->graph);
/* limit the lists of allowed formats to the ones selected, to
* make sure they stay the same if the filtergraph is reconfigured later */
@@ -1714,6 +1717,8 @@ int reap_filters(int flush)
filtered_frame = fgp->frame;
while (1) {
+ FrameData *fd;
+
ret = av_buffersink_get_frame_flags(filter, filtered_frame,
AV_BUFFERSINK_FLAG_NO_REQUEST);
if (ret < 0) {
@@ -1744,16 +1749,20 @@ int reap_filters(int flush)
tb.num, tb.den);
}
- if (ost->type == AVMEDIA_TYPE_VIDEO) {
- FrameData *fd = frame_data(filtered_frame);
- if (!fd) {
- av_frame_unref(filtered_frame);
- report_and_exit(AVERROR(ENOMEM));
- }
-
- fd->frame_rate_filter = av_buffersink_get_frame_rate(filter);
+ fd = frame_data(filtered_frame);
+ if (!fd) {
+ av_frame_unref(filtered_frame);
+ report_and_exit(AVERROR(ENOMEM));
}
+ // only use bits_per_raw_sample passed through from the decoder
+ // if the filtergraph did not touch the frame data
+ if (!fgp->is_meta)
+ fd->bits_per_raw_sample = 0;
+
+ if (ost->type == AVMEDIA_TYPE_VIDEO)
+ fd->frame_rate_filter = av_buffersink_get_frame_rate(filter);
+
enc_frame(ost, filtered_frame);
av_frame_unref(filtered_frame);
}
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index a18320fa9b..6ab541d7c5 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -365,15 +365,11 @@ static int enc_stats_init(OutputStream *ost, EncStats *es, int pre,
c->type = fmt_specs[i].type;
- if (fmt_specs[i].need_input_data) {
- if (ost->ist)
- ost->ist->want_frame_data = 1;
- else {
- av_log(ost, AV_LOG_WARNING,
- "Format directive '%s' is unavailable, because "
- "this output stream has no associated input stream\n",
- val);
- }
+ if (fmt_specs[i].need_input_data && !ost->ist) {
+ av_log(ost, AV_LOG_WARNING,
+ "Format directive '%s' is unavailable, because "
+ "this output stream has no associated input stream\n",
+ val);
}
break;
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* [FFmpeg-devel] [PATCH 16/21] fftools/ffmpeg_dec: move decoding to a separate thread
2023-06-14 16:48 [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
` (13 preceding siblings ...)
2023-06-14 16:49 ` [FFmpeg-devel] [PATCH 15/21] fftools/ffmpeg: attach bits_per_raw_sample information to frames Anton Khirnov
@ 2023-06-14 16:49 ` Anton Khirnov
2023-06-16 20:58 ` Michael Niedermayer
2023-06-14 16:49 ` [FFmpeg-devel] [PATCH 17/21] fftools/ffmpeg: move fix_sub_duration_heartbeat() to ffmpeg_dec Anton Khirnov
` (5 subsequent siblings)
20 siblings, 1 reply; 37+ messages in thread
From: Anton Khirnov @ 2023-06-14 16:49 UTC (permalink / raw)
To: ffmpeg-devel
This is only a preparatory step to a fully threaded architecture and
does not yet make decoding truly parallel - the main thread will
currently submit a packet and wait until it has been fully processed by
the decoding thread before moving on. Decoded behavior as observed by
the rest of the program should remain unchanged. That will change in
future commits after encoders and filters are moved to threads and a
thread-aware scheduler is added.
---
fftools/ffmpeg.c | 63 +++++---
fftools/ffmpeg.h | 11 ++
fftools/ffmpeg_dec.c | 365 ++++++++++++++++++++++++++++++++++++++-----
fftools/ffmpeg_mux.c | 5 -
4 files changed, 382 insertions(+), 62 deletions(-)
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 45e71ed626..4e6205e3cb 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -728,6 +728,46 @@ cleanup:
return ret;
}
+static void subtitle_free(void *opaque, uint8_t *data)
+{
+ AVSubtitle *sub = (AVSubtitle*)data;
+ avsubtitle_free(sub);
+ av_free(sub);
+}
+
+int subtitle_wrap_frame(AVFrame *frame, AVSubtitle *subtitle, int copy)
+{
+ AVBufferRef *buf;
+ AVSubtitle *sub;
+ int ret;
+
+ if (copy) {
+ sub = av_mallocz(sizeof(*sub));
+ ret = sub ? copy_av_subtitle(sub, subtitle) : AVERROR(ENOMEM);
+ if (ret < 0) {
+ av_freep(&sub);
+ return ret;
+ }
+ } else {
+ sub = av_memdup(subtitle, sizeof(*subtitle));
+ if (!sub)
+ return AVERROR(ENOMEM);
+ memset(subtitle, 0, sizeof(*subtitle));
+ }
+
+ buf = av_buffer_create((uint8_t*)sub, sizeof(*sub),
+ subtitle_free, NULL, 0);
+ if (!buf) {
+ avsubtitle_free(sub);
+ av_freep(&sub);
+ return AVERROR(ENOMEM);
+ }
+
+ frame->buf[0] = buf;
+
+ return 0;
+}
+
static int fix_sub_duration_heartbeat(InputStream *ist, int64_t signal_pts)
{
int ret = AVERROR_BUG;
@@ -1038,30 +1078,11 @@ static void decode_flush(InputFile *ifile)
{
for (int i = 0; i < ifile->nb_streams; i++) {
InputStream *ist = ifile->streams[i];
- int ret;
- if (ist->discard)
+ if (ist->discard || !ist->decoding_needed)
continue;
- do {
- ret = process_input_packet(ist, NULL, 1);
- } while (ret > 0);
-
- if (ist->decoding_needed) {
- /* report last frame duration to the demuxer thread */
- if (ist->par->codec_type == AVMEDIA_TYPE_AUDIO) {
- LastFrameDuration dur;
-
- dur.stream_idx = i;
- dur.duration = av_rescale_q(ist->nb_samples,
- (AVRational){ 1, ist->dec_ctx->sample_rate},
- ist->st->time_base);
-
- av_thread_message_queue_send(ifile->audio_duration_queue, &dur, 0);
- }
-
- avcodec_flush_buffers(ist->dec_ctx);
- }
+ dec_packet(ist, NULL, 1);
}
}
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index abc1a21d73..5d60da085b 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -730,6 +730,7 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost,
int init_complex_filtergraph(FilterGraph *fg);
int copy_av_subtitle(AVSubtitle *dst, const AVSubtitle *src);
+int subtitle_wrap_frame(AVFrame *frame, AVSubtitle *subtitle, int copy);
/**
* Get our axiliary frame data attached to the frame, allocating it
@@ -941,4 +942,14 @@ extern const char * const opt_name_codec_tags[];
extern const char * const opt_name_frame_rates[];
extern const char * const opt_name_top_field_first[];
+static inline void pkt_move(void *dst, void *src)
+{
+ av_packet_move_ref(dst, src);
+}
+
+static inline void frame_move(void *dst, void *src)
+{
+ av_frame_move_ref(dst, src);
+}
+
#endif /* FFTOOLS_FFMPEG_H */
diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index e6c6e22b04..996e7318d9 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -30,6 +30,7 @@
#include "libavfilter/buffersrc.h"
#include "ffmpeg.h"
+#include "thread_queue.h"
struct Decoder {
AVFrame *frame;
@@ -45,8 +46,50 @@ struct Decoder {
AVRational last_frame_tb;
int64_t last_filter_in_rescale_delta;
int last_frame_sample_rate;
+
+ pthread_t thread;
+ /**
+ * Queue for sending coded packets from the main thread to
+ * the decoder thread.
+ *
+ * An empty packet is sent to flush the decoder without terminating
+ * decoding.
+ */
+ ThreadQueue *queue_in;
+ /**
+ * Queue for sending decoded frames from the decoder thread
+ * to the main thread.
+ *
+ * An empty frame is sent to signal that a single packet has been fully
+ * processed.
+ */
+ ThreadQueue *queue_out;
};
+// data that is local to the decoder thread and not visible outside of it
+typedef struct DecThreadContext {
+ AVFrame *frame;
+ AVPacket *pkt;
+} DecThreadContext;
+
+static int dec_thread_stop(Decoder *d)
+{
+ void *ret;
+
+ if (!d->queue_in)
+ return 0;
+
+ tq_send_finish(d->queue_in, 0);
+ tq_receive_finish(d->queue_out, 0);
+
+ pthread_join(d->thread, &ret);
+
+ tq_free(&d->queue_in);
+ tq_free(&d->queue_out);
+
+ return (intptr_t)ret;
+}
+
void dec_free(Decoder **pdec)
{
Decoder *dec = *pdec;
@@ -54,6 +97,8 @@ void dec_free(Decoder **pdec)
if (!dec)
return;
+ dec_thread_stop(dec);
+
av_frame_free(&dec->frame);
av_packet_free(&dec->pkt);
@@ -383,8 +428,10 @@ out:
return ret;
}
-static int transcode_subtitles(InputStream *ist, const AVPacket *pkt)
+static int transcode_subtitles(InputStream *ist, const AVPacket *pkt,
+ AVFrame *frame)
{
+ Decoder *d = ist->decoder;
AVPacket *flush_pkt = NULL;
AVSubtitle subtitle;
int got_output;
@@ -403,20 +450,30 @@ static int transcode_subtitles(InputStream *ist, const AVPacket *pkt)
if (ret < 0) {
av_log(ist, AV_LOG_ERROR, "Error decoding subtitles: %s\n",
av_err2str(ret));
- if (exit_on_error)
- exit_program(1);
ist->decode_errors++;
+ return exit_on_error ? ret : 0;
}
- if (ret < 0 || !got_output) {
- if (!pkt)
- sub2video_flush(ist);
- return ret < 0 ? ret : AVERROR_EOF;
- }
+ if (!got_output)
+ return pkt ? 0 : AVERROR_EOF;
ist->frames_decoded++;
- return process_subtitle(ist, &subtitle);
+ // XXX the queue for transferring data back to the main thread runs
+ // on AVFrames, so we wrap AVSubtitle in an AVBufferRef and put that
+ // inside the frame
+ // eventually, subtitles should be switched to use AVFrames natively
+ ret = subtitle_wrap_frame(frame, &subtitle, 0);
+ if (ret < 0) {
+ avsubtitle_free(&subtitle);
+ return ret;
+ }
+
+ ret = tq_send(d->queue_out, 0, frame);
+ if (ret < 0)
+ av_frame_unref(frame);
+
+ return ret;
}
static int send_filter_eof(InputStream *ist)
@@ -434,7 +491,7 @@ static int send_filter_eof(InputStream *ist)
return 0;
}
-int dec_packet(InputStream *ist, const AVPacket *pkt, int no_eof)
+static int packet_decode(InputStream *ist, const AVPacket *pkt, AVFrame *frame)
{
Decoder *d = ist->decoder;
AVCodecContext *dec = ist->dec_ctx;
@@ -442,7 +499,7 @@ int dec_packet(InputStream *ist, const AVPacket *pkt, int no_eof)
int ret;
if (dec->codec_type == AVMEDIA_TYPE_SUBTITLE)
- return transcode_subtitles(ist, pkt);
+ return transcode_subtitles(ist, pkt, frame);
// With fate-indeo3-2, we're getting 0-sized packets before EOF for some
// reason. This seems like a semi-critical bug. Don't trigger EOF, and
@@ -457,23 +514,25 @@ int dec_packet(InputStream *ist, const AVPacket *pkt, int no_eof)
if (ret == AVERROR(EAGAIN)) {
av_log(ist, AV_LOG_FATAL, "A decoder returned an unexpected error code. "
"This is a bug, please report it.\n");
- exit_program(1);
+ return AVERROR_BUG;
}
av_log(ist, AV_LOG_ERROR, "Error submitting %s to decoder: %s\n",
pkt ? "packet" : "EOF", av_err2str(ret));
- if (exit_on_error)
- exit_program(1);
- if (ret != AVERROR_EOF)
+ if (ret != AVERROR_EOF) {
ist->decode_errors++;
+ if (!exit_on_error)
+ ret = 0;
+ }
return ret;
}
while (1) {
- AVFrame *frame = d->frame;
FrameData *fd;
+ av_frame_unref(frame);
+
update_benchmark(NULL);
ret = avcodec_receive_frame(dec, frame);
update_benchmark("decode_%s %d.%d", type_desc,
@@ -483,30 +542,22 @@ int dec_packet(InputStream *ist, const AVPacket *pkt, int no_eof)
av_assert0(pkt); // should never happen during flushing
return 0;
} else if (ret == AVERROR_EOF) {
- /* after flushing, send an EOF on all the filter inputs attached to the stream */
- /* except when looping we need to flush but not to send an EOF */
- if (!no_eof) {
- ret = send_filter_eof(ist);
- if (ret < 0) {
- av_log(NULL, AV_LOG_FATAL, "Error marking filters as finished\n");
- exit_program(1);
- }
- }
-
- return AVERROR_EOF;
+ return ret;
} else if (ret < 0) {
av_log(ist, AV_LOG_ERROR, "Decoding error: %s\n", av_err2str(ret));
- if (exit_on_error)
- exit_program(1);
ist->decode_errors++;
- return ret;
+
+ if (exit_on_error)
+ return ret;
+
+ continue;
}
if (frame->decode_error_flags || (frame->flags & AV_FRAME_FLAG_CORRUPT)) {
av_log(ist, exit_on_error ? AV_LOG_FATAL : AV_LOG_WARNING,
"corrupt decoded frame\n");
if (exit_on_error)
- exit_program(1);
+ return AVERROR_INVALIDDATA;
}
@@ -514,7 +565,7 @@ int dec_packet(InputStream *ist, const AVPacket *pkt, int no_eof)
fd = frame_data(frame);
if (!fd) {
av_frame_unref(frame);
- report_and_exit(AVERROR(ENOMEM));
+ return AVERROR(ENOMEM);
}
fd->pts = frame->pts;
fd->tb = dec->pkt_timebase;
@@ -533,19 +584,254 @@ int dec_packet(InputStream *ist, const AVPacket *pkt, int no_eof)
if (ret < 0) {
av_log(NULL, AV_LOG_FATAL, "Error while processing the decoded "
"data for stream #%d:%d\n", ist->file_index, ist->index);
- exit_program(1);
+ return ret;
}
}
ist->frames_decoded++;
- ret = send_frame_to_filters(ist, frame);
- av_frame_unref(frame);
+ ret = tq_send(d->queue_out, 0, frame);
if (ret < 0)
- exit_program(1);
+ return ret;
}
}
+static void dec_thread_set_name(const InputStream *ist)
+{
+ char name[16];
+ snprintf(name, sizeof(name), "dec%d:%d:%s", ist->file_index, ist->index,
+ ist->dec_ctx->codec->name);
+ ff_thread_setname(name);
+}
+
+static void dec_thread_uninit(DecThreadContext *dt)
+{
+ av_packet_free(&dt->pkt);
+ av_frame_free(&dt->frame);
+
+ memset(dt, 0, sizeof(*dt));
+}
+
+static int dec_thread_init(DecThreadContext *dt)
+{
+ memset(dt, 0, sizeof(*dt));
+
+ dt->frame = av_frame_alloc();
+ if (!dt->frame)
+ goto fail;
+
+ dt->pkt = av_packet_alloc();
+ if (!dt->pkt)
+ goto fail;
+
+ return 0;
+
+fail:
+ dec_thread_uninit(dt);
+ return AVERROR(ENOMEM);
+}
+
+static void *decoder_thread(void *arg)
+{
+ InputStream *ist = arg;
+ InputFile *ifile = input_files[ist->file_index];
+ Decoder *d = ist->decoder;
+ DecThreadContext dt;
+ int ret = 0, input_status = 0;
+
+ ret = dec_thread_init(&dt);
+ if (ret < 0)
+ goto finish;
+
+ dec_thread_set_name(ist);
+
+ while (!input_status) {
+ int dummy, flush_buffers;
+
+ input_status = tq_receive(d->queue_in, &dummy, dt.pkt);
+ flush_buffers = input_status >= 0 && !dt.pkt->buf;
+ if (!dt.pkt->buf)
+ av_log(ist, AV_LOG_VERBOSE, "Decoder thread received %s packet\n",
+ flush_buffers ? "flush" : "EOF");
+
+ ret = packet_decode(ist, dt.pkt->buf ? dt.pkt : NULL, dt.frame);
+
+ av_packet_unref(dt.pkt);
+ av_frame_unref(dt.frame);
+
+ if (ret == AVERROR_EOF) {
+ av_log(ist, AV_LOG_VERBOSE, "Decoder returned EOF, %s\n",
+ flush_buffers ? "resetting" : "finishing");
+
+ if (!flush_buffers)
+ break;
+
+ /* report last frame duration to the demuxer thread */
+ if (ist->dec->type == AVMEDIA_TYPE_AUDIO) {
+ LastFrameDuration dur;
+
+ dur.stream_idx = ist->index;
+ dur.duration = av_rescale_q(ist->nb_samples,
+ (AVRational){ 1, ist->dec_ctx->sample_rate},
+ ist->st->time_base);
+
+ av_thread_message_queue_send(ifile->audio_duration_queue, &dur, 0);
+ }
+
+ avcodec_flush_buffers(ist->dec_ctx);
+ } else if (ret < 0) {
+ av_log(ist, AV_LOG_ERROR, "Error processing packet in decoder: %s\n",
+ av_err2str(ret));
+ break;
+ }
+
+ // signal to the consumer thread that the entire packet was processed
+ ret = tq_send(d->queue_out, 0, dt.frame);
+ if (ret < 0) {
+ if (ret != AVERROR_EOF)
+ av_log(ist, AV_LOG_ERROR, "Error communicating with the main thread\n");
+ break;
+ }
+ }
+
+ // EOF is normal thread termination
+ if (ret == AVERROR_EOF)
+ ret = 0;
+
+finish:
+ tq_receive_finish(d->queue_in, 0);
+ tq_send_finish (d->queue_out, 0);
+
+ // make sure the demuxer does not get stuck waiting for audio durations
+ // that will never arrive
+ if (ifile->audio_duration_queue && ist->dec->type == AVMEDIA_TYPE_AUDIO)
+ av_thread_message_queue_set_err_recv(ifile->audio_duration_queue, AVERROR_EOF);
+
+ dec_thread_uninit(&dt);
+
+ av_log(ist, AV_LOG_VERBOSE, "Terminating decoder thread\n");
+
+ return (void*)(intptr_t)ret;
+}
+
+static int dec_thread_start(InputStream *ist)
+{
+ Decoder *d = ist->decoder;
+ ObjPool *op;
+ int ret = 0;
+
+ op = objpool_alloc_packets();
+ if (!op)
+ return AVERROR(ENOMEM);
+
+ d->queue_in = tq_alloc(1, 1, op, pkt_move);
+ if (!d->queue_in) {
+ objpool_free(&op);
+ return AVERROR(ENOMEM);
+ }
+
+ op = objpool_alloc_frames();
+ if (!op)
+ goto fail;
+
+ d->queue_out = tq_alloc(1, 4, op, frame_move);
+ if (!d->queue_out) {
+ objpool_free(&op);
+ goto fail;
+ }
+
+ ret = pthread_create(&d->thread, NULL, decoder_thread, ist);
+ if (ret) {
+ ret = AVERROR(ret);
+ av_log(ist, AV_LOG_ERROR, "pthread_create() failed: %s\n",
+ av_err2str(ret));
+ goto fail;
+ }
+
+ return 0;
+fail:
+ if (ret >= 0)
+ ret = AVERROR(ENOMEM);
+
+ tq_free(&d->queue_in);
+ tq_free(&d->queue_out);
+ return ret;
+}
+
+int dec_packet(InputStream *ist, const AVPacket *pkt, int no_eof)
+{
+ Decoder *d = ist->decoder;
+ int ret = 0, thread_ret;
+
+ // thread already joined
+ if (!d->queue_in)
+ return AVERROR_EOF;
+
+ // send the packet/flush request/EOF to the decoder thread
+ if (pkt || no_eof) {
+ av_packet_unref(d->pkt);
+
+ if (pkt) {
+ ret = av_packet_ref(d->pkt, pkt);
+ if (ret < 0)
+ goto finish;
+ }
+
+ ret = tq_send(d->queue_in, 0, d->pkt);
+ if (ret < 0)
+ goto finish;
+ } else
+ tq_send_finish(d->queue_in, 0);
+
+ // retrieve all decoded data for the packet
+ while (1) {
+ int dummy;
+
+ ret = tq_receive(d->queue_out, &dummy, d->frame);
+ if (ret < 0)
+ goto finish;
+
+ // packet fully processed
+ if (!d->frame->buf[0])
+ return 0;
+
+ // process the decoded frame
+ if (ist->dec->type == AVMEDIA_TYPE_SUBTITLE) {
+ AVSubtitle *sub = (AVSubtitle*)d->frame->buf[0]->data;
+ ret = process_subtitle(ist, sub);
+ } else {
+ ret = send_frame_to_filters(ist, d->frame);
+ }
+ av_frame_unref(d->frame);
+ if (ret < 0)
+ goto finish;
+ }
+
+finish:
+ thread_ret = dec_thread_stop(d);
+ if (thread_ret < 0) {
+ av_log(ist, AV_LOG_ERROR, "Decoder thread returned error: %s\n",
+ av_err2str(thread_ret));
+ ret = err_merge(ret, thread_ret);
+ }
+ // non-EOF errors here are all fatal
+ if (ret < 0 && ret != AVERROR_EOF)
+ report_and_exit(ret);
+
+ // signal EOF to our downstreams
+ if (ist->dec->type == AVMEDIA_TYPE_SUBTITLE)
+ sub2video_flush(ist);
+ else {
+ ret = send_filter_eof(ist);
+ if (ret < 0) {
+ av_log(NULL, AV_LOG_FATAL, "Error marking filters as finished\n");
+ exit_program(1);
+ }
+ }
+
+ return AVERROR_EOF;
+}
+
static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts)
{
InputStream *ist = s->opaque;
@@ -781,5 +1067,12 @@ int dec_open(InputStream *ist)
}
assert_avoptions(ist->decoder_opts);
+ ret = dec_thread_start(ist);
+ if (ret < 0) {
+ av_log(ist, AV_LOG_ERROR, "Error starting decoder thread: %s\n",
+ av_err2str(ret));
+ return ret;
+ }
+
return 0;
}
diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index 66b2324bb3..026796f7e6 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -475,11 +475,6 @@ static int thread_stop(Muxer *mux)
return (int)(intptr_t)ret;
}
-static void pkt_move(void *dst, void *src)
-{
- av_packet_move_ref(dst, src);
-}
-
static int thread_start(Muxer *mux)
{
AVFormatContext *fc = mux->fc;
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [FFmpeg-devel] [PATCH 16/21] fftools/ffmpeg_dec: move decoding to a separate thread
2023-06-14 16:49 ` [FFmpeg-devel] [PATCH 16/21] fftools/ffmpeg_dec: move decoding to a separate thread Anton Khirnov
@ 2023-06-16 20:58 ` Michael Niedermayer
2023-06-17 2:55 ` Anton Khirnov
0 siblings, 1 reply; 37+ messages in thread
From: Michael Niedermayer @ 2023-06-16 20:58 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 1174 bytes --]
On Wed, Jun 14, 2023 at 06:49:03PM +0200, Anton Khirnov wrote:
> This is only a preparatory step to a fully threaded architecture and
> does not yet make decoding truly parallel - the main thread will
> currently submit a packet and wait until it has been fully processed by
> the decoding thread before moving on. Decoded behavior as observed by
> the rest of the program should remain unchanged. That will change in
> future commits after encoders and filters are moved to threads and a
> thread-aware scheduler is added.
> ---
> fftools/ffmpeg.c | 63 +++++---
> fftools/ffmpeg.h | 11 ++
> fftools/ffmpeg_dec.c | 365 ++++++++++++++++++++++++++++++++++++++-----
> fftools/ffmpeg_mux.c | 5 -
> 4 files changed, 382 insertions(+), 62 deletions(-)
This seems to break (infinite loop)
ffmpeg -i videos/bink/thps4/ACDC.smo -bitexact -t 1 -y ACDC.smo.avi
file seems there: on samples server: game-formats/bink/thps4/ACDC.smo
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Elect your leaders based on what they did after the last election, not
based on what they say before an election.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [FFmpeg-devel] [PATCH 16/21] fftools/ffmpeg_dec: move decoding to a separate thread
2023-06-16 20:58 ` Michael Niedermayer
@ 2023-06-17 2:55 ` Anton Khirnov
0 siblings, 0 replies; 37+ messages in thread
From: Anton Khirnov @ 2023-06-17 2:55 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Quoting Michael Niedermayer (2023-06-16 22:58:21)
> On Wed, Jun 14, 2023 at 06:49:03PM +0200, Anton Khirnov wrote:
> > This is only a preparatory step to a fully threaded architecture and
> > does not yet make decoding truly parallel - the main thread will
> > currently submit a packet and wait until it has been fully processed by
> > the decoding thread before moving on. Decoded behavior as observed by
> > the rest of the program should remain unchanged. That will change in
> > future commits after encoders and filters are moved to threads and a
> > thread-aware scheduler is added.
> > ---
> > fftools/ffmpeg.c | 63 +++++---
> > fftools/ffmpeg.h | 11 ++
> > fftools/ffmpeg_dec.c | 365 ++++++++++++++++++++++++++++++++++++++-----
> > fftools/ffmpeg_mux.c | 5 -
> > 4 files changed, 382 insertions(+), 62 deletions(-)
>
> This seems to break (infinite loop)
>
> ffmpeg -i videos/bink/thps4/ACDC.smo -bitexact -t 1 -y ACDC.smo.avi
>
> file seems there: on samples server: game-formats/bink/thps4/ACDC.smo
This is a bug in the binkaudio decoder, fixed by the patch I just sent.
--
Anton Khirnov
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* [FFmpeg-devel] [PATCH 17/21] fftools/ffmpeg: move fix_sub_duration_heartbeat() to ffmpeg_dec
2023-06-14 16:48 [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
` (14 preceding siblings ...)
2023-06-14 16:49 ` [FFmpeg-devel] [PATCH 16/21] fftools/ffmpeg_dec: move decoding to a separate thread Anton Khirnov
@ 2023-06-14 16:49 ` Anton Khirnov
2023-06-14 16:49 ` [FFmpeg-devel] [PATCH 18/21] fftools/ffmpeg_dec: move InputStream.prev_sub to Decoder Anton Khirnov
` (4 subsequent siblings)
20 siblings, 0 replies; 37+ messages in thread
From: Anton Khirnov @ 2023-06-14 16:49 UTC (permalink / raw)
To: ffmpeg-devel
This way ffmpeg.c does not need to access InputStream.prev_sub and it
can be made private.
---
fftools/ffmpeg.c | 18 ------------------
fftools/ffmpeg.h | 2 +-
fftools/ffmpeg_dec.c | 20 +++++++++++++++++++-
3 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 4e6205e3cb..435e12a37b 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -768,24 +768,6 @@ int subtitle_wrap_frame(AVFrame *frame, AVSubtitle *subtitle, int copy)
return 0;
}
-static int fix_sub_duration_heartbeat(InputStream *ist, int64_t signal_pts)
-{
- int ret = AVERROR_BUG;
- AVSubtitle *prev_subtitle = &ist->prev_sub.subtitle;
- AVSubtitle subtitle;
-
- if (!ist->fix_sub_duration || !prev_subtitle->num_rects ||
- signal_pts <= prev_subtitle->pts)
- return 0;
-
- if ((ret = copy_av_subtitle(&subtitle, prev_subtitle)) < 0)
- return ret;
-
- subtitle.pts = signal_pts;
-
- return process_subtitle(ist, &subtitle);
-}
-
int trigger_fix_sub_duration_heartbeat(OutputStream *ost, const AVPacket *pkt)
{
OutputFile *of = output_files[ost->file_index];
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 5d60da085b..b4b55f5a73 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -879,7 +879,7 @@ OutputStream *ost_iter(OutputStream *prev);
void close_output_stream(OutputStream *ost);
int trigger_fix_sub_duration_heartbeat(OutputStream *ost, const AVPacket *pkt);
-int process_subtitle(InputStream *ist, AVSubtitle *subtitle);
+int fix_sub_duration_heartbeat(InputStream *ist, int64_t signal_pts);
void update_benchmark(const char *fmt, ...);
/**
diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index 996e7318d9..879101fe21 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -376,7 +376,7 @@ static void sub2video_flush(InputStream *ist)
}
}
-int process_subtitle(InputStream *ist, AVSubtitle *subtitle)
+static int process_subtitle(InputStream *ist, AVSubtitle *subtitle)
{
int got_output = 1;
int ret = 0;
@@ -428,6 +428,24 @@ out:
return ret;
}
+int fix_sub_duration_heartbeat(InputStream *ist, int64_t signal_pts)
+{
+ int ret = AVERROR_BUG;
+ AVSubtitle *prev_subtitle = &ist->prev_sub.subtitle;
+ AVSubtitle subtitle;
+
+ if (!ist->fix_sub_duration || !prev_subtitle->num_rects ||
+ signal_pts <= prev_subtitle->pts)
+ return 0;
+
+ if ((ret = copy_av_subtitle(&subtitle, prev_subtitle)) < 0)
+ return ret;
+
+ subtitle.pts = signal_pts;
+
+ return process_subtitle(ist, &subtitle);
+}
+
static int transcode_subtitles(InputStream *ist, const AVPacket *pkt,
AVFrame *frame)
{
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* [FFmpeg-devel] [PATCH 18/21] fftools/ffmpeg_dec: move InputStream.prev_sub to Decoder
2023-06-14 16:48 [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
` (15 preceding siblings ...)
2023-06-14 16:49 ` [FFmpeg-devel] [PATCH 17/21] fftools/ffmpeg: move fix_sub_duration_heartbeat() to ffmpeg_dec Anton Khirnov
@ 2023-06-14 16:49 ` Anton Khirnov
2023-06-14 16:49 ` [FFmpeg-devel] [PATCH 19/21] fftools/ffmpeg_enc: constify the subtitle passed to enc_subtitle() Anton Khirnov
` (3 subsequent siblings)
20 siblings, 0 replies; 37+ messages in thread
From: Anton Khirnov @ 2023-06-14 16:49 UTC (permalink / raw)
To: ffmpeg-devel
It does not need to be visible outside of decoding code.
---
fftools/ffmpeg.h | 4 ----
fftools/ffmpeg_dec.c | 26 ++++++++++++++++++--------
fftools/ffmpeg_demux.c | 1 -
3 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index b4b55f5a73..63ca542337 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -359,10 +359,6 @@ typedef struct InputStream {
int autorotate;
int fix_sub_duration;
- struct { /* previous decoded subtitle and related variables */
- int got_output;
- AVSubtitle subtitle;
- } prev_sub;
struct sub2video {
int w, h;
diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index 879101fe21..36e28aaa07 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -47,6 +47,12 @@ struct Decoder {
int64_t last_filter_in_rescale_delta;
int last_frame_sample_rate;
+ /* previous decoded subtitle and related variables */
+ struct {
+ int got_output;
+ AVSubtitle subtitle;
+ } prev_sub;
+
pthread_t thread;
/**
* Queue for sending coded packets from the main thread to
@@ -102,6 +108,8 @@ void dec_free(Decoder **pdec)
av_frame_free(&dec->frame);
av_packet_free(&dec->pkt);
+ avsubtitle_free(&dec->prev_sub.subtitle);
+
av_freep(pdec);
}
@@ -378,24 +386,25 @@ static void sub2video_flush(InputStream *ist)
static int process_subtitle(InputStream *ist, AVSubtitle *subtitle)
{
+ Decoder *d = ist->decoder;
int got_output = 1;
int ret = 0;
if (ist->fix_sub_duration) {
int end = 1;
- if (ist->prev_sub.got_output) {
- end = av_rescale(subtitle->pts - ist->prev_sub.subtitle.pts,
+ if (d->prev_sub.got_output) {
+ end = av_rescale(subtitle->pts - d->prev_sub.subtitle.pts,
1000, AV_TIME_BASE);
- if (end < ist->prev_sub.subtitle.end_display_time) {
+ if (end < d->prev_sub.subtitle.end_display_time) {
av_log(NULL, AV_LOG_DEBUG,
"Subtitle duration reduced from %"PRId32" to %d%s\n",
- ist->prev_sub.subtitle.end_display_time, end,
+ d->prev_sub.subtitle.end_display_time, end,
end <= 0 ? ", dropping it" : "");
- ist->prev_sub.subtitle.end_display_time = end;
+ d->prev_sub.subtitle.end_display_time = end;
}
}
- FFSWAP(int, got_output, ist->prev_sub.got_output);
- FFSWAP(AVSubtitle, *subtitle, ist->prev_sub.subtitle);
+ FFSWAP(int, got_output, d->prev_sub.got_output);
+ FFSWAP(AVSubtitle, *subtitle, d->prev_sub.subtitle);
if (end <= 0)
goto out;
}
@@ -430,8 +439,9 @@ out:
int fix_sub_duration_heartbeat(InputStream *ist, int64_t signal_pts)
{
+ Decoder *d = ist->decoder;
int ret = AVERROR_BUG;
- AVSubtitle *prev_subtitle = &ist->prev_sub.subtitle;
+ AVSubtitle *prev_subtitle = &d->prev_sub.subtitle;
AVSubtitle subtitle;
if (!ist->fix_sub_duration || !prev_subtitle->num_rects ||
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 1c6a5aab7b..5d3e043793 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -816,7 +816,6 @@ static void ist_free(InputStream **pist)
dec_free(&ist->decoder);
av_dict_free(&ist->decoder_opts);
- avsubtitle_free(&ist->prev_sub.subtitle);
av_freep(&ist->filters);
av_freep(&ist->outputs);
av_freep(&ist->hwaccel_device);
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* [FFmpeg-devel] [PATCH 19/21] fftools/ffmpeg_enc: constify the subtitle passed to enc_subtitle()
2023-06-14 16:48 [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
` (16 preceding siblings ...)
2023-06-14 16:49 ` [FFmpeg-devel] [PATCH 18/21] fftools/ffmpeg_dec: move InputStream.prev_sub to Decoder Anton Khirnov
@ 2023-06-14 16:49 ` Anton Khirnov
2023-06-14 16:49 ` [FFmpeg-devel] [PATCH 20/21] fftools/ffmpeg: use AVFrame to pass subtitles from decoders to filters Anton Khirnov
` (2 subsequent siblings)
20 siblings, 0 replies; 37+ messages in thread
From: Anton Khirnov @ 2023-06-14 16:49 UTC (permalink / raw)
To: ffmpeg-devel
---
fftools/ffmpeg.h | 2 +-
fftools/ffmpeg_enc.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 63ca542337..3da5bc4f7c 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -816,7 +816,7 @@ int enc_alloc(Encoder **penc, const AVCodec *codec);
void enc_free(Encoder **penc);
int enc_open(OutputStream *ost, AVFrame *frame);
-void enc_subtitle(OutputFile *of, OutputStream *ost, AVSubtitle *sub);
+void enc_subtitle(OutputFile *of, OutputStream *ost, const AVSubtitle *sub);
void enc_frame(OutputStream *ost, AVFrame *frame);
void enc_flush(void);
diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index f42f4055d6..4029501313 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -462,7 +462,7 @@ static int check_recording_time(OutputStream *ost, int64_t ts, AVRational tb)
return 1;
}
-void enc_subtitle(OutputFile *of, OutputStream *ost, AVSubtitle *sub)
+void enc_subtitle(OutputFile *of, OutputStream *ost, const AVSubtitle *sub)
{
Encoder *e = ost->enc;
int subtitle_out_max_size = 1024 * 1024;
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* [FFmpeg-devel] [PATCH 20/21] fftools/ffmpeg: use AVFrame to pass subtitles from decoders to filters
2023-06-14 16:48 [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
` (17 preceding siblings ...)
2023-06-14 16:49 ` [FFmpeg-devel] [PATCH 19/21] fftools/ffmpeg_enc: constify the subtitle passed to enc_subtitle() Anton Khirnov
@ 2023-06-14 16:49 ` Anton Khirnov
2023-06-14 16:49 ` [FFmpeg-devel] [PATCH 21/21] fftools/ffmpeg: pass subtitle decoder dimensions to sub2video Anton Khirnov
2023-06-18 8:35 ` [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
20 siblings, 0 replies; 37+ messages in thread
From: Anton Khirnov @ 2023-06-14 16:49 UTC (permalink / raw)
To: ffmpeg-devel
Allows to use the same buffering code for all media types. Will also be
important for the following commit.
---
fftools/ffmpeg.h | 2 +-
fftools/ffmpeg_dec.c | 88 ++++++++++++++++++++++++++---------------
fftools/ffmpeg_filter.c | 51 ++++++------------------
3 files changed, 70 insertions(+), 71 deletions(-)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 3da5bc4f7c..316cd2b7a6 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -736,7 +736,7 @@ FrameData *frame_data(AVFrame *frame);
int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame, int keep_reference);
int ifilter_send_eof(InputFilter *ifilter, int64_t pts, AVRational tb);
-int ifilter_sub2video(InputFilter *ifilter, const AVSubtitle *sub);
+int ifilter_sub2video(InputFilter *ifilter, const AVFrame *frame);
void ifilter_sub2video_heartbeat(InputFilter *ifilter, int64_t pts, AVRational tb);
/**
diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index 36e28aaa07..e0c0038f50 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -47,11 +47,9 @@ struct Decoder {
int64_t last_filter_in_rescale_delta;
int last_frame_sample_rate;
- /* previous decoded subtitle and related variables */
- struct {
- int got_output;
- AVSubtitle subtitle;
- } prev_sub;
+ /* previous decoded subtitles */
+ AVFrame *sub_prev[2];
+ AVFrame *sub_heartbeat;
pthread_t thread;
/**
@@ -108,7 +106,9 @@ void dec_free(Decoder **pdec)
av_frame_free(&dec->frame);
av_packet_free(&dec->pkt);
- avsubtitle_free(&dec->prev_sub.subtitle);
+ for (int i = 0; i < FF_ARRAY_ELEMS(dec->sub_prev); i++)
+ av_frame_free(&dec->sub_prev[i]);
+ av_frame_free(&dec->sub_heartbeat);
av_freep(pdec);
}
@@ -384,45 +384,55 @@ static void sub2video_flush(InputStream *ist)
}
}
-static int process_subtitle(InputStream *ist, AVSubtitle *subtitle)
+static int process_subtitle(InputStream *ist, AVFrame *frame)
{
Decoder *d = ist->decoder;
- int got_output = 1;
+ const AVSubtitle *subtitle = (AVSubtitle*)frame->buf[0]->data;
int ret = 0;
if (ist->fix_sub_duration) {
+ AVSubtitle *sub_prev = d->sub_prev[0]->buf[0] ?
+ (AVSubtitle*)d->sub_prev[0]->buf[0]->data : NULL;
int end = 1;
- if (d->prev_sub.got_output) {
- end = av_rescale(subtitle->pts - d->prev_sub.subtitle.pts,
+ if (sub_prev) {
+ end = av_rescale(subtitle->pts - sub_prev->pts,
1000, AV_TIME_BASE);
- if (end < d->prev_sub.subtitle.end_display_time) {
+ if (end < sub_prev->end_display_time) {
av_log(NULL, AV_LOG_DEBUG,
"Subtitle duration reduced from %"PRId32" to %d%s\n",
- d->prev_sub.subtitle.end_display_time, end,
+ sub_prev->end_display_time, end,
end <= 0 ? ", dropping it" : "");
- d->prev_sub.subtitle.end_display_time = end;
+ sub_prev->end_display_time = end;
}
}
- FFSWAP(int, got_output, d->prev_sub.got_output);
- FFSWAP(AVSubtitle, *subtitle, d->prev_sub.subtitle);
+
+ av_frame_unref(d->sub_prev[1]);
+ av_frame_move_ref(d->sub_prev[1], frame);
+
+ frame = d->sub_prev[0];
+ subtitle = frame->buf[0] ? (AVSubtitle*)frame->buf[0]->data : NULL;
+
+ FFSWAP(AVFrame*, d->sub_prev[0], d->sub_prev[1]);
+
if (end <= 0)
- goto out;
+ return 0;
}
- if (!got_output)
+ if (!subtitle)
return 0;
for (int i = 0; i < ist->nb_filters; i++) {
- ret = ifilter_sub2video(ist->filters[i], subtitle);
+ ret = ifilter_sub2video(ist->filters[i], frame);
if (ret < 0) {
av_log(ist, AV_LOG_ERROR, "Error sending a subtitle for filtering: %s\n",
av_err2str(ret));
- goto out;
+ return ret;
}
}
+ subtitle = (AVSubtitle*)frame->buf[0]->data;
if (!subtitle->num_rects)
- goto out;
+ return 0;
for (int oidx = 0; oidx < ist->nb_outputs; oidx++) {
OutputStream *ost = ist->outputs[oidx];
@@ -432,28 +442,30 @@ static int process_subtitle(InputStream *ist, AVSubtitle *subtitle)
enc_subtitle(output_files[ost->file_index], ost, subtitle);
}
-out:
- avsubtitle_free(subtitle);
- return ret;
+ return 0;
}
int fix_sub_duration_heartbeat(InputStream *ist, int64_t signal_pts)
{
Decoder *d = ist->decoder;
int ret = AVERROR_BUG;
- AVSubtitle *prev_subtitle = &d->prev_sub.subtitle;
- AVSubtitle subtitle;
+ AVSubtitle *prev_subtitle = d->sub_prev[0]->buf[0] ?
+ (AVSubtitle*)d->sub_prev[0]->buf[0]->data : NULL;
+ AVSubtitle *subtitle;
- if (!ist->fix_sub_duration || !prev_subtitle->num_rects ||
- signal_pts <= prev_subtitle->pts)
+ if (!ist->fix_sub_duration || !prev_subtitle ||
+ !prev_subtitle->num_rects || signal_pts <= prev_subtitle->pts)
return 0;
- if ((ret = copy_av_subtitle(&subtitle, prev_subtitle)) < 0)
+ av_frame_unref(d->sub_heartbeat);
+ ret = subtitle_wrap_frame(d->sub_heartbeat, prev_subtitle, 1);
+ if (ret < 0)
return ret;
- subtitle.pts = signal_pts;
+ subtitle = (AVSubtitle*)d->sub_heartbeat->buf[0]->data;
+ subtitle->pts = signal_pts;
- return process_subtitle(ist, &subtitle);
+ return process_subtitle(ist, d->sub_heartbeat);
}
static int transcode_subtitles(InputStream *ist, const AVPacket *pkt,
@@ -825,8 +837,7 @@ int dec_packet(InputStream *ist, const AVPacket *pkt, int no_eof)
// process the decoded frame
if (ist->dec->type == AVMEDIA_TYPE_SUBTITLE) {
- AVSubtitle *sub = (AVSubtitle*)d->frame->buf[0]->data;
- ret = process_subtitle(ist, sub);
+ ret = process_subtitle(ist, d->frame);
} else {
ret = send_frame_to_filters(ist, d->frame);
}
@@ -1043,6 +1054,7 @@ static int hw_device_setup_for_decode(InputStream *ist)
int dec_open(InputStream *ist)
{
+ Decoder *d;
const AVCodec *codec = ist->dec;
int ret;
@@ -1056,6 +1068,18 @@ int dec_open(InputStream *ist)
ret = dec_alloc(&ist->decoder);
if (ret < 0)
return ret;
+ d = ist->decoder;
+
+ if (codec->type == AVMEDIA_TYPE_SUBTITLE && ist->fix_sub_duration) {
+ for (int i = 0; i < FF_ARRAY_ELEMS(d->sub_prev); i++) {
+ d->sub_prev[i] = av_frame_alloc();
+ if (!d->sub_prev[i])
+ return AVERROR(ENOMEM);
+ }
+ d->sub_heartbeat = av_frame_alloc();
+ if (!d->sub_heartbeat)
+ return AVERROR(ENOMEM);
+ }
ist->dec_ctx->opaque = ist;
ist->dec_ctx->get_format = get_format;
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 9e6883ccdd..acc8596836 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -118,9 +118,6 @@ typedef struct InputFilterPriv {
} fallback;
struct {
- ///< queue of AVSubtitle* before filter init
- AVFifo *queue;
-
AVFrame *frame;
int64_t last_pts;
@@ -749,12 +746,6 @@ void fg_free(FilterGraph **pfg)
av_frame_free(&frame);
av_fifo_freep2(&ifp->frame_queue);
}
- if (ifp->sub2video.queue) {
- AVSubtitle sub;
- while (av_fifo_read(ifp->sub2video.queue, &sub, 1) >= 0)
- avsubtitle_free(&sub);
- av_fifo_freep2(&ifp->sub2video.queue);
- }
av_frame_free(&ifp->sub2video.frame);
av_channel_layout_uninit(&ifp->fallback.ch_layout);
@@ -1593,7 +1584,11 @@ static int configure_filtergraph(FilterGraph *fg)
InputFilterPriv *ifp = ifp_from_ifilter(fg->inputs[i]);
AVFrame *tmp;
while (av_fifo_read(ifp->frame_queue, &tmp, 1) >= 0) {
- ret = av_buffersrc_add_frame(ifp->filter, tmp);
+ if (ifp->type_src == AVMEDIA_TYPE_SUBTITLE) {
+ sub2video_update(ifp, INT64_MIN, (const AVSubtitle*)tmp->buf[0]->data);
+ } else {
+ ret = av_buffersrc_add_frame(ifp->filter, tmp);
+ }
av_frame_free(&tmp);
if (ret < 0)
goto fail;
@@ -1610,20 +1605,6 @@ static int configure_filtergraph(FilterGraph *fg)
}
}
- /* process queued up subtitle packets */
- for (i = 0; i < fg->nb_inputs; i++) {
- InputFilter *ifilter = fg->inputs[i];
- InputFilterPriv *ifp = ifp_from_ifilter(ifilter);
-
- if (ifp->type_src == AVMEDIA_TYPE_SUBTITLE && ifp->sub2video.queue) {
- AVSubtitle tmp;
- while (av_fifo_read(ifp->sub2video.queue, &tmp, 1) >= 0) {
- sub2video_update(ifp, INT64_MIN, &tmp);
- avsubtitle_free(&tmp);
- }
- }
- }
-
return 0;
fail:
@@ -1797,35 +1778,29 @@ void ifilter_sub2video_heartbeat(InputFilter *ifilter, int64_t pts, AVRational t
sub2video_push_ref(ifp, pts2);
}
-int ifilter_sub2video(InputFilter *ifilter, const AVSubtitle *subtitle)
+int ifilter_sub2video(InputFilter *ifilter, const AVFrame *frame)
{
InputFilterPriv *ifp = ifp_from_ifilter(ifilter);
int ret;
if (ifilter->graph->graph) {
- if (!subtitle) {
+ if (!frame) {
if (ifp->sub2video.end_pts < INT64_MAX)
sub2video_update(ifp, INT64_MAX, NULL);
return av_buffersrc_add_frame(ifp->filter, NULL);
}
- sub2video_update(ifp, INT64_MIN, subtitle);
- } else if (subtitle) {
- AVSubtitle sub;
+ sub2video_update(ifp, INT64_MIN, (const AVSubtitle*)frame->buf[0]->data);
+ } else if (frame) {
+ AVFrame *tmp = av_frame_clone(frame);
- if (!ifp->sub2video.queue)
- ifp->sub2video.queue = av_fifo_alloc2(8, sizeof(AVSubtitle), AV_FIFO_FLAG_AUTO_GROW);
- if (!ifp->sub2video.queue)
+ if (!tmp)
return AVERROR(ENOMEM);
- ret = copy_av_subtitle(&sub, subtitle);
- if (ret < 0)
- return ret;
-
- ret = av_fifo_write(ifp->sub2video.queue, &sub, 1);
+ ret = av_fifo_write(ifp->frame_queue, &tmp, 1);
if (ret < 0) {
- avsubtitle_free(&sub);
+ av_frame_free(&tmp);
return ret;
}
}
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* [FFmpeg-devel] [PATCH 21/21] fftools/ffmpeg: pass subtitle decoder dimensions to sub2video
2023-06-14 16:48 [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
` (18 preceding siblings ...)
2023-06-14 16:49 ` [FFmpeg-devel] [PATCH 20/21] fftools/ffmpeg: use AVFrame to pass subtitles from decoders to filters Anton Khirnov
@ 2023-06-14 16:49 ` Anton Khirnov
2023-06-18 8:35 ` [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
20 siblings, 0 replies; 37+ messages in thread
From: Anton Khirnov @ 2023-06-14 16:49 UTC (permalink / raw)
To: ffmpeg-devel
Restores behavior from before 20cacfe4936a8d5b643421b5ca93bb098f6b76dd.
Eventually this should be handled similarly to audio/video - with a
filtergraph reset or a manual scaler.
---
fftools/ffmpeg_dec.c | 3 +++
fftools/ffmpeg_filter.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index e0c0038f50..4ff30b44b2 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -509,6 +509,9 @@ static int transcode_subtitles(InputStream *ist, const AVPacket *pkt,
return ret;
}
+ frame->width = ist->dec_ctx->width;
+ frame->height = ist->dec_ctx->height;
+
ret = tq_send(d->queue_out, 0, frame);
if (ret < 0)
av_frame_unref(frame);
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index acc8596836..60e09866af 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -1791,6 +1791,9 @@ int ifilter_sub2video(InputFilter *ifilter, const AVFrame *frame)
return av_buffersrc_add_frame(ifp->filter, NULL);
}
+ ifp->width = frame->width ? frame->width : ifp->width;
+ ifp->height = frame->height ? frame->height : ifp->height;
+
sub2video_update(ifp, INT64_MIN, (const AVSubtitle*)frame->buf[0]->data);
} else if (frame) {
AVFrame *tmp = av_frame_clone(frame);
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret
2023-06-14 16:48 [FFmpeg-devel] [PATCH 01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret Anton Khirnov
` (19 preceding siblings ...)
2023-06-14 16:49 ` [FFmpeg-devel] [PATCH 21/21] fftools/ffmpeg: pass subtitle decoder dimensions to sub2video Anton Khirnov
@ 2023-06-18 8:35 ` Anton Khirnov
20 siblings, 0 replies; 37+ messages in thread
From: Anton Khirnov @ 2023-06-18 8:35 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Will push the set tomorrow if nobody has further comments.
--
Anton Khirnov
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 37+ messages in thread