mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
Small fixes in get_range and better structure for generic muxer and demuxer.
Original commit message from CVS: Small fixes in get_range and better structure for generic muxer and demuxer.
This commit is contained in:
parent
307925e307
commit
c1e6c76cdb
17 changed files with 2036 additions and 215 deletions
29
ChangeLog
29
ChangeLog
|
@ -1,3 +1,32 @@
|
|||
2007-11-28 Edgard Lima <edgard.lima@indt.org.br>
|
||||
|
||||
* ext/metadata/Makefile.am:
|
||||
* ext/metadata/gstmetadata.c:
|
||||
* ext/metadata/gstmetadatamux.c:
|
||||
* ext/metadata/gstmetadatamux.h:
|
||||
* ext/metadata/gstmetadataparse.c:
|
||||
* ext/metadata/gstmetadataparse.h:
|
||||
* ext/metadata/metadata.c:
|
||||
* ext/metadata/metadata.h:
|
||||
* ext/metadata/metadataexif.c:
|
||||
* ext/metadata/metadataexif.h:
|
||||
* ext/metadata/metadataiptc.c:
|
||||
* ext/metadata/metadataiptc.h:
|
||||
* ext/metadata/metadataparse.c:
|
||||
* ext/metadata/metadataparse.h:
|
||||
* ext/metadata/metadataparseexif.c:
|
||||
* ext/metadata/metadataparseexif.h:
|
||||
* ext/metadata/metadataparseiptc.c:
|
||||
* ext/metadata/metadataparseiptc.h:
|
||||
* ext/metadata/metadataparsexmp.c:
|
||||
* ext/metadata/metadataparsexmp.h:
|
||||
* ext/metadata/metadatatags.c:
|
||||
* ext/metadata/metadatatags.h:
|
||||
* ext/metadata/metadataxmp.c:
|
||||
* ext/metadata/metadataxmp.h:
|
||||
Small fixes in get_range and better structure for generic muxer and
|
||||
demuxer.
|
||||
|
||||
2007-11-26 Julien Moutte <julien@fluendo.com>
|
||||
|
||||
* configure.ac: Add QuickTime Wrapper plug-in.
|
||||
|
|
|
@ -2,28 +2,30 @@ plugin_LTLIBRARIES = libgstmetadata.la
|
|||
|
||||
libgstmetadata_la_SOURCES = gstmetadata.c \
|
||||
gstmetadataparse.c \
|
||||
metadataparse.c \
|
||||
metadata.c \
|
||||
metadataparsejpeg.c \
|
||||
metadataparsepng.c \
|
||||
metadataparseexif.c \
|
||||
metadataparseiptc.c \
|
||||
metadataparsexmp.c \
|
||||
metadataexif.c \
|
||||
metadataiptc.c \
|
||||
metadataxmp.c \
|
||||
metadataparseutil.c \
|
||||
metadatatypes.c \
|
||||
gstmetadatamux.c
|
||||
gstmetadatamux.c \
|
||||
metadatatags.c
|
||||
|
||||
libgstmetadata_la_CFLAGS = $(METADATA_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS)
|
||||
libgstmetadata_la_LIBADD = $(METADATA_LIBS) -lgsttag-@GST_MAJORMINOR@ $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS)
|
||||
libgstmetadata_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||
|
||||
noinst_HEADERS = gstmetadataparse.h \
|
||||
metadataparse.h \
|
||||
metadata.h \
|
||||
metadataparsejpeg.h \
|
||||
metadataparsepng.h \
|
||||
metadataparseexif.h \
|
||||
metadataparseiptc.h \
|
||||
metadataparsexmp.h \
|
||||
metadataexif.h \
|
||||
metadataiptc.h \
|
||||
metadataxmp.h \
|
||||
metadataparseutil.h \
|
||||
metadatatypes.h \
|
||||
gstmetadatamux.h
|
||||
gstmetadatamux.h \
|
||||
metadatatags.h
|
||||
|
||||
|
|
|
@ -47,15 +47,30 @@
|
|||
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include "metadatatags.h"
|
||||
|
||||
extern gboolean gst_metadata_parse_plugin_init (GstPlugin * plugin);
|
||||
extern gboolean gst_metadata_mux_plugin_init (GstPlugin * plugin);
|
||||
|
||||
GST_DEBUG_CATEGORY_EXTERN (gst_metadata_exif_debug);
|
||||
GST_DEBUG_CATEGORY_EXTERN (gst_metadata_iptc_debug);
|
||||
GST_DEBUG_CATEGORY_EXTERN (gst_metadata_xmp_debug);
|
||||
|
||||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
|
||||
gboolean ret = TRUE;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_metadata_exif_debug, "metadata_exif",
|
||||
0, "Metadata exif");
|
||||
GST_DEBUG_CATEGORY_INIT (gst_metadata_iptc_debug, "metadata_iptc",
|
||||
0, "Metadata iptc");
|
||||
GST_DEBUG_CATEGORY_INIT (gst_metadata_xmp_debug, "metadata_xmp", 0,
|
||||
"Metadata xmp");
|
||||
|
||||
metadata_tags_register ();
|
||||
|
||||
ret = gst_metadata_parse_plugin_init (plugin);
|
||||
|
||||
ret = ret && gst_metadata_mux_plugin_init (plugin);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -46,8 +46,9 @@
|
|||
|
||||
#include <gst/gst.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
#include "metadata.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
/* #defines don't like whitespacey bits */
|
||||
#define GST_TYPE_METADATA_MUX \
|
||||
(gst_metadata_mux_get_type())
|
||||
|
@ -55,29 +56,61 @@ G_BEGIN_DECLS
|
|||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_METADATA_MUX,GstMetadataMux))
|
||||
#define GST_METADATA_MUX_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_METADATA_MUX,GstMetadataMuxClass))
|
||||
#define GST_IS_METADATAMUX(obj) \
|
||||
#define GST_IS_METADATA_MUX(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_METADATA_MUX))
|
||||
#define GST_IS_METADATAMUX_CLASS(klass) \
|
||||
#define GST_IS_METADATA_MUX_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_METADATA_MUX))
|
||||
|
||||
typedef struct _GstMetadataMux GstMetadataMux;
|
||||
typedef struct _GstMetadataMux GstMetadataMux;
|
||||
typedef struct _GstMetadataMuxClass GstMetadataMuxClass;
|
||||
|
||||
typedef enum _tag_MetadataState
|
||||
{
|
||||
MT_STATE_NULL, /* still need to check media type */
|
||||
MT_STATE_MUXED
|
||||
} MetadataState;
|
||||
|
||||
struct _GstMetadataMux
|
||||
{
|
||||
GstElement element;
|
||||
|
||||
GstPad *sinkpad, *srcpad;
|
||||
|
||||
gboolean exif;
|
||||
gboolean iptc;
|
||||
gboolean xmp;
|
||||
|
||||
gboolean need_send_tag;
|
||||
|
||||
GstTagList *taglist;
|
||||
MetaData mux_data;
|
||||
GstAdapter *adapter_parsing;
|
||||
GstAdapter *adapter_holding;
|
||||
guint32 next_offset;
|
||||
guint32 next_size;
|
||||
ImageType img_type;
|
||||
|
||||
gint64 offset_orig; /* offset in original stream */
|
||||
gint64 duration_orig; /* durarion of stream */
|
||||
gint64 offset; /* offset in current stream */
|
||||
gint64 duration; /* durarion of modified stream */
|
||||
|
||||
MetadataState state;
|
||||
|
||||
GstBuffer * prepend_buffer;
|
||||
GstBuffer * append_buffer;
|
||||
|
||||
gboolean need_more_data;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
struct _GstMetadataMuxClass
|
||||
struct _GstMetadataMuxClass
|
||||
{
|
||||
GstElementClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_metadata_mux_get_type (void);
|
||||
extern GType gst_metadata_mux_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_METADATA_MUX_H__ */
|
||||
|
|
|
@ -62,22 +62,17 @@
|
|||
|
||||
#include "gstmetadataparse.h"
|
||||
|
||||
#include "metadataexif.h"
|
||||
|
||||
#include "metadataparseexif.h"
|
||||
#include "metadataiptc.h"
|
||||
|
||||
#include "metadataparseiptc.h"
|
||||
|
||||
#include "metadataparsexmp.h"
|
||||
#include "metadataxmp.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_metadata_parse_debug);
|
||||
#define GST_CAT_DEFAULT gst_metadata_parse_debug
|
||||
|
||||
GST_DEBUG_CATEGORY_EXTERN (gst_metadata_parse_exif_debug);
|
||||
GST_DEBUG_CATEGORY_EXTERN (gst_metadata_parse_iptc_debug);
|
||||
GST_DEBUG_CATEGORY_EXTERN (gst_metadata_parse_xmp_debug);
|
||||
|
||||
#define GOTO_DONE_IF_NULL(ptr) do { if ( NULL == (ptr) ) goto done; } while(FALSE)
|
||||
#define GOTO_DONE_IF_NULL_AND_FAIL(ptr, ret) do { if ( NULL == (ptr) ) { (ret) = FALSE; goto done; } } while(FALSE)
|
||||
|
||||
|
@ -139,7 +134,7 @@ static GstFlowReturn gst_metadata_parse_chain (GstPad * pad, GstBuffer * buf);
|
|||
|
||||
static gboolean gst_metadata_parse_checkgetrange (GstPad * srcpad);
|
||||
|
||||
static gboolean
|
||||
static GstFlowReturn
|
||||
gst_metadata_parse_get_range (GstPad * pad, guint64 offset_orig, guint size,
|
||||
GstBuffer ** buf);
|
||||
|
||||
|
@ -300,21 +295,21 @@ gst_metadata_parse_set_property (GObject * object, guint prop_id,
|
|||
switch (prop_id) {
|
||||
case ARG_EXIF:
|
||||
if (g_value_get_boolean (value))
|
||||
set_parse_option (filter->parse_data, PARSE_OPT_EXIF);
|
||||
set_meta_option (filter->parse_data, META_OPT_EXIF);
|
||||
else
|
||||
unset_parse_option (filter->parse_data, PARSE_OPT_EXIF);
|
||||
unset_meta_option (filter->parse_data, META_OPT_EXIF);
|
||||
break;
|
||||
case ARG_IPTC:
|
||||
if (g_value_get_boolean (value))
|
||||
set_parse_option (filter->parse_data, PARSE_OPT_IPTC);
|
||||
set_meta_option (filter->parse_data, META_OPT_IPTC);
|
||||
else
|
||||
unset_parse_option (filter->parse_data, PARSE_OPT_IPTC);
|
||||
unset_meta_option (filter->parse_data, META_OPT_IPTC);
|
||||
break;
|
||||
case ARG_XMP:
|
||||
if (g_value_get_boolean (value))
|
||||
set_parse_option (filter->parse_data, PARSE_OPT_XMP);
|
||||
set_meta_option (filter->parse_data, META_OPT_XMP);
|
||||
else
|
||||
unset_parse_option (filter->parse_data, PARSE_OPT_XMP);
|
||||
unset_meta_option (filter->parse_data, META_OPT_XMP);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -331,15 +326,15 @@ gst_metadata_parse_get_property (GObject * object, guint prop_id,
|
|||
switch (prop_id) {
|
||||
case ARG_EXIF:
|
||||
g_value_set_boolean (value,
|
||||
PARSE_DATA_OPTION (filter->parse_data) & PARSE_OPT_EXIF);
|
||||
META_DATA_OPTION (filter->parse_data) & META_OPT_EXIF);
|
||||
break;
|
||||
case ARG_IPTC:
|
||||
g_value_set_boolean (value,
|
||||
PARSE_DATA_OPTION (filter->parse_data) & PARSE_OPT_IPTC);
|
||||
META_DATA_OPTION (filter->parse_data) & META_OPT_IPTC);
|
||||
break;
|
||||
case ARG_XMP:
|
||||
g_value_set_boolean (value,
|
||||
PARSE_DATA_OPTION (filter->parse_data) & PARSE_OPT_XMP);
|
||||
META_DATA_OPTION (filter->parse_data) & META_OPT_XMP);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -473,8 +468,11 @@ gst_metadata_parse_src_event (GstPad * pad, GstEvent * event)
|
|||
filter->prepend_buffer = NULL;
|
||||
}
|
||||
|
||||
/* FIXME: related to append */
|
||||
filter->offset = start;
|
||||
gst_metadata_parse_translate_pos_to_orig (filter, start, &start,
|
||||
&filter->prepend_buffer);
|
||||
filter->offset_orig = start;
|
||||
|
||||
if (stop_type == GST_SEEK_TYPE_CUR)
|
||||
stop = filter->offset + stop;
|
||||
|
@ -562,7 +560,7 @@ gst_metadata_parse_finalize (GObject * object)
|
|||
static void
|
||||
gst_metadata_parse_dispose_members (GstMetadataParse * filter)
|
||||
{
|
||||
metadataparse_dispose (&filter->parse_data);
|
||||
metadata_dispose (&filter->parse_data);
|
||||
|
||||
if (filter->adapter_parsing) {
|
||||
gst_object_unref (filter->adapter_parsing);
|
||||
|
@ -614,7 +612,7 @@ gst_metadata_parse_init_members (GstMetadataParse * filter)
|
|||
filter->append_buffer = NULL;
|
||||
filter->prepend_buffer = NULL;
|
||||
|
||||
memset (&filter->parse_data, 0x00, sizeof (ParseData));
|
||||
memset (&filter->parse_data, 0x00, sizeof (MetaData));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -767,13 +765,13 @@ gst_metadata_parse_send_tags (GstMetadataParse * filter)
|
|||
GstTagList *taglist;
|
||||
GstEvent *event;
|
||||
|
||||
if (PARSE_DATA_OPTION (filter->parse_data) & PARSE_OPT_EXIF)
|
||||
if (META_DATA_OPTION (filter->parse_data) & META_OPT_EXIF)
|
||||
metadataparse_exif_tag_list_add (filter->taglist, GST_TAG_MERGE_KEEP,
|
||||
filter->parse_data.exif_adapter);
|
||||
if (PARSE_DATA_OPTION (filter->parse_data) & PARSE_OPT_IPTC)
|
||||
if (META_DATA_OPTION (filter->parse_data) & META_OPT_IPTC)
|
||||
metadataparse_iptc_tag_list_add (filter->taglist, GST_TAG_MERGE_KEEP,
|
||||
filter->parse_data.iptc_adapter);
|
||||
if (PARSE_DATA_OPTION (filter->parse_data) & PARSE_OPT_XMP)
|
||||
if (META_DATA_OPTION (filter->parse_data) & META_OPT_XMP)
|
||||
metadataparse_xmp_tag_list_add (filter->taglist, GST_TAG_MERGE_KEEP,
|
||||
filter->parse_data.xmp_adapter);
|
||||
|
||||
|
@ -823,6 +821,9 @@ gst_metadata_parse_src_query (GstPad * pad, GstQuery * query)
|
|||
}
|
||||
break;
|
||||
case GST_QUERY_DURATION:
|
||||
if (filter->state != MT_STATE_PARSED)
|
||||
goto done;
|
||||
|
||||
gst_query_parse_duration (query, &format, NULL);
|
||||
|
||||
if (format == GST_FORMAT_BYTES) {
|
||||
|
@ -840,6 +841,8 @@ gst_metadata_parse_src_query (GstPad * pad, GstQuery * query)
|
|||
break;
|
||||
}
|
||||
|
||||
done:
|
||||
|
||||
gst_object_unref (filter);
|
||||
|
||||
return ret;
|
||||
|
@ -863,11 +866,11 @@ gst_metadata_parse_parse (GstMetadataParse * filter, const guint8 * buf,
|
|||
filter->next_offset = 0;
|
||||
filter->next_size = 0;
|
||||
|
||||
ret = metadataparse_parse (&filter->parse_data, buf, size,
|
||||
ret = metadata_parse (&filter->parse_data, buf, size,
|
||||
&filter->next_offset, &filter->next_size);
|
||||
|
||||
if (ret < 0) {
|
||||
if (PARSE_DATA_IMG_TYPE (filter->parse_data) == IMG_NONE) {
|
||||
if (META_DATA_IMG_TYPE (filter->parse_data) == IMG_NONE) {
|
||||
/* image type not recognized */
|
||||
GST_ELEMENT_ERROR (filter, STREAM, TYPE_NOT_FOUND, (NULL),
|
||||
("Only jpeg and png are supported"));
|
||||
|
@ -928,8 +931,8 @@ gst_metadata_parse_parse (GstMetadataParse * filter, const guint8 * buf,
|
|||
filter->need_send_tag = TRUE;
|
||||
}
|
||||
|
||||
if (filter->img_type != PARSE_DATA_IMG_TYPE (filter->parse_data)) {
|
||||
filter->img_type = PARSE_DATA_IMG_TYPE (filter->parse_data);
|
||||
if (filter->img_type != META_DATA_IMG_TYPE (filter->parse_data)) {
|
||||
filter->img_type = META_DATA_IMG_TYPE (filter->parse_data);
|
||||
if (!gst_metadata_parse_configure_caps (filter)) {
|
||||
GST_ELEMENT_ERROR (filter, STREAM, FORMAT, (NULL),
|
||||
("Couldn't reconfigure caps for %s",
|
||||
|
@ -966,8 +969,6 @@ gst_metadata_parse_chain (GstPad * pad, GstBuffer * buf)
|
|||
|
||||
filter = GST_METADATA_PARSE (gst_pad_get_parent (pad));
|
||||
|
||||
/* commented until I figure out how to strip if it wasn't parsed yet */
|
||||
|
||||
if (filter->state != MT_STATE_PARSED) {
|
||||
guint32 adpt_size = gst_adapter_available (filter->adapter_parsing);
|
||||
|
||||
|
@ -1607,22 +1608,26 @@ gst_metadata_parse_checkgetrange (GstPad * srcpad)
|
|||
return gst_pad_check_pull_range (filter->sinkpad);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static GstFlowReturn
|
||||
gst_metadata_parse_get_range (GstPad * pad,
|
||||
guint64 offset, guint size, GstBuffer ** buf)
|
||||
{
|
||||
GstMetadataParse *filter = NULL;
|
||||
gboolean ret = TRUE;
|
||||
const gint64 offset_orig = 0;
|
||||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
gint64 offset_orig = 0;
|
||||
guint size_orig;
|
||||
GstBuffer *prepend = NULL;
|
||||
gboolean need_append = FALSE;
|
||||
|
||||
filter = GST_METADATA_PARSE (GST_PAD_PARENT (pad));
|
||||
|
||||
if (filter->state != MT_STATE_PARSED) {
|
||||
ret = GST_FLOW_ERROR;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (offset + size > filter->duration) {
|
||||
/* this should never happen */
|
||||
return FALSE;
|
||||
size = filter->duration - offset;
|
||||
}
|
||||
|
||||
size_orig = size;
|
||||
|
@ -1647,10 +1652,7 @@ gst_metadata_parse_get_range (GstPad * pad,
|
|||
ret = gst_pad_pull_range (filter->sinkpad, offset_orig, size_orig, buf);
|
||||
|
||||
if (ret == GST_FLOW_OK && *buf) {
|
||||
/* FIXEME: put prepend here */
|
||||
gst_metadata_parse_strip_push_buffer (filter, offset_orig, &prepend, buf);
|
||||
filter->offset_orig = offset;
|
||||
filter->offset = offset;
|
||||
|
||||
if (GST_BUFFER_SIZE (*buf) < size) {
|
||||
/* need append */
|
||||
|
@ -1664,6 +1666,15 @@ gst_metadata_parse_get_range (GstPad * pad,
|
|||
|
||||
done:
|
||||
|
||||
if (need_append) {
|
||||
/* FIXME: together with SEEK and
|
||||
* gst_metadata_parse_translate_pos_to_orig
|
||||
* this way if chunk is added in the end we are in trolble
|
||||
* ...still not implemented 'cause it will not be the
|
||||
* case for the time being
|
||||
*/
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
@ -1700,7 +1711,7 @@ gst_metadata_parse_change_state (GstElement * element,
|
|||
gst_metadata_parse_init_members (filter);
|
||||
filter->adapter_parsing = gst_adapter_new ();
|
||||
filter->taglist = gst_tag_list_new ();
|
||||
metadataparse_init (&filter->parse_data);
|
||||
metadata_init (&filter->parse_data);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -1711,6 +1722,22 @@ gst_metadata_parse_change_state (GstElement * element,
|
|||
goto done;
|
||||
|
||||
switch (transition) {
|
||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||
filter->offset = 0;
|
||||
filter->offset_orig = 0;
|
||||
if (filter->adapter_parsing) {
|
||||
gst_adapter_clear (filter->adapter_parsing);
|
||||
}
|
||||
if (filter->adapter_holding) {
|
||||
gst_adapter_clear (filter->adapter_holding);
|
||||
}
|
||||
if (filter->state != MT_STATE_PARSED) {
|
||||
/* cleanup parser */
|
||||
/* FIXME: could be improved a bit to avoid mem allocation */
|
||||
metadata_dispose (&filter->parse_data);
|
||||
metadata_init (&filter->parse_data);
|
||||
}
|
||||
break;
|
||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||
gst_metadata_parse_dispose_members (filter);
|
||||
break;
|
||||
|
@ -1733,20 +1760,6 @@ gst_metadata_parse_plugin_init (GstPlugin * plugin)
|
|||
GST_DEBUG_CATEGORY_INIT (gst_metadata_parse_debug, "metadataparse", 0,
|
||||
"Metadata demuxer");
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_metadata_parse_exif_debug, "metadataparse_exif",
|
||||
0, "Metadata exif demuxer");
|
||||
GST_DEBUG_CATEGORY_INIT (gst_metadata_parse_iptc_debug, "metadataparse_iptc",
|
||||
0, "Metadata iptc demuxer");
|
||||
GST_DEBUG_CATEGORY_INIT (gst_metadata_parse_xmp_debug, "metadataparse_xmp", 0,
|
||||
"Metadata xmp demuxer");
|
||||
|
||||
/* FIXME: register tag should be done by plugin 'cause muxer element also uses it */
|
||||
metadataparse_exif_tags_register ();
|
||||
|
||||
metadataparse_iptc_tags_register ();
|
||||
|
||||
metadataparse_xmp_tags_register ();
|
||||
|
||||
return gst_element_register (plugin, "metadataparse",
|
||||
GST_RANK_PRIMARY + 1, GST_TYPE_METADATA_PARSE);
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include "metadataparse.h"
|
||||
#include "metadata.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
/* #defines don't like whitespacey bits */
|
||||
|
@ -82,7 +82,7 @@ struct _GstMetadataParse
|
|||
gboolean need_send_tag;
|
||||
|
||||
GstTagList *taglist;
|
||||
ParseData parse_data;
|
||||
MetaData parse_data;
|
||||
GstAdapter *adapter_parsing;
|
||||
GstAdapter *adapter_holding;
|
||||
guint32 next_offset;
|
||||
|
|
|
@ -43,14 +43,14 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#include "metadataparse.h"
|
||||
#include "metadata.h"
|
||||
|
||||
/*
|
||||
*static declarations
|
||||
*/
|
||||
|
||||
static int
|
||||
metadataparse_parse_none (ParseData * parse_data, const guint8 * buf,
|
||||
metadata_parse_none (MetaData * meta_data, const guint8 * buf,
|
||||
guint32 * bufsize, guint8 ** next_start, guint32 * next_size);
|
||||
|
||||
/*
|
||||
|
@ -58,17 +58,17 @@ metadataparse_parse_none (ParseData * parse_data, const guint8 * buf,
|
|||
*/
|
||||
|
||||
void
|
||||
metadataparse_init (ParseData * parse_data)
|
||||
metadata_init (MetaData * meta_data)
|
||||
{
|
||||
parse_data->state = STATE_NULL;
|
||||
parse_data->img_type = IMG_NONE;
|
||||
parse_data->option = PARSE_OPT_ALL;
|
||||
parse_data->offset_orig = 0;
|
||||
parse_data->exif_adapter = NULL;
|
||||
parse_data->iptc_adapter = NULL;
|
||||
parse_data->xmp_adapter = NULL;
|
||||
metadata_chunk_array_init (&parse_data->strip_chunks, 4);
|
||||
metadata_chunk_array_init (&parse_data->inject_chunks, 1);
|
||||
meta_data->state = STATE_NULL;
|
||||
meta_data->img_type = IMG_NONE;
|
||||
meta_data->option = META_OPT_ALL;
|
||||
meta_data->offset_orig = 0;
|
||||
meta_data->exif_adapter = NULL;
|
||||
meta_data->iptc_adapter = NULL;
|
||||
meta_data->xmp_adapter = NULL;
|
||||
metadata_chunk_array_init (&meta_data->strip_chunks, 4);
|
||||
metadata_chunk_array_init (&meta_data->inject_chunks, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -80,7 +80,7 @@ metadataparse_init (ParseData * parse_data)
|
|||
* 1 -> need more data
|
||||
*/
|
||||
int
|
||||
metadataparse_parse (ParseData * parse_data, const guint8 * buf,
|
||||
metadata_parse (MetaData * meta_data, const guint8 * buf,
|
||||
guint32 bufsize, guint32 * next_offset, guint32 * next_size)
|
||||
{
|
||||
|
||||
|
@ -88,27 +88,26 @@ metadataparse_parse (ParseData * parse_data, const guint8 * buf,
|
|||
|
||||
guint8 *next_start = (guint8 *) buf;
|
||||
|
||||
if (parse_data->state == STATE_NULL) {
|
||||
if (meta_data->state == STATE_NULL) {
|
||||
ret =
|
||||
metadataparse_parse_none (parse_data, buf, &bufsize, &next_start,
|
||||
next_size);
|
||||
metadata_parse_none (meta_data, buf, &bufsize, &next_start, next_size);
|
||||
if (ret == 0)
|
||||
parse_data->state = STATE_READING;
|
||||
meta_data->state = STATE_READING;
|
||||
else
|
||||
goto done;
|
||||
}
|
||||
|
||||
switch (parse_data->img_type) {
|
||||
switch (meta_data->img_type) {
|
||||
case IMG_JPEG:
|
||||
ret =
|
||||
metadataparse_jpeg_parse (&parse_data->format_data.jpeg,
|
||||
(guint8 *) buf, &bufsize, parse_data->offset_orig, &next_start,
|
||||
metadataparse_jpeg_parse (&meta_data->format_data.jpeg,
|
||||
(guint8 *) buf, &bufsize, meta_data->offset_orig, &next_start,
|
||||
next_size);
|
||||
break;
|
||||
case IMG_PNG:
|
||||
ret =
|
||||
metadataparse_png_parse (&parse_data->format_data.png,
|
||||
(guint8 *) buf, &bufsize, parse_data->offset_orig, &next_start,
|
||||
metadataparse_png_parse (&meta_data->format_data.png,
|
||||
(guint8 *) buf, &bufsize, meta_data->offset_orig, &next_start,
|
||||
next_size);
|
||||
break;
|
||||
default:
|
||||
|
@ -119,46 +118,46 @@ metadataparse_parse (ParseData * parse_data, const guint8 * buf,
|
|||
}
|
||||
|
||||
*next_offset = next_start - buf;
|
||||
parse_data->offset_orig += *next_offset;
|
||||
meta_data->offset_orig += *next_offset;
|
||||
|
||||
done:
|
||||
|
||||
if (ret == 0) {
|
||||
parse_data->state = STATE_DONE;
|
||||
meta_data->state = STATE_DONE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
metadataparse_dispose (ParseData * parse_data)
|
||||
metadata_dispose (MetaData * meta_data)
|
||||
{
|
||||
|
||||
switch (parse_data->img_type) {
|
||||
switch (meta_data->img_type) {
|
||||
case IMG_JPEG:
|
||||
metadataparse_jpeg_dispose (&parse_data->format_data.jpeg);
|
||||
metadataparse_jpeg_dispose (&meta_data->format_data.jpeg);
|
||||
break;
|
||||
case IMG_PNG:
|
||||
metadataparse_png_dispose (&parse_data->format_data.png);
|
||||
metadataparse_png_dispose (&meta_data->format_data.png);
|
||||
break;
|
||||
}
|
||||
|
||||
metadata_chunk_array_free (&parse_data->strip_chunks);
|
||||
metadata_chunk_array_free (&parse_data->inject_chunks);
|
||||
metadata_chunk_array_free (&meta_data->strip_chunks);
|
||||
metadata_chunk_array_free (&meta_data->inject_chunks);
|
||||
|
||||
if (parse_data->xmp_adapter) {
|
||||
gst_object_unref (parse_data->xmp_adapter);
|
||||
parse_data->xmp_adapter = NULL;
|
||||
if (meta_data->xmp_adapter) {
|
||||
gst_object_unref (meta_data->xmp_adapter);
|
||||
meta_data->xmp_adapter = NULL;
|
||||
}
|
||||
|
||||
if (parse_data->iptc_adapter) {
|
||||
gst_object_unref (parse_data->iptc_adapter);
|
||||
parse_data->iptc_adapter = NULL;
|
||||
if (meta_data->iptc_adapter) {
|
||||
gst_object_unref (meta_data->iptc_adapter);
|
||||
meta_data->iptc_adapter = NULL;
|
||||
}
|
||||
|
||||
if (parse_data->exif_adapter) {
|
||||
gst_object_unref (parse_data->exif_adapter);
|
||||
parse_data->exif_adapter = NULL;
|
||||
if (meta_data->exif_adapter) {
|
||||
gst_object_unref (meta_data->exif_adapter);
|
||||
meta_data->exif_adapter = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -169,7 +168,7 @@ metadataparse_dispose (ParseData * parse_data)
|
|||
|
||||
/* find image type */
|
||||
static int
|
||||
metadataparse_parse_none (ParseData * parse_data, const guint8 * buf,
|
||||
metadata_parse_none (MetaData * meta_data, const guint8 * buf,
|
||||
guint32 * bufsize, guint8 ** next_start, guint32 * next_size)
|
||||
{
|
||||
|
||||
|
@ -180,7 +179,7 @@ metadataparse_parse_none (ParseData * parse_data, const guint8 * buf,
|
|||
|
||||
*next_start = (guint8 *) buf;
|
||||
|
||||
parse_data->img_type = IMG_NONE;
|
||||
meta_data->img_type = IMG_NONE;
|
||||
|
||||
if (*bufsize < 3) {
|
||||
*next_size = 3;
|
||||
|
@ -188,18 +187,18 @@ metadataparse_parse_none (ParseData * parse_data, const guint8 * buf,
|
|||
goto done;
|
||||
}
|
||||
|
||||
if (parse_data->option & PARSE_OPT_EXIF)
|
||||
exif = &parse_data->exif_adapter;
|
||||
if (parse_data->option & PARSE_OPT_IPTC)
|
||||
iptc = &parse_data->iptc_adapter;
|
||||
if (parse_data->option & PARSE_OPT_XMP)
|
||||
xmp = &parse_data->xmp_adapter;
|
||||
if (meta_data->option & META_OPT_EXIF)
|
||||
exif = &meta_data->exif_adapter;
|
||||
if (meta_data->option & META_OPT_IPTC)
|
||||
iptc = &meta_data->iptc_adapter;
|
||||
if (meta_data->option & META_OPT_XMP)
|
||||
xmp = &meta_data->xmp_adapter;
|
||||
|
||||
if (buf[0] == 0xFF && buf[1] == 0xD8 && buf[2] == 0xFF) {
|
||||
metadataparse_jpeg_init (&parse_data->format_data.jpeg, exif, iptc, xmp,
|
||||
&parse_data->strip_chunks, &parse_data->inject_chunks);
|
||||
metadataparse_jpeg_init (&meta_data->format_data.jpeg, exif, iptc, xmp,
|
||||
&meta_data->strip_chunks, &meta_data->inject_chunks);
|
||||
ret = 0;
|
||||
parse_data->img_type = IMG_JPEG;
|
||||
meta_data->img_type = IMG_JPEG;
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -211,10 +210,10 @@ metadataparse_parse_none (ParseData * parse_data, const guint8 * buf,
|
|||
|
||||
if (buf[0] == 0x89 && buf[1] == 0x50 && buf[2] == 0x4E && buf[3] == 0x47 &&
|
||||
buf[4] == 0x0D && buf[5] == 0x0A && buf[6] == 0x1A && buf[7] == 0x0A) {
|
||||
metadataparse_png_init (&parse_data->format_data.png, exif, iptc, xmp,
|
||||
&parse_data->strip_chunks, &parse_data->inject_chunks);
|
||||
metadataparse_png_init (&meta_data->format_data.png, exif, iptc, xmp,
|
||||
&meta_data->strip_chunks, &meta_data->inject_chunks);
|
||||
ret = 0;
|
||||
parse_data->img_type = IMG_PNG;
|
||||
meta_data->img_type = IMG_PNG;
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -41,8 +41,8 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __METADATAPARSE_H__
|
||||
#define __METADATAPARSE_H__
|
||||
#ifndef __METADATA_H__
|
||||
#define __METADATA_H__
|
||||
|
||||
#include <gst/base/gstadapter.h>
|
||||
#include "metadatatypes.h"
|
||||
|
@ -52,20 +52,20 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef enum _tag_ParseOption
|
||||
typedef enum _tag_MetaOption
|
||||
{
|
||||
PARSE_OPT_EXIF = (1 << 0),
|
||||
PARSE_OPT_IPTC = (1 << 1),
|
||||
PARSE_OPT_XMP = (1 << 2),
|
||||
PARSE_OPT_ALL = (1 << 3) - 1
|
||||
} ParseOption;
|
||||
META_OPT_EXIF = (1 << 0),
|
||||
META_OPT_IPTC = (1 << 1),
|
||||
META_OPT_XMP = (1 << 2),
|
||||
META_OPT_ALL = (1 << 3) - 1
|
||||
} MetaOption;
|
||||
|
||||
typedef enum _tag_ParseState
|
||||
typedef enum _tag_MetaState
|
||||
{
|
||||
STATE_NULL,
|
||||
STATE_READING,
|
||||
STATE_DONE
|
||||
} ParseState;
|
||||
} MetaState;
|
||||
|
||||
typedef enum _tag_ImageType
|
||||
{
|
||||
|
@ -74,11 +74,11 @@ typedef enum _tag_ImageType
|
|||
IMG_PNG
|
||||
} ImageType;
|
||||
|
||||
typedef struct _tag_ParseData
|
||||
typedef struct _tag_MetaData
|
||||
{
|
||||
ParseState state;
|
||||
MetaState state;
|
||||
ImageType img_type;
|
||||
ParseOption option;
|
||||
MetaOption option;
|
||||
guint32 offset_orig; /* offset since begining of stream */
|
||||
union
|
||||
{
|
||||
|
@ -92,14 +92,14 @@ typedef struct _tag_ParseData
|
|||
MetadataChunkArray strip_chunks;
|
||||
MetadataChunkArray inject_chunks;
|
||||
|
||||
} ParseData;
|
||||
} MetaData;
|
||||
|
||||
#define PARSE_DATA_IMG_TYPE(p) (p).img_type
|
||||
#define PARSE_DATA_OPTION(p) (p).option
|
||||
#define set_parse_option(p, m) do { (p).option = (p).option | (m); } while(FALSE)
|
||||
#define unset_parse_option(p, m) do { (p).option = (p).option & ~(m); } while(FALSE)
|
||||
#define META_DATA_IMG_TYPE(p) (p).img_type
|
||||
#define META_DATA_OPTION(p) (p).option
|
||||
#define set_meta_option(p, m) do { (p).option = (p).option | (m); } while(FALSE)
|
||||
#define unset_meta_option(p, m) do { (p).option = (p).option & ~(m); } while(FALSE)
|
||||
|
||||
extern void metadataparse_init (ParseData * parse_data);
|
||||
extern void metadata_init (MetaData * meta_data);
|
||||
|
||||
/*
|
||||
* offset: number of bytes that MUST be jumped after current "buf" pointer
|
||||
|
@ -112,11 +112,11 @@ extern void metadataparse_init (ParseData * parse_data);
|
|||
* 1 -> need more data
|
||||
*/
|
||||
extern int
|
||||
metadataparse_parse (ParseData * parse_data, const guint8 * buf,
|
||||
metadata_meta (MetaData * meta_data, const guint8 * buf,
|
||||
guint32 bufsize, guint32 * next_offset, guint32 * next_size);
|
||||
|
||||
|
||||
extern void metadataparse_dispose (ParseData * parse_data);
|
||||
extern void metadata_dispose (MetaData * meta_data);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* __METADATAPARSE_H__ */
|
||||
#endif /* __METADATA_H__ */
|
|
@ -41,20 +41,12 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "metadataparseexif.h"
|
||||
#include "metadataexif.h"
|
||||
#include "metadataparseutil.h"
|
||||
#include "metadatatags.h"
|
||||
|
||||
GST_DEBUG_CATEGORY (gst_metadata_parse_exif_debug);
|
||||
#define GST_CAT_DEFAULT gst_metadata_parse_exif_debug
|
||||
|
||||
#define GST_TAG_EXIF "exif"
|
||||
|
||||
void
|
||||
metadataparse_exif_tags_register (void)
|
||||
{
|
||||
gst_tag_register (GST_TAG_EXIF, GST_TAG_FLAG_META,
|
||||
GST_TYPE_BUFFER, GST_TAG_EXIF, "exif metadata chunk", NULL);
|
||||
}
|
||||
GST_DEBUG_CATEGORY (gst_metadata_exif_debug);
|
||||
#define GST_CAT_DEFAULT gst_metadata_exif_debug
|
||||
|
||||
#ifndef HAVE_EXIF
|
||||
|
||||
|
@ -69,6 +61,13 @@ metadataparse_exif_tag_list_add (GstTagList * taglist, GstTagMergeMode mode,
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
metadatamux_exif_create_chunk_from_tag_list (GstAdapter ** adapter,
|
||||
GstTagList * taglist)
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
#else /* ifndef HAVE_EXIF */
|
||||
|
||||
#include <libexif/exif-data.h>
|
||||
|
@ -145,4 +144,25 @@ exif_content_foreach_entry_func (ExifEntry * entry, void *user_data)
|
|||
exif_tag_get_description_in_ifd (entry->tag, EXIF_IFD_0));
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
metadatamux_exif_create_chunk_from_tag_list (GstAdapter ** adapter,
|
||||
GstTagList * taglist)
|
||||
{
|
||||
if (adapter == NULL)
|
||||
goto done;
|
||||
|
||||
if (*adapter)
|
||||
g_object_unref (*adapter);
|
||||
|
||||
*adapter = gst_adapter_new ();
|
||||
|
||||
done:
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#endif /* else (ifndef HAVE_EXIF) */
|
|
@ -48,11 +48,14 @@
|
|||
#include <gst/base/gstadapter.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
extern void
|
||||
|
||||
extern void
|
||||
metadataparse_exif_tag_list_add (GstTagList * taglist, GstTagMergeMode mode,
|
||||
GstAdapter * adapter);
|
||||
|
||||
extern void metadataparse_exif_tags_register (void);
|
||||
extern void
|
||||
metadatamux_exif_create_chunk_from_tag_list (GstAdapter ** adapter,
|
||||
GstTagList * taglist);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* __GST_METADATAPARSE_EXIF_H__ */
|
|
@ -41,20 +41,12 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "metadataparseiptc.h"
|
||||
#include "metadataiptc.h"
|
||||
#include "metadataparseutil.h"
|
||||
#include "metadatatags.h"
|
||||
|
||||
GST_DEBUG_CATEGORY (gst_metadata_parse_iptc_debug);
|
||||
#define GST_CAT_DEFAULT gst_metadata_parse_iptc_debug
|
||||
|
||||
#define GST_TAG_IPTC "iptc"
|
||||
|
||||
void
|
||||
metadataparse_iptc_tags_register (void)
|
||||
{
|
||||
gst_tag_register (GST_TAG_IPTC, GST_TAG_FLAG_META,
|
||||
GST_TYPE_BUFFER, GST_TAG_IPTC, "iptc metadata chunk", NULL);
|
||||
}
|
||||
GST_DEBUG_CATEGORY (gst_metadata_iptc_debug);
|
||||
#define GST_CAT_DEFAULT gst_metadata_iptc_debug
|
||||
|
||||
#ifndef HAVE_IPTC
|
||||
|
||||
|
@ -69,6 +61,14 @@ metadataparse_iptc_tag_list_add (GstTagList * taglist, GstTagMergeMode mode,
|
|||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
metadatamux_iptc_create_chunk_from_tag_list (GstAdapter ** adapter,
|
||||
GstTagList * taglist)
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
#else /* ifndef HAVE_IPTC */
|
||||
|
||||
#include <iptc-data.h>
|
||||
|
@ -124,4 +124,21 @@ iptc_data_foreach_dataset_func (IptcDataSet * dataset, void *user_data)
|
|||
GST_LOG ("value = %s", iptc_dataset_get_as_str (dataset, buf, 256));
|
||||
}
|
||||
|
||||
void
|
||||
metadatamux_iptc_create_chunk_from_tag_list (GstAdapter ** adapter,
|
||||
GstTagList * taglist)
|
||||
{
|
||||
if (adapter == NULL)
|
||||
goto done;
|
||||
|
||||
if (*adapter)
|
||||
g_object_unref (*adapter);
|
||||
|
||||
*adapter = gst_adapter_new ();
|
||||
|
||||
done:
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#endif /* else (ifndef HAVE_IPTC) */
|
|
@ -53,7 +53,9 @@ extern void
|
|||
metadataparse_iptc_tag_list_add (GstTagList * taglist, GstTagMergeMode mode,
|
||||
GstAdapter * adapter);
|
||||
|
||||
extern void metadataparse_iptc_tags_register (void);
|
||||
extern void
|
||||
metadatamux_iptc_create_chunk_from_tag_list (GstAdapter ** adapter,
|
||||
GstTagList * taglist);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* __GST_METADATAPARSE_IPTC_H__ */
|
91
ext/metadata/metadatatags.c
Normal file
91
ext/metadata/metadatatags.c
Normal file
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* GStreamer
|
||||
* Copyright 2007 Edgard Lima <edgard.lima@indt.org.br>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
* GNU Lesser General Public License Version 2.1 (the "LGPL"), in
|
||||
* which case the following provisions apply instead of the ones
|
||||
* mentioned above:
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "metadatatags.h"
|
||||
|
||||
/*
|
||||
* EXIF tags
|
||||
*/
|
||||
|
||||
static void
|
||||
metadata_tags_exif_register (void)
|
||||
{
|
||||
gst_tag_register (GST_TAG_EXIF, GST_TAG_FLAG_META,
|
||||
GST_TYPE_BUFFER, GST_TAG_EXIF, "exif metadata chunk", NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* IPTC tags
|
||||
*/
|
||||
|
||||
static void
|
||||
metadata_tags_iptc_register (void)
|
||||
{
|
||||
gst_tag_register (GST_TAG_IPTC, GST_TAG_FLAG_META,
|
||||
GST_TYPE_BUFFER, GST_TAG_IPTC, "iptc metadata chunk", NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* XMP tags
|
||||
*/
|
||||
|
||||
static void
|
||||
metadata_tags_xmp_register (void)
|
||||
{
|
||||
gst_tag_register (GST_TAG_XMP, GST_TAG_FLAG_META,
|
||||
GST_TYPE_BUFFER, GST_TAG_XMP, "xmp metadata chunk", NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
metadata_tags_register (void)
|
||||
{
|
||||
|
||||
metadata_tags_exif_register ();
|
||||
metadata_tags_iptc_register ();
|
||||
metadata_tags_xmp_register ();
|
||||
|
||||
}
|
62
ext/metadata/metadatatags.h
Normal file
62
ext/metadata/metadatatags.h
Normal file
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* GStreamer
|
||||
* Copyright 2007 Edgard Lima <edgard.lima@indt.org.br>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
* GNU Lesser General Public License Version 2.1 (the "LGPL"), in
|
||||
* which case the following provisions apply instead of the ones
|
||||
* mentioned above:
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __GST_METADATA_TAGS_H__
|
||||
#define __GST_METADATA_TAGS_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/base/gstadapter.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TAG_EXIF "exif"
|
||||
|
||||
#define GST_TAG_IPTC "iptc"
|
||||
|
||||
#define GST_TAG_XMP "xmp"
|
||||
|
||||
extern void
|
||||
metadata_tags_register (void);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* __GST_METADATA_TAGS_H__ */
|
|
@ -41,20 +41,12 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "metadataparsexmp.h"
|
||||
#include "metadataxmp.h"
|
||||
#include "metadataparseutil.h"
|
||||
#include "metadatatags.h"
|
||||
|
||||
GST_DEBUG_CATEGORY (gst_metadata_parse_xmp_debug);
|
||||
#define GST_CAT_DEFAULT gst_metadata_parse_xmp_debug
|
||||
|
||||
#define GST_TAG_XMP "xmp"
|
||||
|
||||
void
|
||||
metadataparse_xmp_tags_register (void)
|
||||
{
|
||||
gst_tag_register (GST_TAG_XMP, GST_TAG_FLAG_META,
|
||||
GST_TYPE_BUFFER, GST_TAG_XMP, "xmp metadata chunk", NULL);
|
||||
}
|
||||
GST_DEBUG_CATEGORY (gst_metadata_xmp_debug);
|
||||
#define GST_CAT_DEFAULT gst_metadata_xmp_debug
|
||||
|
||||
#ifndef HAVE_XMP
|
||||
|
||||
|
@ -81,6 +73,13 @@ metadataparse_xmp_dispose (void)
|
|||
return;
|
||||
}
|
||||
|
||||
void
|
||||
metadatamux_xmp_create_chunk_from_tag_list (GstAdapter ** adapter,
|
||||
GstTagList * taglist)
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
#else /* ifndef HAVE_XMP */
|
||||
|
||||
#include <xmp.h>
|
||||
|
@ -242,4 +241,21 @@ metadataparse_xmp_iter (XmpPtr xmp, XmpIteratorPtr iter)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
metadatamux_xmp_create_chunk_from_tag_list (GstAdapter ** adapter,
|
||||
GstTagList * taglist)
|
||||
{
|
||||
if (adapter == NULL)
|
||||
goto done;
|
||||
|
||||
if (*adapter)
|
||||
g_object_unref (*adapter);
|
||||
|
||||
*adapter = gst_adapter_new ();
|
||||
|
||||
done:
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#endif /* else (ifndef HAVE_XMP) */
|
|
@ -57,7 +57,9 @@ extern gboolean metadataparse_xmp_init (void);
|
|||
|
||||
extern void metadataparse_xmp_dispose (void);
|
||||
|
||||
extern void metadataparse_xmp_tags_register (void);
|
||||
extern void
|
||||
metadatamux_xmp_create_chunk_from_tag_list (GstAdapter ** adapter,
|
||||
GstTagList * taglist);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* __GST_METADATAPARSE_XMP_H__ */
|
Loading…
Reference in a new issue