#include "../utils/var_bool.hpp"
#include <sstream>
+#include <assert.h>
VlcProc *VlcProc::instance( intf_thread_t *pIntf )
{
m_pVout = NULL;
}
- if( getIntf()->p_sys->p_input )
- reset_input();
-
interaction_Unregister( getIntf() );
var_DelCallback( getIntf()->p_libvlc, "volume-change",
void VlcProc::on_item_current_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
- playlist_t * pPlaylist = getIntf()->p_sys->p_playlist;
- input_thread_t* pInput = getIntf()->p_sys->p_input;
input_item_t *p_item = static_cast<input_item_t*>(newVal.p_address);
- if( pInput )
- reset_input();
-
- pInput = playlist_CurrentInput( pPlaylist );
- if( pInput )
- getIntf()->p_sys->p_input = pInput;
-
// Update the stream variable
updateStreamName();
{
input_thread_t* pInput = (input_thread_t*) p_obj;
+ assert( getIntf()->p_sys->p_input == NULL || getIntf()->p_sys->p_input == pInput );
+
+ if( !getIntf()->p_sys->p_input )
+ {
+ msg_Dbg( getIntf(), "new input %p detected", pInput );
+
+ getIntf()->p_sys->p_input = pInput;
+ vlc_object_hold( pInput );
+ }
+
switch( newVal.i_int )
{
case INPUT_EVENT_STATE:
break;
case INPUT_EVENT_DEAD:
+ msg_Dbg( getIntf(), "end of input detected for %p", pInput );
+
+ var_DelCallback( pInput, "intf-event", onGenericCallback, this );
+ var_DelCallback( pInput, "bit-rate", onGenericCallback, this );
+ var_DelCallback( pInput, "sample-rate", onGenericCallback, this );
+ var_DelCallback( pInput, "can-record" , onGenericCallback, this );
+ vlc_object_release( pInput );
+ getIntf()->p_sys->p_input = NULL;
reset_input();
break;
{
input_thread_t* pInput = (input_thread_t*) p_obj;
+ assert( getIntf()->p_sys->p_input == NULL || getIntf()->p_sys->p_input == pInput );
+
int bitrate = var_GetInteger( pInput, "bit-rate" ) / 1000;
SET_TEXT( m_cVarStreamBitRate, UString::fromInt( getIntf(), bitrate ) );
}
{
input_thread_t* pInput = (input_thread_t*) p_obj;
+ assert( getIntf()->p_sys->p_input == NULL || getIntf()->p_sys->p_input == pInput );
+
int sampleRate = var_GetInteger( pInput, "sample-rate" ) / 1000;
SET_TEXT( m_cVarStreamSampleRate, UString::fromInt(getIntf(),sampleRate) );
}
{
input_thread_t* pInput = (input_thread_t*) p_obj;
+ assert( getIntf()->p_sys->p_input == NULL || getIntf()->p_sys->p_input == pInput );
+
SET_BOOL( m_cVarRecordable, var_GetBool( pInput, "can-record" ) );
}
void VlcProc::reset_input()
{
- input_thread_t* pInput = getIntf()->p_sys->p_input;
- if( !pInput ) return;
-
SET_BOOL( m_cVarSeekable, false );
SET_BOOL( m_cVarRecordable, false );
SET_BOOL( m_cVarRecording, false );
SET_STREAMTIME( m_cVarTime, 0, false );
SET_TEXT( m_cVarStreamBitRate, UString( getIntf(), "") );
SET_TEXT( m_cVarStreamSampleRate, UString( getIntf(), "") );
-
- var_DelCallback( pInput, "intf-event", onGenericCallback, this );
- var_DelCallback( pInput, "bit-rate", onGenericCallback, this );
- var_DelCallback( pInput, "sample-rate", onGenericCallback, this );
- var_DelCallback( pInput, "can-record" , onGenericCallback, this );
- vlc_object_release( pInput );
- getIntf()->p_sys->p_input = NULL;
}
void VlcProc::init_variables()