androidcamera: Separate release and free APIs

This commit is contained in:
Youness Alaoui 2013-01-07 18:27:40 -05:00 committed by Nicolas Dufresne
parent c84878ad4b
commit fe288a847b
5 changed files with 19 additions and 1 deletions

View file

@ -108,6 +108,12 @@ gst_ag_surfacetexture_release (GstAGSurfaceTexture * self)
JNIEnv *env = gst_dvm_get_env ();
GST_DVM_CALL (, self->object, Void, android_graphics_surfacetexture, release);
}
void
gst_ag_surfacetexture_free (GstAGSurfaceTexture * self)
{
JNIEnv *env = gst_dvm_get_env ();
(*env)->DeleteGlobalRef (env, self->object);
g_slice_free (GstAGSurfaceTexture, self);

View file

@ -43,6 +43,7 @@ void gst_android_graphics_surfacetexture_deinit (void);
/* android.graphics.SurfaceTexture */
GstAGSurfaceTexture *gst_ag_surfacetexture_new (gint texture_id);
void gst_ag_surfacetexture_release (GstAGSurfaceTexture *self);
void gst_ag_surfacetexture_free (GstAGSurfaceTexture *self);
G_END_DECLS

View file

@ -1855,11 +1855,18 @@ gst_ah_camera_release (GstAHCamera * self)
JNIEnv *env = gst_dvm_get_env ();
AHC_CALL (, Void, release);
}
void
gst_ah_camera_release (GstAHCamera * self)
{
JNIEnv *env = gst_dvm_get_env ();
(*env)->DeleteGlobalRef (env, self->object);
g_slice_free (GstAHCamera, self);
}
gboolean
gst_ah_camera_set_parameters (GstAHCamera * self, GstAHCParameters * params)
{

View file

@ -139,6 +139,7 @@ gboolean gst_ah_camera_lock (GstAHCamera * self);
GstAHCamera *gst_ah_camera_open (gint camera_id);
gboolean gst_ah_camera_reconnect (GstAHCamera * self);
void gst_ah_camera_release (GstAHCamera * self);
void gst_ah_camera_free (GstAHCamera * self);
gboolean gst_ah_camera_set_parameters (GstAHCamera * self,
GstAHCParameters * params);
gboolean gst_ah_camera_set_error_callback (GstAHCamera * self,

View file

@ -2308,11 +2308,14 @@ gst_ahc_src_close (GstAHCSrc * self)
gst_ah_camera_set_error_callback (self->camera, NULL, NULL);
gst_ah_camera_set_preview_callback_with_buffer (self->camera, NULL, NULL);
gst_ah_camera_release (self->camera);
gst_ah_camera_free (self->camera);
}
self->camera = NULL;
if (self->texture)
if (self->texture) {
gst_ag_surfacetexture_release (self->texture);
gst_ag_surfacetexture_free (self->texture);
}
self->texture = NULL;
}