From bb6ac6410ec00f1d3cd93a8dbf33a9381dea33e6 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Mon, 16 Sep 2024 13:21:17 +0200 Subject: [PATCH] taglib: Always use IOStream to read the media (cherry picked from commit 4bc7607f31f80264b5e61fbd187f2f8d2f3bb604) (edited) edited: - keep the support for taglib older than 1.11 which doesn't have the proper FileRef constructor to use it - the aacresolver is only called for Taglib 1.11+ on 3.0 - 4.0 doesn't make a difference for UWP or regular Windows Gbp-Pq: Name 0035-taglib-Always-use-IOStream-to-read-the-media.patch --- modules/meta_engine/taglib.cpp | 35 +++++++++------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/modules/meta_engine/taglib.cpp b/modules/meta_engine/taglib.cpp index bec6838f..adf3a244 100644 --- a/modules/meta_engine/taglib.cpp +++ b/modules/meta_engine/taglib.cpp @@ -891,15 +891,15 @@ static int ReadMeta( vlc_object_t* p_this) if( unlikely(psz_uri == NULL) ) return VLC_ENOMEM; - char *psz_path = vlc_uri2path( psz_uri ); -#if VLC_WINSTORE_APP && TAGLIB_VERSION >= TAGLIB_VERSION_1_11 - if( psz_path == NULL ) + if( !b_extensions_registered ) { - free( psz_uri ); - return VLC_EGENERIC; +#if TAGLIB_VERSION >= TAGLIB_VERSION_1_11 + FileRef::addFileTypeResolver( &aacresolver ); +#endif + b_extensions_registered = true; } - free( psz_path ); +#if TAGLIB_VERSION >= TAGLIB_VERSION_1_11 stream_t *p_stream = vlc_access_NewMRL( p_this, psz_uri ); free( psz_uri ); if( p_stream == NULL ) @@ -907,19 +907,12 @@ static int ReadMeta( vlc_object_t* p_this) VlcIostream s( p_stream ); f = FileRef( &s ); -#else /* VLC_WINSTORE_APP */ +#else // !TAGLIB_VERSION_1_11 + char *psz_path = vlc_uri2path( psz_uri ); free( psz_uri ); if( psz_path == NULL ) return VLC_EGENERIC; - if( !b_extensions_registered ) - { -#if TAGLIB_VERSION >= TAGLIB_VERSION_1_11 - FileRef::addFileTypeResolver( &aacresolver ); -#endif - b_extensions_registered = true; - } - #if defined(_WIN32) wchar_t *wpath = ToWide( psz_path ); if( wpath == NULL ) @@ -927,23 +920,13 @@ static int ReadMeta( vlc_object_t* p_this) free( psz_path ); return VLC_EGENERIC; } -#if TAGLIB_VERSION >= TAGLIB_VERSION_1_11 - FileStream stream( wpath, true ); - f = FileRef( &stream ); -#else /* TAGLIB_VERSION */ f = FileRef( wpath ); -#endif /* TAGLIB_VERSION */ free( wpath ); #else /* _WIN32 */ -#if TAGLIB_VERSION >= TAGLIB_VERSION_1_11 - FileStream stream( psz_path, true ); - f = FileRef( &stream ); -#else /* TAGLIB_VERSION */ f = FileRef( psz_path ); -#endif /* TAGLIB_VERSION */ #endif /* _WIN32 */ free( psz_path ); -#endif /* VLC_WINSTORE_APP */ +#endif // !TAGLIB_VERSION_1_11 if( f.isNull() ) return VLC_EGENERIC; -- 2.30.2