Commit 1911ee61 authored by Jean-Paul Saman's avatar Jean-Paul Saman

dr_67: DVB Transport Stream Descriptor

parent d204b593
...@@ -16,6 +16,7 @@ Changes between 1.3.0 and 2.0.0-git: ...@@ -16,6 +16,7 @@ Changes between 1.3.0 and 2.0.0-git:
- 0x20 MPEG External_ES_ID descriptor - 0x20 MPEG External_ES_ID descriptor
- 0x23 MPEG MultiplexBuffer descriptor - 0x23 MPEG MultiplexBuffer descriptor
- 0x24 Content labelling descriptor - 0x24 Content labelling descriptor
- 0x67 DVB Transport Stream descriptor
* Fix bugs in descriptors: 0x41, 0x44, 0x4a, 0x4b, 0x53, 0x54, 0x55, 0x56, 0x59, 0xa0 * Fix bugs in descriptors: 0x41, 0x44, 0x4a, 0x4b, 0x53, 0x54, 0x55, 0x56, 0x59, 0xa0
* Fix bugs in table: CA, EIT, NIT * Fix bugs in table: CA, EIT, NIT
* Work on SIS table and splice commands. * Work on SIS table and splice commands.
......
...@@ -386,4 +386,14 @@ ...@@ -386,4 +386,14 @@
<integer name="i_other_frequency_flag" bitcount="1" default="0"/> <integer name="i_other_frequency_flag" bitcount="1" default="0"/>
</descriptor> </descriptor>
<descriptor name="transport stream" sname="dvb_transport_stream">
<insert>
<begin>
p_decoded.p_data[0] = 0x44;
p_decoded.p_data[1] = 0x56;
p_decoded.p_data[2] = 0x42;
</begin>
</insert>
</descriptor>
</dr> </dr>
...@@ -835,10 +835,10 @@ static int main_mpeg_iod_0(void) ...@@ -835,10 +835,10 @@ static int main_mpeg_iod_0(void)
BOZO_VARS(mpeg_iod); BOZO_VARS(mpeg_iod);
BOZO_START(IOD); BOZO_START(IOD);
#define dvbpsi_gen_mpeg_iod_dr(x,y) \ #define dvbpsi_gen_mpeg_iod_dr(x,y) \
dvbpsi_gen_mpeg_iod_dr(x) dvbpsi_gen_mpeg_iod_dr(x)
/* check i_scope_of_iod_label */ /* check i_scope_of_iod_label */
BOZO_init_integer(i_scope_of_iod_label, 0); BOZO_init_integer(i_scope_of_iod_label, 0);
BOZO_init_integer(i_iod_label, 0); BOZO_init_integer(i_iod_label, 0);
...@@ -905,10 +905,10 @@ static int main_mpeg_fmc_0(void) ...@@ -905,10 +905,10 @@ static int main_mpeg_fmc_0(void)
BOZO_VARS(mpeg_fmc); BOZO_VARS(mpeg_fmc);
BOZO_START(FMC); BOZO_START(FMC);
#define dvbpsi_gen_mpeg_fmc_dr(x,y) \ #define dvbpsi_gen_mpeg_fmc_dr(x,y) \
dvbpsi_gen_mpeg_fmc_dr(x) dvbpsi_gen_mpeg_fmc_dr(x)
/* check p_fmc */ /* check p_fmc */
BOZO_init_array(i_num_fmc); BOZO_init_array(i_num_fmc);
BOZO_begin_array(p_fmc) BOZO_begin_array(p_fmc)
...@@ -932,10 +932,10 @@ static int main_mpeg_ext_es_id_0(void) ...@@ -932,10 +932,10 @@ static int main_mpeg_ext_es_id_0(void)
BOZO_VARS(mpeg_ext_es_id); BOZO_VARS(mpeg_ext_es_id);
BOZO_START(External_ES_ID); BOZO_START(External_ES_ID);
#define dvbpsi_gen_mpeg_ext_es_id_dr(x,y) \ #define dvbpsi_gen_mpeg_ext_es_id_dr(x,y) \
dvbpsi_gen_mpeg_ext_es_id_dr(x) dvbpsi_gen_mpeg_ext_es_id_dr(x)
/* check i_ext_es_id */ /* check i_ext_es_id */
BOZO_init_integer(i_ext_es_id, 0); BOZO_init_integer(i_ext_es_id, 0);
BOZO_begin_integer(i_ext_es_id, 16) BOZO_begin_integer(i_ext_es_id, 16)
...@@ -956,10 +956,10 @@ static int main_mpeg_mux_buf_0(void) ...@@ -956,10 +956,10 @@ static int main_mpeg_mux_buf_0(void)
BOZO_VARS(mpeg_mux_buf); BOZO_VARS(mpeg_mux_buf);
BOZO_START(MultiplexBuffer); BOZO_START(MultiplexBuffer);
#define dvbpsi_gen_mpeg_mux_buf_dr(x,y) \ #define dvbpsi_gen_mpeg_mux_buf_dr(x,y) \
dvbpsi_gen_mpeg_mux_buf_dr(x) dvbpsi_gen_mpeg_mux_buf_dr(x)
/* check i_mb_buf_size */ /* check i_mb_buf_size */
BOZO_init_integer(i_mb_buf_size, 0); BOZO_init_integer(i_mb_buf_size, 0);
BOZO_init_integer(i_tb_leak_rate, 0); BOZO_init_integer(i_tb_leak_rate, 0);
...@@ -2623,6 +2623,19 @@ static int main_dvb_terr_deliv_sys_0(void) ...@@ -2623,6 +2623,19 @@ static int main_dvb_terr_deliv_sys_0(void)
return i_err; return i_err;
} }
/* transport stream */
static int main_dvb_transport_stream_0(void)
{
BOZO_VARS(dvb_transport_stream);
BOZO_START(transport stream);
BOZO_END(transport stream);
return i_err;
}
/* main function */ /* main function */
int main(void) int main(void)
...@@ -2684,6 +2697,7 @@ int main(void) ...@@ -2684,6 +2697,7 @@ int main(void)
i_err |= main_dvb_local_time_offset_0(); i_err |= main_dvb_local_time_offset_0();
i_err |= main_dvb_subtitling_0(); i_err |= main_dvb_subtitling_0();
i_err |= main_dvb_terr_deliv_sys_0(); i_err |= main_dvb_terr_deliv_sys_0();
i_err |= main_dvb_transport_stream_0();
if(i_err) if(i_err)
fprintf(stderr, "At least one test has FAILED !!!\n"); fprintf(stderr, "At least one test has FAILED !!!\n");
......
...@@ -81,6 +81,7 @@ dvbdrinclude_HEADERS = descriptors/dvb/dr_40.h \ ...@@ -81,6 +81,7 @@ dvbdrinclude_HEADERS = descriptors/dvb/dr_40.h \
descriptors/dvb/dr_5a.h \ descriptors/dvb/dr_5a.h \
descriptors/dvb/dr_62.h \ descriptors/dvb/dr_62.h \
descriptors/dvb/dr_66.h \ descriptors/dvb/dr_66.h \
descriptors/dvb/dr_67.h \
descriptors/dvb/dr_69.h \ descriptors/dvb/dr_69.h \
descriptors/dvb/dr_73.h \ descriptors/dvb/dr_73.h \
descriptors/dvb/dr_76.h \ descriptors/dvb/dr_76.h \
...@@ -155,6 +156,7 @@ descriptors_src = descriptors/mpeg/dr_02.c \ ...@@ -155,6 +156,7 @@ descriptors_src = descriptors/mpeg/dr_02.c \
descriptors/dvb/dr_5a.c \ descriptors/dvb/dr_5a.c \
descriptors/dvb/dr_62.c \ descriptors/dvb/dr_62.c \
descriptors/dvb/dr_66.c \ descriptors/dvb/dr_66.c \
descriptors/dvb/dr_67.c \
descriptors/dvb/dr_69.c \ descriptors/dvb/dr_69.c \
descriptors/dvb/dr_73.c \ descriptors/dvb/dr_73.c \
descriptors/dvb/dr_76.c \ descriptors/dvb/dr_76.c \
......
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
#include "dvb/dr_5a.h" #include "dvb/dr_5a.h"
#include "dvb/dr_62.h" #include "dvb/dr_62.h"
#include "dvb/dr_66.h" #include "dvb/dr_66.h"
#include "dvb/dr_67.h"
#include "dvb/dr_69.h" #include "dvb/dr_69.h"
#include "dvb/dr_73.h" #include "dvb/dr_73.h"
#include "dvb/dr_76.h" #include "dvb/dr_76.h"
......
/*****************************************************************************
* dr_67.c
* Copyright (C) 2016 VideoLAN
* $Id$
*
* Authors: Jean-Paul Saman <jpsaman@videolan.org>
*
* 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
*
*****************************************************************************/
#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_67.h"
/*****************************************************************************
* dvbpsi_decode_dvb_transport_stream_dr
*****************************************************************************/
dvbpsi_dvb_transport_stream_dr_t *dvbpsi_decode_dvb_transport_stream_dr(dvbpsi_descriptor_t *p_descriptor)
{
dvbpsi_dvb_transport_stream_dr_t *p_decoded;
/* Check the tag */
if (!dvbpsi_CanDecodeAsDescriptor(p_descriptor, 0x67))
return NULL;
/* Don't decode twice */
if (dvbpsi_IsDescriptorDecoded(p_descriptor))
return p_descriptor->p_decoded;
/* Check the length */
if (p_descriptor->i_length != 0x03)
return NULL;
/* three values that shall carry: 0x44, 0x56, 0x42 (ASCI "DVB") */
if ((p_descriptor->p_data[0] != 0x44) ||
(p_descriptor->p_data[1] != 0x56) ||
(p_descriptor->p_data[2] != 0x42))
return NULL;
p_decoded = (dvbpsi_dvb_transport_stream_dr_t *)
calloc(1, sizeof(dvbpsi_dvb_transport_stream_dr_t));
if (!p_decoded)
return NULL;
/* three values that shall carry: 0x44, 0x56, 0x42 (ASCI "DVB") */
p_decoded->p_data[0] = p_descriptor->p_data[0];
p_decoded->p_data[1] = p_descriptor->p_data[1];
p_decoded->p_data[2] = p_descriptor->p_data[2];
p_descriptor->p_decoded = (void*)p_decoded;
return p_decoded;
}
/*****************************************************************************
* dvbpsi_gen_dvb_transport_stream_dr
*****************************************************************************/
dvbpsi_descriptor_t *dvbpsi_gen_dvb_transport_stream_dr(dvbpsi_dvb_transport_stream_dr_t *p_decoded,
bool b_duplicate)
{
/* three values that shall carry: 0x44, 0x56, 0x42 (ASCI "DVB") */
if ((p_decoded->p_data[0] != 0x44) ||
(p_decoded->p_data[1] != 0x56) ||
(p_decoded->p_data[2] != 0x42))
return NULL;
/* Create the descriptor */
dvbpsi_descriptor_t * p_descriptor = dvbpsi_NewDescriptor(0x67, 3, NULL);
if (!p_descriptor)
return NULL;
/* Encode data */
p_descriptor->p_data[0] = p_decoded->p_data[0];
p_descriptor->p_data[1] = p_decoded->p_data[1];
p_descriptor->p_data[2] = p_decoded->p_data[2];
if (b_duplicate)
{
/* Duplicate decoded data */
p_descriptor->p_decoded =
dvbpsi_DuplicateDecodedDescriptor(p_decoded,
sizeof(dvbpsi_dvb_transport_stream_dr_t));
}
return p_descriptor;
}
/*****************************************************************************
* dr_67.h
* Copyright (C) 2016 VideoLAN
* $Id$
*
* Authors: Jean-Paul Saman <jpsaman@videolan.org>
*
* 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
*
*****************************************************************************/
/*!
* \file dr_67.h
* \author Jean-Paul Saman
* \brief Transport stream descriptor
*/
#ifndef _DR_67_H
#define _DR_67_H
/*****************************************************************************
* dvbpsi_dvb_transport_stream_dr_s
*****************************************************************************/
/*!
* \struct dvbpsi_dvb_transport_stream_dr_s
* \brief Transport Stream Descriptor
*
* This structure is used to store a decoded Transport Stream descriptor.
*/
/*!
* \typedef struct dvbpsi_dvb_transport_stream_dr_s dvbpsi_dvb_transport_stream_dr_t
* \brief dvbpsi_dvb_transport_stream_dr_t type definition.
*/
typedef struct dvbpsi_dvb_transport_stream_dr_s
{
uint8_t p_data[3]; /*!< three values that shall carry: 0x44, 0x56, 0x42 (ASCI "DVB") */
} dvbpsi_dvb_transport_stream_dr_t;
/*****************************************************************************
* dvbpsi_decode_dvb_transport_stream_dr
*****************************************************************************/
/*!
* \fn dvbpsi_dvb_transport_stream_dr_t *dvbpsi_decode_dvb_transport_stream_dr(
* dvbpsi_descriptor_t *p_descriptor)
* \brief Decode a Transport Stream descriptor (tag 0x67)
* \param p_descriptor Raw descriptor to decode.
* \return NULL if the descriptor could not be decoded or a pointer to a
* dvbpsi_dvb_transport_stream_dr_t structure.
*/
dvbpsi_dvb_transport_stream_dr_t *dvbpsi_decode_dvb_transport_stream_dr(dvbpsi_descriptor_t *p_descriptor);
/*****************************************************************************
* dvbpsi_gen_dvb_transport_stream_dr
*****************************************************************************/
/*!
* \fn dvbpsi_descriptor_t *dvbpsi_gen_dvb_transport_stream_dr(dvbpsi_dvb_transport_stream_dr_t *p_decoded,
bool b_duplicate);
* \brief Transport Stream descriptor generator.
* \param p_decoded pointer to a decoded Transport Stream descriptor structure
* \param b_duplicate if true then duplicate the p_decoded structure into
* the descriptor
* \return a pointer to a new descriptor structure which contains encoded data.
*/
dvbpsi_descriptor_t *dvbpsi_gen_dvb_transport_stream_dr(dvbpsi_dvb_transport_stream_dr_t *p_decoded,
bool b_duplicate);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment