[vlc-devel] [PATCH] Add support for INFO tag in wav files

Antoine Huchet antoine+vlc at huchet.me
Thu Mar 21 14:35:49 CET 2019


Hello,

This is an attempt to close https://trac.videolan.org/vlc/ticket/6587

Let me know if I did anything wrong.

Best,
Antoine Huchet

---
 modules/meta_engine/taglib.cpp | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/modules/meta_engine/taglib.cpp b/modules/meta_engine/taglib.cpp
index c04bbd316a..85569c4a08 100644
--- a/modules/meta_engine/taglib.cpp
+++ b/modules/meta_engine/taglib.cpp
@@ -862,17 +862,29 @@ static int ReadMeta( vlc_object_t* p_this)

     if( f.isNull() )
         return VLC_EGENERIC;
-    if( !f.tag() || f.tag()->isEmpty() )
-        return VLC_EGENERIC;
+
+    // Read the tags from the file
+    Tag *p_tag = f.tag();
+
+    if( !p_tag || p_tag->isEmpty() )
+    {
+        if( RIFF::WAV::File* riff_wav =
+                dynamic_cast<RIFF::WAV::File*>(f.file()) )
+        {
+            if( riff_wav->hasInfoTag() )
+                p_tag = riff_wav->InfoTag();
+            else
+                return VLC_EGENERIC;
+        }
+        else
+            return VLC_EGENERIC;
+    }

     p_demux_meta->p_meta = p_meta = vlc_meta_New();
     if( !p_meta )
         return VLC_ENOMEM;


-    // Read the tags from the file
-    Tag* p_tag = f.tag();
-
 #define SET( tag, meta )
       \
     if( !p_tag->tag().isNull() && !p_tag->tag().isEmpty() )
       \
         vlc_meta_Set##meta( p_meta, p_tag->tag().toCString(true) )
-- 
2.19.1





-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190321/5eb796c4/attachment.sig>


More information about the vlc-devel mailing list