Commit 6bdf53c3 authored by Laurent Aimar's avatar Laurent Aimar Committed by Jean-Baptiste Kempf

Use intf-change-vout to properly detect vout (close #1992 and #1950)

(cherry picked from commit fccf6aa0)

And Fixed initial snpshot/fullscreen state.
It fixes a regression introduced by fccf6aa0
parent a9b4d597
...@@ -671,6 +671,9 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, ...@@ -671,6 +671,9 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
/* /*
* Other first Line buttons * Other first Line buttons
*/ */
/* */
CONNECT( THEMIM->getIM(), voutChanged(bool), this, enableVideo(bool) );
/** Fullscreen/Visualisation **/ /** Fullscreen/Visualisation **/
fullscreenButton = new QPushButton; fullscreenButton = new QPushButton;
BUTTON_SET_ACT_I( fullscreenButton, "", fullscreen, BUTTON_SET_ACT_I( fullscreenButton, "", fullscreen,
...@@ -909,7 +912,7 @@ void ControlsWidget::updateInput() ...@@ -909,7 +912,7 @@ void ControlsWidget::updateInput()
{ {
/* Activate the interface buttons according to the presence of the input */ /* Activate the interface buttons according to the presence of the input */
enableInput( THEMIM->getIM()->hasInput() ); enableInput( THEMIM->getIM()->hasInput() );
enableVideo( THEMIM->getIM()->hasVideo() && THEMIM->getIM()->hasInput() ); enableVideo( THEMIM->getIM()->hasVideo() );
} }
void ControlsWidget::setStatus( int status ) void ControlsWidget::setStatus( int status )
...@@ -993,7 +996,6 @@ void ControlsWidget::toggleAdvanced() ...@@ -993,7 +996,6 @@ void ControlsWidget::toggleAdvanced()
emit advancedControlsToggled( b_advancedVisible ); emit advancedControlsToggled( b_advancedVisible );
} }
/********************************************************************** /**********************************************************************
* Fullscrenn control widget * Fullscrenn control widget
**********************************************************************/ **********************************************************************/
......
...@@ -174,7 +174,6 @@ public: ...@@ -174,7 +174,6 @@ public:
QPushButton *playlistButton; QPushButton *playlistButton;
void setStatus( int ); void setStatus( int );
void enableInput( bool ); void enableInput( bool );
void enableVideo( bool );
public slots: public slots:
void setNavigation( int ); void setNavigation( int );
protected: protected:
...@@ -216,6 +215,7 @@ protected slots: ...@@ -216,6 +215,7 @@ protected slots:
void toggleTeletext(); void toggleTeletext();
void toggleTeletextTransparency(); void toggleTeletextTransparency();
void enableTeletext( bool ); void enableTeletext( bool );
void enableVideo( bool );
signals: signals:
void advancedControlsToggled( bool ); void advancedControlsToggled( bool );
}; };
......
...@@ -42,6 +42,8 @@ static int PLItemChanged( vlc_object_t *, const char *, ...@@ -42,6 +42,8 @@ static int PLItemChanged( vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void * ); vlc_value_t, vlc_value_t, void * );
static int InterfaceChanged( vlc_object_t *, const char *, static int InterfaceChanged( vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void * ); vlc_value_t, vlc_value_t, void * );
static int InterfaceVoutChanged( vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void * );
static int ItemStateChanged( vlc_object_t *, const char *, static int ItemStateChanged( vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void * ); vlc_value_t, vlc_value_t, void * );
static int ItemRateChanged( vlc_object_t *, const char *, static int ItemRateChanged( vlc_object_t *, const char *,
...@@ -67,6 +69,7 @@ InputManager::InputManager( QObject *parent, intf_thread_t *_p_intf) : ...@@ -67,6 +69,7 @@ InputManager::InputManager( QObject *parent, intf_thread_t *_p_intf) :
p_input = NULL; p_input = NULL;
i_rate = 0; i_rate = 0;
i_input_id = 0; i_input_id = 0;
b_video = false;
b_transparentTelextext = false; b_transparentTelextext = false;
} }
...@@ -91,6 +94,7 @@ void InputManager::setInput( input_thread_t *_p_input ) ...@@ -91,6 +94,7 @@ void InputManager::setInput( input_thread_t *_p_input )
UpdateSPU(); UpdateSPU();
UpdateTeletext(); UpdateTeletext();
UpdateNavigation(); UpdateNavigation();
UpdateVout();
addCallbacks(); addCallbacks();
i_input_id = input_GetItem( p_input )->i_id; i_input_id = input_GetItem( p_input )->i_id;
} }
...@@ -114,11 +118,13 @@ void InputManager::delInput() ...@@ -114,11 +118,13 @@ void InputManager::delInput()
i_input_id = 0; i_input_id = 0;
old_name = ""; old_name = "";
artUrl = ""; artUrl = "";
b_video = false;
emit positionUpdated( -1.0, 0 ,0 ); emit positionUpdated( -1.0, 0 ,0 );
emit statusChanged( END_S ); emit statusChanged( END_S );
emit nameChanged( "" ); emit nameChanged( "" );
emit artChanged( "" ); emit artChanged( "" );
emit rateChanged( INPUT_RATE_DEFAULT ); emit rateChanged( INPUT_RATE_DEFAULT );
emit voutChanged( false );
vlc_object_release( p_input ); vlc_object_release( p_input );
p_input = NULL; p_input = NULL;
UpdateSPU(); UpdateSPU();
...@@ -152,6 +158,8 @@ void InputManager::addCallbacks() ...@@ -152,6 +158,8 @@ void InputManager::addCallbacks()
var_AddCallback( p_input, "title", ItemTitleChanged, this ); var_AddCallback( p_input, "title", ItemTitleChanged, this );
/* src/input/input.c:734 for timers update*/ /* src/input/input.c:734 for timers update*/
var_AddCallback( p_input, "intf-change", InterfaceChanged, this ); var_AddCallback( p_input, "intf-change", InterfaceChanged, this );
/* src/input/input.c for vout creation/destruction */
var_AddCallback( p_input, "intf-change-vout", InterfaceVoutChanged, this );
} }
/* Delete the callbacks on Input. Self explanatory */ /* Delete the callbacks on Input. Self explanatory */
...@@ -164,6 +172,7 @@ void InputManager::delCallbacks() ...@@ -164,6 +172,7 @@ void InputManager::delCallbacks()
var_DelCallback( p_input, "rate-change", ItemRateChanged, this ); var_DelCallback( p_input, "rate-change", ItemRateChanged, this );
var_DelCallback( p_input, "title", ItemTitleChanged, this ); var_DelCallback( p_input, "title", ItemTitleChanged, this );
var_DelCallback( p_input, "intf-change", InterfaceChanged, this ); var_DelCallback( p_input, "intf-change", InterfaceChanged, this );
var_DelCallback( p_input, "intf-change-vout", InterfaceVoutChanged, this );
} }
/* Convert the event from the callbacks in actions */ /* Convert the event from the callbacks in actions */
...@@ -178,7 +187,8 @@ void InputManager::customEvent( QEvent *event ) ...@@ -178,7 +187,8 @@ void InputManager::customEvent( QEvent *event )
type != ItemTitleChanged_Type && type != ItemTitleChanged_Type &&
type != ItemSpuChanged_Type && type != ItemSpuChanged_Type &&
type != ItemTeletextChanged_Type && type != ItemTeletextChanged_Type &&
type != ItemStateChanged_Type ) type != ItemStateChanged_Type &&
type != InterfaceVoutUpdate_Type )
return; return;
if( type == ItemStateChanged_Type ) if( type == ItemStateChanged_Type )
...@@ -193,7 +203,8 @@ void InputManager::customEvent( QEvent *event ) ...@@ -193,7 +203,8 @@ void InputManager::customEvent( QEvent *event )
type != ItemRateChanged_Type && type != ItemRateChanged_Type &&
type != ItemSpuChanged_Type && type != ItemSpuChanged_Type &&
type != ItemTeletextChanged_Type && type != ItemTeletextChanged_Type &&
type != ItemStateChanged_Type type != ItemStateChanged_Type &&
type != InterfaceVoutUpdate_Type
) )
&& ( i_input_id != ple->i_id ) ) && ( i_input_id != ple->i_id ) )
return; return;
...@@ -230,6 +241,9 @@ void InputManager::customEvent( QEvent *event ) ...@@ -230,6 +241,9 @@ void InputManager::customEvent( QEvent *event )
case ItemTeletextChanged_Type: case ItemTeletextChanged_Type:
UpdateTeletext(); UpdateTeletext();
break; break;
case InterfaceVoutUpdate_Type:
UpdateVout();
break;
} }
} }
...@@ -338,18 +352,6 @@ bool InputManager::hasAudio() ...@@ -338,18 +352,6 @@ bool InputManager::hasAudio()
return false; return false;
} }
bool InputManager::hasVideo()
{
if( hasInput() )
{
vlc_value_t val;
var_Change( p_input, "video-es", VLC_VAR_CHOICESCOUNT, &val, NULL );
return val.i_int > 0;
}
return false;
}
void InputManager::UpdateSPU() void InputManager::UpdateSPU()
{ {
UpdateTeletext(); UpdateTeletext();
...@@ -363,6 +365,18 @@ void InputManager::UpdateTeletext() ...@@ -363,6 +365,18 @@ void InputManager::UpdateTeletext()
telexToggle( false ); telexToggle( false );
} }
void InputManager::UpdateVout()
{
if( hasInput() )
{
vlc_object_t *p_vout = (vlc_object_t*)vlc_object_find( p_input, VLC_OBJECT_VOUT, FIND_CHILD );
b_video = p_vout != NULL;
if( p_vout )
vlc_object_release( p_vout );
emit voutChanged( b_video );
}
}
void InputManager::UpdateArt() void InputManager::UpdateArt()
{ {
/* Update Art meta */ /* Update Art meta */
...@@ -703,6 +717,7 @@ bool MainInputManager::teletextState() ...@@ -703,6 +717,7 @@ bool MainInputManager::teletextState()
static int InterfaceChanged( vlc_object_t *p_this, const char *psz_var, static int InterfaceChanged( vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *param ) vlc_value_t oldval, vlc_value_t newval, void *param )
{ {
/* FIXME remove that static variable */
static int counter = 0; static int counter = 0;
InputManager *im = (InputManager*)param; InputManager *im = (InputManager*)param;
...@@ -714,6 +729,16 @@ static int InterfaceChanged( vlc_object_t *p_this, const char *psz_var, ...@@ -714,6 +729,16 @@ static int InterfaceChanged( vlc_object_t *p_this, const char *psz_var,
return VLC_SUCCESS; return VLC_SUCCESS;
} }
static int InterfaceVoutChanged( vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *param )
{
InputManager *im = (InputManager*)param;
IMEvent *event = new IMEvent( InterfaceVoutUpdate_Type, 0 );
QApplication::postEvent( im, static_cast<QEvent*>(event) );
return VLC_SUCCESS;
}
static int ItemStateChanged( vlc_object_t *p_this, const char *psz_var, static int ItemStateChanged( vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *param ) vlc_value_t oldval, vlc_value_t newval, void *param )
{ {
......
...@@ -44,6 +44,7 @@ static int const ItemRateChanged_Type = QEvent::User + IMEventType + 5; ...@@ -44,6 +44,7 @@ static int const ItemRateChanged_Type = QEvent::User + IMEventType + 5;
static int const VolumeChanged_Type = QEvent::User + IMEventType + 6; static int const VolumeChanged_Type = QEvent::User + IMEventType + 6;
static int const ItemSpuChanged_Type = QEvent::User + IMEventType + 7; static int const ItemSpuChanged_Type = QEvent::User + IMEventType + 7;
static int const ItemTeletextChanged_Type= QEvent::User + IMEventType + 8; static int const ItemTeletextChanged_Type= QEvent::User + IMEventType + 8;
static int const InterfaceVoutUpdate_Type= QEvent::User + IMEventType + 9;
static int const FullscreenControlToggle_Type = QEvent::User + IMEventType + 10; static int const FullscreenControlToggle_Type = QEvent::User + IMEventType + 10;
static int const FullscreenControlShow_Type = QEvent::User + IMEventType + 11; static int const FullscreenControlShow_Type = QEvent::User + IMEventType + 11;
...@@ -70,7 +71,7 @@ public: ...@@ -70,7 +71,7 @@ public:
void delInput(); void delInput();
bool hasInput() { return p_input && !p_input->b_dead && vlc_object_alive (p_input); } bool hasInput() { return p_input && !p_input->b_dead && vlc_object_alive (p_input); }
bool hasAudio(); bool hasAudio();
bool hasVideo(); bool hasVideo() { return hasInput() && b_video; }
QString getName() { return old_name; } QString getName() { return old_name; }
...@@ -83,6 +84,7 @@ private: ...@@ -83,6 +84,7 @@ private:
QString artUrl; QString artUrl;
int i_rate; int i_rate;
bool b_transparentTelextext; bool b_transparentTelextext;
bool b_video;
void customEvent( QEvent * ); void customEvent( QEvent * );
void addCallbacks(); void addCallbacks();
...@@ -95,6 +97,7 @@ private: ...@@ -95,6 +97,7 @@ private:
void UpdateSPU(); void UpdateSPU();
void UpdateTeletext(); void UpdateTeletext();
void UpdateArt(); void UpdateArt();
void UpdateVout();
public slots: public slots:
void setInput( input_thread_t * ); ///< Our controlled input changed void setInput( input_thread_t * ); ///< Our controlled input changed
...@@ -129,6 +132,8 @@ signals: ...@@ -129,6 +132,8 @@ signals:
void setNewTelexPage( int ); void setNewTelexPage( int );
/// Advanced buttons /// Advanced buttons
void advControlsSetIcon(); void advControlsSetIcon();
/// Vout
void voutChanged( bool );
}; };
class MainInputManager : public QObject class MainInputManager : public QObject
......
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