This descriptor contains the frequency tables on ISDB-T.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
--- /dev/null
+/*
+ * Copyright (c) 2013 - Mauro Carvalho Chehab <m.chehab@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ *
+ * Described on ARIB STD-B10 as Terrestrial delivery system descriptor
+ */
+
+#ifndef _ISDBT_DELIVERY_H
+#define _ISDBT_DELIVERY_H
+
+#include <stdint.h>
+#include <unistd.h> /* ssize_t */
+
+struct isdbt_desc_terrestrial_delivery_system {
+ uint8_t type;
+ uint8_t length;
+ struct dvb_desc *next;
+ uint16_t *frequency;
+ unsigned num_freqs;
+
+ union {
+ uint16_t bitfield;
+ struct {
+ uint16_t transmission_mode:2;
+ uint16_t guard_interval:2;
+ uint16_t area_code:6;
+ };
+ };
+} __attribute__((packed));
+
+struct dvb_v5_fe_parms;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void isdbt_desc_delivery_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, struct dvb_desc *desc);
+void isdbt_desc_delivery_print(struct dvb_v5_fe_parms *parms, const struct dvb_desc *desc);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
descriptors/desc_atsc_service_location.c ../include/descriptors/desc_atsc_service_location.h \
descriptors/desc_hierarchy.c ../include/descriptors/desc_hierarchy.h \
descriptors/desc_extension.c ../include/descriptors/desc_extension.h \
+ descriptors/desc_isdbt_delivery.c ../include/descriptors/desc_isdbt_delivery.h \
descriptors/nit.c ../include/descriptors/nit.h \
descriptors/sdt.c ../include/descriptors/sdt.h \
descriptors/vct.c ../include/descriptors/vct.h \
#include "descriptors/desc_cable_delivery.h"
#include "descriptors/desc_sat.h"
#include "descriptors/desc_terrestrial_delivery.h"
+#include "descriptors/desc_isdbt_delivery.h"
#include "descriptors/desc_service.h"
#include "descriptors/desc_service_list.h"
#include "descriptors/desc_frequency_list.h"
},
[ISDBT_delivery_system_descriptor] = {
.name = "ISDBT_delivery_system_descriptor",
- .init = NULL,
- .print = NULL,
- .size = 0,
+ .init = isdbt_desc_delivery_init,
+ .print = isdbt_desc_delivery_print,
.free = NULL,
+ .size = sizeof(struct isdbt_desc_terrestrial_delivery_system),
},
[partial_reception_descriptor] = {
.name = "partial_reception_descriptor",
--- /dev/null
+/*
+ * Copyright (c) 2013 - Mauro Carvalho Chehab <m.chehab@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ *
+ */
+
+#include "descriptors.h"
+#include "descriptors/desc_isdbt_delivery.h"
+#include "dvb-fe.h"
+
+void isdbt_desc_delivery_init(struct dvb_v5_fe_parms *parms,
+ const uint8_t *buf, struct dvb_desc *desc)
+{
+ struct isdbt_desc_terrestrial_delivery_system *d = (void *)desc;
+ unsigned char *p = (unsigned char *) buf;
+ int i;
+ size_t len;
+
+ len = sizeof(*d) - offsetof(struct isdbt_desc_terrestrial_delivery_system, bitfield);
+ memcpy(&d->bitfield, p, len);
+ p += len;
+
+ bswap16(d->bitfield);
+
+ d->num_freqs = d->length / 2;
+ if (!len)
+ return;
+ d->frequency = malloc(d->num_freqs * sizeof(*d->frequency));
+ if (!d->frequency)
+ dvb_perror("Can't allocate space for ISDB-T frequencies");
+ memcpy(d->frequency, p, d->num_freqs * sizeof(*d->frequency));
+
+ for (i = 0; i < d->num_freqs; i++)
+ bswap16(d->frequency[i]);
+}
+
+static const char *interval_name[] = {
+ [0] = "1/4",
+ [1] = "1/8",
+ [2] = "1/16",
+ [3] = "1/32",
+};
+
+static const char *tm_name[] = {
+ [0] = "2K",
+ [1] = "4K",
+ [2] = "8K",
+ [3] = "AUTO",
+};
+
+void isdbt_desc_delivery_print(struct dvb_v5_fe_parms *parms, const struct dvb_desc *desc)
+{
+ const struct isdbt_desc_terrestrial_delivery_system *d = (const void *) desc;
+ int i;
+
+ dvb_log("| ISDB-T delivery");
+ dvb_log("| transmission mode %s (%d)",
+ tm_name[d->transmission_mode], d->transmission_mode);
+ dvb_log("| guard interval %s (%d)",
+ interval_name[d->guard_interval], d->guard_interval);
+ dvb_log("| area code %d", d->area_code);
+
+ for (i = 0; i < d->num_freqs; i++) {
+ dvb_log("| frequency[%d] %d Hz", i, d->frequency[i] * 1000000l / 7);
+ }
+}