diff options
author | Stefan Kost <ensonic@users.sf.net> | 2009-03-06 23:34:56 +0200 |
---|---|---|
committer | Stefan Kost <ensonic@users.sf.net> | 2009-03-06 23:38:45 +0200 |
commit | 772f8f6a8a9febe581159f8d811a2aaace2fa096 (patch) | |
tree | 1e4e759c5a0653517eea67515835405583f94c74 /ext | |
parent | 152830945646ca4230c60c92ce250d1a64c4f9d7 (diff) | |
download | gst-plugins-bad-772f8f6a8a9febe581159f8d811a2aaace2fa096.tar.gz gst-plugins-bad-772f8f6a8a9febe581159f8d811a2aaace2fa096.tar.bz2 gst-plugins-bad-772f8f6a8a9febe581159f8d811a2aaace2fa096.zip |
metadata: cleanup, fix the test, add comments
First do not build the plugin, if we have none of the backend, as it won't work
then. Fix the miniobject_unref error in the test. Sprinkle a first handful of
debug logs into the element code.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/metadata/metadata.c | 15 | ||||
-rw-r--r-- | ext/metadata/metadatamuxjpeg.c | 10 | ||||
-rw-r--r-- | ext/metadata/metadataparsejpeg.c | 8 |
3 files changed, 28 insertions, 5 deletions
diff --git a/ext/metadata/metadata.c b/ext/metadata/metadata.c index cc4b1dff..55510515 100644 --- a/ext/metadata/metadata.c +++ b/ext/metadata/metadata.c @@ -248,28 +248,34 @@ metadata_parse (MetaData * meta_data, const guint8 * buf, switch (meta_data->img_type) { case IMG_JPEG: - if (G_LIKELY (meta_data->options & META_OPT_DEMUX)) + if (G_LIKELY (meta_data->options & META_OPT_DEMUX)) { + GST_DEBUG ("parsing jpeg"); ret = metadataparse_jpeg_parse (&meta_data->format_data.jpeg_parse, (guint8 *) buf, &buf_size, meta_data->offset_orig, &next_start, next_size); - else + } else { + GST_DEBUG ("formatting jpeg"); ret = metadatamux_jpeg_parse (&meta_data->format_data.jpeg_mux, (guint8 *) buf, &buf_size, meta_data->offset_orig, &next_start, next_size); + } break; case IMG_PNG: - if (G_LIKELY (meta_data->options & META_OPT_DEMUX)) + if (G_LIKELY (meta_data->options & META_OPT_DEMUX)) { + GST_DEBUG ("parsing png"); ret = metadataparse_png_parse (&meta_data->format_data.png_parse, (guint8 *) buf, &buf_size, meta_data->offset_orig, &next_start, next_size); - else + } else { + GST_DEBUG ("formatting png"); ret = metadatamux_png_parse (&meta_data->format_data.png_mux, (guint8 *) buf, &buf_size, meta_data->offset_orig, &next_start, next_size); + } break; default: /* unexpected */ @@ -286,6 +292,7 @@ done: if (ret == META_PARSING_DONE) { meta_data->state = STATE_DONE; } + GST_DEBUG ("parsing/formatting done : %d", ret); return ret; } diff --git a/ext/metadata/metadatamuxjpeg.c b/ext/metadata/metadatamuxjpeg.c index 57c8779f..3a418a44 100644 --- a/ext/metadata/metadatamuxjpeg.c +++ b/ext/metadata/metadatamuxjpeg.c @@ -211,6 +211,7 @@ metadatamux_jpeg_parse (JpegMuxData * jpeg_data, guint8 * buf, if (jpeg_data->state == JPEG_MUX_NULL) { if (*bufsize < 2) { + GST_INFO ("need more data"); *next_size = (buf - *next_start) + 2; ret = META_PARSING_NEED_MORE_DATA; goto done; @@ -220,6 +221,7 @@ metadatamux_jpeg_parse (JpegMuxData * jpeg_data, guint8 * buf, mark[1] = READ (buf, *bufsize); if (mark[0] != 0xFF || mark[1] != 0xD8) { + GST_INFO ("missing marker"); ret = META_PARSING_ERROR; goto done; } @@ -231,6 +233,7 @@ metadatamux_jpeg_parse (JpegMuxData * jpeg_data, guint8 * buf, while (ret == META_PARSING_DONE) { switch (jpeg_data->state) { case JPEG_MUX_READING: + GST_DEBUG ("start reading"); ret = metadatamux_jpeg_reading (jpeg_data, &buf, bufsize, offset, step_buf, next_start, next_size); @@ -239,6 +242,7 @@ metadatamux_jpeg_parse (JpegMuxData * jpeg_data, guint8 * buf, goto done; break; default: + GST_INFO ("invalid parser state"); ret = META_PARSING_ERROR; break; } @@ -379,6 +383,7 @@ metadatamux_jpeg_reading (JpegMuxData * jpeg_data, guint8 ** buf, *next_start = *buf; if (*bufsize < 2) { + GST_INFO ("need more data"); *next_size = (*buf - *next_start) + 2; ret = META_PARSING_NEED_MORE_DATA; goto done; @@ -396,6 +401,7 @@ metadatamux_jpeg_reading (JpegMuxData * jpeg_data, guint8 ** buf, if (chunk_size >= 16) { if (*bufsize < 5) { + GST_INFO ("need more data"); *next_size = (*buf - *next_start) + 5; ret = META_PARSING_NEED_MORE_DATA; goto done; @@ -406,11 +412,13 @@ metadatamux_jpeg_reading (JpegMuxData * jpeg_data, guint8 ** buf, } } else { /* FIXME: should we check if the first chunk is EXIF? */ + GST_INFO ("chunk size too small %u", chunk_size); } } if (!jfif_found) { + GST_INFO ("no jfif found"); ret = META_PARSING_ERROR; goto done; } @@ -456,7 +464,7 @@ metadatamux_jpeg_reading (JpegMuxData * jpeg_data, guint8 ** buf, ret = META_PARSING_DONE; } else { - /* invalid JPEG chunk */ + GST_INFO ("invalid JPEG chunk"); ret = META_PARSING_ERROR; } diff --git a/ext/metadata/metadataparsejpeg.c b/ext/metadata/metadataparsejpeg.c index 480de563..8e90b5c7 100644 --- a/ext/metadata/metadataparsejpeg.c +++ b/ext/metadata/metadataparsejpeg.c @@ -245,6 +245,7 @@ metadataparse_jpeg_parse (JpegParseData * jpeg_data, guint8 * buf, type to be sure it is a JPEG */ if (*bufsize < 2) { + GST_INFO ("need more data"); *next_size = (buf - *next_start) + 2; ret = META_PARSING_NEED_MORE_DATA; goto done; @@ -254,6 +255,7 @@ metadataparse_jpeg_parse (JpegParseData * jpeg_data, guint8 * buf, mark[1] = READ (buf, *bufsize); if (mark[0] != 0xFF || mark[1] != 0xD8) { + GST_INFO ("missing marker"); ret = META_PARSING_ERROR; goto done; } @@ -265,21 +267,25 @@ metadataparse_jpeg_parse (JpegParseData * jpeg_data, guint8 * buf, while (ret == META_PARSING_DONE) { switch (jpeg_data->state) { case JPEG_PARSE_READING: + GST_DEBUG ("start reading"); ret = metadataparse_jpeg_reading (jpeg_data, &buf, bufsize, offset, step_buf, next_start, next_size); break; case JPEG_PARSE_JUMPING: + GST_DEBUG ("jump"); ret = metadataparse_jpeg_jump (jpeg_data, &buf, bufsize, next_start, next_size); break; case JPEG_PARSE_EXIF: + GST_DEBUG ("parse exif"); ret = metadataparse_jpeg_exif (jpeg_data, &buf, bufsize, next_start, next_size); break; case JPEG_PARSE_IPTC: + GST_DEBUG ("parse iptc"); #ifdef HAVE_IPTC ret = metadataparse_jpeg_iptc (jpeg_data, &buf, bufsize, next_start, @@ -287,6 +293,7 @@ metadataparse_jpeg_parse (JpegParseData * jpeg_data, guint8 * buf, #endif break; case JPEG_PARSE_XMP: + GST_DEBUG ("parse xmp"); ret = metadataparse_jpeg_xmp (jpeg_data, &buf, bufsize, next_start, next_size); @@ -295,6 +302,7 @@ metadataparse_jpeg_parse (JpegParseData * jpeg_data, guint8 * buf, goto done; break; default: + GST_INFO ("invalid parser state"); ret = META_PARSING_ERROR; break; } |