summaryrefslogtreecommitdiffstats
path: root/ext/metadata/metadataexif.c
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sf.net>2009-01-23 14:43:00 +0200
committerStefan Kost <ensonic@users.sf.net>2009-01-23 15:14:24 +0200
commit93df7379e47144261787378fa195cad676b855ad (patch)
treea2b473a74c664b01516d9b49b379655471aa4bbb /ext/metadata/metadataexif.c
parente4e3b44e048ddc1d7499c6108175a5f89c6273d9 (diff)
downloadgst-plugins-bad-93df7379e47144261787378fa195cad676b855ad.tar.gz
gst-plugins-bad-93df7379e47144261787378fa195cad676b855ad.tar.bz2
gst-plugins-bad-93df7379e47144261787378fa195cad676b855ad.zip
Configure byte order for EXIF. Fixes #568704
Exif blocks can be in differnt byte orders. Add an element property to select wich one should be written.
Diffstat (limited to 'ext/metadata/metadataexif.c')
-rw-r--r--ext/metadata/metadataexif.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/ext/metadata/metadataexif.c b/ext/metadata/metadataexif.c
index 6924511d..73cb275b 100644
--- a/ext/metadata/metadataexif.c
+++ b/ext/metadata/metadataexif.c
@@ -69,6 +69,23 @@
GST_DEBUG_CATEGORY (gst_metadata_exif_debug);
#define GST_CAT_DEFAULT gst_metadata_exif_debug
+GType
+gst_meta_exif_byte_order_get_type (void)
+{
+ static GType meta_exif_byte_order_type = 0;
+ static const GEnumValue meta_exif_byte_order[] = {
+ {GST_META_EXIF_BYTE_ORDER_MOTOROLA, "Motorola byte-order", "Motorola"},
+ {GST_META_EXIF_BYTE_ORDER_INTEL, "Intel byte-order", "Intel"},
+ {0, NULL, NULL},
+ };
+
+ if (!meta_exif_byte_order_type) {
+ meta_exif_byte_order_type =
+ g_enum_register_static ("MetaExifByteOrder", meta_exif_byte_order);
+ }
+ return meta_exif_byte_order_type;
+}
+
/*
* Implementation when libexif isn't available at compilation time
*/
@@ -95,7 +112,7 @@ metadataparse_exif_tag_list_add (GstTagList * taglist, GstTagMergeMode mode,
void
metadatamux_exif_create_chunk_from_tag_list (guint8 ** buf, guint32 * size,
- const GstTagList * taglist)
+ const GstTagList * taglist, const MetaExifWriteOptions * opts)
{
/* do nothing */
}
@@ -353,6 +370,7 @@ done:
* @buf: buffer that will have the created EXIF chunk
* @size: size of the buffer that will be created
* @taglist: list of tags to be added to EXIF chunk
+ * @opts: write options for exif metadata
*
* Get tags from @taglist, create a EXIF chunk based on it and save to @buf.
* Note: The EXIF chunk is NOT wrapped by any bytes specific to any file format
@@ -362,7 +380,7 @@ done:
void
metadatamux_exif_create_chunk_from_tag_list (guint8 ** buf, guint32 * size,
- const GstTagList * taglist)
+ const GstTagList * taglist, const MetaExifWriteOptions * opts)
{
ExifData *ed = NULL;
GstBuffer *exif_chunk = NULL;
@@ -387,6 +405,17 @@ metadatamux_exif_create_chunk_from_tag_list (guint8 ** buf, guint32 * size,
if (!ed) {
ed = exif_data_new ();
+ GST_DEBUG ("setting byteorder %d", opts->byteorder);
+ switch (opts->byteorder) {
+ case GST_META_EXIF_BYTE_ORDER_MOTOROLA:
+ exif_data_set_byte_order (ed, EXIF_BYTE_ORDER_MOTOROLA);
+ break;
+ case GST_META_EXIF_BYTE_ORDER_INTEL:
+ exif_data_set_byte_order (ed, EXIF_BYTE_ORDER_INTEL);
+ break;
+ default:
+ break;
+ }
exif_data_set_data_type (ed, EXIF_DATA_TYPE_COMPRESSED);
exif_data_fix (ed);
}