2009-10-01 20:51:04 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2009 Stefan Kost <ensonic@users.sf.net>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-03 20:38:00 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2009-10-01 20:51:04 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:element-zbar
|
2017-03-08 18:01:13 +00:00
|
|
|
* @title: zbar
|
2009-10-01 20:51:04 +00:00
|
|
|
*
|
2009-10-02 10:02:31 +00:00
|
|
|
* Detect bar codes in the video streams and send them as element messages to
|
2024-11-18 10:00:36 +00:00
|
|
|
* the #GstBus if #GstZBar:message property is %TRUE.
|
|
|
|
* If the #GstZBar:attach-frame property is %TRUE, the posted barcode message
|
2015-05-02 02:20:30 +00:00
|
|
|
* includes a sample of the frame where the barcode was detected (Since 1.6).
|
2009-10-02 10:02:31 +00:00
|
|
|
*
|
2024-11-18 10:00:36 +00:00
|
|
|
* The element generates messages named `barcode`. The structure contains these fields:
|
2017-03-08 18:01:13 +00:00
|
|
|
*
|
|
|
|
* * #GstClockTime `timestamp`: the timestamp of the buffer that triggered the message.
|
|
|
|
* * gchar * `type`: the symbol type.
|
2019-09-02 19:08:44 +00:00
|
|
|
* * gchar * `symbol`: the detected bar code data.
|
2017-03-08 18:01:13 +00:00
|
|
|
* * gint `quality`: an unscaled, relative quantity: larger values are better than smaller
|
2009-11-03 22:19:20 +00:00
|
|
|
* values.
|
2024-11-18 10:00:36 +00:00
|
|
|
* * #GstSample `frame`: the frame in which the barcode message was detected, if
|
|
|
|
* the #GstZBar:attach-frame property was set to %TRUE (Since 1.6)
|
2009-10-01 20:51:04 +00:00
|
|
|
*
|
2017-03-08 18:01:13 +00:00
|
|
|
* ## Example launch lines
|
2009-10-01 20:51:04 +00:00
|
|
|
* |[
|
2015-12-14 02:09:46 +00:00
|
|
|
* gst-launch-1.0 -m v4l2src ! videoconvert ! zbar ! videoconvert ! xvimagesink
|
2009-10-01 20:51:04 +00:00
|
|
|
* ]| This pipeline will detect barcodes and send them as messages.
|
|
|
|
* |[
|
2024-11-18 10:00:36 +00:00
|
|
|
* gst-launch-1.0 -m v4l2src ! tee name=t ! queue ! videoconvert ! zbar ! fakesink t. ! queue ! videoconvert ! xvimagesink
|
2009-10-01 20:51:04 +00:00
|
|
|
* ]| Same as above, but running the filter on a branch to keep the display in color
|
2017-03-08 18:01:13 +00:00
|
|
|
*
|
2009-10-01 20:51:04 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "gstzbar.h"
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
#include <gst/video/video.h>
|
|
|
|
|
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (zbar_debug);
|
|
|
|
#define GST_CAT_DEFAULT zbar_debug
|
|
|
|
|
|
|
|
/* GstZBar signals and args */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
2009-10-02 10:02:31 +00:00
|
|
|
PROP_MESSAGE,
|
2015-05-02 02:20:30 +00:00
|
|
|
PROP_ATTACH_FRAME,
|
2010-11-02 16:32:55 +00:00
|
|
|
PROP_CACHE
|
2009-10-01 20:51:04 +00:00
|
|
|
};
|
|
|
|
|
2010-11-02 16:35:57 +00:00
|
|
|
#define DEFAULT_CACHE FALSE
|
|
|
|
#define DEFAULT_MESSAGE TRUE
|
2015-05-02 02:20:30 +00:00
|
|
|
#define DEFAULT_ATTACH_FRAME FALSE
|
2009-10-01 20:51:04 +00:00
|
|
|
|
2010-11-02 17:46:11 +00:00
|
|
|
#define ZBAR_YUV_CAPS \
|
2014-09-26 08:25:20 +00:00
|
|
|
"{ Y800, I420, YV12, NV12, NV21, Y41B, Y42B, YUV9, YVU9 }"
|
2010-11-02 17:46:11 +00:00
|
|
|
|
2009-10-01 20:51:04 +00:00
|
|
|
static GstStaticPadTemplate gst_zbar_src_template =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
2011-10-08 10:07:58 +00:00
|
|
|
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (ZBAR_YUV_CAPS))
|
2009-10-01 20:51:04 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate gst_zbar_sink_template =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
2011-10-08 10:07:58 +00:00
|
|
|
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (ZBAR_YUV_CAPS))
|
2009-10-01 20:51:04 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
static void gst_zbar_finalize (GObject * object);
|
|
|
|
static void gst_zbar_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_zbar_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
|
|
|
|
2009-10-02 08:22:48 +00:00
|
|
|
static gboolean gst_zbar_start (GstBaseTransform * base);
|
|
|
|
static gboolean gst_zbar_stop (GstBaseTransform * base);
|
2009-10-01 20:51:04 +00:00
|
|
|
|
2011-12-21 22:51:30 +00:00
|
|
|
static GstFlowReturn gst_zbar_transform_frame_ip (GstVideoFilter * vfilter,
|
|
|
|
GstVideoFrame * frame);
|
|
|
|
|
2011-10-08 10:07:58 +00:00
|
|
|
#define gst_zbar_parent_class parent_class
|
2021-02-25 08:57:00 +00:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (GstZBar, gst_zbar, GST_TYPE_VIDEO_FILTER,
|
|
|
|
GST_DEBUG_CATEGORY_INIT (zbar_debug, "zbar", 0, "zbar"););
|
|
|
|
GST_ELEMENT_REGISTER_DEFINE (zbar, "zbar", GST_RANK_NONE, GST_TYPE_ZBAR);
|
2009-10-01 20:51:04 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gst_zbar_class_init (GstZBarClass * g_class)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
2011-10-08 10:07:58 +00:00
|
|
|
GstElementClass *gstelement_class;
|
2009-10-01 20:51:04 +00:00
|
|
|
GstBaseTransformClass *trans_class;
|
2011-12-21 22:51:30 +00:00
|
|
|
GstVideoFilterClass *vfilter_class;
|
2009-10-01 20:51:04 +00:00
|
|
|
|
|
|
|
gobject_class = G_OBJECT_CLASS (g_class);
|
2011-10-08 10:07:58 +00:00
|
|
|
gstelement_class = GST_ELEMENT_CLASS (g_class);
|
2009-10-01 20:51:04 +00:00
|
|
|
trans_class = GST_BASE_TRANSFORM_CLASS (g_class);
|
2011-12-21 22:51:30 +00:00
|
|
|
vfilter_class = GST_VIDEO_FILTER_CLASS (g_class);
|
2009-10-01 20:51:04 +00:00
|
|
|
|
|
|
|
gobject_class->set_property = gst_zbar_set_property;
|
|
|
|
gobject_class->get_property = gst_zbar_get_property;
|
|
|
|
gobject_class->finalize = gst_zbar_finalize;
|
|
|
|
|
2009-10-02 10:02:31 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_MESSAGE,
|
2010-11-02 16:35:57 +00:00
|
|
|
g_param_spec_boolean ("message", "message",
|
2009-10-02 10:02:31 +00:00
|
|
|
"Post a barcode message for each detected code",
|
2010-11-02 16:35:57 +00:00
|
|
|
DEFAULT_MESSAGE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2009-10-02 10:02:31 +00:00
|
|
|
|
2015-05-02 02:20:30 +00:00
|
|
|
/**
|
|
|
|
* GstZBar::attach-frame:
|
|
|
|
*
|
|
|
|
* Attach the frame in which the barcode was detected to the posted
|
|
|
|
* barcode message.
|
|
|
|
*
|
|
|
|
* Since: 1.6
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_ATTACH_FRAME,
|
|
|
|
g_param_spec_boolean ("attach-frame", "Attach frame",
|
|
|
|
"Attach a frame dump to each barcode message",
|
|
|
|
DEFAULT_ATTACH_FRAME, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
2010-09-28 15:21:57 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_CACHE,
|
|
|
|
g_param_spec_boolean ("cache", "cache",
|
|
|
|
"Enable or disable the inter-image result cache",
|
2010-11-02 16:32:55 +00:00
|
|
|
DEFAULT_CACHE,
|
2010-10-19 13:23:23 +00:00
|
|
|
G_PARAM_READWRITE | GST_PARAM_MUTABLE_READY |
|
|
|
|
G_PARAM_STATIC_STRINGS));
|
2010-09-28 15:21:57 +00:00
|
|
|
|
2012-10-17 16:34:26 +00:00
|
|
|
gst_element_class_set_static_metadata (gstelement_class, "Barcode detector",
|
2011-10-08 10:07:58 +00:00
|
|
|
"Filter/Analyzer/Video",
|
|
|
|
"Detect bar codes in the video streams",
|
|
|
|
"Stefan Kost <ensonic@users.sf.net>");
|
|
|
|
|
2016-03-04 06:50:26 +00:00
|
|
|
gst_element_class_add_static_pad_template (gstelement_class,
|
|
|
|
&gst_zbar_sink_template);
|
|
|
|
gst_element_class_add_static_pad_template (gstelement_class,
|
|
|
|
&gst_zbar_src_template);
|
2011-10-08 10:07:58 +00:00
|
|
|
|
2009-10-02 08:22:48 +00:00
|
|
|
trans_class->start = GST_DEBUG_FUNCPTR (gst_zbar_start);
|
2009-10-23 08:00:53 +00:00
|
|
|
trans_class->stop = GST_DEBUG_FUNCPTR (gst_zbar_stop);
|
2011-12-21 22:51:30 +00:00
|
|
|
|
|
|
|
vfilter_class->transform_frame_ip =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_zbar_transform_frame_ip);
|
2009-10-01 20:51:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-10-08 10:07:58 +00:00
|
|
|
gst_zbar_init (GstZBar * zbar)
|
2009-10-01 20:51:04 +00:00
|
|
|
{
|
2010-11-02 16:32:55 +00:00
|
|
|
zbar->cache = DEFAULT_CACHE;
|
2010-11-02 16:35:57 +00:00
|
|
|
zbar->message = DEFAULT_MESSAGE;
|
2015-05-02 02:20:30 +00:00
|
|
|
zbar->attach_frame = DEFAULT_ATTACH_FRAME;
|
2009-10-02 10:02:31 +00:00
|
|
|
|
2009-10-01 20:51:04 +00:00
|
|
|
zbar->scanner = zbar_image_scanner_create ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_zbar_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GstZBar *zbar = GST_ZBAR (object);
|
|
|
|
|
|
|
|
zbar_image_scanner_destroy (zbar->scanner);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_zbar_set_property (GObject * object, guint prop_id, const GValue * value,
|
|
|
|
GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstZBar *zbar;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_ZBAR (object));
|
|
|
|
zbar = GST_ZBAR (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2010-09-28 15:21:57 +00:00
|
|
|
case PROP_CACHE:
|
|
|
|
zbar->cache = g_value_get_boolean (value);
|
|
|
|
break;
|
2009-10-02 10:02:31 +00:00
|
|
|
case PROP_MESSAGE:
|
|
|
|
zbar->message = g_value_get_boolean (value);
|
|
|
|
break;
|
2015-05-02 02:20:30 +00:00
|
|
|
case PROP_ATTACH_FRAME:
|
|
|
|
zbar->attach_frame = g_value_get_boolean (value);
|
|
|
|
break;
|
2009-10-01 20:51:04 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_zbar_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstZBar *zbar;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_ZBAR (object));
|
|
|
|
zbar = GST_ZBAR (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2010-09-28 15:21:57 +00:00
|
|
|
case PROP_CACHE:
|
|
|
|
g_value_set_boolean (value, zbar->cache);
|
|
|
|
break;
|
2009-10-02 10:02:31 +00:00
|
|
|
case PROP_MESSAGE:
|
|
|
|
g_value_set_boolean (value, zbar->message);
|
|
|
|
break;
|
2015-05-02 02:20:30 +00:00
|
|
|
case PROP_ATTACH_FRAME:
|
|
|
|
g_value_set_boolean (value, zbar->attach_frame);
|
|
|
|
break;
|
2009-10-01 20:51:04 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
2011-12-21 22:51:30 +00:00
|
|
|
gst_zbar_transform_frame_ip (GstVideoFilter * vfilter, GstVideoFrame * frame)
|
2009-10-01 20:51:04 +00:00
|
|
|
{
|
2011-12-21 22:51:30 +00:00
|
|
|
GstZBar *zbar = GST_ZBAR (vfilter);
|
2011-10-08 10:07:58 +00:00
|
|
|
gpointer data;
|
|
|
|
gint stride, height;
|
2009-10-01 20:51:04 +00:00
|
|
|
zbar_image_t *image;
|
|
|
|
const zbar_symbol_t *symbol;
|
|
|
|
int n;
|
|
|
|
|
|
|
|
image = zbar_image_create ();
|
2010-11-02 17:18:52 +00:00
|
|
|
|
2010-11-02 17:46:11 +00:00
|
|
|
/* all formats we support start with an 8-bit Y plane. zbar doesn't need
|
|
|
|
* to know about the chroma plane(s) */
|
2011-12-21 22:51:30 +00:00
|
|
|
data = GST_VIDEO_FRAME_COMP_DATA (frame, 0);
|
|
|
|
stride = GST_VIDEO_FRAME_COMP_STRIDE (frame, 0);
|
|
|
|
height = GST_VIDEO_FRAME_HEIGHT (frame);
|
2011-10-08 10:07:58 +00:00
|
|
|
|
2010-01-11 00:16:18 +00:00
|
|
|
zbar_image_set_format (image, GST_MAKE_FOURCC ('Y', '8', '0', '0'));
|
2011-10-08 10:07:58 +00:00
|
|
|
zbar_image_set_size (image, stride, height);
|
|
|
|
zbar_image_set_data (image, (gpointer) data, stride * height, NULL);
|
2009-10-01 20:51:04 +00:00
|
|
|
|
|
|
|
/* scan the image for barcodes */
|
|
|
|
n = zbar_scan_image (zbar->scanner, image);
|
2015-06-02 14:31:00 +00:00
|
|
|
if (G_UNLIKELY (n == -1)) {
|
|
|
|
GST_WARNING_OBJECT (zbar, "Error trying to scan frame. Skipping");
|
|
|
|
goto out;
|
|
|
|
}
|
2010-09-28 15:21:57 +00:00
|
|
|
if (n == 0)
|
|
|
|
goto out;
|
2009-10-01 20:51:04 +00:00
|
|
|
|
|
|
|
/* extract results */
|
|
|
|
symbol = zbar_image_first_symbol (image);
|
|
|
|
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);
|
2009-11-03 22:19:20 +00:00
|
|
|
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);
|
2009-10-02 08:22:48 +00:00
|
|
|
|
2010-09-28 15:21:57 +00:00
|
|
|
if (zbar->cache && zbar_symbol_get_count (symbol) != 0)
|
2009-11-03 22:19:20 +00:00
|
|
|
continue;
|
2009-10-02 10:02:31 +00:00
|
|
|
|
|
|
|
if (zbar->message) {
|
|
|
|
GstMessage *m;
|
|
|
|
GstStructure *s;
|
2015-05-02 02:20:30 +00:00
|
|
|
GstSample *sample;
|
|
|
|
GstCaps *sample_caps;
|
2019-06-19 10:31:39 +00:00
|
|
|
GstClockTime timestamp, running_time, stream_time, duration;
|
|
|
|
|
|
|
|
timestamp = GST_BUFFER_TIMESTAMP (frame->buffer);
|
|
|
|
duration = GST_BUFFER_DURATION (frame->buffer);
|
|
|
|
running_time =
|
|
|
|
gst_segment_to_running_time (&GST_BASE_TRANSFORM (zbar)->segment,
|
|
|
|
GST_FORMAT_TIME, timestamp);
|
|
|
|
stream_time =
|
|
|
|
gst_segment_to_stream_time (&GST_BASE_TRANSFORM (zbar)->segment,
|
|
|
|
GST_FORMAT_TIME, timestamp);
|
2009-10-02 10:02:31 +00:00
|
|
|
|
|
|
|
s = gst_structure_new ("barcode",
|
2019-06-19 10:31:39 +00:00
|
|
|
"timestamp", G_TYPE_UINT64, timestamp,
|
|
|
|
"stream-time", G_TYPE_UINT64, stream_time,
|
|
|
|
"running-time", G_TYPE_UINT64, running_time,
|
2009-10-02 10:02:31 +00:00
|
|
|
"type", G_TYPE_STRING, zbar_get_symbol_name (typ),
|
2009-11-03 22:19:20 +00:00
|
|
|
"symbol", G_TYPE_STRING, data, "quality", G_TYPE_INT, quality, NULL);
|
2015-05-02 02:20:30 +00:00
|
|
|
|
2019-06-19 10:31:39 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (duration))
|
|
|
|
gst_structure_set (s, "duration", G_TYPE_UINT64, duration, NULL);
|
|
|
|
|
2015-05-02 02:20:30 +00:00
|
|
|
if (zbar->attach_frame) {
|
|
|
|
/* create a sample from image */
|
|
|
|
sample_caps = gst_video_info_to_caps (&frame->info);
|
|
|
|
sample = gst_sample_new (frame->buffer, sample_caps, NULL, NULL);
|
|
|
|
gst_caps_unref (sample_caps);
|
|
|
|
gst_structure_set (s, "frame", GST_TYPE_SAMPLE, sample, NULL);
|
|
|
|
gst_sample_unref (sample);
|
|
|
|
}
|
|
|
|
|
2009-10-02 10:02:31 +00:00
|
|
|
m = gst_message_new_element (GST_OBJECT (zbar), s);
|
|
|
|
gst_element_post_message (GST_ELEMENT (zbar), m);
|
2015-05-02 02:20:30 +00:00
|
|
|
|
|
|
|
} else if (zbar->attach_frame)
|
|
|
|
GST_WARNING_OBJECT (zbar,
|
|
|
|
"attach-frame=true has no effect if message=false");
|
2009-10-01 20:51:04 +00:00
|
|
|
}
|
|
|
|
|
2010-09-28 15:21:57 +00:00
|
|
|
out:
|
2009-10-01 20:51:04 +00:00
|
|
|
/* clean up */
|
2010-09-28 15:21:57 +00:00
|
|
|
zbar_image_scanner_recycle_image (zbar->scanner, image);
|
2009-10-01 20:51:04 +00:00
|
|
|
zbar_image_destroy (image);
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
2009-10-02 08:22:48 +00:00
|
|
|
static gboolean
|
|
|
|
gst_zbar_start (GstBaseTransform * base)
|
|
|
|
{
|
|
|
|
GstZBar *zbar = GST_ZBAR (base);
|
|
|
|
|
2010-09-28 15:21:57 +00:00
|
|
|
/* start the cache if enabled (e.g. for filtering dupes) */
|
|
|
|
zbar_image_scanner_enable_cache (zbar->scanner, zbar->cache);
|
2009-10-02 08:22:48 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_zbar_stop (GstBaseTransform * base)
|
|
|
|
{
|
|
|
|
GstZBar *zbar = GST_ZBAR (base);
|
|
|
|
|
2010-09-28 15:21:57 +00:00
|
|
|
/* stop the cache if enabled (e.g. for filtering dupes) */
|
|
|
|
zbar_image_scanner_enable_cache (zbar->scanner, zbar->cache);
|
2009-10-02 08:22:48 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2009-10-01 20:51:04 +00:00
|
|
|
static gboolean
|
|
|
|
plugin_init (GstPlugin * plugin)
|
|
|
|
{
|
2021-02-25 08:57:00 +00:00
|
|
|
return GST_ELEMENT_REGISTER (zbar, plugin);
|
2009-10-01 20:51:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
2012-04-05 16:02:56 +00:00
|
|
|
zbar,
|
2009-10-01 20:51:04 +00:00
|
|
|
"zbar barcode scanner",
|
|
|
|
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
|