diff options
author | Stefan Kost <ensonic@users.sf.net> | 2009-11-04 00:19:20 +0200 |
---|---|---|
committer | Stefan Kost <ensonic@users.sf.net> | 2009-11-04 00:19:20 +0200 |
commit | 94942cf69b4da79f3f15d8d0c9e5da3ab7bbcfa1 (patch) | |
tree | 0f86085827f0b99bfb9133480cfccc6cec444dc9 | |
parent | aaba1b1d2617511347e33bebc66af0c5961b02e5 (diff) |
zbar: include quality and check count, fixes #600461
We report the relative quality in the message and we also use the cache to skip
early detects and doubles.
-rw-r--r-- | ext/zbar/gstzbar.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/ext/zbar/gstzbar.c b/ext/zbar/gstzbar.c index cd2ec48f4..95470d7ff 100644 --- a/ext/zbar/gstzbar.c +++ b/ext/zbar/gstzbar.c @@ -55,6 +55,14 @@ * the deteted bar code data. * </para> * </listitem> + * <listitem> + * <para> + * gint + * <classname>"quality"</classname>: + * an unscaled, relative quantity: larger values are better than smaller + * values. + * </para> + * </listitem> * </itemizedlist> * * <refsect2> @@ -275,9 +283,13 @@ gst_zbar_transform_ip (GstBaseTransform * base, GstBuffer * outbuf) for (; symbol; symbol = zbar_symbol_next (symbol)) { zbar_symbol_type_t typ = zbar_symbol_get_type (symbol); const char *data = zbar_symbol_get_data (symbol); + gint quality = zbar_symbol_get_quality (symbol); + + GST_DEBUG_OBJECT (zbar, "decoded %s symbol \"%s\" at quality %d", + zbar_get_symbol_name (typ), data, quality); - GST_DEBUG_OBJECT (zbar, "decoded %s symbol \"%s\"", - zbar_get_symbol_name (typ), data); + if (zbar_symbol_get_count (symbol) != 0) + continue; if (zbar->message) { GstMessage *m; @@ -287,7 +299,7 @@ gst_zbar_transform_ip (GstBaseTransform * base, GstBuffer * outbuf) s = gst_structure_new ("barcode", "timestamp", G_TYPE_UINT64, GST_BUFFER_TIMESTAMP (outbuf), "type", G_TYPE_STRING, zbar_get_symbol_name (typ), - "symbol", G_TYPE_STRING, data, NULL); + "symbol", G_TYPE_STRING, data, "quality", G_TYPE_INT, quality, NULL); m = gst_message_new_element (GST_OBJECT (zbar), s); gst_element_post_message (GST_ELEMENT (zbar), m); } |