libmp4.c File Reference

Include dependency graph for libmp4.c:


Defines

#define MP4_BOX_HEADERSIZE(p_box)
#define MP4_GETX_PRIVATE(dst, code, size)
#define MP4_GET1BYTE(dst)   MP4_GETX_PRIVATE( dst, *p_peek, 1 )
#define MP4_GET2BYTES(dst)   MP4_GETX_PRIVATE( dst, GetWBE(p_peek), 2 )
#define MP4_GET3BYTES(dst)   MP4_GETX_PRIVATE( dst, Get24bBE(p_peek), 3 )
#define MP4_GET4BYTES(dst)   MP4_GETX_PRIVATE( dst, GetDWBE(p_peek), 4 )
#define MP4_GET8BYTES(dst)   MP4_GETX_PRIVATE( dst, GetQWBE(p_peek), 8 )
#define MP4_GETFOURCC(dst)
#define MP4_GETVERSIONFLAGS(p_void)
#define MP4_GETSTRINGZ(p_str)
#define MP4_READBOX_ENTER(MP4_Box_data_TYPE_t)
#define MP4_READBOX_EXIT(i_code)
#define MP4_BOX_TYPE_ASCII()   ( ((char*)&p_box->i_type)[0] != (char)0xA9 )
#define es_descriptor   p_box->data.p_esds->es_descriptor

Functions

static uint32_t Get24bBE (const uint8_t *p)
static void GetUUID (UUID_t *p_uuid, const uint8_t *p_buff)
static void CreateUUID (UUID_t *p_uuid, uint32_t i_fourcc)
static void MP4_ConvertDate2Str (char *psz, uint64_t i_date)
static MP4_Box_tMP4_ReadBox (stream_t *p_stream, MP4_Box_t *p_father)
int MP4_ReadBoxCommon (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_NextBox (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBoxContainerRaw (stream_t *p_stream, MP4_Box_t *p_container)
static int MP4_ReadBoxContainer (stream_t *p_stream, MP4_Box_t *p_container)
static void MP4_FreeBox_Common (MP4_Box_t *p_box)
static int MP4_ReadBoxSkip (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBox_ftyp (stream_t *p_stream, MP4_Box_t *p_box)
static void MP4_FreeBox_ftyp (MP4_Box_t *p_box)
static int MP4_ReadBox_mvhd (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBox_tkhd (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBox_mdhd (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBox_hdlr (stream_t *p_stream, MP4_Box_t *p_box)
static void MP4_FreeBox_hdlr (MP4_Box_t *p_box)
static int MP4_ReadBox_vmhd (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBox_smhd (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBox_hmhd (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBox_url (stream_t *p_stream, MP4_Box_t *p_box)
static void MP4_FreeBox_url (MP4_Box_t *p_box)
static int MP4_ReadBox_urn (stream_t *p_stream, MP4_Box_t *p_box)
static void MP4_FreeBox_urn (MP4_Box_t *p_box)
static int MP4_ReadBox_dref (stream_t *p_stream, MP4_Box_t *p_box)
static void MP4_FreeBox_stts (MP4_Box_t *p_box)
static int MP4_ReadBox_stts (stream_t *p_stream, MP4_Box_t *p_box)
static void MP4_FreeBox_ctts (MP4_Box_t *p_box)
static int MP4_ReadBox_ctts (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadLengthDescriptor (uint8_t **pp_peek, int64_t *i_read)
static void MP4_FreeBox_esds (MP4_Box_t *p_box)
static int MP4_ReadBox_esds (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBox_avcC (stream_t *p_stream, MP4_Box_t *p_box)
static void MP4_FreeBox_avcC (MP4_Box_t *p_box)
static int MP4_ReadBox_sample_soun (stream_t *p_stream, MP4_Box_t *p_box)
static void MP4_FreeBox_sample_soun (MP4_Box_t *p_box)
int MP4_ReadBox_sample_vide (stream_t *p_stream, MP4_Box_t *p_box)
void MP4_FreeBox_sample_vide (MP4_Box_t *p_box)
static int MP4_ReadBox_sample_mp4s (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBox_sample_text (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBox_sample_tx3g (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBox_stsd (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBox_stsz (stream_t *p_stream, MP4_Box_t *p_box)
static void MP4_FreeBox_stsz (MP4_Box_t *p_box)
static void MP4_FreeBox_stsc (MP4_Box_t *p_box)
static int MP4_ReadBox_stsc (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBox_stco_co64 (stream_t *p_stream, MP4_Box_t *p_box)
static void MP4_FreeBox_stco_co64 (MP4_Box_t *p_box)
static int MP4_ReadBox_stss (stream_t *p_stream, MP4_Box_t *p_box)
static void MP4_FreeBox_stss (MP4_Box_t *p_box)
static void MP4_FreeBox_stsh (MP4_Box_t *p_box)
static int MP4_ReadBox_stsh (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBox_stdp (stream_t *p_stream, MP4_Box_t *p_box)
static void MP4_FreeBox_stdp (MP4_Box_t *p_box)
static void MP4_FreeBox_padb (MP4_Box_t *p_box)
static int MP4_ReadBox_padb (stream_t *p_stream, MP4_Box_t *p_box)
static void MP4_FreeBox_elst (MP4_Box_t *p_box)
static int MP4_ReadBox_elst (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBox_cprt (stream_t *p_stream, MP4_Box_t *p_box)
static void MP4_FreeBox_cprt (MP4_Box_t *p_box)
static int MP4_ReadBox_dcom (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBox_cmvd (stream_t *p_stream, MP4_Box_t *p_box)
static void MP4_FreeBox_cmvd (MP4_Box_t *p_box)
static int MP4_ReadBox_cmov (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBox_rdrf (stream_t *p_stream, MP4_Box_t *p_box)
static void MP4_FreeBox_rdrf (MP4_Box_t *p_box)
static int MP4_ReadBox_rmdr (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBox_rmqu (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBox_rmvc (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBox_drms (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBox_0xa9xxx (stream_t *p_stream, MP4_Box_t *p_box)
static void MP4_FreeBox_0xa9xxx (MP4_Box_t *p_box)
static int MP4_ReadBox_chpl (stream_t *p_stream, MP4_Box_t *p_box)
static void MP4_FreeBox_chpl (MP4_Box_t *p_box)
static int MP4_ReadBox_tref_generic (stream_t *p_stream, MP4_Box_t *p_box)
static void MP4_FreeBox_tref_generic (MP4_Box_t *p_box)
static int MP4_ReadBox_meta (stream_t *p_stream, MP4_Box_t *p_box)
static int MP4_ReadBox_default (stream_t *p_stream, MP4_Box_t *p_box)
void MP4_BoxFree (stream_t *s, MP4_Box_t *p_box)
MP4_Box_tMP4_BoxGetRoot (stream_t *s)
static void __MP4_BoxDumpStructure (stream_t *s, MP4_Box_t *p_box, unsigned int i_level)
void MP4_BoxDumpStructure (stream_t *s, MP4_Box_t *p_box)
static void __get_token (char **ppsz_path, char **ppsz_token, int *pi_number)
static void __MP4_BoxGet (MP4_Box_t **pp_result, MP4_Box_t *p_box, const char *psz_fmt, va_list args)
MP4_Box_tMP4_BoxGet (MP4_Box_t *p_box, const char *psz_fmt,...)
int MP4_BoxCount (MP4_Box_t *p_box, const char *psz_fmt,...)

Variables

struct {
   uint32_t   i_type
   int(*   MP4_ReadBox_function )(stream_t *p_stream, MP4_Box_t *p_box)
   void(*   MP4_FreeBox_function )(MP4_Box_t *p_box)
MP4_Box_Function []

Define Documentation

#define es_descriptor   p_box->data.p_esds->es_descriptor

#define MP4_BOX_HEADERSIZE ( p_box   ) 

Value:

( 8 + ( p_box->i_shortsize == 1 ? 8 : 0 )     \
      + ( p_box->i_type == FOURCC_uuid ? 16 : 0 ) )

 
#define MP4_BOX_TYPE_ASCII (  )     ( ((char*)&p_box->i_type)[0] != (char)0xA9 )

#define MP4_GET1BYTE ( dst   )     MP4_GETX_PRIVATE( dst, *p_peek, 1 )

#define MP4_GET2BYTES ( dst   )     MP4_GETX_PRIVATE( dst, GetWBE(p_peek), 2 )

#define MP4_GET3BYTES ( dst   )     MP4_GETX_PRIVATE( dst, Get24bBE(p_peek), 3 )

#define MP4_GET4BYTES ( dst   )     MP4_GETX_PRIVATE( dst, GetDWBE(p_peek), 4 )

#define MP4_GET8BYTES ( dst   )     MP4_GETX_PRIVATE( dst, GetQWBE(p_peek), 8 )

#define MP4_GETFOURCC ( dst   ) 

Value:

MP4_GETX_PRIVATE( dst, \
                VLC_FOURCC(p_peek[0],p_peek[1],p_peek[2],p_peek[3]), 4)

#define MP4_GETSTRINGZ ( p_str   ) 

Value:

if( (i_read > 0) && (p_peek[0]) )   \
    {       \
        const int __i_copy__ = strnlen( (char*)p_peek, i_read-1 );  \
        p_str = malloc( __i_copy__+1 );               \
        if( p_str ) \
        { \
             memcpy( p_str, p_peek, __i_copy__ ); \
             p_str[__i_copy__] = 0; \
        } \
        p_peek += __i_copy__ + 1;   \
        i_read -= __i_copy__ + 1;   \
    }       \
    else    \
    {       \
        p_str = NULL; \
    }

#define MP4_GETVERSIONFLAGS ( p_void   ) 

Value:

MP4_GET1BYTE( p_void->i_version ); \
    MP4_GET3BYTES( p_void->i_flags )

#define MP4_GETX_PRIVATE ( dst,
code,
size   ) 

Value:

do { \
    if( (i_read) >= (size) ) { dst = (code); p_peek += (size); } \
    else { dst = 0; }   \
    i_read -= (size);   \
  } while(0)

#define MP4_READBOX_ENTER ( MP4_Box_data_TYPE_t   ) 

Value:

int64_t  i_read = p_box->i_size; \
    uint8_t *p_peek, *p_buff; \
    int i_actually_read; \
    if( !( p_peek = p_buff = malloc( i_read ) ) ) \
    { \
        return( 0 ); \
    } \
    i_actually_read = stream_Read( p_stream, p_peek, i_read ); \
    if( i_actually_read < 0 || (int64_t)i_actually_read < i_read )\
    { \
        free( p_buff ); \
        return( 0 ); \
    } \
    p_peek += MP4_BOX_HEADERSIZE( p_box ); \
    i_read -= MP4_BOX_HEADERSIZE( p_box ); \
    if( !( p_box->data.p_data = malloc( sizeof( MP4_Box_data_TYPE_t ) ) ) ) \
    { \
      free( p_buff ); \
      return( 0 ); \
    }

#define MP4_READBOX_EXIT ( i_code   ) 

Value:

do \
    { \
        free( p_buff ); \
        if( i_read < 0 ) \
            msg_Warn( p_stream, "Not enough data" ); \
        return( i_code ); \
    } while (0)


Function Documentation

static void __get_token ( char **  ppsz_path,
char **  ppsz_token,
int *  pi_number 
) [static]

static void __MP4_BoxDumpStructure ( stream_t s,
MP4_Box_t p_box,
unsigned int  i_level 
) [static]

static void __MP4_BoxGet ( MP4_Box_t **  pp_result,
MP4_Box_t p_box,
const char *  psz_fmt,
va_list  args 
) [static]

static void CreateUUID ( UUID_t p_uuid,
uint32_t  i_fourcc 
) [static]

static uint32_t Get24bBE ( const uint8_t *  p  )  [static]

static void GetUUID ( UUID_t p_uuid,
const uint8_t *  p_buff 
) [static]

int MP4_BoxCount ( MP4_Box_t p_box,
const char *  psz_fmt,
  ... 
)

void MP4_BoxDumpStructure ( stream_t s,
MP4_Box_t p_box 
)

void MP4_BoxFree ( stream_t s,
MP4_Box_t p_box 
)

MP4_Box_t* MP4_BoxGet ( MP4_Box_t p_box,
const char *  psz_fmt,
  ... 
)

MP4_Box_t* MP4_BoxGetRoot ( stream_t s  ) 

static void MP4_ConvertDate2Str ( char *  psz,
uint64_t  i_date 
) [static]

static void MP4_FreeBox_0xa9xxx ( MP4_Box_t p_box  )  [static]

static void MP4_FreeBox_avcC ( MP4_Box_t p_box  )  [static]

static void MP4_FreeBox_chpl ( MP4_Box_t p_box  )  [static]

static void MP4_FreeBox_cmvd ( MP4_Box_t p_box  )  [static]

static void MP4_FreeBox_Common ( MP4_Box_t p_box  )  [static]

static void MP4_FreeBox_cprt ( MP4_Box_t p_box  )  [static]

static void MP4_FreeBox_ctts ( MP4_Box_t p_box  )  [static]

static void MP4_FreeBox_elst ( MP4_Box_t p_box  )  [static]

static void MP4_FreeBox_esds ( MP4_Box_t p_box  )  [static]

static void MP4_FreeBox_ftyp ( MP4_Box_t p_box  )  [static]

static void MP4_FreeBox_hdlr ( MP4_Box_t p_box  )  [static]

static void MP4_FreeBox_padb ( MP4_Box_t p_box  )  [static]

static void MP4_FreeBox_rdrf ( MP4_Box_t p_box  )  [static]

static void MP4_FreeBox_sample_soun ( MP4_Box_t p_box  )  [static]

void MP4_FreeBox_sample_vide ( MP4_Box_t p_box  ) 

static void MP4_FreeBox_stco_co64 ( MP4_Box_t p_box  )  [static]

static void MP4_FreeBox_stdp ( MP4_Box_t p_box  )  [static]

static void MP4_FreeBox_stsc ( MP4_Box_t p_box  )  [static]

static void MP4_FreeBox_stsh ( MP4_Box_t p_box  )  [static]

static void MP4_FreeBox_stss ( MP4_Box_t p_box  )  [static]

static void MP4_FreeBox_stsz ( MP4_Box_t p_box  )  [static]

static void MP4_FreeBox_stts ( MP4_Box_t p_box  )  [static]

static void MP4_FreeBox_tref_generic ( MP4_Box_t p_box  )  [static]

static void MP4_FreeBox_url ( MP4_Box_t p_box  )  [static]

static void MP4_FreeBox_urn ( MP4_Box_t p_box  )  [static]

static int MP4_NextBox ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static MP4_Box_t * MP4_ReadBox ( stream_t p_stream,
MP4_Box_t p_father 
) [static]

static int MP4_ReadBox_0xa9xxx ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_avcC ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_chpl ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_cmov ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_cmvd ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_cprt ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_ctts ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_dcom ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_default ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_dref ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_drms ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_elst ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_esds ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_ftyp ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_hdlr ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_hmhd ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_mdhd ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_meta ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_mvhd ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_padb ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_rdrf ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_rmdr ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_rmqu ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_rmvc ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_sample_mp4s ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_sample_soun ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_sample_text ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_sample_tx3g ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

int MP4_ReadBox_sample_vide ( stream_t p_stream,
MP4_Box_t p_box 
)

static int MP4_ReadBox_smhd ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_stco_co64 ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_stdp ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_stsc ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_stsd ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_stsh ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_stss ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_stsz ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_stts ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_tkhd ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_tref_generic ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_url ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_urn ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadBox_vmhd ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

int MP4_ReadBoxCommon ( stream_t p_stream,
MP4_Box_t p_box 
)

static int MP4_ReadBoxContainer ( stream_t p_stream,
MP4_Box_t p_container 
) [static]

static int MP4_ReadBoxContainerRaw ( stream_t p_stream,
MP4_Box_t p_container 
) [static]

static int MP4_ReadBoxSkip ( stream_t p_stream,
MP4_Box_t p_box 
) [static]

static int MP4_ReadLengthDescriptor ( uint8_t **  pp_peek,
int64_t *  i_read 
) [static]


Variable Documentation