* ALL: added the src/descriptors directory.

  * src/descriptor.h, src/descriptor.c: added a p_decoded field to the
    dvbpsi_descriptor_s structure and added an 's' to the
    dvbpsi_DeleteDescriptors function.
  * src/tables/pmt.c: added 's' where needed.
  * src/tables/pat.h: typo in the documentation.
  * src/descriptors/dr_02.h, src/descriptors/dr_02.c: MPEG2 "video
    stream" descriptor decoder and generator (not tested).
parent 6dd28f04
...@@ -5507,7 +5507,7 @@ done ...@@ -5507,7 +5507,7 @@ done
ac_given_srcdir=$srcdir ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL" ac_given_INSTALL="$INSTALL"
trap 'rm -fr `echo "Makefile src/Makefile src/tables/Makefile examples/Makefile misc/Makefile doc/Makefile debian/Makefile src/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 trap 'rm -fr `echo "Makefile src/Makefile src/tables/Makefile src/descriptors/Makefile examples/Makefile misc/Makefile doc/Makefile debian/Makefile src/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF EOF
cat >> $CONFIG_STATUS <<EOF cat >> $CONFIG_STATUS <<EOF
...@@ -5610,7 +5610,7 @@ EOF ...@@ -5610,7 +5610,7 @@ EOF
cat >> $CONFIG_STATUS <<EOF cat >> $CONFIG_STATUS <<EOF
CONFIG_FILES=\${CONFIG_FILES-"Makefile src/Makefile src/tables/Makefile examples/Makefile misc/Makefile doc/Makefile debian/Makefile"} CONFIG_FILES=\${CONFIG_FILES-"Makefile src/Makefile src/tables/Makefile src/descriptors/Makefile examples/Makefile misc/Makefile doc/Makefile debian/Makefile"}
EOF EOF
cat >> $CONFIG_STATUS <<\EOF cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
......
...@@ -42,7 +42,7 @@ else ...@@ -42,7 +42,7 @@ else
fi fi
AC_OUTPUT([Makefile src/Makefile src/tables/Makefile examples/Makefile misc/Makefile doc/Makefile debian/Makefile]) AC_OUTPUT([Makefile src/Makefile src/tables/Makefile src/descriptors/Makefile examples/Makefile misc/Makefile doc/Makefile debian/Makefile])
echo " echo "
libdvbpsi configuration libdvbpsi configuration
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
pkgincludedir = $(includedir)/dvbpsi pkgincludedir = $(includedir)/dvbpsi
SUBDIRS = tables SUBDIRS = tables descriptors
lib_LTLIBRARIES = libdvbpsi.la lib_LTLIBRARIES = libdvbpsi.la
libdvbpsi_la_SOURCES = dvbpsi.c psi.c descriptor.c libdvbpsi_la_SOURCES = dvbpsi.c psi.c descriptor.c
libdvbpsi_la_LIBADD = tables/lib_tables.la libdvbpsi_la_LIBADD = tables/lib_tables.la descriptors/lib_descriptors.la
libdvbpsi_la_LDFLAGS = -version-info 0:1:0 libdvbpsi_la_LDFLAGS = -version-info 0:1:0
noinst_HEADERS = dvbpsi_private.h noinst_HEADERS = dvbpsi_private.h
......
...@@ -75,12 +75,12 @@ VERSION = @VERSION@ ...@@ -75,12 +75,12 @@ VERSION = @VERSION@
pkgincludedir = $(includedir)/dvbpsi pkgincludedir = $(includedir)/dvbpsi
SUBDIRS = tables SUBDIRS = tables descriptors
lib_LTLIBRARIES = libdvbpsi.la lib_LTLIBRARIES = libdvbpsi.la
libdvbpsi_la_SOURCES = dvbpsi.c psi.c descriptor.c libdvbpsi_la_SOURCES = dvbpsi.c psi.c descriptor.c
libdvbpsi_la_LIBADD = tables/lib_tables.la libdvbpsi_la_LIBADD = tables/lib_tables.la descriptors/lib_descriptors.la
libdvbpsi_la_LDFLAGS = -version-info 0:1:0 libdvbpsi_la_LDFLAGS = -version-info 0:1:0
noinst_HEADERS = dvbpsi_private.h noinst_HEADERS = dvbpsi_private.h
...@@ -95,7 +95,8 @@ DEFS = @DEFS@ -I. -I$(srcdir) -I. ...@@ -95,7 +95,8 @@ DEFS = @DEFS@ -I. -I$(srcdir) -I.
CPPFLAGS = @CPPFLAGS@ CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBS = @LIBS@ LIBS = @LIBS@
libdvbpsi_la_DEPENDENCIES = tables/lib_tables.la libdvbpsi_la_DEPENDENCIES = tables/lib_tables.la \
descriptors/lib_descriptors.la
libdvbpsi_la_OBJECTS = dvbpsi.lo psi.lo descriptor.lo libdvbpsi_la_OBJECTS = dvbpsi.lo psi.lo descriptor.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)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* descriptor.c: descriptors functions * descriptor.c: descriptors functions
*---------------------------------------------------------------------------- *----------------------------------------------------------------------------
* (c)2001-2002 VideoLAN * (c)2001-2002 VideoLAN
* $Id: descriptor.c,v 1.3 2002/01/09 11:22:26 bozo Exp $ * $Id: descriptor.c,v 1.4 2002/05/08 13:00:40 bozo Exp $
* *
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* *
...@@ -54,6 +54,7 @@ dvbpsi_descriptor_t* dvbpsi_NewDescriptor(uint8_t i_tag, uint8_t i_length, ...@@ -54,6 +54,7 @@ dvbpsi_descriptor_t* dvbpsi_NewDescriptor(uint8_t i_tag, uint8_t i_length,
p_descriptor->i_tag = i_tag; p_descriptor->i_tag = i_tag;
p_descriptor->i_length = i_length; p_descriptor->i_length = i_length;
memcpy(p_descriptor->p_data, p_data, i_length); memcpy(p_descriptor->p_data, p_data, i_length);
p_descriptor->p_decoded = NULL;
p_descriptor->p_next = NULL; p_descriptor->p_next = NULL;
} }
else else
...@@ -68,11 +69,11 @@ dvbpsi_descriptor_t* dvbpsi_NewDescriptor(uint8_t i_tag, uint8_t i_length, ...@@ -68,11 +69,11 @@ dvbpsi_descriptor_t* dvbpsi_NewDescriptor(uint8_t i_tag, uint8_t i_length,
/***************************************************************************** /*****************************************************************************
* dvbpsi_DeleteDescriptor * dvbpsi_DeleteDescriptors
***************************************************************************** *****************************************************************************
* Destruction of a dvbpsi_descriptor_t structure. * Destruction of a dvbpsi_descriptor_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DeleteDescriptor(dvbpsi_descriptor_t* p_descriptor) void dvbpsi_DeleteDescriptors(dvbpsi_descriptor_t* p_descriptor)
{ {
while(p_descriptor != NULL) while(p_descriptor != NULL)
{ {
...@@ -81,6 +82,9 @@ void dvbpsi_DeleteDescriptor(dvbpsi_descriptor_t* p_descriptor) ...@@ -81,6 +82,9 @@ void dvbpsi_DeleteDescriptor(dvbpsi_descriptor_t* p_descriptor)
if(p_descriptor->p_data != NULL) if(p_descriptor->p_data != NULL)
free(p_descriptor->p_data); free(p_descriptor->p_data);
if(p_descriptor->p_decoded != NULL)
free(p_descriptor->p_decoded);
free(p_descriptor); free(p_descriptor);
p_descriptor = p_next; p_descriptor = p_next;
} }
......
/***************************************************************************** /*****************************************************************************
* descriptor.h * descriptor.h
* (c)2001-2002 VideoLAN * (c)2001-2002 VideoLAN
* $Id: descriptor.h,v 1.4 2002/03/27 20:02:43 bozo Exp $ * $Id: descriptor.h,v 1.5 2002/05/08 13:00:40 bozo Exp $
* *
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* *
...@@ -61,6 +61,8 @@ typedef struct dvbpsi_descriptor_s ...@@ -61,6 +61,8 @@ typedef struct dvbpsi_descriptor_s
struct dvbpsi_descriptor_s * p_next; /*!< next element of struct dvbpsi_descriptor_s * p_next; /*!< next element of
the list */ the list */
void * p_decoded; /*!< decoded descriptor */
} dvbpsi_descriptor_t; } dvbpsi_descriptor_t;
...@@ -82,15 +84,15 @@ dvbpsi_descriptor_t* dvbpsi_NewDescriptor(uint8_t i_tag, uint8_t i_length, ...@@ -82,15 +84,15 @@ dvbpsi_descriptor_t* dvbpsi_NewDescriptor(uint8_t i_tag, uint8_t i_length,
/***************************************************************************** /*****************************************************************************
* dvbpsi_DeleteDescriptor * dvbpsi_DeleteDescriptors
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_DeleteDescriptor(dvbpsi_descriptor_t* p_descriptor) * \fn void dvbpsi_DeleteDescriptors(dvbpsi_descriptor_t* p_descriptor)
* \brief Destruction of a dvbpsi_descriptor_t structure. * \brief Destruction of a dvbpsi_descriptor_t structure.
* \param p_descriptor pointer to the descriptor * \param p_descriptor pointer to the first descriptor structure
* \return nothing. * \return nothing.
*/ */
void dvbpsi_DeleteDescriptor(dvbpsi_descriptor_t* p_descriptor); void dvbpsi_DeleteDescriptors(dvbpsi_descriptor_t* p_descriptor);
#ifdef __cplusplus #ifdef __cplusplus
......
.deps
.libs
Makefile
*.lo
*.la
## Process this file with automake to produce Makefile.in
pkgincludedir = $(includedir)/dvbpsi
noinst_LTLIBRARIES = lib_descriptors.la
lib_descriptors_la_SOURCES = dr_02.c
pkginclude_HEADERS = dr_02.h
# Makefile.in generated automatically by automake 1.4-p4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
AS = @AS@
CC = @CC@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
EXEEXT = @EXEEXT@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
STRIP = @STRIP@
VERSION = @VERSION@
pkgincludedir = $(includedir)/dvbpsi
noinst_LTLIBRARIES = lib_descriptors.la
lib_descriptors_la_SOURCES = dr_02.c
pkginclude_HEADERS = dr_02.h
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../src/config.h
CONFIG_CLEAN_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
DEFS = @DEFS@ -I. -I$(srcdir) -I../../src
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
lib_descriptors_la_LDFLAGS =
lib_descriptors_la_LIBADD =
lib_descriptors_la_OBJECTS = dr_02.lo
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)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
HEADERS = $(pkginclude_HEADERS)
DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
DEP_FILES = .deps/dr_02.P
SOURCES = $(lib_descriptors_la_SOURCES)
OBJECTS = $(lib_descriptors_la_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .lo .o .obj .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu src/descriptors/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-noinstLTLIBRARIES:
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
distclean-noinstLTLIBRARIES:
maintainer-clean-noinstLTLIBRARIES:
# FIXME: We should only use cygpath when building on Windows,
# and only if it is available.
.c.obj:
$(COMPILE) -c `cygpath -w $<`
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
-rm -f *.$(OBJEXT)
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
.s.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.S.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
maintainer-clean-libtool:
lib_descriptors.la: $(lib_descriptors_la_OBJECTS) $(lib_descriptors_la_DEPENDENCIES)
$(LINK) $(lib_descriptors_la_LDFLAGS) $(lib_descriptors_la_OBJECTS) $(lib_descriptors_la_LIBADD) $(LIBS)
install-pkgincludeHEADERS: $(pkginclude_HEADERS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(pkgincludedir)
@list='$(pkginclude_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(pkgincludedir)/$$p"; \
$(INSTALL_DATA) $$d$$p $(DESTDIR)$(pkgincludedir)/$$p; \
done
uninstall-pkgincludeHEADERS:
@$(NORMAL_UNINSTALL)
list='$(pkginclude_HEADERS)'; for p in $$list; do \
rm -f $(DESTDIR)$(pkgincludedir)/$$p; \
done
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = src/descriptors
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/descriptors/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-include $(DEP_FILES)
mostlyclean-depend:
clean-depend:
distclean-depend:
-rm -rf .deps
maintainer-clean-depend:
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
%.lo: %.c
@echo '$(LTCOMPILE) -c $<'; \
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am:
install-exec: install-exec-am
install-data-am: install-pkgincludeHEADERS
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-pkgincludeHEADERS
uninstall: uninstall-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(pkgincludedir)
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-noinstLTLIBRARIES mostlyclean-compile \
mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-noinstLTLIBRARIES clean-compile clean-libtool \
clean-tags clean-depend clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-noinstLTLIBRARIES distclean-compile \
distclean-libtool distclean-tags distclean-depend \
distclean-generic clean-am
-rm -f libtool
distclean: distclean-am
maintainer-clean-am: maintainer-clean-noinstLTLIBRARIES \
maintainer-clean-compile maintainer-clean-libtool \
maintainer-clean-tags maintainer-clean-depend \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-noinstLTLIBRARIES distclean-noinstLTLIBRARIES \
clean-noinstLTLIBRARIES maintainer-clean-noinstLTLIBRARIES \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
clean-libtool maintainer-clean-libtool uninstall-pkgincludeHEADERS \
install-pkgincludeHEADERS tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir mostlyclean-depend \
distclean-depend clean-depend maintainer-clean-depend info-am info \
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
install-exec install-data-am install-data install-am install \
uninstall-am uninstall all-redirect all-am all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
# 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:
/*****************************************************************************
* dr_02.c
* (c)2001-2002 VideoLAN
* $Id: dr_02.c,v 1.1 2002/05/08 13:00:40 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 "../dvbpsi.h"
#include "../dvbpsi_private.h"
#include "../descriptor.h"
#include "dr_02.h"
/*****************************************************************************
* dvbpsi_DecodeVStreamDr
*****************************************************************************/
dvbpsi_vstream_dr_t * dvbpsi_DecodeVStreamDr(dvbpsi_descriptor_t * p_descriptor)
{
dvbpsi_vstream_dr_t * p_decoded;
/* Check the tag */
if(p_descriptor->i_tag != 0x02)
{
DVBPSI_ERROR_ARG("dr_02 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_vstream_dr_t*)malloc(sizeof(dvbpsi_vstream_dr_t));
if(!p_decoded)
{
DVBPSI_ERROR("dr_02 decoder", "out of memory");
return NULL;
}
/* Decode data and check the length */
p_decoded->b_mpeg2 = (p_descriptor->p_data[0] & 0x04) ? 1 : 0;
if( (!p_decoded->b_mpeg2 && (p_descriptor->i_length != 1))
|| (p_decoded->b_mpeg2 && (p_descriptor->i_length != 3)))
{
DVBPSI_ERROR_ARG("dr_02 decoder", "bad length (%d)",
p_descriptor->i_length);
free(p_decoded);
}
p_decoded->b_multiple_frame_rate = (p_descriptor->p_data[0] & 0x80) ? 1 : 0;
p_decoded->i_frame_rate_code = (p_descriptor->p_data[0] & 0x78) >> 3;
p_decoded->b_constrained_parameter = (p_descriptor->p_data[0] & 0x02) ? 1 : 0;
p_decoded->b_still_picture = (p_descriptor->p_data[0] & 0x01) ? 1 : 0;
if(p_decoded->b_mpeg2)
{
p_decoded->i_profile_level_indication = p_descriptor->p_data[1];
p_decoded->i_chroma_format = (p_descriptor->p_data[2] & 0xc0) >> 6;
p_decoded->b_frame_rate_extension =
(p_descriptor->p_data[2] & 0x20) ? 1 : 0;
}
p_descriptor->p_decoded = (void*)p_decoded;
return p_decoded;
}
/*****************************************************************************
* dvbpsi_GenVStreamDr
*****************************************************************************/
dvbpsi_descriptor_t * dvbpsi_GenVStreamDr(dvbpsi_vstream_dr_t * p_decoded,
int b_duplicate)
{
uint8_t data[3];
dvbpsi_descriptor_t * p_descriptor;
/* Encode data */
data[0] = 0;
if(p_decoded->b_multiple_frame_rate)
data[0] |= 0x80;
data[0] |= (p_decoded->i_frame_rate_code & 0x0f) << 3;
if(p_decoded->b_constrained_parameter)
data[0] |= 0x02;
if(p_decoded->b_still_picture)
data[0] |= 0x01;
if(p_decoded->b_mpeg2)
{
data[1] = p_decoded->i_profile_level_indication;
data[2] = 0x1f;
data[2] |= (p_decoded->i_chroma_format & 0x03) << 6;
if(p_decoded->b_frame_rate_extension)
data[2] |= 0x20;
}
/* Create the descriptor */
p_descriptor = dvbpsi_NewDescriptor(0x02, p_decoded->b_mpeg2 ? 3 : 1, data);
if(p_descriptor)
{
if(b_duplicate)
{
/* Duplicate decoded data */
dvbpsi_vstream_dr_t * p_dup_decoded =
(dvbpsi_vstream_dr_t*)malloc(sizeof(dvbpsi_vstream_dr_t));
if(p_dup_decoded)
memcpy(p_dup_decoded, p_decoded, sizeof(dvbpsi_vstream_dr_t));
p_descriptor->p_decoded = (void*)p_dup_decoded;
}
else
p_descriptor->p_decoded = NULL;
}
return p_descriptor;
}
/*****************************************************************************
* dr_02.h
* (c)2001-2002 VideoLAN
* $Id: dr_02.h,v 1.1 2002/05/08 13:00:40 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_02.h>
* \author Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* \brief Application interface for the MPEG 2 "video stream" descriptor
* decoder and generator.
*
* Application interface for the MPEG 2 "video stream" descriptor
* decoder and generator. This descriptor's definition can be found in
* ISO/IEC 13818-1 section 2.6.2.
*/
#ifndef _DVBPSI_DR_02_H_
#define _DVBPSI_DR_02_H_
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
* dvbpsi_vstream_dr_t
*****************************************************************************/
/*!
* \struct dvbpsi_vstream_dr_s
* \brief "video stream" descriptor structure.
*
* This structure is used to store a decoded "video stream" descriptor.
* (ISO/IEC 13818-1 section 2.6.2).
*/
/*!
* \typedef struct dvbpsi_vstream_dr_s dvbpsi_vstream_dr_t
* \brief dvbpsi_vstream_dr_t type definition.
*/
typedef struct dvbpsi_vstream_dr_s
{
int b_multiple_frame_rate; /*!< multiple_frame_rate_flag */
uint8_t i_frame_rate_code; /*!< frame_rate_code */
int b_mpeg2; /*!< MPEG_2_flag */
int b_constrained_parameter; /*!< constrained_parameter_flag */
int b_still_picture; /*!< still_picture_flag */
/* used if b_mpeg2 is true */
uint8_t i_profile_level_indication; /*!< profile_and_level_indication */
uint8_t i_chroma_format; /*!< chroma_format */
int b_frame_rate_extension; /*!< frame_rate_extension_flag */
} dvbpsi_vstream_dr_t;
/*****************************************************************************
* dvbpsi_DecodeVStreamDr
*****************************************************************************/
/*!
* \fn dvbpsi_vstream_dr_t * dvbpsi_DecodeVStreamDr(
* dvbpsi_descriptor_t * p_descriptor)
* \brief "video stream" descriptor decoder.
* \param p_descriptor pointer to the descriptor structure
* \return a pointer to a new "video stream" descriptor structure which
* contain the decoded data.
*/
dvbpsi_vstream_dr_t* dvbpsi_DecodeVStreamDr(dvbpsi_descriptor_t * p_descriptor);
/*****************************************************************************
* dvbpsi_GenVStreamDr
*****************************************************************************/
/*!
* \fn dvbpsi_descriptor_t * dvbpsi_GenVStreamDr(
* dvbpsi_vstream_dr_t * p_decoded, int b_duplicate)
* \brief "video stream" descriptor generator.
* \param p_decoded pointer to a decoded "video stream" 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 contain encoded data.
*/
dvbpsi_descriptor_t * dvbpsi_GenVStreamDr(dvbpsi_vstream_dr_t * p_decoded,
int b_duplicate);
#ifdef __cplusplus
};
#endif
#else
#error "Multiple inclusions of dr_02.h"
#endif
/***************************************************************************** /*****************************************************************************
* pat.h * pat.h
* (c)2001-2002 VideoLAN * (c)2001-2002 VideoLAN
* $Id: pat.h,v 1.4 2002/03/27 20:02:43 bozo Exp $ * $Id: pat.h,v 1.5 2002/05/08 13:00:40 bozo Exp $
* *
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* *
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
* \author Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * \author Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* \brief Application interface for the PAT decoder and the PAT generator. * \brief Application interface for the PAT decoder and the PAT generator.
* *
* Application interface for the PAT decoder decoder and the PAT generator. * Application interface for the PAT decoder and the PAT generator. New
* New decoded PAT tables are sent by callback to the application. If a table * decoded PAT tables are sent by callback to the application. If a table
* wasn't active (b_current_next == 0) and the next is the same but active * wasn't active (b_current_next == 0) and the next is the same but active
* (b_current_next == 1) then the program list is empty and should be * (b_current_next == 1) then the program list is empty and should be
* caught from the previous structure. * caught from the previous structure.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* pmt.c: PMT decoder/generator * pmt.c: PMT decoder/generator
*---------------------------------------------------------------------------- *----------------------------------------------------------------------------
* (c)2001-2002 VideoLAN * (c)2001-2002 VideoLAN
* $Id: pmt.c,v 1.3 2002/03/18 12:38:53 bozo Exp $ * $Id: pmt.c,v 1.4 2002/05/08 13:00:40 bozo Exp $
* *
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* *
...@@ -136,12 +136,12 @@ void dvbpsi_EmptyPMT(dvbpsi_pmt_t* p_pmt) ...@@ -136,12 +136,12 @@ void dvbpsi_EmptyPMT(dvbpsi_pmt_t* p_pmt)
{ {
dvbpsi_pmt_es_t* p_es = p_pmt->p_first_es; dvbpsi_pmt_es_t* p_es = p_pmt->p_first_es;
dvbpsi_DeleteDescriptor(p_pmt->p_first_descriptor); dvbpsi_DeleteDescriptors(p_pmt->p_first_descriptor);
while(p_es != NULL) while(p_es != NULL)
{ {
dvbpsi_pmt_es_t* p_tmp = p_es->p_next; dvbpsi_pmt_es_t* p_tmp = p_es->p_next;
dvbpsi_DeleteDescriptor(p_es->p_first_descriptor); dvbpsi_DeleteDescriptors(p_es->p_first_descriptor);
free(p_es); free(p_es);
p_es = p_tmp; p_es = p_tmp;
} }
......
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