From 0c773b8cddbde4548c6d657c47de0fab82ba9e6f Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Thu, 10 Apr 2014 16:03:07 +0200 Subject: [PATCH] mpegts: add scrambling descriptor https://bugzilla.gnome.org/show_bug.cgi?id=727560 --- docs/libs/gst-plugins-bad-libs-sections.txt | 3 ++ gst-libs/gst/mpegts/gst-dvb-descriptor.c | 31 +++++++++++++++++++++ gst-libs/gst/mpegts/gst-dvb-descriptor.h | 19 +++++++++++++ 3 files changed, 53 insertions(+) diff --git a/docs/libs/gst-plugins-bad-libs-sections.txt b/docs/libs/gst-plugins-bad-libs-sections.txt index 46ba28a869..84e74d5d8e 100644 --- a/docs/libs/gst-plugins-bad-libs-sections.txt +++ b/docs/libs/gst-plugins-bad-libs-sections.txt @@ -307,6 +307,9 @@ gst_mpegts_descriptor_parse_dvb_frequency_list GstMpegTsDataBroadcastDescriptor gst_mpegts_descriptor_parse_dvb_data_broadcast + +GstMpegTsDvbScramblingModeType +gst_mpegts_descriptor_parse_dvb_scrambling gst_mpegts_descriptor_parse_dvb_data_broadcast_id diff --git a/gst-libs/gst/mpegts/gst-dvb-descriptor.c b/gst-libs/gst/mpegts/gst-dvb-descriptor.c index 3daec78387..76e941388e 100644 --- a/gst-libs/gst/mpegts/gst-dvb-descriptor.c +++ b/gst-libs/gst/mpegts/gst-dvb-descriptor.c @@ -1386,6 +1386,37 @@ gst_mpegts_descriptor_parse_dvb_data_broadcast (const GstMpegTsDescriptor return TRUE; } +/* GST_MTS_DESC_DVB_SCRAMBLING (0x65) */ +/** + * gst_mpegts_descriptor_parse_dvb_scrambling: + * @descriptor: a %GST_MTS_DESC_DVB_SCRAMBLING #GstMpegTsDescriptor + * @scrambling_mode: (out): This 8-bit field identifies the selected + * mode of the scrambling algorithm (#GstMpegTsDVBScramblingModeType). + * The technical details of the scrambling algorithm are available only + * to bona-fide users upon signature of a Non Disclosure Agreement (NDA) + * administered by the DVB Common Scrambling Algorithm Custodian. + * + * Parses out the scrambling mode from the @descriptor. + * + * Returns: %TRUE if the parsing happened correctly, else %FALSE. + */ +gboolean +gst_mpegts_descriptor_parse_dvb_scrambling (const GstMpegTsDescriptor * + descriptor, GstMpegTsDVBScramblingModeType * scrambling_mode) +{ + guint8 *data; + + g_return_val_if_fail (descriptor != NULL && scrambling_mode != NULL, FALSE); + __common_desc_checks_exact (descriptor, GST_MTS_DESC_DVB_SCRAMBLING, 1, + FALSE); + + data = (guint8 *) descriptor->data + 2; + + *scrambling_mode = *data; + + return TRUE; +} + /* GST_MTS_DESC_DVB_DATA_BROADCAST_ID (0x66) */ /** * gst_mpegts_descriptor_parse_dvb_data_broadcast_id: diff --git a/gst-libs/gst/mpegts/gst-dvb-descriptor.h b/gst-libs/gst/mpegts/gst-dvb-descriptor.h index f65663518d..727dbff53f 100644 --- a/gst-libs/gst/mpegts/gst-dvb-descriptor.h +++ b/gst-libs/gst/mpegts/gst-dvb-descriptor.h @@ -658,6 +658,25 @@ struct _GstMpegTsDataBroadcastDescriptor gboolean gst_mpegts_descriptor_parse_dvb_data_broadcast (const GstMpegTsDescriptor *descriptor, GstMpegTsDataBroadcastDescriptor * res); +/* GST_MTS_DESC_DVB_SCRAMBLING (0x65) */ +typedef enum +{ + GST_MPEGTS_DVB_SCRAMBLING_MODE_RESERVED = 0x00, + GST_MPEGTS_DVB_SCRAMBLING_MODE_CSA1 = 0x01, + GST_MPEGTS_DVB_SCRAMBLING_MODE_CSA2 = 0x02, + GST_MPEGTS_DVB_SCRAMBLING_MODE_CSA3_STANDARD = 0x03, + GST_MPEGTS_DVB_SCRAMBLING_MODE_CSA3_MINIMAL_ENHANCED = 0x04, + GST_MPEGTS_DVB_SCRAMBLING_MODE_CSA3_FULL_ENHANCED = 0x05, + /* 0x06 - 0x0f reserved for future use */ + GST_MPEGTS_DVB_SCRAMBLING_MODE_CISSA = 0x10, + /* 0x11 - 0x1f reserved for future DVB-CISSA versions */ + GST_MPEGTS_DVB_SCRAMBLING_MODE_ATIS_0 = 0x70, + GST_MPEGTS_DVB_SCRAMBLING_MODE_ATIS_F = 0x7f, +} GstMpegTsDVBScramblingModeType; + +gboolean gst_mpegts_descriptor_parse_dvb_scrambling (const GstMpegTsDescriptor * descriptor, + GstMpegTsDVBScramblingModeType * scrambling_mode); + /* GST_MTS_DESC_DVB_DATA_BROADCAST_ID (0x66) */ gboolean gst_mpegts_descriptor_parse_dvb_data_broadcast_id (const GstMpegTsDescriptor * descriptor, guint16 * data_broadcast_id, guint8 ** id_selector_bytes, guint8 * len);