mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
taglist: Add datetime get functions
Adds _date_time_get and _date_time_get_index functions to taglist. API: gst_tag_list_get_date_time API: gst_tag_list_get_date_time_index Fixes #594504
This commit is contained in:
parent
b4870282cb
commit
3449bfc30e
4 changed files with 77 additions and 0 deletions
|
@ -2268,6 +2268,8 @@ gst_tag_list_get_pointer
|
|||
gst_tag_list_get_pointer_index
|
||||
gst_tag_list_get_date
|
||||
gst_tag_list_get_date_index
|
||||
gst_tag_list_get_date_time
|
||||
gst_tag_list_get_date_time_index
|
||||
gst_tag_list_get_buffer
|
||||
gst_tag_list_get_buffer_index
|
||||
<SUBSECTION Standard>
|
||||
|
|
|
@ -1701,6 +1701,71 @@ gst_tag_list_get_date_index (const GstTagList * list,
|
|||
return (*value != NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_tag_list_get_date_time:
|
||||
* @list: a #GstTagList to get the tag from
|
||||
* @tag: tag to read out
|
||||
* @value: address of a #GstDateTime pointer variable to store the result into
|
||||
*
|
||||
* Copies the first datetime for the given tag in the taglist into the variable
|
||||
* pointed to by @value. Unref the date with gst_date_time_unref() when
|
||||
* it is no longer needed.
|
||||
*
|
||||
* Returns: TRUE, if a datetime was copied, FALSE if the tag didn't exist in the
|
||||
* given list or if it was #NULL.
|
||||
* Since: 0.10.31
|
||||
*/
|
||||
gboolean
|
||||
gst_tag_list_get_date_time (const GstTagList * list, const gchar * tag,
|
||||
GstDateTime ** value)
|
||||
{
|
||||
GValue v = { 0, };
|
||||
|
||||
g_return_val_if_fail (GST_IS_TAG_LIST (list), FALSE);
|
||||
g_return_val_if_fail (tag != NULL, FALSE);
|
||||
g_return_val_if_fail (value != NULL, FALSE);
|
||||
|
||||
if (!gst_tag_list_copy_value (&v, list, tag))
|
||||
return FALSE;
|
||||
|
||||
g_return_val_if_fail (GST_VALUE_HOLDS_DATE_TIME (&v), FALSE);
|
||||
|
||||
*value = (GstDateTime *) g_value_dup_boxed (&v);
|
||||
g_value_unset (&v);
|
||||
return (*value != NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_tag_list_get_date_time_index:
|
||||
* @list: a #GstTagList to get the tag from
|
||||
* @tag: tag to read out
|
||||
* @index: number of entry to read out
|
||||
* @value: location for the result
|
||||
*
|
||||
* Gets the datetime that is at the given index for the given tag in the given
|
||||
* list and copies it into the variable pointed to by @value. Unref the datetime
|
||||
* with gst_date_time_unref() when it is no longer needed.
|
||||
*
|
||||
* Returns: TRUE, if a value was copied, FALSE if the tag didn't exist in the
|
||||
* given list or if it was #NULL.
|
||||
* Since: 0.10.31
|
||||
*/
|
||||
gboolean
|
||||
gst_tag_list_get_date_time_index (const GstTagList * list,
|
||||
const gchar * tag, guint index, GstDateTime ** value)
|
||||
{
|
||||
const GValue *v;
|
||||
|
||||
g_return_val_if_fail (GST_IS_TAG_LIST (list), FALSE);
|
||||
g_return_val_if_fail (tag != NULL, FALSE);
|
||||
g_return_val_if_fail (value != NULL, FALSE);
|
||||
|
||||
if ((v = gst_tag_list_get_value_index (list, tag, index)) == NULL)
|
||||
return FALSE;
|
||||
*value = (GstDateTime *) g_value_dup_boxed (v);
|
||||
return (*value != NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_tag_list_get_buffer:
|
||||
* @list: a #GstTagList to get the tag from
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#ifndef __GST_TAGLIST_H__
|
||||
#define __GST_TAGLIST_H__
|
||||
|
||||
#include <gst/gstdatetime.h>
|
||||
#include <gst/gstbuffer.h>
|
||||
#include <gst/gststructure.h>
|
||||
#include <gst/glib-compat.h>
|
||||
|
@ -363,6 +364,13 @@ gboolean gst_tag_list_get_date_index (const GstTagList * list,
|
|||
const gchar * tag,
|
||||
guint index,
|
||||
GDate ** value);
|
||||
gboolean gst_tag_list_get_date_time (const GstTagList * list,
|
||||
const gchar * tag,
|
||||
GstDateTime ** value);
|
||||
gboolean gst_tag_list_get_date_time_index (const GstTagList * list,
|
||||
const gchar * tag,
|
||||
guint index,
|
||||
GstDateTime ** value);
|
||||
gboolean gst_tag_list_get_buffer (const GstTagList * list,
|
||||
const gchar * tag,
|
||||
GstBuffer ** value);
|
||||
|
|
|
@ -980,6 +980,8 @@ EXPORTS
|
|||
gst_tag_list_get_char_index
|
||||
gst_tag_list_get_date
|
||||
gst_tag_list_get_date_index
|
||||
gst_tag_list_get_date_time
|
||||
gst_tag_list_get_date_time_index
|
||||
gst_tag_list_get_double
|
||||
gst_tag_list_get_double_index
|
||||
gst_tag_list_get_float
|
||||
|
|
Loading…
Reference in a new issue