PKGBUILDs/extra/gstreamer/0003-Support-zxing-c-2.0.patch

64 lines
2 KiB
Diff
Raw Normal View History

2023-01-08 14:52:42 +00:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2023-01-07 16:35:57 +00:00
From: Antonio Rojas <arojas@archlinux.org>
Date: Sat, 7 Jan 2023 16:18:03 +0100
Subject: [PATCH] Support zxing-c++ 2.0
format is a C++ string in 2.0
---
subprojects/gst-plugins-bad/ext/zxing/gstzxing.cpp | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/subprojects/gst-plugins-bad/ext/zxing/gstzxing.cpp b/subprojects/gst-plugins-bad/ext/zxing/gstzxing.cpp
2023-01-08 14:52:42 +00:00
index 7836dbbcf18e..a8a0f7b49aa4 100644
2023-01-07 16:35:57 +00:00
--- a/subprojects/gst-plugins-bad/ext/zxing/gstzxing.cpp
+++ b/subprojects/gst-plugins-bad/ext/zxing/gstzxing.cpp
@@ -62,6 +62,7 @@
#include "ReadBarcode.h"
#include "TextUtfEncoding.h"
+#include "ZXVersion.h"
using namespace ZXing;
2023-01-08 14:52:42 +00:00
@@ -369,32 +370,40 @@ gst_zxing_transform_frame_ip (GstVideoFilter * vfilter, GstVideoFrame * frame)
2023-01-07 16:35:57 +00:00
if (result.isValid ()) {
GST_DEBUG_OBJECT (zxing, "Symbol found. Text: %s Format: %s",
result.text ().c_str (),
+#if ZXING_VERSION_MAJOR >= 2
+ ToString (result.format ()).c_str ());
+#else
ToString (result.format ()));
+#endif
} else {
goto out;
}
2023-01-08 14:52:42 +00:00
/* extract results */
if (zxing->message) {
GstMessage *m;
GstStructure *s;
GstSample *sample;
GstCaps *sample_caps;
GstClockTime timestamp, running_time, stream_time;
timestamp = GST_BUFFER_TIMESTAMP (frame->buffer);
running_time =
gst_segment_to_running_time (&GST_BASE_TRANSFORM (zxing)->segment,
GST_FORMAT_TIME, timestamp);
stream_time =
gst_segment_to_stream_time (&GST_BASE_TRANSFORM (zxing)->segment,
GST_FORMAT_TIME, timestamp);
s = gst_structure_new ("barcode",
2023-01-07 16:35:57 +00:00
"timestamp", G_TYPE_UINT64, timestamp,
"stream-time", G_TYPE_UINT64, stream_time,
"running-time", G_TYPE_UINT64, running_time,
+#if ZXING_VERSION_MAJOR >= 2
+ "type", G_TYPE_STRING, ToString (result.format ()).c_str (),
+#else
"type", G_TYPE_STRING, ToString (result.format ()),
+#endif
"symbol", G_TYPE_STRING,
result.text ().c_str (), NULL);