#include <QApplication>
+#include <assert.h>
+
static int ItemChanged( vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void * );
static int PLItemChanged( vlc_object_t *, const char *,
b_video = false;
timeA = 0;
timeB = 0;
-
+ f_cache = -1.; /* impossible initial value, different from all */
}
InputManager::~InputManager()
int i_type = event->type();
IMEvent *ple = static_cast<IMEvent *>(event);
- if ( i_type != PositionUpdate_Type &&
+ assert( !( i_type != PositionUpdate_Type &&
i_type != ItemChanged_Type &&
i_type != ItemRateChanged_Type &&
i_type != ItemTitleChanged_Type &&
i_type != SynchroChanged_Type &&
i_type != CachingEvent_Type &&
i_type != BookmarksChanged_Type &&
- i_type != InterfaceAoutUpdate_Type )
- return;
+ i_type != InterfaceAoutUpdate_Type &&
+ i_type != RecordingEvent_Type ) );
if( !hasInput() ) return;
i_type != InfoChanged_Type &&
i_type != SynchroChanged_Type &&
i_type != BookmarksChanged_Type &&
- i_type != InterfaceAoutUpdate_Type
+ i_type != InterfaceAoutUpdate_Type &&
+ i_type != RecordingEvent_Type
)
&& ( i_input_id != ple->i_id ) )
return;
case InterfaceAoutUpdate_Type:
UpdateAout();
break;
+ case RecordingEvent_Type:
+ UpdateRecord();
+ break;
default:
msg_Warn( p_intf, "This shouldn't happen: %i", i_type );
}
InputManager *im = (InputManager*)param;
IMEvent *event = new IMEvent( ItemChanged_Type, newval.i_int );
- QApplication::postEvent( im, static_cast<QEvent*>(event) );
+ QApplication::postEvent( im, event );
return VLC_SUCCESS;
}
break;
case INPUT_EVENT_RECORD:
- /* This happens when a recording starts. What do we do then?
- Display a red light? */
- /* event = new IMEvent( RecordingEvent_Type, 0 );
- break; */
+ event = new IMEvent( RecordingEvent_Type, 0 );
+ break;
case INPUT_EVENT_PROGRAM:
/* This is for PID changes */
}
if( event )
- QApplication::postEvent( im, static_cast<QEvent*>(event) );
+ QApplication::postEvent( im, event );
return VLC_SUCCESS;
}
void InputManager::UpdatePosition()
emit infoChanged( input_GetItem( p_input ) );
}
+void InputManager::UpdateRecord()
+{
+ if( hasInput() )
+ {
+ emit recordingStateChanged( var_GetBool( p_input, "record" ) );
+ }
+}
+
/* User update of the slider */
void InputManager::sliderUpdate( float new_pos )
{
/* emit check if playlist has allready started playing */
vlc_value_t val;
var_Change( THEPL, "playlist-current", VLC_VAR_CHOICESCOUNT, &val, NULL );
+
IMEvent *event = new IMEvent( ItemChanged_Type, val.i_int);
- QApplication::postEvent( this, static_cast<QEvent*>(event) );
+ customEvent( event );
+ delete event;
}
MainInputManager::~MainInputManager()
vout_thread_t* MainInputManager::getVout()
{
- vout_thread_t **pp_vout; int i_vout;
- if( p_input && !input_Control( p_input, INPUT_GET_VOUTS, &pp_vout, &i_vout ) )
- {
- for( int i = 1; i < i_vout; i++ ) vlc_object_release( pp_vout[i]);
- vout_thread_t *p_tmp = pp_vout[0];
- free( pp_vout );
- return p_tmp;
- }
- return NULL;
+ return p_input ? input_GetVout( p_input ) : NULL;
}
aout_instance_t * MainInputManager::getAout()
{
- aout_instance_t *p_aout;
- if( p_input && !input_Control( p_input, INPUT_GET_AOUT, &p_aout ) )
- {
- return p_aout;
- }
- return NULL;
+ return p_input ? input_GetAout( p_input ) : NULL;
}
void MainInputManager::customEvent( QEvent *event )
MainInputManager *mim = (MainInputManager*)param;
IMEvent *event = new IMEvent( ItemChanged_Type, newval.i_int );
- QApplication::postEvent( mim, static_cast<QEvent*>(event) );
+ QApplication::postEvent( mim, event );
return VLC_SUCCESS;
}
MainInputManager *mim = (MainInputManager*)param;
IMEvent *event = new IMEvent( VolumeChanged_Type, newval.i_int );
- QApplication::postEvent( mim, static_cast<QEvent*>(event) );
+ QApplication::postEvent( mim, event );
return VLC_SUCCESS;
}