[libdvbpsi-devel] add support for parsing extended channel name descriptor 0xA0

Michael Krufky git at videolan.org
Tue Feb 4 11:21:57 CET 2014


libdvbpsi | branch: master | Michael Krufky <mkrufky at linuxtv.org> | Sun May 19 17:47:05 2013 -0400| [0d969f66b6b39cb19b08ee6e6b20deda98d6f37b] | committer: Jean-Paul Saman

add support for parsing extended channel name descriptor 0xA0

Signed-off-by: Michael Krufky <mkrufky at linuxtv.org>

> http://git.videolan.org/gitweb.cgi/libdvbpsi.git/?a=commit;h=0d969f66b6b39cb19b08ee6e6b20deda98d6f37b
---

 src/Makefile.am         |    4 ++-
 src/descriptors/dr_a0.c |   71 +++++++++++++++++++++++++++++++++++++++++++++
 src/descriptors/dr_a0.h |   74 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 148 insertions(+), 1 deletion(-)

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
+



More information about the libdvbpsi-devel mailing list