playback/player: qt: add a destructor and release resources

Fixes #129
This commit is contained in:
Alexandre Moreno 2015-10-28 00:43:03 +08:00 committed by Sebastian Dröge
parent 5dbeabcb76
commit d0bc110836
2 changed files with 10 additions and 0 deletions

View file

@ -359,6 +359,15 @@ Player::Player(QObject *parent, VideoRenderer *renderer)
gst_player_set_subtitle_track_enabled(player_, false);
}
Player::~Player()
{
if (player_) {
g_signal_handlers_disconnect_by_data(player_, this);
gst_player_stop(player_);
g_object_unref(player_);
}
}
void
Player::onStateChanged(Player * player, GstPlayerState state)
{

View file

@ -62,6 +62,7 @@ class Player : public QObject
public:
explicit Player(QObject *parent = 0, VideoRenderer *renderer = 0);
virtual ~Player();
typedef GstPlayerError Error;
enum State {