Commit 106bf7aa authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

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

We received already complaints/samples by 4 people in the last week-end...
(cherry picked from commit b4dc61ce93b6706c67139dad1259f1a3b788f18c)
(cherry picked from commit ba1316be2521e153593ca75e588b78d5077caec3)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 280369df
......@@ -1259,6 +1259,39 @@ static int MP4_ReadBox_dac3( stream_t *p_stream, MP4_Box_t *p_box )
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 */
if( p_dvc1->i_profile_level & 0xf0 >> 4 != 0x06 )
{
msg_Warn( p_stream, "unsupported VC-1 profile, please report" );
MP4_READBOX_EXIT( 0 );
}
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 )
{
MP4_Box_data_enda_t *p_enda;
......@@ -2908,6 +2941,7 @@ static const struct
{ ATOM_cmvd, MP4_ReadBox_cmvd, MP4_FreeBox_cmvd },
{ ATOM_avcC, MP4_ReadBox_avcC, MP4_FreeBox_avcC },
{ 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_gnre, MP4_ReadBox_gnre, MP4_FreeBox_Common },
{ ATOM_trkn, MP4_ReadBox_trkn, MP4_FreeBox_Common },
......
......@@ -126,6 +126,7 @@
#define ATOM_alac VLC_FOURCC( 'a', 'l', 'a', 'c' )
#define ATOM_dac3 VLC_FOURCC( 'd', 'a', '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_gnre VLC_FOURCC( 'g', 'n', 'r', 'e' )
#define ATOM_trkn VLC_FOURCC( 't', 'r', 'k', 'n' )
......@@ -952,6 +953,15 @@ typedef struct
} 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
{
uint16_t i_little_endian;
......@@ -1056,6 +1066,7 @@ typedef union MP4_Box_data_s
MP4_Box_data_esds_t *p_esds;
MP4_Box_data_avcC_t *p_avcC;
MP4_Box_data_dac3_t *p_dac3;
MP4_Box_data_dvc1_t *p_dvc1;
MP4_Box_data_enda_t *p_enda;
MP4_Box_data_gnre_t *p_gnre;
MP4_Box_data_trkn_t *p_trkn;
......
......@@ -1924,7 +1924,7 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
p_track->fmt.i_codec = VLC_FOURCC( 'M','J','2','C' );
break;
case( 0xa3 ): /* vc1 */
p_track->fmt.i_codec = VLC_FOURCC( 'W','V','C','1' );
p_track->fmt.i_codec = VLC_CODEC_VC1;
break;
case( 0xa4 ):
p_track->fmt.i_codec = VLC_CODEC_DIRAC;
......@@ -2035,6 +2035,26 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
}
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)*/
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