--- /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 IEC/CENELEC DS/EN 62216-1:2011
+ *
+ * I couldn't find the original version, so I used what's there at:
+ * http://tdt.telecom.pt/recursos/apresentacoes/Signalling Specifications for DTT deployment in Portugal.pdf
+ */
+
+#ifndef _LCN_DESC_H
+#define _LCN_DESC_H
+
+#include <stdint.h>
+#include <unistd.h> /* ssize_t */
+
+struct dvb_desc_logical_channel_number {
+ uint16_t service_id;
+ union {
+ uint16_t bitfield;
+ struct {
+ uint16_t logical_channel_number:10;
+ uint16_t reserved:5;
+ uint16_t visible_service_flag:1;
+ };
+ };
+} __attribute__((packed));
+
+struct dvb_desc_logical_channel {
+ uint8_t type;
+ uint8_t length;
+ struct dvb_desc *next;
+
+ struct dvb_desc_logical_channel_number *lcn;
+} __attribute__((packed));
+
+struct dvb_v5_fe_parms;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void dvb_desc_logical_channel_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, struct dvb_desc *desc);
+void dvb_desc_logical_channel_print(struct dvb_v5_fe_parms *parms, const struct dvb_desc *desc);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
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/desc_logical_channel.c ../include/descriptors/desc_logical_channel.h \
descriptors/desc_ts_info.c ../include/descriptors/desc_ts_info.h \
descriptors/nit.c ../include/descriptors/nit.h \
descriptors/sdt.c ../include/descriptors/sdt.h \
#include "descriptors/desc_atsc_service_location.h"
#include "descriptors/desc_hierarchy.h"
#include "descriptors/desc_ts_info.h"
+#include "descriptors/desc_logical_channel.h"
#include "descriptors/desc_extension.h"
ssize_t dvb_desc_init(const uint8_t *buf, struct dvb_desc *desc)
},
[logical_channel_number_descriptor] = {
.name = "logical_channel_number_descriptor",
- .init = NULL,
- .print = NULL,
+ .init = dvb_desc_logical_channel_init,
+ .print = dvb_desc_logical_channel_print,
.free = NULL,
- .size = 0,
+ .size = sizeof(struct dvb_desc_logical_channel_number),
},
[carousel_id_descriptor] = {
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);
+ dvb_log("| frequency[%d] %ld Hz", i, d->frequency[i] * 1000000l / 7);
}
}
--- /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 IEC/CENELEC DS/EN 62216-1:2011
+ *
+ * I couldn't find the original version, so I used what's there at:
+ * http://tdt.telecom.pt/recursos/apresentacoes/Signalling Specifications for DTT deployment in Portugal.pdf
+ */
+
+#include "descriptors.h"
+#include "descriptors/desc_logical_channel.h"
+#include "dvb-fe.h"
+#include "parse_string.h"
+
+void dvb_desc_logical_channel_init(struct dvb_v5_fe_parms *parms,
+ const uint8_t *buf, struct dvb_desc *desc)
+{
+ struct dvb_desc_logical_channel *d = (void *)desc;
+ unsigned char *p = (unsigned char *)buf;
+ size_t len;
+ int i;
+
+ d->lcn = malloc(d->length);
+ if (!d->lcn)
+ dvb_perror("Out of memory!");
+
+ memcpy(d->lcn, p, d->length);
+
+ len = d->length / sizeof(d->lcn);
+
+ for (i = 0; i < len; i++) {
+ bswap16(d->lcn[i].service_id);
+ bswap16(d->lcn[i].bitfield);
+ }
+}
+
+void dvb_desc_logical_channel_print(struct dvb_v5_fe_parms *parms, const struct dvb_desc *desc)
+{
+ struct dvb_desc_logical_channel *d = (void *)desc;
+ int i;
+ size_t len;
+
+ len = d->length / sizeof(d->lcn);
+
+ for (i = 0; i < len; i++) {
+ dvb_log("| service ID[%d] %d", i, d->lcn[i].service_id);
+ dvb_log("| LCN %d", d->lcn[i].logical_channel_number);
+ dvb_log("| visible service %d", d->lcn[i].visible_service_flag);
+ }
+}