mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
mpegts: add frequency list descriptor
https://bugzilla.gnome.org/show_bug.cgi?id=727560
This commit is contained in:
parent
ace60abef5
commit
e535967ee9
3 changed files with 72 additions and 8 deletions
|
@ -302,6 +302,8 @@ GstMpegTsDVBLinkageDescriptor
|
||||||
gst_mpegts_descriptor_parse_dvb_linkage
|
gst_mpegts_descriptor_parse_dvb_linkage
|
||||||
<SUBSECTION private_data_specifier>
|
<SUBSECTION private_data_specifier>
|
||||||
gst_mpegts_descriptor_parse_dvb_private_data_specifier
|
gst_mpegts_descriptor_parse_dvb_private_data_specifier
|
||||||
|
<SUBSECTION frequency_list>
|
||||||
|
gst_mpegts_descriptor_parse_dvb_frequency_list
|
||||||
<SUBSECTION data_broadcast>
|
<SUBSECTION data_broadcast>
|
||||||
GstMpegTsDataBroadcastDescriptor
|
GstMpegTsDataBroadcastDescriptor
|
||||||
gst_mpegts_descriptor_parse_dvb_data_broadcast
|
gst_mpegts_descriptor_parse_dvb_data_broadcast
|
||||||
|
|
|
@ -47,6 +47,12 @@
|
||||||
* * GST_MTS_DESC_DVB_FREQUENCY_LIST
|
* * GST_MTS_DESC_DVB_FREQUENCY_LIST
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#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]))
|
||||||
|
|
||||||
/* GST_MTS_DESC_DVB_NETWORK_NAME (0x40) */
|
/* GST_MTS_DESC_DVB_NETWORK_NAME (0x40) */
|
||||||
/**
|
/**
|
||||||
|
@ -130,13 +136,6 @@ gst_mpegts_descriptor_parse_satellite_delivery_system (const GstMpegTsDescriptor
|
||||||
|
|
||||||
data = (guint8 *) descriptor->data + 2;
|
data = (guint8 *) 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)
|
/* BCD coded frequency in GHz (decimal point occurs after the 3rd character)
|
||||||
* So direct BCD gives us units of (GHz / 100 000) = 10 kHz*/
|
* So direct BCD gives us units of (GHz / 100 000) = 10 kHz*/
|
||||||
res->frequency = BCD_32 (data) * 10;
|
res->frequency = BCD_32 (data) * 10;
|
||||||
|
@ -1283,6 +1282,68 @@ gst_mpegts_descriptor_parse_dvb_private_data_specifier (const
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* GST_MTS_DESC_DVB_FREQUENCY_LIST (0x62) */
|
||||||
|
/**
|
||||||
|
* gst_mpegts_descriptor_parse_dvb_frequency_list:
|
||||||
|
* @descriptor: a %GST_MTS_DESC_DVB_FREQUENCY_LIST #GstMpegTsDescriptor
|
||||||
|
* @offset: (out): %FALSE in Hz, %TRUE in kHz
|
||||||
|
* @list: (out): a list of all frequencies in Hz/kHz depending from %offset
|
||||||
|
*
|
||||||
|
* Parses out a list of frequencies from the @descriptor.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if the parsing happened correctly, else %FALSE.
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gst_mpegts_descriptor_parse_dvb_frequency_list (const GstMpegTsDescriptor
|
||||||
|
* descriptor, gboolean * offset, GArray ** list)
|
||||||
|
{
|
||||||
|
guint8 *data, type, len;
|
||||||
|
guint32 freq;
|
||||||
|
|
||||||
|
g_return_val_if_fail (descriptor != NULL && offset != NULL &&
|
||||||
|
list != NULL, FALSE);
|
||||||
|
/* 1 byte coding system, 4 bytes each frequency entry */
|
||||||
|
__common_desc_checks (descriptor, GST_MTS_DESC_DVB_FREQUENCY_LIST, 5, FALSE);
|
||||||
|
|
||||||
|
data = (guint8 *) descriptor->data + 2;
|
||||||
|
|
||||||
|
type = *data & 0x03;
|
||||||
|
data += 1;
|
||||||
|
|
||||||
|
if (type == 1) {
|
||||||
|
/* satellite */
|
||||||
|
*offset = TRUE;
|
||||||
|
} else {
|
||||||
|
/* cable, terrestrial */
|
||||||
|
*offset = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*list = g_array_new (FALSE, FALSE, sizeof (guint32));
|
||||||
|
|
||||||
|
len = descriptor->length - 1;
|
||||||
|
|
||||||
|
for (guint8 i = 0; i < len - 3; i += 4) {
|
||||||
|
switch (type) {
|
||||||
|
case 1:
|
||||||
|
freq = BCD_32 (data) * 10;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
freq = BCD_32 (data) * 100;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
freq = GST_READ_UINT32_BE (data) * 10;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_array_append_val (*list, freq);
|
||||||
|
data += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* GST_MTS_DESC_DVB_DATA_BROADCAST (0x64) */
|
/* GST_MTS_DESC_DVB_DATA_BROADCAST (0x64) */
|
||||||
/**
|
/**
|
||||||
* gst_mpegts_descriptor_parse_dvb_data_broadcast:
|
* gst_mpegts_descriptor_parse_dvb_data_broadcast:
|
||||||
|
|
|
@ -632,7 +632,8 @@ gboolean gst_mpegts_descriptor_parse_dvb_private_data_specifier (const GstMpegTs
|
||||||
guint8 * length);
|
guint8 * length);
|
||||||
|
|
||||||
/* GST_MTS_DESC_DVB_FREQUENCY_LIST (0x62) */
|
/* GST_MTS_DESC_DVB_FREQUENCY_LIST (0x62) */
|
||||||
/* FIXME : Implement */
|
gboolean gst_mpegts_descriptor_parse_dvb_frequency_list (const GstMpegTsDescriptor
|
||||||
|
* descriptor, gboolean * offset, GArray ** list);
|
||||||
|
|
||||||
/* GST_MTS_DESC_DVB_DATA_BROADCAST (0x64) */
|
/* GST_MTS_DESC_DVB_DATA_BROADCAST (0x64) */
|
||||||
typedef struct _GstMpegTsDataBroadcastDescriptor GstMpegTsDataBroadcastDescriptor;
|
typedef struct _GstMpegTsDataBroadcastDescriptor GstMpegTsDataBroadcastDescriptor;
|
||||||
|
|
Loading…
Reference in a new issue