summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorCarl-Anton Ingmarsson <ca.ingmarsson@gmail.com>2009-04-01 21:40:14 +0200
committerJan Schmidt <thaytan@noraisin.net>2009-06-20 15:21:23 +0100
commit6fa5b4ff14b88eff42f36fb74058bdb46c6e92b4 (patch)
tree495240e0e41eac46d2c59669f8d53334e5af1349 /sys
parent21d774023635ecb3b261c4132a05b194b95b7f35 (diff)
downloadgst-plugins-bad-6fa5b4ff14b88eff42f36fb74058bdb46c6e92b4.tar.gz
gst-plugins-bad-6fa5b4ff14b88eff42f36fb74058bdb46c6e92b4.tar.bz2
gst-plugins-bad-6fa5b4ff14b88eff42f36fb74058bdb46c6e92b4.zip
vdpau: make the decoder clean up after itself
Diffstat (limited to 'sys')
-rw-r--r--sys/vdpau/gstvdpaudecoder.c15
-rw-r--r--sys/vdpau/gstvdpaumpegdecoder.c19
2 files changed, 32 insertions, 2 deletions
diff --git a/sys/vdpau/gstvdpaudecoder.c b/sys/vdpau/gstvdpaudecoder.c
index deb93c49..8d5ed4e5 100644
--- a/sys/vdpau/gstvdpaudecoder.c
+++ b/sys/vdpau/gstvdpaudecoder.c
@@ -57,6 +57,7 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_BOILERPLATE_FULL (GstVdpauDecoder, gst_vdpaudecoder, GstElement,
GST_TYPE_ELEMENT, DEBUG_INIT);
+static void gst_vdpau_decoder_finalize (GObject * object);
static void gst_vdpaudecoder_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_vdpaudecoder_get_property (GObject * object, guint prop_id,
@@ -453,6 +454,7 @@ gst_vdpaudecoder_class_init (GstVdpauDecoderClass * klass)
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
+ gobject_class->finalize = gst_vdpau_decoder_finalize;
gobject_class->set_property = gst_vdpaudecoder_set_property;
gobject_class->get_property = gst_vdpaudecoder_get_property;
@@ -495,6 +497,19 @@ gst_vdpaudecoder_init (GstVdpauDecoder * dec, GstVdpauDecoderClass * klass)
}
static void
+gst_vdpau_decoder_finalize (GObject * object)
+{
+ GstVdpauDecoder *dec = (GstVdpauDecoder *) object;
+
+ if (dec->src_caps)
+ g_object_unref (dec->src_caps);
+ if (dec->device)
+ g_object_unref (dec->device);
+
+ g_free (dec->display_name);
+}
+
+static void
gst_vdpaudecoder_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
diff --git a/sys/vdpau/gstvdpaumpegdecoder.c b/sys/vdpau/gstvdpaumpegdecoder.c
index 52eec777..f3e510bd 100644
--- a/sys/vdpau/gstvdpaumpegdecoder.c
+++ b/sys/vdpau/gstvdpaumpegdecoder.c
@@ -71,6 +71,7 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_BOILERPLATE (GstVdpauMpegDecoder, gst_vdpau_mpeg_decoder, GstVdpauDecoder,
GST_TYPE_VDPAU_DECODER);
+static void gst_vdpau_mpeg_decoder_finalize (GObject * object);
static void gst_vdpau_mpeg_decoder_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
static void gst_vdpau_mpeg_decoder_get_property (GObject * object,
@@ -227,8 +228,8 @@ gst_vdpau_mpeg_decoder_parse_picture (GstVdpauMpegDecoder * mpeg_dec,
if (pic_hdr.pic_type == I_FRAME &&
mpeg_dec->vdp_info.forward_reference != VDP_INVALID_HANDLE) {
- dec->device->vdp_video_surface_destroy (mpeg_dec->
- vdp_info.forward_reference);
+ dec->device->vdp_video_surface_destroy (mpeg_dec->vdp_info.
+ forward_reference);
mpeg_dec->vdp_info.forward_reference = VDP_INVALID_HANDLE;
}
@@ -374,6 +375,7 @@ gst_vdpau_mpeg_decoder_class_init (GstVdpauMpegDecoderClass * klass)
gstelement_class = (GstElementClass *) klass;
vdpaudec_class = (GstVdpauDecoderClass *) klass;
+ gobject_class->finalize = gst_vdpau_mpeg_decoder_finalize;
gobject_class->set_property = gst_vdpau_mpeg_decoder_set_property;
gobject_class->get_property = gst_vdpau_mpeg_decoder_get_property;
@@ -415,6 +417,19 @@ gst_vdpau_mpeg_decoder_init (GstVdpauMpegDecoder * mpeg_dec,
}
static void
+gst_vdpau_mpeg_decoder_finalize (GObject * object)
+{
+ GstVdpauMpegDecoder *mpeg_dec = (GstVdpauMpegDecoder *) object;
+
+#if 0 /* FIXME: can't free the decoder since the device already has been freed */
+ if (mpeg_dec->decoder != VDP_INVALID_HANDLE)
+ dec->device->vdp_decoder_destroy (mpeg_dec->decoder);
+#endif
+
+ g_object_unref (mpeg_dec->adapter);
+}
+
+static void
gst_vdpau_mpeg_decoder_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{