Commit 70c75214 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

[Qt] Fix crash when pressed play when input is DYYYYYING.

Close #2196
parent 3f6bd266
...@@ -428,10 +428,13 @@ void InputManager::sliderUpdate( float new_pos ) ...@@ -428,10 +428,13 @@ void InputManager::sliderUpdate( float new_pos )
void InputManager::togglePlayPause() void InputManager::togglePlayPause()
{ {
vlc_value_t state; vlc_value_t state;
var_Get( p_input, "state", &state ); if( hasInput() )
state.i_int = ( state.i_int != PLAYING_S ) ? PLAYING_S : PAUSE_S; {
var_Set( p_input, "state", state ); var_Get( p_input, "state", &state );
emit statusChanged( state.i_int ); state.i_int = ( state.i_int != PLAYING_S ) ? PLAYING_S : PAUSE_S;
var_Set( p_input, "state", state );
emit statusChanged( state.i_int );
}
} }
void InputManager::sectionPrev() void InputManager::sectionPrev()
...@@ -741,18 +744,16 @@ void MainInputManager::prev() ...@@ -741,18 +744,16 @@ void MainInputManager::prev()
void MainInputManager::togglePlayPause() void MainInputManager::togglePlayPause()
{ {
if( p_input == NULL ) /* No input, play */
{ if( !p_input )
playlist_Play( THEPL ); playlist_Play( THEPL );
return; else
} getIM()->togglePlayPause();
getIM()->togglePlayPause();
} }
bool MainInputManager::teletextState() bool MainInputManager::teletextState()
{ {
im = getIM(); if( getIM()->hasInput() )
if( im->hasInput() )
{ {
const int i_teletext_es = var_GetInteger( getInput(), "teletext-es" ); const int i_teletext_es = var_GetInteger( getInput(), "teletext-es" );
const int i_spu_es = var_GetInteger( getInput(), "spu-es" ); const int i_spu_es = var_GetInteger( getInput(), "spu-es" );
......
...@@ -65,6 +65,8 @@ public: ...@@ -65,6 +65,8 @@ public:
class InputManager : public QObject class InputManager : public QObject
{ {
Q_OBJECT; Q_OBJECT;
friend class MainInputManager;
public: public:
InputManager( QObject *, intf_thread_t * ); InputManager( QObject *, intf_thread_t * );
virtual ~InputManager(); virtual ~InputManager();
...@@ -107,7 +109,6 @@ private: ...@@ -107,7 +109,6 @@ private:
public slots: public slots:
void setInput( input_thread_t * ); ///< Our controlled input changed void setInput( input_thread_t * ); ///< Our controlled input changed
void sliderUpdate( float ); ///< User dragged the slider. We get new pos void sliderUpdate( float ); ///< User dragged the slider. We get new pos
void togglePlayPause();
/* SpeedRate Rate Management */ /* SpeedRate Rate Management */
void slower(); void slower();
void faster(); void faster();
...@@ -125,6 +126,8 @@ public slots: ...@@ -125,6 +126,8 @@ public slots:
/* A to B Loop */ /* A to B Loop */
void setAtoB(); void setAtoB();
private slots:
void togglePlayPause();
signals: signals:
/// Send new position, new time and new length /// Send new position, new time and new length
......
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