taglib: Always use IOStream to read the media
authorSteve Lhomme <robux4@ycbcr.xyz>
Mon, 16 Sep 2024 11:21:17 +0000 (13:21 +0200)
committerSebastian Ramacher <sramacher@debian.org>
Tue, 21 Jan 2025 18:02:47 +0000 (19:02 +0100)
(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

index bec6838fa020fc8f089c6782009495c15cf1f578..adf3a244ddc9724dfd0c653ba7eb0285b7ce6169 100644 (file)
@@ -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;