From 6a622a678e113fc6f560ff562468ab840e310659 Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Wed, 28 May 2014 16:47:53 +0200 Subject: [PATCH] example: ts-parser: add parential rating descriptor https://bugzilla.gnome.org/show_bug.cgi?id=730854 --- gst-libs/gst/mpegts/gst-dvb-descriptor.c | 1 + tests/examples/mpegts/ts-parser.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/gst-libs/gst/mpegts/gst-dvb-descriptor.c b/gst-libs/gst/mpegts/gst-dvb-descriptor.c index 7a2332a..2874e86 100644 --- a/gst-libs/gst/mpegts/gst-dvb-descriptor.c +++ b/gst-libs/gst/mpegts/gst-dvb-descriptor.c @@ -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) { diff --git a/tests/examples/mpegts/ts-parser.c b/tests/examples/mpegts/ts-parser.c index 00435c6..86c53ee 100644 --- a/tests/examples/mpegts/ts-parser.c +++ b/tests/examples/mpegts/ts-parser.c @@ -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; -- 2.7.4