src/input/input_dec.c \
src/input/input_programs.c \
src/input/input_clock.c \
- src/input/input_info.c \
src/video_output/video_output.c \
src/video_output/vout_pictures.c \
src/video_output/vout_pictures.h \
off_t i_plugin_data;
};
-/**
- * \brief A list of info items.
- *
- * Composes a linked list of name/value pairs intended to inform the
- * user about the current stream
- * \see input_AddInfo
- */
-struct input_info_t {
- /**
- * Name of this item
- */
- char * psz_name;
-
- /**
- * Value of this item
- */
- char * psz_value;
-
- /**
- * Pointer to next item in list, or NULL it at end of list
- */
- input_info_t * p_next;
-};
-
-/**
- * \brief A list of info categories.
- *
- * Composes a NULL terminated linked list of categories in which to
- * place info about the stream.
- *
- * \see input_InfoCategory
- */
-struct input_info_category_t {
- /**
- * The name of this category
- */
- char * psz_name;
-
- /**
- * first element of a linked list containing info items
- */
- input_info_t * p_info;
-
- /**
- * Pointer to next element in this list, or NULL if at end of list
- */
- input_info_category_t * p_next;
-};
-
/*****************************************************************************
-* stream_descriptor_t
+ * stream_descriptor_t
*****************************************************************************
* Describes a stream and list its associated programs. Build upon
* the information carried in program association sections (for instance)
/* Optional stream output */
sout_instance_t * p_sout;
- /* Input info */
- input_info_category_t * p_info;
-
/* Statistics */
count_t c_packets_read; /* packets read */
count_t c_packets_trashed; /* trashed packets */
#define MUTE_NO_CHANGE -1
+/*****************************************************************************
+ * info_t
+ *****************************************************************************/
+
+/**
+ * Info item
+ */
+
+struct info_t
+{
+ char *psz_name; /**< Name of this info */
+ char *psz_value; /**< Value of the info */
+};
+
+/**
+ * Info category
+ * \see info_t
+ */
+struct info_category_t
+{
+ char *psz_name; /**< Name of this category */
+ int i_infos; /**< Number of infos in the category */
+ struct info_t **pp_infos; /**< Pointer to an array of infos */
+};
+
+/*****************************************************************************
+ * input_item_t
+ *****************************************************************************
+ * Describes an input and is used to spawn input_thread_t objects.
+ *****************************************************************************/
+struct input_item_t
+{
+ char *psz_name; /**< text describing this item */
+ char *psz_uri; /**< mrl of this item */
+
+ int i_options; /**< Number of input options */
+ char **ppsz_options; /**< Array of input options */
+
+ mtime_t i_duration; /**< A hint about the duration of this
+ * item, in milliseconds*/
+
+ int i_categories; /**< Number of info categories */
+ info_category_t **pp_categories; /**< Pointer to the first info category */
+
+ vlc_mutex_t lock; /**< Item cannot be changed without this lock */
+};
+
/*****************************************************************************
* input_thread_t
*****************************************************************************
/* General stream description */
stream_descriptor_t stream;
+ /* Input item description */
+ input_item_t *p_item;
+
/* Playlist item */
char * psz_source;
char * psz_dupsource;
/*****************************************************************************
* Prototypes
*****************************************************************************/
-#define input_CreateThread(a,b,c,d) __input_CreateThread(VLC_OBJECT(a),b,c,d)
-VLC_EXPORT( input_thread_t *, __input_CreateThread, ( vlc_object_t *, char *psz_uri, char **ppsz_options, int i_options ) );
+#define input_CreateThread(a,b) __input_CreateThread(VLC_OBJECT(a),b)
+VLC_EXPORT( input_thread_t *, __input_CreateThread, ( vlc_object_t *, input_item_t * ) );
VLC_EXPORT( void, input_StopThread, ( input_thread_t * ) );
VLC_EXPORT( void, input_DestroyThread, ( input_thread_t * ) );
VLC_EXPORT( void, input_ClockManageRef, ( input_thread_t *, pgrm_descriptor_t *, mtime_t ) );
VLC_EXPORT( mtime_t, input_ClockGetTS, ( input_thread_t *, pgrm_descriptor_t *, mtime_t ) );
-/*****************************************************************************
- * Prototypes from input_info.c
- *****************************************************************************/
-VLC_EXPORT( input_info_category_t *, input_InfoCategory, ( input_thread_t *, char * ) );
-VLC_EXPORT( int, input_AddInfo, ( input_info_category_t *, char *, char *, ... ) );
-int input_DelInfo( input_thread_t * p_input ); /* no need to export this */
-
/*****************************************************************************
* Prototypes from input_ext-plugins.h (buffers management)
*****************************************************************************/
INPUT_DEL_BOOKMARK, /* arg1= seekpoint_t * res=can fail */
INPUT_SET_BOOKMARK, /* arg1= int res=can fail */
+ INPUT_ADD_OPTION, /* arg1= char * arg2= char * res=can fail */
+
+ INPUT_ADD_INFO, /* arg1= char * arg2= char * arg3=... res=can fail */
+
+ INPUT_SET_NAME, /* arg1= char * res=can fail */
+
INPUT_GET_SUBDELAY, /* arg1 = int* res=can fail */
INPUT_SET_SUBDELAY, /* arg1 = int res=can fail */
* intf.h: interface header for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: intf.h,v 1.4 2004/01/25 18:17:08 zorglub Exp $
+ * $Id$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*****************************************************************************/
#include "vlc_interface.h"
#include "intf_eject.h"
-#include "vlc_playlist.h"
#include "stream_control.h"
#include "input_ext-intf.h"
+#include "vlc_playlist.h"
# ifdef __cplusplus
}
typedef struct playlist_t playlist_t;
typedef struct playlist_item_t playlist_item_t;
typedef struct playlist_group_t playlist_group_t;
-typedef struct item_info_t item_info_t;
-typedef struct item_info_category_t item_info_category_t;
typedef struct playlist_export_t playlist_export_t;
/* Modules */
/* Input */
typedef struct input_thread_t input_thread_t;
typedef struct input_thread_sys_t input_thread_sys_t;
+typedef struct input_item_t input_item_t;
typedef struct input_area_t input_area_t;
typedef struct input_buffers_t input_buffers_t;
typedef struct input_socket_t input_socket_t;
-typedef struct input_info_t input_info_t;
-typedef struct input_info_category_t input_info_category_t;
typedef struct access_sys_t access_sys_t;
typedef struct demux_sys_t demux_sys_t;
typedef struct es_descriptor_t es_descriptor_t;
typedef struct pgrm_sys_t pgrm_sys_t;
typedef struct stream_descriptor_t stream_descriptor_t;
typedef struct seekpoint_t seekpoint_t;
+typedef struct info_t info_t;
+typedef struct info_category_t info_category_t;
/* Format */
typedef struct audio_format_t audio_format_t;
* vlc_playlist.h : Playlist functions
*****************************************************************************
* Copyright (C) 1999-2004 VideoLAN
- * $Id: vlc_playlist.h,v 1.27 2004/01/29 17:51:07 zorglub Exp $
+ * $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* @{
*/
-/**
- * Playlist info item
- * \see playlist_item_t
- */
-
-struct item_info_t
-{
- char * psz_name; /**< Name of this info */
- char * psz_value; /**< Value of the info */
-};
-
-/**
- * playlist item info category
- * \see playlist_item_t
- * \see item_info_t
- */
-struct item_info_category_t
-{
- char * psz_name; /**< Name of this category */
- int i_infos; /**< Number of infos in the category */
- item_info_t **pp_infos; /**< Pointer to an array of infos */
-};
-
/**
* playlist export helper structure
*/
*/
struct playlist_item_t
{
- char * psz_name; /**< text describing this item */
- 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_options; /**< Number of options */
- char ** ppsz_options; /**< Array of options */
+ input_item_t input; /**< input item descriptor */
+
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
* played or skipped */
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 */
};
/**
VLC_EXPORT( char * , playlist_GetInfo, ( playlist_t * , int, 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_ItemGetCategory, ( playlist_item_t *, const char *) );
+VLC_EXPORT( 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_ItemCreateCategory, ( playlist_item_t *, const char *) );
+VLC_EXPORT( 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_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_ItemAddOption, (playlist_item_t *, const char *) );
/* Playlist sorting */
char **option;
/* global options for all inputs */
- char **input_option;
- int i_input_option;
+ input_item_t item;
input_thread_t *p_input;
} vlm_media_t;
}
#endif
-#define meta_info_add_str(title, str) \
- if ( str ) { \
- dbg_print( INPUT_DBG_META, "field %s: %s\n", title, 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 void InformationCreate( input_thread_t *p_input )
{
cdda_data_t *p_cdda = (cdda_data_t *) p_input->p_access_data;
- playlist_t *p_playlist = vlc_object_find( p_input, VLC_OBJECT_PLAYLIST,
- FIND_PARENT );
- input_info_category_t *p_cat;
-
- p_cat = input_InfoCategory( p_input, "General" );
-
#ifdef HAVE_LIBCDDB
if (p_cdda->i_cddb_enabled) {
- playlist_item_t *p_item;
-
- meta_info_add_str( "Title", p_cdda->cddb.disc->title );
- meta_info_add_str( "Artist", p_cdda->cddb.disc->artist );
- meta_info_add_str( "Genre", p_cdda->cddb.disc->genre );
- meta_info_add_str( "Extended Data", p_cdda->cddb.disc->ext_data );
- {
- char year[5];
- if (p_cdda->cddb.disc->year != 0) {
- snprintf(year, 5, "%d", p_cdda->cddb.disc->year);
- meta_info_add_str( "Year", year );
- }
- if ( p_cdda->cddb.disc->discid ) {
- input_AddInfo( p_cat, _("CDDB Disc ID"), "%x",
- p_cdda->cddb.disc->discid );
- }
-
- if ( p_cdda->cddb.disc->category != CDDB_CAT_INVALID ) {
- input_AddInfo( p_cat, _("CDDB Disc Category"), "%s",
- CDDB_CATEGORY[p_cdda->cddb.disc->category] );
- }
- }
+ dbg_print( INPUT_DBG_META, "field %s: %s\n", "Title",
+ p_cdda->cddb.disc->title );
+ input_Control( p_input, INPUT_ADD_INFO, _("General"), _("Title"),
+ "%s", p_cdda->cddb.disc->title );
+
+ dbg_print( INPUT_DBG_META, "field %s: %s\n", "Artist",
+ p_cdda->cddb.disc->artist );
+ input_Control( p_input, INPUT_ADD_INFO, _("General"), _("Artist"),
+ "%s", p_cdda->cddb.disc->artist );
+
+ dbg_print( INPUT_DBG_META, "field %s: %s\n", "Genre",
+ p_cdda->cddb.disc->genre );
+ input_Control( p_input, INPUT_ADD_INFO, _("General"), _("Genre"),
+ "%s", p_cdda->cddb.disc->genre );
+
+ dbg_print( INPUT_DBG_META, "field %s: %s\n", "Extended Data",
+ p_cdda->cddb.disc->ext_data );
+ input_Control( p_input, INPUT_ADD_INFO, _("General"), _("Extended Data"),
+ "%s", p_cdda->cddb.disc->ext_data );
+
+ if (p_cdda->cddb.disc->year != 0)
+ input_Control( p_input, INPUT_ADD_INFO, _("General"),
+ _("Year"), "%d", p_cdda->cddb.disc->year );
+ if ( p_cdda->cddb.disc->discid )
+ input_Control( p_input, INPUT_ADD_INFO, _("General"),
+ _("CDDB Disc ID"), "%x", p_cdda->cddb.disc->discid );
+
+ if ( p_cdda->cddb.disc->category != CDDB_CAT_INVALID )
+ input_Control( p_input, INPUT_ADD_INFO, _("General"),
+ _("CDDB Disc Category"), "%s",
+ CDDB_CATEGORY[p_cdda->cddb.disc->category] );
}
#endif /*HAVE_LIBCDDB*/
/ CDIO_CD_FRAMES_PER_SEC;
dbg_print( INPUT_DBG_META, "Duration %ld", (long int) i_duration );
- input_AddInfo( p_cat, _("Duration"), "%s",
- secstotimestr( psz_buffer, i_duration ) );
+ input_Control( p_input, INPUT_ADD_INFO, _("General"), _("Duration"), "%s",
+ secstotimestr( psz_buffer, i_duration ) );
for( i_track = 0 ; i_track < p_cdda->i_nb_tracks ; i_track++ ) {
char track_str[TITLE_MAX];
mtime_t i_duration =
- (p_cdda->p_sectors[i_track+1] - p_cdda->p_sectors[i_track])
- / CDIO_CD_FRAMES_PER_SEC;
+ (p_cdda->p_sectors[i_track+1] - p_cdda->p_sectors[i_track])
+ / CDIO_CD_FRAMES_PER_SEC;
snprintf(track_str, TITLE_MAX, "%s %02d", _("Track"), i_track+1);
- p_cat = input_InfoCategory( p_input, track_str );
- input_AddInfo( p_cat, _("Duration"), "%s",
- secstotimestr( psz_buffer, i_duration ) );
+ input_Control( p_input, INPUT_ADD_INFO, track_str, _("Duration"), "%s",
+ secstotimestr( psz_buffer, i_duration ) );
#ifdef HAVE_LIBCDDB
if (p_cdda->i_cddb_enabled) {
cddb_track_t *t=cddb_disc_get_track(p_cdda->cddb.disc,
i_track);
if (t != NULL) {
- if ( t->artist != NULL && strlen(t->artist) ) {
- input_AddInfo( p_cat, _("Artist"), "%s", t->artist );
- }
- if ( t->title != NULL && strlen(t->title) ) {
- input_AddInfo( p_cat, _("Title"), "%s", t->title );
- }
- if ( t->ext_data != NULL && strlen(t->ext_data) ) {
- input_AddInfo( p_cat, _("Extended Data"), "%s", t->ext_data );
- }
- }
+ if ( t->artist != NULL && strlen(t->artist) ) {
+ input_Control( p_input, INPUT_ADD_INFO, track_str,
+ _("Artist"), "%s", t->artist );
+ }
+ if ( t->title != NULL && strlen(t->title) ) {
+ input_Control( p_input, INPUT_ADD_INFO, track_str,
+ _("Title"), "%s", t->title );
+ }
+ if ( t->ext_data != NULL && strlen(t->ext_data) ) {
+ input_Control( p_input, INPUT_ADD_INFO, track_str,
+ _("Extended Data"), "%s", t->ext_data );
+ }
+ }
}
#endif
}
}
-
- if( p_playlist ) vlc_object_release( p_playlist );
}
if( !p_item )
return;
- vlc_mutex_lock( &p_item->lock );
+ vlc_mutex_lock( &p_item->input.lock );
p_author =
CDDAFormatStr( p_input, p_cdda,
}
#endif /*HAVE_LIBCDDB*/
- vlc_mutex_unlock( &p_item->lock );
+ vlc_mutex_unlock( &p_item->input.lock );
}
static int
* slp.c: SLP access plugin
*****************************************************************************
* Copyright (C) 2002-2004 VideoLAN
- * $Id: slp.c,v 1.20 2004/01/25 17:31:22 gbazin Exp $
+ * $Id$
*
* Authors: LoĂŻc Minier <lool@videolan.org>
*
return SLP_TRUE;
}
- p_playlist_item->psz_name = strdup(psz_attrlist); /* NULL is checked */
+ if( p_playlist_item->input.psz_name )
+ free( p_playlist_item->input.psz_name );
+
+ p_playlist_item->input.psz_name = strdup(psz_attrlist); /* NULL is checked */
return SLP_TRUE;
}
SLPError slpe_errcode,
void * p_cookie )
{
- input_thread_t * p_input = (input_thread_t *)p_cookie;
+ input_thread_t *p_input = (input_thread_t *)p_cookie;
playlist_t * p_playlist;
char psz_item[42] = ""; //"udp:@";
char * psz_s; /* to hold the uri of the stream */
return SLP_TRUE;
}
- msg_Dbg(p_input,"URL: %s",psz_srvurl);
+ msg_Dbg( p_input,"URL: %s", psz_srvurl );
/* or there was a problem with getting the data we requested */
if( (slpe_errcode != SLP_OK) )
psz_s = strstr( psz_srvurl, "//" );
if( psz_s == NULL )
{
- msg_Err( (input_thread_t *)p_input,
+ msg_Err( p_input,
"SrvUrlCallback got a strange string of your libslp" );
return SLP_TRUE;
}
sizeof(psz_item) - strlen(psz_item) - 1 );
/* create a playlist item */
- p_playlist_item = malloc( sizeof( playlist_item_t ) );
- memset( p_playlist_item, 0, sizeof( playlist_item_t ) );
+ p_playlist_item = playlist_ItemNew( p_input, psz_s, NULL );
if( p_playlist_item == NULL )
{
msg_Err( p_input, "out of memory" );
return SLP_TRUE;
}
- p_playlist_item->psz_name = NULL;
- p_playlist_item->psz_uri = strdup( psz_s );
- p_playlist_item->i_duration = -1;
p_playlist_item->i_group = i_group;
p_playlist_item->b_enabled = VLC_TRUE;
SLPClose( slph_slp3 );
}
- /* add a default name if we found no attribute */
- if( p_playlist_item->psz_name == NULL )
- {
- p_playlist_item->psz_name = strdup( psz_s );
- }
-
/* search the main playlist object */
- p_playlist = vlc_object_find( (input_thread_t *)p_input,
- VLC_OBJECT_PLAYLIST,
+ p_playlist = vlc_object_find( p_input, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
- msg_Warn( (input_thread_t *)p_input,
- "could not find playlist, not adding entries" );
+ msg_Warn( p_input, "could not find playlist, not adding entries" );
return SLP_TRUE;
}
- playlist_AddItem( p_playlist,
- p_playlist_item,
- PLAYLIST_APPEND,
- PLAYLIST_END );
- vlc_object_release( (vlc_object_t *)p_playlist );
+ playlist_AddItem( p_playlist, p_playlist_item,
+ PLAYLIST_APPEND, PLAYLIST_END );
+ vlc_object_release( p_playlist );
- msg_Info( (input_thread_t *)p_input,
- "added « %s » (lifetime %i) to playlist",
- psz_srvurl, i_lifetime );
+ msg_Info( p_input, "added « %s » (lifetime %i) to playlist",
+ psz_srvurl, i_lifetime );
return SLP_TRUE;
}
* Preamble
*****************************************************************************/
#include <vlc/vlc.h>
-#include <vlc/input.h> /* for input infos */
#include <vlc/decoder.h>
#include <vlc/aout.h>
if( p_dec->fmt_out.audio.i_rate != p_sys->i_rate )
{
-#define TITLE_MAX 30
- input_info_category_t *p_cat;
- char psz_streamid[TITLE_MAX];
- int i_es_id = p_dec->fmt_out.i_id;
- input_thread_t * p_input = vlc_object_find( p_dec, VLC_OBJECT_INPUT, FIND_PARENT );
+ msg_Info( p_dec, "MPGA channels:%d samplerate:%d bitrate:%d",
+ p_sys->i_channels, p_sys->i_rate, p_sys->i_bit_rate );
- if( p_input )
- {
- snprintf(psz_streamid, TITLE_MAX, "%s%04x", _("Stream "), i_es_id);
- p_cat = input_InfoCategory( p_input, psz_streamid );
-
-#if 1
- /* We should be finding this stream, but we aren't. */
- input_AddInfo( p_cat, _("Type"), "%s", _("audio") );
- input_AddInfo( p_cat, _("Description"), "%s", _("MPEG audio") );
-#endif
-
- input_AddInfo( p_cat, _("Sample Rate"), "%d", p_sys->i_rate );
- input_AddInfo( p_cat, _("Bit Rate"), "%d", p_sys->i_bit_rate );
- input_AddInfo( p_cat, _("Channel(s)"), "%d", p_sys->i_channels );
-
- msg_Info( p_dec, "MPGA channels:%d samplerate:%d bitrate:%d",
- p_sys->i_channels, p_sys->i_rate, p_sys->i_bit_rate );
-
- aout_DateInit( &p_sys->end_date, p_sys->i_rate );
- aout_DateSet( &p_sys->end_date, p_sys->i_pts );
-
- vlc_object_release( p_input );
- }
+ aout_DateInit( &p_sys->end_date, p_sys->i_rate );
+ aout_DateSet( &p_sys->end_date, p_sys->i_pts );
}
p_dec->fmt_out.audio.i_rate = p_sys->i_rate;
* speex.c: speex decoder/packetizer/encoder module making use of libspeex.
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: speex.c,v 1.13 2004/02/22 15:57:41 fenrir Exp $
+ * $Id$
*
- * Authors: Gildas Bazin <gbazin@netcourrier.com>
+ * Authors: Gildas Bazin <gbazin@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*****************************************************************************/
#include <vlc/vlc.h>
#include <vlc/decoder.h>
-#include <vlc/input.h>
-#include "vlc_playlist.h"
#include <ogg/ogg.h>
#include <speex.h>
input_thread_t *p_input = (input_thread_t *)p_dec->p_parent;
decoder_sys_t *p_sys = p_dec->p_sys;
- input_info_category_t *p_cat =
- input_InfoCategory( p_input, _("Speex comment") );
- playlist_t *p_playlist = vlc_object_find( p_dec, VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
- playlist_item_t *p_item;
-
char *p_buf = (char *)p_oggpacket->packet;
SpeexMode *p_mode;
int i_len;
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" : "" );
- 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" : "" );
+ input_Control( p_input, INPUT_ADD_INFO, _("Speex comment"), _("Mode"),
+ "%s%s", p_mode->modeName,
+ p_sys->p_header->vbr ? " VBR" : "" );
if( p_oggpacket->bytes < 8 )
{
return;
}
- input_AddInfo( p_cat, p_buf, "" );
- playlist_ItemAddInfo( p_item , _("Speex comment") , p_buf , "" );
-
- vlc_mutex_unlock( &p_item->lock );
-
- if( p_playlist ) vlc_object_release( p_playlist );
+ input_Control( p_input, INPUT_ADD_INFO, _("Speex comment"), p_buf, "" );
/* TODO: finish comments parsing */
}
* theora.c: theora decoder module making use of libtheora.
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: theora.c,v 1.24 2004/01/29 17:51:07 zorglub Exp $
+ * $Id$
*
- * Authors: Gildas Bazin <gbazin@netcourrier.com>
+ * Authors: Gildas Bazin <gbazin@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*****************************************************************************/
#include <vlc/vlc.h>
#include <vlc/decoder.h>
-#include "input_ext-plugins.h"
-#include "vlc_playlist.h"
#include <ogg/ogg.h>
static void ParseTheoraComments( decoder_t *p_dec )
{
input_thread_t *p_input = (input_thread_t *)p_dec->p_parent;
- input_info_category_t *p_cat =
- 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 )
{
*psz_value = '\0';
psz_value++;
- input_AddInfo( p_cat, 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 );
+ input_Control( p_input, INPUT_ADD_INFO, _("Theora comment"),
+ psz_name, psz_value );
}
free( psz_comment );
i++;
}
- if( p_playlist) vlc_object_release( p_playlist );
}
/*****************************************************************************
* vorbis.c: vorbis decoder/encoder/packetizer module making use of libvorbis.
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
- * $Id: vorbis.c,v 1.32 2004/02/22 15:57:41 fenrir Exp $
+ * $Id$
*
- * Authors: Gildas Bazin <gbazin@netcourrier.com>
+ * Authors: Gildas Bazin <gbazin@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*****************************************************************************/
#include <vlc/vlc.h>
#include <vlc/decoder.h>
-#include <vlc/input.h>
-#include "vlc_playlist.h"
#include <ogg/ogg.h>
static void ParseVorbisComments( decoder_t *p_dec )
{
input_thread_t *p_input = (input_thread_t *)p_dec->p_parent;
- input_info_category_t *p_cat =
- 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 )
{
*psz_value = '\0';
psz_value++;
- input_AddInfo( p_cat, 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 );
+ input_Control( p_input, INPUT_ADD_INFO, _("Vorbis comment"),
+ psz_name, psz_value );
}
free( psz_comment );
i++;
}
- if( p_playlist ) vlc_object_release( p_playlist );
}
/*****************************************************************************
if( p_playlist )
{
mtime_t dur =
- p_playlist->pp_items[p_playlist->i_index]->i_duration;
+ p_playlist->pp_items[p_playlist->i_index]->input.i_duration;
i_seconds = time.i_time / 1000000;
secstotimestr ( psz_time, i_seconds );
char *psz_bookmark = strdup( val.psz_string );
for( i_position = 0 ; i_position < p_playlist->i_size ; i_position++)
{
- if( !strcmp( psz_bookmark, p_playlist->pp_items[i_position]->psz_uri ) )
+ if( !strcmp( psz_bookmark, p_playlist->pp_items[i_position]->input.psz_uri ) )
{
playlist_Goto( p_playlist, i_position );
break;
char psz_bookmark_name[11];
sprintf( psz_bookmark_name, "bookmark%i", i_num );
var_Create( p_intf, psz_bookmark_name, VLC_VAR_STRING|VLC_VAR_DOINHERIT );
- val.psz_string = strdup( p_playlist->pp_items[p_playlist->i_index]->psz_uri );
+ val.psz_string = strdup( p_playlist->pp_items[p_playlist->i_index]->input.psz_uri );
var_Set( p_intf, psz_bookmark_name, val );
msg_Info( p_intf, "setting playlist bookmark %i to %s", i_num, val.psz_string );
vlc_object_release( p_playlist );
sprintf( value, "%d", i );
mvar_AppendNewVar( itm, "index", value );
- mvar_AppendNewVar( itm, "name", p_pl->pp_items[i]->psz_name );
+ mvar_AppendNewVar( itm, "name", p_pl->pp_items[i]->input.psz_name );
- mvar_AppendNewVar( itm, "uri", p_pl->pp_items[i]->psz_uri );
+ mvar_AppendNewVar( itm, "uri", p_pl->pp_items[i]->input.psz_uri );
sprintf( value, "%d", p_pl->pp_items[i]->i_group );
mvar_AppendNewVar( itm, "group", value );
static mvar_t *mvar_InfoSetNew( char *name, input_thread_t *p_input )
{
mvar_t *s = mvar_New( name, "set" );
-
- input_info_category_t * p_category;
- input_info_t * p_info;
+ int i, j;
fprintf( stderr," mvar_InfoSetNew: name=`%s'\n", name );
if( p_input == NULL )
return s;
}
- vlc_mutex_lock( &p_input->stream.stream_lock );
- p_category = p_input->stream.p_info;
- while ( p_category )
+ vlc_mutex_lock( &p_input->p_item->lock );
+ for ( i = 0; i < p_input->p_item->i_categories; i++ )
{
+ info_category_t *p_category = p_input->p_item->pp_categories[i];
mvar_t *cat = mvar_New( name, "set" );
mvar_t *iset = mvar_New( "info", "set" );
mvar_AppendNewVar( cat, "name", p_category->psz_name );
mvar_AppendVar( cat, iset );
- p_info = p_category->p_info;
- while ( p_info )
+ for ( j = 0; j < p_category->i_infos; j++ )
{
+ info_t *p_info = p_category->pp_infos[j];
mvar_t *info = mvar_New( "info", "" );
- msg_Dbg( p_input, "adding info name=%s value=%s", p_info->psz_name, p_info->psz_value );
+ msg_Dbg( p_input, "adding info name=%s value=%s",
+ p_info->psz_name, p_info->psz_value );
mvar_AppendNewVar( info, "name", p_info->psz_name );
mvar_AppendNewVar( info, "value", p_info->psz_value );
mvar_AppendVar( iset, info );
- p_info = p_info->p_next;
}
mvar_AppendVar( s, cat );
- p_category = p_category->p_next;
}
- vlc_mutex_unlock( &p_input->stream.stream_lock );
+ vlc_mutex_unlock( &p_input->p_item->lock );
return s;
}
uri_decode_url_encoded( mrl );
p_item = parse_MRL( p_intf, mrl );
- if( !p_item || !p_item->psz_uri || !*p_item->psz_uri )
+ if( !p_item || !p_item->input.psz_uri ||
+ !*p_item->input.psz_uri )
{
msg_Dbg( p_intf, "invalid requested mrl: %s", mrl );
} else
char p_buffer[ MAX_LINE_LENGTH + 1 ];
vlc_bool_t b_showpos = config_GetInt( p_intf, "rc-show-pos" );
- input_info_category_t * p_category;
- input_info_t * p_info;
int i_dummy;
off_t i_oldpos = 0;
{
if ( p_input )
{
- vlc_mutex_lock( &p_input->stream.stream_lock );
- p_category = p_input->stream.p_info;
- while ( p_category )
+ int i, j;
+ vlc_mutex_lock( &p_input->p_item->lock );
+ for ( i = 0; i < p_input->p_item->i_categories; i++ )
{
+ info_category_t *p_category =
+ p_input->p_item->pp_categories[i];
+
printf( "+----[ %s ]\n", p_category->psz_name );
printf( "| \n" );
- p_info = p_category->p_info;
- while ( p_info )
+ for ( j = 0; j < p_category->i_infos; j++ )
{
+ info_t *p_info = p_category->pp_infos[j];
printf( "| %s: %s\n", p_info->psz_name,
p_info->psz_value );
- p_info = p_info->p_next;
}
- p_category = p_category->p_next;
printf( "| \n" );
}
printf( "+----[ end of stream info ]\n" );
- vlc_mutex_unlock( &p_input->stream.stream_lock );
+ vlc_mutex_unlock( &p_input->p_item->lock );
}
else
{
for ( i = 0; i < p_playlist->i_size; i++ )
{
printf( "|%s%s %s|\n", i == p_playlist->i_index?"*":" ",
- p_playlist->pp_items[i]->psz_name,
- p_playlist->pp_items[i]->psz_uri );
+ p_playlist->pp_items[i]->input.psz_name,
+ p_playlist->pp_items[i]->input.psz_uri );
}
if ( i == 0 )
{
* mp4.h : MP4 file input module for vlc
*****************************************************************************
* Copyright (C) 2001-2004 VideoLAN
- * $Id: mp4.h,v 1.14 2004/01/25 20:05:28 hartman Exp $
+ * $Id$
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* id3tag.c: id3 tag parser/skipper based on libid3tag
*****************************************************************************
* Copyright (C) 2002-2004 VideoLAN
- * $Id: id3tag.c,v 1.22 2004/03/03 11:38:14 fenrir Exp $
+ * $Id$
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
*****************************************************************************/
static void ParseID3Tag( input_thread_t *p_input, uint8_t *p_data, int i_size )
{
- playlist_t *p_playlist;
struct id3_tag *p_id3_tag;
struct id3_frame *p_frame;
- input_info_category_t *p_category;
char *psz_temp;
vlc_value_t val;
int i;
return;
}
- p_playlist = vlc_object_find( p_input, VLC_OBJECT_PLAYLIST, FIND_PARENT );
-
val.b_bool = VLC_FALSE;
p_id3_tag = id3_tag_parse( p_data, i_size );
- p_category = input_InfoCategory( p_input, "ID3" );
i = 0;
while ( ( p_frame = id3_tag_findframe( p_id3_tag , "T", i ) ) )
{
int i_strings;
- 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 );
i_strings = id3_field_getnstrings( &p_frame->fields[1] );
i_genre = strtol( psz_temp, &psz_endptr, 10 );
if( psz_temp != psz_endptr && i_genre >= 0 && i_genre < NUM_GENRES )
{
- input_AddInfo( p_category, (char *)p_frame->description,
+ input_Control( p_input, INPUT_ADD_INFO, "ID3",
+ (char *)p_frame->description,
ppsz_genres[atoi(psz_temp)]);
- playlist_ItemAddInfo( p_item, "ID3",
- (char *)p_frame->description,
- ppsz_genres[atoi(psz_temp)]);
}
else
{
- input_AddInfo( p_category, (char *)p_frame->description,
- psz_temp );
- playlist_ItemAddInfo( p_item, "ID3",
- (char *)p_frame->description,
- psz_temp);
+ input_Control( p_input, INPUT_ADD_INFO, "ID3",
+ (char *)p_frame->description, psz_temp);
}
}
else if ( !strcmp(p_frame->id, ID3_FRAME_TITLE ) )
{
- if( p_item )
- {
- if( p_item->psz_name )
- {
- free( p_item->psz_name );
- }
- p_item->psz_name = strdup( psz_temp );;
-
- val.b_bool = VLC_TRUE;
- }
- input_AddInfo( p_category, (char *)p_frame->description,
- psz_temp );
- playlist_ItemAddInfo( p_item, "ID3",
- (char *)p_frame->description,
- psz_temp);
+ input_Control( p_input, INPUT_SET_NAME, psz_temp );
+ input_Control( p_input, INPUT_ADD_INFO, "ID3",
+ (char *)p_frame->description, psz_temp );
}
else if ( !strcmp(p_frame->id, ID3_FRAME_ARTIST ) )
{
- if( 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_ItemAddInfo( p_item, "ID3",
- (char *)p_frame->description,
- psz_temp);
+ input_Control( p_input, INPUT_ADD_INFO,
+ _("General"), _("Author"), psz_temp );
+ input_Control( p_input, INPUT_ADD_INFO, "ID3",
+ (char *)p_frame->description, psz_temp );
}
else
{
- input_AddInfo( p_category, (char *)p_frame->description,
- psz_temp );
- playlist_ItemAddInfo( p_item, "ID3",
- (char *)p_frame->description,
- psz_temp);
+ input_Control( p_input, INPUT_ADD_INFO, "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 )
- {
- if( p_playlist )
- {
- val.b_bool = p_playlist->i_index;
- var_Set( p_playlist, "item-change", val );
- }
- }
+
val.b_bool = VLC_TRUE;
var_Change( p_input, "demuxed-id3", VLC_VAR_SETVALUE, &val, NULL );
-
- if( p_playlist )
- {
- vlc_object_release( p_playlist );
- }
}
/*****************************************************************************
* gtk_callbacks.c : Callbacks for the Gtk+ plugin.
*****************************************************************************
* Copyright (C) 2000, 2001, 2003 VideoLAN
- * $Id: gtk_callbacks.c,v 1.16 2003/12/22 14:32:56 sam Exp $
+ * $Id$
*
* Authors: Sam Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>
return FALSE;
}
- psz_current = p_playlist->pp_items[ p_playlist->i_index ]->psz_name;
+ psz_current = p_playlist->pp_items[ p_playlist->i_index ]->input.psz_name;
/*
* Get the active input
* gtk_playlist.c : Interface for the playlist dialog
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: playlist.c,v 1.9 2004/01/05 13:07:03 zorglub Exp $
+ * $Id$
*
* Authors: Pierre Baillet <oct@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>
for( i_dummy = p_playlist->i_size ; i_dummy-- ; )
{
char psz_duration[MSTRTIME_MAX_SIZE];
- mtime_t dur = p_playlist->pp_items[i_dummy]->i_duration;
+ mtime_t dur = p_playlist->pp_items[i_dummy]->input.i_duration;
if ( dur != -1 )
{
secstotimestr( psz_duration, dur/1000000 );
{
memcpy( psz_duration ,"no info",sizeof("no info" ));
}
- ppsz_text[0] = p_playlist->pp_items[i_dummy]->psz_name;
+ ppsz_text[0] = p_playlist->pp_items[i_dummy]->input.psz_name;
ppsz_text[1] = strdup( psz_duration );
gtk_clist_insert( p_clist, 0, ppsz_text );
}
* playlist.cpp: Playlist control
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: playlist.cpp,v 1.15 2003/06/23 20:35:36 asmax Exp $
+ * $Id$
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
{
if( LongFileName )
{
- return PlayList->pp_items[i]->psz_name;
+ return PlayList->pp_items[i]->input.psz_name;
}
else
{
- string f = PlayList->pp_items[i]->psz_name;
+ string f = PlayList->pp_items[i]->input.psz_name;
int pos = f.rfind( DIRECTORY_SEPARATOR, f.size() );
- return PlayList->pp_items[i]->psz_name + pos + 1;
+ return PlayList->pp_items[i]->input.psz_name + pos + 1;
}
}
//---------------------------------------------------------------------------
if( x >= CaseLeft[i] && x <= CaseRight[i] && y >=
TextTop + i * CaseHeight && y < TextTop + (i + 1) * CaseHeight )
{
- TextFont->GetSize( PlayList->pp_items[i + StartIndex]->psz_name, w,
+ TextFont->GetSize( PlayList->pp_items[i + StartIndex]->input.psz_name, w,
h );
if( w > FileWidth )
{
ParentWindow->ChangeToolTipText(
- (string)PlayList->pp_items[i + StartIndex]->psz_name );
+ (string)PlayList->pp_items[i + StartIndex]->input.psz_name );
return true;
}
}
* vlcproc.cpp: VlcProc class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: vlcproc.cpp,v 1.54 2004/02/15 18:58:38 ipkiss Exp $
+ * $Id$
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
// Update file name
if( PlayList->i_index >= 0 && PlayList->i_index != Sys->i_index )
{
- string long_name = PlayList->pp_items[PlayList->i_index]->psz_name;
+ string long_name = PlayList->pp_items[PlayList->i_index]->input.psz_name;
int pos = long_name.rfind( DIRECTORY_SEPARATOR, long_name.size() );
// Complete file name
Thema->EvtBank->Get( "file_name" )->PostTextMessage(
- PlayList->pp_items[PlayList->i_index]->psz_name );
+ PlayList->pp_items[PlayList->i_index]->input.psz_name );
// File name without path
Thema->EvtBank->Get( "title" )->PostTextMessage(
- PlayList->pp_items[PlayList->i_index]->psz_name + pos + 1 );
+ PlayList->pp_items[PlayList->i_index]->input.psz_name + pos + 1 );
}
// Update playlists
* playlist.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: playlist.cpp,v 1.7 2004/02/27 13:24:12 gbazin Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
*
for( int i = 0; i < m_pPlaylist->i_size; i++ )
{
// Get the name of the playlist item
- UString *pName = convertName( m_pPlaylist->pp_items[i]->psz_name );
+ UString *pName = convertName( m_pPlaylist->pp_items[i]->input.psz_name );
// Is it the played stream ?
bool playing = (i == m_pPlaylist->i_index );
// Add the item in the list
* fileinfo.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2004 VideoLAN
- * $Id: fileinfo.cpp,v 1.23 2004/01/25 03:29:01 hartman Exp $
+ * $Id$
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
fileinfo_tree->DeleteChildren( fileinfo_root );
fileinfo_root_label = wxL2U(p_input->psz_name);
- vlc_mutex_lock( &p_input->stream.stream_lock );
-
- input_info_category_t *p_cat = p_input->stream.p_info;
-
- while( p_cat )
+ vlc_mutex_lock( &p_input->p_item->lock );
+ for( int i = 0; i < p_input->p_item->i_categories; i++ )
{
+ info_category_t *p_cat = p_input->p_item->pp_categories[i];
+
wxTreeItemId cat = fileinfo_tree->AppendItem( fileinfo_root,
wxL2U(p_cat->psz_name) );
- input_info_t *p_info = p_cat->p_info;
- while( p_info )
+ for( int j = 0; j < p_cat->i_infos; j++ )
{
+ info_t *p_info = p_cat->pp_infos[j];
+
fileinfo_tree->AppendItem( cat, (wxString)wxL2U(p_info->psz_name) +
wxT(": ") + wxL2U(p_info->psz_value) );
- p_info = p_info->p_next;
}
- p_cat = p_cat->p_next;
fileinfo_tree->Expand( cat );
}
-
- vlc_mutex_unlock( &p_input->stream.stream_lock );
+ vlc_mutex_unlock( &p_input->p_item->lock );
return;
}
* iteminfo.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2004 VideoLAN
- * $Id: iteminfo.cpp,v 1.8 2004/01/29 17:51:08 zorglub Exp $
+ * $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
*
wxStaticText *uri_label =
new wxStaticText( info_panel, -1, wxU(_("URI")) );
- uri_text = new wxTextCtrl( info_panel, Uri_Event,
- wxU(p_item->psz_uri),
- wxDefaultPosition, wxSize( 300, -1 ),
- wxTE_PROCESS_ENTER);
+ uri_text = new wxTextCtrl( info_panel, Uri_Event,
+ wxU(p_item->input.psz_uri), wxDefaultPosition, wxSize( 300, -1 ),
+ wxTE_PROCESS_ENTER );
wxBoxSizer *uri_sizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticText *name_label =
new wxStaticText( info_panel, -1, wxU(_("Name")) );
- name_text =
- new wxTextCtrl( info_panel, Uri_Event,
- wxU(p_item->psz_name),
- wxDefaultPosition, wxSize( 300, -1 ),
- wxTE_PROCESS_ENTER);
+ name_text = new wxTextCtrl( info_panel, Uri_Event,
+ wxU(p_item->input.psz_name), wxDefaultPosition, wxSize( 300, -1 ),
+ wxTE_PROCESS_ENTER );
wxBoxSizer *name_sizer = new wxBoxSizer( wxHORIZONTAL );
{
if( !info_root )
{
- info_root = info_tree->AddRoot( wxU( p_item->psz_name) );
+ info_root = info_tree->AddRoot( wxU( p_item->input.psz_name) );
}
/* Rebuild the tree */
- for( int i = 0; i< p_item->i_categories ; i++)
+ for( int i = 0; i< p_item->input.i_categories ; i++)
{
- if( !strcmp( p_item->pp_categories[i]->psz_name, _("Options") ) )
+ if( !strcmp( p_item->input.pp_categories[i]->psz_name, _("Options") ) )
{
continue;
}
wxTreeItemId cat = info_tree->AppendItem( info_root,
- wxU( p_item->pp_categories[i]->psz_name) );
+ wxU( p_item->input.pp_categories[i]->psz_name) );
- for( int j = 0 ; j < p_item->pp_categories[i]->i_infos ; j++ )
+ for( int j = 0 ; j < p_item->input.pp_categories[i]->i_infos ; j++ )
{
info_tree->AppendItem( cat , (wxString)
- wxU(p_item->pp_categories[i]->pp_infos[j]->psz_name) +
- wxT(": ") +
- wxU(p_item->pp_categories[i]->pp_infos[j]->psz_value) );
+ wxU(p_item->input.pp_categories[i]->pp_infos[j]->psz_name) +
+ wxT(": ") +
+ wxU(p_item->input.pp_categories[i]->pp_infos[j]->psz_value) );
}
}
}
*****************************************************************************/
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() );
+ vlc_mutex_lock( &p_item->input.lock );
+ p_item->input.psz_name = strdup( name_text->GetLineText(0).mb_str() );
+ p_item->input.psz_uri = strdup( uri_text->GetLineText(0).mb_str() );
playlist_ItemAddInfo( p_item,"General","Author",
author_text->GetLineText(0).mb_str() );
vlc_bool_t b_old_enabled = p_item->b_enabled;
}
p_item->b_enabled = enabled_checkbox->IsChecked() ? VLC_TRUE : VLC_FALSE ;
- vlc_mutex_unlock( &p_item->lock );
+ vlc_mutex_unlock( &p_item->input.lock );
EndModal( wxID_OK );
}
return;
}
- listview->SetItem( i, 0, wxL2U(p_item->psz_name) );
+ listview->SetItem( i, 0, wxL2U(p_item->input.psz_name) );
listview->SetItem( i, 1, wxU( playlist_ItemGetInfo( p_item,
_("General") , _("Author") ) ) );
char *psz_group = playlist_FindGroup(p_playlist,
}
char psz_duration[MSTRTIME_MAX_SIZE];
- mtime_t dur = p_item->i_duration;
+ mtime_t dur = p_item->input.i_duration;
if( dur != -1 ) secstotimestr( psz_duration, dur/1000000 );
else memcpy( psz_duration , "-:--:--", sizeof("-:--:--") );
listview->SetItem( i, 2, wxU(psz_duration) );
vlc_mutex_lock( &p_playlist->object_lock );
for( int i = 0; i < p_playlist->i_size; i++ )
{
- wxString filename = wxL2U(p_playlist->pp_items[i]->psz_name);
+ wxString filename = wxL2U(p_playlist->pp_items[i]->input.psz_name);
listview->InsertItem( i, filename );
UpdateItem( i );
}
* m3u.c : M3U playlist export module
*****************************************************************************
* Copyright (C) 2004 VideoLAN
- * $Id: m3u.c,v 1.1 2004/01/11 00:45:06 zorglub Exp $
+ * $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
*
/* Go through the playlist and add items */
for( i = 0; i< p_playlist->i_size ; i++)
{
- if( strcmp( p_playlist->pp_items[i]->psz_name,
- p_playlist->pp_items[i]->psz_uri ) )
+ if( strcmp( p_playlist->pp_items[i]->input.psz_name,
+ p_playlist->pp_items[i]->input.psz_uri ) )
{
char *psz_author = playlist_GetInfo( p_playlist, i, _("General"),
_("Author") );
fprintf( p_export->p_file,"#EXTINF:%i,%s%s\n",
- (int)(p_playlist->pp_items[i]->i_duration/1000000),
+ (int)(p_playlist->pp_items[i]->input.i_duration/1000000),
psz_author ? psz_author : "",
- p_playlist->pp_items[i]->psz_name );
+ p_playlist->pp_items[i]->input.psz_name );
}
- fprintf( p_export->p_file, "%s\n", p_playlist->pp_items[i]->psz_uri );
+ fprintf( p_export->p_file, "%s\n",
+ p_playlist->pp_items[i]->input.psz_uri );
}
return VLC_SUCCESS;
}
* old.c : Old playlist format import/export
*****************************************************************************
* Copyright (C) 2004 VideoLAN
- * $Id: old.c,v 1.1 2004/01/11 00:45:06 zorglub Exp $
+ * $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
*
for ( i = 0 ; i < p_playlist->i_size ; i++ )
{
- fprintf( p_export->p_file , "%s\n" , p_playlist->pp_items[i]->psz_uri );
- }
+ fprintf( p_export->p_file , "%s\n" ,
+ p_playlist->pp_items[i]->input.psz_uri );
+ }
return VLC_SUCCESS;
}
+
/*****************************************************************************
* sap.c : SAP interface module
*****************************************************************************
p_intf->p_sys->pp_announces[i]->i_id );
/* Change the name in the item */
- if( p_item->psz_name )
- free( p_item->psz_name );
- p_item->psz_name = strdup( p_sd->psz_sessionname);
+ if( p_item->input.psz_name )
+ free( p_item->input.psz_name );
+ p_item->input.psz_name = strdup( p_sd->psz_sessionname);
/* Update the stored name */
if( p_intf->p_sys->pp_announces[i]->psz_name )
p_item = playlist_ItemGetById( p_playlist, i_id );
if( p_item )
{
- vlc_mutex_lock( &p_item->lock );
+ vlc_mutex_lock( &p_item->input.lock );
playlist_ItemSetGroup( p_item, i_group );
- vlc_mutex_unlock( &p_item->lock );
+ vlc_mutex_unlock( &p_item->input.lock );
}
/* Then remember it */
#include <vlc/vlc.h>
#include <vlc/input.h>
+#include "vlc_playlist.h"
+
#include "ninput.h"
#include "../../modules/demux/util/sub.h"
int i_bkmk, *pi_bkmk;
int i, *pi;
vlc_value_t val, text;
+ char *psz_option, *psz_value;
vlc_mutex_lock( &p_input->stream.stream_lock );
switch( i_query )
{
+ case INPUT_ADD_OPTION:
+ {
+ psz_option = (char *)va_arg( args, char * );
+ psz_value = (char *)va_arg( args, char * );
+ i_ret = VLC_EGENERIC;
+
+ vlc_mutex_lock( &p_input->p_item->lock );
+ vlc_mutex_unlock( &p_input->p_item->lock );
+
+ i_ret = VLC_SUCCESS;
+ break;
+ }
+
+ case INPUT_SET_NAME:
+ {
+ char *psz_name = (char *)va_arg( args, char * );
+ i_ret = VLC_EGENERIC;
+ if( !psz_name ) break;
+ vlc_mutex_lock( &p_input->p_item->lock );
+ if( p_input->p_item->psz_name ) free( p_input->p_item->psz_name );
+ p_input->p_item->psz_name = strdup( psz_name );
+ vlc_mutex_unlock( &p_input->p_item->lock );
+ i_ret = VLC_SUCCESS;
+
+ /* Notify playlist */
+ {
+ vlc_value_t val;
+ playlist_t *p_playlist =
+ (playlist_t *)vlc_object_find( p_input, VLC_OBJECT_PLAYLIST,
+ FIND_PARENT );
+ if( p_playlist )
+ {
+ val.i_int = p_playlist->i_index;
+ var_Set( p_playlist, "item-change", val );
+ vlc_object_release( p_playlist );
+ }
+ }
+ break;
+ }
+
+ case INPUT_ADD_INFO:
+ {
+ char *psz_cat = (char *)va_arg( args, char * );
+ char *psz_name = (char *)va_arg( args, char * );
+ char *psz_format = (char *)va_arg( args, char * );
+
+ info_category_t *p_cat;
+ info_t *p_info;
+ int i;
+
+ i_ret = VLC_EGENERIC;
+
+ vlc_mutex_lock( &p_input->p_item->lock );
+ for( i = 0; i < p_input->p_item->i_categories; i++ )
+ {
+ if( !strcmp( p_input->p_item->pp_categories[i]->psz_name,
+ psz_cat ) )
+ break;
+ }
+
+ if( i == p_input->p_item->i_categories )
+ {
+ p_cat = malloc( sizeof( info_category_t ) );
+ if( !p_cat ) break;
+ p_cat->psz_name = strdup( psz_cat );
+ p_cat->i_infos = 0;
+ p_cat->pp_infos = NULL;
+ INSERT_ELEM( p_input->p_item->pp_categories,
+ p_input->p_item->i_categories,
+ p_input->p_item->i_categories, p_cat );
+ }
+
+ p_cat = p_input->p_item->pp_categories[i];
+
+ for( i = 0; i < p_cat->i_infos; i++ )
+ {
+ if( !strcmp( p_cat->pp_infos[i]->psz_name, psz_name ) )
+ {
+ if( p_cat->pp_infos[i]->psz_value )
+ free( p_cat->pp_infos[i]->psz_value );
+ break;
+ }
+ }
+
+ if( i == p_cat->i_infos )
+ {
+ p_info = malloc( sizeof( info_t ) );
+ if( !p_info ) break;
+ INSERT_ELEM( p_cat->pp_infos, p_cat->i_infos,
+ p_cat->i_infos, p_info );
+ p_info->psz_name = strdup( psz_name );
+ }
+
+ p_info = p_cat->pp_infos[i];
+ vasprintf( &p_info->psz_value, psz_format, args );
+
+ vlc_mutex_unlock( &p_input->p_item->lock );
+
+ i_ret = VLC_SUCCESS;
+
+ /* Notify playlist */
+ {
+ vlc_value_t val;
+ playlist_t *p_playlist =
+ (playlist_t *)vlc_object_find( p_input, VLC_OBJECT_PLAYLIST,
+ FIND_PARENT );
+ if( p_playlist )
+ {
+ val.i_int = p_playlist->i_index;
+ var_Set( p_playlist, "item-change", val );
+ vlc_object_release( p_playlist );
+ }
+ }
+ }
+ break;
+
case INPUT_ADD_BOOKMARK:
p_bkmk = (seekpoint_t *)va_arg( args, seekpoint_t * );
p_bkmk = vlc_seekpoint_Duplicate( p_bkmk );
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;
char psz_cat[sizeof( _("Stream ") ) + 10];
- input_info_category_t *p_cat;
char *psz_description;
vlc_mutex_lock( &p_input->stream.stream_lock );
break;
}
+ /* Add stream info */
+ vlc_mutex_unlock( &p_input->stream.stream_lock );
sprintf( psz_cat, _("Stream %d"), out->p_sys->i_id - 1 );
- /* 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 ) ) )
+
+ input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Codec"),
+ "%.4s", (char*)&fmt->i_codec );
+
+ if( *psz_description )
+ input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Language"),
+ "%s", psz_description );
+
+ if( fmt->psz_description && *fmt->psz_description )
+ input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Description"),
+ "%s", fmt->psz_description );
+
+ /* Add information */
+ switch( fmt->i_cat )
{
- char *psz_type;
- switch( fmt->i_cat )
- {
- case AUDIO_ES:
- psz_type = _("Audio");
- break;
- case VIDEO_ES:
- psz_type = _("Video");
- break;
- case SPU_ES:
- psz_type = _("Subtitle");
- break;
- default:
- psz_type = NULL;
- break;
- }
- if( psz_type )
- {
- input_AddInfo( p_cat, _("Type"), psz_type );
- playlist_AddInfo( p_playlist, -1, psz_cat, _("Type"), psz_type );
- }
- input_AddInfo( p_cat, _("Codec"), "%.4s", (char*)&fmt->i_codec );
- playlist_AddInfo( p_playlist, -1, psz_cat, _("Codec"),
- "%.4s",(char*)&fmt->i_codec );
- if( *psz_description )
- {
- input_AddInfo( p_cat, _("Language"), psz_description );
- playlist_AddInfo( p_playlist, -1, psz_cat, _("Language"),
- "%s", psz_description );
- }
- if( fmt->psz_description && *fmt->psz_description )
- {
- input_AddInfo( p_cat, _("Description"), "%s", fmt->psz_description );
- playlist_AddInfo( p_playlist, -1, psz_cat, _("Description"),
- "%s", fmt->psz_description );
- }
+ case AUDIO_ES:
+ input_Control( p_input, INPUT_ADD_INFO, psz_cat,
+ _("Type"), _("Audio") );
- /* Add information */
- switch( fmt->i_cat )
- {
- case AUDIO_ES:
- 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->audio.i_rate > 0 )
- {
- 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->audio.i_bitspersample > 0 )
- {
- 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 );
- }
- if( fmt->i_bitrate > 0 )
- {
- input_AddInfo( p_cat, _("Bitrate"),
- _("%d bps"), fmt->i_bitrate );
- playlist_AddInfo( p_playlist, -1, psz_cat, _("Bitrate"),
- _("%d bps"), fmt->i_bitrate );
- }
- break;
+ if( fmt->audio.i_channels > 0 )
+ input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Channels"),
+ "%d", fmt->audio.i_channels );
- case VIDEO_ES:
- 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 )
- {
- 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;
+ if( fmt->audio.i_rate > 0 )
+ input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Sample rate"),
+ _("%d Hz"), fmt->audio.i_rate );
- case SPU_ES:
- default:
- break;
- }
- if( p_playlist ) vlc_object_release( p_playlist );
+ if( fmt->audio.i_bitspersample > 0 )
+ input_Control( p_input, INPUT_ADD_INFO, psz_cat,
+ _("Bits per sample"), "%d",
+ fmt->audio.i_bitspersample );
+
+ if( fmt->i_bitrate > 0 )
+ input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Bitrate"),
+ _("%d bps"), fmt->i_bitrate );
+ break;
+
+ case VIDEO_ES:
+ input_Control( p_input, INPUT_ADD_INFO, psz_cat,
+ _("Type"), _("Video") );
+
+ if( fmt->video.i_width > 0 && fmt->video.i_height > 0 )
+ input_Control( p_input, INPUT_ADD_INFO, 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 )
+ input_Control( p_input, INPUT_ADD_INFO, psz_cat,
+ _("Display resolution"), "%dx%d",
+ fmt->video.i_visible_width,
+ fmt->video.i_visible_height);
+ break;
+
+ case SPU_ES:
+ input_Control( p_input, INPUT_ADD_INFO, psz_cat,
+ _("Type"), _("Subtitle") );
+ break;
+
+ default:
+ break;
}
+
+ vlc_mutex_lock( &p_input->stream.stream_lock );
free( psz_description );
es_format_Copy( &es->p_es->fmt, fmt );
# include <sys/times.h>
#endif
-#include "vlc_playlist.h"
-
#include "stream_output.h"
#include "vlc_interface.h"
* This function creates a new input, and returns a pointer
* to its description. On error, it returns NULL.
*****************************************************************************/
-input_thread_t *__input_CreateThread( vlc_object_t *p_parent, char *psz_uri,
- char **ppsz_options, int i_options )
+input_thread_t *__input_CreateThread( vlc_object_t *p_parent,
+ input_item_t *p_item )
{
input_thread_t *p_input; /* thread descriptor */
return NULL;
}
+ /* Store pointer to input item descriptor */
+ p_input->p_item = p_item;
+
/* Parse input options */
- for( i = 0; i < i_options; i++ )
+ vlc_mutex_lock( &p_item->lock );
+ for( i = 0; i < p_item->i_options; i++ )
{
- msg_Dbg( p_input, "option: %s", ppsz_options[i] );
- ParseOption( p_input, ppsz_options[i] );
+ msg_Dbg( p_input, "option: %s", p_item->ppsz_options[i] );
+ ParseOption( p_input, p_item->ppsz_options[i] );
}
+ vlc_mutex_unlock( &p_item->lock );
/* Create a few object variables we'll need later on */
var_Create( p_input, "video", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_input, "audio-channel", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Create( p_input, "spu-channel", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Create( p_input, "sub-file", VLC_VAR_FILE | VLC_VAR_DOINHERIT );
- var_Create( p_input, "sub-autodetect-file", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
- var_Create( p_input, "sub-autodetect-fuzzy", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
+ var_Create( p_input, "sub-autodetect-file", VLC_VAR_BOOL |
+ VLC_VAR_DOINHERIT );
+ var_Create( p_input, "sub-autodetect-fuzzy", VLC_VAR_INTEGER |
+ VLC_VAR_DOINHERIT );
var_Create( p_input, "sout", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_input, "sout-all", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
p_input->p_sys = NULL;
/* Set target */
- p_input->psz_source = strdup( psz_uri );
+ vlc_mutex_lock( &p_item->lock );
+ p_input->psz_source = strdup( p_item->psz_uri );
+ vlc_mutex_unlock( &p_item->lock );
/* Stream */
p_input->s = NULL;
free( val.psz_string );
}
- /* Initialize input info */
- p_input->stream.p_info = NULL;
- p_input->stream.p_info = input_InfoCategory( p_input, _("General") );
- input_AddInfo( p_input->stream.p_info, _("Playlist Item"),
- p_input->psz_source );
vlc_object_attach( p_input, p_parent );
/* Create thread and wait for its readiness. */
VLC_THREAD_PRIORITY_INPUT, VLC_TRUE ) )
{
msg_Err( p_input, "cannot create input thread" );
- input_DelInfo( p_input );
free( p_input );
return NULL;
}
/* Tell we're dead */
p_input->b_dead = 1;
- input_DelInfo( p_input );
-
return 0;
}
vlc_meta_t *p_meta = NULL, *p_meta_user = NULL;
// float f_fps;
double f_fps;
- playlist_t *p_playlist;
mtime_t i_length;
/* Parse source string. Syntax : [[<access>][/<demux>]:][<source>] */
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,
- VLC_OBJECT_PLAYLIST, FIND_PARENT);
- playlist_item_t *p_item = NULL;
- input_info_category_t *p_cat;
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 )
- {
- 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( p_meta->i_meta > 0 )
{
- p_cat = input_InfoCategory( p_input, _("File") );
for( i = 0; i < p_meta->i_meta; i++ )
{
msg_Dbg( p_input, " - '%s' = '%s'", _(p_meta->name[i]),
p_meta->value[i] );
- if( !strcmp( p_meta->name[i], VLC_META_TITLE ) )
- {
- playlist_ItemSetName( p_item, p_meta->value[i] );
- }
+ if( !strcmp( p_meta->name[i], VLC_META_TITLE ) &&
+ p_meta->value[i] )
+ input_Control( p_input, INPUT_SET_NAME, p_meta->value[i] );
+
if( !strcmp( p_meta->name[i], VLC_META_AUTHOR ) )
- {
- playlist_ItemAddInfo( p_item, _("General"), _("Author"),
- p_meta->value[i] );
- }
- input_AddInfo( p_cat, _(p_meta->name[i]), "%s",
- p_meta->value[i] );
- if( p_item )
- {
- playlist_ItemAddInfo( p_item, _("File"),
- _(p_meta->name[i]), "%s",
- p_meta->value[i] );
- }
+ input_Control( p_input, INPUT_ADD_INFO, _("General"),
+ _("Author"), p_meta->value[i] );
+
+ input_Control( p_input, INPUT_ADD_INFO, _("File"),
+ _(p_meta->name[i]), "%s", p_meta->value[i] );
}
}
for( i = 0; i < p_meta->i_track; i++ )
{
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] );
- }
+
+ input_Control( p_input, INPUT_ADD_INFO, 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 );
-
if( p_input->stream.p_sout && p_input->stream.p_sout->p_meta == NULL )
{
p_input->stream.p_sout->p_meta = p_meta;
if( !demux_Control( p_input, DEMUX_GET_LENGTH, &i_length ) &&
i_length > 0 )
{
- input_info_category_t *p_cat =
- input_InfoCategory( p_input, _("File") );
- p_playlist =
- (playlist_t*)vlc_object_find( p_input, VLC_OBJECT_PLAYLIST,
- FIND_PARENT );
- if( p_playlist )
- {
- playlist_SetDuration( p_playlist, -1 , i_length );
- val.b_bool = p_playlist->i_index;
- var_Set( p_playlist, "item-change", val );
- vlc_object_release( p_playlist );
- }
- if( p_cat )
- {
- char psz_buffer[MSTRTIME_MAX_SIZE];
- input_AddInfo( p_cat, _("Duration"),
- msecstotimestr( psz_buffer, i_length / 1000 ) );
- }
+ char psz_buffer[MSTRTIME_MAX_SIZE];
+
+ vlc_mutex_lock( &p_input->p_item->lock );
+ p_input->p_item->i_duration = i_length;
+ vlc_mutex_unlock( &p_input->p_item->lock );
+
+ input_Control( p_input, INPUT_ADD_INFO, _("General"), _("Duration"),
+ msecstotimestr( psz_buffer, i_length / 1000 ) );
/* Set start time */
var_Get( p_input, "start-time", &val );
/* Free info structures XXX destroy es before 'cause vorbis */
msg_Dbg( p_input, "freeing info structures...");
- input_DelInfo( p_input );
free( p_input->psz_source );
if( p_input->psz_dupsource != NULL ) free( p_input->psz_dupsource );
+++ /dev/null
-/*****************************************************************************
- * input_info.c: Convenient functions to handle the input info structures
- *****************************************************************************
- * Copyright (C) 1998-2004 VideoLAN
- * $Id: input_info.c,v 1.14 2004/01/25 17:16:06 zorglub Exp $
- *
- * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include <stdlib.h>
-#include <string.h>
-
-#include <vlc/vlc.h>
-
-#include "stream_control.h"
-#include "input_ext-intf.h"
-#include "vlc_interface.h"
-
-/**
- * \brief Find info category by name.
- *
- * Returns a pointer to the info category with the given name, and
- * creates it if necessary
- *
- * \param p_input pointer to the input thread in which the info is to be found
- * \param psz_name the name of the category to be found
- * \returns a pointer to the category with the given name
- */
-input_info_category_t * input_InfoCategory( input_thread_t * p_input,
- char * psz_name)
-{
- input_info_category_t * p_category, * p_prev;
- p_prev = NULL;
- for ( p_category = p_input->stream.p_info;
- (p_category != NULL) && strcmp( p_category->psz_name, psz_name );
- p_category = p_category->p_next)
- {
- p_prev = p_category;
- }
- if ( p_category )
- {
- return p_category;
- }
- else
- {
- p_category = malloc( sizeof( input_info_category_t ) );
- if ( !p_category )
- {
- msg_Err( p_input, "out of memory" );
- return NULL;
- }
- p_category->psz_name = strdup( psz_name );
- p_category->p_next = NULL;
- p_category->p_info = NULL;
- if( p_prev ) p_prev->p_next = p_category;
- return p_category;
- }
-}
-
-/**
- * \brief Add a info item to a category
- *
- * \param p_category Pointer to the category to put this info in
- * \param psz_name Name of the info item to add
- * \param psz_format printf style format string for the value.
- * \return a negative number on error. 0 on success.
- */
-int input_AddInfo( input_info_category_t * p_category, char * psz_name,
- char * psz_format, ...)
-{
- input_info_t * p_info, * p_prev;
- char * psz_str = NULL;
- va_list args;
-
- p_prev = NULL;
- if ( !p_category )
- {
- return -1;
- }
-
- va_start( args, psz_format );
-
- /*
- * Convert message to string
- */
-#if defined(HAVE_VASPRINTF) && !defined(SYS_DARWIN) && !defined(SYS_BEOS)
- vasprintf( &psz_str, psz_format, args );
-#else
- psz_str = (char*) malloc( strlen(psz_format) + INTF_MAX_MSG_SIZE );
- if( psz_str == NULL )
- {
- return -1;
- }
-
- vsprintf( psz_str, psz_format, args );
-#endif
-
- va_end( args );
- p_info = p_category->p_info;
- while ( p_info )
- {
- p_prev = p_info;
- p_info = p_info->p_next;
- }
- p_info = malloc( sizeof( input_info_t ) );
- if( !p_info )
- {
- return -1;
- }
- p_info->psz_name = strdup( psz_name );
- p_info->psz_value = psz_str;
- p_info->p_next = NULL;
- if ( p_prev )
- {
- p_prev->p_next = p_info;
- }
- else
- {
- p_category->p_info = p_info;
- }
- return 0;
-}
-
-/**
- * \brief Destroy info structures
- * \internal
- *
- * \param p_input The input thread to be cleaned for info
- * \returns for the moment VLC_SUCCESS
- */
-int input_DelInfo( input_thread_t * p_input )
-{
- input_info_category_t * p_category, * p_prev_category;
- input_info_t * p_info, * p_prev_info;
-
- p_category = p_input->stream.p_info;
- while ( p_category )
- {
- p_info = p_category->p_info;
- while ( p_info )
- {
- if ( p_info->psz_name )
- {
- free( p_info->psz_name );
- }
- if ( p_info->psz_value )
- {
- free( p_info->psz_value );
- }
- p_prev_info = p_info;
- p_info = p_info->p_next;
- free( p_prev_info );
- }
- if ( p_category->psz_name )
- {
- free( p_category->psz_name );
- }
- p_prev_category = p_category;
- p_category = p_category->p_next;
- free( p_prev_category );
- }
- return VLC_SUCCESS;
-}
es_descriptor_t * p_es;
vlc_value_t val, text;
char *psz_var = NULL;
- char *psz_type = NULL;
p_es = (es_descriptor_t *)malloc( sizeof(es_descriptor_t) );
if( p_es == NULL )
{
case AUDIO_ES:
psz_var = "audio-es";
- psz_type = _("audio");
break;
case SPU_ES:
psz_var = "spu-es";
- psz_type = _("subtitle");
break;
case VIDEO_ES:
psz_var = "video-es";
- psz_type = _("video");
break;
- case NAV_ES:
- psz_type = _("navigation");
- break;
- case UNKNOWN_ES:
- psz_type = _("unknown");
- break;
- default:
- psz_type = _("error");
- }
-
-#define TITLE_MAX 30
- /* Add stream info. */
- {
- input_info_category_t *p_cat;
- char psz_streamid[TITLE_MAX];
-
- snprintf(psz_streamid, TITLE_MAX, "%s%04x", _("Stream "), i_es_id);
- p_cat = input_InfoCategory( p_input, psz_streamid );
- input_AddInfo( p_cat, _("Type"), "%s", psz_type );
- if ( psz_desc && *psz_desc )
- input_AddInfo( p_cat, _("Description"), "%s", psz_desc );
}
if( psz_var )
#include "vlc_error.h"
#include "vlc_interface.h"
-#include "vlc_playlist.h"
#include "intf_eject.h"
#include "stream_control.h"
#include "input_ext-plugins.h"
#include "ninput.h"
+#include "vlc_playlist.h"
+
#include "vlc_video.h"
#include "video_output.h"
#include "vout_synchro.h"
return result;
}
-
/*****************************************************************************
*
*****************************************************************************/
media->psz_output = NULL;
media->i_option = 0;
media->option = NULL;
- media->i_input_option = 0;
- media->input_option = NULL;
media->i_type = i_type;
media->p_input = NULL;
- TAB_APPEND( vlm->i_media , vlm->media , media );
+ media->item.psz_uri = strdup( psz_name );
+ media->item.psz_name = NULL;
+ media->item.i_duration = -1;
+ media->item.ppsz_options = NULL;
+ media->item.i_options = 0;
+ media->item.i_categories = 0;
+ media->item.pp_categories = NULL;
+ vlc_mutex_init( vlm, &media->item.lock );
+
+ TAB_APPEND( vlm->i_media, vlm->media, media );
return media;
}
}
if(media->option) free( media->option );
- for( i = 0; i < media->i_input_option; i++ )
+ if( media->item.psz_uri ) free( media->item.psz_uri );
+ if( media->item.psz_name ) free( media->item.psz_name );
+ vlc_mutex_destroy( &media->item.lock );
+ for( i = 0; i < media->item.i_options; i++ )
{
- free( media->input_option[i] );
+ free( media->item.ppsz_options[i] );
}
- if( media->input_option ) free( media->input_option );
+ if( media->item.ppsz_options ) free( media->item.ppsz_options );
+ /* FIXME: free the info categories. */
free( media );
return 0;
}
-static int vlm_MediaControl( vlm_t *vlm, vlm_media_t *media, char *psz_name, char *psz_args )
+static int vlm_MediaControl( vlm_t *vlm, vlm_media_t *media, char *psz_name,
+ char *psz_args )
{
if( strcmp( psz_name, "play" ) == 0 )
{
if( media->b_enabled == VLC_TRUE && media->i_input > 0 )
{
- if( psz_args != NULL && sscanf( psz_args, "%d", &i ) == 1 && i < media->i_input )
+ if( psz_args != NULL && sscanf( psz_args, "%d", &i ) == 1 &&
+ i < media->i_input )
{
media->i_index = i;
}
media->i_index = 0;
}
+ /* FIXME!!! we need an input_item_t per input spawned */
+ //input_ItemNew( &media->item );
if( media->psz_output != NULL )
{
- media->input_option = malloc( sizeof( char* ) );
- media->input_option[0] = malloc( strlen(media->psz_output) + 1 + 6 );
- sprintf( media->input_option[0], ":sout=%s" , media->psz_output );
- media->i_input_option = 1;
+ media->item.ppsz_options = malloc( sizeof( char* ) );
+ media->item.ppsz_options[0] =
+ malloc( strlen(media->psz_output) + sizeof("sout=") );
+ sprintf( media->item.ppsz_options[0], "sout=%s",
+ media->psz_output );
+ media->item.i_options = 1;
}
else
{
- media->input_option = NULL;
- media->i_input_option = 0;
+ media->item.ppsz_options = NULL;
+ media->item.i_options = 0;
}
- for( i=0 ; i < media->i_option ; i++ )
+ for( i = 0; i < media->i_option; i++ )
{
- media->i_input_option++;
- media->input_option = realloc( media->input_option, (media->i_input_option) * sizeof( char* ) );
- media->input_option[ media->i_input_option - 1 ] = malloc( strlen(media->option[i]) + 1 + 1 );
- sprintf( media->input_option[ media->i_input_option - 1 ], ":%s" , media->option[i] );
+ media->item.i_options++;
+ media->item.ppsz_options =
+ realloc( media->item.ppsz_options,
+ media->item.i_options * sizeof( char* ) );
+ media->item.ppsz_options[ media->item.i_options - 1 ] =
+ strdup( media->option[i] );
}
- media->p_input = input_CreateThread( vlm, media->input[media->i_index], media->input_option, media->i_input_option );
+ media->p_input = input_CreateThread( vlm, &media->item );
return 0;
}
}
else if( strcmp( psz_name, "stop" ) == 0 )
{
- int i;
-
+ /* FIXME!!! we need an input_item_t per input spawned */
if( media->p_input )
{
input_StopThread( media->p_input );
vlc_object_destroy( media->p_input );
media->p_input = NULL;
- for( i=0 ; i < media->i_input_option ; i++ )
- {
- free( media->input_option[i] );
- }
- if( media->input_option) free( media->input_option );
-
- media->input_option = NULL;
- media->i_input_option = 0;
+ //input_ItemDelete( &media->item );
}
return 0;
return child;
}
-
* playlist.c : Playlist groups management functions
*****************************************************************************
* Copyright (C) 1999-2004 VideoLAN
- * $Id: group.c,v 1.9 2004/01/25 17:16:06 zorglub Exp $
+ * $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
*
#include <string.h> /* strerror() */
#include <vlc/vlc.h>
-#include <vlc/vout.h>
-#include <vlc/sout.h>
+#include <vlc/input.h>
#include "vlc_playlist.h"
-
/**
* Create a group
*
* \param psz_name the name of the group to be created
* \return a pointer to the created group, or NULL on error
*/
-playlist_group_t * playlist_CreateGroup(playlist_t * p_playlist, char *psz_name)
+playlist_group_t *playlist_CreateGroup( playlist_t *p_playlist, char *psz_name)
{
playlist_group_t *p_group;
int i;
{
if( p_playlist->pp_groups[i]->psz_name)
{
- if( ! strcasecmp( p_playlist->pp_groups[i]->psz_name , psz_name ) )
+ if( ! strcasecmp( p_playlist->pp_groups[i]->psz_name, psz_name ) )
{
return p_playlist->pp_groups[i]->i_id;
}
* info.c : Playlist info management
*****************************************************************************
* Copyright (C) 1999-2004 VideoLAN
- * $Id: info.c,v 1.10 2004/02/28 17:10:23 gbazin Exp $
+ * $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
*
#include <string.h> /* strerror() */
#include <vlc/vlc.h>
-#include <vlc/vout.h>
-#include <vlc/sout.h>
+#include <vlc/input.h>
#include "vlc_playlist.h"
{
playlist_item_t *p_item;
char *psz_buffer;
- /* Check the existence of the playlist */
- if( p_playlist == NULL)
- {
- return strdup("");
- }
+
+ /* Sanity check */
+ if( p_playlist == NULL) return strdup("");
+
p_item = playlist_ItemGetByPos( p_playlist, i_pos );
- if( !p_item )
- {
- return strdup("");
- }
- vlc_mutex_lock( &p_item->lock );
- psz_buffer = playlist_ItemGetInfo( p_item ,
- psz_cat, psz_name );
- vlc_mutex_unlock( &p_item->lock );
+ if( !p_item ) return strdup("");
+
+ vlc_mutex_lock( &p_item->input.lock );
+ psz_buffer = playlist_ItemGetInfo( p_item , psz_cat, psz_name );
+ vlc_mutex_unlock( &p_item->input.lock );
return psz_buffer;
}
* \return the info value if any, an empty string else
*/
char * playlist_ItemGetInfo( playlist_item_t *p_item,
- const char * psz_cat, const char *psz_name )
+ const char * psz_cat, const char *psz_name )
{
- int i,j ;
- for( i = 0 ; i< p_item->i_categories ; i++ )
+ int i, j;
+
+ for( i = 0 ; i< p_item->input.i_categories ; i++ )
{
- if( !strcmp( p_item->pp_categories[i]->psz_name , psz_cat ) )
+ info_category_t *p_category = p_item->input.pp_categories[i];
+
+ if( strcmp( p_category->psz_name , psz_cat ) ) continue;
+
+ for( j = 0 ; j< p_category->i_infos ; j++ )
{
- for( j = 0 ; j< p_item->pp_categories[i]->i_infos ; j++ )
+ if( !strcmp( p_category->pp_infos[j]->psz_name, psz_name) )
{
- if( !strcmp( p_item->pp_categories[i]->pp_infos[j]->psz_name,
- psz_name ) )
- {
- return
- strdup(p_item->pp_categories[i]->pp_infos[j]->psz_value );
- }
+ return strdup( p_category->pp_infos[j]->psz_value );
}
}
}
return strdup("");
}
-/**
- * Get one info category. Create it if it does not exist
- *
- * \param p_playlist the playlist to get the category from
- * \param i_item the position of the item on which we want
- * the info ( -1 for current )
- * \param psz_cat the category we want
- * \return the info category.
- */
-item_info_category_t *
-playlist_GetCategory( playlist_t *p_playlist, int i_pos,
- const char * psz_cat )
-{
- playlist_item_t *p_item;
- /* Check the existence of the playlist */
- if( p_playlist == NULL)
- {
- return NULL;
- }
- p_item= playlist_ItemGetByPos( p_playlist , i_pos );
- if( !p_item )
- {
- return NULL;
- }
- return playlist_ItemGetCategory( p_item , psz_cat );
-}
-
/**
* Get one info category (no p_playlist). Create it if it does not exist
*
* \param psz_cat the category we want
* \return the info category.
*/
-item_info_category_t *playlist_ItemGetCategory( playlist_item_t *p_item,
- const char *psz_cat )
+info_category_t * playlist_ItemGetCategory( playlist_item_t *p_item,
+ const char *psz_cat )
{
int i;
/* Search the category */
- for( i = 0 ; i< p_item->i_categories ; i++ )
+ for( i = 0 ; i< p_item->input.i_categories ; i++ )
{
- if( !strncmp( p_item->pp_categories[i]->psz_name , psz_cat,
- strlen(psz_cat) ) )
+ if( !strncmp( p_item->input.pp_categories[i]->psz_name, psz_cat,
+ strlen(psz_cat) ) )
{
- return p_item->pp_categories[i];
+ return p_item->input.pp_categories[i];
}
}
return playlist_ItemCreateCategory( p_item, psz_cat );
}
-
-/**
- * Create one info category.
- *
- * \param p_playlist the playlist
- * \param i_item the position of the item for which we create
- * the category ( -1 for current )
- * \param psz_cat the category we want to create
- * \return the info category.
- */
-item_info_category_t *
-playlist_CreateCategory( playlist_t *p_playlist, int i_pos,
- const char * psz_cat )
-{
- playlist_item_t *p_item = NULL;
-
- /* Check the existence of the playlist */
- if( p_playlist == NULL)
- {
- return NULL;
- }
- p_item = playlist_ItemGetByPos( p_playlist , i_pos );
- if( !p_item )
- {
- return NULL;
- }
-
- return playlist_ItemCreateCategory( p_item, psz_cat );
-}
-
/**
* Create one info category for an item ( no p_playlist required )
*
* \param psz_cat the category we want to create
* \return the info category.
*/
-item_info_category_t *
-playlist_ItemCreateCategory( playlist_item_t *p_item, const char *psz_cat )
+info_category_t * playlist_ItemCreateCategory( playlist_item_t *p_item,
+ const char *psz_cat )
{
- item_info_category_t *p_cat;
+ info_category_t *p_cat;
int i;
- for( i = 0 ; i< p_item->i_categories ; i++)
+
+ for( i = 0 ; i< p_item->input.i_categories ; i++)
{
- if( !strcmp( p_item->pp_categories[i]->psz_name,psz_cat ) )
+ if( !strcmp( p_item->input.pp_categories[i]->psz_name,psz_cat ) )
{
- return p_item->pp_categories[i];
+ return p_item->input.pp_categories[i];
}
}
- if( ( p_cat = malloc( sizeof( item_info_category_t) ) ) == NULL )
+
+ if( ( p_cat = malloc( sizeof( info_category_t) ) ) == NULL )
{
return NULL;
}
p_cat->i_infos = 0;
p_cat->pp_infos = NULL;
- INSERT_ELEM( p_item->pp_categories ,
- p_item->i_categories ,
- p_item->i_categories ,
- p_cat );
+ INSERT_ELEM( p_item->input.pp_categories, p_item->input.i_categories,
+ p_item->input.i_categories, p_cat );
return p_cat;
}
playlist_item_t *p_item;
char *psz_value;
- /* Check the existence of the playlist */
- if( p_playlist == NULL)
- {
- return VLC_EGENERIC;
- }
+ /* Sanity check */
+ if( p_playlist == NULL) return VLC_EGENERIC;
p_item = playlist_ItemGetByPos( p_playlist, i_item );
- if( !p_item )
- {
- return VLC_ENOOBJ;
- }
+ if( !p_item ) return VLC_ENOOBJ;
va_start( args, psz_format );
vasprintf( &psz_value, psz_format, args );
va_end( args );
- vlc_mutex_lock( &p_item->lock );
- i_ret = playlist_ItemAddInfo( p_item , psz_cat , psz_name , psz_value );
- vlc_mutex_unlock( &p_item->lock );
+ vlc_mutex_lock( &p_item->input.lock );
+ i_ret = playlist_ItemAddInfo( p_item, psz_cat, psz_name, psz_value );
+ vlc_mutex_unlock( &p_item->input.lock );
free( psz_value );
return i_ret;
}
-
/**
* Add info to one item ( no need for p_playlist )
*
* \return VLC_SUCCESS on success
*/
int playlist_ItemAddInfo( playlist_item_t *p_item,
- const char *psz_cat, const char *psz_name,
- const char *psz_format, ... )
+ const char *psz_cat, const char *psz_name,
+ const char *psz_format, ... )
{
va_list args;
int i;
int i_new = VLC_TRUE;
- item_info_t *p_info = NULL;
- item_info_category_t *p_cat;
+ info_t *p_info = NULL;
+ info_category_t *p_cat;
/* Find or create the category */
p_cat = playlist_ItemGetCategory( p_item, psz_cat );
- if( p_cat == NULL)
- {
- return VLC_EGENERIC;
- }
+ if( p_cat == NULL) return VLC_EGENERIC;
for( i = 0 ; i< p_cat->i_infos ; i++)
{
/* New info, create it */
if( p_info == NULL )
{
- if( ( p_info = malloc( sizeof( item_info_t) ) ) == NULL )
+ if( ( p_info = malloc( sizeof( info_t) ) ) == NULL )
{
return VLC_EGENERIC;
}
/* If this is new, insert it */
if( i_new == VLC_TRUE )
{
- INSERT_ELEM( p_cat->pp_infos,
- p_cat->i_infos,
- p_cat->i_infos,
- p_info );
+ INSERT_ELEM( p_cat->pp_infos, p_cat->i_infos, p_cat->i_infos, p_info );
}
return VLC_SUCCESS;
#include <string.h> /* strerror() */
#include <vlc/vlc.h>
-#include <vlc/vout.h>
-#include <vlc/sout.h>
+#include <vlc/input.h>
#include "vlc_playlist.h"
mtime_t i_duration, const char **ppsz_options,
int i_options )
{
- playlist_item_t * p_item =
+ playlist_item_t *p_item =
playlist_ItemNew( p_playlist , psz_uri, psz_name );
+
int i;
if( p_item == NULL )
return -1;
}
- p_item->i_duration = i_duration;
+ p_item->input.i_duration = i_duration;
- p_item->i_options = i_options;
- p_item->ppsz_options = NULL;
+ p_item->input.i_options = i_options;
+ p_item->input.ppsz_options = NULL;
for( i = 0; i < i_options; i++ )
{
if( i == 0 )
{
- p_item->ppsz_options = malloc( i_options * sizeof(char *) );
- if( !p_item->ppsz_options )
+ p_item->input.ppsz_options = malloc( i_options * sizeof(char *) );
+ if( !p_item->input.ppsz_options )
{
- p_item->i_options = 0;
+ p_item->input.i_options = 0;
break;
}
}
- p_item->ppsz_options[i] = strdup( ppsz_options[i] );
+ p_item->input.ppsz_options[i] = strdup( ppsz_options[i] );
}
return playlist_AddItem( p_playlist, p_item, i_mode, i_pos );
* regardless of it's size
* \return The id of the playlist item
*/
-int playlist_Add( playlist_t *p_playlist, const char * psz_uri,
- const char *psz_name, int i_mode, int i_pos )
+int playlist_Add( playlist_t *p_playlist, const char *psz_uri,
+ const char *psz_name, int i_mode, int i_pos )
{
- return playlist_AddExt ( p_playlist, psz_uri, psz_name, i_mode, i_pos,
+ return playlist_AddExt( p_playlist, psz_uri, psz_name, i_mode, i_pos,
-1, NULL, 0 );
}
-/**
- * Create a new item, without adding it to the playlist
- *
- * \param psz_uri the mrl of the item
- * \param psz_name a text giving a name or description of the item
- * \return the new item or NULL on failure
- */
-playlist_item_t * __playlist_ItemNew( vlc_object_t *p_obj,
- const char *psz_uri,
- const char *psz_name )
-{
- playlist_item_t * p_item;
-
- p_item = malloc( sizeof( playlist_item_t ) );
- if( p_item == NULL )
- {
- return NULL;
- }
- if( psz_uri == NULL)
- {
- return NULL;
- }
- memset( p_item, 0, sizeof( playlist_item_t ) );
- p_item->psz_uri = strdup( psz_uri );
- if( psz_name != NULL )
- {
- p_item->psz_name = strdup( psz_name );
- }
- else
- {
- p_item->psz_name = strdup ( psz_uri );
- }
- p_item->b_enabled = VLC_TRUE;
- p_item->i_group = PLAYLIST_TYPE_MANUAL;
-
- p_item->i_duration = -1;
- p_item->ppsz_options = NULL;
- p_item->i_options = 0;
-
- vlc_mutex_init( p_obj->p_vlc , &p_item->lock );
-
- playlist_ItemCreateCategory( p_item, _("General") );
- return p_item;
-}
-
-/**
- * Deletes a playlist item
- *
- * \param p_item the item to delete
- * \return nothing
- */
-void playlist_ItemDelete( playlist_item_t *p_item)
-{
- int i,j;
-
- vlc_mutex_lock( &p_item->lock );
-
- if( p_item->psz_name )
- {
- free( p_item->psz_name );
- }
- if( p_item->psz_uri )
- {
- free( p_item->psz_uri );
- }
-
- /* Free the info categories. Welcome to the segfault factory */
- if( p_item->i_categories > 0 )
- {
- for( i = 0; i < p_item->i_categories; i++ )
- {
- for( j= 0 ; j < p_item->pp_categories[i]->i_infos; j++)
- {
- if( p_item->pp_categories[i]->pp_infos[j]->psz_name)
- {
- free( p_item->pp_categories[i]->
- pp_infos[j]->psz_name);
- }
- if( p_item->pp_categories[i]->pp_infos[j]->psz_value)
- {
- free( p_item->pp_categories[i]->
- pp_infos[j]->psz_value);
- }
- free( p_item->pp_categories[i]->pp_infos[j] );
- }
- if( p_item->pp_categories[i]->i_infos )
- free( p_item->pp_categories[i]->pp_infos );
- if( p_item->pp_categories[i]->psz_name)
- {
- free( p_item->pp_categories[i]->psz_name );
- }
- free( p_item->pp_categories[i] );
- }
- free( p_item->pp_categories );
- }
-
- vlc_mutex_unlock( &p_item->lock );
- vlc_mutex_destroy( &p_item->lock );
-
- free( p_item );
-}
-
/***************************************************************************
* Item search functions
***************************************************************************/
return VLC_EGENERIC;
}
-
/**
* Search an item by its id
*
return VLC_ENOOBJ;
}
- vlc_mutex_lock( &p_item->lock );
+ vlc_mutex_lock( &p_item->input.lock );
playlist_ItemSetGroup( p_item , i_group );
- vlc_mutex_unlock( &p_item->lock );
+ vlc_mutex_unlock( &p_item->input.lock );
val.b_bool = (i_pos >= 0 && i_pos < p_playlist->i_size ) ? i_pos : -1;
var_Set( p_playlist, "item-change", val );
{
if( psz_name && p_item )
{
- p_item->psz_name = strdup( psz_name );
+ p_item->input.psz_name = strdup( psz_name );
return VLC_SUCCESS;
}
return VLC_EGENERIC;
return VLC_ENOOBJ;
}
- vlc_mutex_lock( &p_item->lock );
+ vlc_mutex_lock( &p_item->input.lock );
playlist_ItemSetName( p_item , psz_name );
- vlc_mutex_unlock( &p_item->lock );
+ vlc_mutex_unlock( &p_item->input.lock );
val.b_bool = (i_pos >= 0 && i_pos < p_playlist->i_size ) ? i_pos : -1;
var_Set( p_playlist, "item-change", val );
char psz_buffer[MSTRTIME_MAX_SIZE];
if( p_item )
{
- p_item->i_duration = i_duration;
+ p_item->input.i_duration = i_duration;
if( i_duration != -1 )
{
secstotimestr( psz_buffer, i_duration/1000000 );
memcpy( psz_buffer, "--:--:--", sizeof("--:--:--") );
}
playlist_ItemAddInfo( p_item, _("General") , _("Duration"),
- "%s", psz_buffer );
+ "%s", psz_buffer );
return VLC_SUCCESS;
}
return VLC_ENOOBJ;
}
- vlc_mutex_lock( &p_item->lock );
+ vlc_mutex_lock( &p_item->input.lock );
playlist_ItemSetDuration( p_item , i_duration );
- vlc_mutex_unlock( &p_item->lock );
+ vlc_mutex_unlock( &p_item->input.lock );
val.b_bool = (i_pos >= 0 && i_pos < p_playlist->i_size ) ? i_pos : -1;
var_Set( p_playlist, "item-change", val );
* Actions on existing playlist items
**********************************************************************/
-
/**
* delete an item from a playlist.
*
playlist_item_t *p_item = p_playlist->pp_items[i_pos];
msg_Dbg( p_playlist, "deleting playlist item `%s'",
- p_item->psz_name );
+ p_item->input.psz_name );
#if 0
int i,j;
}
/* Renumber the playlist */
- REMOVE_ELEM( p_playlist->pp_items,
- p_playlist->i_size,
- i_pos );
- if( p_playlist->i_enabled > 0 )
- p_playlist->i_enabled--;
+ REMOVE_ELEM( p_playlist->pp_items, p_playlist->i_size, i_pos );
+
+ if( p_playlist->i_enabled > 0 ) p_playlist->i_enabled--;
}
vlc_mutex_unlock( &p_playlist->object_lock );
* \param p_playlist the playlist to be cleared.
* \return returns 0
*/
-int playlist_Clear( playlist_t * p_playlist ) {
+int playlist_Clear( playlist_t * p_playlist )
+{
while( p_playlist->i_groups > 0 )
{
return 0;
}
-
/**
* Disables a playlist item
*
if( i_pos >= 0 && i_pos < p_playlist->i_size )
{
msg_Dbg( p_playlist, "disabling playlist item `%s'",
- p_playlist->pp_items[i_pos]->psz_name );
+ p_playlist->pp_items[i_pos]->input.psz_name );
if( p_playlist->pp_items[i_pos]->b_enabled == VLC_TRUE )
p_playlist->i_enabled--;
if( i_pos >= 0 && i_pos < p_playlist->i_size )
{
msg_Dbg( p_playlist, "enabling playlist item `%s'",
- p_playlist->pp_items[i_pos]->psz_name );
+ p_playlist->pp_items[i_pos]->input.psz_name );
if( p_playlist->pp_items[i_pos]->b_enabled == VLC_FALSE )
p_playlist->i_enabled++;
* \param i_group the id of the group to disable
* \return returns 0
*/
-int playlist_DisableGroup( playlist_t * p_playlist, int i_group)
+int playlist_DisableGroup( playlist_t * p_playlist, int i_group )
{
vlc_value_t val;
int i;
vlc_mutex_lock( &p_playlist->object_lock );
- msg_Dbg(p_playlist,"disabling group %i",i_group);
+ msg_Dbg( p_playlist, "disabling group %i", i_group );
for( i = 0 ; i< p_playlist->i_size; i++ )
{
if( p_playlist->pp_items[i]->i_group == i_group )
{
msg_Dbg( p_playlist, "disabling playlist item `%s'",
- p_playlist->pp_items[i]->psz_name );
+ p_playlist->pp_items[i]->input.psz_name );
if( p_playlist->pp_items[i]->b_enabled == VLC_TRUE )
p_playlist->i_enabled--;
* \param i_group the id of the group to enable
* \return returns 0
*/
-int playlist_EnableGroup( playlist_t * p_playlist, int i_group)
+int playlist_EnableGroup( playlist_t * p_playlist, int i_group )
{
- vlc_value_t val;
+ vlc_value_t val;
int i;
vlc_mutex_lock( &p_playlist->object_lock );
- for( i = 0 ; i< p_playlist->i_size; i++ )
+ for( i = 0; i< p_playlist->i_size; i++ )
{
if( p_playlist->pp_items[i]->i_group == i_group )
{
msg_Dbg( p_playlist, "enabling playlist item `%s'",
- p_playlist->pp_items[i]->psz_name );
+ p_playlist->pp_items[i]->input.psz_name );
if( p_playlist->pp_items[i]->b_enabled == VLC_FALSE )
p_playlist->i_enabled++;
* after the move
* \return returns VLC_SUCCESS
*/
-int playlist_Move( playlist_t * p_playlist, int i_pos, int i_newpos)
+int playlist_Move( playlist_t * p_playlist, int i_pos, int i_newpos )
{
- vlc_value_t val;
+ vlc_value_t val;
vlc_mutex_lock( &p_playlist->object_lock );
/* take into account that our own row disappears. */
- if ( i_pos < i_newpos ) i_newpos--;
+ if( i_pos < i_newpos ) i_newpos--;
- if( i_pos >= 0 && i_newpos >=0 && i_pos <= p_playlist->i_size
- && i_newpos <= p_playlist->i_size )
+ if( i_pos >= 0 && i_newpos >=0 && i_pos <= p_playlist->i_size &&
+ i_newpos <= p_playlist->i_size )
{
playlist_item_t * temp;
msg_Dbg( p_playlist, "moving playlist item `%s' (%i -> %i)",
- p_playlist->pp_items[i_pos]->psz_name, i_pos,
- i_newpos );
+ p_playlist->pp_items[i_pos]->input.psz_name, i_pos, i_newpos);
if( i_pos == p_playlist->i_index )
{
return VLC_SUCCESS;
}
-
-/**
- * Add a special info : option
- *
- * \param p_playlist the playlist
- * \param i_item the position of the item on which we
- * add the option ( -1 for current )
- * \param psz_value the option to add
- * \return the info category.
- */
-int playlist_AddOption( playlist_t *p_playlist, int i_pos,
- const char *psz_option )
-{
- playlist_item_t *p_item;
-
- /* Check the existence of the playlist */
- if( p_playlist == NULL)
- {
- return VLC_EGENERIC;
- }
-
- p_item = playlist_ItemGetByPos( p_playlist , i_pos );
- if( !p_item )
- {
- return VLC_ENOOBJ;
- }
-
- vlc_mutex_lock( &p_item->lock );
- INSERT_ELEM( p_item->ppsz_options, p_item->i_options, p_item->i_options,
- strdup( psz_option ) );
- vlc_mutex_unlock( &p_item->lock );
-
- return VLC_SUCCESS;
-}
#include <string.h> /* strerror() */
#include <vlc/vlc.h>
-#include <vlc/vout.h>
-#include <vlc/sout.h>
#include <vlc/input.h>
#include "vlc_playlist.h"
+/**
+ * Create a new item, without adding it to the playlist
+ *
+ * \param psz_uri the mrl of the item
+ * \param psz_name a text giving a name or description of the item
+ * \return the new item or NULL on failure
+ */
+playlist_item_t * __playlist_ItemNew( vlc_object_t *p_obj,
+ const char *psz_uri,
+ const char *psz_name )
+{
+ playlist_item_t * p_item;
+
+ p_item = malloc( sizeof( playlist_item_t ) );
+ if( p_item == NULL ) return NULL;
+ if( psz_uri == NULL) return NULL;
+
+ memset( p_item, 0, sizeof( playlist_item_t ) );
+
+ p_item->input.psz_uri = strdup( psz_uri );
+
+ if( psz_name != NULL ) p_item->input.psz_name = strdup( psz_name );
+ else p_item->input.psz_name = strdup ( psz_uri );
+ p_item->b_enabled = VLC_TRUE;
+ p_item->i_group = PLAYLIST_TYPE_MANUAL;
+ p_item->input.i_duration = -1;
+ p_item->input.ppsz_options = NULL;
+ p_item->input.i_options = 0;
+ vlc_mutex_init( p_obj, &p_item->input.lock );
+
+ playlist_ItemCreateCategory( p_item, _("General") );
+ return p_item;
+}
+
+/**
+ * Deletes a playlist item
+ *
+ * \param p_item the item to delete
+ * \return nothing
+ */
+void playlist_ItemDelete( playlist_item_t *p_item )
+{
+#if 0
+ int i,j;
+#endif
+
+ vlc_mutex_lock( &p_item->input.lock );
+
+ if( p_item->input.psz_name ) free( p_item->input.psz_name );
+ if( p_item->input.psz_uri ) free( p_item->input.psz_uri );
+
+#if 0
+ /* Free the info categories. Welcome to the segfault factory */
+ if( p_item->i_categories > 0 )
+ {
+ for( i = 0; i < p_item->i_categories; i++ )
+ {
+ for( j= 0 ; j < p_item->pp_categories[i]->i_infos; j++)
+ {
+ if( p_item->pp_categories[i]->pp_infos[j]->psz_name)
+ {
+ free( p_item->pp_categories[i]->
+ pp_infos[j]->psz_name);
+ }
+ if( p_item->pp_categories[i]->pp_infos[j]->psz_value)
+ {
+ free( p_item->pp_categories[i]->
+ pp_infos[j]->psz_value);
+ }
+ free( p_item->pp_categories[i]->pp_infos[j] );
+ }
+ if( p_item->pp_categories[i]->i_infos )
+ free( p_item->pp_categories[i]->pp_infos );
+ if( p_item->pp_categories[i]->psz_name)
+ {
+ free( p_item->pp_categories[i]->psz_name );
+ }
+ free( p_item->pp_categories[i] );
+ }
+ free( p_item->pp_categories );
+ }
+#endif
+
+ vlc_mutex_unlock( &p_item->input.lock );
+ vlc_mutex_destroy( &p_item->input.lock );
+
+ free( p_item );
+}
/**
* Add a playlist item into a playlist
* PLAYLIST_END the item will be added at the end of the playlist
* regardless of it's size
* \return The id of the playlist item
-*/
-int playlist_AddItem( playlist_t *p_playlist, playlist_item_t * p_item,
- int i_mode, int i_pos)
+ */
+int playlist_AddItem( playlist_t *p_playlist, playlist_item_t *p_item,
+ int i_mode, int i_pos)
{
- vlc_value_t val;
+ vlc_value_t val;
vlc_mutex_lock( &p_playlist->object_lock );
{
for ( j = 0; j < p_playlist->i_size; j++ )
{
- if ( !strcmp( p_playlist->pp_items[j]->psz_uri, p_item->psz_uri ) )
+ if ( !strcmp( p_playlist->pp_items[j]->input.psz_uri,
+ p_item->input.psz_uri ) )
{
- if( p_item->psz_name )
+ if ( p_item->input.psz_name )
{
- free( p_item->psz_name );
+ free( p_item->input.psz_name );
}
- if( p_item->psz_uri )
+ if ( p_item->input.psz_uri )
{
- free( p_item->psz_uri );
+ free ( p_item->input.psz_uri );
}
free( p_item );
vlc_mutex_unlock( &p_playlist->object_lock );
i_mode |= PLAYLIST_APPEND;
}
-
msg_Dbg( p_playlist, "adding playlist item `%s' ( %s )",
- p_item->psz_name, p_item->psz_uri );
-
+ p_item->input.psz_name, p_item->input.psz_uri );
p_item->i_id = ++p_playlist->i_last_id;
i_pos = p_playlist->i_size;
}
- INSERT_ELEM( p_playlist->pp_items,
- p_playlist->i_size,
- i_pos,
- p_item );
+ INSERT_ELEM( p_playlist->pp_items, p_playlist->i_size, i_pos, p_item );
p_playlist->i_enabled ++;
if( p_playlist->i_index >= i_pos )
else
{
/* i_mode == PLAYLIST_REPLACE and 0 <= i_pos < p_playlist->i_size */
- if( p_playlist->pp_items[i_pos]->psz_name )
+ if( p_playlist->pp_items[i_pos]->input.psz_name )
{
- free( p_playlist->pp_items[i_pos]->psz_name );
+ free( p_playlist->pp_items[i_pos]->input.psz_name );
}
- if( p_playlist->pp_items[i_pos]->psz_uri )
+ if( p_playlist->pp_items[i_pos]->input.psz_uri )
{
- free( p_playlist->pp_items[i_pos]->psz_uri );
+ free( p_playlist->pp_items[i_pos]->input.psz_uri );
}
/* XXX: what if the item is still in use? */
free( p_playlist->pp_items[i_pos] );
* \param p_item the item on which we want the info
* \param psz_format the option
* \return 0 on success
-*/
-int playlist_ItemAddOption( playlist_item_t *p_item,
- const char *psz_option )
+ */
+int playlist_ItemAddOption( playlist_item_t *p_item, const char *psz_option )
{
if( !psz_option ) return VLC_EGENERIC;
- INSERT_ELEM( p_item->ppsz_options, p_item->i_options, p_item->i_options,
- strdup( psz_option ) );
+ vlc_mutex_lock( &p_item->input.lock );
+ INSERT_ELEM( p_item->input.ppsz_options, p_item->input.i_options,
+ p_item->input.i_options, strdup( psz_option ) );
+ vlc_mutex_unlock( &p_item->input.lock );
return VLC_SUCCESS;
}
p_item = p_playlist->pp_items[p_playlist->i_index];
p_item->i_nb_played++;
- p_playlist->p_input = input_CreateThread( p_playlist, p_item->psz_uri,
- p_item->ppsz_options,
- p_item->i_options );
+ p_playlist->p_input = input_CreateThread( p_playlist, &p_item->input );
val.i_int = p_playlist->i_index;
/* unlock the playlist to set the var...mmm */
* sort.c : Playlist sorting functions
*****************************************************************************
* Copyright (C) 1999-2004 VideoLAN
- * $Id: sort.c,v 1.9 2004/01/23 10:48:08 zorglub Exp $
+ * $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
*
#include <string.h> /* strerror() */
#include <vlc/vlc.h>
+#include <vlc/input.h>
#include <vlc/vout.h>
#include <vlc/sout.h>
}
else if( i_mode == SORT_TITLE )
{
- i_test = strcasecmp( p_playlist->pp_items[i]->psz_name,
- p_playlist->pp_items[i_small]->psz_name );
+ i_test = strcasecmp( p_playlist->pp_items[i]->input.psz_name,
+ p_playlist->pp_items[i_small]->input.psz_name );
}
else if( i_mode == SORT_GROUP )
{
i_test = p_playlist->pp_items[i]->i_group -
- p_playlist->pp_items[i_small]->i_group;
+ p_playlist->pp_items[i_small]->i_group;
}
else if( i_mode == SORT_DURATION )
{
- i_test = p_playlist->pp_items[i]->i_duration -
- p_playlist->pp_items[i_small]->i_duration;
+ i_test = p_playlist->pp_items[i]->input.i_duration -
+ p_playlist->pp_items[i_small]->input.i_duration;
}
else if( i_mode == SORT_AUTHOR )
{