mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
mpegts: atsc: add encoding conversion for UTF-16 ETT strings
https://bugzilla.gnome.org/show_bug.cgi?id=730435
This commit is contained in:
parent
01178115a4
commit
0c0379e8f0
1 changed files with 29 additions and 3 deletions
|
@ -418,16 +418,42 @@ _gst_mpegts_atsc_string_segment_free (GstMpegTsAtscStringSegment * seg)
|
|||
static void
|
||||
_gst_mpegts_atsc_string_segment_decode_string (GstMpegTsAtscStringSegment * seg)
|
||||
{
|
||||
const gchar *from_encoding;
|
||||
|
||||
g_return_if_fail (seg->cached_string == NULL);
|
||||
|
||||
if (seg->compression_type != 0) {
|
||||
GST_FIXME ("Compressed strings not yet supported");
|
||||
return;
|
||||
}
|
||||
/* FIXME check encoding */
|
||||
|
||||
seg->cached_string =
|
||||
g_strndup ((gchar *) seg->compressed_data, seg->compressed_data_size);
|
||||
/* FIXME add more encodings */
|
||||
switch (seg->mode) {
|
||||
case 0x3F:
|
||||
from_encoding = "UTF-16BE";
|
||||
break;
|
||||
default:
|
||||
from_encoding = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (from_encoding != NULL) {
|
||||
GError *err = NULL;
|
||||
|
||||
seg->cached_string =
|
||||
g_convert ((gchar *) seg->compressed_data,
|
||||
(gssize) seg->compressed_data_size, "UTF-8", from_encoding, NULL, NULL,
|
||||
&err);
|
||||
|
||||
if (err) {
|
||||
GST_WARNING ("Failed to convert input string from codeset %s",
|
||||
from_encoding);
|
||||
g_error_free (err);
|
||||
}
|
||||
} else {
|
||||
seg->cached_string =
|
||||
g_strndup ((gchar *) seg->compressed_data, seg->compressed_data_size);
|
||||
}
|
||||
}
|
||||
|
||||
const gchar *
|
||||
|
|
Loading…
Reference in a new issue