Commit 631af38f authored by Jean-Paul Saman's avatar Jean-Paul Saman

dr_65: DVB Scrambling descriptor

parent 1911ee61
......@@ -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
- 0x65 Scrambling 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
......
......@@ -386,6 +386,10 @@
<integer name="i_other_frequency_flag" bitcount="1" default="0"/>
</descriptor>
<descriptor name="scrambling" sname="dvb_scrambling">
<integer name="i_scrambling_mode" bitcount="8" default="1" />
</descriptor>
<descriptor name="transport stream" sname="dvb_transport_stream">
<insert>
<begin>
......
......@@ -2623,6 +2623,27 @@ static int main_dvb_terr_deliv_sys_0(void)
return i_err;
}
/* scrambling */
static int main_dvb_scrambling_0(void)
{
BOZO_VARS(dvb_scrambling);
BOZO_START(scrambling);
/* check i_scrambling_mode */
BOZO_init_integer(i_scrambling_mode, 1);
BOZO_begin_integer(i_scrambling_mode, 8)
BOZO_DOJOB(dvb_scrambling);
BOZO_check_integer(i_scrambling_mode, 8)
BOZO_CLEAN();
BOZO_end_integer(i_scrambling_mode, 8)
BOZO_END(scrambling);
return i_err;
}
/* transport stream */
static int main_dvb_transport_stream_0(void)
{
......@@ -2697,6 +2718,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_scrambling_0();
i_err |= main_dvb_transport_stream_0();
if(i_err)
......
......@@ -80,6 +80,7 @@ dvbdrinclude_HEADERS = descriptors/dvb/dr_40.h \
descriptors/dvb/dr_59.h \
descriptors/dvb/dr_5a.h \
descriptors/dvb/dr_62.h \
descriptors/dvb/dr_65.h \
descriptors/dvb/dr_66.h \
descriptors/dvb/dr_67.h \
descriptors/dvb/dr_69.h \
......@@ -155,6 +156,7 @@ descriptors_src = descriptors/mpeg/dr_02.c \
descriptors/dvb/dr_59.c \
descriptors/dvb/dr_5a.c \
descriptors/dvb/dr_62.c \
descriptors/dvb/dr_65.c \
descriptors/dvb/dr_66.c \
descriptors/dvb/dr_67.c \
descriptors/dvb/dr_69.c \
......
......@@ -62,6 +62,7 @@
#include "dvb/dr_59.h"
#include "dvb/dr_5a.h"
#include "dvb/dr_62.h"
#include "dvb/dr_65.h"
#include "dvb/dr_66.h"
#include "dvb/dr_67.h"
#include "dvb/dr_69.h"
......
/*****************************************************************************
* dr_65.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_65.h"
/*****************************************************************************
* dvbpsi_decode_dvb_scrambling_dr
*****************************************************************************/
dvbpsi_dvb_scrambling_dr_t *dvbpsi_decode_dvb_scrambling_dr(dvbpsi_descriptor_t *p_descriptor)
{
dvbpsi_dvb_scrambling_dr_t *p_decoded;
/* Check the tag */
if (!dvbpsi_CanDecodeAsDescriptor(p_descriptor, 0x65))
return NULL;
/* Don't decode twice */
if (dvbpsi_IsDescriptorDecoded(p_descriptor))
return p_descriptor->p_decoded;
/* Check the length */
if (p_descriptor->i_length != 0x01)
return NULL;
p_decoded = (dvbpsi_dvb_scrambling_dr_t *)
calloc(1, sizeof(dvbpsi_dvb_scrambling_dr_t));
if (!p_decoded)
return NULL;
p_decoded->i_scrambling_mode = p_descriptor->p_data[0];
p_descriptor->p_decoded = (void*)p_decoded;
return p_decoded;
}
/*****************************************************************************
* dvbpsi_gen_dvb_scrambling_dr
*****************************************************************************/
dvbpsi_descriptor_t *dvbpsi_gen_dvb_scrambling_dr(dvbpsi_dvb_scrambling_dr_t *p_decoded,
bool b_duplicate)
{
/* Create the descriptor */
dvbpsi_descriptor_t * p_descriptor = dvbpsi_NewDescriptor(0x65, 1, NULL);
if (!p_descriptor)
return NULL;
/* Encode data */
p_descriptor->p_data[0] = p_decoded->i_scrambling_mode;
if (b_duplicate)
{
/* Duplicate decoded data */
p_descriptor->p_decoded =
dvbpsi_DuplicateDecodedDescriptor(p_decoded,
sizeof(dvbpsi_dvb_scrambling_dr_t));
}
return p_descriptor;
}
/*****************************************************************************
* dr_65.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_65.h
* \author Jean-Paul Saman
* \brief Scrambling descriptor
*/
#ifndef _DR_65_H
#define _DR_66_H
/*****************************************************************************
* dvbpsi_dvb_scrambling_dr_s
*****************************************************************************/
/*!
* \struct dvbpsi_dvb_scrambling_dr_s
* \brief Scrambling Descriptor
*
* This structure is used to store a decoded Scrambling descriptor.
*
* The meaning of i_scrambling_mode is according ETSI EN 300 468 V1.13.1 (2012-04)
*
* scrambling_mode Description
* =============== ==========================================================
* 0x00 Reserved for future use
* 0x01 This value indicates use of DVB-CSA1.
* It is the default mode and shall be used
* when the scrambling descriptor is not present
* in the program map section
* 0x02 This value indicates use of DVB-CSA2
* 0x03 This value indicates use of DVB-CSA3 in standard mode
* 0x04 This value indicates use of DVB-CSA3 in minimally enhanced mode
* 0x05 This value indicates use of DVB-CSA3 in fully enhanced mode
* 0x06 to 0x6F Reserved for future use
* 0x70 to 0x7F ATIS defined (ATIS-0800006, see annex J)
* 0x80 to 0xFE User defined
* 0xFF Reserved for future use
*/
/*!
* \typedef struct dvbpsi_dvb_scrambling_dr_s dvbpsi_dvb_scrambling_dr_t
* \brief dvbpsi_dvb_scrambling_dr_t type definition.
*/
typedef struct dvbpsi_dvb_scrambling_dr_s
{
uint8_t i_scrambling_mode; /*!< Scrambling mode */
} dvbpsi_dvb_scrambling_dr_t;
/*****************************************************************************
* dvbpsi_dvb_scrambling_dr_s
*****************************************************************************/
/*!
* \fn dvbpsi_dvb_scrambling_dr_t *dvbpsi_decode_dvb_scrambling_dr(
* dvbpsi_descriptor_t *p_descriptor)
* \brief Decode a Scrambling descriptor (tag 0x65)
* \param p_descriptor Raw descriptor to decode.
* \return NULL if the descriptor could not be decoded or a pointer to a
* dvbpsi_dvb_scrambling_dr_t structure.
*/
dvbpsi_dvb_scrambling_dr_t *dvbpsi_decode_dvb_scrambling_dr(dvbpsi_descriptor_t *p_descriptor);
/*****************************************************************************
* dvbpsi_gen_scrambling_dr
*****************************************************************************/
/*!
* \fn dvbpsi_descriptor_t *dvbpsi_gen_scrambling_dr(dvbpsi_dvb_scrambling_dr_t *p_decoded,
bool b_duplicate);
* \brief Scrambling descriptor generator.
* \param p_decoded pointer to a decoded Scrambling 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_scrambling_dr(dvbpsi_dvb_scrambling_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