[vlc-commits] [Git][videolan/vlc][3.0.x] demux: mp4: add support for ISO/IEC 23003-5 audio
Hugo Beauzée-Luyssen (@chouquette)
gitlab at videolan.org
Fri Jan 7 12:22:52 UTC 2022
Hugo Beauzée-Luyssen pushed to branch 3.0.x at VideoLAN / VLC
Commits:
80742f9a by Francois Cartegnie at 2022-01-07T10:57:26+00:00
demux: mp4: add support for ISO/IEC 23003-5 audio
refs #26427
(cherry picked from commit c8d319ed0f7df205ac5d278119e2819f7653549b)
- - - - -
3 changed files:
- modules/demux/mp4/essetup.c
- modules/demux/mp4/libmp4.c
- modules/demux/mp4/libmp4.h
Changes:
=====================================
modules/demux/mp4/essetup.c
=====================================
@@ -1033,6 +1033,35 @@ int SetupAudioES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
break;
}
+ case ATOM_ipcm:
+ case ATOM_fpcm:
+ {
+ const MP4_Box_t *p_pcmC = MP4_BoxGet( p_sample, "pcmC" );
+ if( p_pcmC )
+ {
+ const vlc_fourcc_t lookup = p_sample->i_type +
+ BOXDATA(p_pcmC)->i_sample_size +
+ (BOXDATA(p_pcmC)->i_format_flags & 0x01);
+ const vlc_fourcc_t lookuptable[10][2] =
+ {
+ { ATOM_fpcm + 32 + 0, VLC_CODEC_F32B },
+ { ATOM_fpcm + 32 + 1, VLC_CODEC_F32L },
+ { ATOM_fpcm + 64 + 0, VLC_CODEC_F64B },
+ { ATOM_fpcm + 64 + 1, VLC_CODEC_F64L },
+ { ATOM_ipcm + 16 + 0, VLC_CODEC_S16B },
+ { ATOM_ipcm + 16 + 1, VLC_CODEC_S16L },
+ { ATOM_ipcm + 24 + 0, VLC_CODEC_S24B },
+ { ATOM_ipcm + 24 + 1, VLC_CODEC_S24L },
+ { ATOM_ipcm + 32 + 0, VLC_CODEC_S32B },
+ { ATOM_ipcm + 32 + 1, VLC_CODEC_S32L },
+ };
+ for( size_t i = 0; i<10; i++ )
+ if( lookuptable[i][0] == lookup )
+ p_track->fmt.i_codec = lookuptable[i][1];
+ }
+ break;
+ }
+
case ATOM_in24:
p_track->fmt.i_codec = p_enda && BOXDATA(p_enda)->i_little_endian == 1 ?
VLC_CODEC_S24L : VLC_CODEC_S24B;
=====================================
modules/demux/mp4/libmp4.c
=====================================
@@ -2560,6 +2560,20 @@ static int MP4_ReadBox_enda( stream_t *p_stream, MP4_Box_t *p_box )
MP4_READBOX_EXIT( 1 );
}
+static int MP4_ReadBox_pcmC( stream_t *p_stream, MP4_Box_t *p_box )
+{
+ MP4_READBOX_ENTER( MP4_Box_data_pcmC_t, NULL );
+ if(i_read != 6)
+ MP4_READBOX_EXIT( 0 );
+ uint32_t temp;
+ MP4_GET4BYTES(temp);
+ if(temp != 0) /* support only v0 */
+ MP4_READBOX_EXIT( 0 );
+ MP4_GET1BYTE(p_box->data.p_pcmC->i_format_flags);
+ MP4_GET1BYTE(p_box->data.p_pcmC->i_sample_size);
+ MP4_READBOX_EXIT( 1 );
+}
+
static void MP4_FreeBox_sample_soun( MP4_Box_t *p_box )
{
FREENULL( p_box->data.p_sample_soun->p_qt_description );
@@ -4562,6 +4576,7 @@ static const struct
{ ATOM_fiel, MP4_ReadBox_fiel, 0 },
{ ATOM_glbl, MP4_ReadBox_Binary, ATOM_FFV1 },
{ ATOM_enda, MP4_ReadBox_enda, 0 },
+ { ATOM_pcmC, MP4_ReadBox_pcmC, 0 }, /* ISO-IEC 23003-5 */
{ ATOM_iods, MP4_ReadBox_iods, 0 },
{ ATOM_pasp, MP4_ReadBox_pasp, 0 },
{ ATOM_btrt, MP4_ReadBox_btrt, 0 }, /* codecs bitrate stsd/????/btrt */
=====================================
modules/demux/mp4/libmp4.h
=====================================
@@ -204,6 +204,11 @@ typedef int64_t stime_t;
#define ATOM_fLaC VLC_FOURCC( 'f', 'L', 'a', 'C' )
#define ATOM_dfLa VLC_FOURCC( 'd', 'f', 'L', 'a' )
+/* ISO-IEC 23003-5 */
+#define ATOM_fpcm VLC_FOURCC( 'f', 'p', 'c', 'm' )
+#define ATOM_ipcm VLC_FOURCC( 'i', 'p', 'c', 'm' )
+#define ATOM_pcmC VLC_FOURCC( 'p', 'c', 'm', 'C' )
+
/* XiphQT */
#define ATOM_fCtS VLC_FOURCC( 'f', 'C', 't', 'S' )
#define ATOM_vCtH VLC_FOURCC( 'v', 'C', 't', 'H' )
@@ -1476,6 +1481,12 @@ typedef struct
} MP4_Box_data_enda_t;
+typedef struct
+{
+ uint8_t i_format_flags;
+ uint8_t i_sample_size;
+} MP4_Box_data_pcmC_t;
+
typedef struct
{
uint32_t i_entry_count;
@@ -1703,6 +1714,7 @@ typedef union MP4_Box_data_s
MP4_Box_data_fiel_t *p_fiel;
MP4_Box_data_chan_t *p_chan;
MP4_Box_data_enda_t *p_enda;
+ MP4_Box_data_pcmC_t *p_pcmC;
MP4_Box_data_keys_t *p_keys;
MP4_Box_data_iods_t *p_iods;
MP4_Box_data_btrt_t *p_btrt;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/80742f9ad2ee6b0ee58f574be1e5b973e8d559e1
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/80742f9ad2ee6b0ee58f574be1e5b973e8d559e1
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list