[vlc-commits] Vorbis: permit to return attachments too

Jean-Baptiste Kempf git at videolan.org
Thu Apr 5 23:02:53 CEST 2012


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Thu Apr  5 22:01:56 2012 +0200| [106127b6dfb0f9701b76250621beffba1cd34cd4] | committer: Jean-Baptiste Kempf

Vorbis: permit to return attachments too

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=106127b6dfb0f9701b76250621beffba1cd34cd4
---

 modules/demux/flac.c   |    2 +-
 modules/demux/ogg.c    |    3 ++-
 modules/demux/vorbis.h |    7 ++++++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/modules/demux/flac.c b/modules/demux/flac.c
index 1919349..6c5755f 100644
--- a/modules/demux/flac.c
+++ b/modules/demux/flac.c
@@ -578,7 +578,7 @@ static void ParseComment( demux_t *p_demux, const uint8_t *p_data, int i_data )
     if( i_data < 4 )
         return;
 
-    vorbis_ParseComment( &p_sys->p_meta, &p_data[4], i_data - 4 );
+    vorbis_ParseComment( &p_sys->p_meta, &p_data[4], i_data - 4, NULL, NULL );
 
 }
 
diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index 2526b09..bb693d1 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -1525,7 +1525,8 @@ static void Ogg_ExtractXiphMeta( demux_t *p_demux, const void *p_headers, unsign
 
     /* TODO how to handle multiple comments properly ? */
     if( i_count >= 2 && pi_size[1] > i_skip )
-        vorbis_ParseComment( &p_ogg->p_meta, (uint8_t*)pp_data[1] + i_skip, pi_size[1] - i_skip );
+        vorbis_ParseComment( &p_ogg->p_meta, (uint8_t*)pp_data[1] + i_skip, pi_size[1] - i_skip,
+                             &p_ogg->i_attachments, &p_ogg->attachments );
 
     for( unsigned i = 0; i < i_count; i++ )
         free( pp_data[i] );
diff --git a/modules/demux/vorbis.h b/modules/demux/vorbis.h
index 949c0bf..e3c07bd 100644
--- a/modules/demux/vorbis.h
+++ b/modules/demux/vorbis.h
@@ -70,7 +70,8 @@ error:
     return p_attachment;
 }
 
-static inline void vorbis_ParseComment( vlc_meta_t **pp_meta, const uint8_t *p_data, int i_data )
+static inline void vorbis_ParseComment( vlc_meta_t **pp_meta, const uint8_t *p_data, int i_data,
+        int *i_attachments, input_attachment_t ***attachments)
 {
     int n;
     int i_comment;
@@ -158,6 +159,9 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta, const uint8_t *p_d
         else IF_EXTRACT("DATE=", Date )
         else if( !strncasecmp( psz, "METADATA_BLOCK_PICTURE=", strlen("METADATA_BLOCK_PICTURE=")))
         {
+            if( attachments == NULL )
+                continue;
+
             int i;
             uint8_t *p_picture;
             size_t i_size = vlc_b64_decode_binary( &p_picture, &psz[strlen("METADATA_BLOCK_PICTURE=")]);
@@ -168,6 +172,7 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta, const uint8_t *p_d
                 snprintf( psz_url, sizeof(psz_url), "attachment://%s", p_attachment->psz_name );
                 vlc_meta_Set( p_meta, vlc_meta_ArtworkURL, psz_url );
                 i_attach++;
+                TAB_APPEND( *i_attachments, *attachments, p_attachment );
             }
         }
         else if( strchr( psz, '=' ) )



More information about the vlc-commits mailing list