Commit dd3a0dd1 authored by Laurent Aimar's avatar Laurent Aimar

Moved input_item_t from input_source_t to input_thread_private_t.

parent 4af875f0
......@@ -320,6 +320,7 @@ SOURCES_libvlc_common = \
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 \
......
This diff is collapsed.
......@@ -978,10 +978,8 @@ static void EsOutProgramSelect( es_out_t *out, es_out_pgrm_t *p_pgrm )
}
/* 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 );
}
......@@ -1170,7 +1168,7 @@ static void EsOutProgramMeta( es_out_t *out, int i_group, vlc_meta_t *p_meta )
{
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 );
......@@ -1296,7 +1294,7 @@ static void EsOutProgramEpg( es_out_t *out, int i_group, vlc_epg_t *p_epg )
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 );
}
......@@ -1373,9 +1371,9 @@ static es_out_id_t *EsOutAdd( es_out_t *out, const es_format_t *fmt )
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++ )
{
......
......@@ -53,7 +53,7 @@ void input_SendEventTimes( input_thread_t *p_input,
/* 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 );
......@@ -168,7 +168,7 @@ void input_SendEventMeta( input_thread_t *p_input )
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 )
......@@ -179,7 +179,7 @@ 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 )
......@@ -191,7 +191,7 @@ 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 );
}
/*****************************************************************************
......
......@@ -42,6 +42,7 @@
#include "access.h"
#include "demux.h"
#include "stream.h"
#include "item.h"
#include <vlc_sout.h>
#include "../stream_output/stream_output.h"
......@@ -188,9 +189,10 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
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;
......@@ -316,7 +318,7 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
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
......@@ -329,7 +331,7 @@ static void Destructor( input_thread_t * p_input )
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 );
......@@ -464,6 +466,18 @@ sout_instance_t *input_DetachSout( input_thread_t *p_input )
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
*****************************************************************************/
......@@ -684,7 +698,7 @@ static void MainLoopInterface( input_thread_t *p_input )
*/
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 )
{
......@@ -831,7 +845,7 @@ static int InitSout( input_thread_t * 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 )
......@@ -1018,7 +1032,7 @@ static void LoadSubtitles( input_thread_t *p_input )
{
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++ )
......@@ -1125,9 +1139,9 @@ static int Init( input_thread_t * p_input )
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", "" );
......@@ -1156,7 +1170,7 @@ static int Init( input_thread_t * p_input )
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;
}
......@@ -1170,7 +1184,7 @@ static int Init( input_thread_t * p_input )
&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 )
......@@ -1216,7 +1230,7 @@ static int Init( input_thread_t * p_input )
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 );
}
......@@ -1336,7 +1350,7 @@ static void End( input_thread_t * p_input )
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,
......@@ -2559,17 +2573,17 @@ static int InputSourceInit( input_thread_t *p_input,
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 )
......@@ -2658,10 +2672,10 @@ static void InputSourceMeta( input_thread_t *p_input,
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 );
}
......@@ -2780,7 +2794,7 @@ static void InputMetaUser( input_thread_t *p_input, vlc_meta_t *p_meta )
*****************************************************************************/
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 );
......@@ -2910,7 +2924,7 @@ static void input_ChangeState( input_thread_t *p_input, int i_state )
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 );
}
}
......
......@@ -43,9 +43,6 @@
/* 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;
......@@ -118,6 +115,8 @@ struct input_thread_private_t
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;
......@@ -212,8 +211,6 @@ void input_ControlPush( input_thread_t *, int i_type, vlc_value_t * );
* 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
***************************************************************************/
......
......@@ -30,7 +30,7 @@
#include "vlc_playlist.h"
#include "vlc_interface.h"
#include "input_internal.h"
#include "item.h"
static void GuessType( input_item_t *p_item );
......@@ -211,18 +211,6 @@ void input_item_SetMeta( input_item_t *p_i, vlc_meta_type_t meta_type, const cha
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,
......
/*****************************************************************************
* 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
......@@ -447,7 +447,7 @@ int input_DownloadAndCacheArt( playlist_t *p_playlist, input_item_t *p_item )
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment