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;
/* 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");
0xc0, 0x00, 0xc4, 0x86, 0x56, 0xa5
};
+static gboolean
+_has_iso6937_iconv (void)
+{
+ gboolean supported;
+ GIConv test = g_iconv_open ("iso6937", "utf-8");
+ supported = (test != (GIConv) - 1);
+ g_iconv_close (test);
+ return supported;
+}
+
GST_START_TEST (test_scte_sit)
{
GstMpegtsSCTESIT *sit;
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 */
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 */
/* 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 */
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 */