summaryrefslogtreecommitdiff
path: root/user/gst-plugins-bad/mpegts.patch
blob: 1579c4e3286f180b133d427f210f69c529e97501 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1314

--- gst-plugins-bad-1.20.2/gst-libs/gst/mpegts/gstmpegtsdescriptor.c.old	2022-05-02 17:29:29.000000000 -0500
+++ gst-plugins-bad-1.20.2/gst-libs/gst/mpegts/gstmpegtsdescriptor.c	2022-07-02 23:19:51.027302943 -0500
@@ -296,7 +296,7 @@
 dvb_text_from_utf8 (const gchar * text, gsize * out_size)
 {
   GError *error = NULL;
-  gchar *out_text;
+  gchar *out_text = NULL;
   guint8 *out_buffer;
   guint encoding;
   GIConv giconv = (GIConv) - 1;
@@ -304,7 +304,8 @@
   /* We test character maps one-by-one. Start with the default */
   encoding = _ICONV_ISO6937;
   giconv = _get_iconv (_ICONV_UTF8, encoding);
-  out_text = g_convert_with_iconv (text, -1, giconv, NULL, out_size, &error);
+  if (giconv != (GIConv) - 1)
+    out_text = g_convert_with_iconv (text, -1, giconv, NULL, out_size, &error);
 
   if (out_text) {
     GST_DEBUG ("Using default ISO6937 encoding");
--- gst-plugins-bad-1.20.2/tests/check/libs/mpegts.c.old	2022-05-02 17:29:29.000000000 -0500
+++ gst-plugins-bad-1.20.2/tests/check/libs/mpegts.c	2022-07-02 23:41:27.379013955 -0500
@@ -71,6 +71,14 @@
   0xc0, 0x00, 0xc4, 0x86, 0x56, 0xa5
 };
 
+static gboolean
+_has_iso6937_iconv (void)
+{
+  GIConv test = (GIConv) - 1;
+  test = g_iconv_open("iso6937", "utf-8");
+  return (test != (GIConv) - 1);
+}
+
 GST_START_TEST (test_scte_sit)
 {
   GstMpegtsSCTESIT *sit;
@@ -397,11 +405,12 @@
 
   fail_if (data == NULL);
 
-  for (i = 0; i < data_size; i++) {
-    if (data[i] != nit_data_check[i])
-      fail ("0x%X != 0x%X in byte %d of NIT section", data[i],
-          nit_data_check[i], i);
-  }
+  if (_has_iso6937_iconv())
+    for (i = 0; i < data_size; i++) {
+      if (data[i] != nit_data_check[i])
+        fail ("0x%X != 0x%X in byte %d of NIT section", data[i],
+            nit_data_check[i], i);
+    }
 
   /* Check assertion on bad CRC. Reset parsed data, and make the CRC corrupt */
   nit_section->data[nit_section->section_length - 1]++;
@@ -486,11 +495,12 @@
 
   fail_if (data == NULL);
 
-  for (i = 0; i < data_size; i++) {
-    if (data[i] != sdt_data_check[i])
-      fail ("0x%X != 0x%X in byte %d of SDT section", data[i],
-          sdt_data_check[i], i);
-  }
+  if (_has_iso6937_iconv())
+    for (i = 0; i < data_size; i++) {
+      if (data[i] != sdt_data_check[i])
+        fail ("0x%X != 0x%X in byte %d of SDT section", data[i],
+            sdt_data_check[i], i);
+    }
 
   /* Check assertion on bad CRC. Reset parsed data, and make the CRC corrupt */
   sdt_section->data[sdt_section->section_length - 1]++;
@@ -594,14 +604,15 @@
   /* Check creation of descriptor */
   desc = gst_mpegts_descriptor_from_dvb_network_name ("Name");
   fail_if (desc == NULL);
-  fail_unless (desc->length == 4);
+  if (_has_iso6937_iconv()) fail_unless (desc->length == 4);
   fail_unless (desc->tag == 0x40);
 
-  for (i = 0; i < 6; i++) {
-    if (desc->data[i] != network_name_descriptor[i])
-      fail ("0x%X != 0x%X in byte %d of network name descriptor",
-          desc->data[i], network_name_descriptor[i], i);
-  }
+  if (_has_iso6937_iconv())
+    for (i = 0; i < 6; i++) {
+      if (desc->data[i] != network_name_descriptor[i])
+        fail ("0x%X != 0x%X in byte %d of network name descriptor",
+            desc->data[i], network_name_descriptor[i], i);
+    }
 
   /* Check parsing of descriptor */
   ret = gst_mpegts_descriptor_parse_dvb_network_name (desc, &string);
@@ -623,14 +634,15 @@
   desc = gst_mpegts_descriptor_from_dvb_service
       (GST_DVB_SERVICE_DIGITAL_TELEVISION, "Name", "Provider");
   fail_if (desc == NULL);
-  fail_unless (desc->length == 15);
+  if (_has_iso6937_iconv()) fail_unless (desc->length == 15);
   fail_unless (desc->tag == 0x48);
 
-  for (i = 0; i < 17; i++) {
-    if (desc->data[i] != service_descriptor[i])
-      fail ("0x%X != 0x%X in byte %d of service descriptor",
-          desc->data[i], service_descriptor[i], i);
-  }
+  if (_has_iso6937_iconv())
+    for (i = 0; i < 17; i++) {
+      if (desc->data[i] != service_descriptor[i])
+        fail ("0x%X != 0x%X in byte %d of service descriptor",
+            desc->data[i], service_descriptor[i], i);
+    }
 
   /* Check parsing of descriptor with data */
   ret = gst_mpegts_descriptor_parse_dvb_service