static GSList * get_faces (GstStructure * faces) { gint len, aux; GSList *list = NULL; len = gst_structure_n_fields (faces); for (aux = 0; aux < len; aux++) { GstStructure *face; gboolean ret; const gchar *name = gst_structure_nth_field_name (faces, aux); if (g_strcmp0 (name, "timestamp") == 0) { continue; } ret = gst_structure_get (faces, name, GST_TYPE_STRUCTURE, &face, NULL); if (ret) { CvRect *aux = g_slice_new0 (CvRect); gst_structure_get (face, "x", G_TYPE_UINT, &aux->x, NULL); gst_structure_get (face, "y", G_TYPE_UINT, &aux->y, NULL); gst_structure_get (face, "width", G_TYPE_UINT, &aux->width, NULL); gst_structure_get (face, "height", G_TYPE_UINT, &aux->height, NULL); gst_structure_free (face); list = g_slist_append (list, aux); } } return list; }
static void kms_alpha_blending_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { KmsAlphaBlending *self = KMS_ALPHA_BLENDING (object); KMS_ALPHA_BLENDING_LOCK (self); switch (property_id) { case PROP_SET_MASTER: { GstStructure *master; master = g_value_dup_boxed (value); gst_structure_get (master, "port", G_TYPE_INT, &self->priv->master_port, NULL); gst_structure_get (master, "z_order", G_TYPE_INT, &self->priv->z_master, NULL); kms_alpha_blending_set_master_port (self); gst_structure_free (master); break; } default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } KMS_ALPHA_BLENDING_UNLOCK (self); }
// callbacks static gboolean events_cb(GstPad *pad, GstEvent *event, gpointer user_data) { GstHaarAdjust *filter; const GstStructure *structure; filter = GST_HAARADJUST(user_data); // sanity checks g_return_val_if_fail(pad != NULL, FALSE); g_return_val_if_fail(event != NULL, FALSE); g_return_val_if_fail(filter != NULL, FALSE); structure = gst_event_get_structure(event); if ((structure != NULL) && (strcmp(gst_structure_get_name(structure), "haar-detect-roi") == 0)) { CvRect rect; GstClockTime timestamp; gst_structure_get((GstStructure*) structure, "x", G_TYPE_UINT, &rect.x, "y", G_TYPE_UINT, &rect.y, "width", G_TYPE_UINT, &rect.width, "height", G_TYPE_UINT, &rect.height, "timestamp", G_TYPE_UINT64, ×tamp, NULL); if (timestamp > filter->rect_timestamp) { filter->rect_timestamp = timestamp; g_array_free(filter->rect_array, TRUE); filter->rect_array = g_array_sized_new(FALSE, FALSE, sizeof(CvRect), 1); } g_array_append_val(filter->rect_array, rect); } if ((structure != NULL) && (strcmp(gst_structure_get_name(structure), "bgfg-roi") == 0)) { CvRect rect; GstClockTime timestamp; gst_structure_get((GstStructure*) structure, "x", G_TYPE_UINT, &rect.x, "y", G_TYPE_UINT, &rect.y, "width", G_TYPE_UINT, &rect.width, "height", G_TYPE_UINT, &rect.height, "timestamp", G_TYPE_UINT64, ×tamp, NULL); if (timestamp > filter->rect_bg_timestamp) { filter->rect_bg_timestamp = timestamp; g_array_free(filter->rect_bg_array, TRUE); filter->rect_bg_array = g_array_sized_new(FALSE, FALSE, sizeof(CvRect), 1); } g_array_append_val(filter->rect_bg_array, rect); } return TRUE; }
/* * FIXME: This is a hack to make x264 work. * * We have notice that x264 doesn't work if width or height is odd, * so we force a rescale increasing one pixel that dimension * when we detect this situation. */ static GstPadProbeReturn check_caps_probe (GstPad * pad, GstPadProbeInfo * info, gpointer data) { int width, height; GstCaps *filter_caps, *caps; GstElement *element; GstStructure *st; gboolean needs_filter = FALSE; GstEvent *event = gst_pad_probe_info_get_event (info); if (GST_EVENT_TYPE (event) != GST_EVENT_CAPS) { return GST_PAD_PROBE_OK; } gst_event_parse_caps (event, &caps); st = gst_caps_get_structure (caps, 0); gst_structure_get (st, "width", G_TYPE_INT, &width, NULL); gst_structure_get (st, "height", G_TYPE_INT, &height, NULL); if (width % 2) { GST_WARNING ("Width is odd"); needs_filter = TRUE; width--; } if (height % 2) { GST_WARNING ("Height is odd"); needs_filter = TRUE; height--; } if (!needs_filter) return GST_PAD_PROBE_OK; filter_caps = gst_caps_from_string ("video/x-raw,format=I420"); gst_caps_set_simple (filter_caps, "width", G_TYPE_INT, width, NULL); gst_caps_set_simple (filter_caps, "height", G_TYPE_INT, height, NULL); element = gst_pad_get_parent_element (pad); g_object_set (element, "caps", filter_caps, NULL); gst_caps_unref (filter_caps); g_object_unref (element); return GST_PAD_PROBE_OK; }
static void check_get_dtmf_event_message (GstBus * bus, gint number, gint volume) { GstMessage *message; gboolean have_message = FALSE; while (!have_message && (message = gst_bus_pop_filtered (bus, GST_MESSAGE_ELEMENT)) != NULL) { if (gst_message_has_name (message, "dtmf-event")) { const GstStructure *s = gst_message_get_structure (message); gint stype, snumber, smethod, svolume; fail_unless (gst_structure_get (s, "type", G_TYPE_INT, &stype, "number", G_TYPE_INT, &snumber, "method", G_TYPE_INT, &smethod, "volume", G_TYPE_INT, &svolume, NULL)); fail_unless (stype == 1); fail_unless (smethod == 1); fail_unless (snumber == number); fail_unless (svolume == volume); have_message = TRUE; } gst_message_unref (message); } fail_unless (have_message); }
void RecorderEndpointImpl::collectEndpointStats (std::map <std::string, std::shared_ptr<Stats>> &statsReport, std::string id, const GstStructure *stats, double timestamp) { std::shared_ptr<Stats> endpointStats; GstStructure *e2e_stats; std::vector<std::shared_ptr<MediaLatencyStat>> inputStats; std::vector<std::shared_ptr<MediaLatencyStat>> e2eStats; if (gst_structure_get (stats, "e2e-latencies", GST_TYPE_STRUCTURE, &e2e_stats, NULL) ) { collectLatencyStats (e2eStats, e2e_stats); gst_structure_free (e2e_stats); } endpointStats = std::make_shared <EndpointStats> (id, std::make_shared <StatsType> (StatsType::endpoint), timestamp, 0.0, 0.0, inputStats, 0.0, 0.0, e2eStats); setDeprecatedProperties (std::dynamic_pointer_cast <EndpointStats> (endpointStats) ); statsReport[id] = endpointStats; }
static void code_received_cb (GstBus * bus, GstMessage * message, gpointer data) { KmsSendData *self = KMS_SEND_DATA (data); if (GST_MESSAGE_SRC (message) == GST_OBJECT (self->priv->zbar) && GST_MESSAGE_TYPE (message) == GST_MESSAGE_ELEMENT) { const GstStructure *st; guint64 ts; gchar *type, *symbol; st = gst_message_get_structure (message); if (g_strcmp0 (gst_structure_get_name (st), "barcode") != 0) { return; } if (!gst_structure_get (st, "timestamp", G_TYPE_UINT64, &ts, "type", G_TYPE_STRING, &type, "symbol", G_TYPE_STRING, &symbol, NULL)) { return; } kms_send_data_new_code (self, ts, type, symbol); g_free (type); g_free (symbol); } return; }
void ZBarFilterImpl::busMessage (GstMessage *message) { if (GST_MESSAGE_SRC (message) == GST_OBJECT (zbar) && GST_MESSAGE_TYPE (message) == GST_MESSAGE_ELEMENT) { const GstStructure *st; guint64 ts; gchar *type, *symbol; st = gst_message_get_structure (message); if (g_strcmp0 (gst_structure_get_name (st), "barcode") != 0) { return; } if (!gst_structure_get (st, "timestamp", G_TYPE_UINT64, &ts, "type", G_TYPE_STRING, &type, "symbol", G_TYPE_STRING, &symbol, NULL) ) { return; } std::string symbolStr (symbol); std::string typeStr (type); g_free (type); g_free (symbol); barcodeDetected (ts, typeStr, symbolStr); } }
void zbar_receive_message (GstBus *bus, GstMessage *message, gpointer zbar) { ZBarFilter *filter = (ZBarFilter *) zbar; if (GST_MESSAGE_SRC (message) == GST_OBJECT (filter->zbar) && GST_MESSAGE_TYPE (message) == GST_MESSAGE_ELEMENT) { const GstStructure *st; guint64 ts; gchar *type, *symbol; st = gst_message_get_structure (message); if (g_strcmp0 (gst_structure_get_name (st), "barcode") != 0) return; if (!gst_structure_get (st, "timestamp", G_TYPE_UINT64, &ts, "type", G_TYPE_STRING, &type, "symbol", G_TYPE_STRING, &symbol, NULL) ) return; std::string symbolStr (symbol); std::string typeStr (type); g_free (type); g_free (symbol); filter->barcodeDetected (ts, typeStr, symbolStr); } }
static std::shared_ptr<RTCDataChannelStats> createtRTCDataChannelStats (const GstStructure *stats) { KmsWebRtcDataChannelState state; guint64 messages_sent, message_recv, bytes_sent, bytes_recv; gchar *id, *label, *protocol; guint channelid; gst_structure_get (stats, "channel-id", G_TYPE_UINT, &channelid, "label", G_TYPE_STRING, &label, "protocol", G_TYPE_STRING, &protocol, "id", G_TYPE_STRING, &id, "state", G_TYPE_UINT, &state, "bytes-sent", G_TYPE_UINT64, &bytes_sent, "bytes-recv", G_TYPE_UINT64, &bytes_recv, "messages-sent", G_TYPE_UINT64, &messages_sent, "messages-recv", G_TYPE_UINT64, &message_recv, NULL); std::shared_ptr<RTCDataChannelStats> rtcDataStats = std::make_shared <RTCDataChannelStats> (id, std::make_shared <StatsType> (StatsType::datachannel), 0.0, label, protocol, channelid, getRTCDataChannelState (state), messages_sent, bytes_sent, message_recv, bytes_recv); g_free (protocol); g_free (label); g_free (id); return rtcDataStats; }
/** * gst_gl_query_local_gl_context: * @element: a #GstElement to query from * @direction: the #GstPadDirection to query * @context_ptr: (inout): location containing the current and/or resulting * #GstGLContext * * Performs a GST_QUERY_CONTEXT query of type "gst.gl.local_context" on all * #GstPads in @element of @direction for the local OpenGL context used by * GStreamer elements. * * Returns: whether @context_ptr contains a #GstGLContext */ gboolean gst_gl_query_local_gl_context (GstElement * element, GstPadDirection direction, GstGLContext ** context_ptr) { GstQuery *query; GstContext *context; const GstStructure *s; g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE); g_return_val_if_fail (context_ptr != NULL, FALSE); if (*context_ptr) return TRUE; query = gst_query_new_context ("gst.gl.local_context"); if (gst_gl_run_query (GST_ELEMENT (element), query, direction)) { gst_query_parse_context (query, &context); if (context) { s = gst_context_get_structure (context); gst_structure_get (s, "context", GST_TYPE_GL_CONTEXT, context_ptr, NULL); } } gst_query_unref (query); return *context_ptr != NULL; }
void pointerDetector_receive_message (GstBus *bus, GstMessage *message, gpointer pointerDetector) { const GstStructure *st; gchar *windowID; const gchar *type; std::string windowIDStr, typeStr; PointerDetectorFilter *filter = (PointerDetectorFilter *) pointerDetector; if (GST_MESSAGE_SRC (message) != GST_OBJECT (filter->pointerDetector) || GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT) return; st = gst_message_get_structure (message); type = gst_structure_get_name (st); if ( (g_strcmp0 (type, "window-out") != 0) && (g_strcmp0 (type, "window-in") != 0) ) { GST_WARNING ("The message does not have the correct name"); return; } if (!gst_structure_get (st, "window", G_TYPE_STRING , &windowID, NULL) ) { GST_WARNING ("The message does not contain the window ID"); return; } windowIDStr = windowID; typeStr = type; g_free (windowID); filter->raiseEvent (typeStr, windowIDStr); }
static gboolean events_cb(GstPad *pad, GstEvent *event, gpointer user_data) { GstSURFTracker *filter; const GstStructure *structure; filter = GST_SURF_TRACKER(user_data); // sanity checks g_return_val_if_fail(pad != NULL, FALSE); g_return_val_if_fail(event != NULL, FALSE); g_return_val_if_fail(filter != NULL, FALSE); structure = gst_event_get_structure(event); if ((structure != NULL) && (strcmp(gst_structure_get_name(structure), "haar-adjust-roi") == 0)) { CvRect rect; GstClockTime timestamp; gst_structure_get((GstStructure*) structure, "x", G_TYPE_UINT, &rect.x, "y", G_TYPE_UINT, &rect.y, "width", G_TYPE_UINT, &rect.width, "height", G_TYPE_UINT, &rect.height, "timestamp", G_TYPE_UINT64, ×tamp, NULL); if (timestamp > filter->rect_timestamp) { filter->rect_timestamp = timestamp; } g_array_append_val(filter->rect_array, rect); } return TRUE; }
static void kms_connection_attr_ext_add_ips (KmsISdpMediaExtension * ext, GstSDPMedia * media, GArray * ips) { gint i; for (i = 0; i < ips->len; i++) { gchar *nettype, *addrtype, *address; guint ttl, addr_number; const GstStructure *addr; GValue *val; val = &g_array_index (ips, GValue, i); if (!GST_VALUE_HOLDS_STRUCTURE (val)) { GST_WARNING_OBJECT (ext, "Inavalid address provided"); continue; } addr = gst_value_get_structure (val); nettype = addrtype = address = NULL; if (gst_structure_get (addr, "nettype", G_TYPE_STRING, &nettype, "addrtype", G_TYPE_STRING, &addrtype, "address", G_TYPE_STRING, &address, "ttl", G_TYPE_UINT, &ttl, "addrnumber", G_TYPE_UINT, &addr_number, NULL)) { gst_sdp_media_add_connection (media, nettype, addrtype, address, ttl, addr_number); } g_free (nettype); g_free (addrtype); g_free (address); } }
static gboolean message_handler (GstBus * bus, GstMessage * message, gpointer user_data) { switch (GST_MESSAGE_TYPE (message)) { #ifdef ASYNC_VERSION case GST_MESSAGE_ELEMENT: { const GstStructure *str; str = gst_message_get_structure (message); if (gst_structure_has_name (str, "GstBinForwarded")) { GstMessage *orig; /* unwrap the element message */ gst_structure_get (str, "message", GST_TYPE_MESSAGE, &orig, NULL); g_assert (orig); switch (GST_MESSAGE_TYPE (orig)) { case GST_MESSAGE_ASYNC_DONE: g_print ("ASYNC done %s\n", GST_MESSAGE_SRC_NAME (orig)); if (GST_MESSAGE_SRC (orig) == GST_OBJECT_CAST (play_bin)) { g_print ("prerolled, starting synchronized playback and recording\n"); /* returns ASYNC because the sink linked to the live source is not * prerolled */ if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_CHANGE_ASYNC) { g_warning ("State change failed"); } } break; default: break; } } break; } #endif case GST_MESSAGE_EOS: g_print ("EOS\n"); g_main_loop_quit (loop); break; case GST_MESSAGE_ERROR: { GError *err = NULL; gst_message_parse_error (message, &err, NULL); g_print ("error: %s\n", err->message); g_clear_error (&err); g_main_loop_quit (loop); break; } default: break; } return TRUE; }
static void kms_image_overlay_get_timestamp (KmsImageOverlay * imageoverlay, GstStructure * faces) { GstStructure *timestamp; gboolean ret; ret = gst_structure_get (faces, "timestamp", GST_TYPE_STRUCTURE, ×tamp, NULL); if (ret) { gst_structure_get (timestamp, "dts", G_TYPE_UINT64, &imageoverlay->priv->dts, NULL); gst_structure_get (timestamp, "pts", G_TYPE_UINT64, &imageoverlay->priv->pts, NULL); gst_structure_free (timestamp); } }
void kms_remb_local_set_params (KmsRembLocal * rl, GstStructure * params) { gfloat auxf; gint auxi; gboolean is_set; is_set = gst_structure_get (params, "packets-recv-interval-top", G_TYPE_INT, &auxi, NULL); if (is_set) { if (auxi <= 0) { GST_WARNING ("'packets-recv-interval-top' must be greater than 0. Setting to 1."); auxi = 1; } rl->packets_recv_interval_top = auxi; } is_set = gst_structure_get (params, "exponential-factor", G_TYPE_FLOAT, &auxf, NULL); if (is_set) { rl->exponential_factor = auxf; } is_set = gst_structure_get (params, "lineal-factor-min", G_TYPE_INT, &auxi, NULL); if (is_set) { rl->lineal_factor_min = auxi; } is_set = gst_structure_get (params, "lineal-factor-grade", G_TYPE_INT, &auxi, NULL); if (is_set) { rl->lineal_factor_grade = auxi; } is_set = gst_structure_get (params, "decrement-factor", G_TYPE_FLOAT, &auxf, NULL); if (is_set) { rl->decrement_factor = auxf; } is_set = gst_structure_get (params, "threshold-factor", G_TYPE_FLOAT, &auxf, NULL); if (is_set) { rl->threshold_factor = auxf; } is_set = gst_structure_get (params, "up-losses", G_TYPE_INT, &auxi, NULL); if (is_set) { rl->up_losses = auxi; } }
/** * gst_buffer_pool_config_get_gl_allocation_params: * @config: a buffer pool config * * Returns: (transfer full): the currently set #GstGLAllocationParams or %NULL */ GstGLAllocationParams * gst_buffer_pool_config_get_gl_allocation_params (GstStructure * config) { GstGLAllocationParams *ret; if (!gst_structure_get (config, "gl-allocation-params", GST_TYPE_GL_ALLOCATION_PARAMS, &ret, NULL)) ret = NULL; return ret; }
void kms_remb_remote_set_params (KmsRembRemote * rm, GstStructure * params) { gint auxi; gboolean is_set; is_set = gst_structure_get (params, "remb-on-connect", G_TYPE_INT, &auxi, NULL); if (is_set) { rm->remb_on_connect = auxi; } }
static gboolean _find_local_gl_context (GstGLStereoSplit * split) { GstQuery *query; GstContext *context; const GstStructure *s; if (split->context) return TRUE; query = gst_query_new_context ("gst.gl.local_context"); if (!split->context && gst_gl_run_query (GST_ELEMENT (split), query, GST_PAD_SRC)) { gst_query_parse_context (query, &context); if (context) { s = gst_context_get_structure (context); gst_structure_get (s, "context", GST_GL_TYPE_CONTEXT, &split->context, NULL); } } if (!split->context && gst_gl_run_query (GST_ELEMENT (split), query, GST_PAD_SINK)) { gst_query_parse_context (query, &context); if (context) { s = gst_context_get_structure (context); gst_structure_get (s, "context", GST_GL_TYPE_CONTEXT, &split->context, NULL); } } GST_DEBUG_OBJECT (split, "found local context %p", split->context); gst_query_unref (query); if (split->context) return TRUE; return FALSE; }
gboolean gst_vaapi_video_context_get_display (GstContext * context, GstVaapiDisplay ** display_ptr) { const GstStructure *structure; g_return_val_if_fail (GST_IS_CONTEXT (context), FALSE); g_return_val_if_fail (g_strcmp0 (gst_context_get_context_type (context), GST_VAAPI_DISPLAY_CONTEXT_TYPE_NAME) == 0, FALSE); structure = gst_context_get_structure (context); return gst_structure_get (structure, GST_VAAPI_DISPLAY_CONTEXT_TYPE_NAME, GST_TYPE_VAAPI_DISPLAY, display_ptr, NULL); }
gboolean gst_vaapi_find_gl_local_context (GstElement * element, GstObject ** gl_context_ptr) { #if USE_GST_GL_HELPERS GstQuery *query; GstContext *context; const GstStructure *s; GstObject *gl_context; g_return_val_if_fail (gl_context_ptr, FALSE); gl_context = NULL; query = gst_query_new_context ("gst.gl.local_context"); if (_gst_context_run_query (element, query, GST_PAD_SRC)) { gst_query_parse_context (query, &context); if (context) { s = gst_context_get_structure (context); gst_structure_get (s, "context", GST_TYPE_GL_CONTEXT, &gl_context, NULL); } } if (!gl_context && _gst_context_run_query (element, query, GST_PAD_SINK)) { gst_query_parse_context (query, &context); if (context) { s = gst_context_get_structure (context); gst_structure_get (s, "context", GST_TYPE_GL_CONTEXT, &gl_context, NULL); } } gst_query_unref (query); if (gl_context) { *gl_context_ptr = gl_context; return TRUE; } #endif return FALSE; }
/** * gst_buffer_pool_config_get_video_alignment: * @config: a #GstStructure * @align: a #GstVideoAlignment * * Get the video alignment from the bufferpool configuration @config in * in @align * * Returns: #TRUE if @config could be parsed correctly. */ gboolean gst_buffer_pool_config_get_video_alignment (GstStructure * config, GstVideoAlignment * align) { g_return_val_if_fail (config != NULL, FALSE); g_return_val_if_fail (align != NULL, FALSE); return gst_structure_get (config, "padding-top", G_TYPE_UINT, &align->padding_top, "padding-bottom", G_TYPE_UINT, &align->padding_bottom, "padding-left", G_TYPE_UINT, &align->padding_left, "padding-right", G_TYPE_UINT, &align->padding_right, "stride-align0", G_TYPE_UINT, &align->stride_align[0], "stride-align1", G_TYPE_UINT, &align->stride_align[1], "stride-align2", G_TYPE_UINT, &align->stride_align[2], "stride-align3", G_TYPE_UINT, &align->stride_align[3], NULL); }
static std::shared_ptr<RTCPeerConnectionStats> createtRTCPeerConnectionStats (const GstStructure *stats) { guint opened, closed; gchar *id; gst_structure_get (stats, "data-channels-opened", G_TYPE_UINT, &opened, "data-channels-closed", G_TYPE_UINT, &closed, "id", G_TYPE_STRING, &id, NULL); std::shared_ptr<RTCPeerConnectionStats> peerConnStats = std::make_shared <RTCPeerConnectionStats> (id, std::make_shared <StatsType> (StatsType::session), 0.0, opened, closed); g_free (id); return peerConnStats; }
static void kms_alpha_blending_set_port_properties (KmsAlphaBlending * self, GstStructure * properties) { gint port, z_order; gfloat relative_x, relative_y, relative_width, relative_height; KmsAlphaBlendingData *port_data; gboolean fields_ok = TRUE; GST_DEBUG ("setting port properties"); fields_ok = fields_ok && gst_structure_get (properties, "relative_x", G_TYPE_FLOAT, &relative_x, NULL); fields_ok = fields_ok && gst_structure_get (properties, "relative_y", G_TYPE_FLOAT, &relative_y, NULL); fields_ok = fields_ok && gst_structure_get (properties, "relative_width", G_TYPE_FLOAT, &relative_width, NULL); fields_ok = fields_ok && gst_structure_get (properties, "relative_height", G_TYPE_FLOAT, &relative_height, NULL); fields_ok = fields_ok && gst_structure_get (properties, "port", G_TYPE_INT, &port, NULL); fields_ok = fields_ok && gst_structure_get (properties, "z_order", G_TYPE_INT, &z_order, NULL); if (!fields_ok) { GST_WARNING_OBJECT (self, "Invalid properties structure received"); return; } KMS_ALPHA_BLENDING_LOCK (self); port_data = g_hash_table_lookup (self->priv->ports, GINT_TO_POINTER (port)); if (port_data == NULL) { KMS_ALPHA_BLENDING_UNLOCK (self); return; } port_data->relative_x = relative_x; port_data->relative_y = relative_y; port_data->relative_width = relative_width; port_data->relative_height = relative_height; port_data->z_order = z_order; port_data->configured = TRUE; configure_port (port_data); KMS_ALPHA_BLENDING_UNLOCK (self); }
static GstStructure * get_element_entry (const gchar * element_name) { GstStructure *element; if (!gst_structure_get ((GstStructure *) element_table, element_name, GST_TYPE_STRUCTURE, &element, NULL)) { element = NULL; } /* This assert should never fail, because plugin elements are registered * based on the entries in this table. Someone would have to manually * override the type qdata for this to fail. */ g_assert (element); return element; }
/** * gst_context_get_gl_display: * @context: a #GstContext * @display: resulting #GstGLDisplay * * Returns: Whether @display was in @context * * Since: 1.4 */ gboolean gst_context_get_gl_display (GstContext * context, GstGLDisplay ** display) { const GstStructure *s; gboolean ret; g_return_val_if_fail (display != NULL, FALSE); g_return_val_if_fail (context != NULL, FALSE); s = gst_context_get_structure (context); ret = gst_structure_get (s, GST_GL_DISPLAY_CONTEXT_TYPE, GST_TYPE_GL_DISPLAY, display, NULL); GST_CAT_LOG (gst_context, "got GstGLDisplay(%p) from context(%p)", *display, context); return ret; }
/** * gst_context_get_vulkan_device: * @context: a #GstContext * @device: resulting #GstVulkanDevice * * Returns: Whether @device was in @context * * Since: 1.10 */ gboolean gst_context_get_vulkan_device (GstContext * context, GstVulkanDevice ** device) { const GstStructure *s; gboolean ret; g_return_val_if_fail (device != NULL, FALSE); g_return_val_if_fail (context != NULL, FALSE); s = gst_context_get_structure (context); ret = gst_structure_get (s, GST_VULKAN_DEVICE_CONTEXT_TYPE_STR, GST_TYPE_VULKAN_DEVICE, device, NULL); GST_CAT_LOG (GST_CAT_CONTEXT, "got GstVulkanDevice(%" GST_PTR_FORMAT ") from context(%" GST_PTR_FORMAT ")", *device, context); return ret; }
static void gst_gl_display_context_query (GstElement * element, GstGLDisplay ** display_ptr) { GstContext *ctxt; GstQuery *query; #ifndef GST_DISABLE_GST_DEBUG if (!GST_CAT_CONTEXT) GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT"); #endif query = _gst_context_query (element, display_ptr, GST_GL_DISPLAY_CONTEXT_TYPE); gst_query_parse_context (query, &ctxt); if (ctxt && gst_context_has_context_type (ctxt, GST_GL_DISPLAY_CONTEXT_TYPE)) gst_context_get_gl_display (ctxt, display_ptr); if (*display_ptr) goto out; #if GST_GL_HAVE_WINDOW_X11 gst_query_unref (query); query = _gst_context_query (element, display_ptr, "gst.x11.display.handle"); gst_query_parse_context (query, &ctxt); if (ctxt && gst_context_has_context_type (ctxt, "gst.x11.display.handle")) { const GstStructure *s; Display *display; s = gst_context_get_structure (ctxt); if (gst_structure_get (s, "display", G_TYPE_POINTER, &display, NULL) && display) { *display_ptr = (GstGLDisplay *) gst_gl_display_x11_new_with_display (display); } } if (*display_ptr) goto out; #endif out: gst_query_unref (query); }
static void gst_gl_context_query (GstElement * element, GstGLContext ** context_ptr) { GstContext *ctxt; GstQuery *query; #ifndef GST_DISABLE_GST_DEBUG if (!GST_CAT_CONTEXT) GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT"); #endif query = _gst_context_query (element, context_ptr, "gst.gl.app_context"); gst_query_parse_context (query, &ctxt); if (ctxt && gst_context_has_context_type (ctxt, "gst.gl.app_context")) { const GstStructure *s = gst_context_get_structure (ctxt); gst_structure_get (s, "context", GST_GL_TYPE_CONTEXT, context_ptr, NULL); } gst_query_unref (query); }