Commit 783306f0 authored by Jean-Paul Saman's avatar Jean-Paul Saman

New CUE Identifier Descriptor (0x8a)

From SCTE 35 2004 specification
parent 20f365da
......@@ -58,3 +58,4 @@ D: Program Delivery Control (0x69)
N: Jean-Paul Saman
E: jpsaman@videolan.org
D: VBI Data Descriptor (0x45)
D: CUE Identifier Descriptor (0x8a)
......@@ -6,12 +6,12 @@ lib_LTLIBRARIES = libdvbpsi.la
libdvbpsi_la_SOURCES = dvbpsi.c dvbpsi_private.h \
psi.c \
demux.c \
demux.c \
descriptor.c \
$(tables_src) \
$(descriptors_src)
libdvbpsi_la_LDFLAGS = -version-info 6:0:0
libdvbpsi_la_LDFLAGS = -version-info 7:0:0
pkginclude_HEADERS = dvbpsi.h psi.h descriptor.h demux.h \
tables/pat.h tables/pmt.h tables/sdt.h tables/eit.h \
......@@ -44,6 +44,7 @@ pkginclude_HEADERS = dvbpsi.h psi.h descriptor.h demux.h \
descriptors/dr_59.h \
descriptors/dr_5a.h \
descriptors/dr_69.h \
descriptors/dr_8a.h \
descriptors/dr.h
descriptors_src = descriptors/dr_02.c \
......@@ -73,7 +74,8 @@ descriptors_src = descriptors/dr_02.c \
descriptors/dr_58.c \
descriptors/dr_59.c \
descriptors/dr_5a.c \
descriptors/dr_69.c
descriptors/dr_69.c \
descriptors/dr_8a.c
tables_src = tables/pat.c tables/pat_private.h \
tables/pmt.c tables/pmt_private.h \
......
......@@ -60,6 +60,7 @@
#include "dr_59.h"
#include "dr_5a.h"
#include "dr_69.h"
#include "dr_8a.h"
#else
#error "Multiple inclusions of dr.h"
......
/*****************************************************************************
* dr_8a.c
* Copyright (c) 2010 VideoLAN
* $Id$
*
* Authors: Jean-Paul Saman <jpsaman@videolan.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*****************************************************************************/
#include "config.h"
#include <stdio.h>
#include <stdlib.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_8a.h"
/*****************************************************************************
* dvbpsi_DecodeCUEIDr
*****************************************************************************/
dvbpsi_cuei_dr_t * dvbpsi_DecodeCUEIDr(dvbpsi_descriptor_t * p_descriptor)
{
dvbpsi_cuei_dr_t *p_decoded;
/* Check the tag */
if (p_descriptor->i_tag != 0x8a)
{
DVBPSI_ERROR_ARG("dr_8a decoder", "bad tag (0x%x)", p_descriptor->i_tag);
return NULL;
}
/* Don't decode twice */
if (p_descriptor->p_decoded)
return p_descriptor->p_decoded;
/* Allocate memory */
p_decoded = (dvbpsi_cuei_dr_t*)malloc(sizeof(dvbpsi_cuei_dr_t));
if (!p_decoded)
{
DVBPSI_ERROR("dr_8a decoder", "out of memory");
return NULL;
}
/* Decode data and check the length */
if (p_descriptor->i_length == 0x01)
{
DVBPSI_ERROR_ARG("dr_8a decoder", "bad length (%d)",
p_descriptor->i_length);
free(p_decoded);
return NULL;
}
/* cue_stream_type according to: SCTE 35 2004 - p15 - table 6.3
* cue_stream_type PID usage
* 0x00 splice_insert, splice_null, splice_schedule
* 0x01 All Commands
* 0x02 Segmentation
* 0x03 Tiered Splicing
* 0x04 Tiered Segmentation
* 0x05 - 0x7f Reserved
* 0x80 - 0xff User Defined
*/
p_decoded->i_cue_stream_type = p_descriptor->p_data[0];
p_descriptor->p_decoded = (void*)p_decoded;
return p_decoded;
}
/*****************************************************************************
* dvbpsi_GenCUEIDr
*****************************************************************************/
dvbpsi_descriptor_t * dvbpsi_GenCUEIDr(dvbpsi_cuei_dr_t * p_decoded)
{
int i;
/* Create the descriptor */
dvbpsi_descriptor_t * p_descriptor =
dvbpsi_NewDescriptor(0x8a, 0x01, NULL);
if(p_descriptor)
{
/* Encode data */
p_descriptor->p_data[0] = p_decoded->i_cue_stream_type;
}
return p_descriptor;
}
/*****************************************************************************
* dr_8a.h
* Copyright (c) 2010 VideoLAN
* $Id$
*
* Authors: Jean-Paul Saman <jpsaman@videolan.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*****************************************************************************/
/*!
* \file <dr_8a.h>
* \author Jean-Paul Saman <jpsaman@videolan.org>
* \brief CUE Identifier descriptor parsing.
*
* CUE Identifier descriptor parsing, according to SCTE 35 2004
* section 6.2.
*/
#ifndef _DVBPSI_DR_8A_H_
#define _DVBPSI_DR_8A_H_
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
* dvbpsi_cuei_dr_t
*****************************************************************************/
/*!
* \struct dvbpsi_cuei_dr_s
* \brief "CUE Identifier" descriptor structure.
*
* The CUE Identifier descriptor is used to label the PIDs
* that carry splice commands. (SCTE 35 2004 section 6.2.)
*/
/*!
* \typedef struct dvbpsi_cuei_dr_s dvbpsi_cuei_dr_t
* \brief dvbpsi_cuei_dr_t type definition.
*/
typedef struct dvbpsi_cuei_dr_s
{
uint8_t i_cue_stream_type; /*!< indicate type of splice commands */
} dvbpsi_cuei_dr_t;
/*****************************************************************************
* dvbpsi_DecodeCUEIDataDr
*****************************************************************************/
/*!
* \fn dvbpsi_cuei_dr_t * dvbpsi_DecodeCUEIDr(dvbpsi_descriptor_t * p_descriptor)
* \brief "CUEI" descriptor decoder.
* \param p_descriptor pointer to the descriptor structure
* \return a pointer to a new "CUEI" descriptor structure
* which contains the decoded data.
*/
dvbpsi_cuei_dr_t* dvbpsi_DecodeCUEIDr(dvbpsi_descriptor_t * p_descriptor);
/*****************************************************************************
* dvbpsi_GenCUEIDataDr
*****************************************************************************/
/*!
* \fn dvbpsi_descriptor_t * dvbpsi_GenCUEIDr(
dvbpsi_cuei_dr_t * p_decoded, int b_duplicate)
* \brief "CUEI" descriptor generator.
* \param p_decoded pointer to a decoded "CUEI" descriptor
* structure
* \param b_duplicate if non zero 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_GenCUEIDr(dvbpsi_cuei_dr_t * p_decoded);
#ifdef __cplusplus
};
#endif
#else
#error "Multiple inclusions of dr_8a.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