Commit ab94829b authored by Gildas Bazin's avatar Gildas Bazin

* src/libvlc.h, src/input/input.c:

   + added --meta-title/author/artist/genre/copyright/description/date/url config options.
     This allows the user to specify/override metadata information for an input.

* include/vlc_meta.h:
   + vlc_meta_Merge( dest, src ) helper function.

* modules/demux/mp4/*:
   + Fixed a couple of mem-leaks.
   + Support for "description" metadata.
parent d0e495fb
...@@ -64,6 +64,7 @@ static inline vlc_meta_t *vlc_meta_New( void ) ...@@ -64,6 +64,7 @@ static inline vlc_meta_t *vlc_meta_New( void )
return m; return m;
} }
static inline void vlc_meta_Delete( vlc_meta_t *m ) static inline void vlc_meta_Delete( vlc_meta_t *m )
{ {
int i; int i;
...@@ -82,6 +83,7 @@ static inline void vlc_meta_Delete( vlc_meta_t *m ) ...@@ -82,6 +83,7 @@ static inline void vlc_meta_Delete( vlc_meta_t *m )
if( m->track ) free( m->track ); if( m->track ) free( m->track );
free( m ); free( m );
} }
static inline void vlc_meta_Add( vlc_meta_t *m, char *name, char *value ) static inline void vlc_meta_Add( vlc_meta_t *m, char *name, char *value )
{ {
int i_meta = m->i_meta; int i_meta = m->i_meta;
...@@ -109,5 +111,23 @@ static inline vlc_meta_t *vlc_meta_Duplicate( vlc_meta_t *src ) ...@@ -109,5 +111,23 @@ static inline vlc_meta_t *vlc_meta_Duplicate( vlc_meta_t *src )
return dst; return dst;
} }
#endif static inline void vlc_meta_Merge( vlc_meta_t *dst, vlc_meta_t *src )
{
int i, j;
for( i = 0; i < src->i_meta; i++ )
{
/* Check if dst contains the entry */
for( j = 0; j < dst->i_meta; j++ )
{
if( !strcmp( src->name[i], dst->name[j] ) ) break;
}
if( j < dst->i_meta )
{
if( dst->value[j] ) free( dst->value[j] );
dst->value[j] = strdup( src->value[i] );
}
else vlc_meta_Add( dst, src->name[i], src->value[i] );
}
}
#endif
...@@ -1105,9 +1105,17 @@ static int MP4_ReadBox_sample_soun( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -1105,9 +1105,17 @@ static int MP4_ReadBox_sample_soun( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
/* /*
* XXX hack -> produce a copy of the nearly complete chunk * XXX hack -> produce a copy of the nearly complete chunk
*/ */
p_box->data.p_sample_soun->i_qt_description = i_read; if( i_read > 0 )
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 ); 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_version );
MP4_GET2BYTES( p_box->data.p_sample_soun->i_qt_revision_level ); MP4_GET2BYTES( p_box->data.p_sample_soun->i_qt_revision_level );
...@@ -1175,6 +1183,8 @@ static int MP4_ReadBox_sample_soun( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -1175,6 +1183,8 @@ static int MP4_ReadBox_sample_soun( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
static void MP4_FreeBox_sample_soun( MP4_Box_t *p_box ) static void MP4_FreeBox_sample_soun( MP4_Box_t *p_box )
{ {
FREE( p_box->data.p_sample_soun->p_qt_description );
if( p_box->i_type == FOURCC_drms ) if( p_box->i_type == FOURCC_drms )
{ {
if( p_box->data.p_sample_soun->p_drms ) if( p_box->data.p_sample_soun->p_drms )
...@@ -1206,8 +1216,7 @@ static int MP4_ReadBox_sample_vide( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -1206,8 +1216,7 @@ static int MP4_ReadBox_sample_vide( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
p_box->data.p_sample_vide->i_qt_image_description = i_read; 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 ); p_box->data.p_sample_vide->p_qt_image_description = malloc( i_read );
memcpy( p_box->data.p_sample_vide->p_qt_image_description, memcpy( p_box->data.p_sample_vide->p_qt_image_description,
p_peek, p_peek, i_read );
i_read );
} }
else else
{ {
...@@ -1251,6 +1260,12 @@ static int MP4_ReadBox_sample_vide( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -1251,6 +1260,12 @@ static int MP4_ReadBox_sample_vide( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
} }
static void MP4_FreeBox_sample_vide( MP4_Box_t *p_box )
{
FREE( p_box->data.p_sample_vide->p_qt_image_description );
}
static int MP4_ReadBox_stsd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) static int MP4_ReadBox_stsd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{ {
...@@ -2034,56 +2049,56 @@ static struct ...@@ -2034,56 +2049,56 @@ static struct
{ FOURCC_wide, MP4_ReadBoxSkip, MP4_FreeBox_Common }, { FOURCC_wide, MP4_ReadBoxSkip, MP4_FreeBox_Common },
/* for codecs */ /* for codecs */
{ FOURCC_soun, MP4_ReadBox_sample_soun, MP4_FreeBox_Common }, { FOURCC_soun, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
{ FOURCC_ms02, MP4_ReadBox_sample_soun, MP4_FreeBox_Common }, { FOURCC_ms02, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
{ FOURCC_ms11, MP4_ReadBox_sample_soun, MP4_FreeBox_Common }, { FOURCC_ms11, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
{ FOURCC_ms55, MP4_ReadBox_sample_soun, MP4_FreeBox_Common }, { FOURCC_ms55, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
{ FOURCC__mp3, MP4_ReadBox_sample_soun, MP4_FreeBox_Common }, { FOURCC__mp3, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
{ FOURCC_mp4a, MP4_ReadBox_sample_soun, MP4_FreeBox_Common }, { FOURCC_mp4a, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
{ FOURCC_twos, MP4_ReadBox_sample_soun, MP4_FreeBox_Common }, { FOURCC_twos, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
{ FOURCC_sowt, MP4_ReadBox_sample_soun, MP4_FreeBox_Common }, { FOURCC_sowt, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
{ FOURCC_QDMC, MP4_ReadBox_sample_soun, MP4_FreeBox_Common }, { FOURCC_QDMC, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
{ FOURCC_QDM2, MP4_ReadBox_sample_soun, MP4_FreeBox_Common }, { FOURCC_QDM2, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
{ FOURCC_ima4, MP4_ReadBox_sample_soun, MP4_FreeBox_Common }, { FOURCC_ima4, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
{ FOURCC_IMA4, MP4_ReadBox_sample_soun, MP4_FreeBox_Common }, { FOURCC_IMA4, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
{ FOURCC_dvi, MP4_ReadBox_sample_soun, MP4_FreeBox_Common }, { FOURCC_dvi, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
{ FOURCC_alaw, MP4_ReadBox_sample_soun, MP4_FreeBox_Common }, { FOURCC_alaw, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
{ FOURCC_ulaw, MP4_ReadBox_sample_soun, MP4_FreeBox_Common }, { FOURCC_ulaw, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
{ FOURCC_raw, MP4_ReadBox_sample_soun, MP4_FreeBox_Common }, { FOURCC_raw, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
{ FOURCC_MAC3, MP4_ReadBox_sample_soun, MP4_FreeBox_Common }, { FOURCC_MAC3, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
{ FOURCC_MAC6, MP4_ReadBox_sample_soun, MP4_FreeBox_Common }, { FOURCC_MAC6, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
{ FOURCC_Qclp, MP4_ReadBox_sample_soun, MP4_FreeBox_Common }, { FOURCC_Qclp, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
{ FOURCC_samr, MP4_ReadBox_sample_soun, MP4_FreeBox_Common }, { FOURCC_samr, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
{ FOURCC_OggS, MP4_ReadBox_sample_soun, MP4_FreeBox_Common }, { FOURCC_OggS, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
{ FOURCC_vide, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_vide, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_mp4v, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_mp4v, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_SVQ1, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_SVQ1, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_SVQ3, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_SVQ3, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_ZyGo, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_ZyGo, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_DIVX, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_DIVX, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_h263, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_h263, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_s263, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_s263, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_cvid, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_cvid, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_3IV1, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_3IV1, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_3iv1, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_3iv1, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_3IV2, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_3IV2, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_3iv2, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_3iv2, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_3IVD, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_3IVD, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_3ivd, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_3ivd, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_3VID, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_3VID, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_3vid, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_3vid, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_mjpa, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_mjpa, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_mjpb, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_mjpb, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_mjqt, NULL, NULL }, /* found in mjpa/b */ { FOURCC_mjqt, NULL, NULL }, /* found in mjpa/b */
{ FOURCC_mjht, NULL, NULL }, { FOURCC_mjht, NULL, NULL },
{ FOURCC_dvc, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_dvc, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_dvp, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_dvp, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_VP31, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_VP31, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_vp31, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_vp31, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_h264, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_h264, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_jpeg, MP4_ReadBox_sample_vide, MP4_FreeBox_Common }, { FOURCC_jpeg, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide },
{ FOURCC_mp4s, NULL, MP4_FreeBox_Common }, { FOURCC_mp4s, NULL, MP4_FreeBox_Common },
...@@ -2124,6 +2139,7 @@ static struct ...@@ -2124,6 +2139,7 @@ static struct
{ FOURCC_0xa9cmt,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx }, { FOURCC_0xa9cmt,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9req,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx }, { FOURCC_0xa9req,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9day,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx }, { FOURCC_0xa9day,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9des,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9fmt,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx }, { FOURCC_0xa9fmt,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9prd,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx }, { FOURCC_0xa9prd,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
{ FOURCC_0xa9prf,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx }, { FOURCC_0xa9prf,MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx },
...@@ -2580,4 +2596,3 @@ int MP4_BoxCount( MP4_Box_t *p_box, char *psz_fmt, ... ) ...@@ -2580,4 +2596,3 @@ int MP4_BoxCount( MP4_Box_t *p_box, char *psz_fmt, ... )
} }
return( i_count ); return( i_count );
} }
...@@ -170,6 +170,7 @@ ...@@ -170,6 +170,7 @@
#define FOURCC_0xa9cpy VLC_FOURCC( 0xa9, 'c', 'p', 'y' ) #define FOURCC_0xa9cpy VLC_FOURCC( 0xa9, 'c', 'p', 'y' )
#define FOURCC_0xa9inf VLC_FOURCC( 0xa9, 'i', 'n', 'f' ) #define FOURCC_0xa9inf VLC_FOURCC( 0xa9, 'i', 'n', 'f' )
#define FOURCC_0xa9ART VLC_FOURCC( 0xa9, 'A', 'R', 'T' ) #define FOURCC_0xa9ART VLC_FOURCC( 0xa9, 'A', 'R', 'T' )
#define FOURCC_0xa9des VLC_FOURCC( 0xa9, 'd', 'e', 's' )
#define FOURCC_0xa9dir VLC_FOURCC( 0xa9, 'd', 'i', 'r' ) #define FOURCC_0xa9dir VLC_FOURCC( 0xa9, 'd', 'i', 'r' )
#define FOURCC_0xa9cmt VLC_FOURCC( 0xa9, 'c', 'm', 't' ) #define FOURCC_0xa9cmt VLC_FOURCC( 0xa9, 'c', 'm', 't' )
#define FOURCC_0xa9req VLC_FOURCC( 0xa9, 'r', 'e', 'q' ) #define FOURCC_0xa9req VLC_FOURCC( 0xa9, 'r', 'e', 'q' )
......
...@@ -47,10 +47,6 @@ vlc_module_begin(); ...@@ -47,10 +47,6 @@ vlc_module_begin();
set_callbacks( Open, Close ); set_callbacks( Open, Close );
vlc_module_end(); vlc_module_end();
/* TODO:
* - DEMUX_GET_META and meta parsing
*/
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
...@@ -651,40 +647,50 @@ static int Control( input_thread_t *p_input, int i_query, va_list args ) ...@@ -651,40 +647,50 @@ static int Control( input_thread_t *p_input, int i_query, va_list args )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
*pp_meta = meta = vlc_meta_New(); *pp_meta = meta = vlc_meta_New();
for( p_0xa9xxx = p_udta->p_first; p_0xa9xxx != NULL; p_0xa9xxx = p_0xa9xxx->p_next ) for( p_0xa9xxx = p_udta->p_first; p_0xa9xxx != NULL;
p_0xa9xxx = p_0xa9xxx->p_next )
{ {
switch( p_0xa9xxx->i_type ) switch( p_0xa9xxx->i_type )
{ {
case FOURCC_0xa9nam: case FOURCC_0xa9nam:
vlc_meta_Add( meta, VLC_META_TITLE, p_0xa9xxx->data.p_0xa9xxx->psz_text ); vlc_meta_Add( meta, VLC_META_TITLE,
break; p_0xa9xxx->data.p_0xa9xxx->psz_text );
case FOURCC_0xa9aut: break;
vlc_meta_Add( meta, VLC_META_AUTHOR, p_0xa9xxx->data.p_0xa9xxx->psz_text ); case FOURCC_0xa9aut:
break; vlc_meta_Add( meta, VLC_META_AUTHOR,
case FOURCC_0xa9ART: p_0xa9xxx->data.p_0xa9xxx->psz_text );
vlc_meta_Add( meta, VLC_META_ARTIST, p_0xa9xxx->data.p_0xa9xxx->psz_text ); break;
break; case FOURCC_0xa9ART:
case FOURCC_0xa9cpy: vlc_meta_Add( meta, VLC_META_ARTIST,
vlc_meta_Add( meta, VLC_META_COPYRIGHT, p_0xa9xxx->data.p_0xa9xxx->psz_text ); p_0xa9xxx->data.p_0xa9xxx->psz_text );
break; break;
case FOURCC_0xa9day: case FOURCC_0xa9cpy:
vlc_meta_Add( meta, VLC_META_DATE, p_0xa9xxx->data.p_0xa9xxx->psz_text ); vlc_meta_Add( meta, VLC_META_COPYRIGHT,
break; p_0xa9xxx->data.p_0xa9xxx->psz_text );
break;
case FOURCC_0xa9swr: case FOURCC_0xa9day:
case FOURCC_0xa9inf: vlc_meta_Add( meta, VLC_META_DATE,
case FOURCC_0xa9dir: p_0xa9xxx->data.p_0xa9xxx->psz_text );
case FOURCC_0xa9cmt: break;
case FOURCC_0xa9req: case FOURCC_0xa9des:
case FOURCC_0xa9fmt: vlc_meta_Add( meta, VLC_META_DESCRIPTION,
case FOURCC_0xa9prd: p_0xa9xxx->data.p_0xa9xxx->psz_text );
case FOURCC_0xa9prf: break;
case FOURCC_0xa9src:
/* TODO one day, but they aren't really meaningfull */ case FOURCC_0xa9swr:
break; case FOURCC_0xa9inf:
case FOURCC_0xa9dir:
default: case FOURCC_0xa9cmt:
break; 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; return VLC_SUCCESS;
......
...@@ -560,7 +560,7 @@ static int RunThread( input_thread_t *p_input ) ...@@ -560,7 +560,7 @@ static int RunThread( input_thread_t *p_input )
*****************************************************************************/ *****************************************************************************/
static int InitThread( input_thread_t * p_input ) static int InitThread( input_thread_t * p_input )
{ {
vlc_meta_t *meta; vlc_meta_t *p_meta = NULL, *p_meta_user = NULL;
float f_fps; float f_fps;
playlist_t *p_playlist; playlist_t *p_playlist;
mtime_t i_length; mtime_t i_length;
...@@ -824,8 +824,56 @@ static int InitThread( input_thread_t * p_input ) ...@@ -824,8 +824,56 @@ static int InitThread( input_thread_t * p_input )
p_input->p_sys->i_stop_time = 0; p_input->p_sys->i_stop_time = 0;
/* get meta informations */ /* Get meta information from user */
if( !demux_Control( p_input, DEMUX_GET_META, &meta ) ) var_Create( p_input, "meta-title", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_input, "meta-author", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_input, "meta-artist", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_input, "meta-genre", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_input, "meta-copyright", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
var_Create( p_input, "meta-description", VLC_VAR_STRING|VLC_VAR_DOINHERIT);
var_Create( p_input, "meta-date", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_input, "meta-url", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
if( (p_meta_user = vlc_meta_New()) )
{
vlc_value_t val;
var_Get( p_input, "meta-title", &val );
if( val.psz_string && *val.psz_string )
vlc_meta_Add( p_meta_user, VLC_META_TITLE, val.psz_string );
if( val.psz_string ) free( val.psz_string );
var_Get( p_input, "meta-author", &val );
if( val.psz_string && *val.psz_string )
vlc_meta_Add( p_meta_user, VLC_META_AUTHOR, val.psz_string );
if( val.psz_string ) free( val.psz_string );
var_Get( p_input, "meta-artist", &val );
if( val.psz_string && *val.psz_string )
vlc_meta_Add( p_meta_user, VLC_META_ARTIST, val.psz_string );
if( val.psz_string ) free( val.psz_string );
var_Get( p_input, "meta-genre", &val );
if( val.psz_string && *val.psz_string )
vlc_meta_Add( p_meta_user, VLC_META_GENRE, val.psz_string );
if( val.psz_string ) free( val.psz_string );
var_Get( p_input, "meta-copyright", &val );
if( val.psz_string && *val.psz_string )
vlc_meta_Add( p_meta_user, VLC_META_COPYRIGHT, val.psz_string );
if( val.psz_string ) free( val.psz_string );
var_Get( p_input, "meta-description", &val );
if( val.psz_string && *val.psz_string )
vlc_meta_Add( p_meta_user, VLC_META_DESCRIPTION, val.psz_string );
if( val.psz_string ) free( val.psz_string );
var_Get( p_input, "meta-date", &val );
if( val.psz_string && *val.psz_string )
vlc_meta_Add( p_meta_user, VLC_META_DATE, val.psz_string );
if( val.psz_string ) free( val.psz_string );
var_Get( p_input, "meta-url", &val );
if( val.psz_string && *val.psz_string )
vlc_meta_Add( p_meta_user, VLC_META_URL, val.psz_string );
if( val.psz_string ) free( val.psz_string );
}
/* Get meta informations from demuxer */
if( !demux_Control( p_input, DEMUX_GET_META, &p_meta ) ||
( p_meta_user && p_meta_user->i_meta ) )
{ {
playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_input, playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_input,
VLC_OBJECT_PLAYLIST, FIND_PARENT); VLC_OBJECT_PLAYLIST, FIND_PARENT);
...@@ -833,6 +881,10 @@ static int InitThread( input_thread_t * p_input ) ...@@ -833,6 +881,10 @@ static int InitThread( input_thread_t * p_input )
input_info_category_t *p_cat; input_info_category_t *p_cat;
int i; int i;
/* Merge demux and user metadata */
if( !p_meta ){ p_meta = p_meta_user; p_meta_user = NULL; }
else if( p_meta && p_meta_user ) vlc_meta_Merge( p_meta, p_meta_user );
if( p_playlist ) if( p_playlist )
{ {
vlc_mutex_lock( &p_playlist->object_lock ); vlc_mutex_lock( &p_playlist->object_lock );
...@@ -845,32 +897,35 @@ static int InitThread( input_thread_t * p_input ) ...@@ -845,32 +897,35 @@ static int InitThread( input_thread_t * p_input )
} }
msg_Dbg( p_input, "meta informations:" ); msg_Dbg( p_input, "meta informations:" );
if( meta->i_meta > 0 ) if( p_meta->i_meta > 0 )
{ {
p_cat = input_InfoCategory( p_input, _("File") ); p_cat = input_InfoCategory( p_input, _("File") );
for( i = 0; i < meta->i_meta; i++ ) for( i = 0; i < p_meta->i_meta; i++ )
{ {
msg_Dbg( p_input, " - '%s' = '%s'", _(meta->name[i]), meta->value[i] ); msg_Dbg( p_input, " - '%s' = '%s'", _(p_meta->name[i]),
if( !strcmp( meta->name[i], VLC_META_TITLE ) ) p_meta->value[i] );
if( !strcmp( p_meta->name[i], VLC_META_TITLE ) )
{ {
playlist_ItemSetName( p_item, meta->value[i] ); playlist_ItemSetName( p_item, p_meta->value[i] );
} }
if( !strcmp( meta->name[i], VLC_META_AUTHOR ) ) if( !strcmp( p_meta->name[i], VLC_META_AUTHOR ) )
{ {
playlist_ItemAddInfo( p_item, _("General"), _("Author"), playlist_ItemAddInfo( p_item, _("General"), _("Author"),
meta->value[i] ); p_meta->value[i] );
} }
input_AddInfo( p_cat, _(meta->name[i]), "%s", meta->value[i] ); input_AddInfo( p_cat, _(p_meta->name[i]), "%s",
p_meta->value[i] );
if( p_item ) if( p_item )
{ {
playlist_ItemAddInfo( p_item, _("File"), playlist_ItemAddInfo( p_item, _("File"),
_(meta->name[i]), "%s", meta->value[i] ); _(p_meta->name[i]), "%s",
p_meta->value[i] );
} }
} }
} }
for( i = 0; i < meta->i_track; i++ ) for( i = 0; i < p_meta->i_track; i++ )
{ {
vlc_meta_t *tk = meta->track[i]; vlc_meta_t *tk = p_meta->track[i];
int j; int j;
msg_Dbg( p_input, " - track[%d]:", i ); msg_Dbg( p_input, " - track[%d]:", i );
...@@ -882,12 +937,13 @@ static int InitThread( input_thread_t * p_input ) ...@@ -882,12 +937,13 @@ static int InitThread( input_thread_t * p_input )
for( j = 0; j < tk->i_meta; j++ ) for( j = 0; j < tk->i_meta; j++ )
{ {
msg_Dbg( p_input, " - '%s' = '%s'", _(tk->name[j]), tk->value[j] ); msg_Dbg( p_input, " - '%s' = '%s'", _(tk->name[j]),
tk->value[j] );
input_AddInfo( p_cat, _(tk->name[j]), "%s", tk->value[j] ); input_AddInfo( p_cat, _(tk->name[j]), "%s", tk->value[j] );
if( p_item ) if( p_item )
{ {
playlist_ItemAddInfo( p_item, psz_cat, playlist_ItemAddInfo( p_item, psz_cat, _(tk->name[j]),
_(tk->name[j]), "%s", tk->value[j] ); "%s", tk->value[j] );
} }
} }
} }
...@@ -901,21 +957,24 @@ static int InitThread( input_thread_t * p_input ) ...@@ -901,21 +957,24 @@ static int InitThread( input_thread_t * p_input )
if( p_input->stream.p_sout && p_input->stream.p_sout->p_meta == NULL ) if( p_input->stream.p_sout && p_input->stream.p_sout->p_meta == NULL )
{ {
p_input->stream.p_sout->p_meta = meta; p_input->stream.p_sout->p_meta = p_meta;
} }
else else
{ {
vlc_meta_Delete( meta ); vlc_meta_Delete( p_meta );
} }
} }
if( p_meta_user ) vlc_meta_Delete( p_meta_user );
/* get length */ /* Get length */
if( !demux_Control( p_input, DEMUX_GET_LENGTH, &i_length ) && i_length > 0 ) if( !demux_Control( p_input, DEMUX_GET_LENGTH, &i_length ) &&
i_length > 0 )
{ {
input_info_category_t *p_cat = input_InfoCategory( p_input, _("File") ); input_info_category_t *p_cat =
p_playlist = (playlist_t*)vlc_object_find( p_input, input_InfoCategory( p_input, _("File") );
VLC_OBJECT_PLAYLIST, p_playlist =
FIND_PARENT ); (playlist_t*)vlc_object_find( p_input, VLC_OBJECT_PLAYLIST,
FIND_PARENT );
if( p_playlist ) if( p_playlist )
{ {
playlist_SetDuration( p_playlist, -1 , i_length ); playlist_SetDuration( p_playlist, -1 , i_length );
...@@ -934,11 +993,12 @@ static int InitThread( input_thread_t * p_input ) ...@@ -934,11 +993,12 @@ static int InitThread( input_thread_t * p_input )
var_Get( p_input, "start-time", &val ); var_Get( p_input, "start-time", &val );
if( val.i_int > 0 ) if( val.i_int > 0 )
{ {
double f_pos = (double)( (int64_t)val.i_int * I64C(1000000) ) / (double)i_length; double f_pos = val.i_int * I64C(1000000) / (double)i_length;
if( f_pos >= 1.0 ) if( f_pos >= 1.0 )
{ {
msg_Warn( p_input, "invalid start-time, ignored (start-time >= media length)" ); msg_Warn( p_input, "invalid start-time, ignored (start-time "
">= media length)" );
} }
else else
{ {
...@@ -949,6 +1009,7 @@ static int InitThread( input_thread_t * p_input ) ...@@ -949,6 +1009,7 @@ static int InitThread( input_thread_t * p_input )
} }
} }
} }
/* Set stop-time and check validity */ /* Set stop-time and check validity */
var_Get( p_input, "stop-time", &val ); var_Get( p_input, "stop-time", &val );
if( val.i_int > 0 ) if( val.i_int > 0 )
...@@ -958,7 +1019,8 @@ static int InitThread( input_thread_t * p_input ) ...@@ -958,7 +1019,8 @@ static int InitThread( input_thread_t * p_input )
var_Get( p_input, "start-time", &start ); var_Get( p_input, "start-time", &start );
if( start.i_int >= val.i_int ) if( start.i_int >= val.i_int )
{ {
msg_Warn( p_input, "invalid stop-time, ignored (stop-time < start-time)" ); msg_Warn( p_input, "invalid stop-time, ignored (stop-time < "
"start-time)" );
} }
else else
{ {
...@@ -967,7 +1029,7 @@ static int InitThread( input_thread_t * p_input ) ...@@ -967,7 +1029,7 @@ static int InitThread( input_thread_t * p_input )
} }
} }
/* get fps */ /* Get fps */
if( demux_Control( p_input, DEMUX_GET_FPS, &f_fps ) || f_fps < 0.1 ) if( demux_Control( p_input, DEMUX_GET_FPS, &f_fps ) || f_fps < 0.1 )
{ {
i_microsecondperframe = 0; i_microsecondperframe = 0;
...@@ -1007,7 +1069,8 @@ static int InitThread( input_thread_t * p_input ) ...@@ -1007,7 +1069,8 @@ static int InitThread( input_thread_t * p_input )
if( ( p_sub = subtitle_New( p_input, *tmp2, if( ( p_sub = subtitle_New( p_input, *tmp2,
i_microsecondperframe ) ) ) i_microsecondperframe ) ) )
{ {
TAB_APPEND( p_input->p_sys->i_sub, p_input->p_sys->sub, p_sub ); TAB_APPEND( p_input->p_sys->i_sub, p_input->p_sys->sub,
p_sub );
} }
} }
free( *tmp2++ ); free( *tmp2++ );
......
...@@ -32,8 +32,9 @@ static char *ppsz_language[] = ...@@ -32,8 +32,9 @@ static char *ppsz_language[] =
"pl", "pt_BR", "ru", "sv" }; "pl", "pt_BR", "ru", "sv" };
static char *ppsz_language_text[] = static char *ppsz_language_text[] =
{ N_("Auto"), N_("American"), N_("British"), N_("Spanish"), N_("German"), { N_("Auto"), N_("American"), N_("British"), N_("Spanish"), N_("German"),
N_("French"), N_("Hungarian"), N_("Italian"), N_("Japanese"), N_("Dutch"), N_("Norwegian"), N_("French"), N_("Hungarian"), N_("Italian"), N_("Japanese"), N_("Dutch"),
N_("Polish"), N_("Brazilian"), N_("Russian"), N_("Swedish") }; N_("Norwegian"), N_("Polish"), N_("Brazilian"), N_("Russian"),
N_("Swedish") };
/***************************************************************************** /*****************************************************************************
* Configuration options for the main program. Each module will also separatly * Configuration options for the main program. Each module will also separatly
...@@ -161,14 +162,6 @@ static char *ppsz_language_text[] = ...@@ -161,14 +162,6 @@ static char *ppsz_language_text[] =
"the sound, or audio visualization modules (spectrum analyzer, ...).") "the sound, or audio visualization modules (spectrum analyzer, ...).")
#define AUDIO_CHANNEL_MIXER N_("Channel mixer") #define AUDIO_CHANNEL_MIXER N_("Channel mixer")
#if 0
#define AUDIO_CHANNEL_MIXER_LONGTEXT N_( \
"This allows you to choose a specific audio channel mixer. For instance " \
"the headphone channel mixer will downmix any audio source to a stereo " \
"output and give the feeling that you are standing in a room with a " \
"complete 5.1 speaker set when using only a headphone.")
#endif
#define AUDIO_CHANNEL_MIXER_LONGTEXT N_( \ #define AUDIO_CHANNEL_MIXER_LONGTEXT N_( \
"This allows you to choose a specific audio channel mixer. For " \ "This allows you to choose a specific audio channel mixer. For " \
"instance, you can use the \"headphone\" mixer that gives 5.1 feeling " \ "instance, you can use the \"headphone\" mixer that gives 5.1 feeling " \
...@@ -208,11 +201,9 @@ static char *ppsz_language_text[] = ...@@ -208,11 +201,9 @@ static char *ppsz_language_text[] =
"will be centered (0=center, 1=left, 2=right, 4=top, 8=bottom, you can " \ "will be centered (0=center, 1=left, 2=right, 4=top, 8=bottom, you can " \
"also use combinations of these values).") "also use combinations of these values).")
static int pi_align_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 }; static int pi_align_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
static char *ppsz_align_descriptions[] = { N_("Center"), static char *ppsz_align_descriptions[] =
N_("Left"), N_("Right"), { N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"),
N_("Top"), N_("Bottom"), N_("Top-Left"), N_("Top-Right"), N_("Bottom-Left"), N_("Bottom-Right") };
N_("Top-Left"), N_("Top-Right"),
N_("Bottom-Left"), N_("Bottom-Right")};
#define ZOOM_TEXT N_("Zoom video") #define ZOOM_TEXT N_("Zoom video")
#define ZOOM_LONGTEXT N_( \ #define ZOOM_LONGTEXT N_( \
...@@ -262,16 +253,6 @@ static char *ppsz_align_descriptions[] = { N_("Center"), ...@@ -262,16 +253,6 @@ static char *ppsz_align_descriptions[] = { N_("Center"),
"aspect, or a float value (1.25, 1.3333, etc.) expressing pixel " \ "aspect, or a float value (1.25, 1.3333, etc.) expressing pixel " \
"squareness.") "squareness.")
#if 0
#define PIXEL_RATIO_TEXT N_("Destination aspect ratio")
#define PIXEL_RATIO_LONGTEXT N_( \
"This will force the destination pixel size. By default VLC assumes " \
"your pixels are square, unless your hardware has a way to tell it " \
"otherwise. This may be used when you output VLC's signal to another " \
"device such as a TV set. Accepted format is a float value (1, 1.25, " \
"1.3333, etc.) expressing pixel squareness.")
#endif
#define INPUT_CAT_LONGTEXT N_( \ #define INPUT_CAT_LONGTEXT N_( \
"These options allow you to modify the behaviour of the input " \ "These options allow you to modify the behaviour of the input " \
"subsystem, such as the DVD or VCD device, the network interface " \ "subsystem, such as the DVD or VCD device, the network interface " \
...@@ -390,6 +371,38 @@ static char *ppsz_align_descriptions[] = { N_("Center"), ...@@ -390,6 +371,38 @@ static char *ppsz_align_descriptions[] = { N_("Center"),
"If you check this box, IPv4 will be used by default for all UDP and " \ "If you check this box, IPv4 will be used by default for all UDP and " \
"HTTP connections.") "HTTP connections.")
#define META_TITLE_TEXT N_("Title metadata")
#define META_TITLE_LONGTEXT N_( \
"Allows you to specify a \"title\" metadata for an input.")
#define META_AUTHOR_TEXT N_("Author metadata")
#define META_AUTHOR_LONGTEXT N_( \
"Allows you to specify an \"author\" metadata for an input.")
#define META_ARTIST_TEXT N_("Artist metadata")
#define META_ARTIST_LONGTEXT N_( \
"Allows you to specify an \"artist\" metadata for an input.")
#define META_GENRE_TEXT N_("Genre metadata")
#define META_GENRE_LONGTEXT N_( \
"Allows you to specify a \"genre\" metadata for an input.")
#define META_CPYR_TEXT N_("Copyright metadata")
#define META_CPYR_LONGTEXT N_( \
"Allows you to specify a \"copyright\" metadata for an input.")
#define META_DESCR_TEXT N_("Description metadata")
#define META_DESCR_LONGTEXT N_( \
"Allows you to specify a \"description\" metadata for an input.")
#define META_DATE_TEXT N_("Date metadata")
#define META_DATE_LONGTEXT N_( \
"Allows you to specify a \"date\" metadata for an input.")
#define META_URL_TEXT N_("URL metadata")
#define META_URL_LONGTEXT N_( \
"Allows you to specify a \"url\" metadata for an input.")
#define CODEC_CAT_LONGTEXT N_( \ #define CODEC_CAT_LONGTEXT N_( \
"This option can be used to alter the way VLC selects " \ "This option can be used to alter the way VLC selects " \
"its codecs (decompression methods). Only advanced users should " \ "its codecs (decompression methods). Only advanced users should " \
...@@ -794,15 +807,35 @@ vlc_module_begin(); ...@@ -794,15 +807,35 @@ vlc_module_begin();
add_integer( "stop-time", 0, NULL, add_integer( "stop-time", 0, NULL,
STOP_TIME_TEXT, STOP_TIME_LONGTEXT, VLC_TRUE ); STOP_TIME_TEXT, STOP_TIME_LONGTEXT, VLC_TRUE );
add_file( "dvd", DVD_DEVICE, NULL, DVD_DEV_TEXT, DVD_DEV_LONGTEXT, VLC_FALSE ); add_file( "dvd", DVD_DEVICE, NULL, DVD_DEV_TEXT, DVD_DEV_LONGTEXT,
add_file( "vcd", VCD_DEVICE, NULL, VCD_DEV_TEXT, VCD_DEV_LONGTEXT, VLC_FALSE ); VLC_FALSE );
add_file( "cd-audio", CDAUDIO_DEVICE, NULL, CDAUDIO_DEV_TEXT, CDAUDIO_DEV_LONGTEXT, VLC_FALSE ); add_file( "vcd", VCD_DEVICE, NULL, VCD_DEV_TEXT, VCD_DEV_LONGTEXT,
VLC_FALSE );
add_file( "cd-audio", CDAUDIO_DEVICE, NULL, CDAUDIO_DEV_TEXT,
CDAUDIO_DEV_LONGTEXT, VLC_FALSE );
add_bool( "ipv6", 0, NULL, IPV6_TEXT, IPV6_LONGTEXT, VLC_FALSE ); add_bool( "ipv6", 0, NULL, IPV6_TEXT, IPV6_LONGTEXT, VLC_FALSE );
change_short('6'); change_short('6');
add_bool( "ipv4", 0, NULL, IPV4_TEXT, IPV4_LONGTEXT, VLC_FALSE ); add_bool( "ipv4", 0, NULL, IPV4_TEXT, IPV4_LONGTEXT, VLC_FALSE );
change_short('4'); change_short('4');
add_string( "meta-title", NULL, NULL, META_TITLE_TEXT,
META_TITLE_LONGTEXT, VLC_TRUE );
add_string( "meta-author", NULL, NULL, META_AUTHOR_TEXT,
META_AUTHOR_LONGTEXT, VLC_TRUE );
add_string( "meta-artist", NULL, NULL, META_ARTIST_TEXT,
META_ARTIST_LONGTEXT, VLC_TRUE );
add_string( "meta-genre", NULL, NULL, META_GENRE_TEXT,
META_GENRE_LONGTEXT, VLC_TRUE );
add_string( "meta-copyright", NULL, NULL, META_CPYR_TEXT,
META_CPYR_LONGTEXT, VLC_TRUE );
add_string( "meta-description", NULL, NULL, META_DESCR_TEXT,
META_DESCR_LONGTEXT, VLC_TRUE );
add_string( "meta-date", NULL, NULL, META_DATE_TEXT,
META_DATE_LONGTEXT, VLC_TRUE );
add_string( "meta-url", NULL, NULL, META_URL_TEXT,
META_URL_LONGTEXT, VLC_TRUE );
/* Decoder options */ /* Decoder options */
add_category_hint( N_("Decoders"), CODEC_CAT_LONGTEXT , VLC_TRUE ); add_category_hint( N_("Decoders"), CODEC_CAT_LONGTEXT , VLC_TRUE );
add_module( "codec", "decoder", NULL, NULL, CODEC_TEXT, CODEC_LONGTEXT, VLC_TRUE ); add_module( "codec", "decoder", NULL, NULL, CODEC_TEXT, CODEC_LONGTEXT, VLC_TRUE );
......
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