input/es_out.h \
input/es_out_timeshift.h \
input/event.h \
+ input/item.h \
input/stream.h \
input/input_internal.h \
input/input_interface.h \
if( vasprintf( &psz_value, psz_format, args ) == -1 )
return VLC_EGENERIC;
- int i_ret = input_item_AddInfo( p_input->p->input.p_item,
+ int i_ret = input_item_AddInfo( p_input->p->p_item,
psz_cat, psz_name, "%s", psz_value );
free( psz_value );
char *psz_cat = (char *)va_arg( args, char * );
char *psz_name = (char *)va_arg( args, char * );
- int i_ret = input_item_DelInfo( p_input->p->input.p_item,
+ int i_ret = input_item_DelInfo( p_input->p->p_item,
psz_cat, psz_name );
if( !p_input->b_preparsing && !i_ret )
int i_ret = VLC_EGENERIC;
*ppsz_value = NULL;
- *ppsz_value = input_item_GetInfo( p_input->p->input.p_item,
+ *ppsz_value = input_item_GetInfo( p_input->p->p_item,
psz_cat, psz_name );
return i_ret;
}
if( !psz_name ) return VLC_EGENERIC;
- vlc_mutex_lock( &p_input->p->input.p_item->lock );
- if( p_input->p->input.p_item->psz_name )
- free( p_input->p->input.p_item->psz_name );
- p_input->p->input.p_item->psz_name = strdup( psz_name );
- vlc_mutex_unlock( &p_input->p->input.p_item->lock );
+ input_item_SetName( p_input->p->p_item, psz_name );
if( !p_input->b_preparsing )
input_SendEventMetaName( p_input, psz_name );
p_bkmk = (seekpoint_t *)va_arg( args, seekpoint_t * );
p_bkmk = vlc_seekpoint_Duplicate( p_bkmk );
- vlc_mutex_lock( &p_input->p->input.p_item->lock );
+ vlc_mutex_lock( &p_input->p->p_item->lock );
if( !p_bkmk->psz_name )
{
if( asprintf( &p_bkmk->psz_name, _("Bookmark %i"),
&val, &text );
}
}
- vlc_mutex_unlock( &p_input->p->input.p_item->lock );
+ vlc_mutex_unlock( &p_input->p->p_item->lock );
UpdateBookmarksOption( p_input );
p_bkmk = (seekpoint_t *)va_arg( args, seekpoint_t * );
i_bkmk = (int)va_arg( args, int );
- vlc_mutex_lock( &p_input->p->input.p_item->lock );
+ vlc_mutex_lock( &p_input->p->p_item->lock );
if( i_bkmk < p_input->p->i_bookmark )
{
vlc_value_t val, text;
&val, &text );
}
}
- vlc_mutex_unlock( &p_input->p->input.p_item->lock );
+ vlc_mutex_unlock( &p_input->p->p_item->lock );
UpdateBookmarksOption( p_input );
case INPUT_DEL_BOOKMARK:
i_bkmk = (int)va_arg( args, int );
- vlc_mutex_lock( &p_input->p->input.p_item->lock );
+ vlc_mutex_lock( &p_input->p->p_item->lock );
if( i_bkmk < p_input->p->i_bookmark )
{
vlc_value_t val, text;
var_Change( p_input, "bookmark", VLC_VAR_ADDCHOICE,
&val, &text );
}
- vlc_mutex_unlock( &p_input->p->input.p_item->lock );
+ vlc_mutex_unlock( &p_input->p->p_item->lock );
UpdateBookmarksOption( p_input );
return VLC_SUCCESS;
}
- vlc_mutex_unlock( &p_input->p->input.p_item->lock );
+ vlc_mutex_unlock( &p_input->p->p_item->lock );
return VLC_EGENERIC;
ppp_bkmk = (seekpoint_t ***)va_arg( args, seekpoint_t *** );
pi_bkmk = (int *)va_arg( args, int * );
- vlc_mutex_lock( &p_input->p->input.p_item->lock );
+ vlc_mutex_lock( &p_input->p->p_item->lock );
if( p_input->p->i_bookmark )
{
int i;
vlc_seekpoint_Duplicate(p_input->p->bookmark[i]);
}
- vlc_mutex_unlock( &p_input->p->input.p_item->lock );
+ vlc_mutex_unlock( &p_input->p->p_item->lock );
return VLC_SUCCESS;
}
else
*ppp_bkmk = NULL;
*pi_bkmk = 0;
- vlc_mutex_unlock( &p_input->p->input.p_item->lock );
+ vlc_mutex_unlock( &p_input->p->p_item->lock );
return VLC_EGENERIC;
}
break;
case INPUT_CLEAR_BOOKMARKS:
- vlc_mutex_lock( &p_input->p->input.p_item->lock );
+ vlc_mutex_lock( &p_input->p->p_item->lock );
if( p_input->p->i_bookmark )
{
int i;
}
var_Change( p_input, "bookmark", VLC_VAR_CLEARCHOICES, 0, 0 );
}
- vlc_mutex_unlock( &p_input->p->input.p_item->lock );
+ vlc_mutex_unlock( &p_input->p->p_item->lock );
UpdateBookmarksOption( p_input );
case INPUT_SET_BOOKMARK:
i_bkmk = (int)va_arg( args, int );
- vlc_mutex_lock( &p_input->p->input.p_item->lock );
+ vlc_mutex_lock( &p_input->p->p_item->lock );
if( i_bkmk >= 0 && i_bkmk < p_input->p->i_bookmark )
{
vlc_value_t pos;
// don't crash on bookmarks in live streams
if( stream_Size( p_input->p->input.p_stream ) == 0 )
{
- vlc_mutex_unlock( &p_input->p->input.p_item->lock );
+ vlc_mutex_unlock( &p_input->p->p_item->lock );
return VLC_EGENERIC;
}
pos.f_float = !p_input->p->input.p_stream ? 0 :
i_ret = var_Set( p_input, "position", pos );
}
- vlc_mutex_unlock( &p_input->p->input.p_item->lock );
+ vlc_mutex_unlock( &p_input->p->p_item->lock );
return i_ret;
}
else
{
- vlc_mutex_unlock( &p_input->p->input.p_item->lock );
+ vlc_mutex_unlock( &p_input->p->p_item->lock );
return VLC_EGENERIC;
}
if( asprintf( &str, "%s=%s", psz_option, psz_value ) == -1 )
return VLC_ENOMEM;
- i = input_item_AddOpt( p_input->p->input.p_item, str,
+ i = input_item_AddOpt( p_input->p->p_item, str,
VLC_INPUT_OPTION_UNIQUE );
free( str );
return i;
{
int i;
pf = (double*)va_arg( args, double * );
- vlc_mutex_lock( &p_input->p->input.p_item->lock );
+ vlc_mutex_lock( &p_input->p->p_item->lock );
*pf = p_input->p->input.f_fps;
for( i = 0; i < p_input->p->i_slave && *pf <= 0.001; i++ )
*pf = p_input->p->slave[i]->f_fps;
- vlc_mutex_unlock( &p_input->p->input.p_item->lock );
+ vlc_mutex_unlock( &p_input->p->p_item->lock );
return VLC_SUCCESS;
}
int *pi_attachment = (int*)va_arg( args, int * );
int i;
- vlc_mutex_lock( &p_input->p->input.p_item->lock );
+ vlc_mutex_lock( &p_input->p->p_item->lock );
if( p_input->p->i_attachment <= 0 )
{
- vlc_mutex_unlock( &p_input->p->input.p_item->lock );
+ vlc_mutex_unlock( &p_input->p->p_item->lock );
*ppp_attachment = NULL;
*pi_attachment = 0;
return VLC_EGENERIC;
for( i = 0; i < p_input->p->i_attachment; i++ )
(*ppp_attachment)[i] = vlc_input_attachment_Duplicate( p_input->p->attachment[i] );
- vlc_mutex_unlock( &p_input->p->input.p_item->lock );
+ vlc_mutex_unlock( &p_input->p->p_item->lock );
return VLC_SUCCESS;
}
const char *psz_name = (const char*)va_arg( args, const char * );
int i;
- vlc_mutex_lock( &p_input->p->input.p_item->lock );
+ vlc_mutex_lock( &p_input->p->p_item->lock );
for( i = 0; i < p_input->p->i_attachment; i++ )
{
if( !strcmp( p_input->p->attachment[i]->psz_name, psz_name ) )
{
*pp_attachment = vlc_input_attachment_Duplicate( p_input->p->attachment[i] );
- vlc_mutex_unlock( &p_input->p->input.p_item->lock );
+ vlc_mutex_unlock( &p_input->p->p_item->lock );
return VLC_SUCCESS;
}
}
*pp_attachment = NULL;
- vlc_mutex_unlock( &p_input->p->input.p_item->lock );
+ vlc_mutex_unlock( &p_input->p->p_item->lock );
return VLC_EGENERIC;
}
int i, i_len = 0;
char *psz_value = NULL, *psz_next = NULL;
- vlc_mutex_lock( &p_input->p->input.p_item->lock );
+ vlc_mutex_lock( &p_input->p->p_item->lock );
if( p_input->p->i_bookmark > 0 )
{
for( i = 0; i < p_input->p->i_bookmark; i++ )
*psz_next = ','; psz_next++;
}
}
- vlc_mutex_unlock( &p_input->p->input.p_item->lock );
+ vlc_mutex_unlock( &p_input->p->p_item->lock );
input_Control( p_input, INPUT_ADD_OPTION, "bookmarks",
psz_value ? psz_value : "" );
}
/* Update now playing */
- input_item_SetNowPlaying( p_input->p->input.p_item,
- p_pgrm->psz_now_playing );
- input_item_SetPublisher( p_input->p->input.p_item,
- p_pgrm->psz_publisher );
+ input_item_SetNowPlaying( p_input->p->p_item, p_pgrm->psz_now_playing );
+ input_item_SetPublisher( p_input->p->p_item, p_pgrm->psz_publisher );
input_SendEventMeta( p_input );
}
{
if( p_sys->p_pgrm == p_pgrm )
{
- input_item_SetPublisher( p_input->p->input.p_item, psz_provider );
+ input_item_SetPublisher( p_input->p->p_item, psz_provider );
input_SendEventMeta( p_input );
}
input_Control( p_input, INPUT_ADD_INFO, psz_cat, input_MetaTypeToLocalizedString(vlc_meta_Publisher), psz_provider );
if( p_pgrm == p_sys->p_pgrm )
{
- input_item_SetNowPlaying( p_input->p->input.p_item, p_pgrm->psz_now_playing );
+ input_item_SetNowPlaying( p_input->p->p_item, p_pgrm->psz_now_playing );
input_SendEventMeta( p_input );
}
es->i_channel = p_sys->i_audio;
memset( &rg, 0, sizeof(rg) );
- vlc_mutex_lock( &p_input->p->input.p_item->lock );
- vlc_audio_replay_gain_MergeFromMeta( &rg, p_input->p->input.p_item->p_meta );
- vlc_mutex_unlock( &p_input->p->input.p_item->lock );
+ vlc_mutex_lock( &p_input->p->p_item->lock );
+ vlc_audio_replay_gain_MergeFromMeta( &rg, p_input->p->p_item->p_meta );
+ vlc_mutex_unlock( &p_input->p->p_item->lock );
for( i = 0; i < AUDIO_REPLAY_GAIN_MAX; i++ )
{
/* FIXME ugly + what about meta change event ? */
if( var_GetTime( p_input, "length" ) != i_length )
- input_item_SetDuration( p_input->p->input.p_item, i_length );
+ input_item_SetDuration( p_input->p->p_item, i_length );
val.i_time = i_length;
var_Change( p_input, "length", VLC_VAR_SETVALUE, &val, NULL );
event.type = vlc_InputItemMetaChanged;
event.u.input_item_meta_changed.meta_type = vlc_meta_ArtworkURL;
- vlc_event_send( &p_input->p->input.p_item->event_manager, &event );
+ vlc_event_send( &p_input->p->p_item->event_manager, &event );
}
void input_SendEventMetaInfo( input_thread_t *p_input )
vlc_event_t event;
event.type = vlc_InputItemInfoChanged;
- vlc_event_send( &p_input->p->input.p_item->event_manager, &event );
+ vlc_event_send( &p_input->p->p_item->event_manager, &event );
}
void input_SendEventMetaName( input_thread_t *p_input, const char *psz_name )
event.type = vlc_InputItemNameChanged;
event.u.input_item_name_changed.new_name = psz_name;
- vlc_event_send( &p_input->p->input.p_item->event_manager, &event );
+ vlc_event_send( &p_input->p->p_item->event_manager, &event );
}
/*****************************************************************************
#include "access.h"
#include "demux.h"
#include "stream.h"
+#include "item.h"
#include <vlc_sout.h>
#include "../stream_output/stream_output.h"
p_input->p->b_out_pace_control = false;
p_input->i_pts_delay = 0;
- /* Init Input fields */
vlc_gc_incref( p_item ); /* Released in Destructor() */
- p_input->p->input.p_item = p_item;
+ p_input->p->p_item = p_item;
+
+ /* Init Input fields */
p_input->p->input.p_access = NULL;
p_input->p->input.p_stream = NULL;
p_input->p->input.p_demux = NULL;
static void Destructor( input_thread_t * p_input )
{
#ifndef NDEBUG
- char * psz_name = input_item_GetName( p_input->p->input.p_item );
+ char * psz_name = input_item_GetName( p_input->p->p_item );
msg_Dbg( p_input, "Destroying the input for '%s'", psz_name);
free( psz_name );
#endif
if( p_input->p->p_sout )
sout_DeleteInstance( p_input->p->p_sout );
#endif
- vlc_gc_decref( p_input->p->input.p_item );
+ vlc_gc_decref( p_input->p->p_item );
vlc_mutex_destroy( &p_input->p->counters.counters_lock );
return p_sout;
}
+/**
+ * Get the item from an input thread
+ * FIXME it does not increase ref count of the item.
+ * if it is used after p_input is destroyed nothing prevent it from
+ * being freed.
+ */
+input_item_t *input_GetItem( input_thread_t *p_input )
+{
+ assert( p_input && p_input->p );
+ return p_input->p->p_item;
+}
+
/*****************************************************************************
* ObjectKillChildrens
*****************************************************************************/
*/
static void MainLoopStatistic( input_thread_t *p_input )
{
- stats_ComputeInputStats( p_input, p_input->p->input.p_item->p_stats );
+ stats_ComputeInputStats( p_input, p_input->p->p_item->p_stats );
/* Are we the thread responsible for computing global stats ? */
if( libvlc_priv( p_input->p_libvlc )->p_stats_computer == p_input )
{
/* Find a usable sout and attach it to p_input */
psz = var_GetNonEmptyString( p_input, "sout" );
- if( psz && strncasecmp( p_input->p->input.p_item->psz_uri, "vlc:", 4 ) )
+ if( psz && strncasecmp( p_input->p->p_item->psz_uri, "vlc:", 4 ) )
{
/* Check the validity of the provided sout */
if( p_input->p->p_sout )
{
char *psz_autopath = var_GetNonEmptyString( p_input, "sub-autodetect-path" );
char **ppsz_subs = subtitles_Detect( p_input, psz_autopath,
- p_input->p->input.p_item->psz_uri );
+ p_input->p->p_item->psz_uri );
free( psz_autopath );
for( int i = 0; ppsz_subs && ppsz_subs[i]; i++ )
vlc_meta_t *p_meta;
int i, ret;
- for( i = 0; i < p_input->p->input.p_item->i_options; i++ )
+ for( i = 0; i < p_input->p->p_item->i_options; i++ )
{
- if( !strncmp( p_input->p->input.p_item->ppsz_options[i], "meta-file", 9 ) )
+ if( !strncmp( p_input->p->p_item->ppsz_options[i], "meta-file", 9 ) )
{
msg_Dbg( p_input, "Input is a meta file: disabling unneeded options" );
var_SetString( p_input, "sout", "" );
var_Create( p_input, "sample-rate", VLC_VAR_INTEGER );
if( InputSourceInit( p_input, &p_input->p->input,
- p_input->p->input.p_item->psz_uri, NULL ) )
+ p_input->p->p_item->psz_uri, NULL ) )
{
goto error;
}
&i_length ) )
i_length = 0;
if( i_length <= 0 )
- i_length = input_item_GetDuration( p_input->p->input.p_item );
+ i_length = input_item_GetDuration( p_input->p->p_item );
input_SendEventTimes( p_input, 0.0, 0, i_length );
if( !p_input->b_preparsing )
if( !p_input->b_preparsing )
{
msg_Dbg( p_input, "`%s' successfully opened",
- p_input->p->input.p_item->psz_uri );
+ p_input->p->p_item->psz_uri );
}
libvlc_priv_t *p_private = libvlc_priv( p_input->p_libvlc );
/* make sure we are up to date */
- stats_ComputeInputStats( p_input, p_input->p->input.p_item->p_stats );
+ stats_ComputeInputStats( p_input, p_input->p->p_item->p_stats );
if( p_private->p_stats_computer == p_input )
{
stats_ComputeGlobalStats( p_input->p_libvlc,
if( !demux_Control( in->p_demux, DEMUX_GET_ATTACHMENTS,
&attachment, &i_attachment ) )
{
- vlc_mutex_lock( &p_input->p->input.p_item->lock );
+ vlc_mutex_lock( &p_input->p->p_item->lock );
AppendAttachment( &p_input->p->i_attachment, &p_input->p->attachment,
i_attachment, attachment );
- vlc_mutex_unlock( &p_input->p->input.p_item->lock );
+ vlc_mutex_unlock( &p_input->p->p_item->lock );
}
}
if( !demux_Control( in->p_demux, DEMUX_GET_FPS, &f_fps ) )
{
- vlc_mutex_lock( &p_input->p->input.p_item->lock );
+ vlc_mutex_lock( &p_input->p->p_item->lock );
in->f_fps = f_fps;
- vlc_mutex_unlock( &p_input->p->input.p_item->lock );
+ vlc_mutex_unlock( &p_input->p->p_item->lock );
}
if( var_GetInteger( p_input, "clock-synchro" ) != -1 )
if( p_demux_meta->i_attachments > 0 )
{
- vlc_mutex_lock( &p_input->p->input.p_item->lock );
+ vlc_mutex_lock( &p_input->p->p_item->lock );
AppendAttachment( &p_input->p->i_attachment, &p_input->p->attachment,
p_demux_meta->i_attachments, p_demux_meta->attachments );
- vlc_mutex_unlock( &p_input->p->input.p_item->lock );
+ vlc_mutex_unlock( &p_input->p->p_item->lock );
}
module_unneed( p_demux, p_id3 );
}
*****************************************************************************/
static void InputUpdateMeta( input_thread_t *p_input, vlc_meta_t *p_meta )
{
- input_item_t *p_item = p_input->p->input.p_item;
+ input_item_t *p_item = p_input->p->p_item;
char *psz_title = NULL;
char *psz_arturl = input_item_GetArtURL( p_item );
if( b_changed )
{
- input_item_SetErrorWhenReading( p_input->p->input.p_item, p_input->b_error );
+ input_item_SetErrorWhenReading( p_input->p->p_item, p_input->b_error );
input_SendEventState( p_input, i_state );
}
}
/* input_source_t: gathers all information per input source */
typedef struct
{
- /* Input item description */
- input_item_t *p_item;
-
/* Access/Stream/Demux plugins */
access_t *p_access;
stream_t *p_stream;
bool b_out_pace_control; /* idem ? */
/* Main input properties */
+ input_item_t *p_item;
+
input_source_t input;
/* Slave demuxers (subs, and others) */
int i_slave;
* Becarefull; p_item lock HAS to be taken */
void input_ExtractAttachmentAndCacheArt( input_thread_t *p_input );
-void input_item_SetErrorWhenReading( input_item_t *p_i, bool b_error );
-
/***************************************************************************
* Internal prototypes
***************************************************************************/
#include "vlc_playlist.h"
#include "vlc_interface.h"
-#include "input_internal.h"
+#include "item.h"
static void GuessType( input_item_t *p_item );
vlc_event_send( &p_i->event_manager, &event );
}
-/**
- * Get the item from an input thread
- * FIXME it does not increase ref count of the item.
- * if it is used after p_input is destroyed nothing prevent it from
- * being freed.
- */
-input_item_t *input_GetItem( input_thread_t *p_input )
-{
- assert( p_input && p_input->p );
- return p_input->p->input.p_item;
-}
-
/* FIXME GRRRRRRRRRR args should be in the reverse order to be
* consistant with (nearly?) all or copy funcs */
void input_item_CopyOptions( input_item_t *p_parent,
--- /dev/null
+/*****************************************************************************
+ * item.h
+ *****************************************************************************
+ * Copyright (C) 2008 Laurent Aimar
+ * $Id$
+ *
+ * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ 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
+ * 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#if defined(__PLUGIN__) || defined(__BUILTIN__) || !defined(__LIBVLC__)
+# error This header file can only be included from LibVLC.
+#endif
+
+#ifndef _INPUT_ITEM_H
+#define _INPUT_ITEM_H 1
+
+#include "input_interface.h"
+
+void input_item_SetErrorWhenReading( input_item_t *p_i, bool b_error );
+
+#endif
void input_ExtractAttachmentAndCacheArt( input_thread_t *p_input )
{
- input_item_t *p_item = p_input->p->input.p_item;
+ input_item_t *p_item = p_input->p->p_item;
const char *psz_arturl;
const char *psz_artist = NULL;
const char *psz_album = NULL;