gst-plugins-bad: mpegtspacketizer: Handle all ISO8859-x encodings in get_encoding()

Edward Hervey bilboed at kemper.freedesktop.org
Mon Mar 21 11:58:00 PDT 2011


Module: gst-plugins-bad
Branch: master
Commit: b69450af92ba510b4c83ee875a8fe925e4b0b537
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=b69450af92ba510b4c83ee875a8fe925e4b0b537

Author: Mart Raudsepp <mart.raudsepp at collabora.co.uk>
Date:   Mon Mar 21 20:40:14 2011 +0200

mpegtspacketizer: Handle all ISO8859-x encodings in get_encoding()

... according to ETSI EN 300 468, "Selection of character table"

---

 gst/mpegdemux/mpegtspacketizer.c   |   25 +++++--------------------
 gst/mpegtsdemux/mpegtspacketizer.c |   25 +++++--------------------
 2 files changed, 10 insertions(+), 40 deletions(-)

diff --git a/gst/mpegdemux/mpegtspacketizer.c b/gst/mpegdemux/mpegtspacketizer.c
index a86ef0e..335c985 100644
--- a/gst/mpegdemux/mpegtspacketizer.c
+++ b/gst/mpegdemux/mpegtspacketizer.c
@@ -1646,8 +1646,8 @@ mpegts_packetizer_parse_eit (MpegTSPacketizer * packetizer,
             DESC_LENGTH (event_descriptor)) {
 
           eventname_tmp =
-              get_encoding_and_convert (eventname, eventname_length),
-              eventdescription_tmp =
+              get_encoding_and_convert (eventname, eventname_length);
+          eventdescription_tmp =
               get_encoding_and_convert (eventdescription,
               eventdescription_length);
 
@@ -2360,24 +2360,9 @@ get_encoding (const gchar * text, guint * start_text, gboolean * is_multibyte)
 
   firstbyte = (guint8) text[0];
 
-  if (firstbyte == 0x01) {
-    encoding = g_strdup ("iso8859-5");
-    *start_text = 1;
-    *is_multibyte = FALSE;
-  } else if (firstbyte == 0x02) {
-    encoding = g_strdup ("iso8859-6");
-    *start_text = 1;
-    *is_multibyte = FALSE;
-  } else if (firstbyte == 0x03) {
-    encoding = g_strdup ("iso8859-7");
-    *start_text = 1;
-    *is_multibyte = FALSE;
-  } else if (firstbyte == 0x04) {
-    encoding = g_strdup ("iso8859-8");
-    *start_text = 1;
-    *is_multibyte = FALSE;
-  } else if (firstbyte == 0x05) {
-    encoding = g_strdup ("iso8859-9");
+  /* ETSI EN 300 468, "Selection of character table" */
+  if (firstbyte <= 0x0B) {
+    encoding = g_strdup_printf ("iso8859-%u", firstbyte + 4);
     *start_text = 1;
     *is_multibyte = FALSE;
   } else if (firstbyte >= 0x20) {
diff --git a/gst/mpegtsdemux/mpegtspacketizer.c b/gst/mpegtsdemux/mpegtspacketizer.c
index f27918a..6b51c19 100644
--- a/gst/mpegtsdemux/mpegtspacketizer.c
+++ b/gst/mpegtsdemux/mpegtspacketizer.c
@@ -1693,8 +1693,8 @@ mpegts_packetizer_parse_eit (MpegTSPacketizer2 * packetizer,
             DESC_LENGTH (event_descriptor)) {
 
           eventname_tmp =
-              get_encoding_and_convert (eventname, eventname_length),
-              eventdescription_tmp =
+              get_encoding_and_convert (eventname, eventname_length);
+          eventdescription_tmp =
               get_encoding_and_convert (eventdescription,
               eventdescription_length);
 
@@ -2466,24 +2466,9 @@ get_encoding (const gchar * text, guint * start_text, gboolean * is_multibyte)
 
   firstbyte = (guint8) text[0];
 
-  if (firstbyte == 0x01) {
-    encoding = g_strdup ("iso8859-5");
-    *start_text = 1;
-    *is_multibyte = FALSE;
-  } else if (firstbyte == 0x02) {
-    encoding = g_strdup ("iso8859-6");
-    *start_text = 1;
-    *is_multibyte = FALSE;
-  } else if (firstbyte == 0x03) {
-    encoding = g_strdup ("iso8859-7");
-    *start_text = 1;
-    *is_multibyte = FALSE;
-  } else if (firstbyte == 0x04) {
-    encoding = g_strdup ("iso8859-8");
-    *start_text = 1;
-    *is_multibyte = FALSE;
-  } else if (firstbyte == 0x05) {
-    encoding = g_strdup ("iso8859-9");
+  /* ETSI EN 300 468, "Selection of character table" */
+  if (firstbyte <= 0x0B) {
+    encoding = g_strdup_printf ("iso8859-%u", firstbyte + 4);
     *start_text = 1;
     *is_multibyte = FALSE;
   } else if (firstbyte >= 0x20) {



More information about the gstreamer-commits mailing list