example: ts-parser: add parential rating descriptor
authorStefan Ringel <linuxtv@stefanringel.de>
Wed, 28 May 2014 14:47:53 +0000 (16:47 +0200)
committerEdward Hervey <bilboed@bilboed.com>
Thu, 29 May 2014 12:29:15 +0000 (14:29 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=730854

gst-libs/gst/mpegts/gst-dvb-descriptor.c
tests/examples/mpegts/ts-parser.c

index 7a2332a..2874e86 100644 (file)
@@ -1166,6 +1166,7 @@ gst_mpegts_descriptor_parse_dvb_parental_rating (const GstMpegTsDescriptor
     g_ptr_array_add (*rating, item);
 
     memcpy (item->country_code, data, 3);
+    item->country_code[3] = 0;
     data += 3;
 
     if (g_strcmp0 (item->country_code, "BRA") == 0) {
index 00435c6..86c53ee 100644 (file)
@@ -630,6 +630,23 @@ dump_descriptors (GPtrArray * descriptors, guint spacing)
       case GST_MTS_DESC_DVB_CONTENT:
         dump_content (desc, spacing + 2);
         break;
+      case GST_MTS_DESC_DVB_PARENTAL_RATING:
+      {
+        GPtrArray *ratings;
+        guint j;
+
+        if (gst_mpegts_descriptor_parse_dvb_parental_rating (desc, &ratings)) {
+          for (j = 0; j < ratings->len; j++) {
+            GstMpegTsDVBParentalRatingItem *item =
+                g_ptr_array_index (ratings, j);
+            g_printf ("%*s   country_code : %s\n", spacing, "",
+                item->country_code);
+            g_printf ("%*s   rating age   : %d\n", spacing, "", item->rating);
+          }
+          g_ptr_array_unref (ratings);
+        }
+        break;
+      }
       case GST_MTS_DESC_ISO_639_LANGUAGE:
         dump_iso_639_language (desc, spacing + 2);
         break;