[vlc-commits] [Git][videolan/vlc][master] 2 commits: demux: mp4: add proper meta functions declaration header

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Wed Feb 8 21:38:41 UTC 2023



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
71f6abeb by Francois Cartegnie at 2023-02-08T21:20:30+00:00
demux: mp4: add proper meta functions declaration header

- - - - -
0d1874b9 by Francois Cartegnie at 2023-02-08T21:20:30+00:00
demux: mp4: constify meta

- - - - -


5 changed files:

- modules/demux/Makefile.am
- modules/demux/mp4/meta.c
- + modules/demux/mp4/meta.h
- modules/demux/mp4/mp4.c
- modules/demux/mp4/mp4.h


Changes:

=====================================
modules/demux/Makefile.am
=====================================
@@ -215,7 +215,7 @@ libmp4_plugin_la_SOURCES = demux/mp4/mp4.c demux/mp4/mp4.h \
                            demux/mp4/heif.c demux/mp4/heif.h \
                            demux/mp4/avci.h \
                            demux/mp4/essetup.c \
-                           demux/mp4/meta.c \
+                           demux/mp4/meta.c demux/mp4/meta.h \
                            demux/mp4/mpeg4.h \
                            demux/mp4/coreaudio.h \
                            demux/av1_unpack.h \


=====================================
modules/demux/mp4/meta.c
=====================================
@@ -21,13 +21,15 @@
 # include "config.h"
 #endif
 
-#include "mp4.h"
+#include "libmp4.h"
 #include "../../meta_engine/ID3Genres.h"  /* for ATOM_gnre */
 #include "languages.h"
 
 #include <vlc_meta.h>
 #include <vlc_charset.h>
 
+#include "meta.h"
+
 #include "../../meta_engine/ID3Tag.h"
 #include "../../meta_engine/ID3Meta.h"
 
@@ -160,12 +162,12 @@ inline static char * StringConvert( const MP4_Box_data_data_t *p_data )
     }
 }
 
-static char * ExtractString( MP4_Box_t *p_box )
+static char * ExtractString( const MP4_Box_t *p_box )
 {
     if ( p_box->i_type == ATOM_data )
         return StringConvert( p_box->data.p_data );
 
-    MP4_Box_t *p_data = MP4_BoxGet( p_box, "data" );
+    const MP4_Box_t *p_data = MP4_BoxGet( p_box, "data" );
     if ( p_data )
         return StringConvert( BOXDATA(p_data) );
     else if ( p_box->data.p_binary && p_box->data.p_binary->p_blob )
@@ -220,7 +222,7 @@ static bool AtomXA9ToMeta( uint32_t i_type,
     return *meta_type || *meta_key;
 }
 
-static bool SetMeta( vlc_meta_t* p_meta, int i_type, char const* name, MP4_Box_t* p_box )
+static bool SetMeta( vlc_meta_t* p_meta, int i_type, char const* name, const MP4_Box_t* p_box )
 {
     vlc_meta_type_t const* type;
     char const* key;
@@ -244,7 +246,7 @@ static bool SetMeta( vlc_meta_t* p_meta, int i_type, char const* name, MP4_Box_t
     return true;
 }
 
-static int ExtractIntlStrings( vlc_meta_t *p_meta, MP4_Box_t *p_box )
+static int ExtractIntlStrings( vlc_meta_t *p_meta, const MP4_Box_t *p_box )
 {
     if( MP4_BoxGet( p_box, "data" ) )
         return false;
@@ -324,13 +326,13 @@ static int ExtractIntlStrings( vlc_meta_t *p_meta, MP4_Box_t *p_box )
     return i_read == 0;
 }
 
-static void ExtractItunesInfoTriplets( vlc_meta_t *p_meta, MP4_Box_t *p_box )
+static void ExtractItunesInfoTriplets( vlc_meta_t *p_meta, const MP4_Box_t *p_box )
 {
     if( p_box->i_type != ATOM_ITUN )
         return;
-    MP4_Box_t *p_mean = MP4_BoxGet( p_box, "mean" );
-    MP4_Box_t *p_name = MP4_BoxGet( p_box, "name" );
-    MP4_Box_t *p_data = MP4_BoxGet( p_box, "data" );
+    const MP4_Box_t *p_mean = MP4_BoxGet( p_box, "mean" );
+    const MP4_Box_t *p_name = MP4_BoxGet( p_box, "name" );
+    const MP4_Box_t *p_data = MP4_BoxGet( p_box, "data" );
     if( !p_mean || p_mean->data.p_binary->i_blob < 4 + 16 ||
         !p_name || p_name->data.p_binary->i_blob < 5 ||
         !p_data || !BOXDATA(p_data) )
@@ -349,7 +351,7 @@ static void ExtractItunesInfoTriplets( vlc_meta_t *p_meta, MP4_Box_t *p_box )
     }
 }
 
-static void SetupmdirMeta( vlc_meta_t *p_meta, MP4_Box_t *p_box )
+static void SetupmdirMeta( vlc_meta_t *p_meta, const MP4_Box_t *p_box )
 {
     const MP4_Box_t *p_data = MP4_BoxGet( p_box, "data" );
 
@@ -460,7 +462,7 @@ static void SetupmdirMeta( vlc_meta_t *p_meta, MP4_Box_t *p_box )
     }
 }
 
-static void SetupmdtaMeta( vlc_meta_t *p_meta, MP4_Box_t *p_box, MP4_Box_t *p_keys )
+static void SetupmdtaMeta( vlc_meta_t *p_meta, const MP4_Box_t *p_box, const MP4_Box_t *p_keys )
 {
     if ( !p_keys || !BOXDATA(p_keys) || BOXDATA(p_keys)->i_entry_count == 0 )
         return;
@@ -502,7 +504,7 @@ static int ID3TAG_Parse_Handler( uint32_t i_tag, const uint8_t *p_payload,
     return VLC_SUCCESS;
 }
 
-static void SetupID3v2Meta( vlc_meta_t *p_meta, MP4_Box_t *p_box )
+static void SetupID3v2Meta( vlc_meta_t *p_meta, const MP4_Box_t *p_box )
 {
     const MP4_Box_t *p_binary = MP4_BoxGet( p_box, "ID32" );
     if( p_binary == NULL || !BOXDATA(p_binary) || BOXDATA(p_binary)->i_blob < 6 + 20 + 1 )
@@ -519,13 +521,13 @@ void SetupMeta( vlc_meta_t *p_meta, const MP4_Box_t *p_udta )
     if ( p_udta->p_father )
         i_handler = p_udta->i_handler;
 
-    for( MP4_Box_t *p_box = p_udta->p_first; p_box; p_box = p_box->p_next )
+    for( const MP4_Box_t *p_box = p_udta->p_first; p_box; p_box = p_box->p_next )
     {
         switch( i_handler )
         {
             case HANDLER_mdta:
             {
-                MP4_Box_t *p_keys = MP4_BoxGet( p_udta->p_father, "keys" );
+                const MP4_Box_t *p_keys = MP4_BoxGet( p_udta->p_father, "keys" );
                 SetupmdtaMeta( p_meta, p_box, p_keys );
                 break;
             }


=====================================
modules/demux/mp4/meta.h
=====================================
@@ -0,0 +1,25 @@
+/*****************************************************************************
+ * meta.h: mp4 meta handling
+ *****************************************************************************
+ * Copyright (C) 2001-2004, 2010, 2014 VLC authors and VideoLAN
+ *
+ * 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.
+ *****************************************************************************/
+#ifndef VLC_MP4_META_H_
+#define VLC_MP4_META_H_
+
+void SetupMeta( vlc_meta_t *p_meta, const MP4_Box_t *p_udta );
+
+#endif


=====================================
modules/demux/mp4/mp4.c
=====================================
@@ -37,6 +37,7 @@
 #include <vlc_url.h>
 #include <assert.h>
 #include <limits.h>
+#include "meta.h"
 #include "attachments.h"
 #include "heif.h"
 #include "../../codec/cc.h"


=====================================
modules/demux/mp4/mp4.h
=====================================
@@ -196,7 +196,6 @@ int SetupAudioES( demux_t *p_demux, const mp4_track_t *p_track,
                   const MP4_Box_t *p_sample, es_format_t *, track_config_t * );
 int SetupSpuES( demux_t *p_demux, const mp4_track_t *p_track,
                 const MP4_Box_t *p_sample, es_format_t *, track_config_t * );
-void SetupMeta( vlc_meta_t *p_meta, const MP4_Box_t *p_udta );
 
 /* format of RTP reception hint track sample constructor */
 typedef struct



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/20956a81f8a0489eaa3c2e8c028113e3b65ab8d4...0d1874b9bbdd5f65886b2f76356b30cdd30fd864

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/20956a81f8a0489eaa3c2e8c028113e3b65ab8d4...0d1874b9bbdd5f65886b2f76356b30cdd30fd864
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list