mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 18:05:37 +00:00
mpegts: Add support for DVB terrestrial delivery system descriptor
https://bugzilla.gnome.org/show_bug.cgi?id=724069
This commit is contained in:
parent
22b4223c86
commit
e6cb996cea
2 changed files with 258 additions and 2 deletions
|
@ -48,7 +48,6 @@
|
|||
* * 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
|
||||
*/
|
||||
|
||||
|
@ -483,3 +482,179 @@ gst_mpegts_descriptor_from_dvb_subtitling (const gchar * lang,
|
|||
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
/* GST_MTS_DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM (0x5A) */
|
||||
/**
|
||||
* gst_mpegts_descriptor_parse_dvb_terrestrial_delivary_system:
|
||||
* @descriptor: a %GST_MTS_DESC_DVB_CONTENT #GstMpegTsDescriptor
|
||||
* @res: (out) (transfer none): #GstMpegTsTerrestrialSystemDescriptor
|
||||
*
|
||||
* Parses out the terrestrial delivery system from the @descriptor:
|
||||
*
|
||||
* Returns: %TRUE if the parsing happened correctly, else %FALSE.
|
||||
*/
|
||||
gboolean
|
||||
gst_mpegts_descriptor_parse_terrestrial_delivery_system (const
|
||||
GstMpegTsDescriptor * descriptor,
|
||||
GstMpegTsTerrestrialDeliverySystemDescriptor * res)
|
||||
{
|
||||
guint8 *data;
|
||||
guint8 tmp;
|
||||
|
||||
g_return_val_if_fail (descriptor != NULL && descriptor->data != NULL, FALSE);
|
||||
g_return_val_if_fail (res != NULL, FALSE);
|
||||
g_return_val_if_fail (descriptor->tag == 0x5a, FALSE);
|
||||
|
||||
data = (guint8 *) descriptor->data + 2;
|
||||
|
||||
res->frequency = 0;
|
||||
res->frequency =
|
||||
*(data + 3) | *(data + 2) << 8 | *(data + 1) << 16 | *data << 24;
|
||||
res->frequency *= 10;
|
||||
|
||||
data += 4;
|
||||
|
||||
tmp = *data;
|
||||
switch ((tmp >> 5) & 0x07) {
|
||||
case 0:
|
||||
res->bandwidth = GST_MPEGTS_BANDWIDTH_8;
|
||||
break;
|
||||
case 1:
|
||||
res->bandwidth = GST_MPEGTS_BANDWIDTH_7;
|
||||
break;
|
||||
case 2:
|
||||
res->bandwidth = GST_MPEGTS_BANDWIDTH_6;
|
||||
break;
|
||||
case 3:
|
||||
res->bandwidth = GST_MPEGTS_BANDWIDTH_5;
|
||||
break;
|
||||
default:
|
||||
res->bandwidth = GST_MPEGTS_BANDWIDTH_AUTO;
|
||||
break;
|
||||
}
|
||||
|
||||
res->priority = (tmp >> 4) & 0x01;
|
||||
res->time_slicing = (tmp >> 3) & 0x01;
|
||||
res->mpe_fec = (tmp >> 2) & 0x01;
|
||||
data += 1;
|
||||
|
||||
tmp = *data;
|
||||
switch ((tmp >> 6) & 0x03) {
|
||||
case 0:
|
||||
res->constellation = GST_MPEGTS_MODULATION_QPSK;
|
||||
break;
|
||||
case 1:
|
||||
res->constellation = GST_MPEGTS_MODULATION_QAM_16;
|
||||
break;
|
||||
case 2:
|
||||
res->constellation = GST_MPEGTS_MODULATION_QAM_64;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch ((tmp >> 3) & 0x07) {
|
||||
case 0:
|
||||
res->hierarchy = GST_MPEGTS_HIERARCHY_NONE;
|
||||
break;
|
||||
case 1:
|
||||
res->hierarchy = GST_MPEGTS_HIERARCHY_1;
|
||||
break;
|
||||
case 2:
|
||||
res->hierarchy = GST_MPEGTS_HIERARCHY_2;
|
||||
break;
|
||||
case 3:
|
||||
res->hierarchy = GST_MPEGTS_HIERARCHY_4;
|
||||
break;
|
||||
case 4:
|
||||
res->hierarchy = GST_MPEGTS_HIERARCHY_NONE;
|
||||
break;
|
||||
case 5:
|
||||
res->hierarchy = GST_MPEGTS_HIERARCHY_1;
|
||||
break;
|
||||
case 6:
|
||||
res->hierarchy = GST_MPEGTS_HIERARCHY_2;
|
||||
break;
|
||||
case 7:
|
||||
res->hierarchy = GST_MPEGTS_HIERARCHY_4;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (tmp & 0x07) {
|
||||
case 0:
|
||||
res->code_rate_hp = GST_MPEGTS_FEC_1_2;
|
||||
break;
|
||||
case 1:
|
||||
res->code_rate_hp = GST_MPEGTS_FEC_2_3;
|
||||
break;
|
||||
case 2:
|
||||
res->code_rate_hp = GST_MPEGTS_FEC_3_4;
|
||||
break;
|
||||
case 3:
|
||||
res->code_rate_hp = GST_MPEGTS_FEC_5_6;
|
||||
break;
|
||||
case 4:
|
||||
res->code_rate_hp = GST_MPEGTS_FEC_7_8;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
data += 1;
|
||||
|
||||
tmp = *data;
|
||||
switch ((tmp >> 5) & 0x07) {
|
||||
case 0:
|
||||
res->code_rate_lp = GST_MPEGTS_FEC_1_2;
|
||||
break;
|
||||
case 1:
|
||||
res->code_rate_lp = GST_MPEGTS_FEC_2_3;
|
||||
break;
|
||||
case 2:
|
||||
res->code_rate_lp = GST_MPEGTS_FEC_3_4;
|
||||
break;
|
||||
case 3:
|
||||
res->code_rate_lp = GST_MPEGTS_FEC_5_6;
|
||||
break;
|
||||
case 4:
|
||||
res->code_rate_lp = GST_MPEGTS_FEC_7_8;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch ((tmp >> 3) & 0x03) {
|
||||
case 0:
|
||||
res->guard_interval = GST_MPEGTS_GUARD_INTERVAL_1_32;
|
||||
break;
|
||||
case 1:
|
||||
res->guard_interval = GST_MPEGTS_GUARD_INTERVAL_1_16;
|
||||
break;
|
||||
case 2:
|
||||
res->guard_interval = GST_MPEGTS_GUARD_INTERVAL_1_8;
|
||||
break;
|
||||
case 3:
|
||||
res->guard_interval = GST_MPEGTS_GUARD_INTERVAL_1_4;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch ((tmp >> 1) & 0x03) {
|
||||
case 0:
|
||||
res->transmission_mode = GST_MPEGTS_TRANSMISSION_MODE_2K;
|
||||
break;
|
||||
case 1:
|
||||
res->transmission_mode = GST_MPEGTS_TRANSMISSION_MODE_4K;
|
||||
break;
|
||||
case 2:
|
||||
res->transmission_mode = GST_MPEGTS_TRANSMISSION_MODE_8K;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
res->other_frequency = tmp & 0x01;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -376,7 +376,88 @@ GstMpegTsDescriptor * gst_mpegts_descriptor_from_dvb_subtitling (const gchar *la
|
|||
|
||||
|
||||
/* GST_MTS_DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM (0x5A) */
|
||||
/* FIXME : Implement */
|
||||
typedef struct _GstMpegTsTerrestrialDeliverySystemDescriptor GstMpegTsTerrestrialDeliverySystemDescriptor;
|
||||
|
||||
typedef enum {
|
||||
GST_MPEGTS_BANDWIDTH_8 = 0,
|
||||
GST_MPEGTS_BANDWIDTH_7,
|
||||
GST_MPEGTS_BANDWIDTH_6,
|
||||
GST_MPEGTS_BANDWIDTH_AUTO,
|
||||
GST_MPEGTS_BANDWIDTH_5,
|
||||
GST_MPEGTS_BANDWIDTH_10,
|
||||
GST_MPEGTS_BANDWIDTH_1_172
|
||||
} GstMpegTsTerrestrialBandwidth;
|
||||
|
||||
typedef enum {
|
||||
GST_MPEGTS_TRANSMISSION_MODE_2K = 0,
|
||||
GST_MPEGTS_TRANSMISSION_MODE_8K,
|
||||
GST_MPEGTS_TRANSMISSION_MODE_AUTO,
|
||||
GST_MPEGTS_TRANSMISSION_MODE_4K,
|
||||
GST_MPEGTS_TRANSMISSION_MODE_1K,
|
||||
GST_MPEGTS_TRANSMISSION_MODE_16K,
|
||||
GST_MPEGTS_TRANSMISSION_MODE_32K,
|
||||
GST_MPEGTS_TRANSMISSION_MODE_C1,
|
||||
GST_MPEGTS_TRANSMISSION_MODE_C3780
|
||||
} GstMpegTsTerrestrialTransmissionMode;
|
||||
|
||||
typedef enum {
|
||||
GST_MPEGTS_GUARD_INTERVAL_1_32 = 0,
|
||||
GST_MPEGTS_GUARD_INTERVAL_1_16,
|
||||
GST_MPEGTS_GUARD_INTERVAL_1_8,
|
||||
GST_MPEGTS_GUARD_INTERVAL_1_4,
|
||||
GST_MPEGTS_GUARD_INTERVAL_AUTO,
|
||||
GST_MPEGTS_GUARD_INTERVAL_1_128,
|
||||
GST_MPEGTS_GUARD_INTERVAL_19_128,
|
||||
GST_MPEGTS_GUARD_INTERVAL_19_256,
|
||||
GST_MPEGTS_GUARD_INTERVAL_PN420,
|
||||
GST_MPEGTS_GUARD_INTERVAL_PN595,
|
||||
GST_MPEGTS_GUARD_INTERVAL_PN945
|
||||
} GstMpegTsTerrestrialGuardInterval;
|
||||
|
||||
typedef enum {
|
||||
GST_MPEGTS_HIERARCHY_NONE = 0,
|
||||
GST_MPEGTS_HIERARCHY_1,
|
||||
GST_MPEGTS_HIERARCHY_2,
|
||||
GST_MPEGTS_HIERARCHY_4,
|
||||
GST_MPEGTS_HIERARCHY_AUTO
|
||||
} GstMpegTsTerrestrialHierarchy;
|
||||
|
||||
/**
|
||||
* GstMpegTsTerrestrialDeliverySystemDescriptor:
|
||||
* @frequency: the frequency in Hz (Hertz)
|
||||
* @bandwidth: the bandwidth
|
||||
* @priority: %TRUE High Priority %FALSE Low Priority
|
||||
* @time_slicing: %TRUE no time slicing %FALSE time slicing
|
||||
* @mpe_fec: %TRUE no mpe-fec is used %FALSE mpe-fec is use
|
||||
* @constellation: the constallation
|
||||
* @hierarchy: the hierarchy
|
||||
* @code_rate_hp:
|
||||
* @code_rate_lp:
|
||||
* @guard_interval:
|
||||
* @transmission_mode:
|
||||
* @other_frequency: %TRUE more frequency are use, else not
|
||||
*
|
||||
* Terrestrial Delivery System Descriptor (EN 300 468 v.1.13.1)
|
||||
*/
|
||||
|
||||
struct _GstMpegTsTerrestrialDeliverySystemDescriptor
|
||||
{
|
||||
guint32 frequency;
|
||||
GstMpegTsTerrestrialBandwidth bandwidth;
|
||||
gboolean priority;
|
||||
gboolean time_slicing;
|
||||
gboolean mpe_fec;
|
||||
GstMpegTsModulationType constellation;
|
||||
GstMpegTsTerrestrialHierarchy hierarchy;
|
||||
GstMpegTsDVBCodeRate code_rate_hp;
|
||||
GstMpegTsDVBCodeRate code_rate_lp;
|
||||
GstMpegTsTerrestrialGuardInterval guard_interval;
|
||||
GstMpegTsTerrestrialTransmissionMode transmission_mode;
|
||||
gboolean other_frequency;
|
||||
};
|
||||
|
||||
gboolean gst_mpegts_descriptor_parse_terrestrial_delivery_system (const GstMpegTsDescriptor
|
||||
*descriptor, GstMpegTsTerrestrialDeliverySystemDescriptor * res);
|
||||
|
||||
/* GST_MTS_DESC_DVB_FREQUENCY_LIST (0x62) */
|
||||
/* FIXME : Implement */
|
||||
|
|
Loading…
Reference in a new issue