[vlc-commits] demux: mp4: use struct for coreaudio layout params
Francois Cartegnie
git at videolan.org
Wed Dec 19 15:14:21 CET 2018
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Dec 19 14:46:22 2018 +0100| [8e5f16a8a7d2778a3a20074a986d657921a51052] | committer: Francois Cartegnie
demux: mp4: use struct for coreaudio layout params
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8e5f16a8a7d2778a3a20074a986d657921a51052
---
modules/demux/mp4/coreaudio.h | 22 ++++++++++++++++++++--
modules/demux/mp4/essetup.c | 2 +-
modules/demux/mp4/libmp4.c | 2 +-
modules/demux/mp4/libmp4.h | 13 +------------
4 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/modules/demux/mp4/coreaudio.h b/modules/demux/mp4/coreaudio.h
index 80e777bc62..1922d1e6a8 100644
--- a/modules/demux/mp4/coreaudio.h
+++ b/modules/demux/mp4/coreaudio.h
@@ -19,6 +19,24 @@
*****************************************************************************/
#include <vlc_aout.h>
+struct CoreAudio_layout_s
+{
+ uint32_t i_channels_layout_tag;
+ uint32_t i_channels_bitmap;
+ uint32_t i_channels_description_count;
+ struct
+ {
+ uint32_t i_channel_label;
+ uint32_t i_channel_flags;
+ float f_coordinates[3];
+ } *p_descriptions;
+};
+
+static inline void CoreAudio_Layout_Clean(struct CoreAudio_layout_s *c)
+{
+ free( c->p_descriptions );
+}
+
/* According to Apple's CoreAudio_Bitmap/CoreAudio_BitmapTypes.h */
enum
{
@@ -83,7 +101,7 @@ enum CoreAudio_Layout
CoreAudio_Layout_BITMAP = (1<<16),
};
-static inline int CoreAudio_Bitmap_to_vlc_bitmap( uint32_t i_corebitmap,
+static inline int CoreAudio_Bitmap_to_vlc_bitmap( const struct CoreAudio_layout_s *c,
uint16_t *pi_mapping,
uint8_t *pi_channels,
const uint32_t **pp_chans_order )
@@ -93,7 +111,7 @@ static inline int CoreAudio_Bitmap_to_vlc_bitmap( uint32_t i_corebitmap,
*pi_channels = 0;
for (uint8_t i=0;i<ARRAY_SIZE(CoreAudio_Bitmap_mapping);i++)
{
- if ( CoreAudio_Bitmap_mapping[i].i_bitmap & i_corebitmap )
+ if ( CoreAudio_Bitmap_mapping[i].i_bitmap & c->i_channels_bitmap )
{
if ( (CoreAudio_Bitmap_mapping[i].i_vlc_bitmap & *pi_mapping) ||
*pi_channels >= AOUT_CHAN_MAX )
diff --git a/modules/demux/mp4/essetup.c b/modules/demux/mp4/essetup.c
index d21e1b5a9c..637d2d670c 100644
--- a/modules/demux/mp4/essetup.c
+++ b/modules/demux/mp4/essetup.c
@@ -1188,7 +1188,7 @@ int SetupAudioES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
const uint32_t *p_rg_chans_order = NULL;
if ( BOXDATA(p_chan)->layout.i_channels_layout_tag == CoreAudio_Layout_BITMAP &&
- CoreAudio_Bitmap_to_vlc_bitmap( BOXDATA(p_chan)->layout.i_channels_bitmap,
+ CoreAudio_Bitmap_to_vlc_bitmap( &BOXDATA(p_chan)->layout,
&i_vlc_mapping, &i_channels,
&p_rg_chans_order ) != VLC_SUCCESS )
{
diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index d42a4a0a4e..b2d675a20c 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -2288,7 +2288,7 @@ static int MP4_ReadBox_sgpd( stream_t *p_stream, MP4_Box_t *p_box )
static void MP4_FreeBox_stsdext_chan( MP4_Box_t *p_box )
{
MP4_Box_data_chan_t *p_chan = p_box->data.p_chan;
- free( p_chan->layout.p_descriptions );
+ CoreAudio_Layout_Clean( &p_chan->layout );
}
static int MP4_ReadBox_stsdext_chan( stream_t *p_stream, MP4_Box_t *p_box )
diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index df545c83b2..d1b54be832 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -1379,18 +1379,7 @@ typedef struct
{
uint8_t i_version;
uint32_t i_channels_flags; /* 24 bits */
- struct
- {
- uint32_t i_channels_layout_tag;
- uint32_t i_channels_bitmap;
- uint32_t i_channels_description_count;
- struct
- {
- uint32_t i_channel_label;
- uint32_t i_channel_flags;
- float f_coordinates[3];
- } *p_descriptions;
- } layout;
+ struct CoreAudio_layout_s layout;
} MP4_Box_data_chan_t;
typedef struct
More information about the vlc-commits
mailing list