Commit e1e8b00b authored by Laurent Aimar's avatar Laurent Aimar

* input: call DEMUX_GET_META and fill playlist and input infos.

parent 034ed2f4
......@@ -2,7 +2,7 @@
* demux.c
*****************************************************************************
* Copyright (C) 1999-2004 VideoLAN
* $Id: demux.c,v 1.10 2004/01/25 17:16:05 zorglub Exp $
* $Id: demux.c,v 1.11 2004/01/31 05:25:36 fenrir Exp $
*
* Author: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -140,6 +140,9 @@ int demux_vaControlDefault( input_thread_t *p_input, int i_query,
case DEMUX_GET_FPS:
i_ret = VLC_EGENERIC;
break;
case DEMUX_GET_META:
i_ret = VLC_EGENERIC;
break;
default:
msg_Err( p_input, "unknown query in demux_vaControlDefault" );
......
......@@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998-2004 VideoLAN
* $Id: input.c,v 1.284 2004/01/29 17:51:08 zorglub Exp $
* $Id: input.c,v 1.285 2004/01/31 05:25:36 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -43,6 +43,7 @@
#include "vlc_interface.h"
#include "codecs.h"
#include "vlc_meta.h"
#include "../../modules/demux/util/sub.h"
/*****************************************************************************
......@@ -524,6 +525,7 @@ static int RunThread( input_thread_t *p_input )
*****************************************************************************/
static int InitThread( input_thread_t * p_input )
{
vlc_meta_t *meta;
float f_fps;
playlist_t *p_playlist;
mtime_t i_length;
......@@ -778,6 +780,75 @@ static int InitThread( input_thread_t * p_input )
p_input->p_sys->i_sub = 0;
p_input->p_sys->sub = NULL;
/* get meta informations */
if( !demux_Control( p_input, DEMUX_GET_META, &meta ) )
{
playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_input,
VLC_OBJECT_PLAYLIST, FIND_PARENT);
playlist_item_t *p_item = NULL;
input_info_category_t *p_cat;
int i;
if( p_playlist )
{
vlc_mutex_lock( &p_playlist->object_lock );
p_item = playlist_ItemGetByPos( p_playlist, -1 );
if( p_item )
{
vlc_mutex_lock( &p_item->lock );
}
vlc_mutex_unlock( &p_playlist->object_lock );
}
msg_Dbg( p_input, "meta informations:" );
if( meta->i_meta > 0 )
{
p_cat = input_InfoCategory( p_input, _("File") );
for( i = 0; i < meta->i_meta; i++ )
{
msg_Dbg( p_input, " - '%s' = '%s'", _(meta->name[i]), meta->value[i] );
input_AddInfo( p_cat, _(meta->name[i]), "%s", meta->value[i] );
if( p_item )
{
playlist_ItemAddInfo( p_item, _("File"),
_(meta->name[i]), "%s", meta->value[i] );
}
}
}
for( i = 0; i < meta->i_track; i++ )
{
vlc_meta_t *tk = meta->track[i];
int j;
msg_Dbg( p_input, " - track[%d]:", i );
if( tk->i_meta > 0 )
{
char *psz_cat = malloc( strlen(_("Stream")) + 10 );
sprintf( psz_cat, "%s %d", _("Stream"), i );
p_cat = input_InfoCategory( p_input, psz_cat );
for( j = 0; j < tk->i_meta; j++ )
{
msg_Dbg( p_input, " - '%s' = '%s'", _(tk->name[j]), tk->value[j] );
input_AddInfo( p_cat, _(tk->name[j]), "%s", tk->value[j] );
if( p_item )
{
playlist_ItemAddInfo( p_item, psz_cat,
_(tk->name[j]), "%s", tk->value[j] );
}
}
}
}
if( p_item )
{
vlc_mutex_unlock( &p_item->lock );
}
if( p_playlist ) vlc_object_release( p_playlist );
vlc_meta_Delete( meta );
}
/* get length */
if( !demux_Control( p_input, DEMUX_GET_LENGTH, &i_length ) && i_length > 0 )
{
......
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