mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
Now sending iptc tag in whole chunk. Ready to also send exif and xmp in the same way (look at bug #486659).
Original commit message from CVS: Now sending iptc tag in whole chunk. Ready to also send exif and xmp in the same way (look at bug #486659).
This commit is contained in:
parent
7412141912
commit
5888898c57
9 changed files with 156 additions and 24 deletions
28
ChangeLog
28
ChangeLog
|
@ -1,3 +1,31 @@
|
||||||
|
2007-10-31 Edgard Lima <edgard.lima@indt.org.br>
|
||||||
|
|
||||||
|
* ext/metadata/gstmetadataparse.c:
|
||||||
|
(gst_metadata_parse_dispose_members),
|
||||||
|
(gst_metadata_parse_init_members), (gst_metadata_parse_send_tags),
|
||||||
|
(gst_metadata_parse_chain), (gst_metadata_parse_get_range),
|
||||||
|
(gst_metadata_parse_change_state),
|
||||||
|
(gst_metadata_parse_plugin_init):
|
||||||
|
* ext/metadata/gstmetadataparse.h:
|
||||||
|
* ext/metadata/metadataparseexif.c:
|
||||||
|
(metadataparse_exif_tags_register),
|
||||||
|
(metadataparse_exif_tag_list_add),
|
||||||
|
(exif_data_foreach_content_func),
|
||||||
|
(exif_content_foreach_entry_func):
|
||||||
|
* ext/metadata/metadataparseexif.h:
|
||||||
|
* ext/metadata/metadataparseiptc.c:
|
||||||
|
(metadataparse_iptc_tags_register),
|
||||||
|
(metadataparse_tag_list_add_chunk),
|
||||||
|
(metadataparse_iptc_tag_list_add),
|
||||||
|
(iptc_data_foreach_dataset_func):
|
||||||
|
* ext/metadata/metadataparseiptc.h:
|
||||||
|
* ext/metadata/metadataparsexmp.c:
|
||||||
|
(metadataparse_xmp_tags_register),
|
||||||
|
(metadataparse_xmp_tag_list_add):
|
||||||
|
* ext/metadata/metadataparsexmp.h:
|
||||||
|
Now sending iptc tag in whole chunk. Ready to also send exif and xmp
|
||||||
|
in the same way (look at bug #486659).
|
||||||
|
|
||||||
2007-10-31 Thijs Vermeir,,, <thijsvermeir@gmail.com>
|
2007-10-31 Thijs Vermeir,,, <thijsvermeir@gmail.com>
|
||||||
|
|
||||||
* gst/librfb/rfbdecoder.c:
|
* gst/librfb/rfbdecoder.c:
|
||||||
|
|
|
@ -154,6 +154,8 @@ static int
|
||||||
gst_metadata_parse_parse (GstMetadataParse * filter, const guint8 * buf,
|
gst_metadata_parse_parse (GstMetadataParse * filter, const guint8 * buf,
|
||||||
guint32 size);
|
guint32 size);
|
||||||
|
|
||||||
|
static void gst_metadata_parse_send_tags (GstMetadataParse * filter);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_metadata_parse_base_init (gpointer gclass)
|
gst_metadata_parse_base_init (gpointer gclass)
|
||||||
{
|
{
|
||||||
|
@ -472,6 +474,10 @@ gst_metadata_parse_dispose_members (GstMetadataParse * filter)
|
||||||
gst_object_unref (filter->adapter);
|
gst_object_unref (filter->adapter);
|
||||||
filter->adapter = NULL;
|
filter->adapter = NULL;
|
||||||
}
|
}
|
||||||
|
if (filter->taglist) {
|
||||||
|
gst_tag_list_free (filter->taglist);
|
||||||
|
filter->taglist = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -481,6 +487,7 @@ gst_metadata_parse_init_members (GstMetadataParse * filter)
|
||||||
filter->exif = TRUE;
|
filter->exif = TRUE;
|
||||||
filter->iptc = TRUE;
|
filter->iptc = TRUE;
|
||||||
filter->xmp = TRUE;
|
filter->xmp = TRUE;
|
||||||
|
filter->taglist = NULL;
|
||||||
filter->adapter = NULL;
|
filter->adapter = NULL;
|
||||||
filter->next_offset = 0;
|
filter->next_offset = 0;
|
||||||
filter->next_size = 0;
|
filter->next_size = 0;
|
||||||
|
@ -632,6 +639,40 @@ gst_metadata_parse_get_type_name (int img_type)
|
||||||
return type_name;
|
return type_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_metadata_parse_send_tags (GstMetadataParse * filter)
|
||||||
|
{
|
||||||
|
|
||||||
|
GstMessage *msg;
|
||||||
|
GstTagList *taglist;
|
||||||
|
GstEvent *event;
|
||||||
|
|
||||||
|
if (PARSE_DATA_OPTION (filter->parse_data) & PARSE_OPT_EXIF)
|
||||||
|
metadataparse_exif_tag_list_add (filter->taglist, GST_TAG_MERGE_KEEP,
|
||||||
|
filter->parse_data.adpt_exif);
|
||||||
|
if (PARSE_DATA_OPTION (filter->parse_data) & PARSE_OPT_IPTC)
|
||||||
|
metadataparse_iptc_tag_list_add (filter->taglist, GST_TAG_MERGE_KEEP,
|
||||||
|
filter->parse_data.adpt_iptc);
|
||||||
|
if (PARSE_DATA_OPTION (filter->parse_data) & PARSE_OPT_XMP)
|
||||||
|
metadataparse_xmp_tag_list_add (filter->taglist, GST_TAG_MERGE_KEEP,
|
||||||
|
filter->parse_data.adpt_xmp);
|
||||||
|
|
||||||
|
if (!gst_tag_list_is_empty (filter->taglist)) {
|
||||||
|
|
||||||
|
taglist = gst_tag_list_copy (filter->taglist);
|
||||||
|
msg = gst_message_new_tag (GST_OBJECT (filter), taglist);
|
||||||
|
gst_element_post_message (GST_ELEMENT (filter), msg);
|
||||||
|
|
||||||
|
taglist = gst_tag_list_copy (filter->taglist);
|
||||||
|
event = gst_event_new_tag (taglist);
|
||||||
|
gst_pad_push_event (filter->srcpad, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
filter->need_send_tag = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* return:
|
* return:
|
||||||
* -1 -> error
|
* -1 -> error
|
||||||
|
@ -740,11 +781,7 @@ gst_metadata_parse_chain (GstPad * pad, GstBuffer * buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter->need_send_tag) {
|
if (filter->need_send_tag) {
|
||||||
metadataparse_exif_dump (filter->parse_data.adpt_exif);
|
gst_metadata_parse_send_tags (filter);
|
||||||
metadataparse_iptc_dump (filter->parse_data.adpt_iptc);
|
|
||||||
metadataparse_xmp_dump (filter->parse_data.adpt_xmp);
|
|
||||||
|
|
||||||
filter->need_send_tag = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_buffer_set_caps (buf, GST_PAD_CAPS (filter->srcpad));
|
gst_buffer_set_caps (buf, GST_PAD_CAPS (filter->srcpad));
|
||||||
|
@ -859,11 +896,7 @@ gst_metadata_parse_get_range (GstPad * pad,
|
||||||
filter = GST_METADATA_PARSE (gst_pad_get_parent (pad));
|
filter = GST_METADATA_PARSE (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
if (filter->need_send_tag) {
|
if (filter->need_send_tag) {
|
||||||
metadataparse_exif_dump (filter->parse_data.adpt_exif);
|
gst_metadata_parse_send_tags (filter);
|
||||||
metadataparse_iptc_dump (filter->parse_data.adpt_iptc);
|
|
||||||
metadataparse_xmp_dump (filter->parse_data.adpt_xmp);
|
|
||||||
|
|
||||||
filter->need_send_tag = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = gst_pad_pull_range (filter->sinkpad, offset, size, buf);
|
ret = gst_pad_pull_range (filter->sinkpad, offset, size, buf);
|
||||||
|
@ -885,6 +918,7 @@ gst_metadata_parse_change_state (GstElement * element,
|
||||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||||
gst_metadata_parse_init_members (filter);
|
gst_metadata_parse_init_members (filter);
|
||||||
filter->adapter = gst_adapter_new ();
|
filter->adapter = gst_adapter_new ();
|
||||||
|
filter->taglist = gst_tag_list_new ();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -924,6 +958,12 @@ gst_metadata_parse_plugin_init (GstPlugin * plugin)
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_metadata_parse_xmp_debug, "metadataparse_xmp", 0,
|
GST_DEBUG_CATEGORY_INIT (gst_metadata_parse_xmp_debug, "metadataparse_xmp", 0,
|
||||||
"Metadata xmp demuxer");
|
"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",
|
return gst_element_register (plugin, "metadataparse",
|
||||||
GST_RANK_PRIMARY + 1, GST_TYPE_METADATA_PARSE);
|
GST_RANK_PRIMARY + 1, GST_TYPE_METADATA_PARSE);
|
||||||
|
|
|
@ -83,6 +83,7 @@ struct _GstMetadataParse
|
||||||
|
|
||||||
gboolean need_send_tag;
|
gboolean need_send_tag;
|
||||||
|
|
||||||
|
GstTagList *taglist;
|
||||||
ParseData parse_data;
|
ParseData parse_data;
|
||||||
GstAdapter * adapter;
|
GstAdapter * adapter;
|
||||||
guint32 next_offset;
|
guint32 next_offset;
|
||||||
|
|
|
@ -46,10 +46,16 @@
|
||||||
GST_DEBUG_CATEGORY (gst_metadata_parse_exif_debug);
|
GST_DEBUG_CATEGORY (gst_metadata_parse_exif_debug);
|
||||||
#define GST_CAT_DEFAULT gst_metadata_parse_exif_debug
|
#define GST_CAT_DEFAULT gst_metadata_parse_exif_debug
|
||||||
|
|
||||||
|
void
|
||||||
|
metadataparse_exif_tags_register (void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef HAVE_EXIF
|
#ifndef HAVE_EXIF
|
||||||
|
|
||||||
void
|
void
|
||||||
metadataparse_exif_dump (GstAdapter * adapter)
|
metadataparse_exif_tag_list_add (GstTagList * taglist, GstTagMergeMode mode,
|
||||||
|
GstAdapter * adapter)
|
||||||
{
|
{
|
||||||
|
|
||||||
GST_LOG ("EXIF not defined, here I should send just one tag as whole chunk");
|
GST_LOG ("EXIF not defined, here I should send just one tag as whole chunk");
|
||||||
|
@ -66,7 +72,8 @@ exif_data_foreach_content_func (ExifContent * content, void *callback_data);
|
||||||
static void exif_content_foreach_entry_func (ExifEntry * entry, void *);
|
static void exif_content_foreach_entry_func (ExifEntry * entry, void *);
|
||||||
|
|
||||||
void
|
void
|
||||||
metadataparse_exif_dump (GstAdapter * adapter)
|
metadataparse_exif_tag_list_add (GstTagList * taglist, GstTagMergeMode mode,
|
||||||
|
GstAdapter * adapter)
|
||||||
{
|
{
|
||||||
const guint8 *buf;
|
const guint8 *buf;
|
||||||
guint32 size;
|
guint32 size;
|
||||||
|
@ -84,7 +91,7 @@ metadataparse_exif_dump (GstAdapter * adapter)
|
||||||
}
|
}
|
||||||
|
|
||||||
exif_data_foreach_content (exif, exif_data_foreach_content_func,
|
exif_data_foreach_content (exif, exif_data_foreach_content_func,
|
||||||
(void *) NULL /* app data */ );
|
(void *) taglist);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
||||||
|
@ -96,20 +103,22 @@ done:
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
exif_data_foreach_content_func (ExifContent * content, void *callback_data)
|
exif_data_foreach_content_func (ExifContent * content, void *user_data)
|
||||||
{
|
{
|
||||||
ExifIfd ifd = exif_content_get_ifd (content);
|
ExifIfd ifd = exif_content_get_ifd (content);
|
||||||
|
GstTagList *taglist = (GstTagList *) user_data;
|
||||||
|
|
||||||
GST_LOG ("\n Content %p: %s (ifd=%d)", content, exif_ifd_get_name (ifd),
|
GST_LOG ("\n Content %p: %s (ifd=%d)", content, exif_ifd_get_name (ifd),
|
||||||
ifd);
|
ifd);
|
||||||
exif_content_foreach_entry (content, exif_content_foreach_entry_func,
|
exif_content_foreach_entry (content, exif_content_foreach_entry_func,
|
||||||
callback_data);
|
user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
exif_content_foreach_entry_func (ExifEntry * entry, void *unused)
|
exif_content_foreach_entry_func (ExifEntry * entry, void *user_data)
|
||||||
{
|
{
|
||||||
char buf[2048];
|
char buf[2048];
|
||||||
|
GstTagList *taglist = (GstTagList *) user_data;
|
||||||
|
|
||||||
GST_LOG ("\n Entry %p: %s (%s)\n"
|
GST_LOG ("\n Entry %p: %s (%s)\n"
|
||||||
" Size, Comps: %d, %d\n"
|
" Size, Comps: %d, %d\n"
|
||||||
|
|
|
@ -50,7 +50,10 @@
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
metadataparse_exif_dump(GstAdapter *adapter);
|
metadataparse_exif_tag_list_add (GstTagList *taglist, GstTagMergeMode mode, GstAdapter * adapter);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
metadataparse_exif_tags_register (void);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -46,14 +46,46 @@
|
||||||
GST_DEBUG_CATEGORY (gst_metadata_parse_iptc_debug);
|
GST_DEBUG_CATEGORY (gst_metadata_parse_iptc_debug);
|
||||||
#define GST_CAT_DEFAULT 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
metadataparse_tag_list_add_chunk (GstTagList * taglist, GstTagMergeMode mode,
|
||||||
|
const gchar * name, GstAdapter * adapter)
|
||||||
|
{
|
||||||
|
GstBuffer *buf;
|
||||||
|
guint size;
|
||||||
|
|
||||||
|
if (adapter && (size = gst_adapter_available (adapter))) {
|
||||||
|
|
||||||
|
buf = gst_buffer_new_and_alloc (size);
|
||||||
|
|
||||||
|
gst_adapter_copy (adapter, GST_BUFFER_DATA (buf), 0, size);
|
||||||
|
|
||||||
|
gst_tag_list_add (taglist, mode, name, buf, NULL);
|
||||||
|
|
||||||
|
gst_buffer_unref (buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef HAVE_IPTC
|
#ifndef HAVE_IPTC
|
||||||
|
|
||||||
void
|
void
|
||||||
metadataparse_iptc_dump (GstAdapter * adapter)
|
metadataparse_iptc_tag_list_add (GstTagList * taglist, GstTagMergeMode mode,
|
||||||
|
GstAdapter * adapter)
|
||||||
{
|
{
|
||||||
|
|
||||||
GST_LOG ("IPTC not defined, here I should send just one tag as whole chunk");
|
GST_LOG ("IPTC not defined, here I should send just one tag as whole chunk");
|
||||||
|
|
||||||
|
metadataparse_tag_list_add_chunk (taglist, mode, GST_TAG_IPTC, adapter);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* ifndef HAVE_IPTC */
|
#else /* ifndef HAVE_IPTC */
|
||||||
|
@ -64,7 +96,8 @@ static void
|
||||||
iptc_data_foreach_dataset_func (IptcDataSet * dataset, void *user_data);
|
iptc_data_foreach_dataset_func (IptcDataSet * dataset, void *user_data);
|
||||||
|
|
||||||
void
|
void
|
||||||
metadataparse_iptc_dump (GstAdapter * adapter)
|
metadataparse_iptc_tag_list_add (GstTagList * taglist, GstTagMergeMode mode,
|
||||||
|
GstAdapter * adapter)
|
||||||
{
|
{
|
||||||
const guint8 *buf;
|
const guint8 *buf;
|
||||||
guint32 size;
|
guint32 size;
|
||||||
|
@ -74,6 +107,9 @@ metadataparse_iptc_dump (GstAdapter * adapter)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* add chunk tag */
|
||||||
|
metadataparse_tag_list_add_chunk (taglist, mode, GST_TAG_IPTC, adapter);
|
||||||
|
|
||||||
buf = gst_adapter_peek (adapter, size);
|
buf = gst_adapter_peek (adapter, size);
|
||||||
|
|
||||||
iptc = iptc_data_new_from_data (buf, size);
|
iptc = iptc_data_new_from_data (buf, size);
|
||||||
|
@ -81,7 +117,8 @@ metadataparse_iptc_dump (GstAdapter * adapter)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
iptc_data_foreach_dataset (iptc, iptc_data_foreach_dataset_func, NULL);
|
iptc_data_foreach_dataset (iptc, iptc_data_foreach_dataset_func,
|
||||||
|
(void *) taglist);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
||||||
|
@ -97,6 +134,7 @@ iptc_data_foreach_dataset_func (IptcDataSet * dataset, void *user_data)
|
||||||
{
|
{
|
||||||
|
|
||||||
char *buf[256];
|
char *buf[256];
|
||||||
|
GstTagList *taglist = (GstTagList *) user_data;
|
||||||
|
|
||||||
GST_LOG ("name -> %s", iptc_tag_get_name (dataset->record, dataset->tag));
|
GST_LOG ("name -> %s", iptc_tag_get_name (dataset->record, dataset->tag));
|
||||||
GST_LOG ("title -> %s", iptc_tag_get_title (dataset->record, dataset->tag));
|
GST_LOG ("title -> %s", iptc_tag_get_title (dataset->record, dataset->tag));
|
||||||
|
|
|
@ -50,7 +50,10 @@
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
metadataparse_iptc_dump(GstAdapter *adapter);
|
metadataparse_iptc_tag_list_add (GstTagList *taglist, GstTagMergeMode mode, GstAdapter * adapter);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
metadataparse_iptc_tags_register (void);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -46,10 +46,16 @@
|
||||||
GST_DEBUG_CATEGORY (gst_metadata_parse_xmp_debug);
|
GST_DEBUG_CATEGORY (gst_metadata_parse_xmp_debug);
|
||||||
#define GST_CAT_DEFAULT gst_metadata_parse_xmp_debug
|
#define GST_CAT_DEFAULT gst_metadata_parse_xmp_debug
|
||||||
|
|
||||||
|
void
|
||||||
|
metadataparse_xmp_tags_register (void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef HAVE_XMP
|
#ifndef HAVE_XMP
|
||||||
|
|
||||||
void
|
void
|
||||||
metadataparse_xmp_dump (GstAdapter * adapter)
|
metadataparse_xmp_tag_list_add (GstTagList * taglist, GstTagMergeMode mode,
|
||||||
|
GstAdapter * adapter)
|
||||||
{
|
{
|
||||||
|
|
||||||
GST_LOG ("XMP not defined, here I should send just one tag as whole chunk");
|
GST_LOG ("XMP not defined, here I should send just one tag as whole chunk");
|
||||||
|
@ -59,7 +65,8 @@ metadataparse_xmp_dump (GstAdapter * adapter)
|
||||||
#else /* ifndef HAVE_XMP */
|
#else /* ifndef HAVE_XMP */
|
||||||
|
|
||||||
void
|
void
|
||||||
metadataparse_xmp_dump (GstAdapter * adapter)
|
metadataparse_xmp_tag_list_add (GstTagList * taglist, GstTagMergeMode mode,
|
||||||
|
GstAdapter * adapter)
|
||||||
{
|
{
|
||||||
|
|
||||||
GST_LOG ("XMP still not implemented");
|
GST_LOG ("XMP still not implemented");
|
||||||
|
|
|
@ -50,7 +50,10 @@
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
metadataparse_xmp_dump(GstAdapter *adapter);
|
metadataparse_xmp_tag_list_add (GstTagList *taglist, GstTagMergeMode mode, GstAdapter * adapter);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
metadataparse_xmp_tags_register (void);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue