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

add support for the MPEG IOD descriptor

Signed-off-by: default avatarJean-Paul Saman <jpsaman@videolan.org>
parent e08ea38d
...@@ -130,6 +130,12 @@ ...@@ -130,6 +130,12 @@
<integer name="i_mpeg4_audio_profile_and_level" bitcount="8" default="0" /> <integer name="i_mpeg4_audio_profile_and_level" bitcount="8" default="0" />
</descriptor> </descriptor>
<descriptor name="IOD" sname="mpeg_iod" gen_args="1">
<integer name="i_scope_of_iod_label" bitcount="8" default="0"/>
<integer name="i_iod_label" bitcount="8" default="0"/>
<integer name="i_initial_object_descriptor" bitcount="8" default="0"/>
</descriptor>
<descriptor name="network name" sname="dvb_network_name"> <descriptor name="network name" sname="dvb_network_name">
<array name="i_name_byte" len_name="i_name_length" min_size="0" /> <array name="i_name_byte" len_name="i_name_length" min_size="0" />
</descriptor> </descriptor>
......
...@@ -829,6 +829,52 @@ static int main_mpeg_mpeg4_audio_0(void) ...@@ -829,6 +829,52 @@ static int main_mpeg_mpeg4_audio_0(void)
return i_err; return i_err;
} }
/* IOD */
static int main_mpeg_iod_0(void)
{
BOZO_VARS(mpeg_iod);
BOZO_START(IOD);
#define dvbpsi_gen_mpeg_iod_dr(x,y) \
dvbpsi_gen_mpeg_iod_dr(x)
/* check i_scope_of_iod_label */
BOZO_init_integer(i_scope_of_iod_label, 0);
BOZO_init_integer(i_iod_label, 0);
BOZO_init_integer(i_initial_object_descriptor, 0);
BOZO_begin_integer(i_scope_of_iod_label, 8)
BOZO_DOJOB(mpeg_iod);
BOZO_check_integer(i_scope_of_iod_label, 8)
BOZO_CLEAN();
BOZO_end_integer(i_scope_of_iod_label, 8)
/* check i_iod_label */
BOZO_init_integer(i_scope_of_iod_label, 0);
BOZO_init_integer(i_iod_label, 0);
BOZO_init_integer(i_initial_object_descriptor, 0);
BOZO_begin_integer(i_iod_label, 8)
BOZO_DOJOB(mpeg_iod);
BOZO_check_integer(i_iod_label, 8)
BOZO_CLEAN();
BOZO_end_integer(i_iod_label, 8)
/* check i_initial_object_descriptor */
BOZO_init_integer(i_scope_of_iod_label, 0);
BOZO_init_integer(i_iod_label, 0);
BOZO_init_integer(i_initial_object_descriptor, 0);
BOZO_begin_integer(i_initial_object_descriptor, 8)
BOZO_DOJOB(mpeg_iod);
BOZO_check_integer(i_initial_object_descriptor, 8)
BOZO_CLEAN();
BOZO_end_integer(i_initial_object_descriptor, 8)
BOZO_END(IOD);
return i_err;
}
/* network name */ /* network name */
static int main_dvb_network_name_0(void) static int main_dvb_network_name_0(void)
{ {
...@@ -2495,6 +2541,7 @@ int main(void) ...@@ -2495,6 +2541,7 @@ int main(void)
i_err |= main_mpeg_ibp_0(); i_err |= main_mpeg_ibp_0();
i_err |= main_mpeg_mpeg4_video_0(); i_err |= main_mpeg_mpeg4_video_0();
i_err |= main_mpeg_mpeg4_audio_0(); i_err |= main_mpeg_mpeg4_audio_0();
i_err |= main_mpeg_iod_0();
i_err |= main_dvb_network_name_0(); i_err |= main_dvb_network_name_0();
i_err |= main_dvb_service_list_0(); i_err |= main_dvb_service_list_0();
i_err |= main_dvb_stuffing_0(); i_err |= main_dvb_stuffing_0();
......
...@@ -46,6 +46,7 @@ mpegdrinclude_HEADERS = descriptors/mpeg/dr_02.h \ ...@@ -46,6 +46,7 @@ mpegdrinclude_HEADERS = descriptors/mpeg/dr_02.h \
descriptors/mpeg/dr_14.h \ descriptors/mpeg/dr_14.h \
descriptors/mpeg/dr_1b.h \ descriptors/mpeg/dr_1b.h \
descriptors/mpeg/dr_1c.h \ descriptors/mpeg/dr_1c.h \
descriptors/mpeg/dr_1d.h \
descriptors/mpeg/dr_24.h descriptors/mpeg/dr_24.h
dvbdrincludedir = $(pkgincludedir)/dvb dvbdrincludedir = $(pkgincludedir)/dvb
...@@ -118,6 +119,7 @@ descriptors_src = descriptors/mpeg/dr_02.c \ ...@@ -118,6 +119,7 @@ descriptors_src = descriptors/mpeg/dr_02.c \
descriptors/mpeg/dr_14.c \ descriptors/mpeg/dr_14.c \
descriptors/mpeg/dr_1b.c \ descriptors/mpeg/dr_1b.c \
descriptors/mpeg/dr_1c.c \ descriptors/mpeg/dr_1c.c \
descriptors/mpeg/dr_1d.c \
descriptors/mpeg/dr_24.c \ descriptors/mpeg/dr_24.c \
descriptors/dvb/dr_40.c \ descriptors/dvb/dr_40.c \
descriptors/dvb/dr_41.c \ descriptors/dvb/dr_41.c \
......
...@@ -88,6 +88,7 @@ ...@@ -88,6 +88,7 @@
#include "mpeg/dr_14.h" #include "mpeg/dr_14.h"
#include "mpeg/dr_1b.h" #include "mpeg/dr_1b.h"
#include "mpeg/dr_1c.h" #include "mpeg/dr_1c.h"
#include "mpeg/dr_1d.h"
#include "mpeg/dr_24.h" #include "mpeg/dr_24.h"
#include "custom/dr_83_eacem.h" #include "custom/dr_83_eacem.h"
#include "custom/dr_8a_scte.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_1d.h"
dvbpsi_mpeg_iod_dr_t* dvbpsi_decode_mpeg_iod_dr(
dvbpsi_descriptor_t * p_descriptor)
{
dvbpsi_mpeg_iod_dr_t * p_decoded;
/* check the tag. */
if (!dvbpsi_CanDecodeAsDescriptor(p_descriptor, 0x1d))
return NULL;
/* don't decode twice. */
if (dvbpsi_IsDescriptorDecoded(p_descriptor))
return p_descriptor->p_decoded;
/* all descriptors of this type have three bytes of payload. */
if (p_descriptor->i_length != 3)
return NULL;
p_decoded = malloc(sizeof(*p_decoded));
if (!p_decoded)
return NULL;
p_decoded->i_scope_of_iod_label = p_descriptor->p_data[0];
p_decoded->i_iod_label = p_descriptor->p_data[1];
p_decoded->i_initial_object_descriptor = p_descriptor->p_data[2];
p_descriptor->p_decoded = p_decoded;
return p_decoded;
}
dvbpsi_descriptor_t * dvbpsi_gen_mpeg_iod_dr(
dvbpsi_mpeg_iod_dr_t * p_decoded)
{
dvbpsi_descriptor_t * p_descriptor = dvbpsi_NewDescriptor(0x1d, 3, NULL);
if (!p_descriptor)
return NULL;
/* encode the data. */
p_descriptor->p_data[0] = p_decoded->i_scope_of_iod_label;
p_descriptor->p_data[1] = p_decoded->i_iod_label;
p_descriptor->p_data[2] = p_decoded->i_initial_object_descriptor;
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_1d.h>
* \author Daniel Kamil Kozar <dkk089@gmail.com>
* \brief Application interface for the IOD descriptor decoder and generator.
*
* Application interface for the IOD descriptor decoder and generator. This
* descriptor's definition can be found in ISO/IEC 13818-1 revision 2014/10
* section 2.6.40.
*/
#ifndef _DVBPSI_DR_1D_H_
#define _DVBPSI_DR_1D_H_
#ifdef __cplusplus
extern "C" {
#endif
/*!
* \struct dvbpsi_mpeg_iod_dr_s
* \brief IOD descriptor structure.
*
* This structure is used to store a decoded IOD descriptor. (ISO/IEC 13818-1
* section 2.6.40).
*/
/*!
* \typedef struct dvbpsi_mpeg_iod_dr_s dvbpsi_mpeg_iod_dr_t
* \brief dvbpsi_mpeg_iod_dr_t type definition.
*/
typedef struct dvbpsi_mpeg_iod_dr_s
{
uint8_t i_scope_of_iod_label; /*< Scope_of_IOD_label */
uint8_t i_iod_label; /*< IOD_label */
uint8_t i_initial_object_descriptor; /*< InitialObjectDescriptor */
} dvbpsi_mpeg_iod_dr_t;
/*!
* \brief IOD descriptor decoder.
* \param p_descriptor pointer to the descriptor structure
* \return A pointer to a new IOD descriptor structure which contains the
* decoded data.
*/
dvbpsi_mpeg_iod_dr_t* dvbpsi_decode_mpeg_iod_dr(
dvbpsi_descriptor_t * p_descriptor);
/*!
* \brief IOD descriptor generator.
* \param p_decoded pointer to a decoded IOD descriptor structure.
* \return a pointer to a new descriptor structure which contains encoded data.
*/
dvbpsi_descriptor_t * dvbpsi_gen_mpeg_iod_dr(
dvbpsi_mpeg_iod_dr_t * p_decoded);
#ifdef __cplusplus
}
#endif
#else
#error "Multiple inclusions of dr_1d.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