From ab8b2883a1de70685e59419b3fa3a4af8043e9a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= Date: Thu, 14 Nov 2024 10:37:05 +0100 Subject: [PATCH] gst_plugins-cache: add zxing plugin update documentation Part-of: --- .../docs/plugins/gst_plugins_cache.json | 197 ++++++++++++++++++ .../gst-plugins-bad/ext/zxing/gstzxing.cpp | 75 ++++++- .../ext/zxing/gstzxingplugin.c | 9 +- 3 files changed, 272 insertions(+), 9 deletions(-) diff --git a/subprojects/gst-plugins-bad/docs/plugins/gst_plugins_cache.json b/subprojects/gst-plugins-bad/docs/plugins/gst_plugins_cache.json index bc8a76d22c..cfd32f88a8 100644 --- a/subprojects/gst-plugins-bad/docs/plugins/gst_plugins_cache.json +++ b/subprojects/gst-plugins-bad/docs/plugins/gst_plugins_cache.json @@ -253314,5 +253314,202 @@ "source": "gst-plugins-bad", "tracers": {}, "url": "Unknown package origin" + }, + "zxing": { + "description": "ZXing bar code detector plugin", + "elements": { + "zxing": { + "author": "Stéphane Cerveau ", + "description": "Detect bar codes in the video streams with zxing library", + "hierarchy": [ + "GstZXing", + "GstVideoFilter", + "GstBaseTransform", + "GstElement", + "GstObject", + "GInitiallyUnowned", + "GObject" + ], + "klass": "Filter/Analyzer/Video", + "pad-templates": { + "sink": { + "caps": "video/x-raw:\n format: { ARGB, xRGB, Y444, Y42B, I420, Y41B, YUV9, YV12 }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n", + "direction": "sink", + "presence": "always" + }, + "src": { + "caps": "video/x-raw:\n format: { ARGB, xRGB, Y444, Y42B, I420, Y41B, YUV9, YV12 }\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n", + "direction": "src", + "presence": "always" + } + }, + "properties": { + "attach-frame": { + "blurb": "Attach a frame dump to each barcode message", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "false", + "mutable": "null", + "readable": true, + "type": "gboolean", + "writable": true + }, + "format": { + "blurb": "Barcode image format", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "all (0)", + "mutable": "null", + "readable": true, + "type": "GstBarCodeFormat", + "writable": true + }, + "message": { + "blurb": "Post a barcode message for each detected code", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "true", + "mutable": "null", + "readable": true, + "type": "gboolean", + "writable": true + }, + "try-faster": { + "blurb": "Try faster to analyze the frame", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "false", + "mutable": "null", + "readable": true, + "type": "gboolean", + "writable": true + }, + "try-rotate": { + "blurb": "Try to rotate the frame to detect barcode (slower)", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "false", + "mutable": "null", + "readable": true, + "type": "gboolean", + "writable": true + } + }, + "rank": "marginal" + } + }, + "filename": "gstzxing", + "license": "LGPL", + "other-types": { + "GstBarCodeFormat": { + "kind": "enum", + "values": [ + { + "desc": "ALL", + "name": "all", + "value": "0" + }, + { + "desc": "AZTEC", + "name": "aztec", + "value": "1" + }, + { + "desc": "CODABAR", + "name": "codabar", + "value": "2" + }, + { + "desc": "CODE_39", + "name": "code_39", + "value": "3" + }, + { + "desc": "CODE_93", + "name": "code_93", + "value": "4" + }, + { + "desc": "CODE_128", + "name": "code_128", + "value": "5" + }, + { + "desc": "PNG", + "name": "png", + "value": "6" + }, + { + "desc": "EAN_8", + "name": "ean_8", + "value": "7" + }, + { + "desc": "EAN_13", + "name": "ean_13", + "value": "8" + }, + { + "desc": "ITF", + "name": "itf", + "value": "9" + }, + { + "desc": "MAXICODE", + "name": "maxicode", + "value": "10" + }, + { + "desc": "PDF_417", + "name": "pdf_417", + "value": "11" + }, + { + "desc": "QR_CODE", + "name": "qr_code", + "value": "12" + }, + { + "desc": "RSS_14", + "name": "rss_14", + "value": "13" + }, + { + "desc": "RSS_EXPANDED", + "name": "rss_expanded", + "value": "14" + }, + { + "desc": "UPC_A", + "name": "upc_a", + "value": "15" + }, + { + "desc": "UPC_E", + "name": "upc_e", + "value": "16" + }, + { + "desc": "UPC_EAN_EXTENSION", + "name": "upc_ean_expansion", + "value": "17" + } + ] + } + }, + "package": "GStreamer Bad Plug-ins", + "source": "gst-plugins-bad", + "tracers": {}, + "url": "Unknown package origin" } } \ No newline at end of file diff --git a/subprojects/gst-plugins-bad/ext/zxing/gstzxing.cpp b/subprojects/gst-plugins-bad/ext/zxing/gstzxing.cpp index a8a0f7b49a..d56cec2274 100644 --- a/subprojects/gst-plugins-bad/ext/zxing/gstzxing.cpp +++ b/subprojects/gst-plugins-bad/ext/zxing/gstzxing.cpp @@ -37,7 +37,7 @@ * the .#GstZXing:attach-frame property was set to %TRUE (Since 1.18) * * This element is based on the c++ implementation of zxing which can found - * at https://github.com/nu-book/zxing-cpp. + * at https://github.com/zxing-cpp/zxing-cpp. * * ## Example launch lines * |[ @@ -47,6 +47,8 @@ * gst-launch-1.0 -m v4l2src ! tee name=t ! queue ! videoconvert ! zxing ! fakesink t. ! queue ! xvimagesink * ]| Same as above, but running the filter on a branch to keep the display in color * + * Since: 1.18 + * */ #ifdef HAVE_CONFIG_H @@ -84,7 +86,31 @@ enum PROP_FORMAT, }; -enum +/** + * GstBarCodeFormat: + * + * @BARCODE_FORMAT_ALL all format + * @BARCODE_FORMAT_AZTEC aztec format + * @BARCODE_FORMAT_CODABAR codabar format + * @BARCODE_FORMAT_CODE_39 code39 format + * @BARCODE_FORMAT_CODE_93 code 93 format + * @BARCODE_FORMAT_CODE_128 code 128 format + * @BARCODE_FORMAT_DATA_MATRIX data matrix format + * @BARCODE_FORMAT_EAN_8 EAN 8 format + * @BARCODE_FORMAT_EAN_13 EAN 13 format + * @BARCODE_FORMAT_ITF ITF format + * @BARCODE_FORMAT_MAXICODE maxicode format + * @BARCODE_FORMAT_PDF_417 pdf 417 format + * @BARCODE_FORMAT_QR_CODE QR code format + * @BARCODE_FORMAT_RSS_14 RSS 14 format + * @BARCODE_FORMAT_RSS_EXPANDED RSS expanded format + * @BARCODE_FORMAT_UPC_A UPC_A format + * @BARCODE_FORMAT_UPC_E UPC_E format + * @BARCODE_FORMAT_UPC_EAN_EXTENSION UPC_EAN_EXTENSION format + * + * Since: 1.18 + */ +typedef enum { BARCODE_FORMAT_ALL, BARCODE_FORMAT_AZTEC, @@ -104,7 +130,7 @@ enum BARCODE_FORMAT_UPC_A, BARCODE_FORMAT_UPC_E, BARCODE_FORMAT_UPC_EAN_EXTENSION -}; +} GstBarCodeFormat; static const GEnumValue barcode_formats[] = { {BARCODE_FORMAT_ALL, "ALL", "all"}, @@ -175,7 +201,7 @@ struct _GstZXing gboolean rotate; gboolean faster; ImageFormat image_format; - guint barcode_format; + GstBarCodeFormat barcode_format; }; static void gst_zxing_set_property (GObject * object, guint prop_id, @@ -208,27 +234,60 @@ gst_zxing_class_init (GstZXingClass * g_class) gobject_class->set_property = gst_zxing_set_property; gobject_class->get_property = gst_zxing_get_property; + /** + * GstZXing::message: + * + * Post a barcode message for each detected code. + * + * Since: 1.18 + */ g_object_class_install_property (gobject_class, PROP_MESSAGE, g_param_spec_boolean ("message", "message", "Post a barcode message for each detected code", DEFAULT_MESSAGE, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); - + /** + * GstZXing::attach-frame: + * + * Attach a frame dump to each barcode message + * + * Since: 1.18 + */ 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, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); - + /** + * GstZXing::try-rotate: + * + * Try to rotate the frame to detect barcode (slower) + * + * Since: 1.18 + */ g_object_class_install_property (gobject_class, PROP_TRY_ROTATE, g_param_spec_boolean ("try-rotate", "Try rotate", "Try to rotate the frame to detect barcode (slower)", DEFAULT_TRY_ROTATE, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); + /** + * GstZXing::try-faster: + * + * Try faster to analyze the frame + * + * Since: 1.18 + */ g_object_class_install_property (gobject_class, PROP_TRY_FASTER, g_param_spec_boolean ("try-faster", "Try faster", "Try faster to analyze the frame", DEFAULT_TRY_FASTER, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); + /** + * GstZXing::format: + * + * Barcode image format + * + * Since: 1.18 + */ g_object_class_install_property (gobject_class, PROP_FORMAT, g_param_spec_enum ("format", "barcode format", "Barcode image format", GST_TYPE_BARCODE_FORMAT, BARCODE_FORMAT_ALL, @@ -248,6 +307,8 @@ gst_zxing_class_init (GstZXingClass * g_class) GST_DEBUG_FUNCPTR (gst_zxing_transform_frame_ip); vfilter_class->set_info = GST_DEBUG_FUNCPTR (gst_zxing_set_info); + + gst_type_mark_as_plugin_api (GST_TYPE_BARCODE_FORMAT, (GstPluginAPIFlags)0); } static void @@ -284,7 +345,7 @@ gst_zxing_set_property (GObject * object, guint prop_id, const GValue * value, zxing->faster = g_value_get_boolean (value); break; case PROP_FORMAT: - zxing->barcode_format = g_value_get_enum (value); + zxing->barcode_format = (GstBarCodeFormat)g_value_get_enum (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/subprojects/gst-plugins-bad/ext/zxing/gstzxingplugin.c b/subprojects/gst-plugins-bad/ext/zxing/gstzxingplugin.c index 9ba48a6ebd..b1ef514710 100644 --- a/subprojects/gst-plugins-bad/ext/zxing/gstzxingplugin.c +++ b/subprojects/gst-plugins-bad/ext/zxing/gstzxingplugin.c @@ -18,8 +18,13 @@ */ -/* - * ZXing GStreamer plugin +/** + * SECTION:plugin-zxing + * + * Plugin for [ZXing](https://github.com/zxing-cpp/zxing-cpp), a bar code detector. + * + * Since: 1.18 + * */ #ifdef HAVE_CONFIG_H