API: Add GST_TAG_ATTACHMENT for generic file attachments to streams.

Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gsttaglist.c: (_gst_tag_initialize):
* gst/gsttaglist.h:
API: Add GST_TAG_ATTACHMENT for generic file attachments to streams.
Fixes bug #538568.
This commit is contained in:
Sebastian Dröge 2008-06-20 08:39:54 +00:00
parent 8d6056b7b1
commit 3ee5b33c7e
4 changed files with 38 additions and 0 deletions

View file

@ -1,3 +1,11 @@
2008-06-20 Sebastian Dröge <slomo@circular-chaos.org>
* docs/gst/gstreamer-sections.txt:
* gst/gsttaglist.c: (_gst_tag_initialize):
* gst/gsttaglist.h:
API: Add GST_TAG_ATTACHMENT for generic file attachments to streams.
Fixes bug #538568.
2008-06-20 Stefan Kost <ensonic@users.sf.net> 2008-06-20 Stefan Kost <ensonic@users.sf.net>
* libs/gst/controller/gstcontroller.c: * libs/gst/controller/gstcontroller.c:

View file

@ -2000,6 +2000,7 @@ GST_TAG_REFERENCE_LEVEL
GST_TAG_LANGUAGE_CODE GST_TAG_LANGUAGE_CODE
GST_TAG_IMAGE GST_TAG_IMAGE
GST_TAG_PREVIEW_IMAGE GST_TAG_PREVIEW_IMAGE
GST_TAG_ATTACHMENT
GST_TAG_BEATS_PER_MINUTE GST_TAG_BEATS_PER_MINUTE
gst_tag_register gst_tag_register

View file

@ -62,7 +62,9 @@ GstTagInfo;
#define TAGLIST "taglist" #define TAGLIST "taglist"
static GQuark gst_tag_list_quark; static GQuark gst_tag_list_quark;
static GMutex *__tag_mutex; static GMutex *__tag_mutex;
static GHashTable *__tags; static GHashTable *__tags;
#define TAG_LOCK g_mutex_lock (__tag_mutex) #define TAG_LOCK g_mutex_lock (__tag_mutex)
@ -238,6 +240,9 @@ _gst_tag_initialize (void)
_("image"), _("image related to this stream"), gst_tag_merge_use_first); _("image"), _("image related to this stream"), gst_tag_merge_use_first);
gst_tag_register (GST_TAG_PREVIEW_IMAGE, GST_TAG_FLAG_META, GST_TYPE_BUFFER, gst_tag_register (GST_TAG_PREVIEW_IMAGE, GST_TAG_FLAG_META, GST_TYPE_BUFFER,
_("preview image"), _("preview image related to this stream"), NULL); _("preview image"), _("preview image related to this stream"), NULL);
gst_tag_register (GST_TAG_ATTACHMENT, GST_TAG_FLAG_META, GST_TYPE_BUFFER,
_("attachment"), _("file attached to this stream"),
gst_tag_merge_use_first);
gst_tag_register (GST_TAG_BEATS_PER_MINUTE, GST_TAG_FLAG_META, G_TYPE_DOUBLE, gst_tag_register (GST_TAG_BEATS_PER_MINUTE, GST_TAG_FLAG_META, G_TYPE_DOUBLE,
_("beats per minute"), _("number of beats per minute in audio"), NULL); _("beats per minute"), _("number of beats per minute in audio"), NULL);
@ -273,6 +278,7 @@ void
gst_tag_merge_strings_with_comma (GValue * dest, const GValue * src) gst_tag_merge_strings_with_comma (GValue * dest, const GValue * src)
{ {
GString *str; GString *str;
gint i, count; gint i, count;
count = gst_value_list_get_size (src); count = gst_value_list_get_size (src);
@ -289,6 +295,7 @@ gst_tag_merge_strings_with_comma (GValue * dest, const GValue * src)
g_value_take_string (dest, str->str); g_value_take_string (dest, str->str);
g_string_free (str, FALSE); g_string_free (str, FALSE);
} }
static GstTagInfo * static GstTagInfo *
gst_tag_lookup (GQuark entry) gst_tag_lookup (GQuark entry)
{ {
@ -337,6 +344,7 @@ gst_tag_register (const gchar * name, GstTagFlag flag, GType type,
const gchar * nick, const gchar * blurb, GstTagMergeFunc func) const gchar * nick, const gchar * blurb, GstTagMergeFunc func)
{ {
GQuark key; GQuark key;
GstTagInfo *info; GstTagInfo *info;
g_return_if_fail (name != NULL); g_return_if_fail (name != NULL);
@ -532,17 +540,20 @@ gst_is_tag_list (gconstpointer p)
return (GST_IS_STRUCTURE (s) && s->name == gst_tag_list_quark); return (GST_IS_STRUCTURE (s) && s->name == gst_tag_list_quark);
} }
typedef struct typedef struct
{ {
GstStructure *list; GstStructure *list;
GstTagMergeMode mode; GstTagMergeMode mode;
} }
GstTagCopyData; GstTagCopyData;
static void static void
gst_tag_list_add_value_internal (GstStructure * list, GstTagMergeMode mode, gst_tag_list_add_value_internal (GstStructure * list, GstTagMergeMode mode,
GQuark tag, const GValue * value) GQuark tag, const GValue * value)
{ {
GstTagInfo *info = gst_tag_lookup (tag); GstTagInfo *info = gst_tag_lookup (tag);
const GValue *value2; const GValue *value2;
g_assert (info != NULL); g_assert (info != NULL);
@ -593,6 +604,7 @@ gst_tag_list_add_value_internal (GstStructure * list, GstTagMergeMode mode,
} }
} }
} }
static gboolean static gboolean
gst_tag_list_copy_foreach (GQuark tag, const GValue * value, gpointer user_data) gst_tag_list_copy_foreach (GQuark tag, const GValue * value, gpointer user_data)
{ {
@ -780,7 +792,9 @@ gst_tag_list_add_valist (GstTagList * list, GstTagMergeMode mode,
const gchar * tag, va_list var_args) const gchar * tag, va_list var_args)
{ {
GstTagInfo *info; GstTagInfo *info;
GQuark quark; GQuark quark;
gchar *error = NULL; gchar *error = NULL;
g_return_if_fail (GST_IS_TAG_LIST (list)); g_return_if_fail (GST_IS_TAG_LIST (list));
@ -825,6 +839,7 @@ gst_tag_list_add_valist_values (GstTagList * list, GstTagMergeMode mode,
const gchar * tag, va_list var_args) const gchar * tag, va_list var_args)
{ {
GstTagInfo *info; GstTagInfo *info;
GQuark quark; GQuark quark;
g_return_if_fail (GST_IS_TAG_LIST (list)); g_return_if_fail (GST_IS_TAG_LIST (list));
@ -856,6 +871,7 @@ gst_tag_list_remove_tag (GstTagList * list, const gchar * tag)
gst_structure_remove_field ((GstStructure *) list, tag); gst_structure_remove_field ((GstStructure *) list, tag);
} }
typedef struct typedef struct
{ {
GstTagForeachFunc func; GstTagForeachFunc func;
@ -863,6 +879,7 @@ typedef struct
gpointer data; gpointer data;
} }
TagForeachData; TagForeachData;
static int static int
structure_foreach_wrapper (GQuark field_id, const GValue * value, structure_foreach_wrapper (GQuark field_id, const GValue * value,
gpointer user_data) gpointer user_data)

View file

@ -653,6 +653,18 @@ gboolean gst_tag_list_get_date_index (const GstTagList * list,
* Since: 0.10.7 * Since: 0.10.7
*/ */
#define GST_TAG_PREVIEW_IMAGE "preview-image" #define GST_TAG_PREVIEW_IMAGE "preview-image"
/**
* GST_TAG_ATTACHMENT:
*
* generic file attachment (buffer) (buffer caps should specify the content
* type and if possible set "filename" to the file name of the
* attachment)
*
* Since: 0.10.21
*/
#define GST_TAG_ATTACHMENT "attachment"
/** /**
* GST_TAG_BEATS_PER_MINUTE: * GST_TAG_BEATS_PER_MINUTE:
* *