iOS and gstreamer, or trouble with glimagesink

alex_malishev aron_stoun1996 at mail.ru
Mon Oct 24 07:49:13 UTC 2016


Thanks for your reply, Sebastian. 
*iOS:* Yes, I already tried to simplify my pipeline. The simple pipeline,
which works: 
 gst_parse_launch("videotestsrc ! glimagesink", &error);
gst_element_set_state(data->pipeline, GST_STATE_READY);
This is how I init surface: 
 video_sink = gst_bin_get_by_name(GST_BIN(pipeline), "video");
if (!video_sink) {
NSLog(@"Could not retrieve video sink");
return;
}
gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(video_sink),
(guintptr) (id) ui_video_view);
gst_object_unref(video_sink);

Where ui_video_view is instance of this class:
#import "EaglUIView.h"

#import <QuartzCore/QuartzCore.h>

@implementation EaglUIView

+ (Class) layerClass
{
// return [CEAGLLayer class];
return [CAEAGLLayer class];
}

@end

*Android:* In my android device I set pipeline in READY state, then I call
native_camera_surface_init(), which i made by myself, and pass it my surface
from android code. In this function I do this:
 static void gst_native_camera_surface_init(JNIEnv *env, jobject thiz,
jobject surface) { // begin
CustomData *data = GET_CUSTOM_DATA (env, thiz, custom_data_field_id); 
if (!data) return; 
if (data->native_window_camera) { 
GST_DEBUG ("Releasing previous native window %p",
data->native_window_camera); 
ANativeWindow_release (data->native_window_camera); 
} 
gst_element_set_state (data->pipeline, GST_STATE_READY); 
data->native_window_camera = ANativeWindow_fromSurface (env, surface); 

glimagesink = gst_bin_get_by_name(GST_BIN(data->pipeline), "vsink"); 
__android_log_print(ANDROID_LOG_INFO, "gst", "pipeline is %p",
data->pipeline); 
if(!data->pipeline){ 
__android_log_print(ANDROID_LOG_INFO, "gst", "pipeline is null"); 
} 
if(!glimagesink){ 
__android_log_print(ANDROID_LOG_INFO, "gst", "sink is null"); 
} 
__android_log_print(ANDROID_LOG_INFO, "gst", "try to set new window"); 
if (data->pipeline) { 
gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY(glimagesink),
(guintptr) data->native_window_camera); 
gst_object_unref (glimagesink); 
__android_log_print(ANDROID_LOG_INFO, "gst", "set new window"); 
} 
gst_element_set_state (data->pipeline, GST_STATE_NULL); 
check_initialization_complete (data); 
} //end

When I want to use other pipeline, I finalize this pipeline by setting it to
NULL state:
gst_element_set_state(data->pipeline, GST_STATE_NULL);

Then, I finalize window by calling this method:
static void gst_native_camera_surface_finalize(JNIEnv *env, jobject thiz){ 
CustomData *data = GET_CUSTOM_DATA (env, thiz, custom_data_field_id); 
if (!data) return; 
GST_DEBUG ("Releasing Native Window %p", data->native_window_camera); 

if (data->pipeline) { 
__android_log_print(ANDROID_LOG_INFO, "gst", "deleting window"); 
gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (glimagesink),
(guintptr)NULL); 
gst_element_set_state (data->pipeline, GST_STATE_READY); 
} 
__android_log_print(ANDROID_LOG_INFO, "gst", "release window"); 
ANativeWindow_release (data->native_window_camera); 
__android_log_print(ANDROID_LOG_INFO, "gst", "done releasing window"); 
data->native_window = NULL; 
__android_log_print(ANDROID_LOG_INFO, "gst", "native window = null"); 
data->initialized = FALSE; 
}



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/iOS-and-gstreamer-or-trouble-with-glimagesink-tp4680166p4680184.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list