2009-12-17 11:34:42 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2009 Wim Taymans <wim.taymans@gmail.be>
|
|
|
|
*
|
2011-02-25 12:15:25 +00:00
|
|
|
* gstmeta.h: Header for Metadata structures
|
2009-12-17 11:34:42 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-02-25 12:15:25 +00:00
|
|
|
#ifndef __GST_META_H__
|
|
|
|
#define __GST_META_H__
|
2009-12-17 11:34:42 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2011-02-25 12:15:25 +00:00
|
|
|
typedef struct _GstMeta GstMeta;
|
|
|
|
typedef struct _GstMetaInfo GstMetaInfo;
|
2009-12-17 11:34:42 +00:00
|
|
|
|
|
|
|
/**
|
2011-02-25 12:15:25 +00:00
|
|
|
* GstMeta:
|
|
|
|
* @info: pointer to the #GstMetaInfo
|
2009-12-17 11:34:42 +00:00
|
|
|
*
|
2011-02-25 12:15:25 +00:00
|
|
|
* Base structure for metadata. Custom metadata will put this structure
|
2009-12-17 11:34:42 +00:00
|
|
|
* as the first member of their structure.
|
|
|
|
*/
|
2011-02-25 12:15:25 +00:00
|
|
|
struct _GstMeta {
|
|
|
|
const GstMetaInfo *info;
|
2009-12-17 11:34:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2011-02-25 12:15:25 +00:00
|
|
|
* GST_META_TRACE_NAME:
|
2009-12-17 11:34:42 +00:00
|
|
|
*
|
|
|
|
* The name used for tracing memory allocations.
|
|
|
|
*/
|
2011-02-25 12:15:25 +00:00
|
|
|
#define GST_META_TRACE_NAME "GstMeta"
|
2009-12-17 11:34:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GstMetaInitFunction:
|
|
|
|
* @meta: a #GstMeta
|
|
|
|
* @buffer: a #GstBuffer
|
|
|
|
*
|
|
|
|
* Function called when @meta is initialized in @buffer.
|
|
|
|
*/
|
2011-02-27 18:40:45 +00:00
|
|
|
typedef gboolean (*GstMetaInitFunction) (GstMeta *meta, gpointer params, GstBuffer *buffer);
|
2009-12-17 11:34:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GstMetaFreeFunction:
|
|
|
|
* @meta: a #GstMeta
|
|
|
|
* @buffer: a #GstBuffer
|
|
|
|
*
|
|
|
|
* Function called when @meta is freed in @buffer.
|
|
|
|
*/
|
2011-02-25 12:15:25 +00:00
|
|
|
typedef void (*GstMetaFreeFunction) (GstMeta *meta, GstBuffer *buffer);
|
2009-12-17 11:34:42 +00:00
|
|
|
|
2011-03-24 20:18:52 +00:00
|
|
|
typedef void (*GstMetaCopyFunction) (GstBuffer *dest, GstMeta *meta,
|
|
|
|
GstBuffer *buffer, gsize offset, gsize size);
|
2011-03-08 16:58:49 +00:00
|
|
|
/**
|
|
|
|
* GstMetaTransformFunction:
|
|
|
|
* @transbuf: a #GstBuffer
|
2009-12-17 11:34:42 +00:00
|
|
|
* @meta: a #GstMeta
|
|
|
|
* @buffer: a #GstBuffer
|
2011-03-08 16:58:49 +00:00
|
|
|
* @data: transform specific data.
|
|
|
|
*
|
|
|
|
* Function called for each @meta in @buffer as a result of performing a
|
|
|
|
* transformation on @transbuf. Additional type specific transform data
|
|
|
|
* is passed to the function.
|
|
|
|
*
|
|
|
|
* Implementations should check the type of the transform @data and parse
|
|
|
|
* additional type specific field that should be used to perform the transform.
|
2009-12-17 11:34:42 +00:00
|
|
|
*/
|
2011-03-08 16:58:49 +00:00
|
|
|
typedef void (*GstMetaTransformFunction) (GstBuffer *transbuf, GstMeta *meta,
|
2011-03-24 20:18:52 +00:00
|
|
|
GstBuffer *buffer, gpointer data);
|
2009-12-17 11:34:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GstMetaSerializeFunction:
|
|
|
|
* @meta: a #GstMeta
|
|
|
|
*/
|
2011-02-25 12:15:25 +00:00
|
|
|
typedef gchar * (*GstMetaSerializeFunction) (GstMeta *meta);
|
2009-12-17 11:34:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GstMetaDeserializeFunction:
|
|
|
|
* @meta: a #GstMeta
|
|
|
|
*/
|
2011-02-25 12:15:25 +00:00
|
|
|
typedef gboolean (*GstMetaDeserializeFunction) (GstMeta *meta,
|
2009-12-17 11:34:42 +00:00
|
|
|
const gchar *s);
|
|
|
|
|
|
|
|
/**
|
2011-02-25 12:15:25 +00:00
|
|
|
* GstMetaInfo:
|
|
|
|
* @api: tag indentifying the metadata structure and api
|
|
|
|
* @impl: tag indentifying the implementor of the api
|
2009-12-17 11:34:42 +00:00
|
|
|
* @size: size of the metadata
|
|
|
|
* @init_func: function for initializing the metadata
|
|
|
|
* @free_func: function for freeing the metadata
|
2011-03-24 20:18:52 +00:00
|
|
|
* @copy_func: function for copying the metadata
|
2011-03-08 18:18:24 +00:00
|
|
|
* @transform_func: function for transforming the metadata
|
2009-12-17 11:34:42 +00:00
|
|
|
* @serialize_func: function for serializing
|
|
|
|
* @deserialize_func: function for deserializing
|
|
|
|
*
|
2011-02-25 12:15:25 +00:00
|
|
|
* The #GstMetaInfo provides information about a specific metadata
|
2009-12-17 11:34:42 +00:00
|
|
|
* structure.
|
|
|
|
*/
|
2011-02-25 12:15:25 +00:00
|
|
|
struct _GstMetaInfo {
|
|
|
|
GQuark api;
|
|
|
|
GQuark impl;
|
2009-12-17 11:34:42 +00:00
|
|
|
gsize size;
|
|
|
|
|
|
|
|
GstMetaInitFunction init_func;
|
|
|
|
GstMetaFreeFunction free_func;
|
2011-03-24 20:18:52 +00:00
|
|
|
GstMetaCopyFunction copy_func;
|
2011-03-08 16:58:49 +00:00
|
|
|
GstMetaTransformFunction transform_func;
|
2009-12-17 11:34:42 +00:00
|
|
|
GstMetaSerializeFunction serialize_func;
|
|
|
|
GstMetaDeserializeFunction deserialize_func;
|
|
|
|
};
|
|
|
|
|
2011-02-25 12:15:25 +00:00
|
|
|
void _gst_meta_init (void);
|
2009-12-17 11:34:42 +00:00
|
|
|
|
2011-02-25 12:15:25 +00:00
|
|
|
const GstMetaInfo * gst_meta_register (const gchar *api, const gchar *impl,
|
|
|
|
gsize size,
|
|
|
|
GstMetaInitFunction init_func,
|
|
|
|
GstMetaFreeFunction free_func,
|
2011-03-24 20:18:52 +00:00
|
|
|
GstMetaCopyFunction copy_func,
|
2011-03-08 16:58:49 +00:00
|
|
|
GstMetaTransformFunction transform_func,
|
2011-02-25 12:15:25 +00:00
|
|
|
GstMetaSerializeFunction serialize_func,
|
|
|
|
GstMetaDeserializeFunction deserialize_func);
|
|
|
|
const GstMetaInfo * gst_meta_get_info (const gchar * impl);
|
2009-12-17 11:34:42 +00:00
|
|
|
|
2011-02-27 18:40:45 +00:00
|
|
|
/* default metadata */
|
|
|
|
|
2011-02-28 09:05:47 +00:00
|
|
|
/* timing metadata */
|
|
|
|
typedef struct _GstMetaTiming GstMetaTiming;
|
|
|
|
|
|
|
|
const GstMetaInfo *gst_meta_timing_get_info(void);
|
|
|
|
#define GST_META_TIMING_INFO (gst_meta_timing_get_info())
|
|
|
|
|
|
|
|
struct _GstMetaTiming {
|
|
|
|
GstMeta meta; /* common meta header */
|
|
|
|
|
|
|
|
GstClockTime dts; /* decoding timestamp */
|
|
|
|
GstClockTime pts; /* presentation timestamp */
|
|
|
|
GstClockTime duration; /* duration of the data */
|
|
|
|
GstClockTime clock_rate; /* clock rate for the above values */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define gst_buffer_get_meta_timing(b) ((GstMetaTiming*)gst_buffer_get_meta((b),GST_META_TIMING_INFO))
|
|
|
|
#define gst_buffer_add_meta_timing(b) ((GstMetaTiming*)gst_buffer_add_meta((b),GST_META_TIMING_INFO,NULL))
|
2011-02-27 19:42:15 +00:00
|
|
|
|
2009-12-17 11:34:42 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
2011-02-25 12:15:25 +00:00
|
|
|
#endif /* __GST_META_H__ */
|