<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 2, 2015 at 11:45 PM, Daniel Kamil Kozar <span dir="ltr"><<a href="mailto:dkk089@gmail.com" target="_blank">dkk089@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This patch adds support for the STD descriptor, as specified in ISO/IEC 13818-1,<br>
revision 10/2014.<br>
I chose to add the appropriate dump function to dvbinfo and dr_11.h to dr.h<br>
along with the other changes. If this is not desired, please let me know.<br></blockquote><div><br>Patch itself looks ok.<br></div><div>Please split of changes to dvbinfo example application into a separate patch.<br></div><div><br></div><div>Kind regards,<br></div><div>Jean-Paul Saman<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
examples/dvbinfo/libdvbpsi.c | 11 +++++++<br>
src/Makefile.am | 2 ++<br>
src/descriptors/dr.h | 1 +<br>
src/descriptors/dr_11.c | 73 ++++++++++++++++++++++++++++++++++++++++++<br>
src/descriptors/dr_11.h | 75 ++++++++++++++++++++++++++++++++++++++++++++<br>
5 files changed, 162 insertions(+)<br>
<br>
diff --git a/examples/dvbinfo/libdvbpsi.c b/examples/dvbinfo/libdvbpsi.c<br>
index ae976e9..90055d2 100644<br>
--- a/examples/dvbinfo/libdvbpsi.c<br>
+++ b/examples/dvbinfo/libdvbpsi.c<br>
@@ -961,6 +961,14 @@ static void DumpSmoothingBufferDescriptor(dvbpsi_smoothing_buffer_dr_t *smoothin<br>
}<br>
<br>
/*****************************************************************************<br>
+ * DumpSTDDescriptor<br>
+ *****************************************************************************/<br>
+static void DumpSTDDescriptor(dvbpsi_std_dr_t* std_descriptor)<br>
+{<br>
+ printf("Leak valid flag: %d\n", std_descriptor->b_leak_valid_flag);<br>
+}<br>
+<br>
+/*****************************************************************************<br>
* DumpSystemClockDescriptor<br>
*****************************************************************************/<br>
static void DumpSystemClockDescriptor(dvbpsi_system_clock_dr_t* p_clock_descriptor)<br>
@@ -1520,6 +1528,9 @@ static void DumpDescriptors(const char* str, dvbpsi_descriptor_t* p_descriptor)<br>
case 0x10:<br>
DumpSmoothingBufferDescriptor(dvbpsi_DecodeSmoothingBufferDr(p_descriptor));<br>
break;<br>
+ case 0x11:<br>
+ DumpSTDDescriptor(dvbpsi_DecodeSTDDr(p_descriptor));<br>
+ break;<br>
case 0x4c:<br>
DumpTimeShiftedServiceDescriptor(dvbpsi_DecodeTimeShiftedServiceDr(p_descriptor));<br>
break;<br>
diff --git a/src/Makefile.am b/src/Makefile.am<br>
index b6432ee..5f9204c 100644<br>
--- a/src/Makefile.am<br>
+++ b/src/Makefile.am<br>
@@ -35,6 +35,7 @@ pkginclude_HEADERS = dvbpsi.h psi.h descriptor.h demux.h \<br>
descriptors/dr_0e.h \<br>
descriptors/dr_0f.h \<br>
descriptors/dr_10.h \<br>
+ descriptors/dr_11.h \<br>
descriptors/dr_13.h \<br>
descriptors/dr_14.h \<br>
descriptors/dr_40.h \<br>
@@ -90,6 +91,7 @@ descriptors_src = descriptors/dr_02.c \<br>
descriptors/dr_0e.c \<br>
descriptors/dr_0f.c \<br>
descriptors/dr_10.c \<br>
+ descriptors/dr_11.c \<br>
descriptors/dr_13.c \<br>
descriptors/dr_14.c \<br>
descriptors/dr_40.c \<br>
diff --git a/src/descriptors/dr.h b/src/descriptors/dr.h<br>
index 2ef0e9c..a27f3a3 100644<br>
--- a/src/descriptors/dr.h<br>
+++ b/src/descriptors/dr.h<br>
@@ -46,6 +46,7 @@<br>
#include "dr_0e.h"<br>
#include "dr_0f.h"<br>
#include "dr_10.h"<br>
+#include "dr_11.h"<br>
#include "dr_13.h"<br>
#include "dr_14.h"<br>
#include "dr_40.h"<br>
diff --git a/src/descriptors/dr_11.c b/src/descriptors/dr_11.c<br>
new file mode 100644<br>
index 0000000..347935c<br>
--- /dev/null<br>
+++ b/src/descriptors/dr_11.c<br>
@@ -0,0 +1,73 @@<br>
+/*<br>
+Copyright (C) 2015 Daniel Kamil Kozar<br>
+<br>
+This library is free software; you can redistribute it and/or<br>
+modify it under the terms of the GNU Lesser General Public<br>
+License as published by the Free Software Foundation; either<br>
+version 2.1 of the License, or (at your option) any later version.<br>
+<br>
+This library is distributed in the hope that it will be useful,<br>
+but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU<br>
+Lesser General Public License for more details.<br>
+<br>
+You should have received a copy of the GNU Lesser General Public<br>
+License along with this library; if not, write to the Free Software<br>
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA<br>
+*/<br>
+<br>
+#include "config.h"<br>
+<br>
+#include <stdlib.h><br>
+#include <stdbool.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_11.h"<br>
+<br>
+dvbpsi_std_dr_t* dvbpsi_DecodeSTDDr(dvbpsi_descriptor_t * p_descriptor)<br>
+{<br>
+ dvbpsi_std_dr_t * p_decoded;<br>
+<br>
+ /* check the tag. */<br>
+ if (!dvbpsi_CanDecodeAsDescriptor(p_descriptor, 0x11))<br>
+ return NULL;<br>
+<br>
+ /* don't decode twice. */<br>
+ if (dvbpsi_IsDescriptorDecoded(p_descriptor))<br>
+ return p_descriptor->p_decoded;<br>
+<br>
+ /* all descriptors of this type have 1 byte of payload. */<br>
+ if (p_descriptor->i_length != 1)<br>
+ return NULL;<br>
+<br>
+ p_decoded = (dvbpsi_std_dr_t*)malloc(sizeof(*p_decoded));<br>
+ if (!p_decoded)<br>
+ return NULL;<br>
+<br>
+ p_decoded->b_leak_valid_flag = p_descriptor->p_data[0] & 0x01;<br>
+<br>
+ p_descriptor->p_decoded = (void*)p_decoded;<br>
+<br>
+ return p_decoded;<br>
+}<br>
+<br>
+dvbpsi_descriptor_t * dvbpsi_GenSTDDr(dvbpsi_std_dr_t * p_decoded)<br>
+{<br>
+ dvbpsi_descriptor_t * p_descriptor = dvbpsi_NewDescriptor(0x11, 1, NULL);<br>
+ if (!p_descriptor)<br>
+ return NULL;<br>
+<br>
+ /* encode the data, making sure the reserved fields are set to all ones. */<br>
+ p_descriptor->p_data[0] = (0xfe | p_decoded->b_leak_valid_flag);<br>
+<br>
+ return p_descriptor;<br>
+}<br>
diff --git a/src/descriptors/dr_11.h b/src/descriptors/dr_11.h<br>
new file mode 100644<br>
index 0000000..7c4c480<br>
--- /dev/null<br>
+++ b/src/descriptors/dr_11.h<br>
@@ -0,0 +1,75 @@<br>
+/*<br>
+Copyright (C) 2015 Daniel Kamil Kozar<br>
+<br>
+This library is free software; you can redistribute it and/or<br>
+modify it under the terms of the GNU Lesser General Public<br>
+License as published by the Free Software Foundation; either<br>
+version 2.1 of the License, or (at your option) any later version.<br>
+<br>
+This library is distributed in the hope that it will be useful,<br>
+but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU<br>
+Lesser General Public License for more details.<br>
+<br>
+You should have received a copy of the GNU Lesser General Public<br>
+License along with this library; if not, write to the Free Software<br>
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA<br>
+*/<br>
+<br>
+/*!<br>
+ * \file <dr_11.h><br>
+ * \author Daniel Kamil Kozar <<a href="mailto:dkk089@gmail.com">dkk089@gmail.com</a>><br>
+ * \brief Application interface for the MPEG-2 STD descriptor decoder and<br>
+ * generator.<br>
+ *<br>
+ * Application interface for the MPEG-2 STD descriptor decoder and generator.<br>
+ * This descriptor's definition can be found in ISO/IEC 13818-1 revision 2014/10<br>
+ * section 2.6.32.<br>
+ */<br>
+<br>
+#ifndef _DVBPSI_DR_11_H_<br>
+#define _DVBPSI_DR_11_H_<br>
+<br>
+#ifdef __cplusplus<br>
+extern "C" {<br>
+#endif<br>
+<br>
+/*!<br>
+ * \struct dvbpsi_std_dr_s<br>
+ * \brief STD descriptor structure.<br>
+ *<br>
+ * This structure is used to store a decoded STD descriptor. (ISO/IEC 13818-1<br>
+ * section 2.6.32).<br>
+ */<br>
+<br>
+/*!<br>
+ * \typedef struct dvbpsi_std_dr_s dvbpsi_std_dr_t<br>
+ * \brief dvbpsi_std_dr_t type definition.<br>
+ */<br>
+typedef struct dvbpsi_std_dr_s<br>
+{<br>
+ bool b_leak_valid_flag; /*!< leak_valid_flag */<br>
+} dvbpsi_std_dr_t;<br>
+<br>
+/*!<br>
+ * \brief STD descriptor decoder.<br>
+ * \param p_descriptor pointer to the descriptor structure<br>
+ * \return A pointer to a new STD descriptor structure which contains the<br>
+ * decoded data.<br>
+ */<br>
+dvbpsi_std_dr_t* dvbpsi_DecodeSTDDr(dvbpsi_descriptor_t * p_descriptor);<br>
+<br>
+/*!<br>
+ * \brief STD descriptor generator.<br>
+ * \param p_decoded pointer to a decoded STD descriptor structure.<br>
+ * \return a pointer to a new descriptor structure which contains encoded data.<br>
+ */<br>
+dvbpsi_descriptor_t * dvbpsi_GenSTDDr(dvbpsi_std_dr_t * p_decoded);<br>
+<br>
+#ifdef __cplusplus<br>
+}<br>
+#endif<br>
+<br>
+#else<br>
+#error "Multiple inclusions of dr_11.h"<br>
+#endif<br>
--<br>
2.3.1<br>
_______________________________________________<br>
libdvbpsi-devel mailing list<br>
<a href="mailto:libdvbpsi-devel@videolan.org">libdvbpsi-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/libdvbpsi-devel" target="_blank">https://mailman.videolan.org/listinfo/libdvbpsi-devel</a><br>
</blockquote></div><br></div></div>