Commit aa830d43 authored by Clément Stenac's avatar Clément Stenac

modules/demux/util/id3tag.c

  modules/demux/avi/avi.c
  modules/demux/asf/asf.c
  src/input/es_out.c
        - Fill the playlist info structures
parent 0697a96a
......@@ -2,7 +2,7 @@
* asf.c : ASFv01 file input module for vlc
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: asf.c,v 1.47 2003/12/22 00:26:01 sam Exp $
* $Id: asf.c,v 1.48 2004/01/05 13:00:20 zorglub Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -29,6 +29,8 @@
#include <vlc/vlc.h>
#include <vlc/input.h>
#include "vlc_playlist.h"
#include "codecs.h" /* BITMAPINFOHEADER, WAVEFORMATEX */
#include "libasf.h"
......@@ -284,6 +286,8 @@ static int Open( vlc_object_t * p_this )
/* We add all info about this stream */
p_cat = input_InfoCategory( p_input, "Asf" );
playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_input,
VLC_OBJECT_PLAYLIST, FIND_PARENT);
if( p_sys->i_length > 0 )
{
int64_t i_second = p_sys->i_length / (int64_t)1000000;
......@@ -292,22 +296,58 @@ static int Open( vlc_object_t * p_this )
(int)(i_second / 36000),
(int)(( i_second / 60 ) % 60),
(int)(i_second % 60) );
if( p_playlist )
{
playlist_AddInfo( p_playlist, -1, _("Asf"), _("Length"),
"%d:%d:%d",
(int)(i_second / 36000),
(int)(( i_second / 60 ) % 60),
(int)(i_second % 60) );
}
}
input_AddInfo( p_cat, _("Number of streams"), "%d" , p_sys->i_streams );
if( p_playlist )
{
playlist_AddInfo( p_playlist, -1, _("Asf"),_("Number of streams"),"%d",
p_sys->i_streams );
}
if( ( p_cd = ASF_FindObject( p_sys->p_root->p_hdr,
&asf_object_content_description_guid, 0 ) ) )
{
if( *p_cd->psz_title )
{
input_AddInfo( p_cat, _("Title"), p_cd->psz_title );
playlist_AddInfo( p_playlist, -1, _("Asf"),_("Title"),
p_cd->psz_title );
playlist_SetName( p_playlist, -1, p_cd->psz_title );
}
if( p_cd->psz_author )
{
input_AddInfo( p_cat, _("Author"), p_cd->psz_author );
playlist_AddInfo( p_playlist, -1, _("Asf"),_("Author"),
p_cd->psz_author );
playlist_AddInfo( p_playlist, -1, _("General"),_("Author"),
p_cd->psz_author );
}
if( p_cd->psz_copyright )
{
input_AddInfo( p_cat, _("Copyright"), p_cd->psz_copyright );
playlist_AddInfo( p_playlist, -1, _("Asf"), _("Copyright"),
p_cd->psz_copyright );
}
if( *p_cd->psz_description )
{
input_AddInfo( p_cat, _("Description"), p_cd->psz_description );
playlist_AddInfo( p_playlist, -1, _("Asf"), _("Description"),
p_cd->psz_description );
}
if( *p_cd->psz_rating )
{
input_AddInfo( p_cat, _("Rating"), p_cd->psz_rating );
playlist_AddInfo( p_playlist, -1, _("Asf"), _("Rating"),
p_cd->psz_rating );
}
}
/* FIXME to port to new way */
......@@ -322,19 +362,25 @@ static int Open( vlc_object_t * p_this )
char *psz_cat = malloc( strlen(_("Stream")) + 10 );
sprintf( psz_cat, "%s %d", _("Stream"), i_stream );
p_cat = input_InfoCategory( p_input, psz_cat);
free( psz_cat );
if( p_cl && i_stream < p_cl->i_codec_entries_count )
{
input_AddInfo( p_cat, _("Codec name"),
p_cl->codec[i_stream].psz_name );
playlist_AddInfo( p_playlist, -1, psz_cat, _("Codec name"),
p_cl->codec[i_stream].psz_name );
input_AddInfo( p_cat, _("Codec description"),
p_cl->codec[i_stream].psz_description );
playlist_AddInfo( p_playlist, -1, psz_cat,
_("Codec description"),
p_cl->codec[i_stream].psz_description );
}
free( psz_cat );
i_stream++;
}
}
if( p_playlist ) vlc_object_release( p_playlist );
return VLC_SUCCESS;
error:
......
......@@ -2,7 +2,7 @@
* avi.c : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: avi.c,v 1.83 2004/01/04 17:35:01 fenrir Exp $
* $Id: avi.c,v 1.84 2004/01/05 13:00:20 zorglub Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -27,6 +27,7 @@
#include <vlc/vlc.h>
#include <vlc/input.h>
#include "vlc_playlist.h"
#include "codecs.h"
#include "libavi.h"
......@@ -234,13 +235,28 @@ static int Open( vlc_object_t * p_this )
p_avih->i_flags&AVIF_ISINTERLEAVED?" IS_INTERLEAVED":"",
p_avih->i_flags&AVIF_TRUSTCKTYPE?" TRUST_CKTYPE":"" );
{
input_info_category_t *p_cat = input_InfoCategory( p_input, _("AVI") );
playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_input,
VLC_OBJECT_PLAYLIST, FIND_PARENT);
input_info_category_t *p_cat = input_InfoCategory( p_input, _("Avi") );
input_AddInfo( p_cat, _("Number of streams"), "%d", i_track );
input_AddInfo( p_cat, _("Flags"), "%s%s%s%s",
p_avih->i_flags&AVIF_HASINDEX?" HAS_INDEX":"",
p_avih->i_flags&AVIF_MUSTUSEINDEX?" MUST_USE_INDEX":"",
p_avih->i_flags&AVIF_ISINTERLEAVED?" IS_INTERLEAVED":"",
p_avih->i_flags&AVIF_TRUSTCKTYPE?" TRUST_CKTYPE":"" );
if( p_playlist )
{
playlist_AddInfo( p_playlist, -1 , _("Avi"),
_("Number of streams"), "%d", i_track );
playlist_AddInfo( p_playlist, -1 , _("Avi"),
_("Flags"), "%s%s%s%s",
p_avih->i_flags&AVIF_HASINDEX?" HAS_INDEX":"",
p_avih->i_flags&AVIF_MUSTUSEINDEX?" MUST_USE_INDEX":"",
p_avih->i_flags&AVIF_ISINTERLEAVED?" IS_INTERLEAVED":"",
p_avih->i_flags&AVIF_TRUSTCKTYPE?" TRUST_CKTYPE":"" );
vlc_object_release( p_playlist );
}
}
/* now read info on each stream and create ES */
......
......@@ -2,7 +2,7 @@
* id3tag.c: id3 tag parser/skipper based on libid3tag
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: id3tag.c,v 1.17 2003/12/22 22:37:01 hartman Exp $
* $Id: id3tag.c,v 1.18 2004/01/05 13:00:20 zorglub Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
......@@ -86,6 +86,7 @@ static void ParseID3Tag( input_thread_t *p_input, uint8_t *p_data, int i_size )
while ( ( p_frame = id3_tag_findframe( p_id3_tag , "T", i ) ) )
{
playlist_item_t *p_item = p_playlist ? p_playlist->pp_items[p_playlist->i_index] : NULL;
int i_strings = id3_field_getnstrings( &p_frame->fields[1] );
while ( i_strings > 0 )
......@@ -100,11 +101,17 @@ static void ParseID3Tag( input_thread_t *p_input, uint8_t *p_data, int i_size )
{
input_AddInfo( p_category, (char *)p_frame->description,
ppsz_genres[atoi(psz_temp)]);
playlist_AddItemInfo( p_item, "ID3",
(char *)p_frame->description,
ppsz_genres[atoi(psz_temp)]);
}
else
{
input_AddInfo( p_category, (char *)p_frame->description,
psz_temp );
playlist_AddItemInfo( p_item, "ID3",
(char *)p_frame->description,
psz_temp);
}
}
else if ( !strcmp(p_frame->id, ID3_FRAME_TITLE ) )
......@@ -121,26 +128,31 @@ static void ParseID3Tag( input_thread_t *p_input, uint8_t *p_data, int i_size )
}
input_AddInfo( p_category, (char *)p_frame->description,
psz_temp );
playlist_AddItemInfo( p_item, "ID3",
(char *)p_frame->description,
psz_temp);
}
else if ( !strcmp(p_frame->id, ID3_FRAME_ARTIST ) )
{
if( p_item )
{
if( p_item->psz_author )
{
free( p_item->psz_author );
}
p_item->psz_author = strdup( psz_temp );
playlist_AddItemInfo( p_item,
_("General"), _("Author"), psz_temp);
val.b_bool = VLC_TRUE;
}
input_AddInfo( p_category, (char *)p_frame->description,
psz_temp );
playlist_AddItemInfo( p_item, "ID3",
(char *)p_frame->description,
psz_temp);
}
else
{
input_AddInfo( p_category, (char *)p_frame->description,
psz_temp );
playlist_AddItemInfo( p_item, "ID3",
(char *)p_frame->description,
psz_temp);
}
free( psz_temp );
}
......@@ -151,8 +163,8 @@ static void ParseID3Tag( input_thread_t *p_input, uint8_t *p_data, int i_size )
{
if( p_playlist )
{
val.b_bool = VLC_TRUE;
var_Set( p_playlist, "intf-change", val );
val.b_bool = p_playlist->i_index;
var_Set( p_playlist, "item-change", val );
}
}
val.b_bool = VLC_TRUE;
......
......@@ -2,7 +2,7 @@
* es_out.c: Es Out handler for input.
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: es_out.c,v 1.12 2004/01/04 15:32:13 fenrir Exp $
* $Id: es_out.c,v 1.13 2004/01/05 13:00:20 zorglub Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -30,6 +30,7 @@
#include <vlc/input.h>
#include <vlc/decoder.h>
#include "vlc_playlist.h"
#include "codecs.h"
/*****************************************************************************
......@@ -230,6 +231,7 @@ static void EsOutSelect( es_out_t *out, es_out_id_t *es, vlc_bool_t b_force )
static es_out_id_t *EsOutAdd( es_out_t *out, es_format_t *fmt )
{
es_out_sys_t *p_sys = out->p_sys;
playlist_t *p_playlist = NULL;
input_thread_t *p_input = p_sys->p_input;
es_out_id_t *es = malloc( sizeof( es_out_id_t ) );
pgrm_descriptor_t *p_prgm = NULL;
......@@ -336,7 +338,10 @@ static es_out_id_t *EsOutAdd( es_out_t *out, es_format_t *fmt )
}
sprintf( psz_cat, _("Stream %d"), out->p_sys->i_id - 1 );
if( ( p_cat = input_InfoCategory( p_input, psz_cat ) ) )
/* Get a category and the playlist */
if( ( p_cat = input_InfoCategory( p_input, psz_cat ) ) &&
( p_playlist = (playlist_t *)vlc_object_find( p_input,
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ) ) )
{
/* Add information */
switch( fmt->i_cat )
......@@ -346,34 +351,57 @@ static es_out_id_t *EsOutAdd( es_out_t *out, es_format_t *fmt )
{
input_AddInfo( p_cat, _("Description"), "%s",
fmt->psz_description );
playlist_AddInfo( p_playlist, -1, psz_cat,
_("Description"), "%s",
fmt->psz_description );
}
input_AddInfo( p_cat, _("Codec"), "%.4s",
(char*)&fmt->i_codec );
playlist_AddInfo( p_playlist, -1, psz_cat,
_("Codec"),"%.4s",(char*)&fmt->i_codec );
input_AddInfo( p_cat, _("Type"), _("Audio") );
playlist_AddInfo( p_playlist, -1, psz_cat,
_("Type"), _("Audio") );
if( fmt->audio.i_channels > 0 )
{
input_AddInfo( p_cat, _("Channels"), "%d",
fmt->audio.i_channels );
playlist_AddInfo( p_playlist, -1, psz_cat,
_("Channels"), "%d", fmt->audio.i_channels );
}
if( fmt->psz_language )
{
input_AddInfo( p_cat, _("Language"), "%s",
fmt->psz_language );
playlist_AddInfo( p_playlist, -1, psz_cat,
_("Language"), "%s",
fmt->psz_language );
}
if( fmt->audio.i_rate > 0 )
{
input_AddInfo( p_cat, _("Sample rate"), _("%d Hz"),
input_AddInfo( p_cat, _("Sample rate"), _("%d Hz"),
fmt->audio.i_rate );
playlist_AddInfo( p_playlist, -1, psz_cat,
_("Sample rate"), _("%d Hz"),
fmt->audio.i_rate );
}
if( fmt->i_bitrate > 0 )
{
input_AddInfo( p_cat, _("Bitrate"), _("%d bps"),
input_AddInfo( p_cat, _("Bitrate"), _("%d bps"),
fmt->i_bitrate );
playlist_AddInfo( p_playlist, -1, psz_cat,
_("Bitrate"), _("%d bps"),
fmt->i_bitrate );
}
if( fmt->audio.i_bitspersample )
{
input_AddInfo( p_cat, _("Bits per sample"), "%d",
fmt->audio.i_bitspersample );
playlist_AddInfo( p_playlist, -1, psz_cat,
_("Bits per sample"), "%d",
fmt->audio.i_bitspersample );
}
break;
case VIDEO_ES:
......@@ -381,14 +409,27 @@ static es_out_id_t *EsOutAdd( es_out_t *out, es_format_t *fmt )
{
input_AddInfo( p_cat, _("Description"), "%s",
fmt->psz_description );
playlist_AddInfo( p_playlist, -1, psz_cat,
_("Description"), "%s",
fmt->psz_description );
}
input_AddInfo( p_cat, _("Type"), _("Video") );
playlist_AddInfo( p_playlist, -1, psz_cat,
_("Type"), _("Video") );
input_AddInfo( p_cat, _("Codec"), "%.4s",
(char*)&fmt->i_codec );
playlist_AddInfo( p_playlist, -1, psz_cat,
_("Codec"), "%.4s",
(char*)&fmt->i_codec );
if( fmt->video.i_width > 0 && fmt->video.i_height > 0 )
{
input_AddInfo( p_cat, _("Resolution"), "%dx%d",
fmt->video.i_width, fmt->video.i_height );
playlist_AddInfo( p_playlist, -1, psz_cat,
_("Resolution"), "%dx%d",
fmt->video.i_width, fmt->video.i_height );
}
if( fmt->video.i_visible_width > 0 &&
fmt->video.i_visible_height > 0 )
......@@ -396,20 +437,29 @@ static es_out_id_t *EsOutAdd( es_out_t *out, es_format_t *fmt )
input_AddInfo( p_cat, _("Display resolution"), "%dx%d",
fmt->video.i_visible_width,
fmt->video.i_visible_height);
playlist_AddInfo( p_playlist, -1, psz_cat,
_("Display resolution"), "%dx%d",
fmt->video.i_visible_width,
fmt->video.i_visible_height);
}
break;
case SPU_ES:
input_AddInfo( p_cat, _("Type"), _("Subtitle") );
playlist_AddInfo( p_playlist, -1, psz_cat,
_("Type"), _("Subtitle") );
input_AddInfo( p_cat, _("Codec"), "%.4s",
(char*)&fmt->i_codec );
playlist_AddInfo( p_playlist, -1, psz_cat,
_("Codec"), "%.4s",
(char*)&fmt->i_codec );
break;
default:
break;
}
if( p_playlist ) vlc_object_release( p_playlist );
}
/* Apply mode
* XXX change that when we do group too */
if( 1 )
......
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