Commit 499a3845 authored by Clément Stenac's avatar Clément Stenac

Options as infos were bad in several ways: it broke PLAYLIST_GO, used

much memory, and was inconsistent, especially with input_CreateThread
taking an array of options

* Revert to using array of options

* To add an item with options:
    - either use playlist_ItemNew, ItemAddOption, and then AddItem
      (useful if you don't have all your options in an array)
    - either use playlist_AddExt (use this if all your options are
      already in an array)

* To add an item without options: use playlist_Add

You can still add options after an item has been added by using either
playlist_AddOption or playlist_ItemAddOption

* Attempt to improve API and solve thread safety issues.
  - playlist_Item* functions allow to touch items only.
    p_item->lock must be used when needed
    (playlist_ItemNew, playlist_ItemDelete, playlist_Item*Info,
     playlist_ItemSet* )

  - playlist_ItemGetById and ItemGetByPos give you playlist_items
    for GetByPos, you should have the playlist lock

At the moment, the playlist_Set* and playlist_*Info functions are kept (they work with position) but should be avoided.
parent 6dc60921
......@@ -2,7 +2,7 @@
* vlc_playlist.h : Playlist functions
*****************************************************************************
* Copyright (C) 1999-2004 VideoLAN
* $Id: vlc_playlist.h,v 1.26 2004/01/25 18:17:08 zorglub Exp $
* $Id: vlc_playlist.h,v 1.27 2004/01/29 17:51:07 zorglub Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -75,10 +75,11 @@ struct playlist_item_t
char * psz_uri; /**< mrl of this item */
mtime_t i_duration; /**< A hint about the duration of this
* item, in milliseconds*/
int i_categories; /**< Number of info categories */
item_info_category_t **pp_categories;
/**< Pointer to the first info category */
int i_status; /**< unused yet */
int i_categories; /**< Number of info categories */
item_info_category_t **
pp_categories; /**< Pointer to the first info category */
int i_options; /**< Number of options */
char ** ppsz_options; /**< Array of options */
int i_nb_played; /**< How many times was this item played ? */
vlc_bool_t b_autodeletion; /**< Indicates whther this item is to
* be deleted after playback. True mean
......@@ -86,8 +87,9 @@ struct playlist_item_t
* after playback, false otherwise */
vlc_bool_t b_enabled; /**< Indicates whether this item is to be
* played or skipped */
int i_group; /**< Which group does this item belongs to ? */
int i_group; /**< Which group does this item belongs to ? */
int i_id; /**< Unique id to track this item */
vlc_mutex_t lock; /**< Item cannot be changed without this lock */
};
/**
......@@ -165,11 +167,18 @@ void playlist_Destroy ( playlist_t * );
VLC_EXPORT( void, playlist_Command, ( playlist_t *, playlist_command_t, int ) );
/* Item functions */
/* Item management functions */
#define playlist_AddItem(p,pi,i1,i2) playlist_ItemAdd(p,pi,i1,i2)
#define playlist_ItemNew( a , b, c ) __playlist_ItemNew(VLC_OBJECT(a) , b , c )
VLC_EXPORT( playlist_item_t* , __playlist_ItemNew, ( vlc_object_t *,const char *,const char * ) );
VLC_EXPORT( void, playlist_ItemDelete, ( playlist_item_t * ) );
VLC_EXPORT( int, playlist_ItemAdd, ( playlist_t *, playlist_item_t *, int, int ) );
/* Simple add/remove funcctions */
VLC_EXPORT( int, playlist_Add, ( playlist_t *, const char *, const char *, int, int ) );
VLC_EXPORT( int, playlist_AddWDuration, ( playlist_t *, const char *, const char *, int, int, mtime_t ) );
/* For internal use. Do not use this one anymore */
VLC_EXPORT( int, playlist_AddItem, ( playlist_t *, playlist_item_t *, int, int ) );
VLC_EXPORT( int, playlist_AddExt, ( playlist_t *, const char *, const char *, int, int, mtime_t, const char **,int ) );
VLC_EXPORT( int, playlist_Clear, ( playlist_t * ) );
VLC_EXPORT( int, playlist_Delete, ( playlist_t *, int ) );
VLC_EXPORT( int, playlist_Disable, ( playlist_t *, int ) );
......@@ -178,13 +187,18 @@ VLC_EXPORT( int, playlist_DisableGroup, ( playlist_t *, int ) );
VLC_EXPORT( int, playlist_EnableGroup, ( playlist_t *, int ) );
/* Basic item informations accessors */
VLC_EXPORT( int, playlist_SetGroup, (playlist_t *, int, int ) );
VLC_EXPORT( int, playlist_SetName, (playlist_t *, int, char * ) );
VLC_EXPORT( int, playlist_SetDuration, (playlist_t *, int, mtime_t ) );
VLC_EXPORT( int, playlist_ItemSetGroup, (playlist_item_t *, int ) );
VLC_EXPORT( int, playlist_ItemSetName, (playlist_item_t *, char * ) );
VLC_EXPORT( int, playlist_ItemSetDuration, (playlist_item_t *, mtime_t ) );
VLC_EXPORT( int, playlist_SetGroup, (playlist_t * , int , int ) );
VLC_EXPORT( int, playlist_SetName, (playlist_t *, int , char * ) );
VLC_EXPORT( int, playlist_SetDuration, (playlist_t *, int , mtime_t ) );
/* Item search functions */
VLC_EXPORT( int, playlist_GetPositionById, (playlist_t *, int) );
VLC_EXPORT( playlist_item_t *, playlist_GetItemById, (playlist_t *, int) );
VLC_EXPORT( playlist_item_t *, playlist_ItemGetById, (playlist_t *, int) );
VLC_EXPORT( playlist_item_t *, playlist_ItemGetByPos, (playlist_t *, int) );
/* Group management functions */
......@@ -195,20 +209,20 @@ VLC_EXPORT( int, playlist_GroupToId, (playlist_t *, char * ) );
/* Info functions */
VLC_EXPORT( char * , playlist_GetInfo, ( playlist_t * , int, const char *, const char *) );
VLC_EXPORT( char * , playlist_GetItemInfo, ( playlist_item_t * , const char *, const char *) );
VLC_EXPORT( char * , playlist_ItemGetInfo, ( playlist_item_t * , const char *, const char *) );
VLC_EXPORT( item_info_category_t*, playlist_GetCategory, ( playlist_t *, int, const char *) );
VLC_EXPORT( item_info_category_t*, playlist_GetItemCategory, ( playlist_item_t *, const char *) );
VLC_EXPORT( item_info_category_t*, playlist_ItemGetCategory, ( playlist_item_t *, const char *) );
VLC_EXPORT( item_info_category_t*, playlist_CreateCategory, ( playlist_t *, int, const char *) );
VLC_EXPORT( item_info_category_t*, playlist_CreateItemCategory, ( playlist_item_t *, const char *) );
VLC_EXPORT( item_info_category_t*, playlist_ItemCreateCategory, ( playlist_item_t *, const char *) );
VLC_EXPORT( int, playlist_AddInfo, (playlist_t *, int, const char * , const char *, const char *, ...) );
VLC_EXPORT( int, playlist_AddItemInfo, (playlist_item_t *, const char * , const char *, const char *, ...) );
VLC_EXPORT( int, playlist_ItemAddInfo, (playlist_item_t *, const char * , const char *, const char *, ...) );
/* Option functions */
VLC_EXPORT( int, playlist_AddOption, (playlist_t *, int, const char *, ...) );
VLC_EXPORT( int, playlist_AddItemOption, (playlist_item_t *, const char *, ...) );
VLC_EXPORT( int, playlist_AddOption, (playlist_t *, int, const char *) );
VLC_EXPORT( int, playlist_ItemAddOption, (playlist_item_t *, const char *) );
/* Playlist sorting */
#define playlist_SortID(p, i) playlist_Sort( p, SORT_ID, i)
......
......@@ -2,7 +2,7 @@
* cddax.c : CD digital audio input module for vlc using libcdio
*****************************************************************************
* Copyright (C) 2000,2003 VideoLAN
* $Id: access.c,v 1.22 2004/01/07 07:21:31 rocky Exp $
* $Id: access.c,v 1.23 2004/01/29 17:51:07 zorglub Exp $
*
* Authors: Rocky Bernstein <rocky@panix.com>
* Laurent Aimar <fenrir@via.ecp.fr>
......@@ -314,8 +314,13 @@ static void CDDASeek( input_thread_t * p_input, off_t i_off )
if ( str ) { \
dbg_print( INPUT_DBG_META, "field %s: %s\n", title, str); \
input_AddInfo( p_cat, _(title), "%s", str ); \
playlist_AddInfo( p_playlist, -1, p_cat->psz_name, \
vlc_mutex_lock( &p_playlist->object_lock ); \
p_item = playlist_ItemGetByPos( p_playlist, -1 ); \
vlc_mutex_unlock( &p_playlist->object_lock ); \
vlc_mutex_lock( &p_item->lock ); \
playlist_ItemAddInfo( p_item, p_cat->psz_name, \
_(title), "%s" , str ); \
vlc_mutex_unlock( &p_item->lock ); \
}
......@@ -325,9 +330,10 @@ static void InformationCreate( input_thread_t *p_input )
playlist_t *p_playlist = vlc_object_find( p_input, VLC_OBJECT_PLAYLIST,
FIND_PARENT );
input_info_category_t *p_cat;
playlist_item_t *p_item;
p_cat = input_InfoCategory( p_input, "General" );
#ifdef HAVE_LIBCDDB
if (p_cdda->i_cddb_enabled) {
......@@ -669,6 +675,7 @@ CDDACreatePlayListItem(const input_thread_t *p_input, cdda_data_t *p_cdda,
char *p_author;
char *p_title;
char *config_varname = MODULE_STRING "-title-format";
playlist_item_t *p_item;
#ifdef HAVE_LIBCDDB
if (p_cdda->i_cddb_enabled) {
......@@ -685,54 +692,63 @@ CDDACreatePlayListItem(const input_thread_t *p_input, cdda_data_t *p_cdda,
dbg_print( INPUT_DBG_META, "mrl: %s, title: %s, duration, %ld, pos %d",
psz_mrl, p_title, (long int) i_duration / 1000000 , i_pos );
playlist_AddWDuration( p_playlist, psz_mrl, p_title, playlist_operation,
i_pos, i_duration );
playlist_AddExt( p_playlist, psz_mrl, p_title, playlist_operation,
i_pos, i_duration , NULL, 0);
if( i_pos == PLAYLIST_END ) i_pos = p_playlist->i_size - 1;
vlc_mutex_lock( &p_playlist->object_lock );
p_item = playlist_ItemGetByPos( p_playlist, i_pos );
vlc_mutex_unlock( &p_playlist->object_lock );
if( !p_item )
return;
vlc_mutex_lock( &p_item->lock );
p_author =
CDDAFormatStr( p_input, p_cdda,
config_GetPsz( p_input, MODULE_STRING "-author-format" ),
psz_mrl, i_track );
playlist_AddInfo( p_playlist, i_pos, _("General"),_("Author"), p_author);
playlist_ItemAddInfo( p_item , _("General"),_("Author"), p_author);
#ifdef HAVE_LIBCDDB
if (p_cdda->i_cddb_enabled) {
const char *psz_general_cat = _("General");
playlist_AddInfo( p_playlist, i_pos, psz_general_cat, _("Album"),
"%s", p_cdda->cddb.disc->title);
playlist_AddInfo( p_playlist, i_pos, psz_general_cat, _("Disc Artist(s)"),
"%s", p_cdda->cddb.disc->artist);
playlist_AddInfo( p_playlist, i_pos, psz_general_cat,
_("CDDB Disc Category"),
"%s", CDDB_CATEGORY[p_cdda->cddb.disc->category]);
playlist_AddInfo( p_playlist, i_pos, psz_general_cat, _("Genre"),
"%s", p_cdda->cddb.disc->genre);
playlist_ItemAddInfo( p_item, psz_general_cat, _("Album"),
"%s", p_cdda->cddb.disc->title);
playlist_ItemAddInfo( p_item, psz_general_cat, _("Disc Artist(s)"),
"%s", p_cdda->cddb.disc->artist);
playlist_ItemAddInfo( p_item, psz_general_cat,
_("CDDB Disc Category"),
"%s", CDDB_CATEGORY[p_cdda->cddb.disc->category]);
playlist_ItemAddInfo( p_item, psz_general_cat, _("Genre"),
"%s", p_cdda->cddb.disc->genre);
if ( p_cdda->cddb.disc->discid ) {
playlist_AddInfo( p_playlist, i_pos, psz_general_cat, _("CDDB Disc ID"),
"%x", p_cdda->cddb.disc->discid );
playlist_ItemAddInfo( p_item, psz_general_cat, _("CDDB Disc ID"),
"%x", p_cdda->cddb.disc->discid );
}
if (p_cdda->cddb.disc->year != 0) {
playlist_AddInfo( p_playlist, i_pos, psz_general_cat,
_("Year"), "%5d", p_cdda->cddb.disc->year );
playlist_ItemAddInfo( p_item, psz_general_cat,
_("Year"), "%5d", p_cdda->cddb.disc->year );
}
if (p_cdda->i_cddb_enabled) {
cddb_track_t *t=cddb_disc_get_track(p_cdda->cddb.disc,
i_track-1);
i_track-1);
if (t != NULL && t->artist != NULL) {
playlist_AddInfo( p_playlist, i_pos, psz_general_cat,
_("Track Artist"), "%s", t->artist );
playlist_AddInfo( p_playlist, i_pos, psz_general_cat,
_("Track Title"), "%s", t->title );
playlist_ItemAddInfo( p_item, psz_general_cat,
_("Track Artist"), "%s", t->artist );
playlist_ItemAddInfo( p_item , psz_general_cat,
_("Track Title"), "%s", t->title );
}
}
}
#endif /*HAVE_LIBCDDB*/
vlc_mutex_unlock( &p_item->lock );
}
static int
......
......@@ -4,7 +4,7 @@
* to go here.
*****************************************************************************
* Copyright (C) 2000, 2003, 2004 VideoLAN
* $Id: access.c,v 1.17 2004/01/25 04:53:16 rocky Exp $
* $Id: access.c,v 1.18 2004/01/29 17:51:07 zorglub Exp $
*
* Authors: Rocky Bernstein <rocky@panix.com>
* Johan Bilien <jobi@via.ecp.fr>
......@@ -1003,37 +1003,53 @@ VCDUpdateVar( input_thread_t *p_input, int i_num, int i_action,
static inline void
MetaInfoAddStr(input_thread_t *p_input, input_info_category_t *p_cat,
playlist_t *p_playlist, char *title,
const char *str)
MetaInfoAddStr(input_thread_t *p_input, input_info_category_t *p_cat,
playlist_t *p_playlist, char *title,
const char *str)
{
thread_vcd_data_t *p_vcd = (thread_vcd_data_t *) p_input->p_access_data;
if ( str ) {
playlist_item_t *p_item;
if ( str ) {
dbg_print( INPUT_DBG_META, "field: %s: %s\n", title, str);
input_AddInfo( p_cat, title, "%s", str );
playlist_AddInfo( p_playlist, -1, p_cat->psz_name, title,
"%s",str );
input_AddInfo( p_cat, title, "%s", str );
vlc_mutex_lock( &p_playlist->object_lock );
p_item = playlist_ItemGetByPos( p_playlist, -1 );
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_mutex_lock( &p_item->lock );
playlist_ItemAddInfo( p_item, p_cat->psz_name, title,
"%s",str );
vlc_mutex_unlock( &p_item->lock );
}
}
static inline void
MetaInfoAddNum(input_thread_t *p_input, input_info_category_t *p_cat,
playlist_t *p_playlist, char *title, int num)
MetaInfoAddNum(input_thread_t *p_input, input_info_category_t *p_cat,
playlist_t *p_playlist, char *title, int num)
{
thread_vcd_data_t *p_vcd = (thread_vcd_data_t *) p_input->p_access_data;
playlist_item_t *p_item;
vlc_mutex_lock( &p_playlist->object_lock );
p_item = playlist_ItemGetByPos( p_playlist, -1 );
vlc_mutex_unlock( &p_playlist->object_lock );
dbg_print( INPUT_DBG_META, "field %s: %d\n", title, num);
input_AddInfo( p_cat, title, "%d", num );
playlist_AddInfo( p_playlist, -1, p_cat->psz_name, title,
"%d",num );
vlc_mutex_lock( &p_item->lock );
playlist_ItemAddInfo( p_item , p_cat->psz_name, title, "%d",num );
vlc_mutex_unlock( &p_item->lock );
}
#define addstr(title, str) \
MetaInfoAddStr( p_input, p_cat, p_playlist, title, str );
#define addnum(title, num) \
MetaInfoAddNum( p_input, p_cat, p_playlist, title, num );
static void InformationCreate( input_thread_t *p_input )
{
thread_vcd_data_t *p_vcd = (thread_vcd_data_t *) p_input->p_access_data;
......
......@@ -2,7 +2,7 @@
* speex.c: speex decoder/packetizer/encoder module making use of libspeex.
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: speex.c,v 1.10 2004/01/25 18:20:12 bigben Exp $
* $Id: speex.c,v 1.11 2004/01/29 17:51:07 zorglub Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -471,8 +471,19 @@ static void ParseSpeexComments( decoder_t *p_dec, ogg_packet *p_oggpacket )
p_mode = speex_mode_list[p_sys->p_header->mode];
input_AddInfo( p_cat, _("Mode"), "%s%s",
p_mode->modeName, p_sys->p_header->vbr ? " VBR" : "" );
playlist_AddInfo( p_playlist, -1, _("Speex comment") , _("Mode"), "%s%s",
p_mode->modeName, p_sys->p_header->vbr ? " VBR" : "" );
vlc_mutex_lock( &p_playlist->object_lock );
p_item = playlist_ItemGetByPos( p_playlist, -1 );
vlc_mutex_unlock( &p_playlist->object_lock );
if( !p_item)
{
msg_Err(p_dec, "unable to find item" );
return;
}
vlc_mutex_lock( &p_item->lock );
playlist_ItemAddInfo( p_item, _("Speex comment") , _("Mode"),"%s%s",
p_mode->modeName, p_sys->p_header->vbr ? " VBR" : "" );
if( p_oggpacket->bytes < 8 )
......@@ -489,7 +500,9 @@ static void ParseSpeexComments( decoder_t *p_dec, ogg_packet *p_oggpacket )
}
input_AddInfo( p_cat, p_buf, "" );
playlist_AddInfo( p_playlist, -1, _("Speex comment") , p_buf , "" );
playlist_ItemAddInfo( p_item , _("Speex comment") , p_buf , "" );
vlc_mutex_unlock( &p_item->lock );
if( p_playlist ) vlc_object_release( p_playlist );
......
......@@ -2,7 +2,7 @@
* theora.c: theora decoder module making use of libtheora.
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: theora.c,v 1.23 2004/01/25 18:20:12 bigben Exp $
* $Id: theora.c,v 1.24 2004/01/29 17:51:07 zorglub Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -340,6 +340,7 @@ static void ParseTheoraComments( decoder_t *p_dec )
input_InfoCategory( p_input, _("Theora comment") );
playlist_t *p_playlist = vlc_object_find( p_dec, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
playlist_item_t *p_item;
int i = 0;
char *psz_name, *psz_value, *psz_comment;
while ( i < p_dec->p_sys->tc.comments )
......@@ -357,8 +358,18 @@ static void ParseTheoraComments( decoder_t *p_dec )
*psz_value = '\0';
psz_value++;
input_AddInfo( p_cat, psz_name, psz_value );
playlist_AddInfo( p_playlist, -1, _("Theora comment") ,
psz_name, psz_value );
vlc_mutex_lock( &p_playlist->object_lock );
p_item = playlist_ItemGetByPos( p_playlist, -1 );
vlc_mutex_unlock( &p_playlist->object_lock );
if( !p_item)
{
msg_Err(p_dec, "unable to find item" );
return;
}
vlc_mutex_lock( &p_item->lock );
playlist_ItemAddInfo( p_item, _("Theora comment") ,
psz_name, psz_value );
vlc_mutex_unlock( &p_item->lock );
}
free( psz_comment );
i++;
......
......@@ -2,7 +2,7 @@
* vorbis.c: vorbis decoder/encoder/packetizer module making use of libvorbis.
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: vorbis.c,v 1.30 2004/01/25 18:20:12 bigben Exp $
* $Id: vorbis.c,v 1.31 2004/01/29 17:51:07 zorglub Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -456,6 +456,7 @@ static void ParseVorbisComments( decoder_t *p_dec )
input_InfoCategory( p_input, _("Vorbis comment") );
playlist_t *p_playlist = vlc_object_find( p_dec, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
playlist_item_t *p_item;
int i = 0;
char *psz_name, *psz_value, *psz_comment;
while ( i < p_dec->p_sys->vc.comments )
......@@ -473,8 +474,18 @@ static void ParseVorbisComments( decoder_t *p_dec )
*psz_value = '\0';
psz_value++;
input_AddInfo( p_cat, psz_name, psz_value );
playlist_AddInfo( p_playlist, -1, _("Vorbis comment") ,
psz_name, psz_value );
vlc_mutex_lock( &p_playlist->object_lock );
p_item = playlist_ItemGetByPos( p_playlist, -1 );
vlc_mutex_unlock( &p_playlist->object_lock );
if( !p_item)
{
msg_Err(p_dec, "unable to find item" );
return;
}
vlc_mutex_lock( &p_item->lock );
playlist_ItemAddInfo( p_item, _("Vorbis comment") ,
psz_name, psz_value );
vlc_mutex_unlock( &p_item->lock );
}
free( psz_comment );
i++;
......
......@@ -2,7 +2,7 @@
* http.c : http mini-server ;)
*****************************************************************************
* Copyright (C) 2001-2004 VideoLAN
* $Id: http.c,v 1.50 2004/01/25 16:17:03 anil Exp $
* $Id: http.c,v 1.51 2004/01/29 17:51:07 zorglub Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
* Laurent Aimar <fenrir@via.ecp.fr>
......@@ -125,7 +125,7 @@ static void uri_decode_url_encoded( char *psz );
static char *Find_end_MRL( char *psz );
static playlist_item_t * parse_MRL( char *psz );
static playlist_item_t * parse_MRL( intf_thread_t * , char *psz );
/*****************************************************************************
*
......@@ -1764,7 +1764,7 @@ static void MacroDo( httpd_file_callback_args_t *p_args,
uri_extract_value( p_request, "mrl", mrl, 512 );
uri_decode_url_encoded( mrl );
p_item = parse_MRL( mrl );
p_item = parse_MRL( p_intf, mrl );
if( !p_item || !p_item->psz_uri || !*p_item->psz_uri )
{
......@@ -2870,7 +2870,7 @@ static char *Find_end_MRL( char *psz )
* create an item with all informations in it, and return the item.
* return NULL if there is an error.
**********************************************************************/
playlist_item_t * parse_MRL( char *psz )
playlist_item_t * parse_MRL( intf_thread_t *p_intf, char *psz )
{
char **ppsz_options = NULL;
char *mrl;
......@@ -2967,17 +2967,10 @@ playlist_item_t * parse_MRL( char *psz )
else
{
/* now create an item */
p_item = malloc( sizeof( playlist_item_t ) );
memset( p_item, 0, sizeof( playlist_item_t ) );
p_item->psz_name = mrl;
p_item->psz_uri = strdup( mrl );
p_item->i_duration = -1;
p_item->b_enabled = VLC_TRUE;
p_item->i_group = PLAYLIST_TYPE_MANUAL;
p_item = playlist_ItemNew( p_intf, mrl, mrl);
for( i = 0 ; i< i_options ; i++ )
{
playlist_AddItemOption( p_item, ppsz_options[i] );
playlist_ItemAddOption( p_item, ppsz_options[i] );
}
}
......
......@@ -2,7 +2,7 @@
* id3tag.c: id3 tag parser/skipper based on libid3tag
*****************************************************************************
* Copyright (C) 2002-2004 VideoLAN
* $Id: id3tag.c,v 1.19 2004/01/25 20:05:29 hartman Exp $
* $Id: id3tag.c,v 1.20 2004/01/29 17:51:07 zorglub Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
......@@ -85,7 +85,14 @@ 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;
playlist_item_t *p_item = playlist_ItemGetByPos( p_playlist, -1 );
if( !p_item )
{
msg_Err( p_input, "Unable to get item" );
return;
}
vlc_mutex_lock( &p_item->lock );
int i_strings = id3_field_getnstrings( &p_frame->fields[1] );
......@@ -101,7 +108,7 @@ 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",
playlist_ItemAddInfo( p_item, "ID3",
(char *)p_frame->description,
ppsz_genres[atoi(psz_temp)]);
}
......@@ -109,7 +116,7 @@ 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",
playlist_ItemAddInfo( p_item, "ID3",
(char *)p_frame->description,
psz_temp);
}
......@@ -128,7 +135,7 @@ 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",
playlist_ItemAddInfo( p_item, "ID3",
(char *)p_frame->description,
psz_temp);
}
......@@ -136,13 +143,13 @@ static void ParseID3Tag( input_thread_t *p_input, uint8_t *p_data, int i_size )
{
if( p_item )
{
playlist_AddItemInfo( p_item,
playlist_ItemAddInfo( 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",
playlist_ItemAddInfo( p_item, "ID3",
(char *)p_frame->description,
psz_temp);
}
......@@ -150,13 +157,14 @@ 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",
playlist_ItemAddInfo( p_item, "ID3",
(char *)p_frame->description,
psz_temp);
}
free( psz_temp );
}
i++;
vlc_mutex_unlock( &p_item->lock );
}
id3_tag_delete( p_id3_tag );
if(val.b_bool == VLC_TRUE )
......
......@@ -2,7 +2,7 @@
* pda_callbacks.c : Callbacks for the pda Linux Gtk+ plugin.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: pda_callbacks.c,v 1.25 2004/01/25 14:15:21 kuehne Exp $
* $Id: pda_callbacks.c,v 1.26 2004/01/29 17:51:07 zorglub Exp $
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
*
......@@ -133,16 +133,10 @@ void PlaylistAddItem(GtkWidget *widget, gchar *name, char **ppsz_options, int i_
else
#endif
{
i_id = playlist_Add( p_playlist, (const char*)name,
(const char*)name,
PLAYLIST_APPEND, PLAYLIST_END );
i_pos = playlist_GetPositionById( p_playlist, i_id );
for( i = 0 ; i< i_size ; i++ )
{
playlist_AddOption( p_playlist, i_pos , ppsz_options[i] );
}
i_id = playlist_AddExt( p_playlist, (const char*)name,
(const char*)name,
PLAYLIST_APPEND, PLAYLIST_END,
ppsz_options, i_pos );
}
/* Cleanup memory */
......
......@@ -2,7 +2,7 @@
* iteminfo.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2004 VideoLAN
* $Id: iteminfo.cpp,v 1.7 2004/01/25 03:29:01 hartman Exp $
* $Id: iteminfo.cpp,v 1.8 2004/01/29 17:51:08 zorglub Exp $
*
* Authors: Clment Stenac <zorglub@videolan.org>
*
......@@ -178,7 +178,7 @@ wxPanel *ItemInfoDialog::InfoPanel( wxWindow* parent )
author_text =
new wxTextCtrl( info_panel, Uri_Event,
wxU( playlist_GetItemInfo( p_item,
wxU( playlist_ItemGetInfo( p_item,
_("General"), _("Author") ) ),
wxDefaultPosition, wxSize( 300, -1 ),
wxTE_PROCESS_ENTER);
......@@ -305,9 +305,10 @@ void ItemInfoDialog::UpdateInfo()
*****************************************************************************/
void ItemInfoDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
{
vlc_mutex_lock( &p_item->lock );
p_item->psz_name = strdup( name_text->GetLineText(0).mb_str() );
p_item->psz_uri = strdup( uri_text->GetLineText(0).mb_str() );
playlist_AddItemInfo( p_item,"General","Author",
playlist_ItemAddInfo( p_item,"General","Author",
author_text->GetLineText(0).mb_str() );
vlc_bool_t b_old_enabled = p_item->b_enabled;
......@@ -335,6 +336,7 @@ void ItemInfoDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
}
p_item->b_enabled = enabled_checkbox->IsChecked() ? VLC_TRUE : VLC_FALSE ;
vlc_mutex_unlock( &p_item->lock );
EndModal( wxID_OK );