diff options
author | Edgard Lima <edgard.lima@indt.org.br> | 2007-10-31 16:21:02 +0000 |
---|---|---|
committer | Edgard Lima <edgard.lima@indt.org.br> | 2007-10-31 16:21:02 +0000 |
commit | 5888898c570f0f22c930d8c66fe0949d00a90b93 (patch) | |
tree | eb33f602f1c1a1ddda3274c89a819f6f44f3591e /ext/metadata/metadataparseiptc.c | |
parent | 7412141912cc527a231697e38793871b17e6425b (diff) | |
download | gst-plugins-bad-5888898c570f0f22c930d8c66fe0949d00a90b93.tar.gz gst-plugins-bad-5888898c570f0f22c930d8c66fe0949d00a90b93.tar.bz2 gst-plugins-bad-5888898c570f0f22c930d8c66fe0949d00a90b93.zip |
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).
Diffstat (limited to 'ext/metadata/metadataparseiptc.c')
-rw-r--r-- | ext/metadata/metadataparseiptc.c | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/ext/metadata/metadataparseiptc.c b/ext/metadata/metadataparseiptc.c index b6d0e4cf..9c983a70 100644 --- a/ext/metadata/metadataparseiptc.c +++ b/ext/metadata/metadataparseiptc.c @@ -46,14 +46,46 @@ 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); +} + +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 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"); + metadataparse_tag_list_add_chunk (taglist, mode, GST_TAG_IPTC, adapter); + } #else /* ifndef HAVE_IPTC */ @@ -64,7 +96,8 @@ static void iptc_data_foreach_dataset_func (IptcDataSet * dataset, void *user_data); void -metadataparse_iptc_dump (GstAdapter * adapter) +metadataparse_iptc_tag_list_add (GstTagList * taglist, GstTagMergeMode mode, + GstAdapter * adapter) { const guint8 *buf; guint32 size; @@ -74,6 +107,9 @@ metadataparse_iptc_dump (GstAdapter * adapter) goto done; } + /* add chunk tag */ + metadataparse_tag_list_add_chunk (taglist, mode, GST_TAG_IPTC, adapter); + buf = gst_adapter_peek (adapter, size); iptc = iptc_data_new_from_data (buf, size); @@ -81,7 +117,8 @@ metadataparse_iptc_dump (GstAdapter * adapter) 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: @@ -97,6 +134,7 @@ iptc_data_foreach_dataset_func (IptcDataSet * dataset, void *user_data) { char *buf[256]; + GstTagList *taglist = (GstTagList *) user_data; GST_LOG ("name -> %s", iptc_tag_get_name (dataset->record, dataset->tag)); GST_LOG ("title -> %s", iptc_tag_get_title (dataset->record, dataset->tag)); |