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.
Edited by Vikram Kangotra
Merge request reports
Activity
Filter activity
Please register or sign in to reply