enum
{
SIGNAL_0,
+#ifdef GST_WLSINK_ENHANCEMENT
+ SIGNAL_HANDOFF,
+ SIGNAL_PREROLL_HANDOFF,
+#endif
LAST_SIGNAL
};
PROP_0,
PROP_DISPLAY,
#ifdef GST_WLSINK_ENHANCEMENT
+ PROP_SIGNAL_HANDOFFS,
PROP_USE_GAPLESS,
PROP_KEEP_CAMERA_PREVIEW,
PROP_USE_TBM,
static gboolean gst_wayland_sink_event (GstBaseSink * bsink, GstEvent * event);
static void gst_wayland_sink_update_window_geometry (GstWaylandSink * sink);
static void render_last_buffer (GstWaylandSink * sink);
+
+static guint gst_waylandsink_signals[LAST_SIGNAL] = { 0 };
+
#endif
#define gst_wayland_sink_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstWaylandSink, gst_wayland_sink, GST_TYPE_VIDEO_SINK,
g_object_class_install_property (gobject_class, PROP_ALIGN_WIDTH,
g_param_spec_double ("align-w", "align width",
- "Align with, Left: 0.0, Middle: 0.5, Right: 1.0 \n"
+ "Align with, Left: 0.0, Middle: 0.5, Right: 1.0, "
"Please set align-w and align-h togethrer"
"Function is not supported in DISP_GEO_METHOD_CUSTOM_ROI. ", 0.0,
1.0, 0.5, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_ALIGN_HEIGHT,
g_param_spec_double ("align-h", "align height",
- "Align height, Left: 0.0, Middle: 0.5, Right: 1.0 \n"
+ "Align height, Left: 0.0, Middle: 0.5, Right: 1.0, "
"Please set align-w and align-h togethrer"
"Function is not supported in DISP_GEO_METHOD_CUSTOM_ROI. ", 0.0,
1.0, 0.5, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ /* fakesink function for stream callback of MSL with browser */
+ g_object_class_install_property (gobject_class, PROP_SIGNAL_HANDOFFS,
+ g_param_spec_boolean ("signal-handoffs", "Signal handoffs",
+ "Send a signal before unreffing the buffer", FALSE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ gst_waylandsink_signals[SIGNAL_HANDOFF] =
+ g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstWaylandSinkClass, handoff), NULL, NULL,
+ g_cclosure_marshal_generic, G_TYPE_NONE, 2,
+ GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE, GST_TYPE_PAD);
+
+ gst_waylandsink_signals[SIGNAL_PREROLL_HANDOFF] =
+ g_signal_new ("preroll-handoff", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstWaylandSinkClass, preroll_handoff),
+ NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 2,
+ GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE, GST_TYPE_PAD);
+
#endif
}
{
FUNCTION;
#ifdef GST_WLSINK_ENHANCEMENT
+ sink->signal_handoffs = FALSE;
sink->keep_camera_preview = FALSE;
sink->got_costum_event = FALSE;
sink->USE_TBM = TRUE;
case PROP_KEEP_CAMERA_PREVIEW:
g_value_set_boolean (value, sink->keep_camera_preview);
break;
+ case PROP_SIGNAL_HANDOFFS:
+ g_value_set_boolean (value, sink->signal_handoffs);
+ break;
case PROP_USE_TBM:
g_value_set_boolean (value, sink->USE_TBM);
break;
case PROP_OFFSET_WIDTH:
g_value_set_uint (value, sink->offset_w);
break;
- case PROP_OFFSET_HEIGHT:
+ case PROP_OFFSET_HEIGHT:
g_value_set_uint (value, sink->offset_h);
break;
case PROP_ALIGN_WIDTH:
GST_OBJECT_UNLOCK (sink);
break;
#ifdef GST_WLSINK_ENHANCEMENT
+ case PROP_SIGNAL_HANDOFFS:
+ sink->signal_handoffs = g_value_get_boolean (value);
+ GST_LOG ("set signal_handoffs(%d)", sink->signal_handoffs);
+ if (sink->signal_handoffs && sink->window) {
+ /* overlay -> hand-off */
+ gst_wayland_sink_stop_video (sink);
+ }
+ break;
case PROP_KEEP_CAMERA_PREVIEW:
sink->keep_camera_preview = g_value_get_boolean (value);
GST_LOG ("keep_camera_preview (%d)", sink->keep_camera_preview);
static GstFlowReturn
gst_wayland_sink_preroll (GstBaseSink * bsink, GstBuffer * buffer)
{
+#ifdef GST_WLSINK_ENHANCEMENT
+ GstWaylandSink *sink = GST_WAYLAND_SINK (bsink);
FUNCTION;
+
GST_DEBUG_OBJECT (bsink, "preroll buffer %p", buffer);
+
+ if (sink->signal_handoffs) {
+ GST_LOG ("g_signal_emit: preroll-handoff");
+ g_signal_emit (sink,
+ gst_waylandsink_signals[SIGNAL_PREROLL_HANDOFF], 0, buffer,
+ bsink->sinkpad);
+
+ return GST_FLOW_OK;
+ }
+#endif
return gst_wayland_sink_render (bsink, buffer);
}
gst_wayland_sink_update_window_geometry (sink);
#endif
}
+
+ if (sink->signal_handoffs) {
+ GST_LOG ("g_signal_emit: hand-off ");
+ g_signal_emit (sink, gst_waylandsink_signals[SIGNAL_HANDOFF], 0, buffer,
+ bsink->sinkpad);
+ goto done;
+ }
+
/* drop buffers until we get a frame callback */
if (g_atomic_int_get (&sink->redraw_pending) == TRUE
&& !gst_wayland_sink_check_use_gapless (sink))
GST_INFO ("wl_surface_commit (video_surface@%p)", window->video_surface);
wl_surface_commit (window->video_surface);
}
-
- if (gst_wl_window_is_toplevel (window)) {
- struct wl_region *region;
-
- region = wl_compositor_create_region (window->display->compositor);
- GST_INFO ("wl_region@%p = wl_compositor_create_region (wl_compositor@%p)",
- region, window->display->compositor);
- GST_INFO ("wl_region_add (wl_region@%p, x@%d, y@%d, w@%d, h@%d)", region, 0,
- 0, window->render_rectangle.w, window->render_rectangle.h);
- wl_region_add (region, 0, 0, window->render_rectangle.w,
- window->render_rectangle.h);
- GST_INFO ("wl_surface_set_input_region (area_surface@%p, wl_region@%p)",
- window->area_surface, region);
- wl_surface_set_input_region (window->area_surface, region);
- GST_INFO ("wl_region_destroy (wl_region@%p)", region);
- wl_region_destroy (region);
- }
}
#else
static void
#if GST_WLSINK_ENHANCEMENT
FUNCTION;
g_return_if_fail (window != NULL);
- if (gst_wl_window_is_toplevel (window)) {
- /* let's set windwo size for convenient gst-launch test */
- x = 0, y = 0, w = 720, h = 1280;
- window->render_rectangle.x = x;
- window->render_rectangle.y = y;
- window->render_rectangle.w = w;
- window->render_rectangle.h = h;
- } else {
- /* we already set area surface size, ignore call by app, app need to remove call */
+
+ if (window->disp_geo_method.value != DISP_GEO_METHOD_CUSTOM_ROI) {
+ GST_ERROR
+ ("must be set display-geometry-method to DISP_GEO_METHOD_CUSTOM_ROI before setting render rectangle()");
return;
}