Commit 9bc70c3e authored by Daniel Kamil Kozar's avatar Daniel Kamil Kozar Committed by Jean-Paul Saman

add support for the MPEG External_ES_ID descriptor

Signed-off-by: default avatarJean-Paul Saman <jpsaman@videolan.org>
parent a04a65fb
......@@ -144,6 +144,10 @@
<array name="p_fmc" len_name="i_num_fmc" min_size="1" type="dvbpsi_fmc_t"/>
</descriptor>
<descriptor name="External_ES_ID" sname="mpeg_ext_es_id" gen_args="1">
<integer name="i_ext_es_id" bitcount="16" default="0"/>
</descriptor>
<descriptor name="network name" sname="dvb_network_name">
<array name="i_name_byte" len_name="i_name_length" min_size="0" />
</descriptor>
......
......@@ -926,6 +926,30 @@ static int main_mpeg_fmc_0(void)
return i_err;
}
/* External_ES_ID */
static int main_mpeg_ext_es_id_0(void)
{
BOZO_VARS(mpeg_ext_es_id);
BOZO_START(External_ES_ID);
#define dvbpsi_gen_mpeg_ext_es_id_dr(x,y) \
dvbpsi_gen_mpeg_ext_es_id_dr(x)
/* check i_ext_es_id */
BOZO_init_integer(i_ext_es_id, 0);
BOZO_begin_integer(i_ext_es_id, 16)
BOZO_DOJOB(mpeg_ext_es_id);
BOZO_check_integer(i_ext_es_id, 16)
BOZO_CLEAN();
BOZO_end_integer(i_ext_es_id, 16)
BOZO_END(External_ES_ID);
return i_err;
}
/* network name */
static int main_dvb_network_name_0(void)
{
......@@ -2595,6 +2619,7 @@ int main(void)
i_err |= main_mpeg_iod_0();
i_err |= main_mpeg_sl_0();
i_err |= main_mpeg_fmc_0();
i_err |= main_mpeg_ext_es_id_0();
i_err |= main_dvb_network_name_0();
i_err |= main_dvb_service_list_0();
i_err |= main_dvb_stuffing_0();
......
......@@ -49,6 +49,7 @@ mpegdrinclude_HEADERS = descriptors/mpeg/dr_02.h \
descriptors/mpeg/dr_1d.h \
descriptors/mpeg/dr_1e.h \
descriptors/mpeg/dr_1f.h \
descriptors/mpeg/dr_20.h \
descriptors/mpeg/dr_24.h
dvbdrincludedir = $(pkgincludedir)/dvb
......@@ -124,6 +125,7 @@ descriptors_src = descriptors/mpeg/dr_02.c \
descriptors/mpeg/dr_1d.c \
descriptors/mpeg/dr_1e.c \
descriptors/mpeg/dr_1f.c \
descriptors/mpeg/dr_20.c \
descriptors/mpeg/dr_24.c \
descriptors/dvb/dr_40.c \
descriptors/dvb/dr_41.c \
......
......@@ -91,6 +91,7 @@
#include "mpeg/dr_1d.h"
#include "mpeg/dr_1e.h"
#include "mpeg/dr_1f.h"
#include "mpeg/dr_20.h"
#include "mpeg/dr_24.h"
#include "custom/dr_83_eacem.h"
#include "custom/dr_8a_scte.h"
......
/*
Copyright (C) 2016 Daniel Kamil Kozar
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 <stdlib.h>
#include <stdbool.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_20.h"
dvbpsi_mpeg_ext_es_id_dr_t* dvbpsi_decode_mpeg_ext_es_id_dr(
dvbpsi_descriptor_t * p_descriptor)
{
dvbpsi_mpeg_ext_es_id_dr_t * p_decoded;
/* check the tag. */
if (!dvbpsi_CanDecodeAsDescriptor(p_descriptor, 0x20))
return NULL;
/* don't decode twice. */
if (dvbpsi_IsDescriptorDecoded(p_descriptor))
return p_descriptor->p_decoded;
/* all descriptors of this type must have 2 bytes of payload. */
if (p_descriptor->i_length != 2)
return NULL;
p_decoded = malloc(sizeof(*p_decoded));
if (!p_decoded)
return NULL;
p_decoded->i_ext_es_id = ((p_descriptor->p_data[0] & 0xff) << 8)
| p_descriptor->p_data[1];
p_descriptor->p_decoded = p_decoded;
return p_decoded;
}
dvbpsi_descriptor_t * dvbpsi_gen_mpeg_ext_es_id_dr(
dvbpsi_mpeg_ext_es_id_dr_t * p_decoded)
{
dvbpsi_descriptor_t * p_descriptor = dvbpsi_NewDescriptor(0x20, 2, NULL);
if (!p_descriptor)
return NULL;
/* encode the data. */
p_descriptor->p_data[0] = p_decoded->i_ext_es_id >> 8;
p_descriptor->p_data[1] = p_decoded->i_ext_es_id;
return p_descriptor;
}
/*
Copyright (C) 2016 Daniel Kamil Kozar
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_20.h>
* \author Daniel Kamil Kozar <dkk089@gmail.com>
* \brief Application interface for the External_ES_ID descriptor decoder and
* generator.
*
* Application interface for the External_ES_ID descriptor decoder and
* generator. This descriptor's definition can be found in ISO/IEC 13818-1
* revision 2014/10 section 2.6.46.
*/
#ifndef _DVBPSI_DR_20_H_
#define _DVBPSI_DR_20_H_
#ifdef __cplusplus
extern "C" {
#endif
/*!
* \struct dvbpsi_mpeg_ext_es_id_dr_s
* \brief External_ES_ID descriptor structure.
*
* This structure is used to store a decoded External_ES_ID descriptor. (ISO/IEC
* 13818-1 section 2.6.46).
*/
/*!
* \typedef struct dvbpsi_mpeg_ext_es_id_dr_s dvbpsi_mpeg_ext_es_id_dr_t
* \brief dvbpsi_mpeg_ext_es_id_dr_t type definition.
*/
typedef struct dvbpsi_mpeg_ext_es_id_dr_s {
uint16_t i_ext_es_id; /*< External_ES_ID */
} dvbpsi_mpeg_ext_es_id_dr_t;
/*!
* \brief External_ES_ID descriptor decoder.
* \param p_descriptor pointer to the descriptor structure
* \return A pointer to a new External_ES_ID descriptor structure which contains
* the decoded data.
*/
dvbpsi_mpeg_ext_es_id_dr_t* dvbpsi_decode_mpeg_ext_es_id_dr(
dvbpsi_descriptor_t * p_descriptor);
/*!
* \brief External_ES_ID descriptor generator.
* \param p_decoded pointer to a decoded External_ES_ID descriptor structure.
* \return a pointer to a new descriptor structure which contains encoded data.
*/
dvbpsi_descriptor_t * dvbpsi_gen_mpeg_ext_es_id_dr(
dvbpsi_mpeg_ext_es_id_dr_t * p_decoded);
#ifdef __cplusplus
}
#endif
#else
#error "Multiple inclusions of dr_20.h"
#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