<p>Hi Hannes,</p>
<p>The easiest way to get fix the issue would be to use <code>FileRef::addFileTypeResolver (...)</code> as the initializer for a variable declared <code>static</code>.</p>
<pre><code>--- a/modules/meta_engine/taglib.cpp
+++ b/modules/meta_engine/taglib.cpp
@@ -738,10 +738,13 @@ static int ReadMeta( vlc_object_t* p_this)
return VLC_EGENERIC;
#if TAGLIB_VERSION >= TAGLIB_SYNCDECODE_FIXED_VERSION
- FileRef::addFileTypeResolver( new VLCTagLib::ExtResolver<MPEG::File>(".aac") );
+ static FileTypeResolver * ftr_acc = FileRef::addFileTypeResolver( new VLCTagLib::ExtResolver<MPEG::File>(".aac") );
#endif
- FileRef::addFileTypeResolver( new VLCTagLib::ExtResolver<MP4::File>(".m4v") );
+ static FileTypeResolver * ftr_m4v = FileRef::addFileTypeResolver( new VLCTagLib::ExtResolver<MP4::File>(".m4v") );
+
+ VLC_UNUSED(ftr_acc);
+ VLC_UNUSED(ftr_m4v);
#if defined(_WIN32)
wchar_t *wpath = ToWide( psz_path );</code></pre>
<p>This would effectivelly only invoke the functions once each, instead of every time <code>ReadMeta</code> is called. It is however rather unfortunate that a variable declared static of course must have a name, which is why <code>VLC_UNUSED</code> should be used to silence warnings from the compiler.</p>
<p>Alternatives:</p>
<ul>
<li><p>move the initialization of <code>ftr_acc</code> and <code>ftr_m4v</code> to a separate function (preferrably a lambda in C++11), and then use the invocation of this function as the initializer for a static variable (so that we only have one "unused" variable within the scope of <code>ReadMeta</code>), or together with <code>std::call_once</code> (c++11).</p></li>
<li><p>Declare <code>ftr_acc</code> and <code>ftr_m4v</code> as (<code>static</code>) in the global namespace, and introduce code such as:</p>
<pre><code>if (!ftr_acc) ftr_acc = FileRef::addFileTypeResolver (...)</code></pre></li>
</ul>
<p>On 16/02/19 13:45, Hannes Domani wrote:</p>
<blockquote>
<p>Hello</p>
<blockquote>
<p>@@ -719,9 +738,11 @@ static int ReadMeta( vlc_object_t* p_this) return VLC_EGENERIC;</p>
<p>#if TAGLIB_VERSION >= TAGLIB_SYNCDECODE_FIXED_VERSION - FileRef::addFileTypeResolver( new VLCTagLib::FileAAC ); + FileRef::addFileTypeResolver( new VLCTagLib::ExtResolver<MPEG::File>(".aac") ); #endif</p>
<ul>
<li><pre><code>FileRef::addFileTypeResolver( new VLCTagLib::ExtResolver<MP4::File>(".m4v") );</code></pre></li>
<li>#if defined(_WIN32) wchar_t *wpath = ToWide( psz_path ); if( wpath == NULL )</li>
</ul>
</blockquote>
<p>Now on every call to ReadMeta() these VLCTagLib::ExtResolver instances are added to a static list, and they are never deleted. Is there a way so this is only done once (and maybe delete them at the end)?</p>
<p>Regards Domani Hannes _______________________________________________ vlc-devel mailing list To unsubscribe or modify your subscription options: https://mailman.videolan.org/listinfo/vlc-devel</p>
</blockquote>
<p>-- :: Filip Roséen :: +33.768663126 :: +46.701448424 :: filip@atch.se</p>