ping for review<br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Roberto Corno</b> <span dir="ltr"><<a href="mailto:corno.roberto@gmail.com">corno.roberto@gmail.com</a>></span><br>
Date: 22 November 2011 14:37<br>Subject: [PATCH] Add 0x40 descriptor support<br>To: <a href="mailto:vlc-devel@videolan.org">vlc-devel@videolan.org</a><br>Cc: Roberto Corno <<a href="mailto:corno.roberto@gmail.com">corno.roberto@gmail.com</a>><br>
<br><br>---<br>
src/descriptors/dr.h | 1 +<br>
src/descriptors/dr_40.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++<br>
src/descriptors/dr_40.h | 86 ++++++++++++++++++++++++++++++++++++++++++++<br>
3 files changed, 177 insertions(+), 0 deletions(-)<br>
create mode 100644 src/descriptors/dr_40.c<br>
create mode 100644 src/descriptors/dr_40.h<br>
<br>
diff --git a/src/descriptors/dr.h b/src/descriptors/dr.h<br>
index faf318a..93b27ee 100644<br>
--- a/src/descriptors/dr.h<br>
+++ b/src/descriptors/dr.h<br>
@@ -46,6 +46,7 @@<br>
#include "dr_0d.h"<br>
#include "dr_0e.h"<br>
#include "dr_0f.h"<br>
+#include "dr_40.h"<br>
#include "dr_42.h"<br>
#include "dr_43.h"<br>
#include "dr_44.h"<br>
diff --git a/src/descriptors/dr_40.c b/src/descriptors/dr_40.c<br>
new file mode 100644<br>
index 0000000..0ae431e<br>
--- /dev/null<br>
+++ b/src/descriptors/dr_40.c<br>
@@ -0,0 +1,90 @@<br>
+<br>
+<br>
+<br>
+#include "config.h"<br>
+<br>
+#include <stdio.h><br>
+#include <stdlib.h><br>
+#include <string.h><br>
+<br>
+#if defined(HAVE_INTTYPES_H)<br>
+#include <inttypes.h><br>
+#elif defined(HAVE_STDINT_H)<br>
+#include <stdint.h><br>
+#endif<br>
+<br>
+#include "../dvbpsi.h"<br>
+#include "../dvbpsi_private.h"<br>
+#include "../descriptor.h"<br>
+<br>
+#include "dr_40.h"<br>
+<br>
+/*****************************************************************************<br>
+ * dvbpsi_DecodeNetworkNameDr<br>
+ *****************************************************************************/<br>
+dvbpsi_network_name_dr_t* dvbpsi_DecodeNetworkNameDr(<br>
+ dvbpsi_descriptor_t * p_descriptor) {<br>
+ dvbpsi_network_name_dr_t * p_decoded;<br>
+<br>
+ /* Check the tag */<br>
+ if(p_descriptor->i_tag != 0x40)<br>
+ {<br>
+ DVBPSI_ERROR_ARG("dr_40 decoder", "bad tag (0x%x)", p_descriptor->i_tag);<br>
+ return NULL;<br>
+ }<br>
+ /* Don't decode twice */<br>
+ if(p_descriptor->p_decoded)<br>
+ return p_descriptor->p_decoded;<br>
+ /* Allocate memory */<br>
+ p_decoded =<br>
+ (dvbpsi_network_name_dr_t*)malloc(sizeof(dvbpsi_network_name_dr_t));<br>
+ if(!p_decoded)<br>
+ {<br>
+ DVBPSI_ERROR("dr_40 decoder", "out of memory");<br>
+ return NULL;<br>
+ }<br>
+ /* Decode data */<br>
+ p_decoded->i_name_length = p_descriptor->i_length;<br>
+ if(p_decoded->i_name_length)<br>
+ memcpy(p_decoded->i_name_byte,<br>
+ p_descriptor->p_data,<br>
+ p_decoded->i_name_length);<br>
+<br>
+ p_descriptor->p_decoded = (void*)p_decoded;<br>
+<br>
+ return p_decoded;<br>
+}<br>
+<br>
+<br>
+/*****************************************************************************<br>
+ * dvbpsi_GenNetworkNameDr<br>
+ *****************************************************************************/<br>
+dvbpsi_descriptor_t * dvbpsi_GenNetworkNameDr(<br>
+ dvbpsi_network_name_dr_t * p_decoded,<br>
+ int b_duplicate) {<br>
+ /* Create the descriptor */<br>
+ dvbpsi_descriptor_t * p_descriptor =<br>
+ dvbpsi_NewDescriptor(0x40, p_decoded->i_name_length, NULL);<br>
+<br>
+ if(p_descriptor)<br>
+ {<br>
+ /* Encode data */<br>
+ if(p_decoded->i_name_length)<br>
+ memcpy(p_descriptor->p_data,<br>
+ p_decoded->i_name_byte,<br>
+ p_decoded->i_name_length);<br>
+<br>
+ if(b_duplicate)<br>
+ {<br>
+ /* Duplicate decoded data */<br>
+ dvbpsi_network_name_dr_t * p_dup_decoded =<br>
+ (dvbpsi_network_name_dr_t*)malloc(sizeof(dvbpsi_network_name_dr_t));<br>
+ if(p_dup_decoded)<br>
+ memcpy(p_dup_decoded, p_decoded, sizeof(dvbpsi_network_name_dr_t));<br>
+<br>
+ p_descriptor->p_decoded = (void*)p_dup_decoded;<br>
+ }<br>
+ }<br>
+<br>
+ return p_descriptor;<br>
+}<br>
diff --git a/src/descriptors/dr_40.h b/src/descriptors/dr_40.h<br>
new file mode 100644<br>
index 0000000..4c9c8ee<br>
--- /dev/null<br>
+++ b/src/descriptors/dr_40.h<br>
@@ -0,0 +1,86 @@<br>
+/*<br>
+ * dr_40.h<br>
+ *<br>
+ * Created on: Nov 22, 2011<br>
+ * Author: rcorno<br>
+ */<br>
+<br>
+/*!<br>
+ * \file <dr_40.h><br>
+ * \author Corno Roberto <<a href="mailto:corno.roberto@gmail.com">corno.roberto@gmail.com</a>><br>
+ * \brief Application interface for the DVB "network name"<br>
+ * descriptor decoder and generator.<br>
+ *<br>
+ * Application interface for the DVB "network name" descriptor<br>
+ * decoder and generator. This descriptor's definition can be found in<br>
+ * ETSI EN 300 468 section 6.2.27.<br>
+ */<br>
+<br>
+#ifndef DR_40_H_<br>
+#define DR_40_H_<br>
+<br>
+#ifdef __cplusplus<br>
+extern "C" {<br>
+#endif<br>
+<br>
+/*****************************************************************************<br>
+ * dvbpsi_network_name_dr_t<br>
+ *****************************************************************************/<br>
+/*!<br>
+ * \struct dvbpsi_network_name_dr_t<br>
+ * \brief "network name" descriptor structure.<br>
+ *<br>
+ * This structure is used to store a decoded "network name"<br>
+ * descriptor. (ETSI EN 300 468 section 6.2.27).<br>
+ */<br>
+/*!<br>
+ * \typedef struct dvbpsi_network_nameg_dr_s dvbpsi_network_name_dr_t<br>
+ * \brief dvbpsi_network_name_dr_t type definition.<br>
+ */<br>
+typedef struct dvbpsi_network_name_dr_s<br>
+{<br>
+ uint8_t i_name_length; /*!< length of the i_name_byte<br>
+ array */<br>
+ uint8_t i_name_byte[255]; /*!< the name of the delivery system */<br>
+<br>
+} dvbpsi_network_name_dr_t;<br>
+<br>
+/*****************************************************************************<br>
+ * dvbpsi_DecodeNetworkNameDr<br>
+ *****************************************************************************/<br>
+/*!<br>
+ * \fn dvbpsi_network_name_dr_t * dvbpsi_DecodeNetworkNameDr(<br>
+ dvbpsi_descriptor_t * p_descriptor)<br>
+ * \brief "network name" descriptor decoder.<br>
+ * \param p_descriptor pointer to the descriptor structure<br>
+ * \return a pointer to a new "network name" descriptor structure<br>
+ * which contains the decoded data.<br>
+ */<br>
+dvbpsi_network_name_dr_t* dvbpsi_DecodeNetworkNameDr(<br>
+ dvbpsi_descriptor_t * p_descriptor);<br>
+<br>
+<br>
+/*****************************************************************************<br>
+ * dvbpsi_GenNetworkNameDr<br>
+ *****************************************************************************/<br>
+/*!<br>
+ * \fn dvbpsi_descriptor_t * dvbpsi_GenNetworkNameDr(<br>
+ dvbpsi_network_name_dr_t * p_decoded, int b_duplicate)<br>
+ * \brief "network name" descriptor generator.<br>
+ * \param p_decoded pointer to a decoded "network name" descriptor<br>
+ * structure<br>
+ * \param b_duplicate if non zero then duplicate the p_decoded structure into<br>
+ * the descriptor<br>
+ * \return a pointer to a new descriptor structure which contains encoded data.<br>
+ */<br>
+dvbpsi_descriptor_t * dvbpsi_GenNetworkNameDr(<br>
+ dvbpsi_network_name_dr_t * p_decoded,<br>
+ int b_duplicate);<br>
+<br>
+#ifdef __cplusplus<br>
+};<br>
+#endif<br>
+<br>
+#else<br>
+#error "Multiple inclusions of dr_40.h"<br>
+#endif<br>
<font color="#888888">--<br>
1.7.0.4<br>
<br>
</font></div><br>