Commit b4dc61ce authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Support VC-1 in mp4, as muxed by L-Smash

We will get more and more of those samples soon...
parent f325462b
...@@ -1361,6 +1361,33 @@ static int MP4_ReadBox_dac3( stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -1361,6 +1361,33 @@ static int MP4_ReadBox_dac3( stream_t *p_stream, MP4_Box_t *p_box )
MP4_READBOX_EXIT( 1 ); MP4_READBOX_EXIT( 1 );
} }
static int MP4_ReadBox_dvc1( stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_Box_data_dvc1_t *p_dvc1;
MP4_READBOX_ENTER( MP4_Box_data_dvc1_t );
p_dvc1 = p_box->data.p_dvc1;
MP4_GET1BYTE( p_dvc1->i_profile_level ); /* profile is on 4bits, level 3bits */
p_dvc1->i_vc1 = p_box->i_size - 7; /* Header + profile_level */
if( p_dvc1->i_vc1 > 0 )
{
uint8_t *p = p_dvc1->p_vc1 = malloc( p_dvc1->i_vc1 );
if( p )
memcpy( p, p_peek, i_read );
}
#ifdef MP4_VERBOSE
msg_Dbg( p_stream,
"read box: \"dvc1\" profile=0x%x level=0x%x",
p_dvc1->i_profile_level & 0xf0 >> 4, p_dvc1->i_profile_level & 0xe > 1 );
#endif
MP4_READBOX_EXIT( 1 );
}
static int MP4_ReadBox_enda( stream_t *p_stream, MP4_Box_t *p_box ) static int MP4_ReadBox_enda( stream_t *p_stream, MP4_Box_t *p_box )
{ {
MP4_Box_data_enda_t *p_enda; MP4_Box_data_enda_t *p_enda;
...@@ -3063,6 +3090,7 @@ static const struct ...@@ -3063,6 +3090,7 @@ static const struct
{ ATOM_cmvd, MP4_ReadBox_cmvd, MP4_FreeBox_cmvd }, { ATOM_cmvd, MP4_ReadBox_cmvd, MP4_FreeBox_cmvd },
{ ATOM_avcC, MP4_ReadBox_avcC, MP4_FreeBox_avcC }, { ATOM_avcC, MP4_ReadBox_avcC, MP4_FreeBox_avcC },
{ ATOM_dac3, MP4_ReadBox_dac3, MP4_FreeBox_Common }, { ATOM_dac3, MP4_ReadBox_dac3, MP4_FreeBox_Common },
{ ATOM_dvc1, MP4_ReadBox_dvc1, MP4_FreeBox_Common },
{ ATOM_enda, MP4_ReadBox_enda, MP4_FreeBox_Common }, { ATOM_enda, MP4_ReadBox_enda, MP4_FreeBox_Common },
{ ATOM_gnre, MP4_ReadBox_gnre, MP4_FreeBox_Common }, { ATOM_gnre, MP4_ReadBox_gnre, MP4_FreeBox_Common },
{ ATOM_trkn, MP4_ReadBox_trkn, MP4_FreeBox_Common }, { ATOM_trkn, MP4_ReadBox_trkn, MP4_FreeBox_Common },
......
...@@ -130,6 +130,7 @@ ...@@ -130,6 +130,7 @@
#define ATOM_alac VLC_FOURCC( 'a', 'l', 'a', 'c' ) #define ATOM_alac VLC_FOURCC( 'a', 'l', 'a', 'c' )
#define ATOM_dac3 VLC_FOURCC( 'd', 'a', 'c', '3' ) #define ATOM_dac3 VLC_FOURCC( 'd', 'a', 'c', '3' )
#define ATOM_dec3 VLC_FOURCC( 'd', 'e', 'c', '3' ) #define ATOM_dec3 VLC_FOURCC( 'd', 'e', 'c', '3' )
#define ATOM_dvc1 VLC_FOURCC( 'd', 'v', 'c', '1' )
#define ATOM_enda VLC_FOURCC( 'e', 'n', 'd', 'a' ) #define ATOM_enda VLC_FOURCC( 'e', 'n', 'd', 'a' )
#define ATOM_gnre VLC_FOURCC( 'g', 'n', 'r', 'e' ) #define ATOM_gnre VLC_FOURCC( 'g', 'n', 'r', 'e' )
#define ATOM_trkn VLC_FOURCC( 't', 'r', 'k', 'n' ) #define ATOM_trkn VLC_FOURCC( 't', 'r', 'k', 'n' )
...@@ -1007,6 +1008,15 @@ typedef struct ...@@ -1007,6 +1008,15 @@ typedef struct
} MP4_Box_data_dac3_t; } MP4_Box_data_dac3_t;
typedef struct
{
uint8_t i_profile_level;
int i_vc1;
uint8_t *p_vc1;
} MP4_Box_data_dvc1_t;
typedef struct typedef struct
{ {
uint16_t i_little_endian; uint16_t i_little_endian;
...@@ -1139,6 +1149,7 @@ typedef union MP4_Box_data_s ...@@ -1139,6 +1149,7 @@ typedef union MP4_Box_data_s
MP4_Box_data_esds_t *p_esds; MP4_Box_data_esds_t *p_esds;
MP4_Box_data_avcC_t *p_avcC; MP4_Box_data_avcC_t *p_avcC;
MP4_Box_data_dac3_t *p_dac3; MP4_Box_data_dac3_t *p_dac3;
MP4_Box_data_dvc1_t *p_dvc1;
MP4_Box_data_enda_t *p_enda; MP4_Box_data_enda_t *p_enda;
MP4_Box_data_gnre_t *p_gnre; MP4_Box_data_gnre_t *p_gnre;
MP4_Box_data_trkn_t *p_trkn; MP4_Box_data_trkn_t *p_trkn;
......
...@@ -1898,7 +1898,7 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track, ...@@ -1898,7 +1898,7 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
p_track->fmt.i_codec = VLC_FOURCC( 'M','J','2','C' ); p_track->fmt.i_codec = VLC_FOURCC( 'M','J','2','C' );
break; break;
case( 0xa3 ): /* vc1 */ case( 0xa3 ): /* vc1 */
p_track->fmt.i_codec = VLC_FOURCC( 'W','V','C','1' ); p_track->fmt.i_codec = VLC_CODEC_VC1;
break; break;
case( 0xa4 ): case( 0xa4 ):
p_track->fmt.i_codec = VLC_CODEC_DIRAC; p_track->fmt.i_codec = VLC_CODEC_DIRAC;
...@@ -2012,6 +2012,26 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track, ...@@ -2012,6 +2012,26 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
} }
break; break;
case VLC_FOURCC( 'v', 'c', '-', '1' ):
{
MP4_Box_t *p_dvc1 = MP4_BoxGet( p_sample, "dvc1" );
if( p_dvc1 )
{
p_track->fmt.i_extra = p_dvc1->data.p_dvc1->i_vc1;
if( p_track->fmt.i_extra > 0 )
{
p_track->fmt.p_extra = malloc( p_dvc1->data.p_dvc1->i_vc1 );
memcpy( p_track->fmt.p_extra, p_dvc1->data.p_dvc1->p_vc1,
p_track->fmt.i_extra );
}
}
else
{
msg_Err( p_demux, "missing dvc1" );
}
break;
}
/* avc1: send avcC (h264 without annexe B, ie without start code)*/ /* avc1: send avcC (h264 without annexe B, ie without start code)*/
case VLC_FOURCC( 'a', 'v', 'c', '1' ): case VLC_FOURCC( 'a', 'v', 'c', '1' ):
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment