* src/descriptors/dr_08.h: fixed a typo.

  * src/descriptors/dr_09.h, src/descriptors/dr_09.c: MPEG2 "conditional
    access" descriptor decoder and generator (not tested).
  * src/descriptors/dr_0a.h, src/descriptors/dr_0a.c: MPEG2 "ISO 639
    language" descriptor decoder and generator (not tested).
parent 338d3bf8
...@@ -10,7 +10,9 @@ lib_descriptors_la_SOURCES = dr_02.c \ ...@@ -10,7 +10,9 @@ lib_descriptors_la_SOURCES = dr_02.c \
dr_05.c \ dr_05.c \
dr_06.c \ dr_06.c \
dr_07.c \ dr_07.c \
dr_08.c dr_08.c \
dr_09.c \
dr_0a.c
pkginclude_HEADERS = dr_02.h \ pkginclude_HEADERS = dr_02.h \
dr_03.h \ dr_03.h \
...@@ -18,5 +20,7 @@ pkginclude_HEADERS = dr_02.h \ ...@@ -18,5 +20,7 @@ pkginclude_HEADERS = dr_02.h \
dr_05.h \ dr_05.h \
dr_06.h \ dr_06.h \
dr_07.h \ dr_07.h \
dr_08.h dr_08.h \
dr_09.h \
dr_0a.h
...@@ -77,10 +77,10 @@ pkgincludedir = $(includedir)/dvbpsi ...@@ -77,10 +77,10 @@ pkgincludedir = $(includedir)/dvbpsi
noinst_LTLIBRARIES = lib_descriptors.la noinst_LTLIBRARIES = lib_descriptors.la
lib_descriptors_la_SOURCES = dr_02.c dr_03.c dr_04.c dr_05.c dr_06.c dr_07.c dr_08.c lib_descriptors_la_SOURCES = dr_02.c dr_03.c dr_04.c dr_05.c dr_06.c dr_07.c dr_08.c dr_09.c dr_0a.c
pkginclude_HEADERS = dr_02.h dr_03.h dr_04.h dr_05.h dr_06.h dr_07.h dr_08.h pkginclude_HEADERS = dr_02.h dr_03.h dr_04.h dr_05.h dr_06.h dr_07.h dr_08.h dr_09.h dr_0a.h
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../src/config.h CONFIG_HEADER = ../../src/config.h
...@@ -95,7 +95,7 @@ LIBS = @LIBS@ ...@@ -95,7 +95,7 @@ LIBS = @LIBS@
lib_descriptors_la_LDFLAGS = lib_descriptors_la_LDFLAGS =
lib_descriptors_la_LIBADD = lib_descriptors_la_LIBADD =
lib_descriptors_la_OBJECTS = dr_02.lo dr_03.lo dr_04.lo dr_05.lo \ lib_descriptors_la_OBJECTS = dr_02.lo dr_03.lo dr_04.lo dr_05.lo \
dr_06.lo dr_07.lo dr_08.lo dr_06.lo dr_07.lo dr_08.lo dr_09.lo dr_0a.lo
CFLAGS = @CFLAGS@ CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
...@@ -111,7 +111,7 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) ...@@ -111,7 +111,7 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar TAR = tar
GZIP_ENV = --best GZIP_ENV = --best
DEP_FILES = .deps/dr_02.P .deps/dr_03.P .deps/dr_04.P .deps/dr_05.P \ DEP_FILES = .deps/dr_02.P .deps/dr_03.P .deps/dr_04.P .deps/dr_05.P \
.deps/dr_06.P .deps/dr_07.P .deps/dr_08.P .deps/dr_06.P .deps/dr_07.P .deps/dr_08.P .deps/dr_09.P .deps/dr_0a.P
SOURCES = $(lib_descriptors_la_SOURCES) SOURCES = $(lib_descriptors_la_SOURCES)
OBJECTS = $(lib_descriptors_la_OBJECTS) OBJECTS = $(lib_descriptors_la_OBJECTS)
......
/***************************************************************************** /*****************************************************************************
* dr_08.h * dr_08.h
* (c)2001-2002 VideoLAN * (c)2001-2002 VideoLAN
* $Id: dr_08.h,v 1.1 2002/05/08 15:55:32 bozo Exp $ * $Id: dr_08.h,v 1.2 2002/05/08 16:45:33 bozo Exp $
* *
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* *
...@@ -71,8 +71,8 @@ typedef struct dvbpsi_vwindow_dr_s ...@@ -71,8 +71,8 @@ typedef struct dvbpsi_vwindow_dr_s
* dvbpsi_descriptor_t * p_descriptor) * dvbpsi_descriptor_t * p_descriptor)
* \brief "video window" descriptor decoder. * \brief "video window" descriptor decoder.
* \param p_descriptor pointer to the descriptor structure * \param p_descriptor pointer to the descriptor structure
* \return a pointer to a new "vwindow" descriptor structure which contains * \return a pointer to a new "video window" descriptor structure which
* the decoded data. * contains the decoded data.
*/ */
dvbpsi_vwindow_dr_t* dvbpsi_DecodeVWindowDr(dvbpsi_descriptor_t * p_descriptor); dvbpsi_vwindow_dr_t* dvbpsi_DecodeVWindowDr(dvbpsi_descriptor_t * p_descriptor);
...@@ -84,7 +84,7 @@ dvbpsi_vwindow_dr_t* dvbpsi_DecodeVWindowDr(dvbpsi_descriptor_t * p_descriptor); ...@@ -84,7 +84,7 @@ dvbpsi_vwindow_dr_t* dvbpsi_DecodeVWindowDr(dvbpsi_descriptor_t * p_descriptor);
* \fn dvbpsi_descriptor_t * dvbpsi_GenVWindowDr( * \fn dvbpsi_descriptor_t * dvbpsi_GenVWindowDr(
* dvbpsi_vwindow_dr_t * p_decoded, int b_duplicate) * dvbpsi_vwindow_dr_t * p_decoded, int b_duplicate)
* \brief "video window" descriptor generator. * \brief "video window" descriptor generator.
* \param p_decoded pointer to a decoded "vwindow" descriptor structure * \param p_decoded pointer to a decoded "video window" descriptor structure
* \param b_duplicate if non zero then duplicate the p_decoded structure into * \param b_duplicate if non zero then duplicate the p_decoded structure into
* the descriptor * the descriptor
* \return a pointer to a new descriptor structure which contains encoded data. * \return a pointer to a new descriptor structure which contains encoded data.
......
/*****************************************************************************
* dr_09.c
* (c)2001-2002 VideoLAN
* $Id: dr_09.c,v 1.1 2002/05/08 16:45:33 bozo Exp $
*
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
*
* 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>
#include "../dvbpsi.h"
#include "../dvbpsi_private.h"
#include "../descriptor.h"
#include "dr_09.h"
/*****************************************************************************
* dvbpsi_DecodeCADr
*****************************************************************************/
dvbpsi_ca_dr_t * dvbpsi_DecodeCADr(dvbpsi_descriptor_t * p_descriptor)
{
dvbpsi_ca_dr_t * p_decoded;
/* Check the tag */
if(p_descriptor->i_tag != 0x09)
{
DVBPSI_ERROR_ARG("dr_09 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_ca_dr_t*)malloc(sizeof(dvbpsi_ca_dr_t));
if(!p_decoded)
{
DVBPSI_ERROR("dr_09 decoder", "out of memory");
return NULL;
}
/* Decode data and check the length */
if(p_descriptor->i_length < 4)
{
DVBPSI_ERROR_ARG("dr_09 decoder", "bad length (%d)",
p_descriptor->i_length);
free(p_decoded);
}
p_decoded->i_ca_system_id = ((uint16_t)(p_descriptor->p_data[0]) << 8)
| p_descriptor->p_data[1];
p_decoded->i_ca_pid = ((uint16_t)(p_descriptor->p_data[2] & 0x1f) << 8)
| p_descriptor->p_data[3];
p_decoded->i_private_length = p_descriptor->i_length - 4;
if(p_decoded->i_private_length)
memcpy(p_decoded->i_private_data,
p_descriptor->p_data + 4,
p_decoded->i_private_length);
p_descriptor->p_decoded = (void*)p_decoded;
return p_decoded;
}
/*****************************************************************************
* dvbpsi_GenCADr
*****************************************************************************/
dvbpsi_descriptor_t * dvbpsi_GenCADr(dvbpsi_ca_dr_t * p_decoded,
int b_duplicate)
{
/* Create the descriptor */
dvbpsi_descriptor_t * p_descriptor =
dvbpsi_NewDescriptor(0x06, p_decoded->i_private_length + 4, NULL);
if(p_descriptor)
{
/* Encode data */
p_descriptor->p_data[0] = p_decoded->i_ca_system_id >> 8;
p_descriptor->p_data[1] = p_decoded->i_ca_system_id;
p_descriptor->p_data[2] = (p_decoded->i_ca_pid >> 8) & 0x1f;
p_descriptor->p_data[3] = p_decoded->i_ca_pid;
if(p_decoded->i_private_length)
memcpy(p_descriptor->p_data + 4,
p_decoded->i_private_data,
p_decoded->i_private_length);
if(b_duplicate)
{
/* Duplicate decoded data */
dvbpsi_ca_dr_t * p_dup_decoded =
(dvbpsi_ca_dr_t*)malloc(sizeof(dvbpsi_ca_dr_t));
if(p_dup_decoded)
memcpy(p_dup_decoded, p_decoded, sizeof(dvbpsi_ca_dr_t));
p_descriptor->p_decoded = (void*)p_dup_decoded;
}
}
return p_descriptor;
}
/*****************************************************************************
* dr_09.h
* (c)2001-2002 VideoLAN
* $Id: dr_09.h,v 1.1 2002/05/08 16:45:33 bozo Exp $
*
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
*
* 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_09.h>
* \author Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* \brief Application interface for the MPEG 2 "conditional access"
* descriptor decoder and generator.
*
* Application interface for the MPEG 2 "conditional access" descriptor
* decoder and generator. This descriptor's definition can be found in
* ISO/IEC 13818-1 section 2.6.16.
*/
#ifndef _DVBPSI_DR_09_H_
#define _DVBPSI_DR_09_H_
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
* dvbpsi_ca_dr_t
*****************************************************************************/
/*!
* \struct dvbpsi_ca_dr_s
* \brief "conditional access" descriptor structure.
*
* This structure is used to store a decoded "conditional access"
* descriptor. (ISO/IEC 13818-1 section 2.6.16).
*/
/*!
* \typedef struct dvbpsi_ca_dr_s dvbpsi_ca_dr_t
* \brief dvbpsi_ca_dr_t type definition.
*/
typedef struct dvbpsi_ca_dr_s
{
uint16_t i_ca_system_id; /*!< CA_system_ID */
uint16_t i_ca_pid; /*!< CA_PID */
uint8_t i_private_length; /*!< length of the i_private_data
array */
uint8_t i_private_data[251]; /*!< private_data_byte */
} dvbpsi_ca_dr_t;
/*****************************************************************************
* dvbpsi_DecodeCADr
*****************************************************************************/
/*!
* \fn dvbpsi_ca_dr_t * dvbpsi_DecodeCADr(
* dvbpsi_descriptor_t * p_descriptor)
* \brief "conditional access" descriptor decoder.
* \param p_descriptor pointer to the descriptor structure
* \return a pointer to a new "conditional access" descriptor structure which
* contains the decoded data.
*/
dvbpsi_ca_dr_t* dvbpsi_DecodeCADr(dvbpsi_descriptor_t * p_descriptor);
/*****************************************************************************
* dvbpsi_GenCADr
*****************************************************************************/
/*!
* \fn dvbpsi_descriptor_t * dvbpsi_GenCADr(
* dvbpsi_ca_dr_t * p_decoded, int b_duplicate)
* \brief "conditional access" descriptor generator.
* \param p_decoded pointer to a decoded "conditional access" 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_GenCADr(dvbpsi_ca_dr_t * p_decoded,
int b_duplicate);
#ifdef __cplusplus
};
#endif
#else
#error "Multiple inclusions of dr_09.h"
#endif
/*****************************************************************************
* dr_0a.c
* (c)2001-2002 VideoLAN
* $Id: dr_0a.c,v 1.1 2002/05/08 16:45:33 bozo Exp $
*
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
*
* 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>
#include "../dvbpsi.h"
#include "../dvbpsi_private.h"
#include "../descriptor.h"
#include "dr_0a.h"
/*****************************************************************************
* dvbpsi_DecodeISO639Dr
*****************************************************************************/
dvbpsi_iso639_dr_t * dvbpsi_DecodeISO639Dr(dvbpsi_descriptor_t * p_descriptor)
{
dvbpsi_iso639_dr_t * p_decoded;
/* Check the tag */
if(p_descriptor->i_tag != 0x0a)
{
DVBPSI_ERROR_ARG("dr_0a 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_iso639_dr_t*)malloc(sizeof(dvbpsi_iso639_dr_t));
if(!p_decoded)
{
DVBPSI_ERROR("dr_0a decoder", "out of memory");
return NULL;
}
/* Decode data and check the length */
if((p_descriptor->i_length < 1) || ((p_descriptor->i_length - 1) % 3 != 0))
{
DVBPSI_ERROR_ARG("dr_0a decoder", "bad length (%d)",
p_descriptor->i_length);
free(p_decoded);
}
p_decoded->i_audio_type = p_descriptor->p_data[p_descriptor->i_length - 1];
p_decoded->i_code_count = (p_descriptor->i_length - 1) / 3;
if(p_decoded->i_code_count)
memcpy(p_decoded->i_iso_639_code,
p_descriptor->p_data,
p_descriptor->i_length - 1);
p_descriptor->p_decoded = (void*)p_decoded;
return p_decoded;
}
/*****************************************************************************
* dvbpsi_GenISO639Dr
*****************************************************************************/
dvbpsi_descriptor_t * dvbpsi_GenISO639Dr(dvbpsi_iso639_dr_t * p_decoded,
int b_duplicate)
{
/* Create the descriptor */
dvbpsi_descriptor_t * p_descriptor =
dvbpsi_NewDescriptor(0x06, p_decoded->i_code_count * 3 + 1, NULL);
if(p_descriptor)
{
/* Encode data */
p_descriptor->p_data[p_descriptor->i_length - 1] = p_decoded->i_audio_type;
if(p_decoded->i_code_count)
memcpy(p_descriptor->p_data,
p_decoded->i_iso_639_code,
p_descriptor->i_length - 1);
if(b_duplicate)
{
/* Duplicate decoded data */
dvbpsi_iso639_dr_t * p_dup_decoded =
(dvbpsi_iso639_dr_t*)malloc(sizeof(dvbpsi_iso639_dr_t));
if(p_dup_decoded)
memcpy(p_dup_decoded, p_decoded, sizeof(dvbpsi_iso639_dr_t));
p_descriptor->p_decoded = (void*)p_dup_decoded;
}
}
return p_descriptor;
}
/*****************************************************************************
* dr_0a.h
* (c)2001-2002 VideoLAN
* $Id: dr_0a.h,v 1.1 2002/05/08 16:45:33 bozo Exp $
*
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
*
* 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_0a.h>
* \author Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* \brief Application interface for the MPEG 2 "ISO 639 language"
* descriptor decoder and generator.
*
* Application interface for the MPEG 2 "ISO 639 language" descriptor
* decoder and generator. This descriptor's definition can be found in
* ISO/IEC 13818-1 section 2.6.18.
*/
#ifndef _DVBPSI_DR_0A_H_
#define _DVBPSI_DR_0A_H_
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
* dvbpsi_iso639_dr_t
*****************************************************************************/
/*!
* \struct dvbpsi_iso639_dr_s
* \brief "ISO 639 language" descriptor structure.
*
* This structure is used to store a decoded "ISO 639 language"
* descriptor. (ISO/IEC 13818-1 section 2.6.18).
*/
/*!
* \typedef struct dvbpsi_iso639_dr_s dvbpsi_iso639_dr_t
* \brief dvbpsi_iso639_dr_t type definition.
*/
typedef struct dvbpsi_iso639_dr_s
{
uint8_t i_code_count; /*!< length of the i_iso_639_code
array */
uint8_t i_iso_639_code[252]; /*!< ISO_639_language_code */
uint8_t i_audio_type; /*!< audio_type */
} dvbpsi_iso639_dr_t;
/*****************************************************************************
* dvbpsi_DecodeISO639Dr
*****************************************************************************/
/*!
* \fn dvbpsi_iso639_dr_t * dvbpsi_DecodeISO639Dr(
* dvbpsi_descriptor_t * p_descriptor)
* \brief "ISO 639 language" descriptor decoder.
* \param p_descriptor pointer to the descriptor structure
* \return a pointer to a new "ISO 639 language" descriptor structure which
* contains the decoded data.
*/
dvbpsi_iso639_dr_t* dvbpsi_DecodeISO639Dr(dvbpsi_descriptor_t * p_descriptor);
/*****************************************************************************
* dvbpsi_GenISO639Dr
*****************************************************************************/
/*!
* \fn dvbpsi_descriptor_t * dvbpsi_GenISO639Dr(
* dvbpsi_iso639_dr_t * p_decoded, int b_duplicate)
* \brief "ISO 639 language" descriptor generator.
* \param p_decoded pointer to a decoded "ISO 639 language" 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_GenISO639Dr(dvbpsi_iso639_dr_t * p_decoded,
int b_duplicate);
#ifdef __cplusplus
};
#endif
#else
#error "Multiple inclusions of dr_0a.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