Commit ec6c1502 authored by Laurent Aimar's avatar Laurent Aimar

* mp4: more mov fields are parsed.

parent 1ddde2be
......@@ -2,7 +2,7 @@
* libmp4.c : LibMP4 library for mp4 module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: libmp4.c,v 1.20 2003/04/16 16:32:42 fenrir Exp $
* $Id: libmp4.c,v 1.21 2003/04/22 08:51:27 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -1208,6 +1208,23 @@ int MP4_ReadBox_sample_soun( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
MP4_GET2BYTES( p_box->data.p_sample_soun->i_data_reference_index );
/*
* XXX hack -> produce a copy of the nearly complete chunk
*/
if( i_read > 0 )
{
p_box->data.p_sample_soun->i_qt_description = i_read;
p_box->data.p_sample_soun->p_qt_description = malloc( i_read );
memcpy( p_box->data.p_sample_soun->p_qt_description,
p_peek,
i_read );
}
else
{
p_box->data.p_sample_soun->i_qt_description = 0;
p_box->data.p_sample_soun->p_qt_description = NULL;
}
MP4_GET2BYTES( p_box->data.p_sample_soun->i_qt_version );
MP4_GET2BYTES( p_box->data.p_sample_soun->i_qt_revision_level );
MP4_GET4BYTES( p_box->data.p_sample_soun->i_qt_vendor );
......@@ -1320,28 +1337,44 @@ int MP4_ReadBox_sample_vide( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
MP4_GET2BYTES( p_box->data.p_sample_vide->i_data_reference_index );
MP4_GET2BYTES( p_box->data.p_sample_vide->i_predefined1 );
MP4_GET2BYTES( p_box->data.p_sample_vide->i_reserved2 );
for( i = 0; i < 3 ; i++ )
/*
* XXX hack -> produce a copy of the nearly complete chunk
*/
if( i_read > 0 )
{
p_box->data.p_sample_vide->i_qt_image_description = i_read;
p_box->data.p_sample_vide->p_qt_image_description = malloc( i_read );
memcpy( p_box->data.p_sample_vide->p_qt_image_description,
p_peek,
i_read );
}
else
{
MP4_GET4BYTES( p_box->data.p_sample_vide->i_predefined2[i] );
p_box->data.p_sample_vide->i_qt_image_description = 0;
p_box->data.p_sample_vide->p_qt_image_description = NULL;
}
MP4_GET2BYTES( p_box->data.p_sample_vide->i_qt_version );
MP4_GET2BYTES( p_box->data.p_sample_vide->i_qt_revision_level );
MP4_GET4BYTES( p_box->data.p_sample_vide->i_qt_vendor );
MP4_GET4BYTES( p_box->data.p_sample_vide->i_qt_temporal_quality );
MP4_GET4BYTES( p_box->data.p_sample_vide->i_qt_spatial_quality );
MP4_GET2BYTES( p_box->data.p_sample_vide->i_width );
MP4_GET2BYTES( p_box->data.p_sample_vide->i_height );
MP4_GET4BYTES( p_box->data.p_sample_vide->i_horizresolution );
MP4_GET4BYTES( p_box->data.p_sample_vide->i_vertresolution );
MP4_GET4BYTES( p_box->data.p_sample_vide->i_reserved3 );
MP4_GET2BYTES( p_box->data.p_sample_vide->i_predefined3 );
MP4_GET4BYTES( p_box->data.p_sample_vide->i_qt_data_size );
MP4_GET2BYTES( p_box->data.p_sample_vide->i_qt_frame_count );
memcpy( &p_box->data.p_sample_vide->i_compressorname, p_peek, 32 );
p_peek += 32; i_read -= 32;
MP4_GET2BYTES( p_box->data.p_sample_vide->i_depth );
MP4_GET2BYTES( p_box->data.p_sample_vide->i_predefined4 );
MP4_GET2BYTES( p_box->data.p_sample_vide->i_qt_color_table );
MP4_SeekStream( p_stream, p_box->i_pos + MP4_BOX_HEADERSIZE( p_box ) + 78);
MP4_ReadBoxContainerRaw( p_stream, p_box );
......@@ -2098,11 +2131,13 @@ static struct
{ FOURCC_raw, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
{ FOURCC_MAC3, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
{ FOURCC_MAC6, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
{ FOURCC_Qclp, MP4_ReadBox_sample_soun, MP4_FreeBox_Common },
{ FOURCC_vide, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
{ FOURCC_mp4v, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
{ FOURCC_SVQ1, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
{ FOURCC_SVQ3, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
{ FOURCC_ZyGo, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
{ FOURCC_DIVX, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
{ FOURCC_h263, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
{ FOURCC_cvid, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
......
......@@ -2,7 +2,7 @@
* libmp4.h : LibMP4 library for mp4 module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: libmp4.h,v 1.9 2003/03/13 16:09:20 hartman Exp $
* $Id: libmp4.h,v 1.10 2003/04/22 08:51:28 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -107,10 +107,12 @@
#define FOURCC_MAC6 VLC_FOURCC( 'M', 'A', 'C', '6' )
#define FOURCC_alaw VLC_FOURCC( 'a', 'l', 'a', 'w' )
#define FOURCC_ulaw VLC_FOURCC( 'u', 'l', 'a', 'w' )
#define FOURCC_Qclp VLC_FOURCC( 'Q', 'c', 'l', 'p' )
#define FOURCC_zlib VLC_FOURCC( 'z', 'l', 'i', 'b' )
#define FOURCC_SVQ1 VLC_FOURCC( 'S', 'V', 'Q', '1' )
#define FOURCC_SVQ3 VLC_FOURCC( 'S', 'V', 'Q', '3' )
#define FOURCC_ZyGo VLC_FOURCC( 'Z', 'y', 'G', 'o' )
#define FOURCC_3IV1 VLC_FOURCC( '3', 'I', 'V', '1' )
#define FOURCC_3iv1 VLC_FOURCC( '3', 'i', 'v', '1' )
#define FOURCC_3IV2 VLC_FOURCC( '3', 'I', 'V', '2' )
......@@ -365,6 +367,11 @@ typedef struct MP4_Box_data_sample_soun_s
uint32_t i_bytes_per_packet;
uint32_t i_bytes_per_frame;
uint32_t i_bytes_per_sample;
/* XXX hack */
int i_qt_description;
uint8_t *p_qt_description;
} MP4_Box_data_sample_soun_t;
typedef struct MP4_Box_data_sample_vide_s
......@@ -372,9 +379,12 @@ typedef struct MP4_Box_data_sample_vide_s
uint8_t i_reserved1[6];
uint16_t i_data_reference_index;
uint16_t i_predefined1;
uint16_t i_reserved2;
uint32_t i_predefined2[3];
uint16_t i_qt_version;
uint16_t i_qt_revision_level;
uint32_t i_qt_vendor;
uint32_t i_qt_temporal_quality;
uint32_t i_qt_spatial_quality;
int16_t i_width;
int16_t i_height;
......@@ -382,14 +392,18 @@ typedef struct MP4_Box_data_sample_vide_s
uint32_t i_horizresolution;
uint32_t i_vertresolution;
uint32_t i_reserved3;
uint16_t i_predefined3;
uint32_t i_qt_data_size;
uint16_t i_qt_frame_count;
uint8_t i_compressorname[32];
int16_t i_depth;
int16_t i_predefined4;
int16_t i_qt_color_table;
/* XXX hack ImageDescription */
int i_qt_image_description;
uint8_t *p_qt_image_description;
} MP4_Box_data_sample_vide_t;
typedef struct MP4_Box_data_sample_hint_s
......
......@@ -2,7 +2,7 @@
* mp4.c : MP4 file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: mp4.c,v 1.21 2003/04/14 03:23:30 fenrir Exp $
* $Id: mp4.c,v 1.22 2003/04/22 08:51:28 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -445,6 +445,8 @@ static int MP4Demux( input_thread_t *p_input )
i_pos = MP4_GetTrackPos( &track );
//msg_Dbg( p_input, "stream %d size=%6d pos=%8lld", i_track, i_size, i_pos );
/* go,go go ! */
if( ! MP4_SeekAbsolute( p_input, i_pos ) )
{
......@@ -927,6 +929,26 @@ static int TrackCreateES ( input_thread_t *p_input,
p_decoder_specific_info =
p_decconfig->p_decoder_specific_info;
}
else
{
switch( p_sample->i_type )
{
/* qt decoder, send the complete chunk */
case VLC_FOURCC( 'S', 'V', 'Q', '3' ):
case VLC_FOURCC( 'Z', 'y', 'G', 'o' ):
i_decoder_specific_info_len = p_sample->data.p_sample_vide->i_qt_image_description;
p_decoder_specific_info = p_sample->data.p_sample_vide->p_qt_image_description;
break;
case VLC_FOURCC( 'Q', 'D', 'M', 'C' ):
case VLC_FOURCC( 'Q', 'D', 'M', '2' ):
case VLC_FOURCC( 'Q', 'c', 'l', 'p' ):
i_decoder_specific_info_len = p_sample->data.p_sample_soun->i_qt_description;
p_decoder_specific_info = p_sample->data.p_sample_soun->p_qt_description;
break;
default:
break;
}
}
#undef p_decconfig
......
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