archrelease: copy trunk to extra-any
[arch-packages.git] / gstreamer / trunk / 0002-Support-zxing-c-2.0.patch
blob08d86bce1c85248a60791dbf1a4aa176228f44e8
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Antonio Rojas <arojas@archlinux.org>
3 Date: Sat, 7 Jan 2023 16:18:03 +0100
4 Subject: [PATCH] Support zxing-c++ 2.0
6 format is a C++ string in 2.0
7 ---
8 subprojects/gst-plugins-bad/ext/zxing/gstzxing.cpp | 9 +++++++++
9 1 file changed, 9 insertions(+)
11 diff --git a/subprojects/gst-plugins-bad/ext/zxing/gstzxing.cpp b/subprojects/gst-plugins-bad/ext/zxing/gstzxing.cpp
12 index 7836dbbcf18e..a8a0f7b49aa4 100644
13 --- a/subprojects/gst-plugins-bad/ext/zxing/gstzxing.cpp
14 +++ b/subprojects/gst-plugins-bad/ext/zxing/gstzxing.cpp
15 @@ -62,6 +62,7 @@
17 #include "ReadBarcode.h"
18 #include "TextUtfEncoding.h"
19 +#include "ZXVersion.h"
21 using namespace ZXing;
23 @@ -369,32 +370,40 @@ gst_zxing_transform_frame_ip (GstVideoFilter * vfilter, GstVideoFrame * frame)
24 if (result.isValid ()) {
25 GST_DEBUG_OBJECT (zxing, "Symbol found. Text: %s Format: %s",
26 result.text ().c_str (),
27 +#if ZXING_VERSION_MAJOR >= 2
28 + ToString (result.format ()).c_str ());
29 +#else
30 ToString (result.format ()));
31 +#endif
32 } else {
33 goto out;
36 /* extract results */
37 if (zxing->message) {
38 GstMessage *m;
39 GstStructure *s;
40 GstSample *sample;
41 GstCaps *sample_caps;
42 GstClockTime timestamp, running_time, stream_time;
44 timestamp = GST_BUFFER_TIMESTAMP (frame->buffer);
45 running_time =
46 gst_segment_to_running_time (&GST_BASE_TRANSFORM (zxing)->segment,
47 GST_FORMAT_TIME, timestamp);
48 stream_time =
49 gst_segment_to_stream_time (&GST_BASE_TRANSFORM (zxing)->segment,
50 GST_FORMAT_TIME, timestamp);
52 s = gst_structure_new ("barcode",
53 "timestamp", G_TYPE_UINT64, timestamp,
54 "stream-time", G_TYPE_UINT64, stream_time,
55 "running-time", G_TYPE_UINT64, running_time,
56 +#if ZXING_VERSION_MAJOR >= 2
57 + "type", G_TYPE_STRING, ToString (result.format ()).c_str (),
58 +#else
59 "type", G_TYPE_STRING, ToString (result.format ()),
60 +#endif
61 "symbol", G_TYPE_STRING,
62 result.text ().c_str (), NULL);