Code documentation.

Original commit message from CVS:
Code documentation.
This commit is contained in:
Edgard Lima 2007-12-13 17:19:54 +00:00
parent 334b512629
commit 7bc241beb0
19 changed files with 379 additions and 250 deletions

View file

@ -1,3 +1,25 @@
2007-12-13 Edgard Lima <edgard.lima@indt.org.br>
* ext/metadata/TODO:
* ext/metadata/gstmetadatamux.c:
* ext/metadata/gstmetadataparse.c:
* ext/metadata/metadata.c:
* ext/metadata/metadata.h:
* ext/metadata/metadataiptc.c:
* ext/metadata/metadatamuxjpeg.c:
* ext/metadata/metadatamuxjpeg.h:
* ext/metadata/metadatamuxpng.c:
* ext/metadata/metadatamuxpng.h:
* ext/metadata/metadataparsejpeg.c:
* ext/metadata/metadataparsejpeg.h:
* ext/metadata/metadataparsepng.c:
* ext/metadata/metadataparsepng.h:
* ext/metadata/metadataparseutil.c:
* ext/metadata/metadataparseutil.h:
* ext/metadata/metadatatypes.h:
* ext/metadata/metadataxmp.c:
Code documentation.
2007-12-13 Edgard Lima <edgard.lima@indt.org.br>
* configure.ac:

18
ext/metadata/TODO Normal file
View file

@ -0,0 +1,18 @@
This file contains a list of things to be done as well some open issues (questions) related to design/implementation.
TODO:
1- Add individual tags IPTC and XMP (and more for EXIF)
2- Use GST_TYPE_FRACTION for Rational and SRational (metadataexif.c)
3- Get properties like 'width' and 'height' from caps
4- Review the code (in order to move to gst-plugins-good)
5- Document how the plugin works (atchitecture and interaction beteween modules)
OPEN ISSUES:
1- What is (How) the best way to delete some tag?
2- How to change metadata when the orignal image was modified.
ex: file.jpeg has XMP, then we do filesrc ! metadataparse ! jpegdec ! pngenc ! metadatamux ! files
is the metadata still valid? which fields are no valid anymore?

View file

@ -157,7 +157,7 @@ static gboolean gst_metadata_mux_configure_srccaps (GstMetadataMux * filter);
static gboolean gst_metadata_mux_configure_caps (GstMetadataMux * filter);
static int
gst_metadata_mux_mux (GstMetadataMux * filter, const guint8 * buf,
gst_metadata_mux_parse (GstMetadataMux * filter, const guint8 * buf,
guint32 size);
static void gst_metadata_mux_create_chunks_from_tags (GstMetadataMux * filter);
@ -976,11 +976,21 @@ gst_metadata_mux_calculate_offsets (GstMetadataMux * filter)
}
/*
* Do parsing step-by-step and reconfigure caps if need
* return:
* META_PARSING_ERROR
* META_PARSING_DONE
* META_PARSING_NEED_MORE_DATA
*/
static int
gst_metadata_mux_mux (GstMetadataMux * filter, const guint8 * buf, guint32 size)
gst_metadata_mux_parse (GstMetadataMux * filter, const guint8 * buf,
guint32 size)
{
int ret = -1;
int ret = META_PARSING_ERROR;
filter->next_offset = 0;
filter->next_size = 0;
@ -988,14 +998,14 @@ gst_metadata_mux_mux (GstMetadataMux * filter, const guint8 * buf, guint32 size)
ret = metadata_parse (&filter->mux_data, buf, size,
&filter->next_offset, &filter->next_size);
if (ret < 0) {
if (ret == META_PARSING_ERROR) {
if (META_DATA_IMG_TYPE (filter->mux_data) == IMG_NONE) {
/* image type not recognized */
GST_ELEMENT_ERROR (filter, STREAM, TYPE_NOT_FOUND, (NULL),
("Only jpeg and png are supported"));
goto done;
}
} else if (ret > 0) {
} else if (ret == META_PARSING_NEED_MORE_DATA) {
filter->need_more_data = TRUE;
} else {
filter->state = MT_STATE_MUXED;
@ -1009,7 +1019,7 @@ gst_metadata_mux_mux (GstMetadataMux * filter, const guint8 * buf, guint32 size)
GST_ELEMENT_ERROR (filter, STREAM, FORMAT, (NULL),
("Couldn't reconfigure caps for %s",
gst_metadata_mux_get_type_name (filter->img_type)));
ret = -1;
ret = META_PARSING_ERROR;
goto done;
}
}
@ -1082,10 +1092,13 @@ gst_metadata_mux_chain (GstPad * pad, GstBuffer * buf)
const guint8 *new_buf =
gst_adapter_peek (filter->adapter_parsing, adpt_size);
if (gst_metadata_mux_mux (filter, new_buf, adpt_size) < 0)
if (gst_metadata_mux_parse (filter, new_buf,
adpt_size) == META_PARSING_ERROR) {
ret = GST_FLOW_ERROR;
goto done;
}
}
}
if (filter->state == MT_STATE_MUXED) {
@ -1098,9 +1111,11 @@ gst_metadata_mux_chain (GstPad * pad, GstBuffer * buf)
}
if (filter->need_calculate_offset) {
if (!gst_metadata_mux_calculate_offsets (filter))
if (!gst_metadata_mux_calculate_offsets (filter)) {
ret = GST_FLOW_ERROR;
goto done;
}
}
if (filter->offset_orig + GST_BUFFER_SIZE (buf) == filter->duration_orig)
append = TRUE;
@ -1188,8 +1203,13 @@ gst_metadata_mux_pull_range_mux (GstMetadataMux * filter)
offset += filter->next_offset;
/* 'filter->next_size' only says the minimum required number of bytes.
We try provided more bytes (4096) just to avoid a lot of calls to 'metadata_parse'
returning META_PARSING_NEED_MORE_DATA */
if (filter->next_size < 4096) {
if (duration - offset < 4096) {
/* In case there is no 4096 bytes available upstream.
It should be done upstream but we do here for safety */
filter->next_size = duration - offset;
} else {
filter->next_size = 4096;
@ -1204,16 +1224,16 @@ gst_metadata_mux_pull_range_mux (GstMetadataMux * filter)
}
res =
gst_metadata_mux_mux (filter, GST_BUFFER_DATA (buf),
gst_metadata_mux_parse (filter, GST_BUFFER_DATA (buf),
GST_BUFFER_SIZE (buf));
if (res < 0) {
if (res == META_PARSING_ERROR) {
ret = FALSE;
goto done;
}
gst_buffer_unref (buf);
} while (res > 0);
} while (res == META_PARSING_NEED_MORE_DATA);
done:

View file

@ -932,10 +932,11 @@ gst_metadata_parse_calculate_offsets (GstMetadataParse * filter)
}
/*
* Do parsing step-by-step and reconfigure caps if need
* return:
* -1 -> error
* 0 -> succeded
* 1 -> need more data
* META_PARSING_ERROR
* META_PARSING_DONE
* META_PARSING_NEED_MORE_DATA
*/
static int
@ -943,7 +944,7 @@ gst_metadata_parse_parse (GstMetadataParse * filter, const guint8 * buf,
guint32 size)
{
int ret = -1;
int ret = META_PARSING_ERROR;
filter->next_offset = 0;
filter->next_size = 0;
@ -951,14 +952,14 @@ gst_metadata_parse_parse (GstMetadataParse * filter, const guint8 * buf,
ret = metadata_parse (&filter->parse_data, buf, size,
&filter->next_offset, &filter->next_size);
if (ret < 0) {
if (ret == META_PARSING_ERROR) {
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"));
goto done;
}
} else if (ret > 0) {
} else if (ret == META_PARSING_NEED_MORE_DATA) {
filter->need_more_data = TRUE;
} else {
gst_metadata_parse_calculate_offsets (filter);
@ -968,13 +969,14 @@ gst_metadata_parse_parse (GstMetadataParse * filter, const guint8 * buf,
filter->need_send_tag = TRUE;
}
/* reconfigure caps if it is different from type detected by 'metadata_parse' function */
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",
gst_metadata_parse_get_type_name (filter->img_type)));
ret = -1;
ret = META_PARSING_ERROR;
goto done;
}
}
@ -1047,10 +1049,13 @@ gst_metadata_parse_chain (GstPad * pad, GstBuffer * buf)
const guint8 *new_buf =
gst_adapter_peek (filter->adapter_parsing, adpt_size);
if (gst_metadata_parse_parse (filter, new_buf, adpt_size) < 0)
if (gst_metadata_parse_parse (filter, new_buf,
adpt_size) == META_PARSING_ERROR) {
ret = GST_FLOW_ERROR;
goto done;
}
}
}
if (filter->state == MT_STATE_PARSED) {
@ -1151,8 +1156,13 @@ gst_metadata_parse_pull_range_parse (GstMetadataParse * filter)
offset += filter->next_offset;
/* 'filter->next_size' only says the minimum required number of bytes.
We try provided more bytes (4096) just to avoid a lot of calls to 'metadata_parse'
returning META_PARSING_NEED_MORE_DATA */
if (filter->next_size < 4096) {
if (duration - offset < 4096) {
/* In case there is no 4096 bytes available upstream.
It should be done upstream but we do here for safety */
filter->next_size = duration - offset;
} else {
filter->next_size = 4096;
@ -1169,14 +1179,14 @@ gst_metadata_parse_pull_range_parse (GstMetadataParse * filter)
res =
gst_metadata_parse_parse (filter, GST_BUFFER_DATA (buf),
GST_BUFFER_SIZE (buf));
if (res < 0) {
if (res == META_PARSING_ERROR) {
ret = FALSE;
goto done;
}
gst_buffer_unref (buf);
} while (res > 0);
} while (res == META_PARSING_NEED_MORE_DATA);
done:

View file

@ -49,16 +49,26 @@
*static declarations
*/
static int
static MetadataParsingReturn
metadata_parse_none (MetaData * meta_data, const guint8 * buf,
guint32 * bufsize, guint8 ** next_start, guint32 * next_size);
/*
* extern implementation
* extern functions implementations
*/
/*
* Init metadata handle vars.
* This function must becalled before any other function from this module.
* This functoin must not be called twice without call 'metadata_dispose'
* beteween them.
* meta_data [in]: metadata handler to be inited
* parse [in]: pass TRUE for demuxing and FALSE for muxing
* options [in]: which types of metadata will be processed (EXIF, IPTC and/or XMP).
* Look at 'MetaOption' to see the available options.
*/
void
metadata_init (MetaData * meta_data, gboolean parse, guint8 options)
metadata_init (MetaData * meta_data, const gboolean parse, const guint8 options)
{
meta_data->state = STATE_NULL;
meta_data->img_type = IMG_NONE;
@ -70,85 +80,25 @@ metadata_init (MetaData * meta_data, gboolean parse, guint8 options)
meta_data->parse = parse;
if (parse) {
/* when parsing we will probably strip only 3 chunk (exif, iptc and xmp)
so we use 4 just in case there is more than one chunk of them.
But this is just for convinience, 'cause the chunk_array incriases dinamically */
metadata_chunk_array_init (&meta_data->strip_chunks, 4);
/* at most 1 chunk will be injected (JPEG JFIF) */
metadata_chunk_array_init (&meta_data->inject_chunks, 1);
} else {
/* at most 1 chunk will be striped (JPEG JFIF) */
metadata_chunk_array_init (&meta_data->strip_chunks, 1);
/* at most 3 chunk will be injected (EXIF, IPTC, XMP) */
metadata_chunk_array_init (&meta_data->inject_chunks, 3);
}
}
/*
* offset: number of bytes to jump (just a hint to jump a chunk)
* size: number of bytes to read on next call (just a hint to get all chunk)
* return:
* -1 -> error
* 0 -> done
* 1 -> need more data
* Dispose medadata handler data.
* Call this function to free any resource allocated by 'metadata_init'
*/
int
metadata_parse (MetaData * meta_data, const guint8 * buf,
guint32 bufsize, guint32 * next_offset, guint32 * next_size)
{
int ret = 0;
guint8 *next_start = (guint8 *) buf;
if (meta_data->state == STATE_NULL) {
ret =
metadata_parse_none (meta_data, buf, &bufsize, &next_start, next_size);
if (ret == 0)
meta_data->state = STATE_READING;
else
goto done;
}
switch (meta_data->img_type) {
case IMG_JPEG:
if (G_LIKELY (meta_data->parse))
ret =
metadataparse_jpeg_parse (&meta_data->format_data.jpeg_parse,
(guint8 *) buf, &bufsize, meta_data->offset_orig, &next_start,
next_size);
else
ret =
metadatamux_jpeg_parse (&meta_data->format_data.jpeg_mux,
(guint8 *) buf, &bufsize, meta_data->offset_orig, &next_start,
next_size);
break;
case IMG_PNG:
if (G_LIKELY (meta_data->parse))
ret =
metadataparse_png_parse (&meta_data->format_data.png_parse,
(guint8 *) buf, &bufsize, meta_data->offset_orig, &next_start,
next_size);
else
ret =
metadatamux_png_parse (&meta_data->format_data.png_mux,
(guint8 *) buf, &bufsize, meta_data->offset_orig, &next_start,
next_size);
break;
default:
/* unexpected */
ret = -1;
goto done;
break;
}
*next_offset = next_start - buf;
meta_data->offset_orig += *next_offset;
done:
if (ret == 0) {
meta_data->state = STATE_DONE;
}
return ret;
}
void
metadata_dispose (MetaData * meta_data)
{
@ -189,73 +139,95 @@ metadata_dispose (MetaData * meta_data)
}
/*
* static implementation
* meta_data [in]: metata handle
* buf [in]: data to be parsed
* bufsize [in]: size of data in bytes
* next_offset [out]: number of bytes to jump from the begining of 'buf' in the next call.
* i.e, 0 (zero) mean that in the next call to function "buf" must have the same
* data (probably resized, see 'size')
* size [out]: number of minimal bytes in buf for the next call to this function
* return:
* META_PARSING_ERROR
* META_PARSING_DONE
* META_PARSING_NEED_MORE_DATA (look 'next_offset' and 'size')
* when this function returns 0 you have strip and inject chunks ready to use
* If you change the contents of strip and inject chunks, you have to call
* 'metadata_lazy_update' (this is the case when muxing)
* see MetaData->strip_chunks and MetaData->inject_chunks
*/
/* find image type */
static int
metadata_parse_none (MetaData * meta_data, const guint8 * buf,
guint32 * bufsize, guint8 ** next_start, guint32 * next_size)
MetadataParsingReturn
metadata_parse (MetaData * meta_data, const guint8 * buf,
guint32 bufsize, guint32 * next_offset, guint32 * next_size)
{
int ret = -1;
GstAdapter **exif = NULL;
GstAdapter **iptc = NULL;
GstAdapter **xmp = NULL;
int ret = META_PARSING_DONE;
*next_start = (guint8 *) buf;
guint8 *next_start = (guint8 *) buf;
meta_data->img_type = IMG_NONE;
if (*bufsize < 3) {
*next_size = 3;
ret = 1;
goto done;
}
if (meta_data->options & META_OPT_EXIF)
exif = &meta_data->exif_adapter;
if (meta_data->options & META_OPT_IPTC)
iptc = &meta_data->iptc_adapter;
if (meta_data->options & META_OPT_XMP)
xmp = &meta_data->xmp_adapter;
if (buf[0] == 0xFF && buf[1] == 0xD8 && buf[2] == 0xFF) {
if (G_LIKELY (meta_data->parse))
metadataparse_jpeg_init (&meta_data->format_data.jpeg_parse, exif, iptc,
xmp, &meta_data->strip_chunks, &meta_data->inject_chunks);
if (meta_data->state == STATE_NULL) {
ret =
metadata_parse_none (meta_data, buf, &bufsize, &next_start, next_size);
if (ret == META_PARSING_DONE)
meta_data->state = STATE_READING;
else
metadatamux_jpeg_init (&meta_data->format_data.jpeg_mux,
&meta_data->strip_chunks, &meta_data->inject_chunks);
ret = 0;
meta_data->img_type = IMG_JPEG;
goto done;
}
if (*bufsize < 8) {
*next_size = 8;
ret = 1;
goto done;
}
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) {
switch (meta_data->img_type) {
case IMG_JPEG:
if (G_LIKELY (meta_data->parse))
metadataparse_png_init (&meta_data->format_data.png_parse, exif, iptc,
xmp, &meta_data->strip_chunks, &meta_data->inject_chunks);
ret =
metadataparse_jpeg_parse (&meta_data->format_data.jpeg_parse,
(guint8 *) buf, &bufsize, meta_data->offset_orig, &next_start,
next_size);
else
metadatamux_png_init (&meta_data->format_data.png_mux,
&meta_data->strip_chunks, &meta_data->inject_chunks);
ret = 0;
meta_data->img_type = IMG_PNG;
ret =
metadatamux_jpeg_parse (&meta_data->format_data.jpeg_mux,
(guint8 *) buf, &bufsize, meta_data->offset_orig, &next_start,
next_size);
break;
case IMG_PNG:
if (G_LIKELY (meta_data->parse))
ret =
metadataparse_png_parse (&meta_data->format_data.png_parse,
(guint8 *) buf, &bufsize, meta_data->offset_orig, &next_start,
next_size);
else
ret =
metadatamux_png_parse (&meta_data->format_data.png_mux,
(guint8 *) buf, &bufsize, meta_data->offset_orig, &next_start,
next_size);
break;
default:
/* unexpected */
ret = META_PARSING_ERROR;
goto done;
break;
}
*next_offset = next_start - buf;
meta_data->offset_orig += *next_offset;
done:
if (ret == META_PARSING_DONE) {
meta_data->state = STATE_DONE;
}
return ret;
}
/*
* This function must be called after 'metadata_parse' and after the element has modified the 'segments'.
* This function is really importante in case o muxing 'cause:
* 1- 'cause gives the oportunity to muxers to wrapper new segments with apropriate bytes
* ex: in case of JPEG it can wrap the EXIF chunk (created using tags) with chunk id and chunk size
* 2- 'cause gives the oportunity to muxer to decide if some chunks should still be striped/injected
* ex: if there is no EXIF chunk to be inserted, the muxer decides to not strip JFIF anymore
* see MetaData->strip_chunks and MetaData->inject_chunks
*/
void
metadata_lazy_update (MetaData * meta_data)
{
@ -278,3 +250,81 @@ metadata_lazy_update (MetaData * meta_data)
}
}
/*
* static functions implementation
*/
/*
* Find out the type of the stream
*/
static MetadataParsingReturn
metadata_parse_none (MetaData * meta_data, const guint8 * buf,
guint32 * bufsize, guint8 ** next_start, guint32 * next_size)
{
int ret = META_PARSING_ERROR;
GstAdapter **exif = NULL;
GstAdapter **iptc = NULL;
GstAdapter **xmp = NULL;
*next_start = (guint8 *) buf;
meta_data->img_type = IMG_NONE;
/*
* Be sure of add checking for more types in order from the
* less to more bytes need to detect the stream type.
*/
/* we need at least 3 bytes to see if it is JPEG */
if (*bufsize < 3) {
*next_size = 3;
ret = META_PARSING_NEED_MORE_DATA;
goto done;
}
if (meta_data->options & META_OPT_EXIF)
exif = &meta_data->exif_adapter;
if (meta_data->options & META_OPT_IPTC)
iptc = &meta_data->iptc_adapter;
if (meta_data->options & META_OPT_XMP)
xmp = &meta_data->xmp_adapter;
if (buf[0] == 0xFF && buf[1] == 0xD8 && buf[2] == 0xFF) {
if (G_LIKELY (meta_data->parse))
metadataparse_jpeg_init (&meta_data->format_data.jpeg_parse, exif, iptc,
xmp, &meta_data->strip_chunks, &meta_data->inject_chunks);
else
metadatamux_jpeg_init (&meta_data->format_data.jpeg_mux,
&meta_data->strip_chunks, &meta_data->inject_chunks);
ret = META_PARSING_DONE;
meta_data->img_type = IMG_JPEG;
goto done;
}
/* we need at least 8 bytes to see if it is PNG */
if (*bufsize < 8) {
*next_size = 8;
ret = META_PARSING_NEED_MORE_DATA;
goto done;
}
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) {
if (G_LIKELY (meta_data->parse))
metadataparse_png_init (&meta_data->format_data.png_parse, exif, iptc,
xmp, &meta_data->strip_chunks, &meta_data->inject_chunks);
else
metadatamux_png_init (&meta_data->format_data.png_mux,
&meta_data->strip_chunks, &meta_data->inject_chunks);
ret = META_PARSING_DONE;
meta_data->img_type = IMG_PNG;
goto done;
}
done:
return ret;
}

View file

@ -54,6 +54,8 @@
G_BEGIN_DECLS
/* *INDENT-OFF* */
typedef enum _tag_MetaOption
{
META_OPT_EXIF = (1 << 0),
@ -61,6 +63,7 @@ typedef enum _tag_MetaOption
META_OPT_XMP = (1 << 2),
META_OPT_ALL = (1 << 3) - 1
} MetaOption;
/* *INDENT-ON* */
typedef enum _tag_MetaState
{
@ -102,26 +105,16 @@ typedef struct _tag_MetaData
#define META_DATA_IMG_TYPE(p) (p).img_type
extern void metadata_init (MetaData * meta_data, gboolean parse, guint8 options);
extern void metadata_init (MetaData * meta_data, const gboolean parse, const guint8 options);
/*
* offset: number of bytes that MUST be jumped after current "buf" pointer
* next_size: number of minimum amount of bytes required on next step.
* if less than this is provided, the return will be 1 for sure.
* and the offset will be 0 (zero)
* return:
* -1 -> error
* 0 -> done
* 1 -> need more data
*/
extern int
extern void metadata_dispose (MetaData * meta_data);
extern MetadataParsingReturn
metadata_parse (MetaData * meta_data, const guint8 * buf,
guint32 bufsize, guint32 * next_offset, guint32 * next_size);
extern void metadata_lazy_update (MetaData * meta_data);
extern void metadata_dispose (MetaData * meta_data);
G_END_DECLS
#endif /* __METADATA_H__ */

View file

@ -75,6 +75,7 @@ metadatamux_iptc_create_chunk_from_tag_list (guint8 ** buf, guint32 * size,
#else /* ifndef HAVE_IPTC */
#include <iptc-data.h>
#include <string.h>
static void
iptc_data_foreach_dataset_func (IptcDataSet * dataset, void *user_data);
@ -122,7 +123,7 @@ static void
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));

View file

@ -49,7 +49,7 @@
#include <libiptcdata/iptc-jpeg.h>
#endif
static int
static MetadataParsingReturn
metadatamux_jpeg_reading (JpegMuxData * jpeg_data, guint8 ** buf,
guint32 * bufsize, const guint32 offset, const guint8 * step_buf,
guint8 ** next_start, guint32 * next_size);
@ -153,13 +153,13 @@ metadatamux_jpeg_dispose (JpegMuxData * jpeg_data)
jpeg_data->state = JPEG_MUX_NULL;
}
int
MetadataParsingReturn
metadatamux_jpeg_parse (JpegMuxData * jpeg_data, guint8 * buf,
guint32 * bufsize, const guint32 offset, guint8 ** next_start,
guint32 * next_size)
{
int ret = 0;
int ret = META_PARSING_DONE;
guint8 mark[2] = { 0x00, 0x00 };
const guint8 *step_buf = buf;
@ -169,7 +169,7 @@ metadatamux_jpeg_parse (JpegMuxData * jpeg_data, guint8 * buf,
if (*bufsize < 2) {
*next_size = (buf - *next_start) + 2;
ret = 1;
ret = META_PARSING_NEED_MORE_DATA;
goto done;
}
@ -177,7 +177,7 @@ metadatamux_jpeg_parse (JpegMuxData * jpeg_data, guint8 * buf,
mark[1] = READ (buf, *bufsize);
if (mark[0] != 0xFF || mark[1] != 0xD8) {
ret = -1;
ret = META_PARSING_ERROR;
goto done;
}
@ -185,7 +185,7 @@ metadatamux_jpeg_parse (JpegMuxData * jpeg_data, guint8 * buf,
}
while (ret == 0) {
while (ret == META_PARSING_DONE) {
switch (jpeg_data->state) {
case JPEG_MUX_READING:
ret =
@ -196,7 +196,7 @@ metadatamux_jpeg_parse (JpegMuxData * jpeg_data, guint8 * buf,
goto done;
break;
default:
ret = -1;
ret = META_PARSING_ERROR;
break;
}
}
@ -209,13 +209,13 @@ done:
/* look for markers */
static int
static MetadataParsingReturn
metadatamux_jpeg_reading (JpegMuxData * jpeg_data, guint8 ** buf,
guint32 * bufsize, const guint32 offset, const guint8 * step_buf,
guint8 ** next_start, guint32 * next_size)
{
int ret = -1;
int ret = META_PARSING_ERROR;
guint8 mark[2] = { 0x00, 0x00 };
guint16 chunk_size = 0;
gint64 new_chunk_offset = 0;
@ -232,7 +232,7 @@ metadatamux_jpeg_reading (JpegMuxData * jpeg_data, guint8 ** buf,
if (*bufsize < 2) {
*next_size = (*buf - *next_start) + 2;
ret = 1;
ret = META_PARSING_NEED_MORE_DATA;
goto done;
}
@ -249,7 +249,7 @@ metadatamux_jpeg_reading (JpegMuxData * jpeg_data, guint8 ** buf,
if (chunk_size >= 16) {
if (*bufsize < 5) {
*next_size = (*buf - *next_start) + 5;
ret = 1;
ret = META_PARSING_NEED_MORE_DATA;
goto done;
}
@ -263,7 +263,7 @@ metadatamux_jpeg_reading (JpegMuxData * jpeg_data, guint8 ** buf,
}
if (!jfif_found) {
ret = -1;
ret = META_PARSING_ERROR;
goto done;
}
@ -305,11 +305,11 @@ metadatamux_jpeg_reading (JpegMuxData * jpeg_data, guint8 ** buf,
metadata_chunk_array_append_sorted (jpeg_data->inject_chunks, &chunk);
jpeg_data->state = JPEG_MUX_DONE;
ret = 0;
ret = META_PARSING_DONE;
} else {
/* invalid JPEG chunk */
ret = -1;
ret = META_PARSING_ERROR;
}

View file

@ -76,7 +76,7 @@ extern void metadatamux_jpeg_dispose (JpegMuxData * jpeg_data);
extern void metadatamux_jpeg_lazy_update (JpegMuxData * jpeg_data);
int
extern MetadataParsingReturn
metadatamux_jpeg_parse (JpegMuxData * jpeg_data, guint8 * buf,
guint32 * bufsize, const guint32 offset, guint8 ** next_start, guint32 * next_size);

View file

@ -45,7 +45,7 @@
#include <string.h>
static int
static MetadataParsingReturn
metadatamux_png_reading (PngMuxData * png_data, guint8 ** buf,
guint32 * bufsize, const guint32 offset, const guint8 * step_buf,
guint8 ** next_start, guint32 * next_size);
@ -168,13 +168,13 @@ metadatamux_png_dispose (PngMuxData * png_data)
png_data->state = PNG_MUX_NULL;
}
int
MetadataParsingReturn
metadatamux_png_parse (PngMuxData * png_data, guint8 * buf,
guint32 * bufsize, const guint32 offset, guint8 ** next_start,
guint32 * next_size)
{
int ret = 0;
int ret = META_PARSING_DONE;
guint8 mark[8];
const guint8 *step_buf = buf;
@ -184,7 +184,7 @@ metadatamux_png_parse (PngMuxData * png_data, guint8 * buf,
if (*bufsize < 8) {
*next_size = (buf - *next_start) + 8;
ret = 1;
ret = META_PARSING_NEED_MORE_DATA;
goto done;
}
@ -200,7 +200,7 @@ metadatamux_png_parse (PngMuxData * png_data, guint8 * buf,
if (mark[0] != 0x89 || mark[1] != 0x50 || mark[2] != 0x4E || mark[3] != 0x47
|| mark[4] != 0x0D || mark[5] != 0x0A || mark[6] != 0x1A
|| mark[7] != 0x0A) {
ret = -1;
ret = META_PARSING_ERROR;
goto done;
}
@ -208,7 +208,7 @@ metadatamux_png_parse (PngMuxData * png_data, guint8 * buf,
}
while (ret == 0) {
while (ret == META_PARSING_DONE) {
switch (png_data->state) {
case PNG_MUX_READING:
ret =
@ -219,7 +219,7 @@ metadatamux_png_parse (PngMuxData * png_data, guint8 * buf,
goto done;
break;
default:
ret = -1;
ret = META_PARSING_ERROR;
break;
}
}
@ -232,13 +232,13 @@ done:
/* look for markers */
static int
static MetadataParsingReturn
metadatamux_png_reading (PngMuxData * png_data, guint8 ** buf,
guint32 * bufsize, const guint32 offset, const guint8 * step_buf,
guint8 ** next_start, guint32 * next_size)
{
int ret = -1;
int ret = META_PARSING_ERROR;
guint8 mark[4];
guint32 chunk_size = 0;
MetadataChunk chunk;
@ -249,7 +249,7 @@ metadatamux_png_reading (PngMuxData * png_data, guint8 ** buf,
if (*bufsize < 8) {
*next_size = (*buf - *next_start) + 8;
ret = 1;
ret = META_PARSING_NEED_MORE_DATA;
goto done;
}
@ -264,7 +264,7 @@ metadatamux_png_reading (PngMuxData * png_data, guint8 ** buf,
mark[3] = READ (*buf, *bufsize);
if (!(mark[0] == 'I' && mark[1] == 'H' && mark[2] == 'D' && mark[3] == 'R')) {
ret = -1;
ret = META_PARSING_ERROR;
png_data->state = PNG_MUX_NULL;
goto done;
}
@ -279,7 +279,7 @@ metadatamux_png_reading (PngMuxData * png_data, guint8 ** buf,
metadata_chunk_array_append_sorted (png_data->inject_chunks, &chunk);
png_data->state = PNG_MUX_DONE;
ret = 0;
ret = META_PARSING_DONE;
done:

View file

@ -78,7 +78,7 @@ extern void metadatamux_png_dispose (PngMuxData * png_data);
extern void metadatamux_png_lazy_update (PngMuxData * png_data);
int
extern MetadataParsingReturn
metadatamux_png_parse (PngMuxData * png_data, guint8 * buf,
guint32 * bufsize, const guint32 offset, guint8 ** next_start, guint32 * next_size);

View file

@ -49,26 +49,26 @@
#include <libiptcdata/iptc-jpeg.h>
#endif
static int
static MetadataParsingReturn
metadataparse_jpeg_reading (JpegParseData * jpeg_data, guint8 ** buf,
guint32 * bufsize, const guint32 offset, const guint8 * step_buf,
guint8 ** next_start, guint32 * next_size);
static int
static MetadataParsingReturn
metadataparse_jpeg_exif (JpegParseData * jpeg_data, guint8 ** buf,
guint32 * bufsize, guint8 ** next_start, guint32 * next_size);
#ifdef HAVE_IPTC
static int
static MetadataParsingReturn
metadataparse_jpeg_iptc (JpegParseData * jpeg_data, guint8 ** buf,
guint32 * bufsize, guint8 ** next_start, guint32 * next_size);
#endif
static int
static MetadataParsingReturn
metadataparse_jpeg_xmp (JpegParseData * jpeg_data, guint8 ** buf,
guint32 * bufsize, guint8 ** next_start, guint32 * next_size);
static int
static MetadataParsingReturn
metadataparse_jpeg_jump (JpegParseData * jpeg_data, guint8 ** buf,
guint32 * bufsize, guint8 ** next_start, guint32 * next_size);
@ -105,13 +105,13 @@ metadataparse_jpeg_dispose (JpegParseData * jpeg_data)
jpeg_data->xmp_adapter = NULL;
}
int
MetadataParsingReturn
metadataparse_jpeg_parse (JpegParseData * jpeg_data, guint8 * buf,
guint32 * bufsize, const guint32 offset, guint8 ** next_start,
guint32 * next_size)
{
int ret = 0;
int ret = META_PARSING_DONE;
guint8 mark[2] = { 0x00, 0x00 };
const guint8 *step_buf = buf;
@ -121,7 +121,7 @@ metadataparse_jpeg_parse (JpegParseData * jpeg_data, guint8 * buf,
if (*bufsize < 2) {
*next_size = (buf - *next_start) + 2;
ret = 1;
ret = META_PARSING_NEED_MORE_DATA;
goto done;
}
@ -129,7 +129,7 @@ metadataparse_jpeg_parse (JpegParseData * jpeg_data, guint8 * buf,
mark[1] = READ (buf, *bufsize);
if (mark[0] != 0xFF || mark[1] != 0xD8) {
ret = -1;
ret = META_PARSING_ERROR;
goto done;
}
@ -137,7 +137,7 @@ metadataparse_jpeg_parse (JpegParseData * jpeg_data, guint8 * buf,
}
while (ret == 0) {
while (ret == META_PARSING_DONE) {
switch (jpeg_data->state) {
case JPEG_PARSE_READING:
ret =
@ -170,7 +170,7 @@ metadataparse_jpeg_parse (JpegParseData * jpeg_data, guint8 * buf,
goto done;
break;
default:
ret = -1;
ret = META_PARSING_ERROR;
break;
}
}
@ -183,13 +183,13 @@ done:
/* look for markers */
static int
static MetadataParsingReturn
metadataparse_jpeg_reading (JpegParseData * jpeg_data, guint8 ** buf,
guint32 * bufsize, const guint32 offset, const guint8 * step_buf,
guint8 ** next_start, guint32 * next_size)
{
int ret = -1;
int ret = META_PARSING_ERROR;
guint8 mark[2] = { 0x00, 0x00 };
guint16 chunk_size = 0;
@ -203,7 +203,7 @@ metadataparse_jpeg_reading (JpegParseData * jpeg_data, guint8 ** buf,
if (*bufsize < 2) {
*next_size = (*buf - *next_start) + 2;
ret = 1;
ret = META_PARSING_NEED_MORE_DATA;
goto done;
}
@ -212,18 +212,18 @@ metadataparse_jpeg_reading (JpegParseData * jpeg_data, guint8 ** buf,
if (mark[0] == 0xFF) {
if (mark[1] == 0xD9) { /* end of image */
ret = 0;
ret = META_PARSING_DONE;
jpeg_data->state = JPEG_PARSE_DONE;
goto done;
} else if (mark[1] == 0xDA) { /* start of scan, lets not look behinf of this */
ret = 0;
ret = META_PARSING_DONE;
jpeg_data->state = JPEG_PARSE_DONE;
goto done;
}
if (*bufsize < 2) {
*next_size = (*buf - *next_start) + 2;
ret = 1;
ret = META_PARSING_NEED_MORE_DATA;
goto done;
}
@ -235,7 +235,7 @@ metadataparse_jpeg_reading (JpegParseData * jpeg_data, guint8 ** buf,
if (chunk_size >= 16) {
if (*bufsize < 14) {
*next_size = (*buf - *next_start) + 14;
ret = 1;
ret = META_PARSING_NEED_MORE_DATA;
goto done;
}
@ -251,7 +251,7 @@ metadataparse_jpeg_reading (JpegParseData * jpeg_data, guint8 ** buf,
if (*bufsize < 6) {
*next_size = (*buf - *next_start) + 6;
ret = 1;
ret = META_PARSING_NEED_MORE_DATA;
goto done;
}
@ -292,14 +292,14 @@ metadataparse_jpeg_reading (JpegParseData * jpeg_data, guint8 ** buf,
jpeg_data->read = chunk_size - 2;
jpeg_data->state = JPEG_PARSE_EXIF;
ret = 0;
ret = META_PARSING_DONE;
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;
ret = META_PARSING_NEED_MORE_DATA;
goto done;
}
@ -320,7 +320,7 @@ metadataparse_jpeg_reading (JpegParseData * jpeg_data, guint8 ** buf,
*bufsize -= 29;
jpeg_data->read = chunk_size - 2 - 29;
jpeg_data->state = JPEG_PARSE_XMP;
ret = 0;
ret = META_PARSING_DONE;
goto done;
}
}
@ -333,7 +333,7 @@ metadataparse_jpeg_reading (JpegParseData * jpeg_data, guint8 ** buf,
if (*bufsize < 14) {
*next_size = (*buf - *next_start) + 14;
ret = 1;
ret = META_PARSING_NEED_MORE_DATA;
goto done;
}
@ -352,7 +352,7 @@ metadataparse_jpeg_reading (JpegParseData * jpeg_data, guint8 ** buf,
if (jpeg_data->iptc_adapter) {
jpeg_data->read = chunk_size - 2;
jpeg_data->state = JPEG_PARSE_IPTC;
ret = 0;
ret = META_PARSING_DONE;
goto done;
}
}
@ -363,11 +363,11 @@ metadataparse_jpeg_reading (JpegParseData * jpeg_data, guint8 ** buf,
/* just set jump sise */
jpeg_data->read = chunk_size - 2;
jpeg_data->state = JPEG_PARSE_JUMPING;
ret = 0;
ret = META_PARSING_DONE;
} else {
/* invalid JPEG chunk */
ret = -1;
ret = META_PARSING_ERROR;
}
@ -378,7 +378,7 @@ done:
}
static int
static MetadataParsingReturn
metadataparse_jpeg_exif (JpegParseData * jpeg_data, guint8 ** buf,
guint32 * bufsize, guint8 ** next_start, guint32 * next_size)
{
@ -386,7 +386,7 @@ metadataparse_jpeg_exif (JpegParseData * jpeg_data, guint8 ** buf,
ret = metadataparse_util_hold_chunk (&jpeg_data->read, buf,
bufsize, next_start, next_size, jpeg_data->exif_adapter);
if (ret == 0) {
if (ret == META_PARSING_DONE) {
jpeg_data->state = JPEG_PARSE_READING;
@ -398,7 +398,7 @@ metadataparse_jpeg_exif (JpegParseData * jpeg_data, guint8 ** buf,
}
#ifdef HAVE_IPTC
static int
static MetadataParsingReturn
metadataparse_jpeg_iptc (JpegParseData * jpeg_data, guint8 ** buf,
guint32 * bufsize, guint8 ** next_start, guint32 * next_size)
{
@ -409,7 +409,7 @@ metadataparse_jpeg_iptc (JpegParseData * jpeg_data, guint8 ** buf,
bufsize, next_start, next_size, jpeg_data->iptc_adapter);
if (ret == 0) {
if (ret == META_PARSING_DONE) {
const guint8 *buf;
guint32 size;
@ -425,7 +425,7 @@ metadataparse_jpeg_iptc (JpegParseData * jpeg_data, guint8 ** buf,
if (res < 0) {
/* error */
ret = -1;
ret = META_PARSING_ERROR;
} else if (res == 0) {
/* no iptc data found */
gst_adapter_clear (*jpeg_data->iptc_adapter);
@ -451,7 +451,7 @@ metadataparse_jpeg_iptc (JpegParseData * jpeg_data, guint8 ** buf,
}
#endif
static int
static MetadataParsingReturn
metadataparse_jpeg_xmp (JpegParseData * jpeg_data, guint8 ** buf,
guint32 * bufsize, guint8 ** next_start, guint32 * next_size)
{
@ -460,7 +460,7 @@ metadataparse_jpeg_xmp (JpegParseData * jpeg_data, guint8 ** buf,
ret = metadataparse_util_hold_chunk (&jpeg_data->read, buf,
bufsize, next_start, next_size, jpeg_data->xmp_adapter);
if (ret == 0) {
if (ret == META_PARSING_DONE) {
jpeg_data->state = JPEG_PARSE_READING;
/* if there is a second XMP chunk in the file it will be jumped */
jpeg_data->xmp_adapter = NULL;
@ -468,7 +468,7 @@ metadataparse_jpeg_xmp (JpegParseData * jpeg_data, guint8 ** buf,
return ret;
}
static int
static MetadataParsingReturn
metadataparse_jpeg_jump (JpegParseData * jpeg_data, guint8 ** buf,
guint32 * bufsize, guint8 ** next_start, guint32 * next_size)
{

View file

@ -87,7 +87,7 @@ extern void metadataparse_jpeg_dispose (JpegParseData * jpeg_data);
extern void metadataparse_jpeg_lazy_update (JpegParseData * jpeg_data);
int
extern MetadataParsingReturn
metadataparse_jpeg_parse (JpegParseData * jpeg_data, guint8 * buf,
guint32 * bufsize, const guint32 offset, guint8 ** next_start, guint32 * next_size);

View file

@ -45,16 +45,16 @@
#include <string.h>
static int
static MetadataParsingReturn
metadataparse_png_reading (PngParseData * png_data, guint8 ** buf,
guint32 * bufsize, const guint32 offset, const guint8 * step_buf,
guint8 ** next_start, guint32 * next_size);
static int
static MetadataParsingReturn
metadataparse_png_xmp (PngParseData * png_data, guint8 ** buf,
guint32 * bufsize, guint8 ** next_start, guint32 * next_size);
static int
static MetadataParsingReturn
metadataparse_png_jump (PngParseData * png_data, guint8 ** buf,
guint32 * bufsize, guint8 ** next_start, guint32 * next_size);
@ -86,13 +86,13 @@ metadataparse_png_dispose (PngParseData * png_data)
png_data->xmp_adapter = NULL;
}
int
MetadataParsingReturn
metadataparse_png_parse (PngParseData * png_data, guint8 * buf,
guint32 * bufsize, const guint32 offset, guint8 ** next_start,
guint32 * next_size)
{
int ret = 0;
int ret = META_PARSING_DONE;
guint8 mark[8];
const guint8 *step_buf = buf;
@ -102,7 +102,7 @@ metadataparse_png_parse (PngParseData * png_data, guint8 * buf,
if (*bufsize < 8) {
*next_size = (buf - *next_start) + 8;
ret = 1;
ret = META_PARSING_NEED_MORE_DATA;
goto done;
}
@ -118,7 +118,7 @@ metadataparse_png_parse (PngParseData * png_data, guint8 * buf,
if (mark[0] != 0x89 || mark[1] != 0x50 || mark[2] != 0x4E || mark[3] != 0x47
|| mark[4] != 0x0D || mark[5] != 0x0A || mark[6] != 0x1A
|| mark[7] != 0x0A) {
ret = -1;
ret = META_PARSING_ERROR;
goto done;
}
@ -126,7 +126,7 @@ metadataparse_png_parse (PngParseData * png_data, guint8 * buf,
}
while (ret == 0) {
while (ret == META_PARSING_DONE) {
switch (png_data->state) {
case PNG_PARSE_READING:
ret =
@ -147,7 +147,7 @@ metadataparse_png_parse (PngParseData * png_data, guint8 * buf,
goto done;
break;
default:
ret = -1;
ret = META_PARSING_ERROR;
break;
}
}
@ -160,13 +160,13 @@ done:
/* look for markers */
static int
static MetadataParsingReturn
metadataparse_png_reading (PngParseData * png_data, guint8 ** buf,
guint32 * bufsize, const guint32 offset, const guint8 * step_buf,
guint8 ** next_start, guint32 * next_size)
{
int ret = -1;
int ret = META_PARSING_ERROR;
guint8 mark[4];
guint32 chunk_size = 0;
@ -176,7 +176,7 @@ metadataparse_png_reading (PngParseData * png_data, guint8 ** buf,
if (*bufsize < 8) {
*next_size = (*buf - *next_start) + 8;
ret = 1;
ret = META_PARSING_NEED_MORE_DATA;
goto done;
}
@ -191,7 +191,7 @@ metadataparse_png_reading (PngParseData * png_data, guint8 ** buf,
mark[3] = READ (*buf, *bufsize);
if (mark[0] == 'I' && mark[1] == 'E' && mark[2] == 'N' && mark[3] == 'D') {
ret = 0;
ret = META_PARSING_DONE;
png_data->state = PNG_PARSE_DONE;
goto done;
}
@ -200,7 +200,7 @@ metadataparse_png_reading (PngParseData * png_data, guint8 ** buf,
if (chunk_size >= 22) { /* "XML:com.adobe.xmp" plus some flags */
if (*bufsize < 22) {
*next_size = (*buf - *next_start) + 22;
ret = 1;
ret = META_PARSING_NEED_MORE_DATA;
goto done;
}
@ -220,7 +220,7 @@ metadataparse_png_reading (PngParseData * png_data, guint8 ** buf,
*bufsize -= 22;
png_data->read = chunk_size - 22; /* four CRC bytes at the end will be jumped after */
png_data->state = PNG_PARSE_XMP;
ret = 0;
ret = META_PARSING_DONE;
goto done;
}
}
@ -230,7 +230,7 @@ metadataparse_png_reading (PngParseData * png_data, guint8 ** buf,
/* just set jump sise */
png_data->read = chunk_size + 4; /* four CRC bytes at the end */
png_data->state = PNG_PARSE_JUMPING;
ret = 0;
ret = META_PARSING_DONE;
done:
@ -239,7 +239,7 @@ done:
}
static int
static MetadataParsingReturn
metadataparse_png_jump (PngParseData * png_data, guint8 ** buf,
guint32 * bufsize, guint8 ** next_start, guint32 * next_size)
{
@ -248,7 +248,7 @@ metadataparse_png_jump (PngParseData * png_data, guint8 ** buf,
bufsize, next_start, next_size);
}
static int
static MetadataParsingReturn
metadataparse_png_xmp (PngParseData * png_data, guint8 ** buf,
guint32 * bufsize, guint8 ** next_start, guint32 * next_size)
{
@ -256,7 +256,7 @@ metadataparse_png_xmp (PngParseData * png_data, guint8 ** buf,
ret = metadataparse_util_hold_chunk (&png_data->read, buf,
bufsize, next_start, next_size, png_data->xmp_adapter);
if (ret == 0) {
if (ret == META_PARSING_DONE) {
/* jump four CRC bytes at the end of chunk */
png_data->read = 4;
png_data->state = PNG_PARSE_JUMPING;

View file

@ -82,7 +82,7 @@ extern void metadataparse_png_dispose (PngParseData * png_data);
extern void metadataparse_png_lazy_update (PngParseData * jpeg_data);
int
extern MetadataParsingReturn
metadataparse_png_parse (PngParseData * png_data, guint8 * buf,
guint32 * bufsize, const guint32 offset, guint8 ** next_start, guint32 * next_size);

View file

@ -63,7 +63,7 @@ metadataparse_util_tag_list_add_chunk (GstTagList * taglist,
}
int
MetadataParsingReturn
metadataparse_util_hold_chunk (guint32 * read, guint8 ** buf,
guint32 * bufsize, guint8 ** next_start,
guint32 * next_size, GstAdapter ** adapter)
@ -73,7 +73,7 @@ metadataparse_util_hold_chunk (guint32 * read, guint8 ** buf,
if (*read > *bufsize) {
*next_start = *buf;
*next_size = *read;
ret = 1;
ret = META_PARSING_NEED_MORE_DATA;
} else {
GstBuffer *gst_buf;
@ -88,13 +88,13 @@ metadataparse_util_hold_chunk (guint32 * read, guint8 ** buf,
*buf += *read;
*bufsize -= *read;
*read = 0;
ret = 0;
ret = META_PARSING_DONE;
}
return ret;
}
int
MetadataParsingReturn
metadataparse_util_jump_chunk (guint32 * read, guint8 ** buf,
guint32 * bufsize, guint8 ** next_start, guint32 * next_size)
{
@ -106,13 +106,13 @@ metadataparse_util_jump_chunk (guint32 * read, guint8 ** buf,
*next_start = *buf + *bufsize + *read;
*read = 0;
*bufsize = 0;
ret = 1;
ret = META_PARSING_NEED_MORE_DATA;
} else {
*next_start = *buf + *read;
*buf += *read;
*bufsize -= *read;
*read = 0;
ret = 0;
ret = META_PARSING_DONE;
}
return ret;
}

View file

@ -47,16 +47,20 @@
#include <gst/gst.h>
#include <gst/base/gstadapter.h>
#include "metadatatypes.h"
G_BEGIN_DECLS
extern void
metadataparse_util_tag_list_add_chunk (GstTagList * taglist,
GstTagMergeMode mode, const gchar * name, GstAdapter * adapter);
extern int metadataparse_util_hold_chunk (guint32 * read, guint8 ** buf,
extern MetadataParsingReturn
metadataparse_util_hold_chunk (guint32 * read, guint8 ** buf,
guint32 * bufsize, guint8 ** next_start, guint32 * next_size,
GstAdapter ** adapter);
extern int
extern MetadataParsingReturn
metadataparse_util_jump_chunk (guint32 * read, guint8 ** buf,
guint32 * bufsize, guint8 ** next_start, guint32 * next_size);

View file

@ -48,6 +48,16 @@
G_BEGIN_DECLS
/* *INDENT-OFF* */
typedef enum _tag_MetadataParsingReturn {
META_PARSING_ERROR = -1,
META_PARSING_DONE = 0,
META_PARSING_NEED_MORE_DATA = 1
} MetadataParsingReturn;
/* *INDENT-ON* */
typedef enum _tag_MetadataChunkType {
MD_CHUNK_UNKNOWN,
MD_CHUNK_EXIF,

View file

@ -84,6 +84,7 @@ metadatamux_xmp_create_chunk_from_tag_list (guint8 ** buf, guint32 * size,
#else /* ifndef HAVE_XMP */
#include <xmp.h>
#include <string.h>
#define XMP_SCHEMA_NODE 0x80000000UL