[vlc-commits] demux: mp4: add support for XiphQt flac
Francois Cartegnie
git at videolan.org
Sat May 21 14:41:53 CEST 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat May 21 14:37:15 2016 +0200| [7871318c1e96f4673f6d557affd4427782a4a0cf] | committer: Francois Cartegnie
demux: mp4: add support for XiphQt flac
Untested.
Should be sufficient the way it worked
with vorbis (see xiphqt's decoder).
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7871318c1e96f4673f6d557affd4427782a4a0cf
---
modules/demux/mp4/essetup.c | 21 +++++++++++++++++++++
modules/demux/mp4/libmp4.c | 2 ++
modules/demux/mp4/libmp4.h | 2 ++
3 files changed, 25 insertions(+)
diff --git a/modules/demux/mp4/essetup.c b/modules/demux/mp4/essetup.c
index f9291f8..fab56d3 100644
--- a/modules/demux/mp4/essetup.c
+++ b/modules/demux/mp4/essetup.c
@@ -784,6 +784,27 @@ int SetupAudioES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
}
break;
}
+ case ATOM_XiFL:
+ {
+ const MP4_Box_t *p_fCtS = MP4_BoxGet( p_sample, "wave/fCtS" ); /* kCookieTypeFLACStreaminfo */
+ if( p_fCtS && p_fCtS->data.p_binary )
+ {
+ size_t i_extra = 8 + p_fCtS->data.p_binary->i_blob;
+ uint8_t *p_extra = malloc(i_extra);
+ if( p_extra )
+ {
+ p_track->fmt.i_extra = i_extra;
+ p_track->fmt.p_extra = p_extra;
+ memcpy( p_extra, "fLaC", 4 );
+ SetDWBE( &p_extra[4], p_fCtS->data.p_binary->i_blob ); /* want the lowest 24bits */
+ p_extra[4] = 0x80; /* 0x80 Last metablock | 0x00 StreamInfo */
+ memcpy( &p_extra[8], p_fCtS->data.p_binary->p_blob, p_fCtS->data.p_binary->i_blob );
+
+ p_track->fmt.i_codec = VLC_CODEC_FLAC;
+ p_track->fmt.b_packetized = false;
+ }
+ }
+ }
case( ATOM_eac3 ):
{
const MP4_Box_t *p_dec3 = MP4_BoxGet( p_sample, "dec3", 0 );
diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 017712c8..f25d426 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -3919,6 +3919,7 @@ static const struct
{ ATOM_wave, MP4_ReadBoxContainer, ATOM_fl64 },
{ ATOM_wave, MP4_ReadBoxContainer, ATOM_QDMC },
{ ATOM_wave, MP4_ReadBoxContainer, ATOM_QDM2 },
+ { ATOM_wave, MP4_ReadBoxContainer, ATOM_XiFL }, /* XiphQT */
{ ATOM_wave, MP4_ReadBoxContainer, ATOM_XiVs }, /* XiphQT */
{ ATOM_ilst, MP4_ReadBox_ilst, ATOM_meta },
{ ATOM_mvex, MP4_ReadBoxContainer, ATOM_moov },
@@ -3981,6 +3982,7 @@ static const struct
{ ATOM_vCtH, MP4_ReadBox_Binary, ATOM_wave },
{ ATOM_vCtC, MP4_ReadBox_Binary, ATOM_wave },
{ ATOM_vCtd, MP4_ReadBox_Binary, ATOM_wave },
+ { ATOM_fCtS, MP4_ReadBox_Binary, ATOM_wave },
/* Samples groups specific information */
{ ATOM_sbgp, MP4_ReadBox_sbgp, ATOM_stbl },
diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index d1e987b..482cd54 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -155,6 +155,7 @@ typedef int64_t stime_t;
#define ATOM_sowt VLC_FOURCC( 's', 'o', 'w', 't' )
#define ATOM_QDMC VLC_FOURCC( 'Q', 'D', 'M', 'C' )
#define ATOM_QDM2 VLC_FOURCC( 'Q', 'D', 'M', '2' )
+#define ATOM_XiFL VLC_FOURCC( 'X', 'i', 'F', 'L' )
#define ATOM_XiVs VLC_FOURCC( 'X', 'i', 'V', 's' )
#define ATOM_ima4 VLC_FOURCC( 'i', 'm', 'a', '4' )
#define ATOM_IMA4 VLC_FOURCC( 'I', 'M', 'A', '4' )
@@ -188,6 +189,7 @@ typedef int64_t stime_t;
#define ATOM_Opus VLC_FOURCC( 'O', 'p', 'u', 's' )
/* XiphQT */
+#define ATOM_fCtS VLC_FOURCC( 'f', 'C', 't', 'S' )
#define ATOM_vCtH VLC_FOURCC( 'v', 'C', 't', 'H' )
#define ATOM_vCtC VLC_FOURCC( 'v', 'C', 't', 'C' )
#define ATOM_vCtd VLC_FOURCC( 'v', 'C', 't', '#' )
More information about the vlc-commits
mailing list