aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2013-05-19 21:47:05 (GMT)
committerJean-Paul Saman <jean-paul.saman@m2x.nl>2014-02-04 09:52:02 (GMT)
commit0d969f66b6b39cb19b08ee6e6b20deda98d6f37b (patch)
tree4682388eb85dd6355148c84f819e7a6a5f45e5bb
parent47c32bb3caffb6c7f32150dfe6d84ed3f70f0738 (diff)
add support for parsing extended channel name descriptor 0xA0
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
-rw-r--r--src/Makefile.am4
-rw-r--r--src/descriptors/dr_a0.c71
-rw-r--r--src/descriptors/dr_a0.h74
3 files changed, 148 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index e8a0b6c..61ec5ae 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -69,6 +69,7 @@ pkginclude_HEADERS = dvbpsi.h psi.h descriptor.h demux.h \
descriptors/dr_83.h \
descriptors/dr_86.h \
descriptors/dr_8a.h \
+ descriptors/dr_a0.h \
descriptors/dr.h
descriptors_src = descriptors/dr_02.c \
@@ -119,7 +120,8 @@ descriptors_src = descriptors/dr_02.c \
descriptors/dr_7c.c \
descriptors/dr_83.c \
descriptors/dr_86.c \
- descriptors/dr_8a.c
+ descriptors/dr_8a.c \
+ descriptors/dr_a0.c
tables_src = tables/pat.c tables/pat_private.h \
tables/pmt.c tables/pmt_private.h \
diff --git a/src/descriptors/dr_a0.c b/src/descriptors/dr_a0.c
new file mode 100644
index 0000000..4a4a890
--- /dev/null
+++ b/src/descriptors/dr_a0.c
@@ -0,0 +1,71 @@
+/*
+Copyright (C) 2013 Michael Krufky
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+dr_a0.c
+
+Decode Extended Channel Name Descriptor.
+
+*/
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+
+#if defined(HAVE_INTTYPES_H)
+#include <inttypes.h>
+#elif defined(HAVE_STDINT_H)
+#include <stdint.h>
+#endif
+
+#include "../dvbpsi.h"
+#include "../dvbpsi_private.h"
+#include "../descriptor.h"
+
+#include "dr_a0.h"
+
+/*****************************************************************************
+ * dvbpsi_ExtendedChannelNameDr
+ *****************************************************************************/
+dvbpsi_extended_channel_name_dr_t *dvbpsi_ExtendedChannelNameDr(dvbpsi_descriptor_t *p_descriptor)
+{
+ dvbpsi_extended_channel_name_dr_t *p_decoded;
+
+ /* Check the tag */
+ if (p_descriptor->i_tag != 0xA0)
+ return NULL;
+
+ /* Don't decode twice */
+ if (p_descriptor->p_decoded)
+ return p_descriptor->p_decoded;
+
+ /* Check length */
+ if (!p_descriptor->i_length)
+ return NULL;
+
+ p_decoded = (dvbpsi_extended_channel_name_dr_t*)malloc(sizeof(dvbpsi_extended_channel_name_dr_t));
+ if (!p_decoded)
+ return NULL;
+
+ p_descriptor->p_decoded = (void*)p_decoded;
+
+ p_decoded->i_long_channel_name_length = p_descriptor->i_length;
+ memcpy(p_decoded->i_long_channel_name, p_descriptor->p_data, p_descriptor->i_length);
+
+ return p_decoded;
+}
diff --git a/src/descriptors/dr_a0.h b/src/descriptors/dr_a0.h
new file mode 100644
index 0000000..7c1394e
--- /dev/null
+++ b/src/descriptors/dr_a0.h
@@ -0,0 +1,74 @@
+/*
+Copyright (C) 2013 Michael Krufky
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+dr_a0.h
+
+Decode Extended Channel Name Descriptor.
+
+*/
+
+/*!
+ * \file dr_a0.h
+ * \author Michael Krufky
+ * \brief Decode Extended Channel Name Descriptor.
+ */
+
+#ifndef _DR_A0_H
+#define _DR_A0_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*****************************************************************************
+ * dvbpsi_extended_channel_name_dr_s
+ *****************************************************************************/
+/*!
+ * \struct dvbpsi_extended_channel_name_dr_s
+ * \brief Extended Channel Name Descriptor
+ *
+ * This structure is used to store a decoded Extended Channel Name descriptor.
+ */
+/*!
+ * \typedef struct dvbpsi_extended_channel_name_dr_s dvbpsi_extended_channel_name_dr_t
+ * \brief dvbpsi_extended_channel_name_dr_t type definition.
+ */
+typedef struct dvbpsi_extended_channel_name_dr_s
+{
+ uint8_t i_long_channel_name_length; /*!< Length in bytes */
+ uint8_t i_long_channel_name[256]; /*!< multiple string structure format. */
+
+}dvbpsi_extended_channel_name_dr_t;
+
+/*****************************************************************************
+ * dvbpsi_ExtendedChannelNameDr
+ *****************************************************************************/
+/*!
+ * \fn dvbpsi_extended_channel_name_dr_t dvbpsi_ExtendedChannelNameDr(dvbpsi_descriptor_t *p_descriptor)
+ * \brief Decode a Extended Channel Name descriptor (tag 0xA0)
+ * \param p_descriptor Raw descriptor to decode.
+ * \return NULL if the descriptor could not be decoded or a pointer to a
+ * dvbpsi_extended_channel_name_dr_t structure.
+ */
+dvbpsi_extended_channel_name_dr_t *dvbpsi_ExtendedChannelNameDr(dvbpsi_descriptor_t *p_descriptor);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+

Privacy Policy