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

add support for the MPEG SL descriptor

Signed-off-by: default avatarJean-Paul Saman <jpsaman@videolan.org>
parent a98c04cb
......@@ -135,6 +135,10 @@
<integer name="i_iod_label" bitcount="8" default="0"/>
<integer name="i_initial_object_descriptor" bitcount="8" default="0"/>
</descriptor>
<descriptor name="SL" sname="mpeg_sl" gen_args="1">
<integer name="i_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" />
......
......@@ -875,6 +875,30 @@ static int main_mpeg_iod_0(void)
return i_err;
}
/* SL */
static int main_mpeg_sl_0(void)
{
BOZO_VARS(mpeg_sl);
BOZO_START(SL);
#define dvbpsi_gen_mpeg_sl_dr(x,y) \
dvbpsi_gen_mpeg_sl_dr(x)
/* check i_es_id */
BOZO_init_integer(i_es_id, 0);
BOZO_begin_integer(i_es_id, 16)
BOZO_DOJOB(mpeg_sl);
BOZO_check_integer(i_es_id, 16)
BOZO_CLEAN();
BOZO_end_integer(i_es_id, 16)
BOZO_END(SL);
return i_err;
}
/* network name */
static int main_dvb_network_name_0(void)
{
......@@ -2542,6 +2566,7 @@ int main(void)
i_err |= main_mpeg_mpeg4_video_0();
i_err |= main_mpeg_mpeg4_audio_0();
i_err |= main_mpeg_iod_0();
i_err |= main_mpeg_sl_0();
i_err |= main_dvb_network_name_0();
i_err |= main_dvb_service_list_0();
i_err |= main_dvb_stuffing_0();
......
......@@ -47,6 +47,7 @@ mpegdrinclude_HEADERS = descriptors/mpeg/dr_02.h \
descriptors/mpeg/dr_1b.h \
descriptors/mpeg/dr_1c.h \
descriptors/mpeg/dr_1d.h \
descriptors/mpeg/dr_1e.h \
descriptors/mpeg/dr_24.h
dvbdrincludedir = $(pkgincludedir)/dvb
......@@ -120,6 +121,7 @@ descriptors_src = descriptors/mpeg/dr_02.c \
descriptors/mpeg/dr_1b.c \
descriptors/mpeg/dr_1c.c \
descriptors/mpeg/dr_1d.c \
descriptors/mpeg/dr_1e.c \
descriptors/mpeg/dr_24.c \
descriptors/dvb/dr_40.c \
descriptors/dvb/dr_41.c \
......
......@@ -89,6 +89,7 @@
#include "mpeg/dr_1b.h"
#include "mpeg/dr_1c.h"
#include "mpeg/dr_1d.h"
#include "mpeg/dr_1e.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_1e.h"
dvbpsi_mpeg_sl_dr_t* dvbpsi_decode_mpeg_sl_dr(
dvbpsi_descriptor_t * p_descriptor)
{
dvbpsi_mpeg_sl_dr_t * p_decoded;
/* check the tag. */
if (!dvbpsi_CanDecodeAsDescriptor(p_descriptor, 0x1e))
return NULL;
/* don't decode twice. */
if (dvbpsi_IsDescriptorDecoded(p_descriptor))
return p_descriptor->p_decoded;
/* all descriptors of this type have two 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_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_sl_dr(
dvbpsi_mpeg_sl_dr_t * p_decoded)
{
dvbpsi_descriptor_t * p_descriptor = dvbpsi_NewDescriptor(0x1e, 2, NULL);
if (!p_descriptor)
return NULL;
/* encode the data. */
p_descriptor->p_data[0] = p_decoded->i_es_id >> 8;
p_descriptor->p_data[1] = p_decoded->i_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_1e.h>
* \author Daniel Kamil Kozar <dkk089@gmail.com>
* \brief Application interface for the SL descriptor decoder and generator.
*
* Application interface for the SL descriptor decoder and generator. This
* descriptor's definition can be found in ISO/IEC 13818-1 revision 2014/10
* section 2.6.42.
*/
#ifndef _DVBPSI_DR_1E_H_
#define _DVBPSI_DR_1E_H_
#ifdef __cplusplus
extern "C" {
#endif
/*!
* \struct dvbpsi_mpeg_sl_dr_s
* \brief SL descriptor structure.
*
* This structure is used to store a decoded SL descriptor. (ISO/IEC 13818-1
* section 2.6.42).
*/
/*!
* \typedef struct dvbpsi_mpeg_sl_dr_s dvbpsi_mpeg_sl_dr_t
* \brief dvbpsi_mpeg_sl_dr_t type definition.
*/
typedef struct dvbpsi_mpeg_sl_dr_s
{
uint16_t i_es_id; /*< ES_ID */
} dvbpsi_mpeg_sl_dr_t;
/*!
* \brief SL descriptor decoder.
* \param p_descriptor pointer to the descriptor structure
* \return A pointer to a new SL descriptor structure which contains the
* decoded data.
*/
dvbpsi_mpeg_sl_dr_t* dvbpsi_decode_mpeg_sl_dr(
dvbpsi_descriptor_t * p_descriptor);
/*!
* \brief SL descriptor generator.
* \param p_decoded pointer to a decoded SL descriptor structure.
* \return a pointer to a new descriptor structure which contains encoded data.
*/
dvbpsi_descriptor_t * dvbpsi_gen_mpeg_sl_dr(
dvbpsi_mpeg_sl_dr_t * p_decoded);
#ifdef __cplusplus
}
#endif
#else
#error "Multiple inclusions of dr_1e.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