* src/descriptors/dr_02.c:

  * src/descriptors/dr_07.c:
  * src/descriptors/dr_08.c:
  * src/descriptors/dr_09.c:
  * src/descriptors/dr_0a.c:
  * misc/dr.xml: xml brief description of each descriptor to generate
    "misc/test_dr.c".
  * misc/dr.xsl: stylesheet used to generate "misc/test_dr.c".
  * misc/dr.dtd: DTD against which misc/dr.xml validates.
  * misc/test_dr.c: generated file.
  * misc/test_dr.h: macros used by misc/test_dr.c.
  * src/descriptors/dr.h: gathers all dr_*.h headers.
parent 4a7f609b
......@@ -9,3 +9,6 @@ doc-dummy:
doc: doc-dummy
$(MAKE) -C doc doc
test_dr.c:
$(MAKE) -C misc test_dr.c
......@@ -336,6 +336,9 @@ doc-dummy:
doc: doc-dummy
$(MAKE) -C doc doc
test_dr.c:
$(MAKE) -C misc test_dr.c
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
......@@ -4,3 +4,4 @@ Makefile
gen_crc
gen_pat
gen_pmt
test_dr
## Process this file with automake to produce Makefile.in
noinst_PROGRAMS = gen_crc gen_pat gen_pmt
noinst_PROGRAMS = gen_crc gen_pat gen_pmt \
test_dr
gen_crc_SOURCES = gen_crc.c
......@@ -10,3 +12,12 @@ gen_pat_LDFLAGS = -L../src -ldvbpsi
gen_pmt_SOURCES = gen_pmt.c
gen_pmt_LDFLAGS = -L../src -ldvbpsi
test_dr_SOURCES = test_dr.c
test_dr_LDFLAGS = -L../src -ldvbpsi
EXTRA_DIST=dr.dtd dr.xml dr.xsl
test_dr.c:
xsltproc -o test_dr.c dr.xsl dr.xml
......@@ -74,7 +74,8 @@ RANLIB = @RANLIB@
STRIP = @STRIP@
VERSION = @VERSION@
noinst_PROGRAMS = gen_crc gen_pat gen_pmt
noinst_PROGRAMS = gen_crc gen_pat gen_pmt test_dr
gen_crc_SOURCES = gen_crc.c
......@@ -83,10 +84,16 @@ gen_pat_LDFLAGS = -L../src -ldvbpsi
gen_pmt_SOURCES = gen_pmt.c
gen_pmt_LDFLAGS = -L../src -ldvbpsi
test_dr_SOURCES = test_dr.c
test_dr_LDFLAGS = -L../src -ldvbpsi
EXTRA_DIST = dr.dtd dr.xml dr.xsl
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../src/config.h
CONFIG_CLEAN_FILES =
noinst_PROGRAMS = gen_crc$(EXEEXT) gen_pat$(EXEEXT) gen_pmt$(EXEEXT)
noinst_PROGRAMS = gen_crc$(EXEEXT) gen_pat$(EXEEXT) gen_pmt$(EXEEXT) \
test_dr$(EXEEXT)
PROGRAMS = $(noinst_PROGRAMS)
......@@ -104,6 +111,9 @@ gen_pat_DEPENDENCIES =
gen_pmt_OBJECTS = gen_pmt.$(OBJEXT)
gen_pmt_LDADD = $(LDADD)
gen_pmt_DEPENDENCIES =
test_dr_OBJECTS = test_dr.$(OBJEXT)
test_dr_LDADD = $(LDADD)
test_dr_DEPENDENCIES =
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)
......@@ -116,9 +126,10 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
DEP_FILES = .deps/gen_crc.P .deps/gen_pat.P .deps/gen_pmt.P
SOURCES = $(gen_crc_SOURCES) $(gen_pat_SOURCES) $(gen_pmt_SOURCES)
OBJECTS = $(gen_crc_OBJECTS) $(gen_pat_OBJECTS) $(gen_pmt_OBJECTS)
DEP_FILES = .deps/gen_crc.P .deps/gen_pat.P .deps/gen_pmt.P \
.deps/test_dr.P
SOURCES = $(gen_crc_SOURCES) $(gen_pat_SOURCES) $(gen_pmt_SOURCES) $(test_dr_SOURCES)
OBJECTS = $(gen_crc_OBJECTS) $(gen_pat_OBJECTS) $(gen_pmt_OBJECTS) $(test_dr_OBJECTS)
all: all-redirect
.SUFFIXES:
......@@ -190,6 +201,10 @@ gen_pmt$(EXEEXT): $(gen_pmt_OBJECTS) $(gen_pmt_DEPENDENCIES)
@rm -f gen_pmt$(EXEEXT)
$(LINK) $(gen_pmt_LDFLAGS) $(gen_pmt_OBJECTS) $(gen_pmt_LDADD) $(LIBS)
test_dr$(EXEEXT): $(test_dr_OBJECTS) $(test_dr_DEPENDENCIES)
@rm -f test_dr$(EXEEXT)
$(LINK) $(test_dr_LDFLAGS) $(test_dr_OBJECTS) $(test_dr_LDADD) $(LIBS)
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
......@@ -348,6 +363,9 @@ distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
test_dr.c:
xsltproc -o test_dr.c dr.xsl dr.xml
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
<!ELEMENT dr (descriptor*)>
<!ELEMENT descriptor (integer | boolean | insert)*>
<!ELEMENT integer EMPTY>
<!ELEMENT boolean EMPTY>
<!ELEMENT insert (begin? | check? | end?)>
<!ELEMENT begin (#PCDATA)>
<!ELEMENT check (#PCDATA)>
<!ELEMENT end (#PCDATA)>
<!ATTLIST descriptor name CDATA #IMPLIED>
<!ATTLIST descriptor sname CDATA #IMPLIED>
<!ATTLIST descriptor fname CDATA #IMPLIED>
<!ATTLIST integer name CDATA #IMPLIED>
<!ATTLIST integer bitcount CDATA #IMPLIED>
<!ATTLIST boolean name CDATA #IMPLIED>
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE dr SYSTEM "dr.dtd">
<dr>
<descriptor name="video stream" sname="vstream" fname="VStream">
<boolean name="b_multiple_frame_rate" />
<integer name="i_frame_rate_code" bitcount="4" />
<boolean name="b_mpeg2" />
<boolean name="b_constrained_parameter" />
<boolean name="b_still_picture" />
<insert>
<check>
if(s_decoded.b_mpeg2)
{</check>
</insert>
<integer name="i_profile_level_indication" bitcount="8" />
<integer name="i_chroma_format" bitcount="2" />
<boolean name="b_frame_rate_extension" />
<insert>
<check>
}</check>
</insert>
</descriptor>
<descriptor name="audio stream" sname="astream" fname="AStream">
<boolean name="b_free_format" />
<integer name="i_id" bitcount="1" />
<integer name="i_layer" bitcount="2" />
</descriptor>
<descriptor name="hierarchy" sname="hierarchy" fname="Hierarchy">
<integer name="i_h_type" bitcount="4" />
<integer name="i_h_layer_index" bitcount="6" />
<integer name="i_h_embedded_layer" bitcount="6" />
<integer name="i_h_priority" bitcount="6" />
</descriptor>
<descriptor name="registration" sname="registration" fname="Registration">
<insert>
<begin>
s_decoded.i_additional_length = 0;</begin>
</insert>
<integer name="i_format_identifier" bitcount="32" />
</descriptor>
<descriptor name="data stream alignment" sname="ds_alignment" fname="DSAlignment">
<integer name="i_alignment_type" bitcount="8" />
</descriptor>
<descriptor name="target background grid" sname="target_bg_grid" fname="TargetBgGrid">
<integer name="i_horizontal_size" bitcount="14" />
<integer name="i_vertical_size" bitcount="14" />
<integer name="i_pel_aspect_ratio" bitcount="4" />
</descriptor>
<descriptor name="video window" sname="vwindow" fname="VWindow">
<integer name="i_horizontal_offset" bitcount="14" />
<integer name="i_vertical_offset" bitcount="14" />
<integer name="i_window_priority" bitcount="4" />
</descriptor>
<descriptor name="conditional access" sname="ca" fname="CA">
<insert>
<begin>
s_decoded.i_private_length = 0;</begin>
</insert>
<integer name="i_ca_system_id" bitcount="16" />
<integer name="i_ca_pid" bitcount="13" />
</descriptor>
<descriptor name="ISO 639 language" sname="iso639" fname="ISO639">
<insert>
<begin>
s_decoded.i_code_count = 0;</begin>
</insert>
<integer name="i_audio_type" bitcount="8" />
</descriptor>
</dr>
<?xml version="1.0" encoding="iso-8859-1" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" omit-xml-declaration="yes" indent="no" encoding="iso-8859-1" />
<!-- -->
<!-- entry point -->
<!-- -->
<xsl:template match="/dr">
/* This file is generated by applying the dr.xsl stylesheet to the dr.xml
* description file. DO NOT EDIT !!! */
#include "config.h"
#include &lt;stdio.h&gt;
/* the libdvbpsi distribution defines DVBPSI_DIST */
#ifdef DVBPSI_DIST
#include "../src/dvbpsi.h"
#include "../src/descriptor.h"
#include "../src/descriptors/dr.h"
#else
#include &lt;dvbpsi/dvbpsi.h&gt;
#include &lt;dvbpsi/descriptor.h&gt;
#include &lt;dvbpsi/dr.h&gt;
#endif
#include "test_dr.h"
<xsl:apply-templates mode="code" />
/* main function */
int main()
{
int i_err = 0;
<xsl:apply-templates mode="main" />
return i_err;
}
</xsl:template>
<xsl:template match="text()" priority="-1"/>
<!-- -->
<!-- code templates -->
<!-- -->
<xsl:template match="descriptor" mode="code">
/* <xsl:value-of select="@name" /> */
int main_<xsl:value-of select="@sname" />()
{
BOZO_VARS(<xsl:value-of select="@sname" />);
BOZO_START(<xsl:value-of select="@name" />);
/* BEGIN start */<xsl:apply-templates mode="begin" />
/* BEGIN end */
BOZO_DOJOB(<xsl:value-of select="@fname" />);
/* CHECK start */<xsl:apply-templates mode="check" />
/* CHECK end */
BOZO_CLEAN();
/* END start */<xsl:apply-templates mode="end" >
<xsl:sort select="position()" data-type="number" order="descending" />
</xsl:apply-templates>
/* END end */
BOZO_END(<xsl:value-of select="@name" />);
return i_err;
}
</xsl:template>
<xsl:template match="text()" mode="code" priority="-1"/>
<!-- -->
<!-- begin templates -->
<!-- -->
<xsl:template match="integer" mode="begin">
BOZO_begin_integer(<xsl:value-of select="@name" />, <xsl:value-of select="@bitcount" />)</xsl:template>
<xsl:template match="boolean" mode="begin">
BOZO_begin_boolean(<xsl:value-of select="@name" />)</xsl:template>
<xsl:template match="insert" mode="begin">
<xsl:value-of select="begin" />
</xsl:template>
<xsl:template match="text()" mode="begin" priority="-1"/>
<!-- -->
<!-- check templates -->
<!-- -->
<xsl:template match="integer" mode="check">
BOZO_check_integer<xsl:if test="@bitcount='32' or @bitcount='64'" ><xsl:value-of select="@bitcount" /></xsl:if>(<xsl:value-of select="@name" />, <xsl:value-of select="@bitcount" />)</xsl:template>
<xsl:template match="boolean" mode="check">
BOZO_check_boolean(<xsl:value-of select="@name" />)</xsl:template>
<xsl:template match="insert" mode="check">
<xsl:value-of select="check" />
</xsl:template>
<xsl:template match="text()" mode="check" priority="-1"/>
<!-- -->
<!-- end templates -->
<!-- -->
<xsl:template match="integer" mode="end">
BOZO_end_integer<xsl:if test="@bitcount='32' or @bitcount='64'" ><xsl:value-of select="@bitcount" /></xsl:if>(<xsl:value-of select="@name" />, <xsl:value-of select="@bitcount" />)</xsl:template>
<xsl:template match="boolean" mode="end">
BOZO_end_boolean(<xsl:value-of select="@name" />)</xsl:template>
<xsl:template match="insert" mode="end">
<xsl:value-of select="end" />
</xsl:template>
<xsl:template match="text()" mode="end" priority="-1"/>
<!-- -->
<!-- main templates -->
<!-- -->
<xsl:template match="descriptor" mode="main">
i_err |= main_<xsl:value-of select="@sname" />();</xsl:template>
<xsl:template match="text()" mode="main" priority="-1"/>
</xsl:stylesheet>
/* This file is generated by applying the dr.xsl stylesheet to the dr.xml
* description file. DO NOT EDIT !!! */
#include "config.h"
#include <stdio.h>
/* the libdvbpsi distribution defines DVBPSI_DIST */
#ifdef DVBPSI_DIST
#include "../src/dvbpsi.h"
#include "../src/descriptor.h"
#include "../src/descriptors/dr.h"
#else
#include <dvbpsi/dvbpsi.h>
#include <dvbpsi/descriptor.h>
#include <dvbpsi/dr.h>
#endif
#include "test_dr.h"
/* video stream */
int main_vstream()
{
BOZO_VARS(vstream);
BOZO_START(video stream);
/* BEGIN start */
BOZO_begin_boolean(b_multiple_frame_rate)
BOZO_begin_integer(i_frame_rate_code, 4)
BOZO_begin_boolean(b_mpeg2)
BOZO_begin_boolean(b_constrained_parameter)
BOZO_begin_boolean(b_still_picture)
BOZO_begin_integer(i_profile_level_indication, 8)
BOZO_begin_integer(i_chroma_format, 2)
BOZO_begin_boolean(b_frame_rate_extension)
/* BEGIN end */
BOZO_DOJOB(VStream);
/* CHECK start */
BOZO_check_boolean(b_multiple_frame_rate)
BOZO_check_integer(i_frame_rate_code, 4)
BOZO_check_boolean(b_mpeg2)
BOZO_check_boolean(b_constrained_parameter)
BOZO_check_boolean(b_still_picture)
if(s_decoded.b_mpeg2)
{
BOZO_check_integer(i_profile_level_indication, 8)
BOZO_check_integer(i_chroma_format, 2)
BOZO_check_boolean(b_frame_rate_extension)
}
/* CHECK end */
BOZO_CLEAN();
/* END start */
BOZO_end_boolean(b_frame_rate_extension)
BOZO_end_integer(i_chroma_format, 2)
BOZO_end_integer(i_profile_level_indication, 8)
BOZO_end_boolean(b_still_picture)
BOZO_end_boolean(b_constrained_parameter)
BOZO_end_boolean(b_mpeg2)
BOZO_end_integer(i_frame_rate_code, 4)
BOZO_end_boolean(b_multiple_frame_rate)
/* END end */
BOZO_END(video stream);
return i_err;
}
/* audio stream */
int main_astream()
{
BOZO_VARS(astream);
BOZO_START(audio stream);
/* BEGIN start */
BOZO_begin_boolean(b_free_format)
BOZO_begin_integer(i_id, 1)
BOZO_begin_integer(i_layer, 2)
/* BEGIN end */
BOZO_DOJOB(AStream);
/* CHECK start */
BOZO_check_boolean(b_free_format)
BOZO_check_integer(i_id, 1)
BOZO_check_integer(i_layer, 2)
/* CHECK end */
BOZO_CLEAN();
/* END start */
BOZO_end_integer(i_layer, 2)
BOZO_end_integer(i_id, 1)
BOZO_end_boolean(b_free_format)
/* END end */
BOZO_END(audio stream);
return i_err;
}
/* hierarchy */
int main_hierarchy()
{
BOZO_VARS(hierarchy);
BOZO_START(hierarchy);
/* BEGIN start */
BOZO_begin_integer(i_h_type, 4)
BOZO_begin_integer(i_h_layer_index, 6)
BOZO_begin_integer(i_h_embedded_layer, 6)
BOZO_begin_integer(i_h_priority, 6)
/* BEGIN end */
BOZO_DOJOB(Hierarchy);
/* CHECK start */
BOZO_check_integer(i_h_type, 4)
BOZO_check_integer(i_h_layer_index, 6)
BOZO_check_integer(i_h_embedded_layer, 6)
BOZO_check_integer(i_h_priority, 6)
/* CHECK end */
BOZO_CLEAN();
/* END start */
BOZO_end_integer(i_h_priority, 6)
BOZO_end_integer(i_h_embedded_layer, 6)
BOZO_end_integer(i_h_layer_index, 6)
BOZO_end_integer(i_h_type, 4)
/* END end */
BOZO_END(hierarchy);
return i_err;
}
/* registration */
int main_registration()
{
BOZO_VARS(registration);
BOZO_START(registration);
/* BEGIN start */
s_decoded.i_additional_length = 0;
BOZO_begin_integer(i_format_identifier, 32)
/* BEGIN end */
BOZO_DOJOB(Registration);
/* CHECK start */
BOZO_check_integer32(i_format_identifier, 32)
/* CHECK end */
BOZO_CLEAN();
/* END start */
BOZO_end_integer32(i_format_identifier, 32)
/* END end */
BOZO_END(registration);
return i_err;
}
/* data stream alignment */
int main_ds_alignment()
{
BOZO_VARS(ds_alignment);
BOZO_START(data stream alignment);
/* BEGIN start */
BOZO_begin_integer(i_alignment_type, 8)
/* BEGIN end */
BOZO_DOJOB(DSAlignment);
/* CHECK start */
BOZO_check_integer(i_alignment_type, 8)
/* CHECK end */
BOZO_CLEAN();
/* END start */
BOZO_end_integer(i_alignment_type, 8)
/* END end */
BOZO_END(data stream alignment);
return i_err;
}
/* target background grid */
int main_target_bg_grid()
{
BOZO_VARS(target_bg_grid);
BOZO_START(target background grid);
/* BEGIN start */
BOZO_begin_integer(i_horizontal_size, 14)
BOZO_begin_integer(i_vertical_size, 14)
BOZO_begin_integer(i_pel_aspect_ratio, 4)
/* BEGIN end */
BOZO_DOJOB(TargetBgGrid);
/* CHECK start */
BOZO_check_integer(i_horizontal_size, 14)
BOZO_check_integer(i_vertical_size, 14)
BOZO_check_integer(i_pel_aspect_ratio, 4)
/* CHECK end */
BOZO_CLEAN();
/* END start */
BOZO_end_integer(i_pel_aspect_ratio, 4)
BOZO_end_integer(i_vertical_size, 14)
BOZO_end_integer(i_horizontal_size, 14)
/* END end */
BOZO_END(target background grid);
return i_err;
}
/* video window */
int main_vwindow()
{
BOZO_VARS(vwindow);
BOZO_START(video window);
/* BEGIN start */
BOZO_begin_integer(i_horizontal_offset, 14)
BOZO_begin_integer(i_vertical_offset, 14)
BOZO_begin_integer(i_window_priority, 4)
/* BEGIN end */
BOZO_DOJOB(VWindow);
/* CHECK start */
BOZO_check_integer(i_horizontal_offset, 14)
BOZO_check_integer(i_vertical_offset, 14)
BOZO_check_integer(i_window_priority, 4)
/* CHECK end */
BOZO_CLEAN();
/* END start */
BOZO_end_integer(i_window_priority, 4)
BOZO_end_integer(i_vertical_offset, 14)
BOZO_end_integer(i_horizontal_offset, 14)
/* END end */
BOZO_END(video window);
return i_err;
}
/* conditional access */
int main_ca()
{
BOZO_VARS(ca);
BOZO_START(conditional access);
/* BEGIN start */
s_decoded.i_private_length = 0;
BOZO_begin_integer(i_ca_system_id, 16)
BOZO_begin_integer(i_ca_pid, 13)
/* BEGIN end */
BOZO_DOJOB(CA);
/* CHECK start */
BOZO_check_integer(i_ca_system_id, 16)
BOZO_check_integer(i_ca_pid, 13)
/* CHECK end */
BOZO_CLEAN();
/* END start */
BOZO_end_integer(i_ca_pid, 13)
BOZO_end_integer(i_ca_system_id, 16)
/* END end */
BOZO_END(conditional access);
return i_err;
}
/* ISO 639 language */
int main_iso639()
{
BOZO_VARS(iso639);
BOZO_START(ISO 639 language);
/* BEGIN start */
s_decoded.i_code_count = 0;
BOZO_begin_integer(i_audio_type, 8)
/* BEGIN end */
BOZO_DOJOB(ISO639);
/* CHECK start */
BOZO_check_integer(i_audio_type, 8)
/* CHECK end */
BOZO_CLEAN();
/* END start */
BOZO_end_integer(i_audio_type, 8)
/* END end */
BOZO_END(ISO 639 language);
return i_err;
}
/* main function */
int main()
{
int i_err = 0;
i_err |= main_vstream();
i_err |= main_astream();
i_err |= main_hierarchy();
i_err |= main_registration();
i_err |= main_ds_alignment();
i_err |= main_target_bg_grid();
i_err |= main_vwindow();
i_err |= main_ca();
i_err |= main_iso639();
return i_err;
}
/*****************************************************************************
* test_dr.h
* (c)2001-2002 VideoLAN
* $Id: test_dr.h,v 1.1 2002/05/09 17:00:03 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.
*
*****************************************************************************/
#define BOZO_VARS(sname) \
int i_err = 0; \
long long unsigned int i_loop_count = 0; \
dvbpsi_##sname##_dr_t s_decoded, *p_new_decoded; \
dvbpsi_descriptor_t * p_descriptor;
#define BOZO_CLEAN() \
dvbpsi_DeleteDescriptors(p_descriptor);
#define BOZO_DOJOB(fname) \
if(!(i_loop_count & 0xffff)) \
fprintf(stdout, "\r iteration count: %22llu [%llu]", \
i_loop_count, (uint64_t)(-1)); \
i_loop_count++; \
p_descriptor = dvbpsi_Gen##fname##Dr(&s_decoded, 0); \
p_new_decoded = dvbpsi_Decode##fname##Dr(p_descriptor);
#define BOZO_START(name) \
fprintf(stdout, "\"%s\" descriptor check:\n", #name);
#define BOZO_END(name) \
fprintf(stdout, "\r iteration count: %22llu [%llu]\n", \
i_loop_count, (uint64_t)(-1)); \
if(i_err) \
fprintf(stderr, "\"%s\" descriptor check FAILED\n\n", #name); \
else \
fprintf(stdout, "\"%s\" descriptor check succeeded\n\n", #name);
/* integer */