diff options
author | Edgard Lima <edgard.lima@indt.org.br> | 2007-11-01 16:04:29 +0000 |
---|---|---|
committer | Edgard Lima <edgard.lima@indt.org.br> | 2007-11-01 16:04:29 +0000 |
commit | 929954f595220293179b7ce22f563f1707934566 (patch) | |
tree | 786173419229d5f8f8bbbb28dd201a27d75baeeb /ext/metadata/metadataparsejpeg.c | |
parent | 5888898c570f0f22c930d8c66fe0949d00a90b93 (diff) | |
download | gst-plugins-bad-929954f595220293179b7ce22f563f1707934566.tar.gz gst-plugins-bad-929954f595220293179b7ce22f563f1707934566.tar.bz2 gst-plugins-bad-929954f595220293179b7ce22f563f1707934566.zip |
Some XMP stuff added.
Original commit message from CVS:
Some XMP stuff added.
Diffstat (limited to 'ext/metadata/metadataparsejpeg.c')
-rw-r--r-- | ext/metadata/metadataparsejpeg.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/ext/metadata/metadataparsejpeg.c b/ext/metadata/metadataparsejpeg.c index bf453a12..753d436a 100644 --- a/ext/metadata/metadataparsejpeg.c +++ b/ext/metadata/metadataparsejpeg.c @@ -66,6 +66,10 @@ metadataparse_jpeg_iptc (JpegData * jpeg_data, guint8 ** buf, guint32 * bufsize, guint8 ** next_start, guint32 * next_size); static int +metadataparse_jpeg_xmp (JpegData * jpeg_data, guint8 ** buf, + guint32 * bufsize, guint8 ** next_start, guint32 * next_size); + +static int metadataparse_jpeg_jump (JpegData * jpeg_data, guint8 ** buf, guint32 * bufsize, guint8 ** next_start, guint32 * next_size); @@ -80,11 +84,14 @@ metadataparse_jpeg_init (JpegData * jpeg_data, GstAdapter ** adpt_exif, jpeg_data->adpt_iptc = adpt_iptc; jpeg_data->adpt_xmp = adpt_xmp; jpeg_data->read = 0; + + metadataparse_xmp_init (); } void metadataparse_jpeg_dispose (JpegData * jpeg_data) { + metadataparse_xmp_dispose (); jpeg_data->adpt_exif = NULL; jpeg_data->adpt_iptc = NULL; @@ -143,6 +150,11 @@ metadataparse_jpeg_parse (JpegData * jpeg_data, guint8 * buf, metadataparse_jpeg_iptc (jpeg_data, &buf, bufsize, next_start, next_size); break; + case JPEG_XMP: + ret = + metadataparse_jpeg_xmp (jpeg_data, &buf, bufsize, next_start, + next_size); + break; case JPEG_DONE: goto done; break; @@ -172,6 +184,7 @@ metadataparse_jpeg_reading (JpegData * jpeg_data, guint8 ** buf, static const unsigned char ExifHeader[] = { 0x45, 0x78, 0x69, 0x66, 0x00, 0x00 }; static const char IptcHeader[] = "Photoshop 3.0"; + static const char XmpHeader[] = "http://ns.adobe.com/xap/1.0/"; *next_start = *buf; @@ -204,7 +217,8 @@ metadataparse_jpeg_reading (JpegData * jpeg_data, guint8 ** buf, chunk_size = READ (*buf, *bufsize) << 8; chunk_size += READ (*buf, *bufsize); - if (mark[1] == 0xE1) { /* may be it is Exif */ + if (mark[1] == 0xE1) { /* may be it is Exif or XMP */ + if (chunk_size >= 8) { /* size2 'EXIF' 0x00 0x00 */ guint8 ch; @@ -222,6 +236,22 @@ metadataparse_jpeg_reading (JpegData * jpeg_data, guint8 ** buf, goto done; } } + if (chunk_size >= 31) { /* size2 "http://ns.adobe.com/xap/1.0/" */ + if (*bufsize < 29) { + *next_size = (*buf - *next_start) + 29; + ret = 1; + goto done; + } + + if (jpeg_data->adpt_xmp) { + if (0 == memcmp (XmpHeader, *buf, 29)) { + jpeg_data->read = chunk_size - 2; + ret = 0; + jpeg_data->state = JPEG_XMP; + goto done; + } + } + } } } else if (mark[1] == 0xED) { /* may be it is photoshop and may be there is iptc */ if (chunk_size >= 16) { /* size2 "Photoshop 3.0" */ @@ -350,6 +380,16 @@ metadataparse_jpeg_iptc (JpegData * jpeg_data, guint8 ** buf, } static int +metadataparse_jpeg_xmp (JpegData * jpeg_data, guint8 ** buf, + guint32 * bufsize, guint8 ** next_start, guint32 * next_size) +{ + + return metadataparse_jpeg_hold_chunk (jpeg_data, buf, + bufsize, next_start, next_size, jpeg_data->adpt_xmp); + +} + +static int metadataparse_jpeg_jump (JpegData * jpeg_data, guint8 ** buf, guint32 * bufsize, guint8 ** next_start, guint32 * next_size) { |