gst-plugins-bad/gst-plugins-bad-1.20.5-zxing-cpp-2.0.0.patch

64 lines
2.0 KiB
Diff
Raw Permalink Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
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
index 7836dbbcf18e..a8a0f7b49aa4 100644
--- 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;
@@ -369,32 +370,40 @@ gst_zxing_transform_frame_ip (GstVideoFilter * vfilter, GstVideoFrame * frame)
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;
}
/* 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",
"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);