Commit d88930e7 authored by Laurent Aimar's avatar Laurent Aimar

* mp4: added partial support for udta meta data.

parent 09ba73c7
...@@ -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-2004 VideoLAN * Copyright (C) 2001-2004 VideoLAN
* $Id: libmp4.c,v 1.45 2004/01/25 20:05:28 hartman Exp $ * $Id$
* *
* Author: Laurent Aimar <fenrir@via.ecp.fr> * Author: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -1932,6 +1932,41 @@ static int MP4_ReadBox_drms( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -1932,6 +1932,41 @@ static int MP4_ReadBox_drms( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
MP4_READBOX_EXIT( 1 ); MP4_READBOX_EXIT( 1 );
} }
static int MP4_ReadBox_0xa9xxx( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
int16_t i_length, i_dummy;
MP4_READBOX_ENTER( MP4_Box_data_0xa9xxx_t );
p_box->data.p_0xa9xxx->psz_text = NULL;
MP4_GET2BYTES( i_length );
MP4_GET2BYTES( i_dummy );
if( i_length > 0 )
{
if( i_length > i_read ) i_length = i_read;
p_box->data.p_0xa9xxx->psz_text = malloc( i_length + 1 );
memcpy( p_box->data.p_0xa9xxx->psz_text,
p_peek, i_length );
p_box->data.p_0xa9xxx->psz_text[i_length] = '\0';
#ifdef MP4_VERBOSE
msg_Dbg( p_stream->p_input,
"read box: \"%4.4s\" text=`%s'",
(char*)&p_box->i_type,
p_box->data.p_0xa9xxx->psz_text );
#endif
}
MP4_READBOX_EXIT( 1 );
}
static void MP4_FreeBox_0xa9xxx( MP4_Box_t *p_box )
{
FREE( p_box->data.p_0xa9xxx->psz_text );
}
/**** ------------------------------------------------------------------- ****/ /**** ------------------------------------------------------------------- ****/
/**** "Higher level" Functions ****/ /**** "Higher level" Functions ****/
...@@ -2046,6 +2081,7 @@ static struct ...@@ -2046,6 +2081,7 @@ static struct
{ FOURCC_dvp, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_dvp, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
{ FOURCC_VP31, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_VP31, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
{ FOURCC_vp31, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_vp31, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
{ FOURCC_h264, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
{ FOURCC_jpeg, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_jpeg, MP4_ReadBox_sample_vide, MP4_FreeBox_Common },
...@@ -2077,6 +2113,22 @@ static struct ...@@ -2077,6 +2113,22 @@ static struct
{ FOURCC_name, MP4_ReadBox_drms, MP4_FreeBox_Common }, { FOURCC_name, MP4_ReadBox_drms, MP4_FreeBox_Common },
{ FOURCC_priv, MP4_ReadBox_drms, MP4_FreeBox_Common }, { FOURCC_priv, MP4_ReadBox_drms, MP4_FreeBox_Common },
/* found in udta */
{ FOURCC_0xa9nam,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9aut,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9cpy,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9swr,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9inf,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9ART,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9dir,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9cmt,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9req,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9day,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9fmt,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9prd,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9prf,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9src,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
/* 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-2004 VideoLAN * Copyright (C) 2001-2004 VideoLAN
* $Id: libmp4.h,v 1.20 2004/01/25 20:05:28 hartman Exp $ * $Id$
* 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
...@@ -134,6 +134,7 @@ ...@@ -134,6 +134,7 @@
#define FOURCC_mjht VLC_FOURCC( 'm', 'j', 'p', 'b' ) #define FOURCC_mjht VLC_FOURCC( 'm', 'j', 'p', 'b' )
#define FOURCC_VP31 VLC_FOURCC( 'V', 'P', '3', '1' ) #define FOURCC_VP31 VLC_FOURCC( 'V', 'P', '3', '1' )
#define FOURCC_vp31 VLC_FOURCC( 'v', 'p', '3', '1' ) #define FOURCC_vp31 VLC_FOURCC( 'v', 'p', '3', '1' )
#define FOURCC_h264 VLC_FOURCC( 'h', '2', '6', '4' )
#define FOURCC_dvc VLC_FOURCC( 'd', 'v', 'c', ' ' ) #define FOURCC_dvc VLC_FOURCC( 'd', 'v', 'c', ' ' )
#define FOURCC_dvp VLC_FOURCC( 'd', 'v', 'p', ' ' ) #define FOURCC_dvp VLC_FOURCC( 'd', 'v', 'p', ' ' )
...@@ -163,6 +164,21 @@ ...@@ -163,6 +164,21 @@
#define FOURCC_name VLC_FOURCC( 'n', 'a', 'm', 'e' ) #define FOURCC_name VLC_FOURCC( 'n', 'a', 'm', 'e' )
#define FOURCC_priv VLC_FOURCC( 'p', 'r', 'i', 'v' ) #define FOURCC_priv VLC_FOURCC( 'p', 'r', 'i', 'v' )
#define FOURCC_0xa9nam VLC_FOURCC( 0xa9, 'n', 'a', 'm' )
#define FOURCC_0xa9aut VLC_FOURCC( 0xa9, 'a', 'u', 't' )
#define FOURCC_0xa9swr VLC_FOURCC( 0xa9, 's', 'w', 'r' )
#define FOURCC_0xa9cpy VLC_FOURCC( 0xa9, 'c', 'p', 'y' )
#define FOURCC_0xa9inf VLC_FOURCC( 0xa9, 'i', 'n', 'f' )
#define FOURCC_0xa9ART VLC_FOURCC( 0xa9, 'A', 'R', 'T' )
#define FOURCC_0xa9dir VLC_FOURCC( 0xa9, 'd', 'i', 'r' )
#define FOURCC_0xa9cmt VLC_FOURCC( 0xa9, 'c', 'm', 't' )
#define FOURCC_0xa9req VLC_FOURCC( 0xa9, 'r', 'e', 'q' )
#define FOURCC_0xa9day VLC_FOURCC( 0xa9, 'd', 'a', 'y' )
#define FOURCC_0xa9fmt VLC_FOURCC( 0xa9, 'f', 'm', 't' )
#define FOURCC_0xa9prd VLC_FOURCC( 0xa9, 'p', 'r', 'd' )
#define FOURCC_0xa9prf VLC_FOURCC( 0xa9, 'p', 'r', 'f' )
#define FOURCC_0xa9src VLC_FOURCC( 0xa9, 's', 'r', 'c' )
/* 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
...@@ -659,7 +675,7 @@ typedef struct MP4_Box_data_cmov_s ...@@ -659,7 +675,7 @@ typedef struct MP4_Box_data_cmov_s
} MP4_Box_data_cmov_t; } MP4_Box_data_cmov_t;
typedef struct MP4_Box_data_rdrf_s typedef struct
{ {
uint8_t i_version; uint8_t i_version;
uint32_t i_flags; uint32_t i_flags;
...@@ -669,7 +685,7 @@ typedef struct MP4_Box_data_rdrf_s ...@@ -669,7 +685,7 @@ typedef struct MP4_Box_data_rdrf_s
} MP4_Box_data_rdrf_t; } MP4_Box_data_rdrf_t;
typedef struct MP4_Box_data_rmdr_s typedef struct
{ {
uint8_t i_version; uint8_t i_version;
uint32_t i_flags; uint32_t i_flags;
...@@ -678,7 +694,7 @@ typedef struct MP4_Box_data_rmdr_s ...@@ -678,7 +694,7 @@ typedef struct MP4_Box_data_rmdr_s
} MP4_Box_data_rmdr_t; } MP4_Box_data_rmdr_t;
typedef struct MP4_Box_data_rmvc_s typedef struct
{ {
uint8_t i_version; uint8_t i_version;
uint32_t i_flags; uint32_t i_flags;
...@@ -691,7 +707,7 @@ typedef struct MP4_Box_data_rmvc_s ...@@ -691,7 +707,7 @@ typedef struct MP4_Box_data_rmvc_s
} MP4_Box_data_rmvc_t; } MP4_Box_data_rmvc_t;
typedef struct MP4_Box_data_rmcd_s typedef struct
{ {
uint8_t i_version; uint8_t i_version;
uint32_t i_flags; uint32_t i_flags;
...@@ -699,12 +715,18 @@ typedef struct MP4_Box_data_rmcd_s ...@@ -699,12 +715,18 @@ typedef struct MP4_Box_data_rmcd_s
} MP4_Box_data_rmcd_t; } MP4_Box_data_rmcd_t;
typedef struct MP4_Box_data_rmqu_s typedef struct
{ {
uint32_t i_quality; uint32_t i_quality;
} MP4_Box_data_rmqu_t; } MP4_Box_data_rmqu_t;
typedef struct
{
char *psz_text;
} MP4_Box_data_0xa9xxx_t;
/* /*
typedef struct MP4_Box_data__s typedef struct MP4_Box_data__s
{ {
...@@ -759,6 +781,8 @@ typedef union MP4_Box_data_s ...@@ -759,6 +781,8 @@ typedef union MP4_Box_data_s
MP4_Box_data_rmqu_t *p_rmqu; MP4_Box_data_rmqu_t *p_rmqu;
MP4_Box_data_rmvc_t *p_rmvc; MP4_Box_data_rmvc_t *p_rmvc;
MP4_Box_data_0xa9xxx_t *p_0xa9xxx;
void *p_data; /* for unknow type */ void *p_data; /* for unknow type */
} MP4_Box_data_t; } MP4_Box_data_t;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* mp4.c : MP4 file input module for vlc * mp4.c : MP4 file input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001-2004 VideoLAN * Copyright (C) 2001-2004 VideoLAN
* $Id: mp4.c,v 1.59 2004/02/07 13:26:24 fenrir Exp $ * $Id$
* 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
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <vlc/input.h> #include <vlc/input.h>
#include <vlc_playlist.h> #include <vlc_playlist.h>
#include "iso_lang.h" #include "iso_lang.h"
#include "vlc_meta.h"
#include "libmp4.h" #include "libmp4.h"
#include "mp4.h" #include "mp4.h"
...@@ -640,7 +641,54 @@ static int Control( input_thread_t *p_input, int i_query, va_list args ) ...@@ -640,7 +641,54 @@ static int Control( input_thread_t *p_input, int i_query, va_list args )
return VLC_EGENERIC; return VLC_EGENERIC;
case DEMUX_GET_META: case DEMUX_GET_META:
return VLC_EGENERIC; {
vlc_meta_t **pp_meta = (vlc_meta_t**)va_arg( args, vlc_meta_t** );
vlc_meta_t *meta;
MP4_Box_t *p_udta = MP4_BoxGet( p_sys->p_root, "/moov/udta" );
MP4_Box_t *p_0xa9xxx;
if( p_udta == NULL )
{
return VLC_EGENERIC;
}
*pp_meta = meta = vlc_meta_New();
for( p_0xa9xxx = p_udta->p_first; p_0xa9xxx != NULL; p_0xa9xxx = p_0xa9xxx->p_next )
{
switch( p_0xa9xxx->i_type )
{
case FOURCC_0xa9nam:
vlc_meta_Add( meta, VLC_META_TITLE, p_0xa9xxx->data.p_0xa9xxx->psz_text );
break;
case FOURCC_0xa9aut:
vlc_meta_Add( meta, VLC_META_AUTHOR, p_0xa9xxx->data.p_0xa9xxx->psz_text );
break;
case FOURCC_0xa9ART:
vlc_meta_Add( meta, VLC_META_ARTIST, p_0xa9xxx->data.p_0xa9xxx->psz_text );
break;
case FOURCC_0xa9cpy:
vlc_meta_Add( meta, VLC_META_COPYRIGHT, p_0xa9xxx->data.p_0xa9xxx->psz_text );
break;
case FOURCC_0xa9day:
vlc_meta_Add( meta, VLC_META_DATE, p_0xa9xxx->data.p_0xa9xxx->psz_text );
break;
case FOURCC_0xa9swr:
case FOURCC_0xa9inf:
case FOURCC_0xa9dir:
case FOURCC_0xa9cmt:
case FOURCC_0xa9req:
case FOURCC_0xa9fmt:
case FOURCC_0xa9prd:
case FOURCC_0xa9prf:
case FOURCC_0xa9src:
/* TODO one day, but they aren't really meaningfull */
break;
default:
break;
}
}
return VLC_SUCCESS;
}
default: default:
msg_Err( p_input, "control query unimplemented !!!" ); msg_Err( p_input, "control query unimplemented !!!" );
......
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