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:
- 0x20 MPEG External_ES_ID descriptor
- 0x23 MPEG MultiplexBuffer 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 table: CA, EIT, NIT
* Work on SIS table and splice commands.
......
......@@ -386,4 +386,14 @@
<integer name="i_other_frequency_flag" bitcount="1" default="0"/>
</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>
......@@ -2623,6 +2623,19 @@ static int main_dvb_terr_deliv_sys_0(void)
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 */
int main(void)
......@@ -2684,6 +2697,7 @@ int main(void)
i_err |= main_dvb_local_time_offset_0();
i_err |= main_dvb_subtitling_0();
i_err |= main_dvb_terr_deliv_sys_0();
i_err |= main_dvb_transport_stream_0();
if(i_err)
fprintf(stderr, "At least one test has FAILED !!!\n");
......
......@@ -81,6 +81,7 @@ dvbdrinclude_HEADERS = descriptors/dvb/dr_40.h \
descriptors/dvb/dr_5a.h \
descriptors/dvb/dr_62.h \
descriptors/dvb/dr_66.h \
descriptors/dvb/dr_67.h \
descriptors/dvb/dr_69.h \
descriptors/dvb/dr_73.h \
descriptors/dvb/dr_76.h \
......@@ -155,6 +156,7 @@ descriptors_src = descriptors/mpeg/dr_02.c \
descriptors/dvb/dr_5a.c \
descriptors/dvb/dr_62.c \
descriptors/dvb/dr_66.c \
descriptors/dvb/dr_67.c \
descriptors/dvb/dr_69.c \
descriptors/dvb/dr_73.c \
descriptors/dvb/dr_76.c \
......
......@@ -63,6 +63,7 @@
#include "dvb/dr_5a.h"
#include "dvb/dr_62.h"
#include "dvb/dr_66.h"
#include "dvb/dr_67.h"
#include "dvb/dr_69.h"
#include "dvb/dr_73.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