1 /* GStreamer Editing Services
2 * Copyright (C) 2012 Paul Lange <palango@gmx.de>
3 * Copyright (C) <2014> Thibault Saunier <thibault.saunier@collabora.com>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
24 #include <glib-object.h>
27 #include "ges-meta-container.h"
30 * SECTION: gesmetacontainer
31 * @short_description: An interface for storing meta
33 * Interface that allows reading and writing meta
36 static GQuark ges_meta_key;
38 G_DEFINE_INTERFACE_WITH_CODE (GESMetaContainer, ges_meta_container,
39 G_TYPE_OBJECT, ges_meta_key =
40 g_quark_from_static_string ("ges-meta-container-data");
49 static guint _signals[LAST_SIGNAL] = { 0 };
51 typedef struct RegisteredMeta
57 typedef struct ContainerData
59 GstStructure *structure;
60 GHashTable *static_items;
64 ges_meta_container_default_init (GESMetaContainerInterface * iface)
68 * GESMetaContainer::notify:
69 * @container: a #GESMetaContainer
70 * @prop: the key of the value that changed
71 * @value: the #GValue containing the new value
73 * The notify signal is used to be notify of changes of values
76 _signals[NOTIFY_SIGNAL] =
77 g_signal_new ("notify-meta", G_TYPE_FROM_INTERFACE (iface),
78 G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE | G_SIGNAL_DETAILED |
79 G_SIGNAL_NO_HOOKS, 0, NULL, NULL, g_cclosure_marshal_generic,
80 G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_VALUE);
84 _free_meta_container_data (ContainerData * data)
86 gst_structure_free (data->structure);
87 g_hash_table_unref (data->static_items);
89 g_slice_free (ContainerData, data);
93 _free_static_item (RegisteredMeta * item)
95 g_slice_free (RegisteredMeta, item);
98 static ContainerData *
99 _create_container_data (GESMetaContainer * container)
101 ContainerData *data = g_slice_new (ContainerData);
102 data->structure = gst_structure_new_empty ("metadatas");
103 data->static_items = g_hash_table_new_full (g_str_hash, g_str_equal,
104 g_free, (GDestroyNotify) (GDestroyNotify) _free_static_item);
105 g_object_set_qdata_full (G_OBJECT (container), ges_meta_key, data,
106 (GDestroyNotify) _free_meta_container_data);
111 static GstStructure *
112 _meta_container_get_structure (GESMetaContainer * container)
116 data = g_object_get_qdata (G_OBJECT (container), ges_meta_key);
118 data = _create_container_data (container);
120 return data->structure;
125 GESMetaForeachFunc func;
126 const GESMetaContainer *container;
128 } MetadataForeachData;
131 structure_foreach_wrapper (GQuark field_id, const GValue * value,
134 MetadataForeachData *data = (MetadataForeachData *) user_data;
136 data->func (data->container, g_quark_to_string (field_id), value, data->data);
141 _append_foreach (GQuark field_id, const GValue * value, GESMetaContainer * self)
143 ges_meta_container_set_meta (self, g_quark_to_string (field_id), value);
149 * ges_meta_container_foreach:
150 * @container: container to iterate over
151 * @func: (scope call): function to be called for each metadata
152 * @user_data: (closure): user specified data
154 * Calls the given function for each metadata inside the meta container. Note
155 * that if there is no metadata, the function won't be called at all.
158 ges_meta_container_foreach (GESMetaContainer * container,
159 GESMetaForeachFunc func, gpointer user_data)
161 GstStructure *structure;
162 MetadataForeachData foreach_data;
164 g_return_if_fail (GES_IS_META_CONTAINER (container));
165 g_return_if_fail (func != NULL);
167 structure = _meta_container_get_structure (container);
169 foreach_data.func = func;
170 foreach_data.container = container;
171 foreach_data.data = user_data;
173 gst_structure_foreach (structure,
174 (GstStructureForeachFunc) structure_foreach_wrapper, &foreach_data);
177 /* _can_write_value should have been checked before calling */
179 _register_meta (GESMetaContainer * container, GESMetaFlag flags,
180 const gchar * meta_item, GType type)
183 RegisteredMeta *static_item;
185 data = g_object_get_qdata (G_OBJECT (container), ges_meta_key);
187 data = _create_container_data (container);
188 else if (g_hash_table_lookup (data->static_items, meta_item)) {
189 GST_WARNING_OBJECT (container, "Static meta %s already registered",
195 static_item = g_slice_new0 (RegisteredMeta);
196 static_item->item_type = type;
197 static_item->flags = flags;
198 g_hash_table_insert (data->static_items, g_strdup (meta_item), static_item);
204 _set_value (GESMetaContainer * container, const gchar * meta_item,
205 const GValue * value)
207 GstStructure *structure;
208 gchar *val = gst_value_serialize (value);
211 GST_WARNING_OBJECT (container, "Could not set value on item: %s",
218 structure = _meta_container_get_structure (container);
220 GST_DEBUG_OBJECT (container, "Setting meta_item %s value: %s::%s",
221 meta_item, G_VALUE_TYPE_NAME (value), val);
223 gst_structure_set_value (structure, meta_item, value);
224 g_signal_emit (container, _signals[NOTIFY_SIGNAL], 0, meta_item, value);
231 _can_write_value (GESMetaContainer * container, const gchar * item_name,
235 RegisteredMeta *static_item = NULL;
237 data = g_object_get_qdata (G_OBJECT (container), ges_meta_key);
239 _create_container_data (container);
243 static_item = g_hash_table_lookup (data->static_items, item_name);
245 if (static_item == NULL)
248 if ((static_item->flags & GES_META_WRITABLE) == FALSE) {
249 GST_WARNING_OBJECT (container, "Can not write %s", item_name);
253 if (static_item->item_type != type) {
254 GST_WARNING_OBJECT (container, "Can not set value of type %s on %s "
255 "its type is: %s", g_type_name (static_item->item_type), item_name,
263 #define CREATE_SETTER(name, value_ctype, value_gtype, setter_name) \
265 ges_meta_container_set_ ## name (GESMetaContainer *container, \
266 const gchar *meta_item, value_ctype value) \
268 GValue gval = { 0 }; \
271 g_return_val_if_fail (GES_IS_META_CONTAINER (container), FALSE); \
272 g_return_val_if_fail (meta_item != NULL, FALSE); \
274 if (_can_write_value (container, meta_item, value_gtype) == FALSE) \
277 g_value_init (&gval, value_gtype); \
278 g_value_set_ ##setter_name (&gval, value); \
280 ret = _set_value (container, meta_item, &gval); \
281 g_value_unset (&gval); \
286 * ges_meta_container_set_boolean:
287 * @container: Target container
288 * @meta_item: Name of the meta item to set
289 * @value: Value to set
291 * Sets the value of a given meta item
293 * Return: %TRUE if the meta could be added, %FALSE otherwise
295 CREATE_SETTER (boolean, gboolean, G_TYPE_BOOLEAN, boolean);
298 * ges_meta_container_set_int:
299 * @container: Target container
300 * @meta_item: Name of the meta item to set
301 * @value: Value to set
303 * Sets the value of a given meta item
305 * Return: %TRUE if the meta could be added, %FALSE otherwise
307 CREATE_SETTER (int, gint, G_TYPE_INT, int);
310 * ges_meta_container_set_uint:
311 * @container: Target container
312 * @meta_item: Name of the meta item to set
313 * @value: Value to set
315 * Sets the value of a given meta item
317 * Return: %TRUE if the meta could be added, %FALSE otherwise
319 CREATE_SETTER (uint, guint, G_TYPE_UINT, uint);
322 * ges_meta_container_set_int64:
323 * @container: Target container
324 * @meta_item: Name of the meta item to set
325 * @value: Value to set
327 * Sets the value of a given meta item
329 * Return: %TRUE if the meta could be added, %FALSE otherwise
331 CREATE_SETTER (int64, gint64, G_TYPE_INT64, int64);
334 * ges_meta_container_set_uint64:
335 * @container: Target container
336 * @meta_item: Name of the meta item to set
337 * @value: Value to set
339 * Sets the value of a given meta item
341 * Return: %TRUE if the meta could be added, %FALSE otherwise
343 CREATE_SETTER (uint64, guint64, G_TYPE_UINT64, uint64);
346 * ges_meta_container_set_float:
347 * @container: Target container
348 * @meta_item: Name of the meta item to set
349 * @value: Value to set
351 * Sets the value of a given meta item
353 * Return: %TRUE if the meta could be added, %FALSE otherwise
355 CREATE_SETTER (float, float, G_TYPE_FLOAT, float);
358 * ges_meta_container_set_double:
359 * @container: Target container
360 * @meta_item: Name of the meta item to set
361 * @value: Value to set
363 * Sets the value of a given meta item
365 * Return: %TRUE if the meta could be added, %FALSE otherwise
367 CREATE_SETTER (double, double, G_TYPE_DOUBLE, double);
370 * ges_meta_container_set_date:
371 * @container: Target container
372 * @meta_item: Name of the meta item to set
373 * @value: Value to set
375 * Sets the value of a given meta item
377 * Return: %TRUE if the meta could be added, %FALSE otherwise
379 CREATE_SETTER (date, const GDate *, G_TYPE_DATE, boxed);
382 * ges_meta_container_set_date_time:
383 * @container: Target container
384 * @meta_item: Name of the meta item to set
385 * @value: Value to set
387 * Sets the value of a given meta item
389 * Return: %TRUE if the meta could be added, %FALSE otherwise
391 CREATE_SETTER (date_time, const GstDateTime *, GST_TYPE_DATE_TIME, boxed);
394 * ges_meta_container_set_string:
395 * @container: Target container
396 * @meta_item: Name of the meta item to set
397 * @value: Value to set
399 * Sets the value of a given meta item
401 * Return: %TRUE if the meta could be added, %FALSE otherwise
403 CREATE_SETTER (string, const gchar *, G_TYPE_STRING, string);
406 * ges_meta_container_set_meta:
407 * @container: Target container
408 * @meta_item: Name of the meta item to set
409 * @value: (allow-none): Value to set
411 * Sets the value of a given meta item
413 * Return: %TRUE if the meta could be added, %FALSE otherwise
416 ges_meta_container_set_meta (GESMetaContainer * container,
417 const gchar * meta_item, const GValue * value)
419 g_return_val_if_fail (GES_IS_META_CONTAINER (container), FALSE);
420 g_return_val_if_fail (meta_item != NULL, FALSE);
423 GstStructure *structure = _meta_container_get_structure (container);
424 gst_structure_remove_field (structure, meta_item);
426 g_signal_emit (container, _signals[NOTIFY_SIGNAL], 0, meta_item, value);
431 if (_can_write_value (container, meta_item, G_VALUE_TYPE (value)) == FALSE)
434 return _set_value (container, meta_item, value);
438 * ges_meta_container_metas_to_string:
439 * @container: a #GESMetaContainer
441 * Serializes a meta container to a string.
443 * Returns: (nullable): a newly-allocated string, or NULL in case of an error.
444 * The string must be freed with g_free() when no longer needed.
447 ges_meta_container_metas_to_string (GESMetaContainer * container)
449 GstStructure *structure;
451 g_return_val_if_fail (GES_IS_META_CONTAINER (container), NULL);
453 structure = _meta_container_get_structure (container);
455 return gst_structure_to_string (structure);
459 * ges_meta_container_add_metas_from_string:
460 * @container: Target container
461 * @str: a string created with ges_meta_container_metas_to_string()
463 * Deserializes a meta container.
465 * Returns: TRUE on success, FALSE if there was an error.
468 ges_meta_container_add_metas_from_string (GESMetaContainer * container,
471 GstStructure *n_structure;
473 g_return_val_if_fail (GES_IS_META_CONTAINER (container), FALSE);
475 n_structure = gst_structure_from_string (str, NULL);
476 if (n_structure == NULL) {
477 GST_WARNING_OBJECT (container, "Could not add metas: %s", str);
481 gst_structure_foreach (n_structure, (GstStructureForeachFunc) _append_foreach,
484 gst_structure_free (n_structure);
488 #define CREATE_REGISTER_STATIC(name, value_ctype, value_gtype, setter_name) \
490 ges_meta_container_register_meta_ ## name (GESMetaContainer *container,\
491 GESMetaFlag flags, const gchar *meta_item, value_ctype value) \
494 GValue gval = { 0 }; \
496 g_return_val_if_fail (GES_IS_META_CONTAINER (container), FALSE); \
497 g_return_val_if_fail (meta_item != NULL, FALSE); \
499 if (!_register_meta (container, flags, meta_item, value_gtype)) \
502 g_value_init (&gval, value_gtype); \
503 g_value_set_ ##setter_name (&gval, value); \
505 ret = _set_value (container, meta_item, &gval); \
507 g_value_unset (&gval); \
512 * ges_meta_container_register_meta_boolean:
513 * @container: Target container
514 * @flags: The #GESMetaFlag to be used
515 * @meta_item: Name of the meta item to set
516 * @value: Value to set
518 * Sets a static meta on @container. This method lets you define static
519 * metadatas, which means that the type of the registered will be the only
520 * type accepted for this meta on that particular @container.
522 * Return: %TRUE if the meta could be registered, %FALSE otherwise
524 CREATE_REGISTER_STATIC (boolean, gboolean, G_TYPE_BOOLEAN, boolean);
527 * ges_meta_container_register_meta_int:
528 * @container: Target container
529 * @flags: The #GESMetaFlag to be used
530 * @meta_item: Name of the meta item to set
531 * @value: Value to set
533 * Sets a static meta on @container. This method lets you define static
534 * metadatas, which means that the type of the registered will be the only
535 * type accepted for this meta on that particular @container.
537 * Return: %TRUE if the meta could be registered, %FALSE otherwise
539 CREATE_REGISTER_STATIC (int, gint, G_TYPE_INT, int);
542 * ges_meta_container_register_meta_uint:
543 * @container: Target container
544 * @flags: The #GESMetaFlag to be used
545 * @meta_item: Name of the meta item to set
546 * @value: Value to set
548 * Sets a static meta on @container. This method lets you define static
549 * metadatas, which means that the type of the registered will be the only
550 * type accepted for this meta on that particular @container.
552 * Return: %TRUE if the meta could be registered, %FALSE otherwise
554 CREATE_REGISTER_STATIC (uint, guint, G_TYPE_UINT, uint);
557 * ges_meta_container_register_meta_int64:
558 * @container: Target container
559 * @flags: The #GESMetaFlag to be used
560 * @meta_item: Name of the meta item to set
561 * @value: Value to set
563 * Sets a static meta on @container. This method lets you define static
564 * metadatas, which means that the type of the registered will be the only
565 * type accepted for this meta on that particular @container.
567 * Return: %TRUE if the meta could be registered, %FALSE otherwise
569 CREATE_REGISTER_STATIC (int64, gint64, G_TYPE_INT64, int64);
572 * ges_meta_container_register_meta_uint64:
573 * @container: Target container
574 * @flags: The #GESMetaFlag to be used
575 * @meta_item: Name of the meta item to set
576 * @value: Value to set
578 * Sets a static meta on @container. This method lets you define static
579 * metadatas, which means that the type of the registered will be the only
580 * type accepted for this meta on that particular @container.
582 * Return: %TRUE if the meta could be registered, %FALSE otherwise
584 CREATE_REGISTER_STATIC (uint64, guint64, G_TYPE_UINT64, uint64);
587 * ges_meta_container_register_meta_float:
588 * @container: Target container
589 * @flags: The #GESMetaFlag to be used
590 * @meta_item: Name of the meta item to set
591 * @value: Value to set
593 * Sets a static meta on @container. This method lets you define static
594 * metadatas, which means that the type of the registered will be the only
595 * type accepted for this meta on that particular @container.
597 * Return: %TRUE if the meta could be registered, %FALSE otherwise
599 CREATE_REGISTER_STATIC (float, float, G_TYPE_FLOAT, float);
602 * ges_meta_container_register_meta_double:
603 * @container: Target container
604 * @flags: The #GESMetaFlag to be used
605 * @meta_item: Name of the meta item to set
606 * @value: Value to set
608 * Sets a static meta on @container. This method lets you define static
609 * metadatas, which means that the type of the registered will be the only
610 * type accepted for this meta on that particular @container.
612 * Return: %TRUE if the meta could be registered, %FALSE otherwise
614 CREATE_REGISTER_STATIC (double, double, G_TYPE_DOUBLE, double);
617 * ges_meta_container_register_meta_date:
618 * @container: Target container
619 * @flags: The #GESMetaFlag to be used
620 * @meta_item: Name of the meta item to set
621 * @value: (allow-none): Value to set
623 * Sets a static meta on @container. This method lets you define static
624 * metadatas, which means that the type of the registered will be the only
625 * type accepted for this meta on that particular @container.
627 * Return: %TRUE if the meta could be registered, %FALSE otherwise
629 CREATE_REGISTER_STATIC (date, const GDate *, G_TYPE_DATE, boxed);
632 * ges_meta_container_register_meta_date_time:
633 * @container: Target container
634 * @flags: The #GESMetaFlag to be used
635 * @meta_item: Name of the meta item to set
636 * @value: (allow-none): Value to set
638 * Sets a static meta on @container. This method lets you define static
639 * metadatas, which means that the type of the registered will be the only
640 * type accepted for this meta on that particular @container.
642 * Return: %TRUE if the meta could be registered, %FALSE otherwise
644 CREATE_REGISTER_STATIC (date_time, const GstDateTime *, GST_TYPE_DATE_TIME,
648 * ges_meta_container_register_meta_string:
649 * @container: Target container
650 * @flags: The #GESMetaFlag to be used
651 * @meta_item: Name of the meta item to set
652 * @value: (allow-none): Value to set
654 * Sets a static meta on @container. This method lets you define static
655 * metadatas, which means that the type of the registered will be the only
656 * type accepted for this meta on that particular @container.
658 * Return: %TRUE if the meta could be registered, %FALSE otherwise
660 CREATE_REGISTER_STATIC (string, const gchar *, G_TYPE_STRING, string);
663 * ges_meta_container_register_meta:
664 * @container: Target container
665 * @flags: The #GESMetaFlag to be used
666 * @meta_item: Name of the meta item to set
667 * @value: Value to set
669 * Sets a static meta on @container. This method lets you define static
670 * metadatas, which means that the type of the registered will be the only
671 * type accepted for this meta on that particular @container.
673 * Return: %TRUE if the static meta could be added, %FALSE otherwise
676 ges_meta_container_register_meta (GESMetaContainer * container,
677 GESMetaFlag flags, const gchar * meta_item, const GValue * value)
679 g_return_val_if_fail (GES_IS_META_CONTAINER (container), FALSE);
680 g_return_val_if_fail (meta_item != NULL, FALSE);
682 if (!_register_meta (container, flags, meta_item, G_VALUE_TYPE (value)))
685 return _set_value (container, meta_item, value);
689 ges_meta_container_check_meta_registered (GESMetaContainer * container,
690 const gchar * meta_item, GESMetaFlag * flags, GType * type)
693 RegisteredMeta *static_item;
695 data = g_object_get_qdata (G_OBJECT (container), ges_meta_key);
699 static_item = g_hash_table_lookup (data->static_items, meta_item);
700 if (static_item == NULL) {
701 GST_WARNING_OBJECT (container, "Static meta %s has not been registered yet",
708 *type = static_item->item_type;
711 *flags = static_item->flags;
716 /* Copied from gsttaglist.c */
717 /***** evil macros to get all the *_get_* functions right *****/
719 #define CREATE_GETTER(name,type) \
721 ges_meta_container_get_ ## name (GESMetaContainer *container, \
722 const gchar *meta_item, type value) \
724 GstStructure *structure; \
726 g_return_val_if_fail (GES_IS_META_CONTAINER (container), FALSE); \
727 g_return_val_if_fail (meta_item != NULL, FALSE); \
728 g_return_val_if_fail (value != NULL, FALSE); \
730 structure = _meta_container_get_structure (container); \
732 return gst_structure_get_ ## name (structure, meta_item, value); \
736 * ges_meta_container_get_boolean:
737 * @container: Target container
738 * @meta_item: Name of the meta item to get
739 * @dest: (out): Destination to which value of meta item will be copied
741 * Gets the value of a given meta item, returns NULL if @meta_item
744 CREATE_GETTER (boolean, gboolean *);
747 * ges_meta_container_get_int:
748 * @container: Target container
749 * @meta_item: Name of the meta item to get
750 * @dest: (out): Destination to which value of meta item will be copied
752 * Gets the value of a given meta item, returns NULL if @meta_item
755 CREATE_GETTER (int, gint *);
758 * ges_meta_container_get_uint:
759 * @container: Target container
760 * @meta_item: Name of the meta item to get
761 * @dest: (out): Destination to which value of meta item will be copied
763 * Gets the value of a given meta item, returns NULL if @meta_item
766 CREATE_GETTER (uint, guint *);
769 * ges_meta_container_get_double:
770 * @container: Target container
771 * @meta_item: Name of the meta item to get
772 * @dest: (out): Destination to which value of meta item will be copied
774 * Gets the value of a given meta item, returns NULL if @meta_item
777 CREATE_GETTER (double, gdouble *);
780 * ges_meta_container_get_int64:
781 * @container: Target container
782 * @meta_item: Name of the meta item to get
783 * @dest: (out): Destination to which value of meta item will be copied
785 * Gets the value of a given meta item, returns %FALSE if @meta_item
789 ges_meta_container_get_int64 (GESMetaContainer * container,
790 const gchar * meta_item, gint64 * dest)
792 GstStructure *structure;
795 g_return_val_if_fail (GES_IS_META_CONTAINER (container), FALSE);
796 g_return_val_if_fail (meta_item != NULL, FALSE);
797 g_return_val_if_fail (dest != NULL, FALSE);
799 structure = _meta_container_get_structure (container);
801 value = gst_structure_get_value (structure, meta_item);
802 if (!value || G_VALUE_TYPE (value) != G_TYPE_INT64)
805 *dest = g_value_get_int64 (value);
811 * ges_meta_container_get_uint64:
812 * @container: Target container
813 * @meta_item: Name of the meta item to get
814 * @dest: (out): Destination to which value of meta item will be copied
816 * Gets the value of a given meta item, returns %FALSE if @meta_item
820 ges_meta_container_get_uint64 (GESMetaContainer * container,
821 const gchar * meta_item, guint64 * dest)
823 GstStructure *structure;
826 g_return_val_if_fail (GES_IS_META_CONTAINER (container), FALSE);
827 g_return_val_if_fail (meta_item != NULL, FALSE);
828 g_return_val_if_fail (dest != NULL, FALSE);
830 structure = _meta_container_get_structure (container);
832 value = gst_structure_get_value (structure, meta_item);
833 if (!value || G_VALUE_TYPE (value) != G_TYPE_UINT64)
836 *dest = g_value_get_uint64 (value);
842 * ges_meta_container_get_float:
843 * @container: Target container
844 * @meta_item: Name of the meta item to get
845 * @dest: (out): Destination to which value of meta item will be copied
847 * Gets the value of a given meta item, returns %FALSE if @meta_item
851 ges_meta_container_get_float (GESMetaContainer * container,
852 const gchar * meta_item, gfloat * dest)
854 GstStructure *structure;
857 g_return_val_if_fail (GES_IS_META_CONTAINER (container), FALSE);
858 g_return_val_if_fail (meta_item != NULL, FALSE);
859 g_return_val_if_fail (dest != NULL, FALSE);
861 structure = _meta_container_get_structure (container);
863 value = gst_structure_get_value (structure, meta_item);
864 if (!value || G_VALUE_TYPE (value) != G_TYPE_FLOAT)
867 *dest = g_value_get_float (value);
873 * ges_meta_container_get_string:
874 * @container: Target container
875 * @meta_item: Name of the meta item to get
877 * Gets the value of a given meta item, returns NULL if @meta_item
881 ges_meta_container_get_string (GESMetaContainer * container,
882 const gchar * meta_item)
884 GstStructure *structure;
886 g_return_val_if_fail (GES_IS_META_CONTAINER (container), FALSE);
887 g_return_val_if_fail (meta_item != NULL, FALSE);
889 structure = _meta_container_get_structure (container);
891 return gst_structure_get_string (structure, meta_item);
895 * ges_meta_container_get_meta:
896 * @container: Target container
897 * @key: The key name of the meta to retrieve
899 * Gets the value of a given meta item, returns NULL if @key
902 * Returns: the #GValue corresponding to the meta with the given @key.
905 ges_meta_container_get_meta (GESMetaContainer * container, const gchar * key)
907 GstStructure *structure;
909 g_return_val_if_fail (GES_IS_META_CONTAINER (container), FALSE);
910 g_return_val_if_fail (key != NULL, FALSE);
912 structure = _meta_container_get_structure (container);
914 return gst_structure_get_value (structure, key);
918 * ges_meta_container_get_date:
919 * @container: Target container
920 * @meta_item: Name of the meta item to get
921 * @dest: (out): Destination to which value of meta item will be copied
923 * Gets the value of a given meta item, returns NULL if @meta_item
926 CREATE_GETTER (date, GDate **);
929 * ges_meta_container_get_date_time:
930 * @container: Target container
931 * @meta_item: Name of the meta item to get
932 * @dest: (out): Destination to which value of meta item will be copied
934 * Gets the value of a given meta item, returns NULL if @meta_item
937 CREATE_GETTER (date_time, GstDateTime **);