summaryrefslogtreecommitdiff
path: root/ext/vp8/gstvp8enc.c
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2011-07-09 11:31:02 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2011-07-09 11:31:02 +0200
commitb0d619855c6515e427377cce9e20e86c2a4ac5f9 (patch)
tree22d4eb8f6fb0d8ccbc5a1dfdc2ef0c20a1d0d71f /ext/vp8/gstvp8enc.c
parent5f55a745714bb4e42c4b37fa33b4e7291ae1a92f (diff)
downloadgstreamer-plugins-bad-b0d619855c6515e427377cce9e20e86c2a4ac5f9.tar.gz
vp8enc: Use destroy notify to free the coder hook
Diffstat (limited to 'ext/vp8/gstvp8enc.c')
-rw-r--r--ext/vp8/gstvp8enc.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/ext/vp8/gstvp8enc.c b/ext/vp8/gstvp8enc.c
index 29f07f73b..c9deb5bf3 100644
--- a/ext/vp8/gstvp8enc.c
+++ b/ext/vp8/gstvp8enc.c
@@ -65,6 +65,24 @@ typedef struct
GList *invisible;
} GstVP8EncCoderHook;
+static void
+_gst_mini_object_unref0 (GstMiniObject * obj)
+{
+ if (obj)
+ gst_mini_object_unref (obj);
+}
+
+static void
+gst_vp8_enc_coder_hook_free (GstVP8EncCoderHook * hook)
+{
+ if (hook->image)
+ g_slice_free (vpx_image_t, hook->image);
+
+ g_list_foreach (hook->invisible, (GFunc) _gst_mini_object_unref0, NULL);
+ g_list_free (hook->invisible);
+ g_slice_free (GstVP8EncCoderHook, hook);
+}
+
#define DEFAULT_BITRATE 0
#define DEFAULT_MODE VPX_VBR
#define DEFAULT_MIN_QUANTIZER 0
@@ -866,6 +884,8 @@ gst_vp8_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder,
hook = g_slice_new0 (GstVP8EncCoderHook);
hook->image = image;
frame->coder_hook = hook;
+ frame->coder_hook_destroy_notify =
+ (GDestroyNotify) gst_vp8_enc_coder_hook_free;
if (frame->force_keyframe) {
flags |= VPX_EFLAG_FORCE_KF;
@@ -899,13 +919,6 @@ _to_granulepos (guint64 frame_end_number, guint inv_count, guint keyframe_dist)
return granulepos;
}
-static void
-_gst_mini_object_unref0 (GstMiniObject * obj)
-{
- if (obj)
- gst_mini_object_unref (obj);
-}
-
static GstFlowReturn
gst_vp8_enc_shape_output (GstBaseVideoEncoder * base_video_encoder,
GstVideoFrame * frame)
@@ -981,13 +994,6 @@ gst_vp8_enc_shape_output (GstBaseVideoEncoder * base_video_encoder,
}
done:
- if (hook) {
- g_list_foreach (hook->invisible, (GFunc) _gst_mini_object_unref0, NULL);
- g_list_free (hook->invisible);
- g_slice_free (GstVP8EncCoderHook, hook);
- frame->coder_hook = NULL;
- }
-
return ret;
}