mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-21 17:21:13 +00:00
GstCustomMeta: Use simplified API where possible
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5385>
This commit is contained in:
parent
452ab184cb
commit
0ab48250a9
7 changed files with 14 additions and 30 deletions
|
@ -88,15 +88,13 @@ get_qrcode_content (GstBaseQROverlay * base, GstBuffer * buf,
|
|||
GstCustomMeta *meta = gst_buffer_get_custom_meta (buf, "GstQROverlayMeta");
|
||||
if (meta) {
|
||||
gchar *data;
|
||||
GstStructure *structure =
|
||||
gst_custom_meta_get_structure ((GstCustomMeta *) meta);
|
||||
|
||||
if (gst_structure_get (structure, "data", G_TYPE_STRING, &data, NULL)) {
|
||||
if (gst_structure_get (meta->structure, "data", G_TYPE_STRING, &data, NULL)) {
|
||||
gboolean keep_data;
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
self->data_changed = TRUE;
|
||||
if (gst_structure_get_boolean (structure, "keep_data", &keep_data)
|
||||
if (gst_structure_get_boolean (meta->structure, "keep_data", &keep_data)
|
||||
&& keep_data) {
|
||||
g_free (self->data);
|
||||
self->data = g_strdup (self->data);
|
||||
|
@ -162,7 +160,6 @@ gst_qr_overlay_class_init (GstQROverlayClass * klass)
|
|||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
static const gchar *tags[] = { NULL };
|
||||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
gstelement_class = (GstElementClass *) klass;
|
||||
|
@ -177,7 +174,7 @@ gst_qr_overlay_class_init (GstQROverlayClass * klass)
|
|||
"Overlay Qrcodes over each buffer with data passed in",
|
||||
"Thibault Saunier <tsaunier@igalia.com>");
|
||||
|
||||
gst_meta_register_custom ("GstQROverlayMeta", tags, NULL, NULL, NULL);
|
||||
gst_meta_register_custom_simple ("GstQROverlayMeta");
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_DATA, g_param_spec_string ("data",
|
||||
|
|
|
@ -402,9 +402,8 @@ gst_vp8_enc_preflight_buffer (GstVPXEnc * enc,
|
|||
gboolean layer_sync, guint layer_id, guint8 tl0picidx)
|
||||
{
|
||||
GstCustomMeta *meta = gst_buffer_add_custom_meta (buffer, "GstVP8Meta");
|
||||
GstStructure *s = gst_custom_meta_get_structure (meta);
|
||||
|
||||
gst_structure_set (s,
|
||||
gst_structure_set (meta->structure,
|
||||
"use-temporal-scaling", G_TYPE_BOOLEAN, (enc->cfg.ts_periodicity != 0),
|
||||
"layer-sync", G_TYPE_BOOLEAN, layer_sync,
|
||||
"layer-id", G_TYPE_UINT, layer_id,
|
||||
|
|
|
@ -31,9 +31,8 @@ void
|
|||
vpx_element_init (GstPlugin * plugin)
|
||||
{
|
||||
static gsize res = FALSE;
|
||||
static const gchar *tags[] = { NULL };
|
||||
if (g_once_init_enter (&res)) {
|
||||
gst_meta_register_custom ("GstVP8Meta", tags, NULL, NULL, NULL);
|
||||
gst_meta_register_custom_simple ("GstVP8Meta");
|
||||
g_once_init_leave (&res, TRUE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -556,13 +556,12 @@ gst_rtp_vp8_create_header_buffer (GstRtpVP8Pay * self, guint8 partid,
|
|||
gboolean use_temporal_scaling = FALSE;
|
||||
|
||||
if (meta) {
|
||||
GstStructure *s = gst_custom_meta_get_structure (meta);
|
||||
gst_structure_get_boolean (s, "use-temporal-scaling",
|
||||
gst_structure_get_boolean (meta->structure, "use-temporal-scaling",
|
||||
&use_temporal_scaling);
|
||||
|
||||
if (use_temporal_scaling)
|
||||
gst_structure_get (s, "layer-id", G_TYPE_UINT, &temporal_layer,
|
||||
"layer-sync", G_TYPE_BOOLEAN, &layer_sync, NULL);
|
||||
gst_structure_get (meta->structure, "layer-id", G_TYPE_UINT,
|
||||
&temporal_layer, "layer-sync", G_TYPE_BOOLEAN, &layer_sync, NULL);
|
||||
}
|
||||
|
||||
/* FIXME: Support a prediction structure where higher layers don't
|
||||
|
@ -682,13 +681,12 @@ gst_rtp_vp8_pay_handle_buffer (GstRTPBasePayload * payload, GstBuffer * buffer)
|
|||
}
|
||||
|
||||
if (meta) {
|
||||
GstStructure *s = gst_custom_meta_get_structure (meta);
|
||||
gboolean use_temporal_scaling;
|
||||
/* For interop it's most likely better to keep the temporal scalability
|
||||
* fields present if the stream previously had them present. Alternating
|
||||
* whether these fields are present or not may confuse the receiver. */
|
||||
|
||||
gst_structure_get_boolean (s, "use-temporal-scaling",
|
||||
gst_structure_get_boolean (meta->structure, "use-temporal-scaling",
|
||||
&use_temporal_scaling);
|
||||
if (use_temporal_scaling)
|
||||
self->temporal_scalability_fields_present = TRUE;
|
||||
|
|
|
@ -105,12 +105,10 @@ add_vp8_meta (GstBuffer * buffer, gboolean use_temporal_scaling,
|
|||
gboolean layer_sync, guint layer_id, guint tl0picidx)
|
||||
{
|
||||
GstCustomMeta *meta;
|
||||
GstStructure *s;
|
||||
|
||||
meta = gst_buffer_add_custom_meta (buffer, "GstVP8Meta");
|
||||
fail_unless (meta != NULL);
|
||||
s = gst_custom_meta_get_structure (meta);
|
||||
gst_structure_set (s,
|
||||
gst_structure_set (meta->structure,
|
||||
"use-temporal-scaling", G_TYPE_BOOLEAN, use_temporal_scaling,
|
||||
"layer-sync", G_TYPE_BOOLEAN, layer_sync,
|
||||
"layer-id", G_TYPE_UINT, layer_id,
|
||||
|
@ -873,10 +871,9 @@ rtpvp8_suite (void)
|
|||
{
|
||||
Suite *s = suite_create ("rtpvp8");
|
||||
TCase *tc_chain;
|
||||
static const gchar *tags[] = { NULL };
|
||||
|
||||
/* Register custom GstVP8Meta manually */
|
||||
gst_meta_register_custom ("GstVP8Meta", tags, NULL, NULL, NULL);
|
||||
gst_meta_register_custom_simple ("GstVP8Meta");
|
||||
|
||||
suite_add_tcase (s, (tc_chain = tcase_create ("vp8pay")));
|
||||
tcase_add_loop_test (tc_chain, test_pay_no_meta, 0,
|
||||
|
|
|
@ -219,10 +219,8 @@ GST_END_TEST;
|
|||
guint temporal_layer_id, tl0picidx; \
|
||||
GstCustomMeta *meta = gst_buffer_get_custom_meta (buffer, \
|
||||
"GstVP8Meta"); \
|
||||
GstStructure *s; \
|
||||
fail_unless (meta != NULL); \
|
||||
s = gst_custom_meta_get_structure (meta); \
|
||||
fail_unless (gst_structure_get (s, \
|
||||
fail_unless (gst_structure_get (meta->structure, \
|
||||
"use-temporal-scaling", G_TYPE_BOOLEAN, &use_temporal_scaling, \
|
||||
"layer-sync", G_TYPE_BOOLEAN, &layer_sync, \
|
||||
"layer-id", G_TYPE_UINT, &temporal_layer_id, \
|
||||
|
@ -386,7 +384,6 @@ GST_START_TEST (test_encode_fresh_meta)
|
|||
GstBuffer *buffer;
|
||||
GstHarness *h = gst_harness_new ("vp8enc");
|
||||
GstCustomMeta *meta;
|
||||
GstStructure *s;
|
||||
gst_harness_set_src_caps (h, gst_caps_new_i420_full (320, 240, 25, 1, 1, 1));
|
||||
|
||||
buffer = gst_harness_create_video_buffer_full (h, 0x0,
|
||||
|
@ -395,8 +392,7 @@ GST_START_TEST (test_encode_fresh_meta)
|
|||
|
||||
/* Attach bogus meta to input buffer */
|
||||
meta = gst_buffer_add_custom_meta (buffer, "GstVP8Meta");
|
||||
s = gst_custom_meta_get_structure (meta);
|
||||
gst_structure_set (s,
|
||||
gst_structure_set (meta->structure,
|
||||
"use-temporal-scaling", G_TYPE_BOOLEAN, FALSE,
|
||||
"layer-sync", G_TYPE_BOOLEAN, FALSE,
|
||||
"layer-id", G_TYPE_UINT, 0, "tl0picidx", G_TYPE_UINT, 0, NULL);
|
||||
|
|
|
@ -2953,7 +2953,6 @@ gst_aggregator_class_init (GstAggregatorClass * klass)
|
|||
{
|
||||
GObjectClass *gobject_class = (GObjectClass *) klass;
|
||||
GstElementClass *gstelement_class = (GstElementClass *) klass;
|
||||
static const gchar *meta_tags[] = { NULL };
|
||||
|
||||
aggregator_parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
|
@ -3070,8 +3069,7 @@ gst_aggregator_class_init (GstAggregatorClass * klass)
|
|||
GST_TYPE_CLOCK_TIME, GST_TYPE_CLOCK_TIME,
|
||||
GST_TYPE_STRUCTURE | G_SIGNAL_TYPE_STATIC_SCOPE);
|
||||
|
||||
gst_meta_register_custom ("GstAggregatorMissingDataMeta", meta_tags, NULL,
|
||||
NULL, NULL);
|
||||
gst_meta_register_custom_simple ("GstAggregatorMissingDataMeta");
|
||||
}
|
||||
|
||||
static inline gpointer
|
||||
|
|
Loading…
Reference in a new issue