[vlc-devel] [vlc-commits] taglib: template the extension fix, remove contribs patch

Filip Roséen filip at atch.se
Fri Feb 19 17:00:20 CET 2016

> This has been fixed using static class instances, (because we need to
> deallocate, and releasing module will)
> and registration flag.
> Francois

Getting rid of the allocation

Another way of completely solving the issue is by getting rid of the `new`
completely, which in turn means that there will not be a need for deallocation.

    --- a/modules/meta_engine/taglib.cpp
    +++ b/modules/meta_engine/taglib.cpp
    @@ -738,10 +738,16 @@ static int ReadMeta( vlc_object_t* p_this)
             return VLC_EGENERIC;
    -    FileRef::addFileTypeResolver( new VLCTagLib::ExtResolver<MPEG::File>(".aac") );
    +    static VLCTagLib::ExtResolver<MPEG::File>  ftr_acc (".aac");
    +    static FileRef::FileTypeResolver const * p_ftr_acc = FileRef::addFileTypeResolver (&ftr_acc);
    +    VLC_UNUSED(p_ftr_acc);
    -    FileRef::addFileTypeResolver( new VLCTagLib::ExtResolver<MP4::File>(".m4v") );
    +    static VLCTagLib::ExtResolver<MP4::File>   ftr_m4v (".m4v");
    +    static FileRef::FileTypeResolver const * p_ftr_m4v = FileRef::addFileTypeResolver (&ftr_m4v);
    +    VLC_UNUSED(p_ftr_m4v);
     #if defined(_WIN32)
         wchar_t *wpath = ToWide( psz_path );

Using a static class instance for such registration

It would of course be neater if such registration happens inside a static class
instance, so if such is already available that path is probably a lot more
pleasant to walk.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20160219/3def322d/attachment.html>

More information about the vlc-devel mailing list