diff mbox series

[FFmpeg-devel] fate/matroska: Add test for updating CodecPrivate from packet sidedata

Message ID 20200401184215.18433-1-andreas.rheinhardt@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel] fate/matroska: Add test for updating CodecPrivate from packet sidedata | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Andreas Rheinhardt April 1, 2020, 6:42 p.m. UTC
containing updated extradata, in this case a new FLAC streaminfo.
Furthermore, it also tests that the Matroska muxer is able to preserve
uncommon channel layouts by adding Vorbis comments to the CodecPrivate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
This is in particular intended to test patch [1] (using fewer frames
for the last track ensures that (after the removal of the seekbacks in
mkv_check_new_extra_data()) the end position won't be at the end of the
buffer when writing the final version of the Tracks element; but this
won't be a problem after the switch to avio_get_dyn_buf() in the commit
before [1].)

[1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-January/256208.html

 tests/fate/matroska.mak                       | 12 +++++
 tests/ref/fate/matroska-flac-extradata-update | 53 +++++++++++++++++++
 2 files changed, 65 insertions(+)
 create mode 100644 tests/ref/fate/matroska-flac-extradata-update

Comments

Carl Eugen Hoyos April 1, 2020, 7:15 p.m. UTC | #1
Am Mi., 1. Apr. 2020 um 20:42 Uhr schrieb Andreas Rheinhardt
<andreas.rheinhardt@gmail.com>:
>
> containing updated extradata, in this case a new FLAC streaminfo.
> Furthermore, it also tests that the Matroska muxer is able to preserve
> uncommon channel layouts by adding Vorbis comments to the CodecPrivate.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
> This is in particular intended to test patch [1] (using fewer frames
> for the last track ensures that (after the removal of the seekbacks in
> mkv_check_new_extra_data()) the end position won't be at the end of the
> buffer when writing the final version of the Tracks element; but this
> won't be a problem after the switch to avio_get_dyn_buf() in the commit
> before [1].)
>
> [1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-January/256208.html
>
>  tests/fate/matroska.mak                       | 12 +++++
>  tests/ref/fate/matroska-flac-extradata-update | 53 +++++++++++++++++++
>  2 files changed, 65 insertions(+)
>  create mode 100644 tests/ref/fate/matroska-flac-extradata-update
>
> diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
> index b9ed7322fd..02f2ea211f 100644
> --- a/tests/fate/matroska.mak
> +++ b/tests/fate/matroska.mak
> @@ -32,6 +32,18 @@ fate-matroska-lzo-decompression: CMD = framecrc -i $(TARGET_SAMPLES)/mkv/lzo.mka
>  FATE_MATROSKA-$(call ALLYES, MATROSKA_DEMUXER FLAC_PARSER) += fate-matroska-flac-channel-mapping
>  fate-matroska-flac-channel-mapping: CMD = framecrc -i $(TARGET_SAMPLES)/mkv/flac_channel_layouts.mka -map 0 -c:a copy
>
> +# This tests that the Matroska muxer writes the channel layout
> +# of FLAC tracks as a Vorbis comment in the CodecPrivate if necessary
> +# and that FLAC extradata is correctly updated when a packet
> +# with sidedata containing new extradata is encountered.
> +# Furthermore it tests everything the matroska-flac-channel-mapping test
> +# tests and it also tests the FLAC decoder and encoder, in particular
> +# the latter's ability to send updated extradata.
> +FATE_MATROSKA-$(call ALLYES, FLAC_DECODER FLAC_ENCODER FLAC_PARSER \
> +                MATROSKA_DEMUXER MATROSKA_MUXER) += fate-matroska-flac-extradata-update
> +fate-matroska-flac-extradata-update: CMD = transcode matroska $(TARGET_SAMPLES)/mkv/flac_channel_layouts.mka \
> +                                           matroska "-map 0 -map 0:0 -c flac -frames:a:2 8" "-map 0 -c copy"

What effect does "-map 0 -map 0:0" have?

Carl Eugen
Andreas Rheinhardt April 1, 2020, 7:19 p.m. UTC | #2
Carl Eugen Hoyos:
> Am Mi., 1. Apr. 2020 um 20:42 Uhr schrieb Andreas Rheinhardt
> <andreas.rheinhardt@gmail.com>:
>>
>> containing updated extradata, in this case a new FLAC streaminfo.
>> Furthermore, it also tests that the Matroska muxer is able to preserve
>> uncommon channel layouts by adding Vorbis comments to the CodecPrivate.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
>> ---
>> This is in particular intended to test patch [1] (using fewer frames
>> for the last track ensures that (after the removal of the seekbacks in
>> mkv_check_new_extra_data()) the end position won't be at the end of the
>> buffer when writing the final version of the Tracks element; but this
>> won't be a problem after the switch to avio_get_dyn_buf() in the commit
>> before [1].)
>>
>> [1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-January/256208.html
>>
>>  tests/fate/matroska.mak                       | 12 +++++
>>  tests/ref/fate/matroska-flac-extradata-update | 53 +++++++++++++++++++
>>  2 files changed, 65 insertions(+)
>>  create mode 100644 tests/ref/fate/matroska-flac-extradata-update
>>
>> diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
>> index b9ed7322fd..02f2ea211f 100644
>> --- a/tests/fate/matroska.mak
>> +++ b/tests/fate/matroska.mak
>> @@ -32,6 +32,18 @@ fate-matroska-lzo-decompression: CMD = framecrc -i $(TARGET_SAMPLES)/mkv/lzo.mka
>>  FATE_MATROSKA-$(call ALLYES, MATROSKA_DEMUXER FLAC_PARSER) += fate-matroska-flac-channel-mapping
>>  fate-matroska-flac-channel-mapping: CMD = framecrc -i $(TARGET_SAMPLES)/mkv/flac_channel_layouts.mka -map 0 -c:a copy
>>
>> +# This tests that the Matroska muxer writes the channel layout
>> +# of FLAC tracks as a Vorbis comment in the CodecPrivate if necessary
>> +# and that FLAC extradata is correctly updated when a packet
>> +# with sidedata containing new extradata is encountered.
>> +# Furthermore it tests everything the matroska-flac-channel-mapping test
>> +# tests and it also tests the FLAC decoder and encoder, in particular
>> +# the latter's ability to send updated extradata.
>> +FATE_MATROSKA-$(call ALLYES, FLAC_DECODER FLAC_ENCODER FLAC_PARSER \
>> +                MATROSKA_DEMUXER MATROSKA_MUXER) += fate-matroska-flac-extradata-update
>> +fate-matroska-flac-extradata-update: CMD = transcode matroska $(TARGET_SAMPLES)/mkv/flac_channel_layouts.mka \
>> +                                           matroska "-map 0 -map 0:0 -c flac -frames:a:2 8" "-map 0 -c copy"
> 
> What effect does "-map 0 -map 0:0" have?
> 
-map 0 adds all streams of the input file to output and map 0:0 adds the
first input stream again. flac_channel_layouts.mka has two streams and
therefore there will be three output streams: The common source of the
first and third stream is the first input stream, the second stream has
the second input stream as source.

- Andreas
Carl Eugen Hoyos April 1, 2020, 7:20 p.m. UTC | #3
Am Mi., 1. Apr. 2020 um 21:19 Uhr schrieb Andreas Rheinhardt
<andreas.rheinhardt@gmail.com>:
>
> Carl Eugen Hoyos:
> > Am Mi., 1. Apr. 2020 um 20:42 Uhr schrieb Andreas Rheinhardt
> > <andreas.rheinhardt@gmail.com>:
> >>
> >> containing updated extradata, in this case a new FLAC streaminfo.
> >> Furthermore, it also tests that the Matroska muxer is able to preserve
> >> uncommon channel layouts by adding Vorbis comments to the CodecPrivate.
> >>
> >> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> >> ---
> >> This is in particular intended to test patch [1] (using fewer frames
> >> for the last track ensures that (after the removal of the seekbacks in
> >> mkv_check_new_extra_data()) the end position won't be at the end of the
> >> buffer when writing the final version of the Tracks element; but this
> >> won't be a problem after the switch to avio_get_dyn_buf() in the commit
> >> before [1].)
> >>
> >> [1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-January/256208.html
> >>
> >>  tests/fate/matroska.mak                       | 12 +++++
> >>  tests/ref/fate/matroska-flac-extradata-update | 53 +++++++++++++++++++
> >>  2 files changed, 65 insertions(+)
> >>  create mode 100644 tests/ref/fate/matroska-flac-extradata-update
> >>
> >> diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
> >> index b9ed7322fd..02f2ea211f 100644
> >> --- a/tests/fate/matroska.mak
> >> +++ b/tests/fate/matroska.mak
> >> @@ -32,6 +32,18 @@ fate-matroska-lzo-decompression: CMD = framecrc -i $(TARGET_SAMPLES)/mkv/lzo.mka
> >>  FATE_MATROSKA-$(call ALLYES, MATROSKA_DEMUXER FLAC_PARSER) += fate-matroska-flac-channel-mapping
> >>  fate-matroska-flac-channel-mapping: CMD = framecrc -i $(TARGET_SAMPLES)/mkv/flac_channel_layouts.mka -map 0 -c:a copy
> >>
> >> +# This tests that the Matroska muxer writes the channel layout
> >> +# of FLAC tracks as a Vorbis comment in the CodecPrivate if necessary
> >> +# and that FLAC extradata is correctly updated when a packet
> >> +# with sidedata containing new extradata is encountered.
> >> +# Furthermore it tests everything the matroska-flac-channel-mapping test
> >> +# tests and it also tests the FLAC decoder and encoder, in particular
> >> +# the latter's ability to send updated extradata.
> >> +FATE_MATROSKA-$(call ALLYES, FLAC_DECODER FLAC_ENCODER FLAC_PARSER \
> >> +                MATROSKA_DEMUXER MATROSKA_MUXER) += fate-matroska-flac-extradata-update
> >> +fate-matroska-flac-extradata-update: CMD = transcode matroska $(TARGET_SAMPLES)/mkv/flac_channel_layouts.mka \
> >> +                                           matroska "-map 0 -map 0:0 -c flac -frames:a:2 8" "-map 0 -c copy"
> >
> > What effect does "-map 0 -map 0:0" have?
> >
> -map 0 adds all streams of the input file to output and map 0:0 adds the
> first input stream again. flac_channel_layouts.mka has two streams and
> therefore there will be three output streams: The common source of the
> first and third stream is the first input stream, the second stream has
> the second input stream as source.

Of course.

Thank you, Carl Eugen
Andreas Rheinhardt April 3, 2020, 8:16 a.m. UTC | #4
Andreas Rheinhardt:
> containing updated extradata, in this case a new FLAC streaminfo.
> Furthermore, it also tests that the Matroska muxer is able to preserve
> uncommon channel layouts by adding Vorbis comments to the CodecPrivate.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
> This is in particular intended to test patch [1] (using fewer frames
> for the last track ensures that (after the removal of the seekbacks in
> mkv_check_new_extra_data()) the end position won't be at the end of the
> buffer when writing the final version of the Tracks element; but this
> won't be a problem after the switch to avio_get_dyn_buf() in the commit
> before [1].)
> 
> [1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-January/256208.html
> 
Applied.

- Andreas
diff mbox series

Patch

diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
index b9ed7322fd..02f2ea211f 100644
--- a/tests/fate/matroska.mak
+++ b/tests/fate/matroska.mak
@@ -32,6 +32,18 @@  fate-matroska-lzo-decompression: CMD = framecrc -i $(TARGET_SAMPLES)/mkv/lzo.mka
 FATE_MATROSKA-$(call ALLYES, MATROSKA_DEMUXER FLAC_PARSER) += fate-matroska-flac-channel-mapping
 fate-matroska-flac-channel-mapping: CMD = framecrc -i $(TARGET_SAMPLES)/mkv/flac_channel_layouts.mka -map 0 -c:a copy
 
+# This tests that the Matroska muxer writes the channel layout
+# of FLAC tracks as a Vorbis comment in the CodecPrivate if necessary
+# and that FLAC extradata is correctly updated when a packet
+# with sidedata containing new extradata is encountered.
+# Furthermore it tests everything the matroska-flac-channel-mapping test
+# tests and it also tests the FLAC decoder and encoder, in particular
+# the latter's ability to send updated extradata.
+FATE_MATROSKA-$(call ALLYES, FLAC_DECODER FLAC_ENCODER FLAC_PARSER \
+                MATROSKA_DEMUXER MATROSKA_MUXER) += fate-matroska-flac-extradata-update
+fate-matroska-flac-extradata-update: CMD = transcode matroska $(TARGET_SAMPLES)/mkv/flac_channel_layouts.mka \
+                                           matroska "-map 0 -map 0:0 -c flac -frames:a:2 8" "-map 0 -c copy"
+
 FATE_MATROSKA_FFPROBE-$(call ALLYES, MATROSKA_DEMUXER) += fate-matroska-spherical-mono
 fate-matroska-spherical-mono: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream_side_data_list -select_streams v -v 0 $(TARGET_SAMPLES)/mkv/spherical.mkv
 
diff --git a/tests/ref/fate/matroska-flac-extradata-update b/tests/ref/fate/matroska-flac-extradata-update
new file mode 100644
index 0000000000..743486c974
--- /dev/null
+++ b/tests/ref/fate/matroska-flac-extradata-update
@@ -0,0 +1,53 @@ 
+2b363aecd6422c3ce9964983f5d0f3ef *tests/data/fate/matroska-flac-extradata-update.matroska
+2049 tests/data/fate/matroska-flac-extradata-update.matroska
+#extradata 0:       34, 0x7acb09e7
+#extradata 1:       34, 0x7acb09e7
+#extradata 2:       34, 0x443402dd
+#tb 0: 1/1000
+#media_type 0: audio
+#codec_id 0: flac
+#sample_rate 0: 48000
+#channel_layout 0: 3f
+#channel_layout_name 0: 5.1
+#tb 1: 1/1000
+#media_type 1: audio
+#codec_id 1: flac
+#sample_rate 1: 48000
+#channel_layout 1: 60f
+#channel_layout_name 1: 5.1(side)
+#tb 2: 1/1000
+#media_type 2: audio
+#codec_id 2: flac
+#sample_rate 2: 48000
+#channel_layout 2: 3f
+#channel_layout_name 2: 5.1
+0,          0,          0,       96,       26, 0x4e160341
+1,          0,          0,       96,       26, 0x4e160341
+2,          0,          0,       96,       26, 0x4e160341
+0,         96,         96,       96,       26, 0x4e17035c
+1,         96,         96,       96,       26, 0x4e17035c
+2,         96,         96,       96,       26, 0x4e17035c
+0,        192,        192,       96,       26, 0x4de40383
+1,        192,        192,       96,       26, 0x4de40383
+2,        192,        192,       96,       26, 0x4de40383
+0,        288,        288,       96,       26, 0x4e3903a2
+1,        288,        288,       96,       26, 0x4e3903a2
+2,        288,        288,       96,       26, 0x4e3903a2
+0,        384,        384,       96,       26, 0x4f9a03d5
+1,        384,        384,       96,       26, 0x4f9a03d5
+2,        384,        384,       96,       26, 0x4f9a03d5
+0,        480,        480,       96,       26, 0x501303e0
+1,        480,        480,       96,       26, 0x501303e0
+2,        480,        480,       96,       26, 0x501303e0
+0,        576,        576,       96,       26, 0x5160042f
+1,        576,        576,       96,       26, 0x5160042f
+2,        576,        576,       96,       26, 0x5160042f
+0,        672,        672,       96,       26, 0x50dd042e
+1,        672,        672,       96,       26, 0x50dd042e
+2,        672,        672,       96,       26, 0x50dd042e
+0,        768,        768,       96,       26, 0x53de0499
+1,        768,        768,       96,       26, 0x53de0499
+0,        864,        864,       96,       26, 0x53df04b4
+1,        864,        864,       96,       26, 0x53df04b4
+0,        960,        960,       42,       26, 0x5740044b
+1,        960,        960,       42,       26, 0x5740044b