diff mbox series

[FFmpeg-devel,03/10] fate/cover-art: Add test for writing id3v2 tags and apic with AIFF/MP3

Message ID HE1PR0301MB2154098DFAAB914FA298D4728F4D9@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
Commit 2f4ef9cbdfad716bcf1b4d4c99161e23b7cf24f0
Headers show
Series [FFmpeg-devel,01/10] fate/filter-video: Remove SAMPLES depedency from refcmp tests | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt April 15, 2021, 8:16 p.m. UTC
Notice that the order of the APIC tracks is currently wrong. This is
a superposition of two bugs: (i) Both muxers write the attached
pictures in the order they arrive in the muxer and not in the
stream_index order, leading to attached pictures that are copied being
written earlier because their timestamp is AV_NOPTS_VALUE, whereas the
timestamp of the encoded pictures is 0. (ii) A bug in the id3v2 parsing
code reverses the order of the parsed pictures.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 tests/fate/cover-art.mak                  | 21 +++++-
 tests/ref/fate/cover-art-aiff-id3v2-remux | 82 +++++++++++++++++++++++
 tests/ref/fate/cover-art-mp3-id3v2-remux  | 55 +++++++++++++++
 3 files changed, 156 insertions(+), 2 deletions(-)
 create mode 100644 tests/ref/fate/cover-art-aiff-id3v2-remux
 create mode 100644 tests/ref/fate/cover-art-mp3-id3v2-remux
diff mbox series

Patch

diff --git a/tests/fate/cover-art.mak b/tests/fate/cover-art.mak
index 721c650b78..c42a4bc499 100644
--- a/tests/fate/cover-art.mak
+++ b/tests/fate/cover-art.mak
@@ -30,9 +30,26 @@  FATE_COVER_ART-$(CONFIG_WV_DEMUXER) += fate-cover-art-wv
 fate-cover-art-wv: CMD = md5 -i $(TARGET_SAMPLES)/cover_art/luckynight_cover.wv -an -c:v copy -f rawvideo
 fate-cover-art-wv: REF = 45333c983c45af54449dff10af144317
 
+# Tests writing id3v2 tags (some with non-ASCII characters) and apics.
+FATE_COVER_ART_REMUX-$(call ALLYES, FILE_PROTOCOL FLAC_DEMUXER MJPEG_DECODER \
+                                    FLAC_DECODER SCALE_FILTER PNG_ENCODER    \
+                                    BMP_ENCODER PCM_S16BE_ENCODER AIFF_MUXER \
+                                    AIFF_DEMUXER BMP_DECODER PNG_DECODER     \
+                                    FRAMECRC_MUXER PIPE_PROTOCOL)            \
+                       += fate-cover-art-aiff-id3v2-remux
+fate-cover-art-aiff-id3v2-remux: CMD = transcode flac $(TARGET_SAMPLES)/cover_art/cover_art.flac aiff "-map 0 -map 0:v -map 0:v -map 0:v -c:a pcm_s16be -c:v:0 copy -filter:v:1 scale -c:v:1 png -filter:v:2 scale -c:v:2 bmp -c:v:3 copy -write_id3v2 1 -metadata:g unknown_key=unknown_value -metadata compilation=foo -metadata:s:v:0 title=first -metadata:s:v:1 title=second -metadata:s:v:1 comment=Illustration -metadata:s:v:2 title=third -metadata:s:v:2 comment=Conductor -metadata:s:v:3 title=fourth -metadata:s:v:3 comment=Composer" "-map 0 -c copy -t 0.1" "" "-show_entries format_tags:stream_tags:stream_disposition=attached_pic:stream=index,codec_name"
+
+FATE_COVER_ART_REMUX-$(call ALLYES, FILE_PROTOCOL MP3_DEMUXER MJPEG_DECODER \
+                                    SCALE_FILTER PNG_ENCODER BMP_ENCODER    \
+                                    MP3_MUXER BMP_DECODER PNG_DECODER       \
+                                    FRAMECRC_MUXER PIPE_PROTOCOL)           \
+                       += fate-cover-art-mp3-id3v2-remux
+fate-cover-art-mp3-id3v2-remux: CMD = transcode mp3 $(TARGET_SAMPLES)/exif/embedded_small.mp3 mp3 "-map 0 -map 0:v -map 0:v -c:a copy -filter:v:0 scale -filter:v:2 scale -c:v:0 bmp -c:v:1 copy -c:v:2 png -metadata:s:v:0 comment=Band/Orchestra" "-map 0 -c copy -t 0.1" "" "-show_entries stream_tags:stream_disposition=attached_pic:stream=index,codec_name"
+
 FCA_TEMP-$(call ALLYES, RAWVIDEO_MUXER FILE_PROTOCOL) = $(FATE_COVER_ART-yes)
 FATE_COVER_ART = $(FCA_TEMP-yes)
-
 $(FATE_COVER_ART): CMP = oneline
+
 FATE_SAMPLES_AVCONV += $(FATE_COVER_ART)
-fate-cover-art: $(FATE_COVER_ART)
+FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_COVER_ART_REMUX-yes)
+fate-cover-art: $(FATE_COVER_ART) $(FATE_COVER_ART_REMUX-yes)
diff --git a/tests/ref/fate/cover-art-aiff-id3v2-remux b/tests/ref/fate/cover-art-aiff-id3v2-remux
new file mode 100644
index 0000000000..207721fc71
--- /dev/null
+++ b/tests/ref/fate/cover-art-aiff-id3v2-remux
@@ -0,0 +1,82 @@ 
+d4a9481090a8bab1a3f072a8108a1d6a *tests/data/fate/cover-art-aiff-id3v2-remux.aiff
+608914 tests/data/fate/cover-art-aiff-id3v2-remux.aiff
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: pcm_s16be
+#sample_rate 0: 44100
+#channel_layout 0: 3
+#channel_layout_name 0: stereo
+#tb 1: 1/90000
+#media_type 1: video
+#codec_id 1: bmp
+#dimensions 1: 350x350
+#sar 1: 0/1
+#tb 2: 1/90000
+#media_type 2: video
+#codec_id 2: png
+#dimensions 2: 350x350
+#sar 2: 1/1
+#tb 3: 1/90000
+#media_type 3: video
+#codec_id 3: mjpeg
+#dimensions 3: 350x350
+#sar 3: 1/1
+#tb 4: 1/90000
+#media_type 4: video
+#codec_id 4: mjpeg
+#dimensions 4: 350x350
+#sar 4: 1/1
+0,          0,          0,     1024,     4096, 0xdac4695d
+1,          0,          0,        0,   368254, 0xfa7f4bd8
+2,          0,          0,        0,   184497, 0xc33f8d44
+3,          0,          0,        0,    19650, 0xd5662610
+4,          0,          0,        0,    19650, 0xd5662610
+0,       1024,       1024,     1024,     4096, 0xad05c909
+0,       2048,       2048,     1024,     4096, 0x97e3b8f8
+0,       3072,       3072,     1024,     4096, 0xb08180fa
+[STREAM]
+index=0
+codec_name=pcm_s16be
+DISPOSITION:attached_pic=0
+[/STREAM]
+[STREAM]
+index=1
+codec_name=bmp
+DISPOSITION:attached_pic=1
+TAG:title=third
+TAG:comment=Conductor
+[/STREAM]
+[STREAM]
+index=2
+codec_name=png
+DISPOSITION:attached_pic=1
+TAG:title=second
+TAG:comment=Illustration
+[/STREAM]
+[STREAM]
+index=3
+codec_name=mjpeg
+DISPOSITION:attached_pic=1
+TAG:title=fourth
+TAG:comment=Composer
+[/STREAM]
+[STREAM]
+index=4
+codec_name=mjpeg
+DISPOSITION:attached_pic=1
+TAG:title=first
+TAG:comment=Other
+[/STREAM]
+[FORMAT]
+TAG:artist=Мельница
+TAG:RATING=0
+TAG:album=Ангелофрения
+TAG:title=Дороги
+TAG:tracktotal=11
+TAG:totaltracks=11
+TAG:genre=Folk
+TAG:date=2012
+TAG:track=2
+TAG:unknown_key=unknown_value
+TAG:compilation=foo
+[/FORMAT]
diff --git a/tests/ref/fate/cover-art-mp3-id3v2-remux b/tests/ref/fate/cover-art-mp3-id3v2-remux
new file mode 100644
index 0000000000..a3bc8c7891
--- /dev/null
+++ b/tests/ref/fate/cover-art-mp3-id3v2-remux
@@ -0,0 +1,55 @@ 
+c1b55a9a92226cd72d3f53ccd830d127 *tests/data/fate/cover-art-mp3-id3v2-remux.mp3
+399346 tests/data/fate/cover-art-mp3-id3v2-remux.mp3
+#tb 0: 1/14112000
+#media_type 0: audio
+#codec_id 0: mp3
+#sample_rate 0: 44100
+#channel_layout 0: 3
+#channel_layout_name 0: stereo
+#tb 1: 1/90000
+#media_type 1: video
+#codec_id 1: png
+#dimensions 1: 263x263
+#sar 1: 1/1
+#tb 2: 1/90000
+#media_type 2: video
+#codec_id 2: bmp
+#dimensions 2: 263x263
+#sar 2: 0/1
+#tb 3: 1/90000
+#media_type 3: video
+#codec_id 3: mjpeg
+#dimensions 3: 263x263
+#sar 3: 96/96
+0,    -353590,    -353590,   368640,      417, 0x15848290, S=1,       10, 0x034e0055
+1,          0,          0,        0,   165671, 0x7c1c8070
+2,          0,          0,        0,   208350, 0x291b44d1
+3,          0,          0,        0,    15760, 0x71d5c418
+0,      15050,      15050,   368640,      418, 0x46f684a4
+0,     383690,     383690,   368640,      418, 0x46f684a4
+0,     752330,     752330,   368640,      418, 0x46f684a4
+0,    1120970,    1120970,   368640,      418, 0x46f684a4
+[STREAM]
+index=0
+codec_name=mp3
+DISPOSITION:attached_pic=0
+TAG:encoder=Lavf
+[/STREAM]
+[STREAM]
+index=1
+codec_name=png
+DISPOSITION:attached_pic=1
+TAG:comment=Other
+[/STREAM]
+[STREAM]
+index=2
+codec_name=bmp
+DISPOSITION:attached_pic=1
+TAG:comment=Band/Orchestra
+[/STREAM]
+[STREAM]
+index=3
+codec_name=mjpeg
+DISPOSITION:attached_pic=1
+TAG:comment=Other
+[/STREAM]