[vlc-commits] Move xiph metadata parsing to a .c|.h files couple

Jean-Baptiste Kempf git at videolan.org
Sun May 5 20:28:57 CEST 2013


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun May  5 20:19:44 2013 +0200| [0ba90548ce81bdf395bb75b2ce8cc77dd87b9ff0] | committer: Jean-Baptiste Kempf

Move xiph metadata parsing to a .c|.h files couple

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

 modules/demux/Modules.am                    |    4 +-
 modules/demux/flac.c                        |    2 +-
 modules/demux/ogg.c                         |    2 +-
 modules/demux/{vorbis.h => xiph_metadata.c} |   41 ++++-----------
 modules/demux/xiph_metadata.h               |   75 +++++++++++++++++++++++++++
 modules/meta_engine/Modules.am              |    2 +-
 modules/meta_engine/taglib.cpp              |    2 +-
 7 files changed, 90 insertions(+), 38 deletions(-)

diff --git a/modules/demux/Modules.am b/modules/demux/Modules.am
index b52c988..bcd01c6 100644
--- a/modules/demux/Modules.am
+++ b/modules/demux/Modules.am
@@ -1,5 +1,5 @@
-SOURCES_flacsys = flac.c
-SOURCES_ogg = ogg.c ogg.h oggseek.c oggseek.h vorbis.h xiph.h
+SOURCES_flacsys = flac.c xiph_metadata.h xiph_metadata.c
+SOURCES_ogg = ogg.c ogg.h oggseek.c oggseek.h xiph_metadata.h xiph.h xiph_metadata.c
 SOURCES_demuxdump = demuxdump.c
 SOURCES_rawdv = rawdv.c rawdv.h
 SOURCES_rawvid = rawvid.c
diff --git a/modules/demux/flac.c b/modules/demux/flac.c
index 2c16272..2740f96 100644
--- a/modules/demux/flac.c
+++ b/modules/demux/flac.c
@@ -38,7 +38,7 @@
 #include <vlc_charset.h>              /* EnsureUTF8 */
 
 #include <assert.h>
-#include "vorbis.h"                   /* vorbis comments */
+#include "xiph_metadata.h"            /* vorbis comments */
 
 /*****************************************************************************
  * Module descriptor
diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index 40f7161..b5750c3 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -40,7 +40,7 @@
 #include <vlc_codecs.h>
 #include <vlc_bits.h>
 #include "xiph.h"
-#include "vorbis.h"
+#include "xiph_metadata.h"
 #include "ogg.h"
 #include "oggseek.h"
 
diff --git a/modules/demux/vorbis.h b/modules/demux/xiph_metadata.c
similarity index 89%
rename from modules/demux/vorbis.h
rename to modules/demux/xiph_metadata.c
index 379bd95..75bf95b 100644
--- a/modules/demux/vorbis.h
+++ b/modules/demux/xiph_metadata.c
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * vorbis.h: Vorbis Comment parser
+ * xiph_metadata.h: Vorbis Comment parser
  *****************************************************************************
  * Copyright © 2008-2013 VLC authors and VideoLAN
  * $Id$
@@ -22,11 +22,17 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
 #include <vlc_charset.h>
 #include <vlc_strings.h>
 #include <vlc_input.h>
+#include "xiph_metadata.h"
 
-static input_attachment_t* ParseFlacPicture( const uint8_t *p_data, int i_data,
+input_attachment_t* ParseFlacPicture( const uint8_t *p_data, int i_data,
     int i_attachments, int *i_cover_score, int *i_cover_idx )
 {
     /* TODO: Merge with ID3v2 copy in modules/meta_engine/taglib.cpp. */
@@ -106,7 +112,7 @@ error:
     return p_attachment;
 }
 
-static inline void vorbis_ParseComment( vlc_meta_t **pp_meta,
+void vorbis_ParseComment( vlc_meta_t **pp_meta,
         const uint8_t *p_data, int i_data,
         int *i_attachments, input_attachment_t ***attachments,
         int *i_cover_score, int *i_cover_idx,
@@ -266,35 +272,6 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta,
 #undef RM
 }
 
-static const struct {
-  const char *psz_tag;
-  const char *psz_i18n;
-} Katei18nCategories[] = {
-    /* From Silvia's Mozilla list */
-    { "CC",      N_("Closed captions") },
-    { "SUB",     N_("Subtitles") },
-    { "TAD",     N_("Textual audio descriptions") },
-    { "KTV",     N_("Karaoke") },
-    { "TIK",     N_("Ticker text") },
-    { "AR",      N_("Active regions") },
-    { "NB",      N_("Semantic annotations") },
-    { "META",    N_("Metadata") },
-    { "TRX",     N_("Transcript") },
-    { "LRC",     N_("Lyrics") },
-    { "LIN",     N_("Linguistic markup") },
-    { "CUE",     N_("Cue points") },
-
-    /* Grandfathered */
-    { "subtitles", N_("Subtitles") },
-    { "spu-subtitles", N_("Subtitles (images)") },
-    { "lyrics", N_("Lyrics") },
-
-    /* Kate specific */
-    { "K-SPU", N_("Subtitles (images)") },
-    { "K-SLD-T", N_("Slides (text)") },
-    { "K-SLD-I", N_("Slides (images)") },
-};
-
 const char *FindKateCategoryName( const char *psz_tag )
 {
     for( size_t i = 0; i < sizeof(Katei18nCategories)/sizeof(Katei18nCategories[0]); i++ )
diff --git a/modules/demux/xiph_metadata.h b/modules/demux/xiph_metadata.h
new file mode 100644
index 0000000..de97c2b
--- /dev/null
+++ b/modules/demux/xiph_metadata.h
@@ -0,0 +1,75 @@
+/*****************************************************************************
+ * xiph_metadata.h: Vorbis Comment parser
+ *****************************************************************************
+ * Copyright © 2008-2013 VLC authors and VideoLAN
+ * $Id$
+ *
+ * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
+ *          Jean-Baptiste Kempf <jb at videolan.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#include <vlc_charset.h>
+#include <vlc_strings.h>
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+input_attachment_t* ParseFlacPicture( const uint8_t *p_data, int i_data,
+    int i_attachments, int *i_cover_score, int *i_cover_idx );
+
+void vorbis_ParseComment( vlc_meta_t **pp_meta,
+        const uint8_t *p_data, int i_data,
+        int *i_attachments, input_attachment_t ***attachments,
+        int *i_cover_score, int *i_cover_idx,
+        int *i_seekpoint, seekpoint_t ***ppp_seekpoint );
+
+static const struct {
+  const char *psz_tag;
+  const char *psz_i18n;
+} Katei18nCategories[] = {
+    /* From Silvia's Mozilla list */
+    { "CC",      N_("Closed captions") },
+    { "SUB",     N_("Subtitles") },
+    { "TAD",     N_("Textual audio descriptions") },
+    { "KTV",     N_("Karaoke") },
+    { "TIK",     N_("Ticker text") },
+    { "AR",      N_("Active regions") },
+    { "NB",      N_("Semantic annotations") },
+    { "META",    N_("Metadata") },
+    { "TRX",     N_("Transcript") },
+    { "LRC",     N_("Lyrics") },
+    { "LIN",     N_("Linguistic markup") },
+    { "CUE",     N_("Cue points") },
+
+    /* Grandfathered */
+    { "subtitles", N_("Subtitles") },
+    { "spu-subtitles", N_("Subtitles (images)") },
+    { "lyrics", N_("Lyrics") },
+
+    /* Kate specific */
+    { "K-SPU", N_("Subtitles (images)") },
+    { "K-SLD-T", N_("Slides (text)") },
+    { "K-SLD-I", N_("Slides (images)") },
+};
+
+const char *FindKateCategoryName( const char *psz_tag );
+
+# ifdef __cplusplus
+}
+# endif
+
diff --git a/modules/meta_engine/Modules.am b/modules/meta_engine/Modules.am
index f9fdcf1..b9fd775 100644
--- a/modules/meta_engine/Modules.am
+++ b/modules/meta_engine/Modules.am
@@ -1,5 +1,5 @@
 SOURCES_folder = folder.c
-SOURCES_taglib = taglib.cpp
+SOURCES_taglib = taglib.cpp ../demux/xiph_metadata.h ../demux/xiph_metadata.c
 
 libvlc_LTLIBRARIES += \
 	libfolder_plugin.la
diff --git a/modules/meta_engine/taglib.cpp b/modules/meta_engine/taglib.cpp
index 76c8785..8867514 100644
--- a/modules/meta_engine/taglib.cpp
+++ b/modules/meta_engine/taglib.cpp
@@ -75,7 +75,7 @@
 #include <mpegfile.h>
 #include <oggfile.h>
 #include <oggflacfile.h>
-#include "../demux/vorbis.h"
+#include "../demux/xiph_metadata.h"
 
 #include <aifffile.h>
 #include <wavfile.h>



More information about the vlc-commits mailing list