Taglib: Use ID3v2Tag() instead of tag() for RIFF::WAV::File
When I tried to compile VLC on my Linux system (version 6.7.3-2-cachyos), I encountered a compilation error.
Build log:
CXX meta_engine/libtaglib_plugin_la-taglib.lo
../../modules/meta_engine/taglib.cpp: In function ‘int ReadMeta(vlc_object_t*)’:
../../modules/meta_engine/taglib.cpp:988:17: error: cannot declare variable ‘s’ to be of abstract type ‘VlcIostream’
988 | VlcIostream s( p_stream );
| ^
../../modules/meta_engine/taglib.cpp:186:7: note: because the following virtual functions are pure within ‘VlcIostream’:
186 | class VlcIostream : public IOStream
| ^~~~~~~~~~~
In file included from /usr/include/taglib/tfile.h:30,
from /usr/include/taglib/fileref.h:29,
from ../../modules/meta_engine/taglib.cpp:61:
/usr/include/taglib/tiostream.h:117:18: note: ‘virtual void TagLib::IOStream::insert(const TagLib::ByteVector&, TagLib::offset_t, size_t)’
117 | virtual void insert(const ByteVector &data,
| ^~~~~~
/usr/include/taglib/tiostream.h:127:18: note: ‘virtual void TagLib::IOStream::removeBlock(TagLib::offset_t, size_t)’
127 | virtual void removeBlock(offset_t start = 0, size_t length = 0) = 0;
| ^~~~~~~~~~~
../../modules/meta_engine/taglib.cpp: In function ‘int WriteMeta(vlc_object_t*)’:
../../modules/meta_engine/taglib.cpp:1395:44: error: invalid conversion from ‘TagLib::Tag*’ to ‘TagLib::ID3v2::Tag*’ [-fpermissive]
1395 | WriteMetaToId3v2( riff_wav->tag(), p_item );
| ~~~~~~~~~~~~~^~
| |
| TagLib::Tag*
../../modules/meta_engine/taglib.cpp:1119:43: note: initializing argument 1 of ‘void WriteMetaToId3v2(TagLib::ID3v2::Tag*, input_item_t*)’
1119 | static void WriteMetaToId3v2( ID3v2::Tag* tag, input_item_t* p_item )
| ~~~~~~~~~~~~^~~
../../modules/meta_engine/taglib.cpp: In instantiation of ‘TagLib::File* VLCTagLib::ExtResolver<T>::createFileFromStream(TagLib::IOStream*, bool, TagLib::AudioProperties::ReadStyle) const [with T = TagLib::MPEG::File]’:
../../modules/meta_engine/taglib.cpp:151:7: required from here
../../modules/meta_engine/taglib.cpp:161:20: warning: ‘TagLib::MPEG::File::File(TagLib::IOStream*, TagLib::ID3v2::FrameFactory*, bool, TagLib::AudioProperties::ReadStyle)’ is deprecated [-Wdeprecated-declarations]
161 | return new T(s, ID3v2::FrameFactory::instance(), false, AudioProperties::Fast);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../modules/meta_engine/taglib.cpp:74:
/usr/include/taglib/mpegfile.h:140:7: note: declared here
140 | File(IOStream *stream, ID3v2::FrameFactory *frameFactory,
| ^~~~
It's a bit puzzling because I haven't faced this error before, but I made some necessary fixes in the code to get things working.
WriteMetaToId3v2
expects a TagLib::ID3v2::Tag
instead of TagLib::Tag
, hence replaced the usage of the tag()
method with ID3v2Tag()
when working with RIFF::WAV::File
.
https://github.com/taglib/taglib/blob/master/taglib/riff/wav/wavfile.h#L124
Additionally, to resolve the compilation error, the function signatures of insert
and removeBlock
have been adjusted to align with the base class functions.
Merge request reports
Activity
added MRStatus::NotCompliant label
Found the reason it was failing: #28502
- Resolved by Alexandre Janniaux
Is it supported by older taglib version? (< 2.0) If not, we'll need to add version guard.
added 1 commit
- 5144dff7 - Taglib: Use ID3v2Tag() instead of tag() for RIFF::WAV::File
- Resolved by Alexandre Janniaux
Nit: you could use directly
#if TAGLIB_VERSION >= VERSION_INT(2, 0, 0)
instead of declaring a macro for that, that would be easier to follow an maintain.
added 1 commit
- 3e84f373 - Taglib: Use ID3v2Tag() instead of tag() for RIFF::WAV::File
- Resolved by Vikram Kangotra
It seems that you'll need to fix the patches if you want to keep the taglib bump in this MR:
patching file taglib/mpeg/mpegfile.cpp Hunk #1 FAILED at 132. Hunk #2 FAILED at 498. Hunk #3 FAILED at 535. Hunk #4 succeeded at 524 (offset -34 lines). 3 out of 4 hunks FAILED -- saving rejects to file taglib/mpeg/mpegfile.cpp.rej rm -f jpeg/vlc_build/CMakeCache.txt patching file taglib/mpeg/mpegfile.h Hunk #1 FAILED at 76. Hunk #2 FAILED at 91. Hunk #3 FAILED at 108. Hunk #4 FAILED at 375. patching file Makefile.in mkdir -p libtasn1/vlc_build && rm -f libtasn1/vlc_build/config.status && test ! -f libtasn1/config.status || make -C libtasn1 distclean 4 out of 4 hunks FAILED -- saving rejects to file taglib/mpeg/mpegfile.h.rej patching file taglib/toolkit/taglib.h Hunk #1 FAILED at 54. 1 out of 1 hunk FAILED -- saving rejects to file taglib/toolkit/taglib.h.rej # use CreateFile2 in Win8 as CreateFileW is forbidden in UWP