mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
mpegts: split dvb descriptors/enums into a separate file
We will do the same once we have ATSC/ISDB/... descriptor parsing
This commit is contained in:
parent
6a611e5d3d
commit
51d8fa5860
7 changed files with 637 additions and 549 deletions
|
@ -3,6 +3,7 @@ lib_LTLIBRARIES = libgstmpegts-@GST_API_VERSION@.la
|
|||
libgstmpegts_@GST_API_VERSION@_la_SOURCES = \
|
||||
gstmpegtssection.c \
|
||||
gstmpegtsdescriptor.c \
|
||||
gst-dvb-descriptor.c \
|
||||
gst-dvb-section.c
|
||||
|
||||
libgstmpegts_@GST_API_VERSION@includedir = \
|
||||
|
@ -15,6 +16,7 @@ libgstmpegts_@GST_API_VERSION@include_HEADERS = \
|
|||
gst-atsc-section.h \
|
||||
gst-dvb-section.h \
|
||||
gstmpegtsdescriptor.h \
|
||||
gst-dvb-descriptor.h \
|
||||
mpegts.h
|
||||
|
||||
|
||||
|
@ -35,7 +37,9 @@ libgstmpegts_@GST_API_VERSION@_la_LDFLAGS = \
|
|||
glib_enum_headers=gstmpegtssection.h \
|
||||
gstmpegtsdescriptor.h \
|
||||
gst-atsc-section.h \
|
||||
gst-dvb-section.h
|
||||
gst-dvb-section.h \
|
||||
gst-dvb-descriptor.h
|
||||
|
||||
glib_enum_define=GST_MPEGTS
|
||||
glib_gen_prefix=gst_mpegts
|
||||
glib_gen_basename=gstmpegts
|
||||
|
|
283
gst-libs/gst/mpegts/gst-dvb-descriptor.c
Normal file
283
gst-libs/gst/mpegts/gst-dvb-descriptor.c
Normal file
|
@ -0,0 +1,283 @@
|
|||
/*
|
||||
* gstmpegtsdescriptor.c -
|
||||
* Copyright (C) 2013 Edward Hervey
|
||||
*
|
||||
* Authors:
|
||||
* Edward Hervey <edward@collabora.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mpegts.h"
|
||||
#include "gstmpegts-private.h"
|
||||
|
||||
|
||||
/*
|
||||
* TODO
|
||||
*
|
||||
* * Add common validation code for data presence and minimum/maximum expected
|
||||
* size.
|
||||
* * Add parsing methods for the following descriptors that were previously
|
||||
* handled in mpegtsbase:
|
||||
* * GST_MTS_DESC_DVB_DATA_BROADCAST_ID
|
||||
* * GST_MTS_DESC_DVB_DATA_BROADCAST
|
||||
* * GST_MTS_DESC_DVB_CAROUSEL_IDENTIFIER
|
||||
* * GST_MTS_DESC_DVB_STREAM_IDENTIFIER
|
||||
* * GST_MTS_DESC_DVB_EXTENDED_EVENT
|
||||
* * GST_MTS_DESC_DVB_COMPONENT
|
||||
* * GST_MTS_DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM
|
||||
* * GST_MTS_DESC_DVB_FREQUENCY_LIST
|
||||
*/
|
||||
|
||||
|
||||
/* GST_MTS_DESC_DVB_NETWORK_NAME (0x40) */
|
||||
/**
|
||||
* gst_mpegts_descriptor_parse_dvb_network_name:
|
||||
* @descriptor: a %GST_MTS_DESC_DVB_NETWORK_NAME #GstMpegTsDescriptor
|
||||
* @name: (out) (transfer full): the extracted name
|
||||
*
|
||||
* Parses out the dvb network name from the @descriptor:
|
||||
*
|
||||
* Returns: %TRUE if the parsing happened correctly, else %FALSE.
|
||||
*/
|
||||
gboolean
|
||||
gst_mpegts_descriptor_parse_dvb_network_name (const GstMpegTsDescriptor *
|
||||
descriptor, gchar ** name)
|
||||
{
|
||||
g_return_val_if_fail (descriptor != NULL
|
||||
&& descriptor->descriptor_data != NULL, FALSE);
|
||||
g_return_val_if_fail (descriptor->descriptor_tag == 0x40, FALSE);
|
||||
|
||||
*name = get_encoding_and_convert ((gchar *) descriptor->descriptor_data + 2,
|
||||
descriptor->descriptor_data[1]);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* GST_MTS_DESC_DVB_SATELLITE_DELIVERY_SYSTEM (0x43) */
|
||||
/**
|
||||
* gst_mpegts_descriptor_parse_satellite_delivery_system:
|
||||
* @descriptor: a %GST_MTS_DESC_DVB_SATELLITE_DELIVERY_SYSTEM #GstMpegTsDescriptor
|
||||
* @res: (out) (transfer none): the #GstMpegTsSatelliteDeliverySystemDescriptor to fill
|
||||
*
|
||||
* Extracts the satellite delivery system information from @descriptor.
|
||||
*
|
||||
* Returns: %TRUE if parsing succeeded, else %FALSE.
|
||||
*/
|
||||
gboolean
|
||||
gst_mpegts_descriptor_parse_satellite_delivery_system (const GstMpegTsDescriptor
|
||||
* descriptor, GstMpegTsSatelliteDeliverySystemDescriptor * res)
|
||||
{
|
||||
guint8 *data;
|
||||
guint8 tmp;
|
||||
|
||||
g_return_val_if_fail (descriptor != NULL
|
||||
&& descriptor->descriptor_data != NULL, FALSE);
|
||||
g_return_val_if_fail (res != NULL, FALSE);
|
||||
g_return_val_if_fail (descriptor->descriptor_tag == 0x43, FALSE);
|
||||
|
||||
data = (guint8 *) descriptor->descriptor_data + 2;
|
||||
|
||||
#define BCD_UN(a) ((a) & 0x0f)
|
||||
#define BCD_DEC(a) (((a) >> 4) & 0x0f)
|
||||
#define BCD(a) (BCD_UN(a) + 10 * BCD_DEC(a))
|
||||
#define BCD_16(a) (BCD(a[1]) + 100 * BCD(a[0]))
|
||||
#define BCD_28(a) (BCD_DEC(a[3]) + 10 * BCD(a[2]) + 1000 * BCD(a[1]) + 100000 * BCD(a[0]))
|
||||
#define BCD_32(a) (BCD(a[3]) + 100 * BCD(a[2]) + 10000 * BCD(a[1]) + 1000000 * BCD(a[0]))
|
||||
|
||||
/* BCD coded frequency in GHz (decimal point occurs after the 3rd character)
|
||||
* So direct BCD gives us units of (GHz / 100 000) = 10 kHz*/
|
||||
res->frequency = BCD_32 (data) * 10;
|
||||
data += 4;
|
||||
/* BCD codec position in degrees (float pointer after the 3rd character) */
|
||||
res->orbital_position = (BCD_16 (data)) / 10.0;
|
||||
data += 2;
|
||||
|
||||
tmp = *data;
|
||||
res->west_east = (tmp & 0x80) == 0x80;
|
||||
res->polarization = (tmp >> 7) & 0x03;
|
||||
res->modulation_system = (tmp & 0x04) == 0x04;
|
||||
if (res->modulation_system)
|
||||
res->roll_off = (tmp >> 3 & 0x03);
|
||||
else
|
||||
res->roll_off = GST_MPEGTS_ROLLOFF_AUTO;
|
||||
switch (tmp & 0x03) {
|
||||
case 0x00:
|
||||
res->modulation_type = GST_MPEGTS_MODULATION_QAM_AUTO;
|
||||
break;
|
||||
case 0x01:
|
||||
res->modulation_type = GST_MPEGTS_MODULATION_QPSK;
|
||||
break;
|
||||
case 0x10:
|
||||
res->modulation_type = GST_MPEGTS_MODULATION_PSK_8;
|
||||
break;
|
||||
case 0x11:
|
||||
res->modulation_type = GST_MPEGTS_MODULATION_QAM_16;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
res->modulation_type = tmp & 0x03;
|
||||
data += 1;
|
||||
/* symbol_rate is in Msymbols/ (decimal point occurs after 3rd character) */
|
||||
/* So direct BCD gives us units of (Msymbol / 10 000) = 100 sym/s */
|
||||
res->symbol_rate = BCD_28 (data) * 100;
|
||||
data += 3;
|
||||
/* fec_inner */
|
||||
res->fec_inner = *data >> 4;
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* GST_MTS_DESC_DVB_CABLE_DELIVERY_SYSTEM (0x44) */
|
||||
/**
|
||||
* gst_mpegts_descriptor_parse_cable_delivery_system:
|
||||
* @descriptor: a %GST_MTS_DESC_DVB_CABLE_DELIVERY_SYSTEM #GstMpegTsDescriptor
|
||||
* @res: (out) (transfer none): the #GstMpegTsCableDeliverySystemDescriptor to fill
|
||||
*
|
||||
* Extracts the cable delivery system information from @descriptor.
|
||||
*
|
||||
* Returns: %TRUE if parsing succeeded, else %FALSE.
|
||||
*/
|
||||
gboolean
|
||||
gst_mpegts_descriptor_parse_cable_delivery_system (const GstMpegTsDescriptor *
|
||||
descriptor, GstMpegTsCableDeliverySystemDescriptor * res)
|
||||
{
|
||||
guint8 *data;
|
||||
|
||||
g_return_val_if_fail (descriptor != NULL
|
||||
&& descriptor->descriptor_data != NULL, FALSE);
|
||||
g_return_val_if_fail (res != NULL, FALSE);
|
||||
g_return_val_if_fail (descriptor->descriptor_tag == 0x44, FALSE);
|
||||
|
||||
data = (guint8 *) descriptor->descriptor_data + 2;
|
||||
/* BCD in MHz, decimal place after the fourth character */
|
||||
res->frequency = BCD_32 (data) * 100;
|
||||
data += 5;
|
||||
/* fec_out (4bits) */
|
||||
res->outer_fec = *data++ & 0x0f;
|
||||
switch (*data) {
|
||||
case 0x00:
|
||||
res->modulation = GST_MPEGTS_MODULATION_NONE;
|
||||
break;
|
||||
case 0x01:
|
||||
res->modulation = GST_MPEGTS_MODULATION_QAM_16;
|
||||
break;
|
||||
case 0x02:
|
||||
res->modulation = GST_MPEGTS_MODULATION_QAM_32;
|
||||
break;
|
||||
case 0x03:
|
||||
res->modulation = GST_MPEGTS_MODULATION_QAM_64;
|
||||
break;
|
||||
case 0x04:
|
||||
res->modulation = GST_MPEGTS_MODULATION_QAM_128;
|
||||
break;
|
||||
case 0x05:
|
||||
res->modulation = GST_MPEGTS_MODULATION_QAM_256;
|
||||
break;
|
||||
default:
|
||||
GST_WARNING ("Unsupported cable modulation type: 0x%02x", *data);
|
||||
res->modulation = GST_MPEGTS_MODULATION_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
data += 1;
|
||||
/* symbol_rate is in Msymbols/ (decimal point occurs after 3rd character) */
|
||||
/* So direct BCD gives us units of (Msymbol / 10 000) = 100 sym/s */
|
||||
res->symbol_rate = BCD_28 (data) * 100;
|
||||
data += 3;
|
||||
/* fec_inner */
|
||||
res->fec_inner = *data & 0x0f;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* GST_MTS_DESC_DVB_SERVICE (0x48) */
|
||||
/**
|
||||
* gst_mpegts_descriptor_parse_dvb_service:
|
||||
* @descriptor: a %GST_MTS_DESC_DVB_SERVICE #GstMpegTsDescriptor
|
||||
* @service_type: (out) (allow-none): the service type
|
||||
* @service_name: (out) (transfer full) (allow-none): the service name
|
||||
* @provider_name: (out) (transfer full) (allow-none): the provider name
|
||||
*
|
||||
* Extracts the dvb service information from @descriptor.
|
||||
*
|
||||
* Returns: %TRUE if parsing succeeded, else %FALSE.
|
||||
*/
|
||||
gboolean
|
||||
gst_mpegts_descriptor_parse_dvb_service (const GstMpegTsDescriptor *
|
||||
descriptor, GstMpegTsDVBServiceType * service_type, gchar ** service_name,
|
||||
gchar ** provider_name)
|
||||
{
|
||||
guint8 *data;
|
||||
|
||||
g_return_val_if_fail (descriptor != NULL
|
||||
&& descriptor->descriptor_data != NULL, FALSE);
|
||||
g_return_val_if_fail (descriptor->descriptor_tag == 0x48, FALSE);
|
||||
|
||||
data = (guint8 *) descriptor->descriptor_data + 2;
|
||||
|
||||
if (service_type)
|
||||
*service_type = *data;
|
||||
data += 1;
|
||||
if (provider_name)
|
||||
*provider_name = get_encoding_and_convert ((const gchar *) data + 1, *data);
|
||||
data += *data + 1;
|
||||
if (service_name)
|
||||
*service_name = get_encoding_and_convert ((const gchar *) data + 1, *data);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* GST_MTS_DESC_DVB_SHORT_EVENT (0x4D) */
|
||||
/**
|
||||
* gst_mpegts_descriptor_parse_dvb_short_event:
|
||||
* @descriptor: a %GST_MTS_DESC_DVB_SHORT_EVENT #GstMpegTsDescriptor
|
||||
* @language_code: (out) (transfer full) (allow-none): the language code
|
||||
* @event_name: (out) (transfer full) (allow-none): the event name
|
||||
* @text: (out) (transfer full) (allow-none): the event text
|
||||
*
|
||||
* Extracts the DVB short event information from @descriptor.
|
||||
*
|
||||
* Returns: %TRUE if parsing succeeded, else %FALSE.
|
||||
*/
|
||||
gboolean
|
||||
gst_mpegts_descriptor_parse_dvb_short_event (const GstMpegTsDescriptor *
|
||||
descriptor, gchar ** language_code, gchar ** event_name, gchar ** text)
|
||||
{
|
||||
guint8 *data;
|
||||
|
||||
g_return_val_if_fail (descriptor != NULL
|
||||
&& descriptor->descriptor_data != NULL, FALSE);
|
||||
g_return_val_if_fail (descriptor->descriptor_tag == 0x4D, FALSE);
|
||||
|
||||
data = (guint8 *) descriptor->descriptor_data + 2;
|
||||
|
||||
if (language_code) {
|
||||
*language_code = g_malloc0 (4);
|
||||
memcpy (*language_code, data, 3);
|
||||
}
|
||||
data += 3;
|
||||
if (event_name)
|
||||
*event_name = get_encoding_and_convert ((const gchar *) data + 1, *data);
|
||||
data += *data + 1;
|
||||
if (text)
|
||||
*text = get_encoding_and_convert ((const gchar *) data + 1, *data);
|
||||
return TRUE;
|
||||
}
|
346
gst-libs/gst/mpegts/gst-dvb-descriptor.h
Normal file
346
gst-libs/gst/mpegts/gst-dvb-descriptor.h
Normal file
|
@ -0,0 +1,346 @@
|
|||
/*
|
||||
* gstmpegtsdescriptor.h -
|
||||
* Copyright (C) 2013 Edward Hervey
|
||||
*
|
||||
* Authors:
|
||||
* Edward Hervey <edward@collabora.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Some parts of this code come from the Fluendo MPEG Demuxer plugin.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Fluendo, S.L.
|
||||
* Portions created by Fluendo, S.L. are Copyright (C) 2005
|
||||
* Fluendo, S.L. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Wim Taymans <wim@fluendo.com>
|
||||
*/
|
||||
|
||||
#ifndef GST_DVB_DESCRIPTOR_H
|
||||
#define GST_DVB_DESCRIPTOR_H
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
typedef enum {
|
||||
/* 64-127 DVB tags ETSI EN 300 468
|
||||
* (Specification for Service Information (SI) in DVB systems)
|
||||
*/
|
||||
GST_MTS_DESC_DVB_NETWORK_NAME = 0x40,
|
||||
GST_MTS_DESC_DVB_SERVICE_LIST = 0x41,
|
||||
GST_MTS_DESC_DVB_STUFFING = 0x42,
|
||||
GST_MTS_DESC_DVB_SATELLITE_DELIVERY_SYSTEM = 0x43,
|
||||
GST_MTS_DESC_DVB_CABLE_DELIVERY_SYSTEM = 0x44,
|
||||
GST_MTS_DESC_DVB_VBI_DATA = 0x45,
|
||||
GST_MTS_DESC_DVB_VBI_TELETEXT = 0x46,
|
||||
GST_MTS_DESC_DVB_BOUQUET_NAME = 0x47,
|
||||
GST_MTS_DESC_DVB_SERVICE = 0x48,
|
||||
GST_MTS_DESC_DVB_COUNTRY_AVAILABILITY = 0x49,
|
||||
GST_MTS_DESC_DVB_LINKAGE = 0x4A,
|
||||
GST_MTS_DESC_DVB_NVOD_REFERENCE = 0x4B,
|
||||
GST_MTS_DESC_DVB_TIME_SHIFTED_SERVICE = 0x4C,
|
||||
GST_MTS_DESC_DVB_SHORT_EVENT = 0x4D,
|
||||
GST_MTS_DESC_DVB_EXTENDED_EVENT = 0x4E,
|
||||
GST_MTS_DESC_DVB_TIME_SHIFTED_EVENT = 0x4F,
|
||||
GST_MTS_DESC_DVB_COMPONENT = 0x50,
|
||||
GST_MTS_DESC_DVB_MOSAIC = 0x51,
|
||||
GST_MTS_DESC_DVB_STREAM_IDENTIFIER = 0x52,
|
||||
GST_MTS_DESC_DVB_CA_IDENTIFIER = 0x53,
|
||||
GST_MTS_DESC_DVB_CONTENT = 0x54,
|
||||
GST_MTS_DESC_DVB_PARENTAL_RATING = 0x55,
|
||||
GST_MTS_DESC_DVB_TELETEXT = 0x56,
|
||||
GST_MTS_DESC_DVB_TELEPHONE = 0x57,
|
||||
GST_MTS_DESC_DVB_LOCAL_TIME_OFFSET = 0x58,
|
||||
GST_MTS_DESC_DVB_SUBTITLING = 0x59,
|
||||
GST_MTS_DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM = 0x5A,
|
||||
GST_MTS_DESC_DVB_MULTILINGUAL_NETWORK_NAME = 0x5B,
|
||||
GST_MTS_DESC_DVB_MULTILINGUAL_BOUQUET_NAME = 0x5C,
|
||||
GST_MTS_DESC_DVB_MULTILINGUAL_SERVICE_NAME = 0x5D,
|
||||
GST_MTS_DESC_DVB_MULTILINGUAL_COMPONENT = 0x5E,
|
||||
GST_MTS_DESC_DVB_PRIVATE_DATA_SPECIFIER = 0x5F,
|
||||
GST_MTS_DESC_DVB_SERVICE_MOVE = 0x60,
|
||||
GST_MTS_DESC_DVB_SHORT_SMOOTHING_BUFFER = 0x61,
|
||||
GST_MTS_DESC_DVB_FREQUENCY_LIST = 0x62,
|
||||
GST_MTS_DESC_DVB_PARTIAL_TRANSPORT_STREAM = 0x63,
|
||||
GST_MTS_DESC_DVB_DATA_BROADCAST = 0x64,
|
||||
GST_MTS_DESC_DVB_SCRAMBLING = 0x65,
|
||||
GST_MTS_DESC_DVB_DATA_BROADCAST_ID = 0x66,
|
||||
GST_MTS_DESC_DVB_TRANSPORT_STREAM = 0x67,
|
||||
GST_MTS_DESC_DVB_DSNG = 0x68,
|
||||
GST_MTS_DESC_DVB_PDC = 0x69,
|
||||
GST_MTS_DESC_DVB_AC3 = 0x6A,
|
||||
GST_MTS_DESC_DVB_ANCILLARY_DATA = 0x6B,
|
||||
GST_MTS_DESC_DVB_CELL_LIST = 0x6C,
|
||||
GST_MTS_DESC_DVB_CELL_FREQUENCY_LINK = 0x6D,
|
||||
GST_MTS_DESC_DVB_ANNOUNCEMENT_SUPPORT = 0x6E,
|
||||
GST_MTS_DESC_DVB_APPLICATION_SIGNALLING = 0x6F,
|
||||
GST_MTS_DESC_DVB_ADAPTATION_FIELD_DATA = 0x70,
|
||||
GST_MTS_DESC_DVB_SERVICE_IDENTIFIER = 0x71,
|
||||
GST_MTS_DESC_DVB_SERVICE_AVAILABILITY = 0x72,
|
||||
GST_MTS_DESC_DVB_DEFAULT_AUTHORITY = 0x73,
|
||||
GST_MTS_DESC_DVB_RELATED_CONTENT = 0x74,
|
||||
GST_MTS_DESC_DVB_TVA_ID = 0x75,
|
||||
GST_MTS_DESC_DVB_CONTENT_IDENTIFIER = 0x76,
|
||||
GST_MTS_DESC_DVB_TIMESLICE_FEC_IDENTIFIER = 0x77,
|
||||
GST_MTS_DESC_DVB_ECM_REPETITION_RATE = 0x78,
|
||||
GST_MTS_DESC_DVB_S2_SATELLITE_DELIVERY_SYSTEM = 0x79,
|
||||
GST_MTS_DESC_DVB_ENHANCED_AC3 = 0x7A,
|
||||
GST_MTS_DESC_DVB_DTS = 0x7B,
|
||||
GST_MTS_DESC_DVB_AAC = 0x7C,
|
||||
GST_MTS_DESC_DVB_XAIT_LOCATION = 0x7D,
|
||||
GST_MTS_DESC_DVB_FTA_CONTENT_MANAGEMENT = 0x7E,
|
||||
GST_MTS_DESC_DVB_EXTENSION = 0x7F,
|
||||
} GstMpegTsDVBDescriptorType;
|
||||
|
||||
/* GST_MTS_DESC_DVB_CAROUSEL_IDENTIFIER (0x13) */
|
||||
/* FIXME : Implement */
|
||||
|
||||
/* GST_MTS_DESC_DVB_NETWORK_NAME (0x40) */
|
||||
gboolean gst_mpegts_descriptor_parse_dvb_network_name (const GstMpegTsDescriptor *descriptor,
|
||||
gchar **name);
|
||||
|
||||
/* GST_MTS_DESC_DVB_SATELLITE_DELIVERY_SYSTEM (0x43) */
|
||||
typedef struct _GstMpegTsSatelliteDeliverySystemDescriptor GstMpegTsSatelliteDeliverySystemDescriptor;
|
||||
|
||||
typedef enum {
|
||||
GST_MPEGTS_MODULATION_QPSK = 0,
|
||||
GST_MPEGTS_MODULATION_QAM_16,
|
||||
GST_MPEGTS_MODULATION_QAM_32,
|
||||
GST_MPEGTS_MODULATION_QAM_64,
|
||||
GST_MPEGTS_MODULATION_QAM_128,
|
||||
GST_MPEGTS_MODULATION_QAM_256,
|
||||
GST_MPEGTS_MODULATION_QAM_AUTO,
|
||||
GST_MPEGTS_MODULATION_VSB_8,
|
||||
GST_MPEGTS_MODULATION_VSB_16,
|
||||
GST_MPEGTS_MODULATION_PSK_8,
|
||||
GST_MPEGTS_MODULATION_APSK_16,
|
||||
GST_MPEGTS_MODULATION_APSK_32,
|
||||
GST_MPEGTS_MODULATION_DQPSK,
|
||||
GST_MPEGTS_MODULATION_QAM_4_NR_,
|
||||
GST_MPEGTS_MODULATION_NONE
|
||||
} GstMpegTsModulationType;
|
||||
|
||||
typedef enum {
|
||||
GST_MPEGTS_FEC_NONE = 0,
|
||||
GST_MPEGTS_FEC_1_2,
|
||||
GST_MPEGTS_FEC_2_3,
|
||||
GST_MPEGTS_FEC_3_4,
|
||||
GST_MPEGTS_FEC_4_5,
|
||||
GST_MPEGTS_FEC_5_6,
|
||||
GST_MPEGTS_FEC_6_7,
|
||||
GST_MPEGTS_FEC_7_8,
|
||||
GST_MPEGTS_FEC_8_9,
|
||||
GST_MPEGTS_FEC_AUTO,
|
||||
GST_MPEGTS_FEC_3_5,
|
||||
GST_MPEGTS_FEC_9_10,
|
||||
GST_MPEGTS_FEC_2_5
|
||||
} GstMpegTsDVBCodeRate;
|
||||
|
||||
typedef enum {
|
||||
GST_MPEGTS_ROLLOFF_35 = 0,
|
||||
GST_MPEGTS_ROLLOFF_20,
|
||||
GST_MPEGTS_ROLLOFF_25,
|
||||
GST_MPEGTS_ROLLOFF_RESERVED,
|
||||
GST_MPEGTS_ROLLOFF_AUTO
|
||||
} GstMpegTsSatelliteRolloff;
|
||||
|
||||
typedef enum {
|
||||
GST_MPEGTS_POLARIZATION_LINEAR_HORIZONTAL = 0,
|
||||
GST_MPEGTS_POLARIZATION_LINEAR_VERTICAL,
|
||||
GST_MPEGTS_POLARIZATION_CIRCULAR_LEFT,
|
||||
GST_MPEGTS_POLARIZATION_CIRCULAR_RIGHT
|
||||
} GstMpegTsSatellitePolarizationType;
|
||||
|
||||
/**
|
||||
* GstMpegTsSatelliteDeliverySystemDescriptor:
|
||||
* @frequency: the frequency in kHz (kiloHertz)
|
||||
* @orbital_position: the orbital position in degrees
|
||||
* @west_east: If %TRUE, the satellite is in the eastern part of the orbit,
|
||||
* else in the western part.
|
||||
* @polarization: The polarization of the transmitted signal
|
||||
* @roll_off: Roll-off factor used in DVB-S2
|
||||
* @modulation_system: modulation system, %TRUE if DVB-S2, else DVB-S
|
||||
* @modulation_type: Modulation scheme used
|
||||
* @symbol_rate: Symbol rate (in symbols per second)
|
||||
* @fec_inner: inner FEC scheme used
|
||||
*
|
||||
* Satellite Delivery System Descriptor (EN 300 468 v.1.13.1)
|
||||
*/
|
||||
struct _GstMpegTsSatelliteDeliverySystemDescriptor
|
||||
{
|
||||
guint32 frequency;
|
||||
gfloat orbital_position;
|
||||
gboolean west_east;
|
||||
GstMpegTsSatellitePolarizationType polarization;
|
||||
|
||||
GstMpegTsSatelliteRolloff roll_off;
|
||||
gboolean modulation_system;
|
||||
GstMpegTsModulationType modulation_type;
|
||||
|
||||
guint32 symbol_rate;
|
||||
GstMpegTsDVBCodeRate fec_inner;
|
||||
};
|
||||
|
||||
gboolean gst_mpegts_descriptor_parse_satellite_delivery_system (const GstMpegTsDescriptor *descriptor,
|
||||
GstMpegTsSatelliteDeliverySystemDescriptor *res);
|
||||
|
||||
|
||||
/* FIXME : Implement */
|
||||
|
||||
/* GST_MTS_DESC_DVB_CABLE_DELIVERY_SYSTEM (0x44) */
|
||||
typedef enum {
|
||||
GST_MPEGTS_CABLE_OUTER_FEC_UNDEFINED = 0,
|
||||
GST_MPEGTS_CABLE_OUTER_FEC_NONE,
|
||||
GST_MPEGTS_CABLE_OUTER_FEC_RS_204_188,
|
||||
} GstMpegTsCableOuterFECScheme;
|
||||
|
||||
typedef struct _GstMpegTsCableDeliverySystemDescriptor GstMpegTsCableDeliverySystemDescriptor;
|
||||
/**
|
||||
* GstMpegTsCableDeliverySystemDescriptor:
|
||||
* @frequency: the frequency in Hz (Hertz)
|
||||
* @outer_fec: the outer FEC scheme used
|
||||
* @modulation: Modulation scheme used
|
||||
* @symbol_rate: Symbol rate (in symbols per second)
|
||||
* @fec_inner: inner FEC scheme used
|
||||
*
|
||||
* Cable Delivery System Descriptor (EN 300 468 v.1.13.1)
|
||||
*/
|
||||
struct _GstMpegTsCableDeliverySystemDescriptor
|
||||
{
|
||||
guint32 frequency;
|
||||
GstMpegTsCableOuterFECScheme outer_fec;
|
||||
GstMpegTsModulationType modulation;
|
||||
|
||||
guint32 symbol_rate;
|
||||
GstMpegTsDVBCodeRate fec_inner;
|
||||
};
|
||||
|
||||
gboolean gst_mpegts_descriptor_parse_cable_delivery_system (const GstMpegTsDescriptor *descriptor,
|
||||
GstMpegTsCableDeliverySystemDescriptor *res);
|
||||
|
||||
/* GST_MTS_DESC_DVB_SERVICE (0x48) */
|
||||
/**
|
||||
* GstMpegTsDVBServiceType:
|
||||
*
|
||||
* The type of service of a channel.
|
||||
*
|
||||
* As specified in Table 87 of ETSI EN 300 468 v1.13.1
|
||||
*/
|
||||
typedef enum {
|
||||
GST_DVB_SERVICE_RESERVED_00 = 0x00,
|
||||
GST_DVB_SERVICE_DIGITAL_TELEVISION,
|
||||
GST_DVB_SERVICE_DIGITAL_RADIO_SOUND,
|
||||
GST_DVB_SERVICE_TELETEXT,
|
||||
GST_DVB_SERVICE_NVOD_REFERENCE,
|
||||
GST_DVB_SERVICE_NVOD_TIME_SHIFTED,
|
||||
GST_DVB_SERVICE_MOSAIC,
|
||||
GST_DVB_SERVICE_FM_RADIO,
|
||||
GST_DVB_SERVICE_DVB_SRM,
|
||||
GST_DVB_SERVICE_RESERVED_09,
|
||||
GST_DVB_SERVICE_ADVANCED_CODEC_DIGITAL_RADIO_SOUND,
|
||||
GST_DVB_SERVICE_ADVANCED_CODEC_MOSAIC,
|
||||
GST_DVB_SERVICE_DATA_BROADCAST,
|
||||
GST_DVB_SERVICE_RESERVED_0D_COMMON_INTERFACE,
|
||||
GST_DVB_SERVICE_RCS_MAP,
|
||||
GST_DVB_SERVICE_RCS_FLS,
|
||||
GST_DVB_SERVICE_DVB_MHP,
|
||||
GST_DVB_SERVICE_MPEG2_HD_DIGITAL_TELEVISION,
|
||||
/* 0x12 - 015 Reserved for future use */
|
||||
GST_DVB_SERVICE_ADVANCED_CODEC_SD_DIGITAL_TELEVISION = 0x16,
|
||||
GST_DVB_SERVICE_ADVANCED_CODEC_SD_NVOD_TIME_SHIFTED,
|
||||
GST_DVB_SERVICE_ADVANCED_CODEC_SD_NVOD_REFERENCE,
|
||||
GST_DVB_SERVICE_ADVANCED_CODEC_HD_DIGITAL_TELEVISION,
|
||||
GST_DVB_SERVICE_ADVANCED_CODEC_HD_NVOD_TIME_SHIFTED,
|
||||
GST_DVB_SERVICE_ADVANCED_CODEC_HD_NVOD_REFERENCE,
|
||||
GST_DVB_SERVICE_ADVANCED_CODEC_STEREO_HD_DIGITAL_TELEVISION,
|
||||
GST_DVB_SERVICE_ADVANCED_CODEC_STEREO_HD_NVOD_TIME_SHIFTED,
|
||||
GST_DVB_SERVICE_ADVANCED_CODEC_STEREO_HD_NVOD_REFERENCE,
|
||||
/* 0x1F - 0x7f Reserved for future use */
|
||||
/* 0x80 - 0xfe user defined */
|
||||
/* 0xff Reserved for future use */
|
||||
GST_DVB_SERVICE_RESERVED_FF
|
||||
} GstMpegTsDVBServiceType;
|
||||
|
||||
/* FIXME : enum type for service_type ? */
|
||||
gboolean gst_mpegts_descriptor_parse_dvb_service (const GstMpegTsDescriptor *descriptor,
|
||||
GstMpegTsDVBServiceType *service_type,
|
||||
gchar **service_name,
|
||||
gchar **provider_name);
|
||||
|
||||
/* GST_MTS_DESC_DVB_SHORT_EVENT (0x4D) */
|
||||
gboolean gst_mpegts_descriptor_parse_dvb_short_event (const GstMpegTsDescriptor *descriptor,
|
||||
gchar **language_code,
|
||||
gchar **event_name,
|
||||
gchar **text);
|
||||
|
||||
/* GST_MTS_DESC_DVB_EXTENDED_EVENT (0x4E) */
|
||||
typedef struct _GstMpegTsExtendedEventDescriptor GstMpegTsExtendedEventDescriptor;
|
||||
typedef struct _GstMpegTsExtendedEventItem GstMpegTsExtendedEventItem;
|
||||
|
||||
/* FIXME : Maybe make a separate method for getting a specific item entry ? */
|
||||
struct _GstMpegTsExtendedEventItem
|
||||
{
|
||||
gchar *item_description;
|
||||
gchar *item;
|
||||
};
|
||||
|
||||
struct _GstMpegTsExtendedEventDescriptor
|
||||
{
|
||||
guint8 descriptor_number;
|
||||
guint8 last_descriptor_number;
|
||||
gchar language_code[3];
|
||||
guint8 nb_items;
|
||||
GstMpegTsExtendedEventItem items[128];
|
||||
gchar *text;
|
||||
};
|
||||
|
||||
gboolean gst_mpegts_descriptor_parse_dvb_extended_event (const GstMpegTsDescriptor *descriptor,
|
||||
GstMpegTsExtendedEventDescriptor *res);
|
||||
|
||||
/* GST_MTS_DESC_DVB_COMPONENT (0x50) */
|
||||
typedef struct _GstMpegTsComponentDescriptor GstMpegTsComponentDescriptor;
|
||||
struct _GstMpegTsComponentDescriptor
|
||||
{
|
||||
guint8 stream_content;
|
||||
guint8 component_type;
|
||||
guint8 component_tag;
|
||||
/* FIXME : Make it a separate (allocated, null-terminated) return value */
|
||||
gchar language_code[3];
|
||||
gchar *text;
|
||||
};
|
||||
|
||||
gboolean gst_mpegts_descriptor_parse_dvb_component (const GstMpegTsDescriptor *descriptor,
|
||||
GstMpegTsComponentDescriptor *res);
|
||||
|
||||
/* GST_MTS_DESC_DVB_STREAM_IDENTIFIER (0x52) */
|
||||
gboolean gst_mpegts_descriptor_parse_dvb_stream_identifier (const GstMpegTsDescriptor *descriptor,
|
||||
guint8 *component_tag);
|
||||
|
||||
/* GST_MTS_DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM (0x5A) */
|
||||
/* FIXME : Implement */
|
||||
|
||||
/* GST_MTS_DESC_DVB_FREQUENCY_LIST (0x62) */
|
||||
/* FIXME : Implement */
|
||||
|
||||
/* GST_MTS_DESC_DVB_DATA_BROADCAST (0x64) */
|
||||
/* FIXME: Implement */
|
||||
|
||||
/* GST_MTS_DESC_DVB_DATA_BROADCAST_ID (0x66) */
|
||||
/* FIXME : Implement */
|
||||
|
||||
/* GST_MTS_DESC_DVB_AC3 (0x6a) */
|
||||
/* FIXME : Implement */
|
||||
|
||||
#endif /* GST_MPEGTS_DESCRIPTOR_H */
|
|
@ -29,5 +29,6 @@ GST_DEBUG_CATEGORY_EXTERN (gst_mpegts_debug);
|
|||
|
||||
G_GNUC_INTERNAL void __initialize_descriptors (void);
|
||||
G_GNUC_INTERNAL guint32 _calc_crc32 (const guint8 *data, guint datalen);
|
||||
G_GNUC_INTERNAL gchar *get_encoding_and_convert (const gchar *text, guint length);
|
||||
|
||||
#endif /* _GST_MPEGTS_PRIVATE_H_ */
|
||||
|
|
|
@ -354,7 +354,7 @@ convert_to_utf8 (const gchar * text, gint length, guint start,
|
|||
return new_text;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
gchar *
|
||||
get_encoding_and_convert (const gchar * text, guint length)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
@ -618,244 +618,6 @@ gst_mpegts_descriptor_parse_iso_639_language (const GstMpegTsDescriptor *
|
|||
|
||||
}
|
||||
|
||||
|
||||
/* GST_MTS_DESC_DVB_NETWORK_NAME (0x40) */
|
||||
/**
|
||||
* gst_mpegts_descriptor_parse_dvb_network_name:
|
||||
* @descriptor: a %GST_MTS_DESC_DVB_NETWORK_NAME #GstMpegTsDescriptor
|
||||
* @name: (out) (transfer full): the extracted name
|
||||
*
|
||||
* Parses out the dvb network name from the @descriptor:
|
||||
*
|
||||
* Returns: %TRUE if the parsing happened correctly, else %FALSE.
|
||||
*/
|
||||
gboolean
|
||||
gst_mpegts_descriptor_parse_dvb_network_name (const GstMpegTsDescriptor *
|
||||
descriptor, gchar ** name)
|
||||
{
|
||||
g_return_val_if_fail (descriptor != NULL
|
||||
&& descriptor->descriptor_data != NULL, FALSE);
|
||||
g_return_val_if_fail (descriptor->descriptor_tag == 0x40, FALSE);
|
||||
|
||||
*name = get_encoding_and_convert ((gchar *) descriptor->descriptor_data + 2,
|
||||
descriptor->descriptor_data[1]);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* GST_MTS_DESC_DVB_SATELLITE_DELIVERY_SYSTEM (0x43) */
|
||||
/**
|
||||
* gst_mpegts_descriptor_parse_satellite_delivery_system:
|
||||
* @descriptor: a %GST_MTS_DESC_DVB_SATELLITE_DELIVERY_SYSTEM #GstMpegTsDescriptor
|
||||
* @res: (out) (transfer none): the #GstMpegTsSatelliteDeliverySystemDescriptor to fill
|
||||
*
|
||||
* Extracts the satellite delivery system information from @descriptor.
|
||||
*
|
||||
* Returns: %TRUE if parsing succeeded, else %FALSE.
|
||||
*/
|
||||
gboolean
|
||||
gst_mpegts_descriptor_parse_satellite_delivery_system (const GstMpegTsDescriptor
|
||||
* descriptor, GstMpegTsSatelliteDeliverySystemDescriptor * res)
|
||||
{
|
||||
guint8 *data;
|
||||
guint8 tmp;
|
||||
|
||||
g_return_val_if_fail (descriptor != NULL
|
||||
&& descriptor->descriptor_data != NULL, FALSE);
|
||||
g_return_val_if_fail (res != NULL, FALSE);
|
||||
g_return_val_if_fail (descriptor->descriptor_tag == 0x43, FALSE);
|
||||
|
||||
data = (guint8 *) descriptor->descriptor_data + 2;
|
||||
|
||||
#define BCD_UN(a) ((a) & 0x0f)
|
||||
#define BCD_DEC(a) (((a) >> 4) & 0x0f)
|
||||
#define BCD(a) (BCD_UN(a) + 10 * BCD_DEC(a))
|
||||
#define BCD_16(a) (BCD(a[1]) + 100 * BCD(a[0]))
|
||||
#define BCD_28(a) (BCD_DEC(a[3]) + 10 * BCD(a[2]) + 1000 * BCD(a[1]) + 100000 * BCD(a[0]))
|
||||
#define BCD_32(a) (BCD(a[3]) + 100 * BCD(a[2]) + 10000 * BCD(a[1]) + 1000000 * BCD(a[0]))
|
||||
|
||||
/* BCD coded frequency in GHz (decimal point occurs after the 3rd character)
|
||||
* So direct BCD gives us units of (GHz / 100 000) = 10 kHz*/
|
||||
res->frequency = BCD_32 (data) * 10;
|
||||
data += 4;
|
||||
/* BCD codec position in degrees (float pointer after the 3rd character) */
|
||||
res->orbital_position = (BCD_16 (data)) / 10.0;
|
||||
data += 2;
|
||||
|
||||
tmp = *data;
|
||||
res->west_east = (tmp & 0x80) == 0x80;
|
||||
res->polarization = (tmp >> 7) & 0x03;
|
||||
res->modulation_system = (tmp & 0x04) == 0x04;
|
||||
if (res->modulation_system)
|
||||
res->roll_off = (tmp >> 3 & 0x03);
|
||||
else
|
||||
res->roll_off = GST_MPEGTS_ROLLOFF_AUTO;
|
||||
switch (tmp & 0x03) {
|
||||
case 0x00:
|
||||
res->modulation_type = GST_MPEGTS_MODULATION_QAM_AUTO;
|
||||
break;
|
||||
case 0x01:
|
||||
res->modulation_type = GST_MPEGTS_MODULATION_QPSK;
|
||||
break;
|
||||
case 0x10:
|
||||
res->modulation_type = GST_MPEGTS_MODULATION_PSK_8;
|
||||
break;
|
||||
case 0x11:
|
||||
res->modulation_type = GST_MPEGTS_MODULATION_QAM_16;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
res->modulation_type = tmp & 0x03;
|
||||
data += 1;
|
||||
/* symbol_rate is in Msymbols/ (decimal point occurs after 3rd character) */
|
||||
/* So direct BCD gives us units of (Msymbol / 10 000) = 100 sym/s */
|
||||
res->symbol_rate = BCD_28 (data) * 100;
|
||||
data += 3;
|
||||
/* fec_inner */
|
||||
res->fec_inner = *data >> 4;
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* GST_MTS_DESC_DVB_CABLE_DELIVERY_SYSTEM (0x44) */
|
||||
/**
|
||||
* gst_mpegts_descriptor_parse_cable_delivery_system:
|
||||
* @descriptor: a %GST_MTS_DESC_DVB_CABLE_DELIVERY_SYSTEM #GstMpegTsDescriptor
|
||||
* @res: (out) (transfer none): the #GstMpegTsCableDeliverySystemDescriptor to fill
|
||||
*
|
||||
* Extracts the cable delivery system information from @descriptor.
|
||||
*
|
||||
* Returns: %TRUE if parsing succeeded, else %FALSE.
|
||||
*/
|
||||
gboolean
|
||||
gst_mpegts_descriptor_parse_cable_delivery_system (const GstMpegTsDescriptor *
|
||||
descriptor, GstMpegTsCableDeliverySystemDescriptor * res)
|
||||
{
|
||||
guint8 *data;
|
||||
|
||||
g_return_val_if_fail (descriptor != NULL
|
||||
&& descriptor->descriptor_data != NULL, FALSE);
|
||||
g_return_val_if_fail (res != NULL, FALSE);
|
||||
g_return_val_if_fail (descriptor->descriptor_tag == 0x44, FALSE);
|
||||
|
||||
data = (guint8 *) descriptor->descriptor_data + 2;
|
||||
/* BCD in MHz, decimal place after the fourth character */
|
||||
res->frequency = BCD_32 (data) * 100;
|
||||
data += 5;
|
||||
/* fec_out (4bits) */
|
||||
res->outer_fec = *data++ & 0x0f;
|
||||
switch (*data) {
|
||||
case 0x00:
|
||||
res->modulation = GST_MPEGTS_MODULATION_NONE;
|
||||
break;
|
||||
case 0x01:
|
||||
res->modulation = GST_MPEGTS_MODULATION_QAM_16;
|
||||
break;
|
||||
case 0x02:
|
||||
res->modulation = GST_MPEGTS_MODULATION_QAM_32;
|
||||
break;
|
||||
case 0x03:
|
||||
res->modulation = GST_MPEGTS_MODULATION_QAM_64;
|
||||
break;
|
||||
case 0x04:
|
||||
res->modulation = GST_MPEGTS_MODULATION_QAM_128;
|
||||
break;
|
||||
case 0x05:
|
||||
res->modulation = GST_MPEGTS_MODULATION_QAM_256;
|
||||
break;
|
||||
default:
|
||||
GST_WARNING ("Unsupported cable modulation type: 0x%02x", *data);
|
||||
res->modulation = GST_MPEGTS_MODULATION_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
data += 1;
|
||||
/* symbol_rate is in Msymbols/ (decimal point occurs after 3rd character) */
|
||||
/* So direct BCD gives us units of (Msymbol / 10 000) = 100 sym/s */
|
||||
res->symbol_rate = BCD_28 (data) * 100;
|
||||
data += 3;
|
||||
/* fec_inner */
|
||||
res->fec_inner = *data & 0x0f;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* GST_MTS_DESC_DVB_SERVICE (0x48) */
|
||||
/**
|
||||
* gst_mpegts_descriptor_parse_dvb_service:
|
||||
* @descriptor: a %GST_MTS_DESC_DVB_SERVICE #GstMpegTsDescriptor
|
||||
* @service_type: (out) (allow-none): the service type
|
||||
* @service_name: (out) (transfer full) (allow-none): the service name
|
||||
* @provider_name: (out) (transfer full) (allow-none): the provider name
|
||||
*
|
||||
* Extracts the dvb service information from @descriptor.
|
||||
*
|
||||
* Returns: %TRUE if parsing succeeded, else %FALSE.
|
||||
*/
|
||||
gboolean
|
||||
gst_mpegts_descriptor_parse_dvb_service (const GstMpegTsDescriptor *
|
||||
descriptor, GstMpegTsDVBServiceType * service_type, gchar ** service_name,
|
||||
gchar ** provider_name)
|
||||
{
|
||||
guint8 *data;
|
||||
|
||||
g_return_val_if_fail (descriptor != NULL
|
||||
&& descriptor->descriptor_data != NULL, FALSE);
|
||||
g_return_val_if_fail (descriptor->descriptor_tag == 0x48, FALSE);
|
||||
|
||||
data = (guint8 *) descriptor->descriptor_data + 2;
|
||||
|
||||
if (service_type)
|
||||
*service_type = *data;
|
||||
data += 1;
|
||||
if (provider_name)
|
||||
*provider_name = get_encoding_and_convert ((const gchar *) data + 1, *data);
|
||||
data += *data + 1;
|
||||
if (service_name)
|
||||
*service_name = get_encoding_and_convert ((const gchar *) data + 1, *data);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* GST_MTS_DESC_DVB_SHORT_EVENT (0x4D) */
|
||||
/**
|
||||
* gst_mpegts_descriptor_parse_dvb_short_event:
|
||||
* @descriptor: a %GST_MTS_DESC_DVB_SHORT_EVENT #GstMpegTsDescriptor
|
||||
* @language_code: (out) (transfer full) (allow-none): the language code
|
||||
* @event_name: (out) (transfer full) (allow-none): the event name
|
||||
* @text: (out) (transfer full) (allow-none): the event text
|
||||
*
|
||||
* Extracts the DVB short event information from @descriptor.
|
||||
*
|
||||
* Returns: %TRUE if parsing succeeded, else %FALSE.
|
||||
*/
|
||||
gboolean
|
||||
gst_mpegts_descriptor_parse_dvb_short_event (const GstMpegTsDescriptor *
|
||||
descriptor, gchar ** language_code, gchar ** event_name, gchar ** text)
|
||||
{
|
||||
guint8 *data;
|
||||
|
||||
g_return_val_if_fail (descriptor != NULL
|
||||
&& descriptor->descriptor_data != NULL, FALSE);
|
||||
g_return_val_if_fail (descriptor->descriptor_tag == 0x4D, FALSE);
|
||||
|
||||
data = (guint8 *) descriptor->descriptor_data + 2;
|
||||
|
||||
if (language_code) {
|
||||
*language_code = g_malloc0 (4);
|
||||
memcpy (*language_code, data, 3);
|
||||
}
|
||||
data += 3;
|
||||
if (event_name)
|
||||
*event_name = get_encoding_and_convert ((const gchar *) data + 1, *data);
|
||||
data += *data + 1;
|
||||
if (text)
|
||||
*text = get_encoding_and_convert ((const gchar *) data + 1, *data);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_mpegts_descriptor_parse_logical_channel:
|
||||
* @descriptor: a %GST_MTS_DESC_DTG_LOGICAL_CHANNEL #GstMpegTsDescriptor
|
||||
|
|
|
@ -132,76 +132,6 @@ typedef enum {
|
|||
/* 55-63 ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Reserved */
|
||||
} GstMpegTsDescriptorType;
|
||||
|
||||
typedef enum {
|
||||
/* 64-127 DVB tags ETSI EN 300 468
|
||||
* (Specification for Service Information (SI) in DVB systems)
|
||||
*/
|
||||
GST_MTS_DESC_DVB_NETWORK_NAME = 0x40,
|
||||
GST_MTS_DESC_DVB_SERVICE_LIST = 0x41,
|
||||
GST_MTS_DESC_DVB_STUFFING = 0x42,
|
||||
GST_MTS_DESC_DVB_SATELLITE_DELIVERY_SYSTEM = 0x43,
|
||||
GST_MTS_DESC_DVB_CABLE_DELIVERY_SYSTEM = 0x44,
|
||||
GST_MTS_DESC_DVB_VBI_DATA = 0x45,
|
||||
GST_MTS_DESC_DVB_VBI_TELETEXT = 0x46,
|
||||
GST_MTS_DESC_DVB_BOUQUET_NAME = 0x47,
|
||||
GST_MTS_DESC_DVB_SERVICE = 0x48,
|
||||
GST_MTS_DESC_DVB_COUNTRY_AVAILABILITY = 0x49,
|
||||
GST_MTS_DESC_DVB_LINKAGE = 0x4A,
|
||||
GST_MTS_DESC_DVB_NVOD_REFERENCE = 0x4B,
|
||||
GST_MTS_DESC_DVB_TIME_SHIFTED_SERVICE = 0x4C,
|
||||
GST_MTS_DESC_DVB_SHORT_EVENT = 0x4D,
|
||||
GST_MTS_DESC_DVB_EXTENDED_EVENT = 0x4E,
|
||||
GST_MTS_DESC_DVB_TIME_SHIFTED_EVENT = 0x4F,
|
||||
GST_MTS_DESC_DVB_COMPONENT = 0x50,
|
||||
GST_MTS_DESC_DVB_MOSAIC = 0x51,
|
||||
GST_MTS_DESC_DVB_STREAM_IDENTIFIER = 0x52,
|
||||
GST_MTS_DESC_DVB_CA_IDENTIFIER = 0x53,
|
||||
GST_MTS_DESC_DVB_CONTENT = 0x54,
|
||||
GST_MTS_DESC_DVB_PARENTAL_RATING = 0x55,
|
||||
GST_MTS_DESC_DVB_TELETEXT = 0x56,
|
||||
GST_MTS_DESC_DVB_TELEPHONE = 0x57,
|
||||
GST_MTS_DESC_DVB_LOCAL_TIME_OFFSET = 0x58,
|
||||
GST_MTS_DESC_DVB_SUBTITLING = 0x59,
|
||||
GST_MTS_DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM = 0x5A,
|
||||
GST_MTS_DESC_DVB_MULTILINGUAL_NETWORK_NAME = 0x5B,
|
||||
GST_MTS_DESC_DVB_MULTILINGUAL_BOUQUET_NAME = 0x5C,
|
||||
GST_MTS_DESC_DVB_MULTILINGUAL_SERVICE_NAME = 0x5D,
|
||||
GST_MTS_DESC_DVB_MULTILINGUAL_COMPONENT = 0x5E,
|
||||
GST_MTS_DESC_DVB_PRIVATE_DATA_SPECIFIER = 0x5F,
|
||||
GST_MTS_DESC_DVB_SERVICE_MOVE = 0x60,
|
||||
GST_MTS_DESC_DVB_SHORT_SMOOTHING_BUFFER = 0x61,
|
||||
GST_MTS_DESC_DVB_FREQUENCY_LIST = 0x62,
|
||||
GST_MTS_DESC_DVB_PARTIAL_TRANSPORT_STREAM = 0x63,
|
||||
GST_MTS_DESC_DVB_DATA_BROADCAST = 0x64,
|
||||
GST_MTS_DESC_DVB_SCRAMBLING = 0x65,
|
||||
GST_MTS_DESC_DVB_DATA_BROADCAST_ID = 0x66,
|
||||
GST_MTS_DESC_DVB_TRANSPORT_STREAM = 0x67,
|
||||
GST_MTS_DESC_DVB_DSNG = 0x68,
|
||||
GST_MTS_DESC_DVB_PDC = 0x69,
|
||||
GST_MTS_DESC_DVB_AC3 = 0x6A,
|
||||
GST_MTS_DESC_DVB_ANCILLARY_DATA = 0x6B,
|
||||
GST_MTS_DESC_DVB_CELL_LIST = 0x6C,
|
||||
GST_MTS_DESC_DVB_CELL_FREQUENCY_LINK = 0x6D,
|
||||
GST_MTS_DESC_DVB_ANNOUNCEMENT_SUPPORT = 0x6E,
|
||||
GST_MTS_DESC_DVB_APPLICATION_SIGNALLING = 0x6F,
|
||||
GST_MTS_DESC_DVB_ADAPTATION_FIELD_DATA = 0x70,
|
||||
GST_MTS_DESC_DVB_SERVICE_IDENTIFIER = 0x71,
|
||||
GST_MTS_DESC_DVB_SERVICE_AVAILABILITY = 0x72,
|
||||
GST_MTS_DESC_DVB_DEFAULT_AUTHORITY = 0x73,
|
||||
GST_MTS_DESC_DVB_RELATED_CONTENT = 0x74,
|
||||
GST_MTS_DESC_DVB_TVA_ID = 0x75,
|
||||
GST_MTS_DESC_DVB_CONTENT_IDENTIFIER = 0x76,
|
||||
GST_MTS_DESC_DVB_TIMESLICE_FEC_IDENTIFIER = 0x77,
|
||||
GST_MTS_DESC_DVB_ECM_REPETITION_RATE = 0x78,
|
||||
GST_MTS_DESC_DVB_S2_SATELLITE_DELIVERY_SYSTEM = 0x79,
|
||||
GST_MTS_DESC_DVB_ENHANCED_AC3 = 0x7A,
|
||||
GST_MTS_DESC_DVB_DTS = 0x7B,
|
||||
GST_MTS_DESC_DVB_AAC = 0x7C,
|
||||
GST_MTS_DESC_DVB_XAIT_LOCATION = 0x7D,
|
||||
GST_MTS_DESC_DVB_FTA_CONTENT_MANAGEMENT = 0x7E,
|
||||
GST_MTS_DESC_DVB_EXTENSION = 0x7F,
|
||||
} GstMpegTsDVBDescriptorType;
|
||||
|
||||
typedef enum {
|
||||
/* 0x80 - 0xFE are user defined */
|
||||
GST_MTS_DESC_AC3_AUDIO_STREAM = 0x81,
|
||||
|
@ -332,245 +262,6 @@ gboolean gst_mpegts_descriptor_parse_iso_639_language (const GstMpegTsDescriptor
|
|||
GstMpegTsISO639LanguageDescriptor *res);
|
||||
|
||||
|
||||
/* GST_MTS_DESC_DVB_CAROUSEL_IDENTIFIER (0x13) */
|
||||
/* FIXME : Implement */
|
||||
|
||||
/* GST_MTS_DESC_DVB_NETWORK_NAME (0x40) */
|
||||
gboolean gst_mpegts_descriptor_parse_dvb_network_name (const GstMpegTsDescriptor *descriptor,
|
||||
gchar **name);
|
||||
|
||||
/* GST_MTS_DESC_DVB_SATELLITE_DELIVERY_SYSTEM (0x43) */
|
||||
typedef struct _GstMpegTsSatelliteDeliverySystemDescriptor GstMpegTsSatelliteDeliverySystemDescriptor;
|
||||
|
||||
typedef enum {
|
||||
GST_MPEGTS_MODULATION_QPSK = 0,
|
||||
GST_MPEGTS_MODULATION_QAM_16,
|
||||
GST_MPEGTS_MODULATION_QAM_32,
|
||||
GST_MPEGTS_MODULATION_QAM_64,
|
||||
GST_MPEGTS_MODULATION_QAM_128,
|
||||
GST_MPEGTS_MODULATION_QAM_256,
|
||||
GST_MPEGTS_MODULATION_QAM_AUTO,
|
||||
GST_MPEGTS_MODULATION_VSB_8,
|
||||
GST_MPEGTS_MODULATION_VSB_16,
|
||||
GST_MPEGTS_MODULATION_PSK_8,
|
||||
GST_MPEGTS_MODULATION_APSK_16,
|
||||
GST_MPEGTS_MODULATION_APSK_32,
|
||||
GST_MPEGTS_MODULATION_DQPSK,
|
||||
GST_MPEGTS_MODULATION_QAM_4_NR_,
|
||||
GST_MPEGTS_MODULATION_NONE
|
||||
} GstMpegTsModulationType;
|
||||
|
||||
typedef enum {
|
||||
GST_MPEGTS_FEC_NONE = 0,
|
||||
GST_MPEGTS_FEC_1_2,
|
||||
GST_MPEGTS_FEC_2_3,
|
||||
GST_MPEGTS_FEC_3_4,
|
||||
GST_MPEGTS_FEC_4_5,
|
||||
GST_MPEGTS_FEC_5_6,
|
||||
GST_MPEGTS_FEC_6_7,
|
||||
GST_MPEGTS_FEC_7_8,
|
||||
GST_MPEGTS_FEC_8_9,
|
||||
GST_MPEGTS_FEC_AUTO,
|
||||
GST_MPEGTS_FEC_3_5,
|
||||
GST_MPEGTS_FEC_9_10,
|
||||
GST_MPEGTS_FEC_2_5
|
||||
} GstMpegTsDVBCodeRate;
|
||||
|
||||
typedef enum {
|
||||
GST_MPEGTS_ROLLOFF_35 = 0,
|
||||
GST_MPEGTS_ROLLOFF_20,
|
||||
GST_MPEGTS_ROLLOFF_25,
|
||||
GST_MPEGTS_ROLLOFF_RESERVED,
|
||||
GST_MPEGTS_ROLLOFF_AUTO
|
||||
} GstMpegTsSatelliteRolloff;
|
||||
|
||||
typedef enum {
|
||||
GST_MPEGTS_POLARIZATION_LINEAR_HORIZONTAL = 0,
|
||||
GST_MPEGTS_POLARIZATION_LINEAR_VERTICAL,
|
||||
GST_MPEGTS_POLARIZATION_CIRCULAR_LEFT,
|
||||
GST_MPEGTS_POLARIZATION_CIRCULAR_RIGHT
|
||||
} GstMpegTsSatellitePolarizationType;
|
||||
|
||||
/**
|
||||
* GstMpegTsSatelliteDeliverySystemDescriptor:
|
||||
* @frequency: the frequency in kHz (kiloHertz)
|
||||
* @orbital_position: the orbital position in degrees
|
||||
* @west_east: If %TRUE, the satellite is in the eastern part of the orbit,
|
||||
* else in the western part.
|
||||
* @polarization: The polarization of the transmitted signal
|
||||
* @roll_off: Roll-off factor used in DVB-S2
|
||||
* @modulation_system: modulation system, %TRUE if DVB-S2, else DVB-S
|
||||
* @modulation_type: Modulation scheme used
|
||||
* @symbol_rate: Symbol rate (in symbols per second)
|
||||
* @fec_inner: inner FEC scheme used
|
||||
*
|
||||
* Satellite Delivery System Descriptor (EN 300 468 v.1.13.1)
|
||||
*/
|
||||
struct _GstMpegTsSatelliteDeliverySystemDescriptor
|
||||
{
|
||||
guint32 frequency;
|
||||
gfloat orbital_position;
|
||||
gboolean west_east;
|
||||
GstMpegTsSatellitePolarizationType polarization;
|
||||
|
||||
GstMpegTsSatelliteRolloff roll_off;
|
||||
gboolean modulation_system;
|
||||
GstMpegTsModulationType modulation_type;
|
||||
|
||||
guint32 symbol_rate;
|
||||
GstMpegTsDVBCodeRate fec_inner;
|
||||
};
|
||||
|
||||
gboolean gst_mpegts_descriptor_parse_satellite_delivery_system (const GstMpegTsDescriptor *descriptor,
|
||||
GstMpegTsSatelliteDeliverySystemDescriptor *res);
|
||||
|
||||
|
||||
/* FIXME : Implement */
|
||||
|
||||
/* GST_MTS_DESC_DVB_CABLE_DELIVERY_SYSTEM (0x44) */
|
||||
typedef enum {
|
||||
GST_MPEGTS_CABLE_OUTER_FEC_UNDEFINED = 0,
|
||||
GST_MPEGTS_CABLE_OUTER_FEC_NONE,
|
||||
GST_MPEGTS_CABLE_OUTER_FEC_RS_204_188,
|
||||
} GstMpegTsCableOuterFECScheme;
|
||||
|
||||
typedef struct _GstMpegTsCableDeliverySystemDescriptor GstMpegTsCableDeliverySystemDescriptor;
|
||||
/**
|
||||
* GstMpegTsCableDeliverySystemDescriptor:
|
||||
* @frequency: the frequency in Hz (Hertz)
|
||||
* @outer_fec: the outer FEC scheme used
|
||||
* @modulation: Modulation scheme used
|
||||
* @symbol_rate: Symbol rate (in symbols per second)
|
||||
* @fec_inner: inner FEC scheme used
|
||||
*
|
||||
* Cable Delivery System Descriptor (EN 300 468 v.1.13.1)
|
||||
*/
|
||||
struct _GstMpegTsCableDeliverySystemDescriptor
|
||||
{
|
||||
guint32 frequency;
|
||||
GstMpegTsCableOuterFECScheme outer_fec;
|
||||
GstMpegTsModulationType modulation;
|
||||
|
||||
guint32 symbol_rate;
|
||||
GstMpegTsDVBCodeRate fec_inner;
|
||||
};
|
||||
|
||||
gboolean gst_mpegts_descriptor_parse_cable_delivery_system (const GstMpegTsDescriptor *descriptor,
|
||||
GstMpegTsCableDeliverySystemDescriptor *res);
|
||||
|
||||
/* GST_MTS_DESC_DVB_SERVICE (0x48) */
|
||||
/**
|
||||
* GstMpegTsDVBServiceType:
|
||||
*
|
||||
* The type of service of a channel.
|
||||
*
|
||||
* As specified in Table 87 of ETSI EN 300 468 v1.13.1
|
||||
*/
|
||||
typedef enum {
|
||||
GST_DVB_SERVICE_RESERVED_00 = 0x00,
|
||||
GST_DVB_SERVICE_DIGITAL_TELEVISION,
|
||||
GST_DVB_SERVICE_DIGITAL_RADIO_SOUND,
|
||||
GST_DVB_SERVICE_TELETEXT,
|
||||
GST_DVB_SERVICE_NVOD_REFERENCE,
|
||||
GST_DVB_SERVICE_NVOD_TIME_SHIFTED,
|
||||
GST_DVB_SERVICE_MOSAIC,
|
||||
GST_DVB_SERVICE_FM_RADIO,
|
||||
GST_DVB_SERVICE_DVB_SRM,
|
||||
GST_DVB_SERVICE_RESERVED_09,
|
||||
GST_DVB_SERVICE_ADVANCED_CODEC_DIGITAL_RADIO_SOUND,
|
||||
GST_DVB_SERVICE_ADVANCED_CODEC_MOSAIC,
|
||||
GST_DVB_SERVICE_DATA_BROADCAST,
|
||||
GST_DVB_SERVICE_RESERVED_0D_COMMON_INTERFACE,
|
||||
GST_DVB_SERVICE_RCS_MAP,
|
||||
GST_DVB_SERVICE_RCS_FLS,
|
||||
GST_DVB_SERVICE_DVB_MHP,
|
||||
GST_DVB_SERVICE_MPEG2_HD_DIGITAL_TELEVISION,
|
||||
/* 0x12 - 015 Reserved for future use */
|
||||
GST_DVB_SERVICE_ADVANCED_CODEC_SD_DIGITAL_TELEVISION = 0x16,
|
||||
GST_DVB_SERVICE_ADVANCED_CODEC_SD_NVOD_TIME_SHIFTED,
|
||||
GST_DVB_SERVICE_ADVANCED_CODEC_SD_NVOD_REFERENCE,
|
||||
GST_DVB_SERVICE_ADVANCED_CODEC_HD_DIGITAL_TELEVISION,
|
||||
GST_DVB_SERVICE_ADVANCED_CODEC_HD_NVOD_TIME_SHIFTED,
|
||||
GST_DVB_SERVICE_ADVANCED_CODEC_HD_NVOD_REFERENCE,
|
||||
GST_DVB_SERVICE_ADVANCED_CODEC_STEREO_HD_DIGITAL_TELEVISION,
|
||||
GST_DVB_SERVICE_ADVANCED_CODEC_STEREO_HD_NVOD_TIME_SHIFTED,
|
||||
GST_DVB_SERVICE_ADVANCED_CODEC_STEREO_HD_NVOD_REFERENCE,
|
||||
/* 0x1F - 0x7f Reserved for future use */
|
||||
/* 0x80 - 0xfe user defined */
|
||||
/* 0xff Reserved for future use */
|
||||
GST_DVB_SERVICE_RESERVED_FF
|
||||
} GstMpegTsDVBServiceType;
|
||||
|
||||
/* FIXME : enum type for service_type ? */
|
||||
gboolean gst_mpegts_descriptor_parse_dvb_service (const GstMpegTsDescriptor *descriptor,
|
||||
GstMpegTsDVBServiceType *service_type,
|
||||
gchar **service_name,
|
||||
gchar **provider_name);
|
||||
|
||||
/* GST_MTS_DESC_DVB_SHORT_EVENT (0x4D) */
|
||||
gboolean gst_mpegts_descriptor_parse_dvb_short_event (const GstMpegTsDescriptor *descriptor,
|
||||
gchar **language_code,
|
||||
gchar **event_name,
|
||||
gchar **text);
|
||||
|
||||
/* GST_MTS_DESC_DVB_EXTENDED_EVENT (0x4E) */
|
||||
typedef struct _GstMpegTsExtendedEventDescriptor GstMpegTsExtendedEventDescriptor;
|
||||
typedef struct _GstMpegTsExtendedEventItem GstMpegTsExtendedEventItem;
|
||||
|
||||
/* FIXME : Maybe make a separate method for getting a specific item entry ? */
|
||||
struct _GstMpegTsExtendedEventItem
|
||||
{
|
||||
gchar *item_description;
|
||||
gchar *item;
|
||||
};
|
||||
|
||||
struct _GstMpegTsExtendedEventDescriptor
|
||||
{
|
||||
guint8 descriptor_number;
|
||||
guint8 last_descriptor_number;
|
||||
gchar language_code[3];
|
||||
guint8 nb_items;
|
||||
GstMpegTsExtendedEventItem items[128];
|
||||
gchar *text;
|
||||
};
|
||||
|
||||
gboolean gst_mpegts_descriptor_parse_dvb_extended_event (const GstMpegTsDescriptor *descriptor,
|
||||
GstMpegTsExtendedEventDescriptor *res);
|
||||
|
||||
/* GST_MTS_DESC_DVB_COMPONENT (0x50) */
|
||||
typedef struct _GstMpegTsComponentDescriptor GstMpegTsComponentDescriptor;
|
||||
struct _GstMpegTsComponentDescriptor
|
||||
{
|
||||
guint8 stream_content;
|
||||
guint8 component_type;
|
||||
guint8 component_tag;
|
||||
/* FIXME : Make it a separate (allocated, null-terminated) return value */
|
||||
gchar language_code[3];
|
||||
gchar *text;
|
||||
};
|
||||
|
||||
gboolean gst_mpegts_descriptor_parse_dvb_component (const GstMpegTsDescriptor *descriptor,
|
||||
GstMpegTsComponentDescriptor *res);
|
||||
|
||||
/* GST_MTS_DESC_DVB_STREAM_IDENTIFIER (0x52) */
|
||||
gboolean gst_mpegts_descriptor_parse_dvb_stream_identifier (const GstMpegTsDescriptor *descriptor,
|
||||
guint8 *component_tag);
|
||||
|
||||
/* GST_MTS_DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM (0x5A) */
|
||||
/* FIXME : Implement */
|
||||
|
||||
/* GST_MTS_DESC_DVB_FREQUENCY_LIST (0x62) */
|
||||
/* FIXME : Implement */
|
||||
|
||||
/* GST_MTS_DESC_DVB_DATA_BROADCAST (0x64) */
|
||||
/* FIXME: Implement */
|
||||
|
||||
/* GST_MTS_DESC_DVB_DATA_BROADCAST_ID (0x66) */
|
||||
/* FIXME : Implement */
|
||||
|
||||
/* GST_MTS_DESC_DVB_AC3 (0x6a) */
|
||||
/* FIXME : Implement */
|
||||
|
||||
|
||||
/* GST_MTS_DESC_DTG_LOGICAL_CHANNEL (0x83) */
|
||||
typedef struct _GstMpegTsLogicalChannelDescriptor GstMpegTsLogicalChannelDescriptor;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#define _GST_MPEGTS_H_
|
||||
|
||||
#include <gst/mpegts/gstmpegtsdescriptor.h>
|
||||
#include <gst/mpegts/gst-dvb-descriptor.h>
|
||||
#include <gst/mpegts/gstmpegtssection.h>
|
||||
#include <gst/mpegts/gst-atsc-section.h>
|
||||
#include <gst/mpegts/gst-dvb-section.h>
|
||||
|
|
Loading…
Reference in a new issue