Commit 4f21763a authored by Laurent Aimar's avatar Laurent Aimar

* mp4: added parsing of some mov boxes (alternate movies).

parent 66b4ecfa
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libmp4.c : LibMP4 library for mp4 module for vlc * libmp4.c : LibMP4 library for mp4 module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: libmp4.c,v 1.11 2002/12/18 14:17:10 sam Exp $ * $Id: libmp4.c,v 1.12 2003/01/13 02:30:11 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -1899,12 +1899,102 @@ int MP4_ReadBox_cmov( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -1899,12 +1899,102 @@ int MP4_ReadBox_cmov( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
#endif /* HAVE_ZLIB_H */ #endif /* HAVE_ZLIB_H */
} }
int MP4_ReadBox_rdrf( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
uint32_t i_len;
MP4_READBOX_ENTER( MP4_Box_data_rdrf_t );
MP4_GETVERSIONFLAGS( p_box->data.p_rdrf );
MP4_GETFOURCC( p_box->data.p_rdrf->i_ref_type );
MP4_GET4BYTES( i_len );
if( i_len > 0 )
{
uint32_t i;
p_box->data.p_rdrf->psz_ref = malloc( i_len );
for( i = 0; i < i_len; i++ )
{
MP4_GET1BYTE( p_box->data.p_rdrf->psz_ref[i] );
}
p_box->data.p_rdrf->psz_ref[i_len] = '\0';
}
else
{
p_box->data.p_rdrf->psz_ref = NULL;
}
#ifdef MP4_VERBOSE
msg_Dbg( p_stream->p_input,
"Read Box: \"rdrf\" type:%c%c%c%c ref %s",
p_box->data.p_rdrf->i_ref_type&0xff, (p_box->data.p_rdrf->i_ref_type>>8)&0xff,
(p_box->data.p_rdrf->i_ref_type>>16)&0xff, (p_box->data.p_rdrf->i_ref_type>>24)&0xff,
p_box->data.p_rdrf->psz_ref );
#endif
MP4_READBOX_EXIT( 1 );
}
void MP4_FreeBox_rdrf( input_thread_t *p_input, MP4_Box_t *p_box )
{
FREE( p_box->data.p_rdrf->psz_ref )
}
int MP4_ReadBox_rmdr( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_rmdr_t );
MP4_GETVERSIONFLAGS( p_box->data.p_rmdr );
MP4_GET4BYTES( p_box->data.p_rmdr->i_rate );
#ifdef MP4_VERBOSE
msg_Dbg( p_stream->p_input,
"Read Box: \"rmdr\" rate:%d",
p_box->data.p_rmdr->i_rate );
#endif
MP4_READBOX_EXIT( 1 );
}
int MP4_ReadBox_rmqu( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_rmqu_t );
MP4_GET4BYTES( p_box->data.p_rmqu->i_quality );
#ifdef MP4_VERBOSE
msg_Dbg( p_stream->p_input,
"Read Box: \"rmqu\" quality:%d",
p_box->data.p_rmqu->i_quality );
#endif
MP4_READBOX_EXIT( 1 );
}
int MP4_ReadBox_rmvc( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_rmvc_t );
MP4_GETVERSIONFLAGS( p_box->data.p_rmvc );
MP4_GETFOURCC( p_box->data.p_rmvc->i_gestaltType );
MP4_GET4BYTES( p_box->data.p_rmvc->i_val1 );
MP4_GET4BYTES( p_box->data.p_rmvc->i_val2 );
MP4_GET2BYTES( p_box->data.p_rmvc->i_checkType );
#ifdef MP4_VERBOSE
msg_Dbg( p_stream->p_input,
"Read Box: \"rmvc\" gestaltType:%c%c%c%c val1:0x%x val2:0x%x checkType:0x%x",
p_box->data.p_rmvc->i_gestaltType&0xff, (p_box->data.p_rmvc->i_gestaltType>>8)&0xff,
(p_box->data.p_rmvc->i_gestaltType>>16)&0xff,(p_box->data.p_rmvc->i_gestaltType>>24)&0xff,
p_box->data.p_rmvc->i_val1,p_box->data.p_rmvc->i_val2,
p_box->data.p_rmvc->i_checkType );
#endif
MP4_READBOX_EXIT( 1 );
}
/**** ------------------------------------------------------------------- ****/ /**** ------------------------------------------------------------------- ****/
/**** "Higher level" Functions ****/ /**** "Higher level" Functions ****/
/**** ------------------------------------------------------------------- ****/ /**** ------------------------------------------------------------------- ****/
static struct static struct
{ {
uint32_t i_type; uint32_t i_type;
int (*MP4_ReadBox_function )( MP4_Stream_t *p_stream, MP4_Box_t *p_box ); int (*MP4_ReadBox_function )( MP4_Stream_t *p_stream, MP4_Box_t *p_box );
...@@ -1923,6 +2013,8 @@ static struct ...@@ -1923,6 +2013,8 @@ static struct
{ FOURCC_udta, MP4_ReadBoxContainer, MP4_FreeBox_Common }, { FOURCC_udta, MP4_ReadBoxContainer, MP4_FreeBox_Common },
{ FOURCC_nmhd, MP4_ReadBoxContainer, MP4_FreeBox_Common }, { FOURCC_nmhd, MP4_ReadBoxContainer, MP4_FreeBox_Common },
{ FOURCC_hnti, MP4_ReadBoxContainer, MP4_FreeBox_Common }, { FOURCC_hnti, MP4_ReadBoxContainer, MP4_FreeBox_Common },
{ FOURCC_rmra, MP4_ReadBoxContainer, MP4_FreeBox_Common },
{ FOURCC_rmda, MP4_ReadBoxContainer, MP4_FreeBox_Common },
/* specific box */ /* specific box */
{ FOURCC_ftyp, MP4_ReadBox_ftyp, MP4_FreeBox_ftyp }, { FOURCC_ftyp, MP4_ReadBox_ftyp, MP4_FreeBox_ftyp },
...@@ -1991,12 +2083,17 @@ static struct ...@@ -1991,12 +2083,17 @@ static struct
{ FOURCC_dpnd, NULL, NULL }, { FOURCC_dpnd, NULL, NULL },
{ FOURCC_ipir, NULL, NULL }, { FOURCC_ipir, NULL, NULL },
{ FOURCC_mpod, NULL, NULL }, { FOURCC_mpod, NULL, NULL },
/* found in hnti */ /* found in hnti */
{ FOURCC_rtp, NULL, NULL }, { FOURCC_rtp, NULL, NULL },
/* found in rmra */
{ FOURCC_rdrf, MP4_ReadBox_rdrf, MP4_FreeBox_rdrf },
{ FOURCC_rmdr, MP4_ReadBox_rmdr, MP4_FreeBox_Common },
{ FOURCC_rmqu, MP4_ReadBox_rmqu, MP4_FreeBox_Common },
{ FOURCC_rmvc, MP4_ReadBox_rmvc, MP4_FreeBox_Common },
/* Last entry */ /* Last entry */
{ 0, NULL, NULL } { 0, NULL, NULL }
}; };
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libmp4.h : LibMP4 library for mp4 module for vlc * libmp4.h : LibMP4 library for mp4 module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: libmp4.h,v 1.4 2002/11/17 06:46:56 fenrir Exp $ * $Id: libmp4.h,v 1.5 2003/01/13 02:30:11 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -105,9 +105,19 @@ ...@@ -105,9 +105,19 @@
#define FOURCC_mjpb VLC_FOURCC( 'm', 'j', 'q', 't' ) #define FOURCC_mjpb VLC_FOURCC( 'm', 'j', 'q', 't' )
#define FOURCC_mjqt VLC_FOURCC( 'm', 'j', 'h', 't' ) #define FOURCC_mjqt VLC_FOURCC( 'm', 'j', 'h', 't' )
#define FOURCC_mjht VLC_FOURCC( 'm', 'j', 'p', 'b' ) #define FOURCC_mjht VLC_FOURCC( 'm', 'j', 'p', 'b' )
#define FOURCC_jpeg VLC_FOURCC( 'j', 'p', 'e', 'g' ) #define FOURCC_jpeg VLC_FOURCC( 'j', 'p', 'e', 'g' )
#define FOURCC_rmra VLC_FOURCC( 'r', 'm', 'r', 'a' )
#define FOURCC_rmda VLC_FOURCC( 'r', 'm', 'd', 'a' )
#define FOURCC_rdrf VLC_FOURCC( 'r', 'd', 'r', 'f' )
#define FOURCC_rmdr VLC_FOURCC( 'r', 'm', 'd', 'r' )
#define FOURCC_rmvc VLC_FOURCC( 'r', 'm', 'v', 'c' )
#define FOURCC_rmcd VLC_FOURCC( 'r', 'm', 'c', 'd' )
#define FOURCC_rmqu VLC_FOURCC( 'r', 'm', 'q', 'u' )
#define FOURCC_alis VLC_FOURCC( 'a', 'l', 'i', 's' )
/* Do you want some debug information on all read boxes ? */ /* Do you want some debug information on all read boxes ? */
#define MP4_VERBOSE 1 #define MP4_VERBOSE 1
...@@ -578,11 +588,57 @@ typedef struct MP4_Box_data_cmvd_s ...@@ -578,11 +588,57 @@ typedef struct MP4_Box_data_cmvd_s
typedef struct MP4_Box_data_cmov_s typedef struct MP4_Box_data_cmov_s
{ {
struct MP4_Box_s *p_moov; /* uncompressed moov */ struct MP4_Box_s *p_moov; /* uncompressed moov */
} MP4_Box_data_cmov_t; } MP4_Box_data_cmov_t;
typedef struct MP4_Box_data_rdrf_s
{
uint8_t i_version;
uint32_t i_flags;
uint32_t i_ref_type;
char *psz_ref;
} MP4_Box_data_rdrf_t;
typedef struct MP4_Box_data_rmdr_s
{
uint8_t i_version;
uint32_t i_flags;
uint32_t i_rate;
} MP4_Box_data_rmdr_t;
typedef struct MP4_Box_data_rmvc_s
{
uint8_t i_version;
uint32_t i_flags;
uint32_t i_gestaltType;
uint32_t i_val1;
uint32_t i_val2;
uint16_t i_checkType; /* 0: val1 is version min
1: gestalt value & val2 == val1 */
} MP4_Box_data_rmvc_t;
typedef struct MP4_Box_data_rmcd_s
{
uint8_t i_version;
uint32_t i_flags;
} MP4_Box_data_rmcd_t;
typedef struct MP4_Box_data_rmqu_s
{
uint32_t i_quality;
} MP4_Box_data_rmqu_t;
/* /*
typedef struct MP4_Box_data_cmov_s typedef struct MP4_Box_data__s
{ {
uint8_t i_version; uint8_t i_version;
uint32_t i_flags; uint32_t i_flags;
...@@ -629,7 +685,12 @@ typedef union MP4_Box_data_s ...@@ -629,7 +685,12 @@ typedef union MP4_Box_data_s
MP4_Box_data_cmov_t *p_cmov; MP4_Box_data_cmov_t *p_cmov;
MP4_Box_data_moviehintinformation_rtp_t p_moviehintinformation_rtp; MP4_Box_data_moviehintinformation_rtp_t p_moviehintinformation_rtp;
MP4_Box_data_rdrf_t *p_rdrf;
MP4_Box_data_rmdr_t *p_rmdr;
MP4_Box_data_rmqu_t *p_rmqu;
MP4_Box_data_rmvc_t *p_rmvc;
void *p_data; /* for unknow type */ void *p_data; /* for unknow type */
} MP4_Box_data_t; } MP4_Box_data_t;
......
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