summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qt/qgstplayer.cpp9
-rw-r--r--qt/qgstplayer.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/qt/qgstplayer.cpp b/qt/qgstplayer.cpp
index ab140f3..3aae93d 100644
--- a/qt/qgstplayer.cpp
+++ b/qt/qgstplayer.cpp
@@ -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)
{
diff --git a/qt/qgstplayer.h b/qt/qgstplayer.h
index f5d4ab8..c060bc9 100644
--- a/qt/qgstplayer.h
+++ b/qt/qgstplayer.h
@@ -62,6 +62,7 @@ class Player : public QObject
public:
explicit Player(QObject *parent = 0, VideoRenderer *renderer = 0);
+ virtual ~Player();
typedef GstPlayerError Error;
enum State {