diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2003-10-17 15:35:43 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2003-10-17 15:35:43 +0000 |
| commit | fc2f5b2cd655f1391f2abda1b39e37cdec98a951 (patch) | |
| tree | 312efcea86a319de407a7c314fb981fb1c71019a /lib/dvb_si | |
| download | enigma2-fc2f5b2cd655f1391f2abda1b39e37cdec98a951.tar.gz enigma2-fc2f5b2cd655f1391f2abda1b39e37cdec98a951.zip | |
Initial revision
Diffstat (limited to 'lib/dvb_si')
162 files changed, 9931 insertions, 0 deletions
diff --git a/lib/dvb_si/Makefile.am b/lib/dvb_si/Makefile.am new file mode 100644 index 00000000..ed710f89 --- /dev/null +++ b/lib/dvb_si/Makefile.am @@ -0,0 +1,36 @@ +INCLUDES = \ + -I$(top_srcdir)/include + +noinst_LIBRARIES = libenigma_dvb_si.a + +libenigma_dvb_si_a_SOURCES = ac3_descriptor.cpp ait.cpp \ + ancillary_data_descriptor.cpp announcement_support_descriptor.cpp \ + application_signalling_descriptor.cpp audio_stream_descriptor.cpp \ + bat.cpp bouquet_name_descriptor.cpp ca_descriptor.cpp \ + ca_identifier_descriptor.cpp ca_system_descriptor.cpp \ + cable_delivery_system_descriptor.cpp camt.cpp capmt.cpp cat.cpp \ + cell_frequency_link_descriptor.cpp cell_list_descriptor.cpp \ + component_descriptor.cpp container.cpp content_descriptor.cpp \ + country_availability_descriptor.cpp data_broadcast_descriptor.cpp \ + data_broadcast_id_descriptor.cpp descriptor.cpp eit.cpp \ + extended_event_descriptor.cpp frequency_list_descriptor.cpp \ + iso639_language_descriptor.cpp linkage_descriptor.cpp \ + local_time_offset_descriptor.cpp long_crc_table.cpp long_table.cpp \ + mosaic_descriptor.cpp multilingual_bouquet_name_descriptor.cpp \ + multilingual_component_descriptor.cpp \ + multilingual_network_name_descriptor.cpp \ + multilingual_service_name_descriptor.cpp \ + network_name_descriptor.cpp nit.cpp nvod_reference_descriptor.cpp \ + parental_rating_descriptor.cpp pat.cpp pdc_descriptor.cpp pmt.cpp \ + private_data_specifier_descriptor.cpp \ + satellite_delivery_system_descriptor.cpp sdt.cpp \ + service_descriptor.cpp service_list_descriptor.cpp \ + service_move_descriptor.cpp short_crc_table.cpp \ + short_event_descriptor.cpp short_table.cpp \ + stream_identifier_descriptor.cpp stuffing_descriptor.cpp \ + subtitling_descriptor.cpp target_background_grid_descriptor.cpp \ + tdt.cpp telephone_descriptor.cpp teletext_descriptor.cpp \ + terrestrial_delivery_system_descriptor.cpp \ + time_shifted_service_descriptor.cpp tot.cpp \ + vbi_data_descriptor.cpp vbi_teletext_descriptor.cpp \ + video_stream_descriptor.cpp video_window_descriptor.cpp diff --git a/lib/dvb_si/Makefile.in b/lib/dvb_si/Makefile.in new file mode 100644 index 00000000..e9ddcc77 --- /dev/null +++ b/lib/dvb_si/Makefile.in @@ -0,0 +1,508 @@ +# Makefile.in generated automatically by automake 1.5 from Makefile.am. + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# 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. + +@SET_MAKE@ + +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 +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +AMTAR = @AMTAR@ +AWK = @AWK@ +CATALOGS = @CATALOGS@ +CC = @CC@ +CONFIGDIR = @CONFIGDIR@ +CXX = @CXX@ +DATADIR = @DATADIR@ +DEPDIR = @DEPDIR@ +DRIVER = @DRIVER@ +DUMMYPOFILES = @DUMMYPOFILES@ +EXEEXT = @EXEEXT@ +FONTDIR = @FONTDIR@ +GAMESDIR = @GAMESDIR@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBDIR = @LIBDIR@ +MAINT = @MAINT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PKG_CONFIG = @PKG_CONFIG@ +PLUGINDIR = @PLUGINDIR@ +POFILES = @POFILES@ +RANLIB = @RANLIB@ +UCODEDIR = @UCODEDIR@ +UPDATEPOFILES = @UPDATEPOFILES@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +_LIBDIR = @_LIBDIR@ +am__include = @am__include@ +am__quote = @am__quote@ +install_sh = @install_sh@ +targetdatadir = @targetdatadir@ +targetlocalstatedir = @targetlocalstatedir@ +targetprefix = @targetprefix@ +targetsysconfdir = @targetsysconfdir@ + +INCLUDES = \ + -I$(top_srcdir)/include + + +noinst_LIBRARIES = libenigma_dvb_si.a + +libenigma_dvb_si_a_SOURCES = ac3_descriptor.cpp ait.cpp \ + ancillary_data_descriptor.cpp announcement_support_descriptor.cpp \ + application_signalling_descriptor.cpp audio_stream_descriptor.cpp \ + bat.cpp bouquet_name_descriptor.cpp ca_descriptor.cpp \ + ca_identifier_descriptor.cpp ca_system_descriptor.cpp \ + cable_delivery_system_descriptor.cpp camt.cpp capmt.cpp cat.cpp \ + cell_frequency_link_descriptor.cpp cell_list_descriptor.cpp \ + component_descriptor.cpp container.cpp content_descriptor.cpp \ + country_availability_descriptor.cpp data_broadcast_descriptor.cpp \ + data_broadcast_id_descriptor.cpp descriptor.cpp eit.cpp \ + extended_event_descriptor.cpp frequency_list_descriptor.cpp \ + iso639_language_descriptor.cpp linkage_descriptor.cpp \ + local_time_offset_descriptor.cpp long_crc_table.cpp long_table.cpp \ + mosaic_descriptor.cpp multilingual_bouquet_name_descriptor.cpp \ + multilingual_component_descriptor.cpp \ + multilingual_network_name_descriptor.cpp \ + multilingual_service_name_descriptor.cpp \ + network_name_descriptor.cpp nit.cpp nvod_reference_descriptor.cpp \ + parental_rating_descriptor.cpp pat.cpp pdc_descriptor.cpp pmt.cpp \ + private_data_specifier_descriptor.cpp \ + satellite_delivery_system_descriptor.cpp sdt.cpp \ + service_descriptor.cpp service_list_descriptor.cpp \ + service_move_descriptor.cpp short_crc_table.cpp \ + short_event_descriptor.cpp short_table.cpp \ + stream_identifier_descriptor.cpp stuffing_descriptor.cpp \ + subtitling_descriptor.cpp target_background_grid_descriptor.cpp \ + tdt.cpp telephone_descriptor.cpp teletext_descriptor.cpp \ + terrestrial_delivery_system_descriptor.cpp \ + time_shifted_service_descriptor.cpp tot.cpp \ + vbi_data_descriptor.cpp vbi_teletext_descriptor.cpp \ + video_stream_descriptor.cpp video_window_descriptor.cpp + +subdir = lib/dvb_si +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) + +libenigma_dvb_si_a_AR = $(AR) cru +libenigma_dvb_si_a_LIBADD = +am_libenigma_dvb_si_a_OBJECTS = ac3_descriptor.$(OBJEXT) ait.$(OBJEXT) \ + ancillary_data_descriptor.$(OBJEXT) \ + announcement_support_descriptor.$(OBJEXT) \ + application_signalling_descriptor.$(OBJEXT) \ + audio_stream_descriptor.$(OBJEXT) bat.$(OBJEXT) \ + bouquet_name_descriptor.$(OBJEXT) ca_descriptor.$(OBJEXT) \ + ca_identifier_descriptor.$(OBJEXT) \ + ca_system_descriptor.$(OBJEXT) \ + cable_delivery_system_descriptor.$(OBJEXT) camt.$(OBJEXT) \ + capmt.$(OBJEXT) cat.$(OBJEXT) \ + cell_frequency_link_descriptor.$(OBJEXT) \ + cell_list_descriptor.$(OBJEXT) component_descriptor.$(OBJEXT) \ + container.$(OBJEXT) content_descriptor.$(OBJEXT) \ + country_availability_descriptor.$(OBJEXT) \ + data_broadcast_descriptor.$(OBJEXT) \ + data_broadcast_id_descriptor.$(OBJEXT) descriptor.$(OBJEXT) \ + eit.$(OBJEXT) extended_event_descriptor.$(OBJEXT) \ + frequency_list_descriptor.$(OBJEXT) \ + iso639_language_descriptor.$(OBJEXT) \ + linkage_descriptor.$(OBJEXT) \ + local_time_offset_descriptor.$(OBJEXT) long_crc_table.$(OBJEXT) \ + long_table.$(OBJEXT) mosaic_descriptor.$(OBJEXT) \ + multilingual_bouquet_name_descriptor.$(OBJEXT) \ + multilingual_component_descriptor.$(OBJEXT) \ + multilingual_network_name_descriptor.$(OBJEXT) \ + multilingual_service_name_descriptor.$(OBJEXT) \ + network_name_descriptor.$(OBJEXT) nit.$(OBJEXT) \ + nvod_reference_descriptor.$(OBJEXT) \ + parental_rating_descriptor.$(OBJEXT) pat.$(OBJEXT) \ + pdc_descriptor.$(OBJEXT) pmt.$(OBJEXT) \ + private_data_specifier_descriptor.$(OBJEXT) \ + satellite_delivery_system_descriptor.$(OBJEXT) sdt.$(OBJEXT) \ + service_descriptor.$(OBJEXT) service_list_descriptor.$(OBJEXT) \ + service_move_descriptor.$(OBJEXT) short_crc_table.$(OBJEXT) \ + short_event_descriptor.$(OBJEXT) short_table.$(OBJEXT) \ + stream_identifier_descriptor.$(OBJEXT) \ + stuffing_descriptor.$(OBJEXT) subtitling_descriptor.$(OBJEXT) \ + target_background_grid_descriptor.$(OBJEXT) tdt.$(OBJEXT) \ + telephone_descriptor.$(OBJEXT) teletext_descriptor.$(OBJEXT) \ + terrestrial_delivery_system_descriptor.$(OBJEXT) \ + time_shifted_service_descriptor.$(OBJEXT) tot.$(OBJEXT) \ + vbi_data_descriptor.$(OBJEXT) vbi_teletext_descriptor.$(OBJEXT) \ + video_stream_descriptor.$(OBJEXT) \ + video_window_descriptor.$(OBJEXT) +libenigma_dvb_si_a_OBJECTS = $(am_libenigma_dvb_si_a_OBJECTS) + +DEFS = @DEFS@ +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/ac3_descriptor.Po $(DEPDIR)/ait.Po \ +@AMDEP_TRUE@ $(DEPDIR)/ancillary_data_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/announcement_support_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/application_signalling_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/audio_stream_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/bat.Po \ +@AMDEP_TRUE@ $(DEPDIR)/bouquet_name_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/ca_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/ca_identifier_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/ca_system_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/cable_delivery_system_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/camt.Po $(DEPDIR)/capmt.Po \ +@AMDEP_TRUE@ $(DEPDIR)/cat.Po \ +@AMDEP_TRUE@ $(DEPDIR)/cell_frequency_link_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/cell_list_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/component_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/container.Po \ +@AMDEP_TRUE@ $(DEPDIR)/content_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/country_availability_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/data_broadcast_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/data_broadcast_id_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/descriptor.Po $(DEPDIR)/eit.Po \ +@AMDEP_TRUE@ $(DEPDIR)/extended_event_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/frequency_list_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/iso639_language_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/linkage_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/local_time_offset_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/long_crc_table.Po $(DEPDIR)/long_table.Po \ +@AMDEP_TRUE@ $(DEPDIR)/mosaic_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/multilingual_bouquet_name_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/multilingual_component_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/multilingual_network_name_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/multilingual_service_name_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/network_name_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/nit.Po \ +@AMDEP_TRUE@ $(DEPDIR)/nvod_reference_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/parental_rating_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/pat.Po $(DEPDIR)/pdc_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/pmt.Po \ +@AMDEP_TRUE@ $(DEPDIR)/private_data_specifier_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/satellite_delivery_system_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/sdt.Po $(DEPDIR)/service_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/service_list_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/service_move_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/short_crc_table.Po \ +@AMDEP_TRUE@ $(DEPDIR)/short_event_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/short_table.Po \ +@AMDEP_TRUE@ $(DEPDIR)/stream_identifier_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/stuffing_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/subtitling_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/target_background_grid_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/tdt.Po $(DEPDIR)/telephone_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/teletext_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/terrestrial_delivery_system_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/time_shifted_service_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/tot.Po $(DEPDIR)/vbi_data_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/vbi_teletext_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/video_stream_descriptor.Po \ +@AMDEP_TRUE@ $(DEPDIR)/video_window_descriptor.Po +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +CXXFLAGS = @CXXFLAGS@ +DIST_SOURCES = $(libenigma_dvb_si_a_SOURCES) +DIST_COMMON = Makefile.am Makefile.in +SOURCES = $(libenigma_dvb_si_a_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu lib/dvb_si/Makefile +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status + +AR = ar + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libenigma_dvb_si.a: $(libenigma_dvb_si_a_OBJECTS) $(libenigma_dvb_si_a_DEPENDENCIES) + -rm -f libenigma_dvb_si.a + $(libenigma_dvb_si_a_AR) libenigma_dvb_si.a $(libenigma_dvb_si_a_OBJECTS) $(libenigma_dvb_si_a_LIBADD) + $(RANLIB) libenigma_dvb_si.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ac3_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ait.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ancillary_data_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/announcement_support_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/application_signalling_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/audio_stream_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/bat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/bouquet_name_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ca_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ca_identifier_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ca_system_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/cable_delivery_system_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/camt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/capmt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/cat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/cell_frequency_link_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/cell_list_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/component_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/container.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/content_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/country_availability_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/data_broadcast_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/data_broadcast_id_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/eit.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/extended_event_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/frequency_list_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/iso639_language_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/linkage_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/local_time_offset_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/long_crc_table.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/long_table.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/mosaic_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/multilingual_bouquet_name_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/multilingual_component_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/multilingual_network_name_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/multilingual_service_name_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/network_name_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/nit.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/nvod_reference_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/parental_rating_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pdc_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pmt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/private_data_specifier_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/satellite_delivery_system_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/sdt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/service_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/service_list_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/service_move_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/short_crc_table.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/short_event_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/short_table.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/stream_identifier_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/stuffing_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/subtitling_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/target_background_grid_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/tdt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/telephone_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/teletext_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/terrestrial_delivery_system_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/time_shifted_service_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/tot.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/vbi_data_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/vbi_teletext_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/video_stream_descriptor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/video_window_descriptor.Po@am__quote@ + +distclean-depend: + -rm -rf $(DEPDIR) + +.cpp.o: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CXXCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< + +.cpp.obj: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CXXCOMPILE) -c -o $@ `cygpath -w $<` +CXXDEPMODE = @CXXDEPMODE@ +uninstall-info-am: + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) + +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + $(mkinstalldirs) "$(distdir)/$$dir"; \ + fi; \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) + +installdirs: + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +uninstall-am: uninstall-info-am + +.PHONY: GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES distclean distclean-compile \ + distclean-depend distclean-generic distclean-tags distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic tags uninstall uninstall-am \ + uninstall-info-am + +# 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: diff --git a/lib/dvb_si/ac3_descriptor.cpp b/lib/dvb_si/ac3_descriptor.cpp new file mode 100644 index 00000000..ece1e794 --- /dev/null +++ b/lib/dvb_si/ac3_descriptor.cpp @@ -0,0 +1,102 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/ac3_descriptor.h> + +Ac3Descriptor::Ac3Descriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + if (buffer[1] >= 1) + { + ac3TypeFlag = (buffer[2] >> 7) & 0x01; + bsidFlag = (buffer[2] >> 6) & 0x01; + mainidFlag = (buffer[2] >> 5) & 0x01; + asvcFlag = (buffer[2] >> 4) & 0x01; + reserved = buffer[2] & 0x0F; + if (ac3TypeFlag == 1) + ac3Type = buffer[3]; + + if (bsidFlag == 1) + bsid = buffer[ac3TypeFlag + 3]; + + if (mainidFlag == 1) + mainid = buffer[ac3TypeFlag + mainidFlag + 3]; + + if (asvcFlag == 1) + avsc = buffer[ac3TypeFlag + bsidFlag + mainidFlag + 3]; + + if (descriptorLength > ac3TypeFlag + bsidFlag + mainidFlag + asvcFlag) + for (uint16_t i = 0; i < descriptorLength - ac3TypeFlag - bsidFlag - mainidFlag - asvcFlag - 1; ++i) + additionalInfo.push_back(buffer[ac3TypeFlag + bsidFlag + mainidFlag + asvcFlag + i + 3]); + } else + { + ac3TypeFlag = 0; + bsidFlag = 0; + mainidFlag = 0; + asvcFlag = 0; + reserved = 0; + } +} + +uint8_t Ac3Descriptor::getAc3TypeFlag(void) const +{ + return ac3TypeFlag; +} + +uint8_t Ac3Descriptor::getBsidFlag(void) const +{ + return bsidFlag; +} + +uint8_t Ac3Descriptor::getMainidFlag(void) const +{ + return mainidFlag; +} + +uint8_t Ac3Descriptor::getAsvcFlag(void) const +{ + return asvcFlag; +} + +uint8_t Ac3Descriptor::getAc3Type(void) const +{ + return ac3Type; +} + +uint8_t Ac3Descriptor::getBsid(void) const +{ + return bsid; +} + +uint8_t Ac3Descriptor::getMainid(void) const +{ + return mainid; +} + +uint8_t Ac3Descriptor::getAvsc(void) const +{ + return avsc; +} + +const AdditionalInfoVector *Ac3Descriptor::getAdditionalInfo(void) const +{ + return &additionalInfo; +} + diff --git a/lib/dvb_si/ac3_descriptor.h b/lib/dvb_si/ac3_descriptor.h new file mode 100644 index 00000000..39d316a8 --- /dev/null +++ b/lib/dvb_si/ac3_descriptor.h @@ -0,0 +1,59 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_ac3_descriptor_h__ +#define __dvb_descriptor_ac3_descriptor_h__ + +#include "descriptor.h" + +typedef std::vector<uint8_t> AdditionalInfoVector; +typedef AdditionalInfoVector::iterator AdditionalInfoIterator; +typedef AdditionalInfoVector::const_iterator AdditionalInfoConstIterator; + +class Ac3Descriptor : public Descriptor +{ + protected: + unsigned ac3TypeFlag : 1; + unsigned bsidFlag : 1; + unsigned mainidFlag : 1; + unsigned asvcFlag : 1; + unsigned reserved : 4; + unsigned ac3Type : 8; + unsigned bsid : 8; + unsigned mainid : 8; + unsigned avsc : 8; + AdditionalInfoVector additionalInfo; + + public: + Ac3Descriptor(const uint8_t * const buffer); + + uint8_t getAc3TypeFlag(void) const; + uint8_t getBsidFlag(void) const; + uint8_t getMainidFlag(void) const; + uint8_t getAsvcFlag(void) const; + uint8_t getAc3Type(void) const; + uint8_t getBsid(void) const; + uint8_t getMainid(void) const; + uint8_t getAvsc(void) const; + const AdditionalInfoVector *getAdditionalInfo(void) const; +}; + +#endif /* __dvb_descriptor_ac3_descriptor_h__ */ diff --git a/lib/dvb_si/ait.cpp b/lib/dvb_si/ait.cpp new file mode 100644 index 00000000..538becea --- /dev/null +++ b/lib/dvb_si/ait.cpp @@ -0,0 +1,94 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/ait.h> + +ApplicationIdentifier::ApplicationIdentifier(const uint8_t * const buffer) +{ + organisationId = (buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3]; + applicationId = (buffer[4] << 8) | buffer[5]; +} + +uint32_t ApplicationIdentifier::getOrganisationId(void) const +{ + return organisationId; +} + +uint16_t ApplicationIdentifier::getApplicationId(void) const +{ + return applicationId; +} + +ApplicationInformation::ApplicationInformation(const uint8_t * const buffer) +{ + applicationIdentifier = new ApplicationIdentifier(&buffer[0]); + applicationControlCode = buffer[6]; + reserved = (buffer[7] >> 4) & 0x0f; + applicationDescriptorsLoopLength = ((buffer[7] & 0x0f) << 8) | buffer[8]; + + for (uint16_t i = 0; i < applicationDescriptorsLoopLength; i += buffer[i + 10] + 2) + descriptor(&buffer[i + 9]); +} + +ApplicationInformation::~ApplicationInformation(void) +{ + delete applicationIdentifier; +} + +const ApplicationIdentifier *ApplicationInformation::getApplicationIdentifier(void) const +{ + return applicationIdentifier; +} + +uint8_t ApplicationInformation::getApplicationControlCode(void) const +{ + return applicationControlCode; +} + +ApplicationInformationTable::ApplicationInformationTable(const uint8_t * const buffer) : LongCrcTable(buffer) +{ + reserved4 = (buffer[8] >> 4) & 0x0f; + commonDescriptorsLength = ((buffer[8] & 0x0f) << 8) | buffer[9]; + + for (uint16_t i = 0; i < commonDescriptorsLength; i += buffer[i + 11] + 2) + descriptor(&buffer[i + 10]); + + reserved5 = (buffer[commonDescriptorsLength + 10] >> 4) & 0x0f; + applicationLoopLength = ((buffer[commonDescriptorsLength + 10] & 0x0f) << 8) | buffer[commonDescriptorsLength + 11]; + + for (uint16_t i = 0; i < applicationLoopLength; i += 9) { + ApplicationInformation *a = new ApplicationInformation(&buffer[commonDescriptorsLength + 12]); + applicationInformation.push_back(a); + i += a->applicationDescriptorsLoopLength; + } +} + +ApplicationInformationTable::~ApplicationInformationTable(void) +{ + for (ApplicationInformationIterator i = applicationInformation.begin(); i != applicationInformation.end(); ++i) + delete *i; +} + +const ApplicationInformationVector *ApplicationInformationTable::getApplicationInformation(void) const +{ + return &applicationInformation; +} + diff --git a/lib/dvb_si/ait.h b/lib/dvb_si/ait.h new file mode 100644 index 00000000..dd2123c2 --- /dev/null +++ b/lib/dvb_si/ait.h @@ -0,0 +1,86 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_table_ait_h__ +#define __dvb_table_ait_h__ + +#include <lib/dvb_si/container.h> +#include "long_crc_table.h" + +class ApplicationIdentifier +{ + protected: + unsigned organisationId : 32; + unsigned applicationId : 16; + + public: + ApplicationIdentifier(const uint8_t * const buffer); + + uint32_t getOrganisationId(void) const; + uint16_t getApplicationId(void) const; +}; + +class ApplicationInformation : public DescriptorContainer +{ + protected: + ApplicationIdentifier *applicationIdentifier; + unsigned applicationControlCode : 8; + unsigned reserved : 4; + unsigned applicationDescriptorsLoopLength : 12; + + public: + ApplicationInformation(const uint8_t * const buffer); + ~ApplicationInformation(void); + + const ApplicationIdentifier *getApplicationIdentifier(void) const; + uint8_t getApplicationControlCode(void) const; + + friend class ApplicationInformationTable; +}; + +typedef std::vector<ApplicationInformation *> ApplicationInformationVector; +typedef ApplicationInformationVector::iterator ApplicationInformationIterator; +typedef ApplicationInformationVector::const_iterator ApplicationInformationConstIterator; + +class ApplicationInformationTable : public LongCrcTable, public DescriptorContainer +{ + protected: + unsigned reserved4 : 4; + unsigned commonDescriptorsLength : 12; + unsigned reserved5 : 4; + unsigned applicationLoopLength : 12; + ApplicationInformationVector applicationInformation; + + public: + ApplicationInformationTable(const uint8_t * const buffer); + ~ApplicationInformationTable(void); + + static const enum TableId TID = TID_AIT; + static const uint32_t TIMEOUT = 12000; + + const ApplicationInformationVector *getApplicationInformation(void) const; +}; + +typedef std::vector<ApplicationInformationTable *> ApplicationInformationTableVector; +typedef ApplicationInformationTableVector::iterator ApplicationInformationTableIterator; +typedef ApplicationInformationTableVector::const_iterator ApplicationInformationTableConstIterator; + +#endif /* __dvb_table_ait_h__ */ diff --git a/lib/dvb_si/ancillary_data_descriptor.cpp b/lib/dvb_si/ancillary_data_descriptor.cpp new file mode 100644 index 00000000..13aaa92f --- /dev/null +++ b/lib/dvb_si/ancillary_data_descriptor.cpp @@ -0,0 +1,33 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/ancillary_data_descriptor.h> + +AncillaryDataDescriptor::AncillaryDataDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + ancillaryDataIdentifier = buffer[2]; +} + +uint8_t AncillaryDataDescriptor::getAncillaryDataIdentifier(void) const +{ + return ancillaryDataIdentifier; +} + diff --git a/lib/dvb_si/ancillary_data_descriptor.h b/lib/dvb_si/ancillary_data_descriptor.h new file mode 100644 index 00000000..1d29c09f --- /dev/null +++ b/lib/dvb_si/ancillary_data_descriptor.h @@ -0,0 +1,38 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_ancillary_data_descriptor_h__ +#define __dvb_descriptor_ancillary_data_descriptor_h__ + +#include "descriptor.h" + +class AncillaryDataDescriptor : public Descriptor +{ + protected: + unsigned ancillaryDataIdentifier : 8; + + public: + AncillaryDataDescriptor(const uint8_t * const buffer); + + uint8_t getAncillaryDataIdentifier(void) const; +}; + +#endif /* __dvb_descriptor_ancillary_data_descriptor_h__ */ diff --git a/lib/dvb_si/announcement_support_descriptor.cpp b/lib/dvb_si/announcement_support_descriptor.cpp new file mode 100644 index 00000000..53ec0f52 --- /dev/null +++ b/lib/dvb_si/announcement_support_descriptor.cpp @@ -0,0 +1,107 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/announcement_support_descriptor.h> + +Announcement::Announcement(const uint8_t * const buffer) +{ + announcementType = (buffer[0] >> 4) & 0x0f; + reserved = (buffer[0] >> 3) & 0x01; + referenceType = buffer[0] & 0x07; + + if ((referenceType >= 0x01) && (referenceType <= 0x03)) { + originalNetworkId = (buffer[1] << 8) | buffer[2]; + transportStreamId = (buffer[3] << 8) | buffer[4]; + serviceId = (buffer[5] << 8) | buffer[6]; + componentTag = buffer[7]; + } +} + +uint8_t Announcement::getAnnouncementType(void) const +{ + return announcementType; +} + +uint8_t Announcement::getReferenceType(void) const +{ + return referenceType; +} + +uint16_t Announcement::getOriginalNetworkId(void) const +{ + return originalNetworkId; +} + +uint16_t Announcement::getTransportStreamId(void) const +{ + return transportStreamId; +} + +uint16_t Announcement::getServiceId(void) const +{ + return serviceId; +} + +uint8_t Announcement::getComponentTag(void) const +{ + return componentTag; +} + +AnnouncementSupportDescriptor::AnnouncementSupportDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + Announcement *a; + + announcementSupportIndicator = (buffer[2] << 8) | buffer[3]; + + if (descriptorLength < 2) + return; + + for (uint16_t i = 0; i < descriptorLength - 2; ++i) { + a = new Announcement(&buffer[i + 4]); + announcements.push_back(a); + switch (a->getReferenceType()) { + case 0x01: + case 0x02: + case 0x03: + i += 7; + break; + default: + break; + } + } +} + +AnnouncementSupportDescriptor::~AnnouncementSupportDescriptor(void) +{ + for (AnnouncementIterator i = announcements.begin(); i != announcements.end(); ++i) + delete *i; +} + +uint16_t AnnouncementSupportDescriptor::getAnnouncementSupportIndicator(void) const +{ + return announcementSupportIndicator; +} + +const AnnouncementVector *AnnouncementSupportDescriptor::getAnnouncements(void) const +{ + return &announcements; +} + diff --git a/lib/dvb_si/announcement_support_descriptor.h b/lib/dvb_si/announcement_support_descriptor.h new file mode 100644 index 00000000..a0d02e73 --- /dev/null +++ b/lib/dvb_si/announcement_support_descriptor.h @@ -0,0 +1,67 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_announcement_support_descriptor_h__ +#define __dvb_descriptor_announcement_support_descriptor_h__ + +#include "descriptor.h" + +class Announcement +{ + protected: + unsigned announcementType : 4; + unsigned reserved : 1; + unsigned referenceType : 3; + unsigned originalNetworkId : 16; + unsigned transportStreamId : 16; + unsigned serviceId : 16; + unsigned componentTag : 8; + + public: + Announcement(const uint8_t * const buffer); + + uint8_t getAnnouncementType(void) const; + uint8_t getReferenceType(void) const; + uint16_t getOriginalNetworkId(void) const; + uint16_t getTransportStreamId(void) const; + uint16_t getServiceId(void) const; + uint8_t getComponentTag(void) const; +}; + +typedef std::vector<Announcement *> AnnouncementVector; +typedef AnnouncementVector::iterator AnnouncementIterator; +typedef AnnouncementVector::const_iterator AnnouncementConstIterator; + +class AnnouncementSupportDescriptor : public Descriptor +{ + protected: + unsigned announcementSupportIndicator : 16; + AnnouncementVector announcements; + + public: + AnnouncementSupportDescriptor(const uint8_t * const buffer); + ~AnnouncementSupportDescriptor(void); + + uint16_t getAnnouncementSupportIndicator(void) const; + const AnnouncementVector *getAnnouncements(void) const; +}; + +#endif /* __dvb_descriptor_announcement_support_descriptor_h__ */ diff --git a/lib/dvb_si/application_signalling_descriptor.cpp b/lib/dvb_si/application_signalling_descriptor.cpp new file mode 100644 index 00000000..d3c2f884 --- /dev/null +++ b/lib/dvb_si/application_signalling_descriptor.cpp @@ -0,0 +1,57 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/application_signalling_descriptor.h> + +ApplicationSignalling::ApplicationSignalling(const uint8_t * const buffer) +{ + applicationType = (buffer[0] << 8) | buffer[1]; + reserved = (buffer[2] >> 5) & 0x07; + aitVersionNumber = buffer[2] & 0x1f; +} + +uint16_t ApplicationSignalling::getApplicationType(void) const +{ + return applicationType; +} + +uint8_t ApplicationSignalling::getAitVersionNumber(void) const +{ + return aitVersionNumber; +} + +ApplicationSignallingDescriptor::ApplicationSignallingDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + for (uint16_t i = 0; i < descriptorLength; i += 3) + applicationSignallings.push_back(new ApplicationSignalling(&buffer[i + 2])); +} + +ApplicationSignallingDescriptor::~ApplicationSignallingDescriptor(void) +{ + for (ApplicationSignallingIterator i = applicationSignallings.begin(); i != applicationSignallings.end(); ++i) + delete *i; +} + +const ApplicationSignallingVector *ApplicationSignallingDescriptor::getApplicationSignallings(void) const +{ + return &applicationSignallings; +} + diff --git a/lib/dvb_si/application_signalling_descriptor.h b/lib/dvb_si/application_signalling_descriptor.h new file mode 100644 index 00000000..2638b7a1 --- /dev/null +++ b/lib/dvb_si/application_signalling_descriptor.h @@ -0,0 +1,57 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_application_signalling_descriptor_h__ +#define __dvb_descriptor_application_signalling_descriptor_h__ + +#include "descriptor.h" + +class ApplicationSignalling +{ + protected: + unsigned applicationType : 16; + unsigned reserved : 3; + unsigned aitVersionNumber : 5; + + public: + ApplicationSignalling(const uint8_t * const buffer); + + uint16_t getApplicationType(void) const; + uint8_t getAitVersionNumber(void) const; +}; + +typedef std::vector<ApplicationSignalling *> ApplicationSignallingVector; +typedef ApplicationSignallingVector::iterator ApplicationSignallingIterator; +typedef ApplicationSignallingVector::const_iterator ApplicationSignallingConstIterator; + +class ApplicationSignallingDescriptor : public Descriptor +{ + protected: + ApplicationSignallingVector applicationSignallings; + + public: + ApplicationSignallingDescriptor(const uint8_t * const buffer); + ~ApplicationSignallingDescriptor(void); + + const ApplicationSignallingVector *getApplicationSignallings(void) const; +}; + +#endif /* __dvb_descriptor_application_signalling_descriptor_h__ */ diff --git a/lib/dvb_si/audio_stream_descriptor.cpp b/lib/dvb_si/audio_stream_descriptor.cpp new file mode 100644 index 00000000..b3a70987 --- /dev/null +++ b/lib/dvb_si/audio_stream_descriptor.cpp @@ -0,0 +1,52 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/audio_stream_descriptor.h> + +AudioStreamDescriptor::AudioStreamDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + freeFormatFlag = (buffer[2] >> 7) & 0x01; + id = (buffer[2] >> 6) & 0x01; + layer = (buffer[2] >> 4) & 0x03; + variableRateAudioIndicator = (buffer[2] >> 3) & 0x01; + reserved = buffer[2] & 0x07; +} + +uint8_t AudioStreamDescriptor::getFreeFormatFlag(void) const +{ + return freeFormatFlag; +} + +uint8_t AudioStreamDescriptor::getId(void) const +{ + return id; +} + +uint8_t AudioStreamDescriptor::getLayer(void) const +{ + return layer; +} + +uint8_t AudioStreamDescriptor::getVariableRateAudioIndicator(void) const +{ + return variableRateAudioIndicator; +} + diff --git a/lib/dvb_si/audio_stream_descriptor.h b/lib/dvb_si/audio_stream_descriptor.h new file mode 100644 index 00000000..522b10fe --- /dev/null +++ b/lib/dvb_si/audio_stream_descriptor.h @@ -0,0 +1,45 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_audio_stream_descriptor_h__ +#define __dvb_descriptor_audio_stream_descriptor_h__ + +#include "descriptor.h" + +class AudioStreamDescriptor : public Descriptor +{ + protected: + unsigned freeFormatFlag : 1; + unsigned id : 1; + unsigned layer : 2; + unsigned variableRateAudioIndicator : 1; + unsigned reserved : 3; + + public: + AudioStreamDescriptor(const uint8_t * const buffer); + + uint8_t getFreeFormatFlag(void) const; + uint8_t getId(void) const; + uint8_t getLayer(void) const; + uint8_t getVariableRateAudioIndicator(void) const; +}; + +#endif /* __dvb_descriptor_audio_stream_descriptor_h__ */ diff --git a/lib/dvb_si/bat.cpp b/lib/dvb_si/bat.cpp new file mode 100644 index 00000000..7fe4f90a --- /dev/null +++ b/lib/dvb_si/bat.cpp @@ -0,0 +1,55 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/bat.h> + +BouquetAssociation::BouquetAssociation(const uint8_t * const buffer) +{ + transportStreamId = (buffer[0] << 8) | buffer[1]; + originalNetworkId = (buffer[2] << 8) | buffer[3]; + reserved = (buffer[4] >> 4) & 0x0f; + transportStreamLoopLength = ((buffer[4] & 0x0f) << 8) | buffer[5]; + + for (uint16_t i = 6; i < transportStreamLoopLength + 6; i += buffer[i + 1] + 2) + descriptor(&buffer[i]); +} + +BouquetAssociationTable::BouquetAssociationTable(const uint8_t * const buffer) : LongCrcTable(buffer) +{ + reserved4 = (buffer[8] >> 4) & 0x0f; + bouquetDescriptorsLength = ((buffer[8] & 0x0f) << 8) | buffer[9]; + + for (uint16_t i = 10; i < bouquetDescriptorsLength + 10; i += buffer[i + 1] + 2) + descriptor(&buffer[i]); + + reserved5 = (buffer[bouquetDescriptorsLength + 10] >> 4) & 0x0f; + transportStreamLoopLength = ((buffer[bouquetDescriptorsLength + 10] & 0x0f) << 8) | buffer[bouquetDescriptorsLength + 11]; + + for (uint16_t i = bouquetDescriptorsLength + 12; i < sectionLength - 1; i += ((buffer[i + 4] & 0x0f) | buffer[i + 5]) + 6) + bouquet.push_back(new BouquetAssociation(&buffer[i])); +} + +BouquetAssociationTable::~BouquetAssociationTable(void) +{ + for (BouquetAssociationIterator b = bouquet.begin(); b != bouquet.end(); ++b) + delete *b; +} + diff --git a/lib/dvb_si/bat.h b/lib/dvb_si/bat.h new file mode 100644 index 00000000..80b2a55c --- /dev/null +++ b/lib/dvb_si/bat.h @@ -0,0 +1,66 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_table_bat_h__ +#define __dvb_table_bat_h__ + +#include <lib/dvb_si/container.h> +#include "long_crc_table.h" + +class BouquetAssociation : public DescriptorContainer +{ + protected: + unsigned transportStreamId : 16; + unsigned originalNetworkId : 16; + unsigned reserved : 4; + unsigned transportStreamLoopLength : 12; + + public: + BouquetAssociation(const uint8_t * const buffer); +}; + +typedef std::vector<BouquetAssociation *> BouquetAssociationVector; +typedef BouquetAssociationVector::iterator BouquetAssociationIterator; +typedef BouquetAssociationVector::const_iterator BouquetAssociationConstIterator; + +class BouquetAssociationTable : public LongCrcTable , public DescriptorContainer +{ + protected: + unsigned reserved4 : 4; + unsigned bouquetDescriptorsLength : 12; + unsigned reserved5 : 4; + unsigned transportStreamLoopLength : 12; + BouquetAssociationVector bouquet; + + public: + BouquetAssociationTable(const uint8_t * const buffer); + ~BouquetAssociationTable(void); + + static const enum PacketId PID = PID_BAT; + static const enum TableId TID = TID_BAT; + static const uint32_t TIMEOUT = 12000; +}; + +typedef std::vector<BouquetAssociationTable *> BouquetAssociationTableVector; +typedef BouquetAssociationTableVector::iterator BouquetAssociationTableIterator; +typedef BouquetAssociationTableVector::const_iterator BouquetAssociationTableConstIterator; + +#endif /* __dvb_table_bat_h__ */ diff --git a/lib/dvb_si/bouquet_name_descriptor.cpp b/lib/dvb_si/bouquet_name_descriptor.cpp new file mode 100644 index 00000000..ca7f10f3 --- /dev/null +++ b/lib/dvb_si/bouquet_name_descriptor.cpp @@ -0,0 +1,33 @@ +/* + * $Id$ + * + * (C) 2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/bouquet_name_descriptor.h> + +BouquetNameDescriptor::BouquetNameDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + bouquetName.assign((char *)&buffer[2], descriptorLength); +} + +std::string BouquetNameDescriptor::getBouquetName(void) const +{ + return bouquetName; +} + diff --git a/lib/dvb_si/bouquet_name_descriptor.h b/lib/dvb_si/bouquet_name_descriptor.h new file mode 100644 index 00000000..20184b6c --- /dev/null +++ b/lib/dvb_si/bouquet_name_descriptor.h @@ -0,0 +1,39 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_bouquet_name_descriptor_h__ +#define __dvb_descriptor_bouquet_name_descriptor_h__ + +#include "descriptor.h" + +class BouquetNameDescriptor : public Descriptor +{ + protected: + std::string bouquetName; + + public: + BouquetNameDescriptor(const uint8_t * const buffer); + ~BouquetNameDescriptor(void); + + std::string getBouquetName(void) const; +}; + +#endif /* __dvb_descriptor_bouquet_name_descriptor_h__ */ diff --git a/lib/dvb_si/ca_descriptor.cpp b/lib/dvb_si/ca_descriptor.cpp new file mode 100644 index 00000000..78330587 --- /dev/null +++ b/lib/dvb_si/ca_descriptor.cpp @@ -0,0 +1,50 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/ca_descriptor.h> + +CaDescriptor::CaDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + caSystemId = (buffer[2] << 8) | buffer[3]; + reserved = buffer[4] >> 5; + caPid = ((buffer[4] & 0x1F) << 8) | buffer[5]; + + if (descriptorLength < 4) + return; + for (uint16_t i = 0; i < descriptorLength - 4; ++i) + privateDataBytes.push_back(buffer[i + 6]); +} + +uint16_t CaDescriptor::getCaSystemId(void) const +{ + return caSystemId; +} + +uint16_t CaDescriptor::getCaPid(void) const +{ + return caPid; +} + +const PrivateDataByteVector *CaDescriptor::getPrivateDataBytes(void) const +{ + return &privateDataBytes; +} + diff --git a/lib/dvb_si/ca_descriptor.h b/lib/dvb_si/ca_descriptor.h new file mode 100644 index 00000000..194b7f42 --- /dev/null +++ b/lib/dvb_si/ca_descriptor.h @@ -0,0 +1,51 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_ca_descriptor_h__ +#define __dvb_descriptor_ca_descriptor_h__ + +#include "descriptor.h" + +typedef std::vector<uint8_t> PrivateDataByteVector; +typedef PrivateDataByteVector::iterator PrivateDataByteIterator; +typedef PrivateDataByteVector::const_iterator PrivateDataByteConstIterator; + +class CaDescriptor : public Descriptor +{ + protected: + unsigned caSystemId : 16; + unsigned reserved : 3; + unsigned caPid : 13; + PrivateDataByteVector privateDataBytes; + + public: + CaDescriptor(const uint8_t * const buffer); + + uint16_t getCaSystemId(void) const; + uint16_t getCaPid(void) const; + const PrivateDataByteVector *getPrivateDataBytes(void) const; +}; + +typedef std::vector<CaDescriptor *> CaDescriptorVector; +typedef CaDescriptorVector::iterator CaDescriptorIterator; +typedef CaDescriptorVector::const_iterator CaDescriptorConstIterator; + +#endif /* __dvb_descriptor_ca_descriptor_h__ */ diff --git a/lib/dvb_si/ca_identifier_descriptor.cpp b/lib/dvb_si/ca_identifier_descriptor.cpp new file mode 100644 index 00000000..89b1360b --- /dev/null +++ b/lib/dvb_si/ca_identifier_descriptor.cpp @@ -0,0 +1,34 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/ca_identifier_descriptor.h> + +CaIdentifierDescriptor::CaIdentifierDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + for (uint16_t i = 0; i < descriptorLength; i += 2) + caSystemIds.push_back((buffer[i + 2] << 8) | buffer[i + 3]); +} + +const CaSystemIdVector *CaIdentifierDescriptor::getCaSystemIds(void) const +{ + return &caSystemIds; +} + diff --git a/lib/dvb_si/ca_identifier_descriptor.h b/lib/dvb_si/ca_identifier_descriptor.h new file mode 100644 index 00000000..84f28933 --- /dev/null +++ b/lib/dvb_si/ca_identifier_descriptor.h @@ -0,0 +1,42 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_ca_identifier_descriptor_h__ +#define __dvb_descriptor_ca_identifier_descriptor_h__ + +#include "descriptor.h" + +typedef std::vector<uint16_t> CaSystemIdVector; +typedef CaSystemIdVector::iterator CaSystemIdIterator; +typedef CaSystemIdVector::const_iterator CaSystemIdConstIterator; + +class CaIdentifierDescriptor : public Descriptor +{ + protected: + CaSystemIdVector caSystemIds; + + public: + CaIdentifierDescriptor(const uint8_t * const buffer); + + const CaSystemIdVector *getCaSystemIds(void) const; +}; + +#endif /* __dvb_descriptor_ca_identifier_descriptor_h__ */ diff --git a/lib/dvb_si/ca_system_descriptor.cpp b/lib/dvb_si/ca_system_descriptor.cpp new file mode 100644 index 00000000..1d8c5624 --- /dev/null +++ b/lib/dvb_si/ca_system_descriptor.cpp @@ -0,0 +1,33 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/ca_system_descriptor.h> + +CaSystemDescriptor::CaSystemDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + scramblingCode = buffer[2]; +} + +uint8_t CaSystemDescriptor::getScramblingCode(void) const +{ + return scramblingCode; +} + diff --git a/lib/dvb_si/ca_system_descriptor.h b/lib/dvb_si/ca_system_descriptor.h new file mode 100644 index 00000000..8c04c26e --- /dev/null +++ b/lib/dvb_si/ca_system_descriptor.h @@ -0,0 +1,38 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_ca_system_descriptor_h__ +#define __dvb_descriptor_ca_system_descriptor_h__ + +#include "descriptor.h" + +class CaSystemDescriptor : public Descriptor +{ + protected: + unsigned scramblingCode : 8; + + public: + CaSystemDescriptor(const uint8_t * const buffer); + + uint8_t getScramblingCode(void) const; +}; + +#endif /* __dvb_descriptor_ca_system_descriptor_h__ */ diff --git a/lib/dvb_si/cable_delivery_system_descriptor.cpp b/lib/dvb_si/cable_delivery_system_descriptor.cpp new file mode 100644 index 00000000..7dcef3f8 --- /dev/null +++ b/lib/dvb_si/cable_delivery_system_descriptor.cpp @@ -0,0 +1,80 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/cable_delivery_system_descriptor.h> + +CableDeliverySystemDescriptor::CableDeliverySystemDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + frequency = + ( + ((buffer[2] >> 4) * 10000000) + + ((buffer[2] & 0x0F) * 1000000) + + ((buffer[3] >> 4) * 100000) + + ((buffer[3] & 0x0F) * 10000) + + ((buffer[4] >> 4) * 1000) + + ((buffer[4] & 0x0F) * 100) + + ((buffer[5] >> 4) * 10) + + ((buffer[5] & 0x0F) * 1) + ); + + reserved = (buffer[6] << 4) | ((buffer[7] >> 4) & 0x0F); + fecOuter = buffer[7] & 0x0F; + modulation = buffer[8]; + + symbolRate = + ( + ((buffer[9] >> 4) * 1000000) + + ((buffer[9] & 0x0F) * 100000) + + ((buffer[10] >> 4) * 10000) + + ((buffer[10] & 0x0F) * 1000) + + ((buffer[11] >> 4) * 100) + + ((buffer[11] & 0x0F) * 10) + + ((buffer[12] >> 4) * 1) + ); + + fecInner = buffer[12] & 0x0F; +} + +uint32_t CableDeliverySystemDescriptor::getFrequency(void) const +{ + return frequency; +} + +uint8_t CableDeliverySystemDescriptor::getFecOuter(void) const +{ + return fecOuter; +} + +uint8_t CableDeliverySystemDescriptor::getModulation(void) const +{ + return modulation; +} + +uint32_t CableDeliverySystemDescriptor::getSymbolRate(void) const +{ + return symbolRate; +} + +uint8_t CableDeliverySystemDescriptor::getFecInner(void) const +{ + return fecInner; +} + diff --git a/lib/dvb_si/cable_delivery_system_descriptor.h b/lib/dvb_si/cable_delivery_system_descriptor.h new file mode 100644 index 00000000..c6d6a7b8 --- /dev/null +++ b/lib/dvb_si/cable_delivery_system_descriptor.h @@ -0,0 +1,47 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_cable_delivery_system_descriptor_h__ +#define __dvb_descriptor_cable_delivery_system_descriptor_h__ + +#include "descriptor.h" + +class CableDeliverySystemDescriptor : public Descriptor +{ + protected: + unsigned frequency : 32; + unsigned reserved : 12; + unsigned fecOuter : 4; + unsigned modulation : 8; + unsigned symbolRate : 28; + unsigned fecInner : 4; + + public: + CableDeliverySystemDescriptor(const uint8_t * const buffer); + + uint32_t getFrequency(void) const; + uint8_t getFecOuter(void) const; + uint8_t getModulation(void) const; + uint32_t getSymbolRate(void) const; + uint8_t getFecInner(void) const; +}; + +#endif /* __dvb_descriptor_cable_delivery_system_descriptor_h__ */ diff --git a/lib/dvb_si/camt.cpp b/lib/dvb_si/camt.cpp new file mode 100644 index 00000000..5913cbd3 --- /dev/null +++ b/lib/dvb_si/camt.cpp @@ -0,0 +1,29 @@ +/* + * $Id$ + * + * (C) 2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/camt.h> + +ConditionalAccessMessageTable::ConditionalAccessMessageTable(const uint8_t * const buffer) : ShortTable(buffer) +{ + for (uint16_t i = 8; i < sectionLength - 1; ++i) + caDataByte.push_back(buffer[i]); +} + diff --git a/lib/dvb_si/camt.h b/lib/dvb_si/camt.h new file mode 100644 index 00000000..4952789b --- /dev/null +++ b/lib/dvb_si/camt.h @@ -0,0 +1,43 @@ +/* + * $Id$ + * + * (C) 2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_table_camt_h__ +#define __dvb_table_camt_h__ + +#include "short_table.h" + +class ConditionalAccessMessageTable : public ShortTable +{ + protected: + std::vector<uint8_t> caDataByte; + + public: + ConditionalAccessMessageTable(const uint8_t * const buffer); + + static const uint16_t LENGTH = 256; + static const enum TableId TID = TID_CAMT_ECM_0; +}; + +typedef std::vector<ConditionalAccessMessageTable *> ConditionalAccessMessageTableVector; +typedef ConditionalAccessMessageTableVector::iterator ConditionalAccessMessageTableIterator; +typedef ConditionalAccessMessageTableVector::const_iterator ConditionalAccessMessageTableConstIterator; + +#endif /* __dvb_table_camt_h__ */ diff --git a/lib/dvb_si/capmt.cpp b/lib/dvb_si/capmt.cpp new file mode 100644 index 00000000..3d5afed6 --- /dev/null +++ b/lib/dvb_si/capmt.cpp @@ -0,0 +1,124 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/descriptor_tag.h> +#include <lib/dvb_si/capmt.h> + +CaLengthField::CaLengthField(const uint64_t length) +{ + if (length < 0x80) { + sizeIndicator = 0; + lengthValue = length; + } + + else { + uint64_t mask = 0xFF; + + sizeIndicator = 1; + lengthFieldSize = 1; + + while ((length & mask) != length) { + lengthFieldSize++; + mask = ((uint64_t)(mask << 8)) | ((uint64_t)0xFFULL); + } + + for (uint8_t i = lengthFieldSize; i > 0; i--) + lengthValueByte.push_back((length >> ((i - 1) << 3)) & 0xFF); + } +} + +CaElementaryStreamInfo::CaElementaryStreamInfo(const ElementaryStreamInfo * const info, const uint8_t cmdId) +{ + streamType = info->streamType; + reserved1 = info->reserved1; + elementaryPid = info->elementaryPid; + reserved2 = info->reserved2; + esInfoLength = 0; + + for (DescriptorConstIterator i = info->getDescriptors()->begin(); i != info->getDescriptors()->end(); ++i) + if ((*i)->getTag() == CA_DESCRIPTOR) { + descriptors.push_back(new CaDescriptor(*(CaDescriptor *)*i)); + esInfoLength += (*i)->getLength() + 2; + } + + if (esInfoLength) { + caPmtCmdId = cmdId; + esInfoLength++; + } +} + +CaElementaryStreamInfo::~CaElementaryStreamInfo(void) +{ + for (CaDescriptorIterator i = descriptors.begin(); i != descriptors.end(); ++i) + delete *i; +} + +uint16_t CaElementaryStreamInfo::getLength(void) const +{ + return esInfoLength + 5; +} + +CaProgramMapTable::CaProgramMapTable(const ProgramMapTable * const pmt, const uint8_t listManagement, const uint8_t cmdId) +{ + uint64_t length = 6; + + caPmtTag = 0x9F80C3; + caPmtListManagement = listManagement; + + programNumber = pmt->tableIdExtension; + reserved1 = pmt->reserved3; + versionNumber = pmt->versionNumber; + currentNextIndicator = pmt->currentNextIndicator; + reserved2 = pmt->reserved5; + programInfoLength = 0; + + for (DescriptorConstIterator i = pmt->getDescriptors()->begin(); i != pmt->getDescriptors()->end(); ++i) + if ((*i)->getTag() == CA_DESCRIPTOR) { + descriptors.push_back(new CaDescriptor(*(CaDescriptor *)*i)); + programInfoLength += (*i)->getLength() + 2; + } + + if (programInfoLength) { + caPmtCmdId = cmdId; + programInfoLength++; + length += programInfoLength; + } + + for (ElementaryStreamInfoConstIterator i = pmt->esInfo.begin(); i != pmt->esInfo.end(); ++i) { + CaElementaryStreamInfo *info = new CaElementaryStreamInfo(*i, cmdId); + esInfo.push_back(info); + length += info->getLength(); + } + + lengthField = new CaLengthField(length); +} + +CaProgramMapTable::~CaProgramMapTable(void) +{ + for (CaDescriptorIterator i = descriptors.begin(); i != descriptors.end(); ++i) + delete *i; + + for (CaElementaryStreamInfoIterator i = esInfo.begin(); i != esInfo.end(); ++i) + delete *i; + + delete lengthField; +} + diff --git a/lib/dvb_si/capmt.h b/lib/dvb_si/capmt.h new file mode 100644 index 00000000..bb423939 --- /dev/null +++ b/lib/dvb_si/capmt.h @@ -0,0 +1,87 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_table_capmt_h__ +#define __dvb_table_capmt_h__ + +#include <lib/dvb_si/ca_descriptor.h> +#include "pmt.h" + +class CaLengthField +{ + protected: + unsigned sizeIndicator : 1; + unsigned lengthValue : 7; + unsigned lengthFieldSize : 7; + std::vector<uint8_t> lengthValueByte; + + public: + CaLengthField(const uint64_t length); +}; + +class CaElementaryStreamInfo +{ + protected: + unsigned streamType : 8; + unsigned reserved1 : 3; + unsigned elementaryPid : 13; + unsigned reserved2 : 4; + unsigned esInfoLength : 12; + unsigned caPmtCmdId : 8; + CaDescriptorVector descriptors; + + public: + CaElementaryStreamInfo(const ElementaryStreamInfo * const info, const uint8_t cmdId); + ~CaElementaryStreamInfo(void); + + uint16_t getLength(void) const; +}; + +typedef std::vector<CaElementaryStreamInfo *> CaElementaryStreamInfoVector; +typedef CaElementaryStreamInfoVector::iterator CaElementaryStreamInfoIterator; +typedef CaElementaryStreamInfoVector::const_iterator CaElementaryStreamInfoConstIterator; + +class CaProgramMapTable +{ + protected: + unsigned caPmtTag : 24; + CaLengthField *lengthField; + unsigned caPmtListManagement : 8; + unsigned programNumber : 16; + unsigned reserved1 : 2; + unsigned versionNumber : 5; + unsigned currentNextIndicator : 1; + unsigned reserved2 : 4; + unsigned programInfoLength : 12; + unsigned caPmtCmdId : 8; + CaDescriptorVector descriptors; + CaElementaryStreamInfoVector esInfo; + + public: + CaProgramMapTable(const ProgramMapTable * const pmt, const uint8_t listManagement, const uint8_t cmdId); + ~CaProgramMapTable(void); +}; + +typedef std::vector<CaProgramMapTable *> CaProgramMapTableVector; +typedef CaProgramMapTableVector::iterator CaProgramMapTableIterator; +typedef CaProgramMapTableVector::const_iterator CaProgramMapTableConstIterator; + +#endif /* __dvb_table_capmt_h__ */ diff --git a/lib/dvb_si/cat.cpp b/lib/dvb_si/cat.cpp new file mode 100644 index 00000000..88cf2111 --- /dev/null +++ b/lib/dvb_si/cat.cpp @@ -0,0 +1,29 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/cat.h> + +ConditionalAccessTable::ConditionalAccessTable(const uint8_t * const buffer) : LongCrcTable(buffer) +{ + for (uint16_t i = 8; i < sectionLength - 1; i += buffer[i + 1] + 2) + descriptor(&buffer[i]); +} + diff --git a/lib/dvb_si/cat.h b/lib/dvb_si/cat.h new file mode 100644 index 00000000..4ba86bf0 --- /dev/null +++ b/lib/dvb_si/cat.h @@ -0,0 +1,42 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_table_cat_h__ +#define __dvb_table_cat_h__ + +#include <lib/dvb_si/container.h> +#include "long_crc_table.h" + +class ConditionalAccessTable : public LongCrcTable, public DescriptorContainer +{ + public: + ConditionalAccessTable(const uint8_t * const buffer); + + static const enum PacketId PID = PID_CAT; + static const enum TableId TID = TID_CAT; + static const uint32_t TIMEOUT = 200; +}; + +typedef std::vector<ConditionalAccessTable *> ConditionalAccessTableVector; +typedef ConditionalAccessTableVector::iterator ConditionalAccessTableIterator; +typedef ConditionalAccessTableVector::const_iterator ConditionalAccessTableConstIterator; + +#endif /* __dvb_table_cat_h__ */ diff --git a/lib/dvb_si/cell_frequency_link_descriptor.cpp b/lib/dvb_si/cell_frequency_link_descriptor.cpp new file mode 100644 index 00000000..47c3c1d6 --- /dev/null +++ b/lib/dvb_si/cell_frequency_link_descriptor.cpp @@ -0,0 +1,87 @@ +/* + * $Id$ + * + * (C) 2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/cell_frequency_link_descriptor.h> + +SubcellInfo::SubcellInfo(const uint8_t * const buffer) +{ + cellIdExtenstion = buffer[0]; + transposerFrequency = (buffer[1] << 24) | (buffer[2] << 16) | (buffer[3] << 8) | buffer[4]; +} + +uint8_t SubcellInfo::getCellIdExtension(void) const +{ + return cellIdExtenstion; +} + +uint32_t SubcellInfo::getTransposerFrequency(void) const +{ + return transposerFrequency; +} + +CellFrequencyLink::CellFrequencyLink(const uint8_t * const buffer) +{ + cellId = (buffer[0] << 8) | buffer[1]; + frequency = (buffer[2] << 24) | (buffer[3] << 16) | (buffer[4] << 8) | buffer[5]; + subcellInfoLoopLength = buffer[6]; + + for (uint16_t i = 0; i < subcellInfoLoopLength; i += 5) + subcells.push_back(new SubcellInfo(&buffer[i + 7])); +} + +CellFrequencyLink::~CellFrequencyLink(void) +{ + for (SubcellInfoIterator i = subcells.begin(); i != subcells.end(); ++i) + delete *i; +} + +uint16_t CellFrequencyLink::getCellId(void) const +{ + return cellId; +} + +uint32_t CellFrequencyLink::getFrequency(void) const +{ + return frequency; +} + +const SubcellInfoVector *CellFrequencyLink::getSubcells(void) const +{ + return &subcells; +} + +CellFrequencyLinkDescriptor::CellFrequencyLinkDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + for (uint16_t i = 0; i < descriptorLength; i += buffer[i + 10] + 6) + cellFrequencyLinks.push_back(new CellFrequencyLink(&buffer[i + 2])); +} + +CellFrequencyLinkDescriptor::~CellFrequencyLinkDescriptor(void) +{ + for (CellFrequencyLinkIterator i = cellFrequencyLinks.begin(); i != cellFrequencyLinks.end(); ++i) + delete *i; +} + +const CellFrequencyLinkVector *CellFrequencyLinkDescriptor::getCellFrequencyLinks(void) const +{ + return &cellFrequencyLinks; +} + diff --git a/lib/dvb_si/cell_frequency_link_descriptor.h b/lib/dvb_si/cell_frequency_link_descriptor.h new file mode 100644 index 00000000..27099b8f --- /dev/null +++ b/lib/dvb_si/cell_frequency_link_descriptor.h @@ -0,0 +1,78 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_cell_frequency_link_descriptor_h__ +#define __dvb_descriptor_cell_frequency_link_descriptor_h__ + +#include "descriptor.h" + +class SubcellInfo +{ + protected: + unsigned cellIdExtenstion : 8; + unsigned transposerFrequency : 32; + + public: + SubcellInfo(const uint8_t * const buffer); + + uint8_t getCellIdExtension(void) const; + uint32_t getTransposerFrequency(void) const; +}; + +typedef std::vector<SubcellInfo *> SubcellInfoVector; +typedef SubcellInfoVector::iterator SubcellInfoIterator; +typedef SubcellInfoVector::const_iterator SubcellInfoConstIterator; + +class CellFrequencyLink +{ + protected: + unsigned cellId : 16; + unsigned frequency : 32; + unsigned subcellInfoLoopLength : 8; + SubcellInfoVector subcells; + + public: + CellFrequencyLink(const uint8_t * const buffer); + ~CellFrequencyLink(void); + + uint16_t getCellId(void) const; + uint32_t getFrequency(void) const; + const SubcellInfoVector *getSubcells(void) const; + +}; + +typedef std::vector<CellFrequencyLink *> CellFrequencyLinkVector; +typedef CellFrequencyLinkVector::iterator CellFrequencyLinkIterator; +typedef CellFrequencyLinkVector::const_iterator CellFrequencyLinkConstIterator; + +class CellFrequencyLinkDescriptor : public Descriptor +{ + protected: + CellFrequencyLinkVector cellFrequencyLinks; + + public: + CellFrequencyLinkDescriptor(const uint8_t * const buffer); + ~CellFrequencyLinkDescriptor(void); + + const CellFrequencyLinkVector *getCellFrequencyLinks(void) const; +}; + +#endif /* __dvb_descriptor_cell_frequency_link_descriptor_h__ */ diff --git a/lib/dvb_si/cell_list_descriptor.cpp b/lib/dvb_si/cell_list_descriptor.cpp new file mode 100644 index 00000000..7a500572 --- /dev/null +++ b/lib/dvb_si/cell_list_descriptor.cpp @@ -0,0 +1,124 @@ +/* + * $Id$ + * + * (C) 2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + + +#include <lib/dvb_si/cell_list_descriptor.h> + +Subcell::Subcell(const uint8_t * const buffer) +{ + cellIdExtension = buffer[0]; + subcellLatitude = (buffer[1] << 8) | buffer[2]; + subcellLongitude = (buffer[3] << 8) | buffer[4]; + subcellExtendOfLatitude = (buffer[5] << 4) | ((buffer[6] >> 4) & 0x0f); + subcellExtendOfLongitude = ((buffer[6] & 0x0f) << 8) | buffer[7]; +} + +uint8_t Subcell::getCellIdExtension(void) const +{ + return cellIdExtension; +} + +uint16_t Subcell::getSubcellLatitude(void) const +{ + return subcellLatitude; +} + +uint16_t Subcell::getSubcellLongtitude(void) const +{ + return subcellLongitude; +} + +uint16_t Subcell::getSubcellExtendOfLatitude(void) const +{ + return subcellExtendOfLatitude; +} + +uint16_t Subcell::getSubcellExtendOfLongtitude(void) const +{ + return subcellExtendOfLongitude; +} + +Cell::Cell(const uint8_t * const buffer) +{ + cellId = (buffer[0] << 8) | buffer[1]; + cellLatitude = (buffer[2] << 8) | buffer[3]; + cellLongtitude = (buffer[4] << 8) | buffer[5]; + cellExtendOfLatitude = (buffer[6] << 4) | ((buffer[7] >> 4) & 0x0f); + cellExtendOfLongtitude = ((buffer[7] & 0x0f) << 8) | buffer[8]; + subcellInfoLoopLength = buffer[9]; + + for (uint16_t i = 0; i < subcellInfoLoopLength; i += 8) + subcells.push_back(new Subcell(&buffer[i + 10])); +} + +Cell::~Cell(void) +{ + for (SubcellIterator i = subcells.begin(); i != subcells.end(); ++i) + delete *i; +} + +uint16_t Cell::getCellId(void) const +{ + return cellId; +} + +uint16_t Cell::getCellLatitude(void) const +{ + return cellLatitude; +} + +uint16_t Cell::getCellLongtitude(void) const +{ + return cellLongtitude; +} + +uint16_t Cell::getCellExtendOfLatitude(void) const +{ + return cellExtendOfLatitude; +} + +uint16_t Cell::getCellExtendOfLongtitude(void) const +{ + return cellExtendOfLongtitude; +} + +const SubcellVector *Cell::getSubcells(void) const +{ + return &subcells; +} + +CellListDescriptor::CellListDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + for (uint16_t i = 0; i < descriptorLength; i += buffer[i + 11] + 10) + cells.push_back(new Cell(&buffer[i + 2])); +} + +CellListDescriptor::~CellListDescriptor(void) +{ + for (CellIterator i = cells.begin(); i != cells.end(); ++i) + delete *i; +} + +const CellVector *CellListDescriptor::getCells(void) const +{ + return &cells; +} + diff --git a/lib/dvb_si/cell_list_descriptor.h b/lib/dvb_si/cell_list_descriptor.h new file mode 100644 index 00000000..0c8c94ed --- /dev/null +++ b/lib/dvb_si/cell_list_descriptor.h @@ -0,0 +1,89 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_cell_list_descriptor_h__ +#define __dvb_descriptor_cell_list_descriptor_h__ + +#include "descriptor.h" + +class Subcell +{ + protected: + unsigned cellIdExtension : 8; + unsigned subcellLatitude : 16; + unsigned subcellLongitude : 16; + unsigned subcellExtendOfLatitude : 12; + unsigned subcellExtendOfLongitude : 12; + + public: + Subcell(const uint8_t * const buffer); + + uint8_t getCellIdExtension(void) const; + uint16_t getSubcellLatitude(void) const; + uint16_t getSubcellLongtitude(void) const; + uint16_t getSubcellExtendOfLatitude(void) const; + uint16_t getSubcellExtendOfLongtitude(void) const; +}; + +typedef std::vector<Subcell *> SubcellVector; +typedef SubcellVector::iterator SubcellIterator; +typedef SubcellVector::const_iterator SubcellConstIterator; + +class Cell +{ + protected: + unsigned cellId : 16; + unsigned cellLatitude : 16; + unsigned cellLongtitude : 16; + unsigned cellExtendOfLatitude : 12; + unsigned cellExtendOfLongtitude : 12; + unsigned subcellInfoLoopLength : 8; + SubcellVector subcells; + + public: + Cell(const uint8_t * const buffer); + ~Cell(void); + + uint16_t getCellId(void) const; + uint16_t getCellLatitude(void) const; + uint16_t getCellLongtitude(void) const; + uint16_t getCellExtendOfLatitude(void) const; + uint16_t getCellExtendOfLongtitude(void) const; + const SubcellVector *getSubcells(void) const; +}; + +typedef std::vector<Cell *> CellVector; +typedef CellVector::iterator CellIterator; +typedef CellVector::const_iterator CellConstIterator; + +class CellListDescriptor : public Descriptor +{ + protected: + CellVector cells; + + public: + CellListDescriptor(const uint8_t * const buffer); + ~CellListDescriptor(void); + + const CellVector *getCells(void) const; +}; + +#endif /* __dvb_descriptor_cell_list_descriptor_h__ */ diff --git a/lib/dvb_si/component_descriptor.cpp b/lib/dvb_si/component_descriptor.cpp new file mode 100644 index 00000000..8ef27b99 --- /dev/null +++ b/lib/dvb_si/component_descriptor.cpp @@ -0,0 +1,60 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/component_descriptor.h> + +ComponentDescriptor::ComponentDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + reserved = (buffer[2] >> 4) & 0x0f; + streamContent = buffer[2] & 0x0f; + componentType = buffer[3]; + componentTag = buffer[4]; + iso639LanguageCode.assign((char *) &buffer[5], 3); + if (descriptorLength < 6) + return; + text.assign((char *) &buffer[8], descriptorLength - 6); +} + +uint8_t ComponentDescriptor::getStreamContent(void) const +{ + return streamContent; +} + +uint8_t ComponentDescriptor::getComponentType(void) const +{ + return componentType; +} + +uint8_t ComponentDescriptor::getComponentTag(void) const +{ + return componentTag; +} + +std::string ComponentDescriptor::getIso639LanguageCode(void) const +{ + return iso639LanguageCode; +} + +std::string ComponentDescriptor::getText(void) const +{ + return text; +} + diff --git a/lib/dvb_si/component_descriptor.h b/lib/dvb_si/component_descriptor.h new file mode 100644 index 00000000..feae9e32 --- /dev/null +++ b/lib/dvb_si/component_descriptor.h @@ -0,0 +1,47 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_component_descriptor_h__ +#define __dvb_descriptor_component_descriptor_h__ + +#include "descriptor.h" + +class ComponentDescriptor : public Descriptor +{ + protected: + unsigned reserved : 4; + unsigned streamContent : 4; + unsigned componentType : 8; + unsigned componentTag : 8; + std::string iso639LanguageCode; + std::string text; + + public: + ComponentDescriptor(const uint8_t * const buffer); + + uint8_t getStreamContent(void) const; + uint8_t getComponentType(void) const; + uint8_t getComponentTag(void) const; + std::string getIso639LanguageCode(void) const; + std::string getText(void) const; +}; + +#endif /* __dvb_descriptor_component_descriptor_h__ */ diff --git a/lib/dvb_si/container.cpp b/lib/dvb_si/container.cpp new file mode 100644 index 00000000..8074d57e --- /dev/null +++ b/lib/dvb_si/container.cpp @@ -0,0 +1,289 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/ac3_descriptor.h> +#include <lib/dvb_si/ancillary_data_descriptor.h> +#include <lib/dvb_si/announcement_support_descriptor.h> +#include <lib/dvb_si/application_signalling_descriptor.h> +#include <lib/dvb_si/audio_stream_descriptor.h> +#include <lib/dvb_si/bouquet_name_descriptor.h> +#include <lib/dvb_si/ca_descriptor.h> +#include <lib/dvb_si/ca_identifier_descriptor.h> +#include <lib/dvb_si/ca_system_descriptor.h> +#include <lib/dvb_si/cable_delivery_system_descriptor.h> +#include <lib/dvb_si/cell_frequency_link_descriptor.h> +#include <lib/dvb_si/cell_list_descriptor.h> +#include <lib/dvb_si/component_descriptor.h> +#include <lib/dvb_si/container.h> +#include <lib/dvb_si/content_descriptor.h> +#include <lib/dvb_si/country_availability_descriptor.h> +#include <lib/dvb_si/data_broadcast_descriptor.h> +#include <lib/dvb_si/data_broadcast_id_descriptor.h> +#include <lib/dvb_si/extended_event_descriptor.h> +#include <lib/dvb_si/frequency_list_descriptor.h> +#include <lib/dvb_si/iso639_language_descriptor.h> +#include <lib/dvb_si/linkage_descriptor.h> +#include <lib/dvb_si/local_time_offset_descriptor.h> +#include <lib/dvb_si/mosaic_descriptor.h> +#include <lib/dvb_si/multilingual_bouquet_name_descriptor.h> +#include <lib/dvb_si/multilingual_component_descriptor.h> +#include <lib/dvb_si/multilingual_network_name_descriptor.h> +#include <lib/dvb_si/multilingual_service_name_descriptor.h> +#include <lib/dvb_si/network_name_descriptor.h> +#include <lib/dvb_si/nvod_reference_descriptor.h> +#include <lib/dvb_si/parental_rating_descriptor.h> +#include <lib/dvb_si/pdc_descriptor.h> +#include <lib/dvb_si/private_data_specifier_descriptor.h> +#include <lib/dvb_si/satellite_delivery_system_descriptor.h> +#include <lib/dvb_si/service_descriptor.h> +#include <lib/dvb_si/service_list_descriptor.h> +#include <lib/dvb_si/service_move_descriptor.h> +#include <lib/dvb_si/short_event_descriptor.h> +#include <lib/dvb_si/stream_identifier_descriptor.h> +#include <lib/dvb_si/stuffing_descriptor.h> +#include <lib/dvb_si/subtitling_descriptor.h> +#include <lib/dvb_si/target_background_grid_descriptor.h> +#include <lib/dvb_si/telephone_descriptor.h> +#include <lib/dvb_si/teletext_descriptor.h> +#include <lib/dvb_si/terrestrial_delivery_system_descriptor.h> +#include <lib/dvb_si/time_shifted_service_descriptor.h> +#include <lib/dvb_si/vbi_data_descriptor.h> +#include <lib/dvb_si/vbi_teletext_descriptor.h> +#include <lib/dvb_si/video_stream_descriptor.h> +#include <lib/dvb_si/video_window_descriptor.h> +#include <lib/dvb_si/descriptor_tag.h> + +DescriptorContainer::~DescriptorContainer(void) +{ + for (DescriptorIterator i = descriptorVector.begin(); i != descriptorVector.end(); ++i) + delete *i; +} + +void DescriptorContainer::descriptor(const uint8_t * const buffer) +{ + switch (buffer[0]) { + case VIDEO_STREAM_DESCRIPTOR: + descriptorVector.push_back(new VideoStreamDescriptor(buffer)); + break; + + case AUDIO_STREAM_DESCRIPTOR: + descriptorVector.push_back(new AudioStreamDescriptor(buffer)); + break; + + case TARGET_BACKGROUND_GRID_DESCRIPTOR: + descriptorVector.push_back(new TargetBackgroundGridDescriptor(buffer)); + break; + + case VIDEO_WINDOW_DESCRIPTOR: + descriptorVector.push_back(new VideoWindowDescriptor(buffer)); + break; + + case CA_DESCRIPTOR: + descriptorVector.push_back(new CaDescriptor(buffer)); + break; + + case ISO_639_LANGUAGE_DESCRIPTOR: + descriptorVector.push_back(new Iso639LanguageDescriptor(buffer)); + break; + + case NETWORK_NAME_DESCRIPTOR: + descriptorVector.push_back(new NetworkNameDescriptor(buffer)); + break; + + case SERVICE_LIST_DESCRIPTOR: + descriptorVector.push_back(new ServiceListDescriptor(buffer)); + break; + + case STUFFING_DESCRIPTOR: + descriptorVector.push_back(new StuffingDescriptor(buffer)); + break; + + case SATELLITE_DELIVERY_SYSTEM_DESCRIPTOR: + descriptorVector.push_back(new SatelliteDeliverySystemDescriptor(buffer)); + break; + + case CABLE_DELIVERY_SYSTEM_DESCRIPTOR: + descriptorVector.push_back(new CableDeliverySystemDescriptor(buffer)); + break; + + case VBI_DATA_DESCRIPTOR: + descriptorVector.push_back(new VbiDataDescriptor(buffer)); + break; + + case VBI_TELETEXT_DESCRIPTOR: + descriptorVector.push_back(new VbiTeletextDescriptor(buffer)); + break; + + case BOUQUET_NAME_DESCRIPTOR: + descriptorVector.push_back(new BouquetNameDescriptor(buffer)); + break; + + case SERVICE_DESCRIPTOR: + descriptorVector.push_back(new ServiceDescriptor(buffer)); + break; + + case COUNTRY_AVAILABILITY_DESCRIPTOR: + descriptorVector.push_back(new CountryAvailabilityDescriptor(buffer)); + break; + + case LINKAGE_DESCRIPTOR: + descriptorVector.push_back(new LinkageDescriptor(buffer)); + break; + + case NVOD_REFERENCE_DESCRIPTOR: + descriptorVector.push_back(new NvodReferenceDescriptor(buffer)); + break; + + case TIME_SHIFTED_SERVICE_DESCRIPTOR: + descriptorVector.push_back(new TimeShiftedServiceDescriptor(buffer)); + break; + + case SHORT_EVENT_DESCRIPTOR: + descriptorVector.push_back(new ShortEventDescriptor(buffer)); + break; + + case EXTENDED_EVENT_DESCRIPTOR: + descriptorVector.push_back(new ExtendedEventDescriptor(buffer)); + break; + + case COMPONENT_DESCRIPTOR: + descriptorVector.push_back(new ComponentDescriptor(buffer)); + break; + + case MOSAIC_DESCRIPTOR: + descriptorVector.push_back(new MosaicDescriptor(buffer)); + break; + + case STREAM_IDENTIFIER_DESCRIPTOR: + descriptorVector.push_back(new StreamIdentifierDescriptor(buffer)); + break; + + case CA_IDENTIFIER_DESCRIPTOR: + descriptorVector.push_back(new CaIdentifierDescriptor(buffer)); + break; + + case CONTENT_DESCRIPTOR: + descriptorVector.push_back(new ContentDescriptor(buffer)); + break; + + case PARENTAL_RATING_DESCRIPTOR: + descriptorVector.push_back(new ParentalRatingDescriptor(buffer)); + break; + + case TELETEXT_DESCRIPTOR: + descriptorVector.push_back(new TeletextDescriptor(buffer)); + break; + + case TELEPHONE_DESCRIPTOR: + descriptorVector.push_back(new TelephoneDescriptor(buffer)); + break; + + case LOCAL_TIME_OFFSET_DESCRIPTOR: + descriptorVector.push_back(new LocalTimeOffsetDescriptor(buffer)); + break; + + case SUBTITLING_DESCRIPTOR: + descriptorVector.push_back(new SubtitlingDescriptor(buffer)); + break; + + case TERRESTRIAL_DELIVERY_SYSTEM_DESCRIPTOR: + descriptorVector.push_back(new TerrestrialDeliverySystemDescriptor(buffer)); + break; + + case MULTILINGUAL_NETWORK_NAME_DESCRIPTOR: + descriptorVector.push_back(new MultilingualNetworkNameDescriptor(buffer)); + break; + + case MULTILINGUAL_BOUQUET_NAME_DESCRIPTOR: + descriptorVector.push_back(new MultilingualBouquetNameDescriptor(buffer)); + break; + + case MULTILINGUAL_SERVICE_NAME_DESCRIPTOR: + descriptorVector.push_back(new MultilingualServiceNameDescriptor(buffer)); + break; + + case MULTILINGUAL_COMPONENT_DESCRIPTOR: + descriptorVector.push_back(new MultilingualComponentDescriptor(buffer)); + break; + + case PRIVATE_DATA_SPECIFIER_DESCRIPTOR: + descriptorVector.push_back(new PrivateDataSpecifierDescriptor(buffer)); + break; + + case SERVICE_MOVE_DESCRIPTOR: + descriptorVector.push_back(new ServiceMoveDescriptor(buffer)); + break; + + case FREQUENCY_LIST_DESCRIPTOR: + descriptorVector.push_back(new FrequencyListDescriptor(buffer)); + break; + + case DATA_BROADCAST_DESCRIPTOR: + descriptorVector.push_back(new DataBroadcastDescriptor(buffer)); + break; + + case CA_SYSTEM_DESCRIPTOR: + descriptorVector.push_back(new CaSystemDescriptor(buffer)); + break; + + case DATA_BROADCAST_ID_DESCRIPTOR: + descriptorVector.push_back(new DataBroadcastIdDescriptor(buffer)); + break; + + case PDC_DESCRIPTOR: + descriptorVector.push_back(new PdcDescriptor(buffer)); + break; + + case AC3_DESCRIPTOR: + descriptorVector.push_back(new Ac3Descriptor(buffer)); + break; + + case ANCILLARY_DATA_DESCRIPTOR: + descriptorVector.push_back(new AncillaryDataDescriptor(buffer)); + break; + + case CELL_LIST_DESCRIPTOR: + descriptorVector.push_back(new CellListDescriptor(buffer)); + break; + + case CELL_FREQUENCY_LINK_DESCRIPTOR: + descriptorVector.push_back(new CellFrequencyLinkDescriptor(buffer)); + break; + + case ANNOUNCEMENT_SUPPORT_DESCRIPTOR: + descriptorVector.push_back(new AnnouncementSupportDescriptor(buffer)); + break; + + case APPLICATION_SIGNALLING_DESCRIPTOR: + descriptorVector.push_back(new ApplicationSignallingDescriptor(buffer)); + break; + + default: + descriptorVector.push_back(new Descriptor(buffer)); + break; + } +} + +const DescriptorVector *DescriptorContainer::getDescriptors(void) const +{ + return &descriptorVector; +} + diff --git a/lib/dvb_si/container.h b/lib/dvb_si/container.h new file mode 100644 index 00000000..60575f62 --- /dev/null +++ b/lib/dvb_si/container.h @@ -0,0 +1,39 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_container_h__ +#define __dvb_descriptor_container_h__ + +#include "descriptor.h" + +class DescriptorContainer +{ + protected: + void descriptor(const uint8_t * const buffer); + DescriptorVector descriptorVector; + + public: + ~DescriptorContainer(void); + + const DescriptorVector *getDescriptors(void) const; +}; + +#endif /* __dvb_descriptor_container_h__ */ diff --git a/lib/dvb_si/content_descriptor.cpp b/lib/dvb_si/content_descriptor.cpp new file mode 100644 index 00000000..9f277419 --- /dev/null +++ b/lib/dvb_si/content_descriptor.cpp @@ -0,0 +1,68 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/content_descriptor.h> + +ContentClassification::ContentClassification(const uint8_t * const buffer) +{ + contentNibbleLevel1 = (buffer[0] >> 4) & 0x0f; + contentNibbleLevel2 = buffer[0] & 0x0f; + userNibble1 = (buffer[1] >> 4) & 0x0f; + userNibble2 = buffer[1] & 0x0f; +} + +uint8_t ContentClassification::getContentNibbleLevel1(void) const +{ + return contentNibbleLevel1; +} + +uint8_t ContentClassification::getContentNibbleLevel2(void) const +{ + return contentNibbleLevel2; +} + +uint8_t ContentClassification::getUserNibble1(void) const +{ + return userNibble1; +} + +uint8_t ContentClassification::getUserNibble2(void) const +{ + return userNibble2; +} + +ContentDescriptor::ContentDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + for (uint16_t i = 0; i < descriptorLength; i += 2) + classifications.push_back(new ContentClassification(&buffer[i + 2])); +} + +ContentDescriptor::~ContentDescriptor(void) +{ + for (ContentClassificationVector::iterator i = classifications.begin(); i != classifications.end(); ++i) + delete *i; +} + +const ContentClassificationVector *ContentDescriptor::getClassifications(void) const +{ + return &classifications; +} + diff --git a/lib/dvb_si/content_descriptor.h b/lib/dvb_si/content_descriptor.h new file mode 100644 index 00000000..83660140 --- /dev/null +++ b/lib/dvb_si/content_descriptor.h @@ -0,0 +1,60 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_content_descriptor_h__ +#define __dvb_descriptor_content_descriptor_h__ + +#include "descriptor.h" + +class ContentClassification +{ + protected: + unsigned contentNibbleLevel1 : 4; + unsigned contentNibbleLevel2 : 4; + unsigned userNibble1 : 4; + unsigned userNibble2 : 4; + + public: + ContentClassification(const uint8_t * const buffer); + + uint8_t getContentNibbleLevel1(void) const; + uint8_t getContentNibbleLevel2(void) const; + uint8_t getUserNibble1(void) const; + uint8_t getUserNibble2(void) const; +}; + +typedef std::vector<ContentClassification *> ContentClassificationVector; +typedef ContentClassificationVector::iterator ContentClassificationIterator; +typedef ContentClassificationVector::const_iterator ContentClassificationConstIterator; + +class ContentDescriptor : public Descriptor +{ + protected: + ContentClassificationVector classifications; + + public: + ContentDescriptor(const uint8_t * const buffer); + ~ContentDescriptor(void); + + const ContentClassificationVector *getClassifications(void) const; +}; + +#endif /* __dvb_descriptor_content_descriptor_h__ */ diff --git a/lib/dvb_si/copyright_descriptor.h b/lib/dvb_si/copyright_descriptor.h new file mode 100644 index 00000000..e531da02 --- /dev/null +++ b/lib/dvb_si/copyright_descriptor.h @@ -0,0 +1,44 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_copyright_descriptor_h__ +#define __dvb_descriptor_copyright_descriptor_h__ + +#include "descriptor.h" + +typedef std::vector<uint8_t> AdditionalCopyrightInfoVector; +typedef AdditionalCopyrightInfoVector::iterator AdditionalCopyrightInfoIterator; +typedef AdditionalCopyrightInfoVector::const_iterator AdditionalCopyrightInfoConstIterator; + +class CopyrightDescriptor : public Descriptor +{ + protected: + unsigned copyrightIdentifier : 32; + AdditionalCopyrightInfoVector additionalCopyrightInfo; + + public: + CopyrightDescriptor(const uint8_t * const buffer); + + uint32_t getCopyrightIdentifier(void) const; + const AdditionalCopyrightInfoVector *getAdditionalCopyrightInfo(void) const; +}; + +#endif /* __dvb_descriptor_copyright_descriptor_h__ */ diff --git a/lib/dvb_si/country_availability_descriptor.cpp b/lib/dvb_si/country_availability_descriptor.cpp new file mode 100644 index 00000000..2ca759e5 --- /dev/null +++ b/lib/dvb_si/country_availability_descriptor.cpp @@ -0,0 +1,47 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/country_availability_descriptor.h> + +CountryAvailabilityDescriptor::CountryAvailabilityDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + std::string countryCode; + countryAvailabilityFlag = (buffer[2] >> 7) & 0x01; + + if (descriptorLength < 1) + return; + + for (uint16_t i = 0; i < descriptorLength - 1; i += 3) { + countryCode.assign((char *)&buffer[i + 3], 3); + countryCodes.push_back(countryCode); + } +} + +uint8_t CountryAvailabilityDescriptor::getCountryAvailabilityFlag(void) const +{ + return countryAvailabilityFlag; +} + +const CountryCodeVector *CountryAvailabilityDescriptor::getCountryCodes(void) const +{ + return &countryCodes; +} + diff --git a/lib/dvb_si/country_availability_descriptor.h b/lib/dvb_si/country_availability_descriptor.h new file mode 100644 index 00000000..152ef898 --- /dev/null +++ b/lib/dvb_si/country_availability_descriptor.h @@ -0,0 +1,45 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_country_availability_descriptor_h__ +#define __dvb_descriptor_country_availability_descriptor_h__ + +#include "descriptor.h" + +typedef std::vector<std::string> CountryCodeVector; +typedef CountryCodeVector::iterator CountryCodeIterator; +typedef CountryCodeVector::const_iterator CountryCodeConstIterator; + +class CountryAvailabilityDescriptor : public Descriptor +{ + protected: + unsigned countryAvailabilityFlag : 1; + unsigned reserved : 7; + CountryCodeVector countryCodes; + + public: + CountryAvailabilityDescriptor(const uint8_t * const buffer); + + uint8_t getCountryAvailabilityFlag(void) const; + const CountryCodeVector *getCountryCodes(void) const; +}; + +#endif /* __dvb_descriptor_country_availability_descriptor_h__ */ diff --git a/lib/dvb_si/data_broadcast_descriptor.cpp b/lib/dvb_si/data_broadcast_descriptor.cpp new file mode 100644 index 00000000..21d1e31f --- /dev/null +++ b/lib/dvb_si/data_broadcast_descriptor.cpp @@ -0,0 +1,62 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/data_broadcast_descriptor.h> + +DataBroadcastDescriptor::DataBroadcastDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + dataBroadcastId = (buffer[2] << 8) | buffer[3]; + componentTag = buffer[3]; + selectorLength = buffer[4]; + + for (uint16_t i = 0; i < selectorLength; ++i) + selectorBytes.push_back(buffer[i + 5]); + + iso639LanguageCode.assign((char *)&buffer[selectorLength + 5], 3); + textLength = buffer[selectorLength + 8]; + text.assign((char *)&buffer[selectorLength + 9], textLength); +} + +uint16_t DataBroadcastDescriptor::getDataBroadcastId(void) const +{ + return dataBroadcastId; +} + +uint8_t DataBroadcastDescriptor::getComponentTag(void) const +{ + return componentTag; +} + +const selectorByteVector *DataBroadcastDescriptor::getSelectorBytes(void) const +{ + return &selectorBytes; +} + +std::string DataBroadcastDescriptor::getIso639LanguageCode(void) const +{ + return iso639LanguageCode; +} + +std::string DataBroadcastDescriptor::getText(void) const +{ + return text; +} + diff --git a/lib/dvb_si/data_broadcast_descriptor.h b/lib/dvb_si/data_broadcast_descriptor.h new file mode 100644 index 00000000..c5e589a2 --- /dev/null +++ b/lib/dvb_si/data_broadcast_descriptor.h @@ -0,0 +1,52 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_data_broadcast_descriptor_h__ +#define __dvb_descriptor_data_broadcast_descriptor_h__ + +#include "descriptor.h" + +typedef std::vector<uint8_t> selectorByteVector; +typedef selectorByteVector::iterator selectorByteIterator; +typedef selectorByteVector::const_iterator selectorByteConstIterator; + +class DataBroadcastDescriptor : public Descriptor +{ + protected: + unsigned dataBroadcastId : 16; + unsigned componentTag : 8; + unsigned selectorLength : 8; + selectorByteVector selectorBytes; + std::string iso639LanguageCode; + unsigned textLength : 8; + std::string text; + + public: + DataBroadcastDescriptor(const uint8_t * const buffer); + + uint16_t getDataBroadcastId(void) const; + uint8_t getComponentTag(void) const; + const selectorByteVector *getSelectorBytes(void) const; + std::string getIso639LanguageCode(void) const; + std::string getText(void) const; +}; + +#endif /* __dvb_descriptor_data_broadcast_descriptor_h__ */ diff --git a/lib/dvb_si/data_broadcast_id_descriptor.cpp b/lib/dvb_si/data_broadcast_id_descriptor.cpp new file mode 100644 index 00000000..1c42249a --- /dev/null +++ b/lib/dvb_si/data_broadcast_id_descriptor.cpp @@ -0,0 +1,44 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/data_broadcast_id_descriptor.h> + +DataBroadcastIdDescriptor::DataBroadcastIdDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + if (descriptorLength < 2) + return; + + dataBroadcastId = (buffer[2] << 8) | buffer[3]; + + for (uint16_t i = 0; i < descriptorLength - 2; ++i) + idSelectorBytes.push_back(buffer[i + 4]); +} + +uint16_t DataBroadcastIdDescriptor::getDataBroadcastId(void) const +{ + return dataBroadcastId; +} + +const IdSelectorByteVector *DataBroadcastIdDescriptor::getIdSelectorBytes(void) const +{ + return &idSelectorBytes; +} + diff --git a/lib/dvb_si/data_broadcast_id_descriptor.h b/lib/dvb_si/data_broadcast_id_descriptor.h new file mode 100644 index 00000000..a0da275f --- /dev/null +++ b/lib/dvb_si/data_broadcast_id_descriptor.h @@ -0,0 +1,44 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_data_broadcast_id_descriptor_h__ +#define __dvb_descriptor_data_broadcast_id_descriptor_h__ + +#include "descriptor.h" + +typedef std::vector<uint8_t> IdSelectorByteVector; +typedef IdSelectorByteVector::iterator IdSelectorByteIterator; +typedef IdSelectorByteVector::const_iterator IdSelectorByteConstIterator; + +class DataBroadcastIdDescriptor : public Descriptor +{ + protected: + unsigned dataBroadcastId : 16; + IdSelectorByteVector idSelectorBytes; + + public: + DataBroadcastIdDescriptor(const uint8_t * const buffer); + + uint16_t getDataBroadcastId(void) const; + const IdSelectorByteVector *getIdSelectorBytes(void) const; +}; + +#endif /* __dvb_descriptor_data_broadcast_id_descriptor_h__ */ diff --git a/lib/dvb_si/data_stream_alignment_descriptor.h b/lib/dvb_si/data_stream_alignment_descriptor.h new file mode 100644 index 00000000..023995da --- /dev/null +++ b/lib/dvb_si/data_stream_alignment_descriptor.h @@ -0,0 +1,38 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_data_stream_alignment_descriptor_h__ +#define __dvb_descriptor_data_stream_alignment_descriptor_h__ + +#include "descriptor.h" + +class DataStreamAlignmentDescriptor : public Descriptor +{ + protected: + unsigned alignmentType : 8; + + private: + DataStreamAlignmentDescriptor(const uint8_t * const buffer); + + uint8_t getAlignmentType(void) const; +}; + +#endif /* __dvb_descriptor_data_stream_alignment_descriptor_h__ */ diff --git a/lib/dvb_si/descriptor.cpp b/lib/dvb_si/descriptor.cpp new file mode 100644 index 00000000..6ab1ae1a --- /dev/null +++ b/lib/dvb_si/descriptor.cpp @@ -0,0 +1,39 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/descriptor.h> + +Descriptor::Descriptor(const uint8_t * const buffer) +{ + descriptorTag = buffer[0]; + descriptorLength = buffer[1]; +} + +uint8_t Descriptor::getTag(void) const +{ + return descriptorTag; +} + +uint8_t Descriptor::getLength(void) const +{ + return descriptorLength; +} + diff --git a/lib/dvb_si/descriptor.h b/lib/dvb_si/descriptor.h new file mode 100644 index 00000000..bb312579 --- /dev/null +++ b/lib/dvb_si/descriptor.h @@ -0,0 +1,46 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_descriptor_h__ +#define __dvb_descriptor_descriptor_h__ + +#include <string> +#include <vector> +#include <inttypes.h> + +class Descriptor +{ + protected: + unsigned descriptorTag : 8; + unsigned descriptorLength : 8; + + public: + Descriptor(const uint8_t * const buffer); + + uint8_t getTag(void) const; + uint8_t getLength(void) const; +}; + +typedef std::vector<Descriptor *> DescriptorVector; +typedef DescriptorVector::iterator DescriptorIterator; +typedef DescriptorVector::const_iterator DescriptorConstIterator; + +#endif /* __dvb_descriptor_descriptor_h__ */ diff --git a/lib/dvb_si/descriptor_tag.h b/lib/dvb_si/descriptor_tag.h new file mode 100644 index 00000000..e0e93ce6 --- /dev/null +++ b/lib/dvb_si/descriptor_tag.h @@ -0,0 +1,127 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_id_descriptor_tag_h__ +#define __dvb_id_descriptor_tag_h__ + +enum DescriptorTag { + /* 0x00 - 0x3F: ITU-T Rec. H.222.0 | ISO/IEC 13818-1 */ + VIDEO_STREAM_DESCRIPTOR = 0x02, + AUDIO_STREAM_DESCRIPTOR = 0x03, + HIERARCHY_DESCRIPTOR = 0x04, + REGISTRATION_DESCRIPTOR = 0x05, + DATA_STREAM_ALIGNMENT_DESCRIPTOR = 0x06, + TARGET_BACKGROUND_GRID_DESCRIPTOR = 0x07, + VIDEO_WINDOW_DESCRIPTOR = 0x08, + CA_DESCRIPTOR = 0x09, + ISO_639_LANGUAGE_DESCRIPTOR = 0x0A, + SYSTEM_CLOCK_DESCRIPTOR = 0x0B, + MULTIPLEX_BUFFER_UTILIZATION_DESCRIPTOR = 0x0C, + COPYRIGHT_DESCRIPTOR = 0x0D, + MAXIMUM_BITRATE_DESCRIPTOR = 0x0E, + PRIVATE_DATA_INDICATOR_DESCRIPTOR = 0x0F, + SMOOTHING_BUFFER_DESCRIPTOR = 0x10, + STD_DESCRIPTOR = 0x11, + IBP_DESCRIPTOR = 0x12, + CAROUSEL_IDENTIFIER_DESCRIPTOR = 0x13, + /* 0x40 - 0x7F: ETSI EN 300 468 V1.5.1 (2003-01) */ + NETWORK_NAME_DESCRIPTOR = 0x40, + SERVICE_LIST_DESCRIPTOR = 0x41, + STUFFING_DESCRIPTOR = 0x42, + SATELLITE_DELIVERY_SYSTEM_DESCRIPTOR = 0x43, + CABLE_DELIVERY_SYSTEM_DESCRIPTOR = 0x44, + VBI_DATA_DESCRIPTOR = 0x45, + VBI_TELETEXT_DESCRIPTOR = 0x46, + BOUQUET_NAME_DESCRIPTOR = 0x47, + SERVICE_DESCRIPTOR = 0x48, + COUNTRY_AVAILABILITY_DESCRIPTOR = 0x49, + LINKAGE_DESCRIPTOR = 0x4A, + NVOD_REFERENCE_DESCRIPTOR = 0x4B, + TIME_SHIFTED_SERVICE_DESCRIPTOR = 0x4C, + SHORT_EVENT_DESCRIPTOR = 0x4D, + EXTENDED_EVENT_DESCRIPTOR = 0x4E, + TIME_SHIFTED_EVENT_DESCRIPTOR = 0x4F, + COMPONENT_DESCRIPTOR = 0x50, + MOSAIC_DESCRIPTOR = 0x51, + STREAM_IDENTIFIER_DESCRIPTOR = 0x52, + CA_IDENTIFIER_DESCRIPTOR = 0x53, + CONTENT_DESCRIPTOR = 0x54, + PARENTAL_RATING_DESCRIPTOR = 0x55, + TELETEXT_DESCRIPTOR = 0x56, + TELEPHONE_DESCRIPTOR = 0x57, + LOCAL_TIME_OFFSET_DESCRIPTOR = 0x58, + SUBTITLING_DESCRIPTOR = 0x59, + TERRESTRIAL_DELIVERY_SYSTEM_DESCRIPTOR = 0x5A, + MULTILINGUAL_NETWORK_NAME_DESCRIPTOR = 0x5B, + MULTILINGUAL_BOUQUET_NAME_DESCRIPTOR = 0x5C, + MULTILINGUAL_SERVICE_NAME_DESCRIPTOR = 0x5D, + MULTILINGUAL_COMPONENT_DESCRIPTOR = 0x5E, + PRIVATE_DATA_SPECIFIER_DESCRIPTOR = 0x5F, + SERVICE_MOVE_DESCRIPTOR = 0x60, + SHORT_SMOOTHING_BUFFER_DESCRIPTOR = 0x61, + FREQUENCY_LIST_DESCRIPTOR = 0x62, + PARTIAL_TRANSPORT_STREAM_DESCRIPTOR = 0x63, + DATA_BROADCAST_DESCRIPTOR = 0x64, + CA_SYSTEM_DESCRIPTOR = 0x65, + DATA_BROADCAST_ID_DESCRIPTOR = 0x66, + TRANSPORT_STREAM_DESCRIPTOR = 0x67, + DSNG_DESCRIPTOR = 0x68, + PDC_DESCRIPTOR = 0x69, + AC3_DESCRIPTOR = 0x6A, + ANCILLARY_DATA_DESCRIPTOR = 0x6B, + CELL_LIST_DESCRIPTOR = 0x6C, + CELL_FREQUENCY_LINK_DESCRIPTOR = 0x6D, + ANNOUNCEMENT_SUPPORT_DESCRIPTOR = 0x6E, + APPLICATION_SIGNALLING_DESCRIPTOR = 0x6F, + ADAPTATION_FIELD_DATA_DESCRIPTOR = 0x70, + SERVICE_IDENTIFIER_DESCRIPTOR = 0x71, + SERVICE_AVAILABILITY_DESCRIPTOR = 0x72, + /* 0x80 - 0xFE: user defined */ + VIASAT_LOGIC_CHANNEL_DESCRIPTOR = 0x82, + NORDIG_LOGIC_CHANNEL_DESCRIPTOR = 0x83, + EACEM_LOGIC_CHANNEL_DESCRIPTOR = 0x83, + EACEM_PREFERRED_NAME_LIST_DESCRIPTOR = 0x84, + EACEM_PREFERRED_NAME_IDENTIFIER_DESCRIPTOR = 0x85, + EACEM_STREAM_IDENTIFIER_DESCRIPTOR = 0x86, + SENDA_CHANNEL_LIST_DESCRIPTOR = 0xF1, + /* 0xFF: Forbidden */ + FORBIDDEN_DESCRIPTOR = 0xFF +}; + +enum MhpDescriptorTag { + /* ETSI TS 101 812 V1.2.1 (2002-06) */ + APPLICATION_DESCRIPTOR = 0x00, + APPLICATION_NAME_DESCRIPTOR = 0x01, + TRANSPORT_PROTOCOL_DESCRIPTOR = 0x02, + DVB_J_APPLICATION_DESCRIPTOR = 0x03, + DVB_J_APPLICATION_LOCATION_DESCRIPTOR = 0x04, + EXTERNAL_APPLICATION_AUTHORISATION_DESCRIPTOR = 0x05, + ROUTING_DESCRIPTOR_IP4 = 0x06, + ROUTING_DESCRIPTOR_IP6 = 0x07, + DVB_HTML_APPLICATION_DESCRIPTOR = 0x08, + DVB_HTML_APPLICATION_LOCATION_DESCRIPTOR = 0x09, + DVB_HTML_APPLICATION_BOUNDARY_DESCRIPTOR = 0x0A, + APPLICATION_ICONS_DESCRIPTOR = 0x0B, + PREFETCH_DESCRIPTOR = 0x0C, + DII_LOCATION_DESCRIPTOR = 0x0D, +}; + +#endif /* __dvb_id_descriptor_tag_h__ */ diff --git a/lib/dvb_si/dsng_descriptor.h b/lib/dvb_si/dsng_descriptor.h new file mode 100644 index 00000000..38486c4d --- /dev/null +++ b/lib/dvb_si/dsng_descriptor.h @@ -0,0 +1,42 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_dsng_descriptor_h__ +#define __dvb_descriptor_dsng_descriptor_h__ + +#include "descriptor.h" + +typedef std::vector<uint8_t> ByteVector; +typedef ByteVector::iterator ByteIterator; +typedef ByteVector::const_iterator ByteConstIterator; + +class DsngDescriptor : public Descriptor +{ + protected: + ByteVector bytes; + + public: + DsngDescriptor(const uint8_t * const buffer); + + const ByteVector *getBytes(void) const; +}; + +#endif /* __dvb_descriptor_dsng_descriptor_h__ */ diff --git a/lib/dvb_si/eit.cpp b/lib/dvb_si/eit.cpp new file mode 100644 index 00000000..b018a8f2 --- /dev/null +++ b/lib/dvb_si/eit.cpp @@ -0,0 +1,109 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/eit.h> + +Event::Event(const uint8_t * const buffer) +{ + eventId = (buffer[0] << 8) | buffer[1]; + startTimeMjd = (buffer[2] << 8) | buffer[3]; + startTimeBcd = (buffer[4] << 16) | (buffer[5] << 8) | buffer[6]; + duration = (buffer[7] << 16) | (buffer[8] << 8) | buffer[9]; + runningStatus = (buffer[10] >> 5) & 0x07; + freeCaMode = (buffer[10] >> 4) & 0x01; + descriptorsLoopLength = ((buffer[10] & 0x0f) << 8) | buffer[11]; + + for (uint16_t i = 12; i < descriptorsLoopLength + 12; i += buffer[i + 1] + 2) + descriptor(&buffer[i]); +} + +uint16_t Event::getEventId(void) const +{ + return eventId; +} + +uint16_t Event::getStartTimeMjd(void) const +{ + return startTimeMjd; +} + +uint32_t Event::getStartTimeBcd(void) const +{ + return startTimeBcd; +} + +uint32_t Event::getDuration(void) const +{ + return duration; +} + +uint8_t Event::getRunningStatus(void) const +{ + return runningStatus; +} + +uint8_t Event::getFreeCaMode(void) const +{ + return freeCaMode; +} + +EventInformationTable::EventInformationTable(const uint8_t * const buffer) : LongCrcTable(buffer) +{ + transportStreamId = (buffer[8] << 8) | buffer[9]; + originalNetworkId = (buffer[10] << 8) | buffer[11]; + segmentLastSectionNumber = buffer[12]; + lastTableId = buffer[13]; + + for (uint16_t i = 14; i < sectionLength - 1; i += (((buffer[i + 10] & 0x0f) << 8) | buffer[i + 11]) + 12) + events.push_back(new Event(&buffer[i])); +} + +EventInformationTable::~EventInformationTable(void) +{ + for (EventIterator i = events.begin(); i != events.end(); ++i) + delete *i; +} + +uint16_t EventInformationTable::getTransportStreamId(void) const +{ + return transportStreamId; +} + +uint16_t EventInformationTable::getOriginalNetworkId(void) const +{ + return originalNetworkId; +} + +uint8_t EventInformationTable::getLastSectionNumber(void) const +{ + return lastSectionNumber; +} + +uint8_t EventInformationTable::getLastTableId(void) const +{ + return lastTableId; +} + +const EventVector *EventInformationTable::getEvents(void) const +{ + return &events; +} + diff --git a/lib/dvb_si/eit.h b/lib/dvb_si/eit.h new file mode 100644 index 00000000..d065f4ec --- /dev/null +++ b/lib/dvb_si/eit.h @@ -0,0 +1,83 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_table_eit_h__ +#define __dvb_table_eit_h__ + +#include <lib/dvb_si/container.h> +#include "long_crc_table.h" + +class Event : public DescriptorContainer +{ + protected: + unsigned eventId : 16; + unsigned startTimeMjd : 16; + unsigned startTimeBcd : 24; + unsigned duration : 24; + unsigned runningStatus : 3; + unsigned freeCaMode : 1; + unsigned descriptorsLoopLength : 12; + + public: + Event(const uint8_t * const buffer); + + uint16_t getEventId(void) const; + uint16_t getStartTimeMjd(void) const; + uint32_t getStartTimeBcd(void) const; + uint32_t getDuration(void) const; + uint8_t getRunningStatus(void) const; + uint8_t getFreeCaMode(void) const; +}; + +typedef std::vector<Event *> EventVector; +typedef EventVector::iterator EventIterator; +typedef EventVector::const_iterator EventConstIterator; + +class EventInformationTable : public LongCrcTable +{ + protected: + unsigned transportStreamId : 16; + unsigned originalNetworkId : 16; + unsigned segmentLastSectionNumber : 8; + unsigned lastTableId : 8; + EventVector events; + + public: + EventInformationTable(const uint8_t * const buffer); + ~EventInformationTable(void); + + static const uint16_t LENGTH = 4096; + static const enum PacketId PID = PID_EIT; + static const enum TableId TID = TID_EIT_ACTUAL; + static const uint32_t TIMEOUT = 3000; + + uint16_t getTransportStreamId(void) const; + uint16_t getOriginalNetworkId(void) const; + uint8_t getLastSectionNumber(void) const; + uint8_t getLastTableId(void) const; + const EventVector *getEvents(void) const; +}; + +typedef std::vector<EventInformationTable *> EventInformationTableVector; +typedef EventInformationTableVector::iterator EventInformationTableIterator; +typedef EventInformationTableVector::const_iterator EventInformationTableConstIterator; + +#endif /* __dvb_table_eit_h__ */ diff --git a/lib/dvb_si/element_descriptor.h b/lib/dvb_si/element_descriptor.h new file mode 100644 index 00000000..2dea9ba7 --- /dev/null +++ b/lib/dvb_si/element_descriptor.h @@ -0,0 +1,34 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_element_descriptor_h__ +#define __dvb_descriptor_element_descriptor_h__ + +#include "descriptor.h" + +/* 0x92 */ +class ElementDescriptor : public Descriptor +{ + public: + ElementDescriptor(const uint8_t * const buffer); +}; + +#endif /* __dvb_descriptor_element_descriptor_h__ */ diff --git a/lib/dvb_si/extended_event_descriptor.cpp b/lib/dvb_si/extended_event_descriptor.cpp new file mode 100644 index 00000000..bd438cf4 --- /dev/null +++ b/lib/dvb_si/extended_event_descriptor.cpp @@ -0,0 +1,90 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/extended_event_descriptor.h> + +ExtendedEvent::ExtendedEvent(const uint8_t * const buffer) +{ + itemDescriptionLength = buffer[0]; + itemDescription.assign((char *)&buffer[1], itemDescriptionLength); + itemLength = buffer[itemDescriptionLength + 1]; + item.assign((char *)&buffer[itemDescriptionLength + 2], itemLength); +} + +std::string ExtendedEvent::getItemDescription(void) const +{ + return itemDescription; +} + +std::string ExtendedEvent::getItem(void) const +{ + return item; +} + +ExtendedEventDescriptor::ExtendedEventDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + descriptorNumber = (buffer[2] >> 4) & 0x0f; + lastDescriptorNumber = buffer[2] & 0x0f; + iso639LanguageCode.assign((char *)&buffer[3], 3); + lengthOfItems = buffer[6]; + + ExtendedEvent *e; + + for (uint16_t i = 0; i < lengthOfItems; i += e->itemDescriptionLength + e->itemLength + 2) { + e = new ExtendedEvent(&buffer[i + 7]); + items.push_back(e); + } + + textLength = buffer[lengthOfItems + 7]; + text.assign((char *)&buffer[lengthOfItems + 8], textLength); +} + +ExtendedEventDescriptor::~ExtendedEventDescriptor(void) +{ + for (ExtendedEventIterator i = items.begin(); i != items.end(); ++i) + delete *i; +} + +uint8_t ExtendedEventDescriptor::getDescriptorNumber(void) const +{ + return descriptorNumber; +} + +uint8_t ExtendedEventDescriptor::getLastDescriptorNumber(void) const +{ + return lastDescriptorNumber; +} + +std::string ExtendedEventDescriptor::getIso639LanguageCode(void) const +{ + return iso639LanguageCode; +} + +const ExtendedEventVector *ExtendedEventDescriptor::getItems(void) const +{ + return &items; +} + +std::string ExtendedEventDescriptor::getText(void) const +{ + return text; +} + diff --git a/lib/dvb_si/extended_event_descriptor.h b/lib/dvb_si/extended_event_descriptor.h new file mode 100644 index 00000000..4abdccf6 --- /dev/null +++ b/lib/dvb_si/extended_event_descriptor.h @@ -0,0 +1,70 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_extended_event_descriptor_h__ +#define __dvb_descriptor_extended_event_descriptor_h__ + +#include "descriptor.h" + +class ExtendedEvent +{ + protected: + unsigned itemDescriptionLength : 8; + std::string itemDescription; + unsigned itemLength : 8; + std::string item; + + public: + ExtendedEvent(const uint8_t * const buffer); + + std::string getItemDescription(void) const; + std::string getItem(void) const; + + friend class ExtendedEventDescriptor; +}; + +typedef std::vector<ExtendedEvent *> ExtendedEventVector; +typedef ExtendedEventVector::iterator ExtendedEventIterator; +typedef ExtendedEventVector::const_iterator ExtendedEventConstIterator; + +class ExtendedEventDescriptor : public Descriptor +{ + protected: + unsigned descriptorNumber : 4; + unsigned lastDescriptorNumber : 4; + std::string iso639LanguageCode; + unsigned lengthOfItems : 8; + ExtendedEventVector items; + unsigned textLength : 8; + std::string text; + + public: + ExtendedEventDescriptor(const uint8_t * const buffer); + ~ExtendedEventDescriptor(void); + + uint8_t getDescriptorNumber(void) const; + uint8_t getLastDescriptorNumber(void) const; + std::string getIso639LanguageCode(void) const; + const ExtendedEventVector *getItems(void) const; + std::string getText(void) const; +}; + +#endif /* __dvb_descriptor_extended_event_descriptor_h__ */ diff --git a/lib/dvb_si/frequency_list_descriptor.cpp b/lib/dvb_si/frequency_list_descriptor.cpp new file mode 100644 index 00000000..a0314dbb --- /dev/null +++ b/lib/dvb_si/frequency_list_descriptor.cpp @@ -0,0 +1,44 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/frequency_list_descriptor.h> + +FrequencyListDescriptor::FrequencyListDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + if (descriptorLength < 1) + return; + reserved = (buffer[2] >> 2) & 0x3f; + codingType = buffer[2] & 0x03; + + for (uint16_t i = 0; i < descriptorLength - 1; i += 4) + centreFrequencies.push_back((buffer[i + 3] << 24) | (buffer[i + 4] << 16) | (buffer[i + 5] << 8) | buffer[i + 6]); +} + +uint8_t FrequencyListDescriptor::getCodingType(void) const +{ + return codingType; +} + +const CentreFrequencyVector *FrequencyListDescriptor::getCentreFrequencies(void) const +{ + return ¢reFrequencies; +} + diff --git a/lib/dvb_si/frequency_list_descriptor.h b/lib/dvb_si/frequency_list_descriptor.h new file mode 100644 index 00000000..4297b676 --- /dev/null +++ b/lib/dvb_si/frequency_list_descriptor.h @@ -0,0 +1,45 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_frequency_list_descriptor_h__ +#define __dvb_descriptor_frequency_list_descriptor_h__ + +#include "descriptor.h" + +typedef std::vector<uint32_t> CentreFrequencyVector; +typedef CentreFrequencyVector::iterator CentreFrequencyIterator; +typedef CentreFrequencyVector::const_iterator CentreFrequencyConstIterator; + +class FrequencyListDescriptor : public Descriptor +{ + protected: + unsigned reserved : 6; + unsigned codingType : 2; + CentreFrequencyVector centreFrequencies; + + public: + FrequencyListDescriptor(const uint8_t * const buffer); + + uint8_t getCodingType(void) const; + const CentreFrequencyVector *getCentreFrequencies(void) const; +}; + +#endif /* __dvb_descriptor_frequency_list_descriptor_h__ */ diff --git a/lib/dvb_si/group_descriptor.h b/lib/dvb_si/group_descriptor.h new file mode 100644 index 00000000..247fe0d5 --- /dev/null +++ b/lib/dvb_si/group_descriptor.h @@ -0,0 +1,34 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_group_descriptor_h__ +#define __dvb_descriptor_group_descriptor_h__ + +#include "descriptor.h" + +/* 0x91 */ +class GroupDescriptor : public Descriptor +{ + public: + GroupDescriptor(const uint8_t * const buffer); +}; + +#endif /* __dvb_descriptor_group_descriptor_h__ */ diff --git a/lib/dvb_si/hierarchy_descriptor.h b/lib/dvb_si/hierarchy_descriptor.h new file mode 100644 index 00000000..a1bb9d43 --- /dev/null +++ b/lib/dvb_si/hierarchy_descriptor.h @@ -0,0 +1,48 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_hierarchy_descriptor_h__ +#define __dvb_descriptor_hierarchy_descriptor_h__ + +#include "descriptor.h" + +class HierarchyDescriptor : public Descriptor +{ + protected: + unsigned reserved : 4; + unsigned hierarchyType : 4; + unsigned reserved2 : 2; + unsigned hierarchyLayerIndex : 6; + unsigned reserved3 : 2; + unsigned hierarchyEmbeddedLayerIndex : 6; + unsigned reserved4 : 2; + unsigned hierarchyChannel : 6; + + private: + HierarchyDescriptor(const uint8_t * const buffer); + + uint8_t getHierarchyType(void) const; + uint8_t getHierarchyLayerIndex(void) const; + uint8_t getHierarchyEmbeddedLayerIndex(void) const; + uint8_t getHierarchyChannel(void) const; +}; + +#endif /* __dvb_descriptor_hierarchy_descriptor_h__ */ diff --git a/lib/dvb_si/ibp_descriptor.h b/lib/dvb_si/ibp_descriptor.h new file mode 100644 index 00000000..b0ba8762 --- /dev/null +++ b/lib/dvb_si/ibp_descriptor.h @@ -0,0 +1,42 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_ibp_descriptor_h__ +#define __dvb_descriptor_ibp_descriptor_h__ + +#include "descriptor.h" + +class IbpDescriptor : public Descriptor +{ + protected: + unsigned closedGopFlag : 1; + unsigned identicalGopFlag : 1; + unsigned maxGopLength : 14; + + public: + IbpDescriptor(const uint8_t * const buffer); + + uint8_t getClosedGopFlag(void) const; + uint8_t getIdenticalGopFlag(void) const; + uint16_t getMaxGopLength(void) const; +}; + +#endif /* __dvb_descriptor_ibp_descriptor_h__ */ diff --git a/lib/dvb_si/ippv_booking_descriptor.h b/lib/dvb_si/ippv_booking_descriptor.h new file mode 100644 index 00000000..1a5005cc --- /dev/null +++ b/lib/dvb_si/ippv_booking_descriptor.h @@ -0,0 +1,34 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_ippv_booking_descriptor_h__ +#define __dvb_descriptor_ippv_booking_descriptor_h__ + +#include "descriptor.h" + +/* 0x81 */ +class IppvBookingDescriptor : public Descriptor +{ + public: + IppvBookingDescriptor(const uint8_t * const buffer); +}; + +#endif /* __dvb_descriptor_ippv_booking_descriptor_h__ */ diff --git a/lib/dvb_si/ippv_descriptor.h b/lib/dvb_si/ippv_descriptor.h new file mode 100644 index 00000000..0244f1c1 --- /dev/null +++ b/lib/dvb_si/ippv_descriptor.h @@ -0,0 +1,62 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_ippv_descriptor_h__ +#define __dvb_descriptor_ippv_descriptor_h__ + +#include "descriptor.h" + +/* 0xF0 */ +class CurrencyEntry +{ + public: + CurrencyEntry(const uint8_t * const buffer); +}; + +class CountryEntry +{ + protected: + unsigned country : 24; + unsigned unknown : 5; + unsigned currencyAndCostDetail : 3; + // if (currencyAndCostDetail & 1) + unsigned bcdCost : 32; + unsigned length : 8; + std::vector<CurrencyEntry *> currency; + + public: + CountryEntry(const uint8_t * const buffer); +}; + +class IppvDescriptor : public Descriptor +{ + protected: + unsigned unknown1 : 16; + unsigned unknown2 : 16; + unsigned unknown3 : 16; + unsigned IppvEventId : 16; + std::vector<CountryEntry *> country; + + private: + IppvDescriptor(const uint8_t * const buffer); +}; + +#endif /* __dvb_descriptor_ippv_descriptor_h__ */ diff --git a/lib/dvb_si/iso639_language_descriptor.cpp b/lib/dvb_si/iso639_language_descriptor.cpp new file mode 100644 index 00000000..8b22ba20 --- /dev/null +++ b/lib/dvb_si/iso639_language_descriptor.cpp @@ -0,0 +1,56 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/iso639_language_descriptor.h> + +Iso639Language::Iso639Language(const uint8_t * const buffer) +{ + iso639LanguageCode.assign((char *)&buffer[0], 3); + audioType = buffer[3]; +} + +std::string Iso639Language::getIso639LanguageCode(void) const +{ + return iso639LanguageCode; +} + +uint8_t Iso639Language::getAudioType(void) const +{ + return audioType; +} + +Iso639LanguageDescriptor::Iso639LanguageDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + for (uint16_t i = 0; i < descriptorLength; i += 4) + iso639Languages.push_back(new Iso639Language(&buffer[i + 2])); +} + +Iso639LanguageDescriptor::~Iso639LanguageDescriptor(void) +{ + for (Iso639LanguageIterator i = iso639Languages.begin(); i != iso639Languages.end(); ++i) + delete *i; +} + +const Iso639LanguageVector *Iso639LanguageDescriptor::getIso639Languages(void) const +{ + return &iso639Languages; +} + diff --git a/lib/dvb_si/iso639_language_descriptor.h b/lib/dvb_si/iso639_language_descriptor.h new file mode 100644 index 00000000..a232a2dc --- /dev/null +++ b/lib/dvb_si/iso639_language_descriptor.h @@ -0,0 +1,56 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_iso639_language_descriptor_h__ +#define __dvb_descriptor_iso639_language_descriptor_h__ + +#include "descriptor.h" + +class Iso639Language +{ + protected: + std::string iso639LanguageCode; + unsigned audioType : 8; + + public: + Iso639Language(const uint8_t * const buffer); + + std::string getIso639LanguageCode(void) const; + uint8_t getAudioType(void) const; +}; + +typedef std::vector<Iso639Language *> Iso639LanguageVector; +typedef Iso639LanguageVector::iterator Iso639LanguageIterator; +typedef Iso639LanguageVector::const_iterator Iso639LanguageConstIterator; + +class Iso639LanguageDescriptor : public Descriptor +{ + protected: + Iso639LanguageVector iso639Languages; + + public: + Iso639LanguageDescriptor(const uint8_t * const buffer); + ~Iso639LanguageDescriptor(void); + + const Iso639LanguageVector *getIso639Languages(void) const; +}; + +#endif /* __dvb_descriptor_iso639_language_descriptor_h__ */ diff --git a/lib/dvb_si/linkage_descriptor.cpp b/lib/dvb_si/linkage_descriptor.cpp new file mode 100644 index 00000000..a93d839b --- /dev/null +++ b/lib/dvb_si/linkage_descriptor.cpp @@ -0,0 +1,107 @@ +/* + * $Id$ + * + * (C) 2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/linkage_descriptor.h> + +LinkageDescriptor::LinkageDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + transportStreamId = (buffer[2] << 8) | buffer[3]; + originalNetworkId = (buffer[4] << 8) | buffer[5]; + serviceId = (buffer[6] << 8) | buffer[7]; + linkageType = buffer[8]; + + if (linkageType != 0x08) + { + if (descriptorLength < 7) + return; + + for (uint16_t i = 0; i < descriptorLength - 7; ++i) + privateDataBytes.push_back(buffer[i + 9]); + } + + else { + handOverType = (buffer[9] >> 4) & 0x0f; + reserved = (buffer[9] >> 1) & 0x07; + originType = buffer[9] & 0x01; + + uint8_t offset = 0; + + if ((handOverType >= 0x01) && (handOverType <= 0x03)) { + networkId = (buffer[10] << 8) | buffer[11]; + offset += 2; + } + + if (originType == 0x00) { + initialServiceId = (buffer[offset + 10] << 8) | buffer[offset + 11]; + offset += 2; + } + + if (descriptorLength >= (unsigned)(offset+8)) + for (uint16_t i = 0; i < descriptorLength - (offset + 8); ++i) + privateDataBytes.push_back(buffer[i + offset + 10]); + } +} + +uint16_t LinkageDescriptor::getTransportStreamId(void) const +{ + return transportStreamId; +} + +uint16_t LinkageDescriptor::getOriginalNetworkId(void) const +{ + return originalNetworkId; +} + +uint16_t LinkageDescriptor::getServiceId(void) const +{ + return serviceId; +} + +uint8_t LinkageDescriptor::getLinkageType(void) const +{ + return linkageType; +} + +const PrivateDataByteVector *LinkageDescriptor::getPrivateDataBytes(void) const +{ + return &privateDataBytes; +} + +uint8_t LinkageDescriptor::getHandOverType(void) const +{ + return handOverType; +} + +uint8_t LinkageDescriptor::getOriginType(void) const +{ + return originType; +} + +uint16_t LinkageDescriptor::getNetworkId(void) const +{ + return networkId; +} + +uint16_t LinkageDescriptor::getInitialServiceId(void) const +{ + return initialServiceId; +} + diff --git a/lib/dvb_si/linkage_descriptor.h b/lib/dvb_si/linkage_descriptor.h new file mode 100644 index 00000000..72669d1c --- /dev/null +++ b/lib/dvb_si/linkage_descriptor.h @@ -0,0 +1,59 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_linkage_descriptor_h__ +#define __dvb_descriptor_linkage_descriptor_h__ + +#include "descriptor.h" + +typedef std::vector<uint8_t> PrivateDataByteVector; +typedef PrivateDataByteVector::iterator PrivateDataByteIterator; +typedef PrivateDataByteVector::const_iterator PrivateDataByteConstIterator; + +class LinkageDescriptor : public Descriptor +{ + protected: + unsigned transportStreamId : 16; + unsigned originalNetworkId : 16; + unsigned serviceId : 16; + unsigned linkageType : 8; + PrivateDataByteVector privateDataBytes; + unsigned handOverType : 4; + unsigned reserved : 3; + unsigned originType : 1; + unsigned networkId : 16; + unsigned initialServiceId : 16; + + public: + LinkageDescriptor(const uint8_t * const buffer); + + uint16_t getTransportStreamId(void) const; + uint16_t getOriginalNetworkId(void) const; + uint16_t getServiceId(void) const; + uint8_t getLinkageType(void) const; + const PrivateDataByteVector *getPrivateDataBytes(void) const; + uint8_t getHandOverType(void) const; + uint8_t getOriginType(void) const; + uint16_t getNetworkId(void) const; + uint16_t getInitialServiceId(void) const; +}; + +#endif /* __dvb_descriptor_linkage_descriptor_h__ */ diff --git a/lib/dvb_si/local_time_offset_descriptor.cpp b/lib/dvb_si/local_time_offset_descriptor.cpp new file mode 100644 index 00000000..e1d6457f --- /dev/null +++ b/lib/dvb_si/local_time_offset_descriptor.cpp @@ -0,0 +1,88 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/local_time_offset_descriptor.h> + +LocalTimeOffset::LocalTimeOffset(const uint8_t * const buffer) +{ + countryCode.assign((char *)&buffer[0], 3); + countryRegionId = (buffer[3] >> 2) & 0x3f; + reserved = (buffer[3] >> 1) & 0x01; + localTimeOffsetPolarity = buffer[3] & 0x01; + localTimeOffset = (buffer[4] << 8) | buffer[5]; + timeOfChangeMjd = (buffer[6] << 8) | buffer[7]; + timeOfChangeBcd = (buffer[8] << 16) | (buffer[9] << 8) | buffer[10]; + nextTimeOffset = (buffer[11] << 8) | buffer[12]; +} + +std::string LocalTimeOffset::getCountryCode(void) const +{ + return countryCode; +} + +uint8_t LocalTimeOffset::getCountryRegionId(void) const +{ + return countryRegionId; +} + +uint8_t LocalTimeOffset::getLocalTimeOffsetPolarity(void) const +{ + return localTimeOffsetPolarity; +} + +uint16_t LocalTimeOffset::getLocalTimeOffset(void) const +{ + return localTimeOffset; +} + +uint16_t LocalTimeOffset::getTimeOfChangeMjd(void) const +{ + return timeOfChangeMjd; +} + +uint32_t LocalTimeOffset::getTimeOfChangeBcd(void) const +{ + return timeOfChangeBcd; +} + +uint16_t LocalTimeOffset::getNextTimeOffset(void) const +{ + return nextTimeOffset; +} + +LocalTimeOffsetDescriptor::LocalTimeOffsetDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + for (uint16_t i = 0; i < descriptorLength; i += 13) + localTimeOffsets.push_back(new LocalTimeOffset(&buffer[i + 2])); +} + + +LocalTimeOffsetDescriptor::~LocalTimeOffsetDescriptor(void) +{ + for (LocalTimeOffsetIterator i = localTimeOffsets.begin(); i != localTimeOffsets.end(); ++i) + delete *i; +} + +const LocalTimeOffsetVector *LocalTimeOffsetDescriptor::getLocalTimeOffsets(void) const +{ + return &localTimeOffsets; +} + diff --git a/lib/dvb_si/local_time_offset_descriptor.h b/lib/dvb_si/local_time_offset_descriptor.h new file mode 100644 index 00000000..0992a728 --- /dev/null +++ b/lib/dvb_si/local_time_offset_descriptor.h @@ -0,0 +1,67 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_local_time_offset_descriptor_h__ +#define __dvb_descriptor_local_time_offset_descriptor_h__ + +#include "descriptor.h" + +class LocalTimeOffset +{ + protected: + std::string countryCode; + unsigned countryRegionId : 6; + unsigned reserved : 1; + unsigned localTimeOffsetPolarity : 1; + unsigned localTimeOffset : 16; + unsigned timeOfChangeMjd : 16; + unsigned timeOfChangeBcd : 24; + unsigned nextTimeOffset : 16; + + public: + LocalTimeOffset(const uint8_t * const buffer); + + std::string getCountryCode(void) const; + uint8_t getCountryRegionId(void) const; + uint8_t getLocalTimeOffsetPolarity(void) const; + uint16_t getLocalTimeOffset(void) const; + uint16_t getTimeOfChangeMjd(void) const; + uint32_t getTimeOfChangeBcd(void) const; + uint16_t getNextTimeOffset(void) const; +}; + +typedef std::vector<LocalTimeOffset *> LocalTimeOffsetVector; +typedef LocalTimeOffsetVector::iterator LocalTimeOffsetIterator; +typedef LocalTimeOffsetVector::const_iterator LocalTimeOffsetConstIterator; + +class LocalTimeOffsetDescriptor : public Descriptor +{ + protected: + LocalTimeOffsetVector localTimeOffsets; + + public: + LocalTimeOffsetDescriptor(const uint8_t * const buffer); + ~LocalTimeOffsetDescriptor(void); + + const LocalTimeOffsetVector *getLocalTimeOffsets(void) const; +}; + +#endif /* __dvb_descriptor_local_time_offset_descriptor_h__ */ diff --git a/lib/dvb_si/long_crc_table.cpp b/lib/dvb_si/long_crc_table.cpp new file mode 100644 index 00000000..b3b6ecbd --- /dev/null +++ b/lib/dvb_si/long_crc_table.cpp @@ -0,0 +1,36 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/long_crc_table.h> + +LongCrcTable::LongCrcTable(const uint8_t * const buffer) : LongTable(buffer) +{ + crc32 = (buffer[sectionLength - 1] << 24) | + (buffer[sectionLength + 0] << 16) | + (buffer[sectionLength + 1] << 8) | + (buffer[sectionLength + 2]); +} + +uint32_t LongCrcTable::getCrc32(void) const +{ + return crc32; +} + diff --git a/lib/dvb_si/long_crc_table.h b/lib/dvb_si/long_crc_table.h new file mode 100644 index 00000000..28f4a7b7 --- /dev/null +++ b/lib/dvb_si/long_crc_table.h @@ -0,0 +1,44 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_table_long_crc_table_h__ +#define __dvb_table_long_crc_table_h__ + +#include "long_table.h" + +class LongCrcTable : public LongTable +{ + protected: + unsigned crc32 : 32; + + public: + LongCrcTable(const uint8_t * const buffer); + + static const uint8_t CRC32 = 1; + + uint32_t getCrc32(void) const; +}; + +typedef std::vector<LongCrcTable *> LongCrcTableVector; +typedef LongCrcTableVector::iterator LongCrcTableIterator; +typedef LongCrcTableVector::const_iterator LongCrcTableConstIterator; + +#endif /* __dvb_table_long_crc_table_h__ */ diff --git a/lib/dvb_si/long_table.cpp b/lib/dvb_si/long_table.cpp new file mode 100644 index 00000000..9fca910b --- /dev/null +++ b/lib/dvb_si/long_table.cpp @@ -0,0 +1,88 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/long_table.h> + +LongTable::LongTable(const uint8_t * const buffer) : ShortTable(buffer) +{ + tableIdExtension = (buffer[3] << 8) | buffer[4]; + reserved3 = (buffer[5] >> 6) & 0x03; + versionNumber = (buffer[5] >> 1) & 0x1F; + currentNextIndicator = buffer[5] & 0x01; + sectionNumber = buffer[6]; + lastSectionNumber = buffer[7]; +} + +uint16_t LongTable::getTableIdExtension(void) const +{ + return tableIdExtension; +} + +uint8_t LongTable::getVersionNumber(void) const +{ + return versionNumber; +} + +uint8_t LongTable::getCurrentNextIndicator(void) const +{ + return currentNextIndicator; +} + +uint8_t LongTable::getSectionNumber(void) const +{ + return sectionNumber; +} + +uint8_t LongTable::getLastSectionNumber(void) const +{ + return lastSectionNumber; +} + +bool LongTable::operator< (const LongTable &t) const +{ + return (sectionNumber < t.sectionNumber); +} + +bool LongTable::operator> (const LongTable &t) const +{ + return (sectionNumber > t.sectionNumber); +} + +bool LongTable::operator<= (const LongTable &t) const +{ + return (sectionNumber <= t.sectionNumber); +} + +bool LongTable::operator>= (const LongTable &t) const +{ + return (sectionNumber >= t.sectionNumber); +} + +bool LongTable::operator== (const LongTable &t) const +{ + return (sectionNumber == t.sectionNumber); +} + +bool LongTable::operator!= (const LongTable &t) const +{ + return (sectionNumber != t.sectionNumber); +} + diff --git a/lib/dvb_si/long_table.h b/lib/dvb_si/long_table.h new file mode 100644 index 00000000..25cb8357 --- /dev/null +++ b/lib/dvb_si/long_table.h @@ -0,0 +1,60 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_table_long_table_h__ +#define __dvb_table_long_table_h__ + +#include "short_table.h" + +class LongTable : public ShortTable +{ + protected: + unsigned tableIdExtension : 16; + unsigned reserved3 : 2; + unsigned versionNumber : 5; + unsigned currentNextIndicator : 1; + unsigned sectionNumber : 8; + unsigned lastSectionNumber : 8; + + public: + LongTable(const uint8_t * const buffer); + + static const uint8_t SYNTAX = 1; + + uint16_t getTableIdExtension(void) const; + uint8_t getVersionNumber(void) const; + uint8_t getCurrentNextIndicator(void) const; + uint8_t getSectionNumber(void) const; + uint8_t getLastSectionNumber(void) const; + + bool operator< (const LongTable &t) const; + bool operator> (const LongTable &t) const; + bool operator<= (const LongTable &t) const; + bool operator>= (const LongTable &t) const; + bool operator== (const LongTable &t) const; + bool operator!= (const LongTable &t) const; +}; + +typedef std::vector<LongTable *> LongTableVector; +typedef LongTableVector::iterator LongTableIterator; +typedef LongTableVector::const_iterator LongTableConstIterator; + +#endif /* __dvb_table_long_table_h__ */ diff --git a/lib/dvb_si/maximum_bitrate_descriptor.h b/lib/dvb_si/maximum_bitrate_descriptor.h new file mode 100644 index 00000000..b9e933c6 --- /dev/null +++ b/lib/dvb_si/maximum_bitrate_descriptor.h @@ -0,0 +1,39 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_maximum_bitrate_descriptor_h__ +#define __dvb_descriptor_maximum_bitrate_descriptor_h__ + +#include "descriptor.h" + +class MaximumBitrateDescriptor : public Descriptor +{ + protected: + unsigned reserved : 2; + unsigned maximumBitrate : 22; + + public: + MaximumBitrateDescriptor(const uint8_t * const buffer); + + uint32_t getMaximumBitrate(void) const; +}; + +#endif /* __dvb_descriptor_maximum_bitrate_descriptor_h__ */ diff --git a/lib/dvb_si/mosaic_descriptor.cpp b/lib/dvb_si/mosaic_descriptor.cpp new file mode 100644 index 00000000..b414186a --- /dev/null +++ b/lib/dvb_si/mosaic_descriptor.cpp @@ -0,0 +1,171 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/mosaic_descriptor.h> + +ElementaryCellField::ElementaryCellField (const uint8_t * const buffer) +{ + reserved = (buffer[0] >> 6) & 0x03; + elementaryCellId = buffer[0] & 0x3F; +} + +uint8_t ElementaryCellField::getElementaryCellId(void) const +{ + return elementaryCellId; +} + +MosaicCell::MosaicCell (const uint8_t * const buffer) +{ + logicalCellId = (buffer[0] >> 2) & 0x3F; + reserved = (((buffer[0] & 0x03) << 8) | (buffer[1] & 0xF1)) >> 3; + logicalCellPresentationInfo = buffer[1] & 0x07; + elementaryCellFieldLength = buffer[2]; + + for (uint16_t i = 0; i < elementaryCellFieldLength; ++i) + elementaryCellFields.push_back(new ElementaryCellField(&buffer[i + 3])); + + cellLinkageInfo = buffer[elementaryCellFieldLength + 3]; + + switch (cellLinkageInfo) { + case 0x01: + bouquetId = (buffer[elementaryCellFieldLength + 4] << 8) | buffer[elementaryCellFieldLength + 5]; + break; + case 0x02: + case 0x03: + case 0x04: + originalNetworkId = (buffer[elementaryCellFieldLength + 4] << 8) | buffer[elementaryCellFieldLength + 5]; + transportStreamId = (buffer[elementaryCellFieldLength + 6] << 8) | buffer[elementaryCellFieldLength + 7]; + serviceId = (buffer[elementaryCellFieldLength + 8] << 8) | buffer[elementaryCellFieldLength + 9]; + break; + default: + break; + } + + if (cellLinkageInfo == 0x04) + eventId = (buffer[elementaryCellFieldLength + 10] << 8) | buffer[elementaryCellFieldLength + 11]; +} + +MosaicCell::~MosaicCell(void) +{ + for (ElementaryCellFieldIterator i = elementaryCellFields.begin(); i != elementaryCellFields.end(); ++i) + delete *i; +} + +uint8_t MosaicCell::getLogicalCellId(void) const +{ + return logicalCellId; +} + +uint8_t MosaicCell::getLogicalCellPresentationInfo(void) const +{ + return logicalCellPresentationInfo; +} + +const ElementaryCellFieldVector *MosaicCell::getElementaryCellFields(void) const +{ + return &elementaryCellFields; +} + +uint8_t MosaicCell::getCellLinkageInfo(void) const +{ + return cellLinkageInfo; +} + +uint16_t MosaicCell::getBouquetId(void) const +{ + return bouquetId; +} + +uint16_t MosaicCell::getOriginalNetworkId(void) const +{ + return originalNetworkId; +} + +uint16_t MosaicCell::getTransportStreamId(void) const +{ + return transportStreamId; +} + +uint16_t MosaicCell::getServiceId(void) const +{ + return serviceId; +} + +uint16_t MosaicCell::getEventId(void) const +{ + return eventId; +} + +MosaicDescriptor::MosaicDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + if (descriptorLength < 1) + return; + + mosaicEntryPoint = (buffer[2] >> 7) & 0x01; + numberOfHorizontalElementaryCells = (buffer[2] >> 4) & 0x07; + reserved = (buffer[2] >> 3) & 0x01; + numberOfVerticalElementaryCells = buffer[2] & 0x07; + + for (uint16_t i = 0; i < descriptorLength - 1; i += buffer[i + 6] + 2) { + mosaicCells.push_back(new MosaicCell(&buffer[i + 1])); + switch (buffer[i + 6 + buffer[i + 6] + 1]) { + case 0x01: + i += 2; + break; + case 0x02: + case 0x03: + i += 6; + break; + case 0x04: + i += 8; + break; + default: + break; + } + } +} + +MosaicDescriptor::~MosaicDescriptor(void) +{ + for (MosaicCellIterator i = mosaicCells.begin(); i != mosaicCells.end(); ++i) + delete *i; +} + +uint8_t MosaicDescriptor::getMosaicEntryPoint(void) const +{ + return mosaicEntryPoint; +} + +uint8_t MosaicDescriptor::getNumberOfHorizontalElementaryCells(void) const +{ + return numberOfHorizontalElementaryCells; +} + +uint8_t MosaicDescriptor::getNumberOfVerticalElementaryCells(void) const +{ + return numberOfVerticalElementaryCells; +} + +const MosaicCellVector *MosaicDescriptor::getMosaicCells(void) const +{ + return &mosaicCells; +} + diff --git a/lib/dvb_si/mosaic_descriptor.h b/lib/dvb_si/mosaic_descriptor.h new file mode 100644 index 00000000..43769c01 --- /dev/null +++ b/lib/dvb_si/mosaic_descriptor.h @@ -0,0 +1,96 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_mosaic_descriptor_h__ +#define __dvb_descriptor_mosaic_descriptor_h__ + +#include "descriptor.h" + +class ElementaryCellField +{ + protected: + unsigned reserved : 2; + unsigned elementaryCellId : 6; + + public: + ElementaryCellField(const uint8_t * const buffer); + + uint8_t getElementaryCellId(void) const; +}; + +typedef std::vector<ElementaryCellField *> ElementaryCellFieldVector; +typedef ElementaryCellFieldVector::iterator ElementaryCellFieldIterator; +typedef ElementaryCellFieldVector::const_iterator ElementaryCellFieldConstIterator; + +class MosaicCell +{ + protected: + unsigned logicalCellId : 6; + unsigned reserved : 7; + unsigned logicalCellPresentationInfo : 3; + unsigned elementaryCellFieldLength : 8; + ElementaryCellFieldVector elementaryCellFields; + unsigned cellLinkageInfo : 8; + unsigned bouquetId : 16; + unsigned originalNetworkId : 16; + unsigned transportStreamId : 16; + unsigned serviceId : 16; + unsigned eventId : 16; + + public: + MosaicCell(const uint8_t * const buffer); + ~MosaicCell(void); + + uint8_t getLogicalCellId(void) const; + uint8_t getLogicalCellPresentationInfo(void) const; + const ElementaryCellFieldVector *getElementaryCellFields(void) const; + uint8_t getCellLinkageInfo(void) const; + uint16_t getBouquetId(void) const; + uint16_t getOriginalNetworkId(void) const; + uint16_t getTransportStreamId(void) const; + uint16_t getServiceId(void) const; + uint16_t getEventId(void) const; +}; + +typedef std::vector<MosaicCell *> MosaicCellVector; +typedef MosaicCellVector::iterator MosaicCellIterator; +typedef MosaicCellVector::const_iterator MosaicCellConstIterator; + +class MosaicDescriptor : public Descriptor +{ + protected: + unsigned mosaicEntryPoint : 1; + unsigned numberOfHorizontalElementaryCells : 3; + unsigned reserved : 1; + unsigned numberOfVerticalElementaryCells : 3; + MosaicCellVector mosaicCells; + + public: + MosaicDescriptor(const uint8_t * const buffer); + ~MosaicDescriptor(void); + + uint8_t getMosaicEntryPoint(void) const; + uint8_t getNumberOfHorizontalElementaryCells(void) const; + uint8_t getNumberOfVerticalElementaryCells(void) const; + const MosaicCellVector *getMosaicCells(void) const; +}; + +#endif /* __dvb_descriptor_mosaic_descriptor_h__ */ diff --git a/lib/dvb_si/multilingual_bouquet_name_descriptor.cpp b/lib/dvb_si/multilingual_bouquet_name_descriptor.cpp new file mode 100644 index 00000000..1fa66df6 --- /dev/null +++ b/lib/dvb_si/multilingual_bouquet_name_descriptor.cpp @@ -0,0 +1,57 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/multilingual_bouquet_name_descriptor.h> + +MultilingualBouquetName::MultilingualBouquetName(const uint8_t * const buffer) +{ + iso639LanguageCode.assign((char *)&buffer[0], 3); + bouquetNameLength = buffer[3]; + bouquetName.assign((char *)&buffer[4], bouquetNameLength); +} + +std::string MultilingualBouquetName::getIso639LanguageCode(void) const +{ + return iso639LanguageCode; +} + +std::string MultilingualBouquetName::getBouquetName(void) const +{ + return bouquetName; +} + +MultilingualBouquetNameDescriptor::MultilingualBouquetNameDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + for (uint16_t i = 0; i < descriptorLength; i += buffer[i + 3] + 2) + multilingualBouquetNames.push_back(new MultilingualBouquetName(&buffer[i + 2])); +} + +MultilingualBouquetNameDescriptor::~MultilingualBouquetNameDescriptor(void) +{ + for (MultilingualBouquetNameIterator i = multilingualBouquetNames.begin(); i != multilingualBouquetNames.end(); ++i) + delete *i; +} + +const MultilingualBouquetNameVector *MultilingualBouquetNameDescriptor::getMultilingualBouquetNames(void) const +{ + return &multilingualBouquetNames; +} + diff --git a/lib/dvb_si/multilingual_bouquet_name_descriptor.h b/lib/dvb_si/multilingual_bouquet_name_descriptor.h new file mode 100644 index 00000000..f7cef6a0 --- /dev/null +++ b/lib/dvb_si/multilingual_bouquet_name_descriptor.h @@ -0,0 +1,57 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_multilingual_bouquet_name_descriptor_h__ +#define __dvb_descriptor_multilingual_bouquet_name_descriptor_h__ + +#include "descriptor.h" + +class MultilingualBouquetName +{ + protected: + std::string iso639LanguageCode; + unsigned bouquetNameLength : 8; + std::string bouquetName; + + public: + MultilingualBouquetName(const uint8_t * const buffer); + + std::string getIso639LanguageCode(void) const; + std::string getBouquetName(void) const; +}; + +typedef std::vector<MultilingualBouquetName *> MultilingualBouquetNameVector; +typedef MultilingualBouquetNameVector::iterator MultilingualBouquetNameIterator; +typedef MultilingualBouquetNameVector::const_iterator MultilingualBouquetNameConstIterator; + +class MultilingualBouquetNameDescriptor : public Descriptor +{ + protected: + MultilingualBouquetNameVector multilingualBouquetNames; + + public: + MultilingualBouquetNameDescriptor(const uint8_t * const buffer); + ~MultilingualBouquetNameDescriptor(void); + + const MultilingualBouquetNameVector *getMultilingualBouquetNames(void) const; +}; + +#endif /* __dvb_descriptor_multilingual_bouquet_name_descriptor_h__ */ diff --git a/lib/dvb_si/multilingual_component_descriptor.cpp b/lib/dvb_si/multilingual_component_descriptor.cpp new file mode 100644 index 00000000..664718f4 --- /dev/null +++ b/lib/dvb_si/multilingual_component_descriptor.cpp @@ -0,0 +1,64 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/multilingual_component_descriptor.h> + +MultilingualComponent::MultilingualComponent(const uint8_t * const buffer) +{ + iso639LanguageCode.assign((char *)&buffer[0], 3); + textDescriptionLength = buffer[3]; + text.assign((char *)&buffer[4], textDescriptionLength); +} + +std::string MultilingualComponent::getIso639LanguageCode(void) const +{ + return iso639LanguageCode; +} + +std::string MultilingualComponent::getText(void) const +{ + return text; +} + +MultilingualComponentDescriptor::MultilingualComponentDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + componentTag = buffer[2]; + + for (uint16_t i = 0; i < descriptorLength - 1; i += buffer[i + 4] + 2) + multilingualComponents.push_back(new MultilingualComponent(&buffer[i + 3])); +} + +MultilingualComponentDescriptor::~MultilingualComponentDescriptor(void) +{ + for (MultilingualComponentIterator i = multilingualComponents.begin(); i != multilingualComponents.end(); ++i) + delete *i; +} + +uint8_t MultilingualComponentDescriptor::getComponentTag(void) const +{ + return componentTag; +} + +const MultilingualComponentVector *MultilingualComponentDescriptor::getMultilingualComponents(void) const +{ + return &multilingualComponents; +} + diff --git a/lib/dvb_si/multilingual_component_descriptor.h b/lib/dvb_si/multilingual_component_descriptor.h new file mode 100644 index 00000000..e0c1b317 --- /dev/null +++ b/lib/dvb_si/multilingual_component_descriptor.h @@ -0,0 +1,59 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_multilingual_component_descriptor_h__ +#define __dvb_descriptor_multilingual_component_descriptor_h__ + +#include "descriptor.h" + +class MultilingualComponent +{ + protected: + std::string iso639LanguageCode; + unsigned textDescriptionLength : 8; + std::string text; + + public: + MultilingualComponent(const uint8_t * const buffer); + + std::string getIso639LanguageCode(void) const; + std::string getText(void) const; +}; + +typedef std::vector<MultilingualComponent *> MultilingualComponentVector; +typedef MultilingualComponentVector::iterator MultilingualComponentIterator; +typedef MultilingualComponentVector::const_iterator MultilingualComponentConstIterator; + +class MultilingualComponentDescriptor : public Descriptor +{ + protected: + unsigned componentTag : 8; + MultilingualComponentVector multilingualComponents; + + public: + MultilingualComponentDescriptor(const uint8_t * const buffer); + ~MultilingualComponentDescriptor(void); + + uint8_t getComponentTag(void) const; + const MultilingualComponentVector *getMultilingualComponents(void) const; +}; + +#endif /* __dvb_descriptor_multilingual_component_descriptor_h__ */ diff --git a/lib/dvb_si/multilingual_network_name_descriptor.cpp b/lib/dvb_si/multilingual_network_name_descriptor.cpp new file mode 100644 index 00000000..59bc0e46 --- /dev/null +++ b/lib/dvb_si/multilingual_network_name_descriptor.cpp @@ -0,0 +1,57 @@ +/* + * $Id$ + * + * (C) 2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/multilingual_network_name_descriptor.h> + +MultilingualNetworkName::MultilingualNetworkName(const uint8_t * const buffer) +{ + iso639LanguageCode.assign((char *)&buffer[0], 3); + networkNameLength = buffer[3]; + networkName.assign((char *)&buffer[4], networkNameLength); +} + +std::string MultilingualNetworkName::getIso639LanguageCode(void) const +{ + return iso639LanguageCode; +} + +std::string MultilingualNetworkName::getNetworkName(void) const +{ + return networkName; +} + +MultilingualNetworkNameDescriptor::MultilingualNetworkNameDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + for (uint16_t i = 0; i < descriptorLength; i += buffer[i + 5] + 4) + multilingualNetworkNames.push_back(new MultilingualNetworkName(&buffer[i + 2])); +} + +MultilingualNetworkNameDescriptor::~MultilingualNetworkNameDescriptor(void) +{ + for (MultilingualNetworkNameIterator i = multilingualNetworkNames.begin(); i != multilingualNetworkNames.end(); ++i) + delete *i; +} + +const MultilingualNetworkNameVector *MultilingualNetworkNameDescriptor::getMultilingualNetworkNames(void) const +{ + return &multilingualNetworkNames; +} + diff --git a/lib/dvb_si/multilingual_network_name_descriptor.h b/lib/dvb_si/multilingual_network_name_descriptor.h new file mode 100644 index 00000000..62c7960c --- /dev/null +++ b/lib/dvb_si/multilingual_network_name_descriptor.h @@ -0,0 +1,57 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_multilingual_network_name_descriptor_h__ +#define __dvb_descriptor_multilingual_network_name_descriptor_h__ + +#include "descriptor.h" + +class MultilingualNetworkName +{ + protected: + std::string iso639LanguageCode; + unsigned networkNameLength : 8; + std::string networkName; + + public: + MultilingualNetworkName(const uint8_t * const buffer); + + std::string getIso639LanguageCode(void) const; + std::string getNetworkName(void) const; +}; + +typedef std::vector<MultilingualNetworkName *> MultilingualNetworkNameVector; +typedef MultilingualNetworkNameVector::iterator MultilingualNetworkNameIterator; +typedef MultilingualNetworkNameVector::const_iterator MultilingualNetworkNameConstIterator; + +class MultilingualNetworkNameDescriptor : public Descriptor +{ + protected: + MultilingualNetworkNameVector multilingualNetworkNames; + + public: + MultilingualNetworkNameDescriptor(const uint8_t * const buffer); + ~MultilingualNetworkNameDescriptor(void); + + const MultilingualNetworkNameVector *getMultilingualNetworkNames(void) const; +}; + +#endif /* __dvb_descriptor_multilingual_network_name_descriptor_h__ */ diff --git a/lib/dvb_si/multilingual_service_name_descriptor.cpp b/lib/dvb_si/multilingual_service_name_descriptor.cpp new file mode 100644 index 00000000..e4931f76 --- /dev/null +++ b/lib/dvb_si/multilingual_service_name_descriptor.cpp @@ -0,0 +1,68 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/multilingual_service_name_descriptor.h> + +MultilingualServiceName::MultilingualServiceName(const uint8_t * const buffer) +{ + iso639LanguageCode.assign((char *)&buffer[0], 3); + serviceProviderNameLength = buffer[3]; + serviceProviderName.assign((char *)&buffer[4], serviceProviderNameLength); + serviceNameLength = buffer[serviceProviderNameLength + 4]; + serviceName.assign((char *)&buffer[serviceProviderNameLength + 5], serviceNameLength); +} + +std::string MultilingualServiceName::getIso639LanguageCode(void) const +{ + return iso639LanguageCode; +} + +std::string MultilingualServiceName::getServiceProviderName(void) const +{ + return serviceProviderName; +} + +std::string MultilingualServiceName::getServiceName(void) const +{ + return serviceName; +} + +MultilingualServiceNameDescriptor::MultilingualServiceNameDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + MultilingualServiceName *name; + + for (uint16_t i = 0; i < descriptorLength; i += name->serviceProviderNameLength + name->serviceNameLength + 5) { + name = new MultilingualServiceName(&buffer[i + 2]); + multilingualServiceNames.push_back(name); + } +} + +MultilingualServiceNameDescriptor::~MultilingualServiceNameDescriptor(void) +{ + for (MultilingualServiceNameIterator i = multilingualServiceNames.begin(); i != multilingualServiceNames.end(); ++i) + delete *i; +} + +const MultilingualServiceNameVector *MultilingualServiceNameDescriptor::getMultilingualServiceNames(void) const +{ + return &multilingualServiceNames; +} + diff --git a/lib/dvb_si/multilingual_service_name_descriptor.h b/lib/dvb_si/multilingual_service_name_descriptor.h new file mode 100644 index 00000000..a73d9def --- /dev/null +++ b/lib/dvb_si/multilingual_service_name_descriptor.h @@ -0,0 +1,62 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_multilingual_service_name_descriptor_h__ +#define __dvb_descriptor_multilingual_service_name_descriptor_h__ + +#include "descriptor.h" + +class MultilingualServiceName +{ + protected: + std::string iso639LanguageCode; + unsigned serviceProviderNameLength : 8; + std::string serviceProviderName; + unsigned serviceNameLength : 8; + std::string serviceName; + + public: + MultilingualServiceName(const uint8_t * const buffer); + + std::string getIso639LanguageCode(void) const; + std::string getServiceProviderName(void) const; + std::string getServiceName(void) const; + + friend class MultilingualServiceNameDescriptor; +}; + +typedef std::vector<MultilingualServiceName *> MultilingualServiceNameVector; +typedef MultilingualServiceNameVector::iterator MultilingualServiceNameIterator; +typedef MultilingualServiceNameVector::const_iterator MultilingualServiceNameConstIterator; + +class MultilingualServiceNameDescriptor : public Descriptor +{ + protected: + MultilingualServiceNameVector multilingualServiceNames; + + public: + MultilingualServiceNameDescriptor(const uint8_t * const buffer); + ~MultilingualServiceNameDescriptor(void); + + const MultilingualServiceNameVector *getMultilingualServiceNames(void) const; +}; + +#endif /* __dvb_descriptor_multilingual_service_name_descriptor_h__ */ diff --git a/lib/dvb_si/multiplex_buffer_utilization_descriptor.h b/lib/dvb_si/multiplex_buffer_utilization_descriptor.h new file mode 100644 index 00000000..428b6b06 --- /dev/null +++ b/lib/dvb_si/multiplex_buffer_utilization_descriptor.h @@ -0,0 +1,43 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_multiplex_buffer_utilization_descriptor_h__ +#define __dvb_descriptor_multiplex_buffer_utilization_descriptor_h__ + +#include "descriptor.h" + +class MultiplexBufferUtilizationDescriptor : public Descriptor +{ + protected: + unsigned boundValidFlag : 1; + unsigned ltwOffsetLowerBound : 15; + unsigned reserved : 1; + unsigned ltwOffsetUpperBound : 15; + + public: + MultiplexBufferUtilizationDescriptor(const uint8_t * const buffer); + + uint8_t getBoundValidFlag(void) const; + uint16_t getLtwOffsetLowerBound(void) const; + uint16_t getLtwOffsetUpperBound(void) const; +}; + +#endif /* __dvb_descriptor_multiplex_buffer_utilization_descriptor_h__ */ diff --git a/lib/dvb_si/network_name_descriptor.cpp b/lib/dvb_si/network_name_descriptor.cpp new file mode 100644 index 00000000..c7384014 --- /dev/null +++ b/lib/dvb_si/network_name_descriptor.cpp @@ -0,0 +1,33 @@ +/* + * $Id$ + * + * (C) 2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/network_name_descriptor.h> + +NetworkNameDescriptor::NetworkNameDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + networkName.assign((char *)&buffer[2], descriptorLength); +} + +std::string NetworkNameDescriptor::getNetworkName(void) const +{ + return networkName; +} + diff --git a/lib/dvb_si/network_name_descriptor.h b/lib/dvb_si/network_name_descriptor.h new file mode 100644 index 00000000..dd86021d --- /dev/null +++ b/lib/dvb_si/network_name_descriptor.h @@ -0,0 +1,38 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_network_name_descriptor_h__ +#define __dvb_descriptor_network_name_descriptor_h__ + +#include "descriptor.h" + +class NetworkNameDescriptor : public Descriptor +{ + protected: + std::string networkName; + + public: + NetworkNameDescriptor(const uint8_t * const buffer); + + std::string getNetworkName(void) const; +}; + +#endif /* __dvb_descriptor_network_name_descriptor_h__ */ diff --git a/lib/dvb_si/nit.cpp b/lib/dvb_si/nit.cpp new file mode 100644 index 00000000..e02887f2 --- /dev/null +++ b/lib/dvb_si/nit.cpp @@ -0,0 +1,70 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/nit.h> + +TransportStreamInfo::TransportStreamInfo(const uint8_t * const buffer) +{ + transportStreamId = (buffer[0] << 8) | buffer[1]; + originalNetworkId = (buffer[2] << 8) | buffer[3]; + reserved1 = (buffer[4] >> 8) & 0x0F; + transportDescriptorsLength = ((buffer[4] & 0x0F) << 8) | buffer[5]; + + for (uint16_t i = 6; i < transportDescriptorsLength + 6; i += buffer[i + 1] + 2) + descriptor(&buffer[i]); +} + +uint16_t TransportStreamInfo::getTransportStreamId(void) const +{ + return transportStreamId; +} + +uint16_t TransportStreamInfo::getOriginalNetworkId(void) const +{ + return originalNetworkId; +} + +NetworkInformationTable::NetworkInformationTable(const uint8_t * const buffer) : LongCrcTable(buffer) +{ + reserved4 = (buffer[8] >> 5) & 0x0F; + networkDescriptorsLength = ((buffer[8] & 0x0F) << 8) | buffer[9]; + + for (uint16_t i = 10; i < networkDescriptorsLength + 10; i += buffer[i + 1] + 2) + descriptor(&buffer[i]); + + reserved5 = (buffer[networkDescriptorsLength + 10] >> 4) & 0x0F; + transportStreamLoopLength = ((buffer[networkDescriptorsLength + 10] & 0x0F) << 8) | buffer[networkDescriptorsLength + 11]; + + for (uint16_t i = networkDescriptorsLength + 12; i < sectionLength + 3 - 4; i += ((buffer[i + 4] & 0x0F) | buffer[i + 5]) + 6) + tsInfo.push_back(new TransportStreamInfo(&buffer[i])); +} + +NetworkInformationTable::~NetworkInformationTable(void) +{ + for (TransportStreamInfoIterator i = tsInfo.begin(); i != tsInfo.end(); ++i) + delete *i; +} + +const TransportStreamInfoVector *NetworkInformationTable::getTsInfo(void) const +{ + return &tsInfo; +} + diff --git a/lib/dvb_si/nit.h b/lib/dvb_si/nit.h new file mode 100644 index 00000000..e9e7410d --- /dev/null +++ b/lib/dvb_si/nit.h @@ -0,0 +1,71 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_table_nit_h__ +#define __dvb_table_nit_h__ + +#include <lib/dvb_si/container.h> +#include "long_crc_table.h" + +class TransportStreamInfo : public DescriptorContainer +{ + protected: + unsigned transportStreamId : 16; + unsigned originalNetworkId : 16; + unsigned reserved1 : 4; + unsigned transportDescriptorsLength : 12; + + public: + TransportStreamInfo(const uint8_t * const buffer); + + uint16_t getTransportStreamId(void) const; + uint16_t getOriginalNetworkId(void) const; +}; + +typedef std::vector<TransportStreamInfo *> TransportStreamInfoVector; +typedef TransportStreamInfoVector::iterator TransportStreamInfoIterator; +typedef TransportStreamInfoVector::const_iterator TransportStreamInfoConstIterator; + +class NetworkInformationTable : public LongCrcTable, public DescriptorContainer +{ + protected: + unsigned reserved4 : 3; + unsigned networkDescriptorsLength : 12; + unsigned reserved5 : 4; + unsigned transportStreamLoopLength : 12; + TransportStreamInfoVector tsInfo; + + public: + NetworkInformationTable(const uint8_t * const buffer); + ~NetworkInformationTable(void); + + static const enum PacketId PID = PID_NIT; + static const enum TableId TID = TID_NIT_ACTUAL; + static const uint32_t TIMEOUT = 12000; + + const TransportStreamInfoVector *getTsInfo(void) const; +}; + +typedef std::vector<NetworkInformationTable *> NetworkInformationTableVector; +typedef NetworkInformationTableVector::iterator NetworkInformationTableIterator; +typedef NetworkInformationTableVector::const_iterator NetworkInformationTableConstIterator; + +#endif /* __dvb_table_nit_h__ */ diff --git a/lib/dvb_si/nvod_reference_descriptor.cpp b/lib/dvb_si/nvod_reference_descriptor.cpp new file mode 100644 index 00000000..3db6aecb --- /dev/null +++ b/lib/dvb_si/nvod_reference_descriptor.cpp @@ -0,0 +1,63 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/nvod_reference_descriptor.h> + + +NvodReference::NvodReference(const uint8_t * const buffer) +{ + transportStreamId = (buffer[0] << 8) | buffer[1]; + originalNetworkId = (buffer[2] << 8) | buffer[3]; + serviceId = (buffer[4] << 8) | buffer[5]; +} + +uint16_t NvodReference::getTransportStreamId(void) const +{ + return transportStreamId; +} + +uint16_t NvodReference::getOriginalNetworkId(void) const +{ + return originalNetworkId; +} + +uint16_t NvodReference::getServiceId(void) const +{ + return serviceId; +} + +NvodReferenceDescriptor::NvodReferenceDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + for (uint16_t i = 0; i < descriptorLength; i += 6) + nvodReferences.push_back(new NvodReference(&buffer[i + 2])); +} + +NvodReferenceDescriptor::~NvodReferenceDescriptor(void) +{ + for (NvodReferenceIterator i = nvodReferences.begin(); i != nvodReferences.end(); ++i) + delete *i; +} + +const NvodReferenceVector *NvodReferenceDescriptor::getNvodReferences(void) const +{ + return &nvodReferences; +} + diff --git a/lib/dvb_si/nvod_reference_descriptor.h b/lib/dvb_si/nvod_reference_descriptor.h new file mode 100644 index 00000000..64e71f95 --- /dev/null +++ b/lib/dvb_si/nvod_reference_descriptor.h @@ -0,0 +1,58 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_nvod_reference_descriptor_h__ +#define __dvb_descriptor_nvod_reference_descriptor_h__ + +#include "descriptor.h" + +class NvodReference +{ + protected: + unsigned transportStreamId : 16; + unsigned originalNetworkId : 16; + unsigned serviceId : 16; + + public: + NvodReference(const uint8_t * const buffer); + + uint16_t getTransportStreamId(void) const; + uint16_t getOriginalNetworkId(void) const; + uint16_t getServiceId(void) const; +}; + +typedef std::vector<NvodReference *> NvodReferenceVector; +typedef NvodReferenceVector::iterator NvodReferenceIterator; +typedef NvodReferenceVector::const_iterator NvodReferenceConstIterator; + +class NvodReferenceDescriptor : public Descriptor +{ + protected: + NvodReferenceVector nvodReferences; + + public: + NvodReferenceDescriptor(const uint8_t * const buffer); + ~NvodReferenceDescriptor(void); + + const NvodReferenceVector* getNvodReferences(void) const; +}; + +#endif /* __dvb_descriptor_nvod_reference_descriptor_h__ */ diff --git a/lib/dvb_si/packet_id.h b/lib/dvb_si/packet_id.h new file mode 100644 index 00000000..2cccbbf5 --- /dev/null +++ b/lib/dvb_si/packet_id.h @@ -0,0 +1,45 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_id_packet_id_h__ +#define __dvb_id_packet_id_h__ + +enum PacketId { + /* ETSI EN 300 468 V1.5.1 (2003-01) */ + PID_PAT = 0x0000, + PID_CAT = 0x0001, + PID_TSDT = 0x0002, + PID_NIT = 0x0010, + PID_BAT = 0x0011, + PID_SDT = 0x0011, + PID_EIT = 0x0012, + PID_RST = 0x0013, + PID_TDT = 0x0014, + PID_TOT = 0x0014, + PID_NS = 0x0015, /* network synchronization */ + PID_IS = 0x001C, /* inband signaling (SIS-12) */ + PID_M = 0x001D, /* measurement (SIS-10) */ + PID_DIT = 0x001E, + PID_SIT = 0x001F, + PID_RESERVED = 0x1FFF +}; + +#endif /* __dvb_id_packet_id_h__ */ diff --git a/lib/dvb_si/parental_rating_descriptor.cpp b/lib/dvb_si/parental_rating_descriptor.cpp new file mode 100644 index 00000000..243a846d --- /dev/null +++ b/lib/dvb_si/parental_rating_descriptor.cpp @@ -0,0 +1,56 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/parental_rating_descriptor.h> + +ParentalRating::ParentalRating(const uint8_t * const buffer) +{ + countryCode.assign((char *)&buffer[0], 3); + rating = buffer[3]; +} + +std::string ParentalRating::getCountryCode(void) const +{ + return countryCode; +} + +uint8_t ParentalRating::getRating(void) const +{ + return rating; +} + +ParentalRatingDescriptor::ParentalRatingDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + for (uint16_t i = 0; i < descriptorLength; i += 4) + parentalRatings.push_back(new ParentalRating(&buffer[i + 2])); +} + +ParentalRatingDescriptor::~ParentalRatingDescriptor(void) +{ + for (ParentalRatingIterator i = parentalRatings.begin(); i != parentalRatings.end(); ++i) + delete *i; +} + +const ParentalRatingVector *ParentalRatingDescriptor::getParentalRatings(void) const +{ + return &parentalRatings; +} + diff --git a/lib/dvb_si/parental_rating_descriptor.h b/lib/dvb_si/parental_rating_descriptor.h new file mode 100644 index 00000000..1692eb29 --- /dev/null +++ b/lib/dvb_si/parental_rating_descriptor.h @@ -0,0 +1,56 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_parental_rating_descriptor_h__ +#define __dvb_descriptor_parental_rating_descriptor_h__ + +#include "descriptor.h" + +class ParentalRating +{ + protected: + std::string countryCode; + unsigned rating : 8; + + public: + ParentalRating(const uint8_t * const buffer); + + std::string getCountryCode(void) const; + uint8_t getRating(void) const; +}; + +typedef std::vector<ParentalRating *> ParentalRatingVector; +typedef ParentalRatingVector::iterator ParentalRatingIterator; +typedef ParentalRatingVector::const_iterator ParentalRatingConstIterator; + +class ParentalRatingDescriptor : public Descriptor +{ + protected: + ParentalRatingVector parentalRatings; + + public: + ParentalRatingDescriptor(const uint8_t * const buffer); + ~ParentalRatingDescriptor(void); + + const ParentalRatingVector *getParentalRatings(void) const; +}; + +#endif /* __dvb_descriptor_parental_rating_descriptor_h__ */ diff --git a/lib/dvb_si/partial_transport_stream_descriptor.h b/lib/dvb_si/partial_transport_stream_descriptor.h new file mode 100644 index 00000000..8a96d22d --- /dev/null +++ b/lib/dvb_si/partial_transport_stream_descriptor.h @@ -0,0 +1,45 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_partial_transport_stream_descriptor_h__ +#define __dvb_descriptor_partial_transport_stream_descriptor_h__ + +#include "descriptor.h" + +class PartialTransportStreamDescriptor : public Descriptor +{ + protected: + unsigned reserved : 2; + unsigned peakRate : 22; + unsigned reserved2 : 2; + unsigned minimumOverallSmootingRate : 22; + unsigned reserved3 : 2; + unsigned maximumOverallSmoothingBuffer : 14; + + public: + PartialTransportStreamDescriptor(const uint8_t * const buffer); + + uint32_t getPeakRate(void) const; + uint32_t getMinimumOverallSmoothingRate(void) const; + uint16_t getMaximumOverallSmoothingBuffer(void) const; +}; + +#endif /* __dvb_descriptor_partial_transport_stream_descriptor_h__ */ diff --git a/lib/dvb_si/pat.cpp b/lib/dvb_si/pat.cpp new file mode 100644 index 00000000..40d46fbc --- /dev/null +++ b/lib/dvb_si/pat.cpp @@ -0,0 +1,81 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/pat.h> + +NetworkAssociation::NetworkAssociation(const uint8_t * const buffer) +{ + programNumber = (buffer[0] << 8) | buffer[1]; + reserved = (buffer[2] >> 5) & 0x07; + networkPid = ((buffer[2] & 0x1F) << 8) | buffer[3]; +} + +uint16_t NetworkAssociation::getNetworkPid(void) const +{ + return networkPid; +} + +ProgramAssociation::ProgramAssociation(const uint8_t * const buffer) +{ + programNumber = (buffer[0] << 8) | buffer[1]; + reserved = (buffer[2] >> 5) & 0x07; + programMapPid = ((buffer[2] & 0x1F) << 8) | buffer[3]; +} + +uint16_t ProgramAssociation::getProgramNumber(void) const +{ + return programNumber; +} + +uint16_t ProgramAssociation::getProgramMapPid(void) const +{ + return programMapPid; +} + +ProgramAssociationTable::ProgramAssociationTable(const uint8_t * const buffer) : LongCrcTable(buffer) +{ + for (uint16_t i = 8; i < sectionLength - 1; i += 4) { + if (((buffer[i] << 8) | buffer[i + 1]) == 0) + networks.push_back(new NetworkAssociation(&buffer[i])); + else + programs.push_back(new ProgramAssociation(&buffer[i])); + } +} + +ProgramAssociationTable::~ProgramAssociationTable(void) +{ + for (NetworkAssociationIterator i = networks.begin(); i != networks.end(); ++i) + delete *i; + + for (ProgramAssociationIterator i = programs.begin(); i != programs.end(); ++i) + delete *i; +} + +const NetworkAssociationVector *ProgramAssociationTable::getNetworks(void) const +{ + return &networks; +} + +const ProgramAssociationVector *ProgramAssociationTable::getPrograms(void) const +{ + return &programs; +} + diff --git a/lib/dvb_si/pat.h b/lib/dvb_si/pat.h new file mode 100644 index 00000000..1bbfe8b7 --- /dev/null +++ b/lib/dvb_si/pat.h @@ -0,0 +1,84 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_table_pat_h__ +#define __dvb_table_pat_h__ + +#include "long_crc_table.h" + +class NetworkAssociation +{ + protected: + unsigned programNumber : 16; + unsigned reserved : 3; + unsigned networkPid : 13; + + public: + NetworkAssociation(const uint8_t * buffer); + + uint16_t getNetworkPid(void) const; +}; + +typedef std::vector<NetworkAssociation *> NetworkAssociationVector; +typedef NetworkAssociationVector::iterator NetworkAssociationIterator; +typedef NetworkAssociationVector::const_iterator NetworkAssociationConstIterator; + +class ProgramAssociation +{ + protected: + unsigned programNumber : 16; + unsigned reserved : 3; + unsigned programMapPid : 13; + + public: + ProgramAssociation(const uint8_t * buffer); + + uint16_t getProgramNumber(void) const; + uint16_t getProgramMapPid(void) const; +}; + +typedef std::vector<ProgramAssociation *> ProgramAssociationVector; +typedef ProgramAssociationVector::iterator ProgramAssociationIterator; +typedef ProgramAssociationVector::const_iterator ProgramAssociationConstIterator; + +class ProgramAssociationTable : public LongCrcTable +{ + protected: + NetworkAssociationVector networks; + ProgramAssociationVector programs; + + public: + ProgramAssociationTable(const uint8_t * const buffer); + ~ProgramAssociationTable(void); + + static const enum PacketId PID = PID_PAT; + static const enum TableId TID = TID_PAT; + static const uint32_t TIMEOUT = 1200; + + const NetworkAssociationVector *getNetworks(void) const; + const ProgramAssociationVector *getPrograms(void) const; +}; + +typedef std::vector<ProgramAssociationTable *> ProgramAssociationTableVector; +typedef ProgramAssociationTableVector::iterator ProgramAssociationTableIterator; +typedef ProgramAssociationTableVector::const_iterator ProgramAssociationTableConstIterator; + +#endif /* __dvb_table_pat_h__ */ diff --git a/lib/dvb_si/pdc_descriptor.cpp b/lib/dvb_si/pdc_descriptor.cpp new file mode 100644 index 00000000..2ad1ba9a --- /dev/null +++ b/lib/dvb_si/pdc_descriptor.cpp @@ -0,0 +1,34 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/pdc_descriptor.h> + +PdcDescriptor::PdcDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + reserved = (buffer[2] >> 4) & 0x0f; + programmeIdentificationLabel = ((buffer[2] & 0x0f) << 16) | buffer[3] | buffer[4]; +} + +uint32_t PdcDescriptor::getProgrammeIdentificationLabel(void) const +{ + return programmeIdentificationLabel; +} + diff --git a/lib/dvb_si/pdc_descriptor.h b/lib/dvb_si/pdc_descriptor.h new file mode 100644 index 00000000..76608d93 --- /dev/null +++ b/lib/dvb_si/pdc_descriptor.h @@ -0,0 +1,39 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_pdc_descriptor_h__ +#define __dvb_descriptor_pdc_descriptor_h__ + +#include "descriptor.h" + +class PdcDescriptor : public Descriptor +{ + protected: + unsigned reserved : 4; + unsigned programmeIdentificationLabel : 20; + + public: + PdcDescriptor(const uint8_t * const buffer); + + uint32_t getProgrammeIdentificationLabel(void) const; +}; + +#endif /* __dvb_descriptor_pcd_descriptor_h__ */ diff --git a/lib/dvb_si/pmt.cpp b/lib/dvb_si/pmt.cpp new file mode 100644 index 00000000..30087073 --- /dev/null +++ b/lib/dvb_si/pmt.cpp @@ -0,0 +1,75 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/pmt.h> + +ElementaryStreamInfo::ElementaryStreamInfo(const uint8_t * const buffer) +{ + streamType = buffer[0]; + reserved1 = (buffer[1] >> 5) & 0x07; + elementaryPid = ((buffer[1] & 0x1F) << 8) | buffer[2]; + reserved2 = (buffer[3] >> 4) & 0x0F; + esInfoLength = ((buffer[3] & 0x0F) << 8) | buffer[4]; + + for (uint16_t i = 5; i < esInfoLength + 5; i += buffer[i + 1] + 2) + descriptor(&buffer[i]); +} + +uint8_t ElementaryStreamInfo::getType(void) const +{ + return streamType; +} + +uint16_t ElementaryStreamInfo::getPid(void) const +{ + return elementaryPid; +} + +ProgramMapTable::ProgramMapTable(const uint8_t * const buffer) : LongCrcTable(buffer) +{ + reserved4 = (buffer[8] >> 5) & 0x07; + pcrPid = ((buffer[8] & 0x1F) << 8) | buffer[9]; + reserved5 = (buffer[10] >> 4) & 0x0F; + programInfoLength = ((buffer[10] & 0x0F) << 8) | buffer[11]; + + for (uint16_t i = 12; i < programInfoLength + 12; i += buffer[i + 1] + 2) + descriptor(&buffer[i]); + + for (uint16_t i = programInfoLength + 12; i < sectionLength - 1; i += ((buffer[i + 3] & 0x0F) | buffer[i + 4]) + 5) + esInfo.push_back(new ElementaryStreamInfo(&buffer[i])); +} + +uint16_t ProgramMapTable::getPcrPid(void) const +{ + return pcrPid; +} + +const ElementaryStreamInfoVector *ProgramMapTable::getEsInfo(void) const +{ + return &esInfo; +} + +ProgramMapTable::~ProgramMapTable(void) +{ + for (ElementaryStreamInfoIterator i = esInfo.begin(); i != esInfo.end(); ++i) + delete *i; +} + diff --git a/lib/dvb_si/pmt.h b/lib/dvb_si/pmt.h new file mode 100644 index 00000000..f99461f0 --- /dev/null +++ b/lib/dvb_si/pmt.h @@ -0,0 +1,77 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_table_pmt_h__ +#define __dvb_table_pmt_h__ + +#include <lib/dvb_si/container.h> +#include "long_crc_table.h" + +class ElementaryStreamInfo : public DescriptorContainer +{ + protected: + unsigned streamType : 8; + unsigned reserved1 : 3; + unsigned elementaryPid : 13; + unsigned reserved2 : 4; + unsigned esInfoLength : 12; + + public: + ElementaryStreamInfo(const uint8_t * const buffer); + + uint8_t getType(void) const; + uint16_t getPid(void) const; + + friend class CaElementaryStreamInfo; + +}; + +typedef std::vector<ElementaryStreamInfo *> ElementaryStreamInfoVector; +typedef ElementaryStreamInfoVector::iterator ElementaryStreamInfoIterator; +typedef ElementaryStreamInfoVector::const_iterator ElementaryStreamInfoConstIterator; + +class ProgramMapTable : public LongCrcTable, public DescriptorContainer +{ + protected: + unsigned reserved4 : 3; + unsigned pcrPid : 13; + unsigned reserved5 : 4; + unsigned programInfoLength : 12; + ElementaryStreamInfoVector esInfo; + + public: + ProgramMapTable(const uint8_t * const buffer); + ~ProgramMapTable(void); + + static const enum TableId TID = TID_PMT; + static const uint32_t TIMEOUT = 600; + + uint16_t getPcrPid(void) const; + const ElementaryStreamInfoVector *getEsInfo(void) const; + + friend class CaProgramMapTable; +}; + +typedef std::vector<ProgramMapTable *> ProgramMapTableVector; +typedef ProgramMapTableVector::iterator ProgramMapTableIterator; +typedef ProgramMapTableVector::const_iterator ProgramMapTableConstIterator; + +#endif /* __dvb_table_pmt_h__ */ diff --git a/lib/dvb_si/private_data_indicator_descriptor.h b/lib/dvb_si/private_data_indicator_descriptor.h new file mode 100644 index 00000000..10bee514 --- /dev/null +++ b/lib/dvb_si/private_data_indicator_descriptor.h @@ -0,0 +1,38 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_private_data_indicator_descriptor_h__ +#define __dvb_descriptor_private_data_indicator_descriptor_h__ + +#include "descriptor.h" + +class PrivateDataIndicatorDescriptor : public Descriptor +{ + protected: + unsigned privateDataIndicator : 32; + + public: + PrivateDataIndicatorDescriptor(const uint8_t * const buffer); + + uint32_t getPrivateDataIndicator(void) const; +}; + +#endif /* __dvb_descriptor_private_data_indicator_descriptor_h__ */ diff --git a/lib/dvb_si/private_data_specifier_descriptor.cpp b/lib/dvb_si/private_data_specifier_descriptor.cpp new file mode 100644 index 00000000..6d25af4e --- /dev/null +++ b/lib/dvb_si/private_data_specifier_descriptor.cpp @@ -0,0 +1,33 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/private_data_specifier_descriptor.h> + +PrivateDataSpecifierDescriptor::PrivateDataSpecifierDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + privateDataSpecifier = (buffer[2] << 24) | (buffer[3] << 16) | (buffer[4] << 8) | buffer[5]; +} + +uint32_t PrivateDataSpecifierDescriptor::getPrivateDataSpecifier(void) const +{ + return privateDataSpecifier; +} + diff --git a/lib/dvb_si/private_data_specifier_descriptor.h b/lib/dvb_si/private_data_specifier_descriptor.h new file mode 100644 index 00000000..e9e1dcf9 --- /dev/null +++ b/lib/dvb_si/private_data_specifier_descriptor.h @@ -0,0 +1,38 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_private_data_specifier_descriptor_h__ +#define __dvb_descriptor_private_data_specifier_descriptor_h__ + +#include "descriptor.h" + +class PrivateDataSpecifierDescriptor : public Descriptor +{ + protected: + unsigned privateDataSpecifier : 32; + + public: + PrivateDataSpecifierDescriptor(const uint8_t * const buffer); + + uint32_t getPrivateDataSpecifier(void) const; +}; + +#endif /* __dvb_descriptor_private_data_specifier_descriptor_h__ */ diff --git a/lib/dvb_si/registration_descriptor.h b/lib/dvb_si/registration_descriptor.h new file mode 100644 index 00000000..72ccc903 --- /dev/null +++ b/lib/dvb_si/registration_descriptor.h @@ -0,0 +1,44 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_registration_descriptor_h__ +#define __dvb_descriptor_registration_descriptor_h__ + +#include "descriptor.h" + +typedef std::vector<uint8_t> AdditionalIdentificationInfoVector; +typedef AdditionalIdentificationInfoVector::iterator AdditionalIdentificationInfoIterator; +typedef AdditionalIdentificationInfoVector::const_iterator AdditionalIdentificationInfoConstIterator; + +class RegistrationDescriptor : public Descriptor +{ + protected: + unsigned formatIdentifier : 32; + AdditionalIdentificationInfoVector additionalIdentificationInfo; + + private: + RegistrationDescriptor(const uint8_t * const buffer); + + uint32_t getFormatIdentifier(void) const; + const AdditionalIdentificationInfoVector *getAdditionalIdentificationInfo(void) const; +}; + +#endif /* __dvb_descriptor_registration_descriptor_h__ */ diff --git a/lib/dvb_si/satellite_delivery_system_descriptor.cpp b/lib/dvb_si/satellite_delivery_system_descriptor.cpp new file mode 100644 index 00000000..624246d0 --- /dev/null +++ b/lib/dvb_si/satellite_delivery_system_descriptor.cpp @@ -0,0 +1,91 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/satellite_delivery_system_descriptor.h> + +SatelliteDeliverySystemDescriptor::SatelliteDeliverySystemDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + frequency = + ( + ((buffer[2] >> 4) * 10000000) + + ((buffer[2] & 0x0F) * 1000000) + + ((buffer[3] >> 4) * 100000) + + ((buffer[3] & 0x0F) * 10000) + + ((buffer[4] >> 4) * 1000) + + ((buffer[4] & 0x0F) * 100) + + ((buffer[5] >> 4) * 10) + + ((buffer[5] & 0x0F) * 1) + ); + + orbitalPosition = (buffer[6] << 8) | buffer[7]; + westEastFlag = (buffer[8] >> 7) & 0x01; + polarization = (buffer[8] >> 5) & 0x03; + modulation = buffer[8] & 0x1F; + + symbolRate = + ( + ((buffer[9] >> 4) * 1000000) + + ((buffer[9] & 0x0F) * 100000) + + ((buffer[10] >> 4) * 10000) + + ((buffer[10] & 0x0F) * 1000) + + ((buffer[11] >> 4) * 100) + + ((buffer[11] & 0x0F) * 10) + + ((buffer[12] >> 4) * 1) + ); + + fecInner = buffer[12] & 0x0F; +} + +uint32_t SatelliteDeliverySystemDescriptor::getFrequency(void) const +{ + return frequency; +} + +uint16_t SatelliteDeliverySystemDescriptor::getOrbitalPosition(void) const +{ + return orbitalPosition; +} + +uint8_t SatelliteDeliverySystemDescriptor::getWestEastFlag(void) const +{ + return westEastFlag; +} + +uint8_t SatelliteDeliverySystemDescriptor::getPolarization(void) const +{ + return polarization; +} + +uint8_t SatelliteDeliverySystemDescriptor::getModulation(void) const +{ + return modulation; +} + +uint32_t SatelliteDeliverySystemDescriptor::getSymbolRate(void) const +{ + return symbolRate; +} + +uint8_t SatelliteDeliverySystemDescriptor::getFecInner(void) const +{ + return fecInner; +} + diff --git a/lib/dvb_si/satellite_delivery_system_descriptor.h b/lib/dvb_si/satellite_delivery_system_descriptor.h new file mode 100644 index 00000000..3e80cb39 --- /dev/null +++ b/lib/dvb_si/satellite_delivery_system_descriptor.h @@ -0,0 +1,50 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_satellite_delivery_system_descriptor_h__ +#define __dvb_descriptor_satellite_delivery_system_descriptor_h__ + +#include "descriptor.h" + +class SatelliteDeliverySystemDescriptor : public Descriptor +{ + protected: + unsigned frequency : 32; + unsigned orbitalPosition : 16; + unsigned westEastFlag : 1; + unsigned polarization : 2; + unsigned modulation : 5; + unsigned symbolRate : 28; + unsigned fecInner : 4; + + public: + SatelliteDeliverySystemDescriptor(const uint8_t * const buffer); + + uint32_t getFrequency(void) const; + uint16_t getOrbitalPosition(void) const; + uint8_t getWestEastFlag(void) const; + uint8_t getPolarization(void) const; + uint8_t getModulation(void) const; + uint32_t getSymbolRate(void) const; + uint8_t getFecInner(void) const; +}; + +#endif /* __dvb_descriptor_satellite_delivery_system_descriptor_h__ */ diff --git a/lib/dvb_si/sdt.cpp b/lib/dvb_si/sdt.cpp new file mode 100644 index 00000000..9fdb19dd --- /dev/null +++ b/lib/dvb_si/sdt.cpp @@ -0,0 +1,87 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/sdt.h> + +ServiceDescription::ServiceDescription(const uint8_t * const buffer) +{ + serviceId = (buffer[0] << 8) | buffer[1]; + reserved1 = (buffer[2] >> 2) & 0x3F; + eitScheduleFlag = (buffer[2] >> 1) & 0x01; + eitPresentFollowingFlag = buffer[2] & 0x01; + runningStatus = (buffer[3] >> 5) & 0x07; + freeCaMode = (buffer[3] >> 4) & 0x01; + descriptorsLoopLength = ((buffer[3] & 0x0F) << 8) | buffer[4]; + + for (uint16_t i = 5; i < descriptorsLoopLength + 5; i += buffer[i + 1] + 2) + descriptor(&buffer[i]); +} + +uint16_t ServiceDescription::getServiceId(void) const +{ + return serviceId; +} + +uint8_t ServiceDescription::getEitScheduleFlag(void) const +{ + return eitScheduleFlag; +} + +uint8_t ServiceDescription::getEitPresentFollowingFlag(void) const +{ + return eitPresentFollowingFlag; +} + +uint8_t ServiceDescription::getRunningStatus(void) const +{ + return runningStatus; +} + +uint8_t ServiceDescription::getFreeCaMode(void) const +{ + return freeCaMode; +} + +ServiceDescriptionTable::ServiceDescriptionTable(const uint8_t * const buffer) : LongCrcTable (buffer) +{ + originalNetworkId = (buffer[8] << 8) | buffer[9]; + reserved4 = buffer[10]; + + for (uint16_t i = 11; i < sectionLength - 1; i += ((buffer[i + 3] & 0x0F) | buffer[i + 4]) + 5) + description.push_back(new ServiceDescription(&buffer[i])); +} + +ServiceDescriptionTable::~ServiceDescriptionTable(void) +{ + for (ServiceDescriptionIterator i = description.begin(); i != description.end(); ++i) + delete *i; +} + +uint16_t ServiceDescriptionTable::getOriginalNetworkId(void) const +{ + return originalNetworkId; +} + +const ServiceDescriptionVector *ServiceDescriptionTable::getDescriptions(void) const +{ + return &description; +} + diff --git a/lib/dvb_si/sdt.h b/lib/dvb_si/sdt.h new file mode 100644 index 00000000..3d1a21df --- /dev/null +++ b/lib/dvb_si/sdt.h @@ -0,0 +1,77 @@ +/* + * $Id$ + * + * (C) 2002 by Andreas Oberritter <obi@tuxbox.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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_table_sdt_h__ +#define __dvb_table_sdt_h__ + +#include <lib/dvb_si/container.h> +#include "long_crc_table.h" + +class ServiceDescription : public DescriptorContainer +{ + protected: + unsigned serviceId : 16; + unsigned reserved1 : 6; + unsigned eitScheduleFlag : 1; + unsigned eitPresentFollowingFlag : 1; + unsigned runningStatus : 3; + unsigned freeCaMode : 1; + unsigned descriptorsLoopLength : 12; + + public: + ServiceDescription(const uint8_t * const buffer); + + uint16_t getServiceId(void) const; + uint8_t getEitScheduleFlag(void) const; + uint8_t getEitPresentFollowingFlag(void) const; + uint8_t getRunningStatus(void) const; + uint8_t getFreeCaMode(void) const; +}; + +typedef std::vector<ServiceDescription *> ServiceDescriptionVector; +typedef ServiceDescriptionVector::iterator ServiceDescriptionIterator; +typedef ServiceDescriptionVector::const_iterator ServiceDescriptionConstIterator; + +class ServiceDescriptionTable : public LongCrcTable +{ + protected: + unsigned originalNetworkId : 16; + unsigned reserved4 : 8; + ServiceDescriptionVector description; + + public: + ServiceDescriptionTable(const uint8_t * const buffer); + ~ServiceDescriptionTable(void); + + static const enum PacketId PID = PID_SDT; + static const enum TableId TID = TID_SDT_ACTUAL; + static const uint32_t TIMEOUT = 3000; + + uint16_t getOriginalNetworkId(void) const; + uint16_t getTransportStreamId(void) const { return getTableIdExtension(); } + const ServiceDescriptionVector *getDescriptions(void) const; +}; + +typedef std::vector<ServiceDescriptionTable *> ServiceDescriptionTableVector; +typedef ServiceDescriptionTableVector::iterator ServiceDescriptionTableIterator; +typedef ServiceDescriptionTableVector::const_iterator ServiceDescriptionTableConstIterator; + +#endif /* __dvb_table_sdt_h__ */ diff --git a/lib/dvb_si/service_descriptor.cpp b/lib/dvb_si/service_descriptor.cpp new file mode 100644 index 00000000..5328ffa9 --- /dev/null +++ b/lib/dvb_si/service_descriptor.cpp @@ -0,0 +1,47 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/service_descriptor.h> + +ServiceDescriptor::ServiceDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + serviceType = buffer[2]; + serviceProviderNameLength = buffer[3]; + serviceProviderName.assign((char *)&buffer[4], serviceProviderNameLength); + serviceNameLength = buffer[serviceProviderNameLength + 4]; + serviceName.assign((char *)&buffer[serviceProviderNameLength + 5], serviceNameLength); +} + +uint8_t ServiceDescriptor::getServiceType(void) const +{ + return serviceType; +} + +std::string ServiceDescriptor::getServiceProviderName(void) const +{ + return serviceProviderName; +} + +std::string ServiceDescriptor::getServiceName(void) const +{ + return serviceName; +} + diff --git a/lib/dvb_si/service_descriptor.h b/lib/dvb_si/service_descriptor.h new file mode 100644 index 00000000..4650c7ff --- /dev/null +++ b/lib/dvb_si/service_descriptor.h @@ -0,0 +1,44 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_service_descriptor_h__ +#define __dvb_descriptor_service_descriptor_h__ + +#include "descriptor.h" + +class ServiceDescriptor : public Descriptor +{ + protected: + unsigned serviceType : 8; + unsigned serviceProviderNameLength : 8; + std::string serviceProviderName; + unsigned serviceNameLength : 8; + std::string serviceName; + + public: + ServiceDescriptor(const uint8_t * const buffer); + + uint8_t getServiceType(void) const; + std::string getServiceProviderName(void) const; + std::string getServiceName(void) const; +}; + +#endif /* __dvb_descriptor_service_descriptor_h__ */ diff --git a/lib/dvb_si/service_list_descriptor.cpp b/lib/dvb_si/service_list_descriptor.cpp new file mode 100644 index 00000000..d478ab3b --- /dev/null +++ b/lib/dvb_si/service_list_descriptor.cpp @@ -0,0 +1,56 @@ +/* + * $Id$ + * + * (C) 2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/service_list_descriptor.h> + +ServiceListItem::ServiceListItem(const uint8_t * const buffer) +{ + serviceId = (buffer[0] << 8) | buffer[1]; + serviceType = buffer[2]; +} + +uint16_t ServiceListItem::getServiceId(void) const +{ + return serviceId; +} + +uint8_t ServiceListItem::getServiceType(void) const +{ + return serviceType; +} + +ServiceListDescriptor::ServiceListDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + for (uint16_t i = 0; i < descriptorLength; i += 3) + serviceList.push_back(new ServiceListItem(&buffer[i + 2])); +} + +ServiceListDescriptor::~ServiceListDescriptor(void) +{ + for (ServiceListItemIterator i = serviceList.begin(); i != serviceList.end(); ++i) + delete *i; +} + +const ServiceListItemVector *ServiceListDescriptor::getServiceList(void) const +{ + return &serviceList; +} + diff --git a/lib/dvb_si/service_list_descriptor.h b/lib/dvb_si/service_list_descriptor.h new file mode 100644 index 00000000..24fc5ff7 --- /dev/null +++ b/lib/dvb_si/service_list_descriptor.h @@ -0,0 +1,56 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_service_list_descriptor_h__ +#define __dvb_descriptor_service_list_descriptor_h__ + +#include "descriptor.h" + +class ServiceListItem +{ + protected: + unsigned serviceId : 16; + unsigned serviceType : 8; + + public: + ServiceListItem(const uint8_t * const buffer); + + uint16_t getServiceId(void) const; + uint8_t getServiceType(void) const; +}; + +typedef std::vector<ServiceListItem *> ServiceListItemVector; +typedef ServiceListItemVector::iterator ServiceListItemIterator; +typedef ServiceListItemVector::const_iterator ServiceListItemConstIterator; + +class ServiceListDescriptor : public Descriptor +{ + protected: + ServiceListItemVector serviceList; + + public: + ServiceListDescriptor(const uint8_t * const buffer); + ~ServiceListDescriptor(void); + + const ServiceListItemVector *getServiceList(void) const; +}; + +#endif /* __dvb_descriptor_service_list_descriptor_h__ */ diff --git a/lib/dvb_si/service_move_descriptor.cpp b/lib/dvb_si/service_move_descriptor.cpp new file mode 100644 index 00000000..65dd2323 --- /dev/null +++ b/lib/dvb_si/service_move_descriptor.cpp @@ -0,0 +1,45 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/service_move_descriptor.h> + +ServiceMoveDescriptor::ServiceMoveDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + newOriginalNetworkId = (buffer[2] << 8) | buffer[3]; + newTransportStreamId = (buffer[4] << 8) | buffer[5]; + newServiceId = (buffer[6] << 8) | buffer[7]; +} + +uint16_t ServiceMoveDescriptor::getNewOriginalNetworkId(void) const +{ + return newOriginalNetworkId; +} + +uint16_t ServiceMoveDescriptor::getNewTransportStreamId(void) const +{ + return newTransportStreamId; +} + +uint16_t ServiceMoveDescriptor::getNewServiceId(void) const +{ + return newServiceId; +} + diff --git a/lib/dvb_si/service_move_descriptor.h b/lib/dvb_si/service_move_descriptor.h new file mode 100644 index 00000000..6ffa6214 --- /dev/null +++ b/lib/dvb_si/service_move_descriptor.h @@ -0,0 +1,42 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_service_move_descriptor_h__ +#define __dvb_descriptor_service_move_descriptor_h__ + +#include "descriptor.h" + +class ServiceMoveDescriptor : public Descriptor +{ + protected: + unsigned newOriginalNetworkId : 16; + unsigned newTransportStreamId : 16; + unsigned newServiceId : 16; + + public: + ServiceMoveDescriptor(const uint8_t * const buffer); + + uint16_t getNewOriginalNetworkId(void) const; + uint16_t getNewTransportStreamId(void) const; + uint16_t getNewServiceId(void) const; +}; + +#endif /* __dvb_descriptor_service_move_descriptor_h__ */ diff --git a/lib/dvb_si/service_type.h b/lib/dvb_si/service_type.h new file mode 100644 index 00000000..d51ed37f --- /dev/null +++ b/lib/dvb_si/service_type.h @@ -0,0 +1,50 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_id_service_type_h__ +#define __dvb_id_service_type_h__ + +enum ServiceType { + /* 0x00 - 0x10: ETSI EN 300 468 V1.5.1 (2003-01) */ + ST_RESERVED = 0x00, + ST_DIGITAL_TELEVISION_SERVICE = 0x01, + ST_DIGITAL_RADIO_SOUND_SERVICE = 0x02, + ST_TELETEXT_SERVICE = 0x03, + ST_NVOD_REFERENCE_SERVICE = 0x04, + ST_NVOD_TIME_SHIFTED_SERVICE = 0x05, + ST_MOSAIC_SERVICE = 0x06, + ST_PAL_CODED_SIGNAL = 0x07, + ST_SECAM_CODED_SIGNAL = 0x08, + ST_D_D2_MAC = 0x09, + ST_FM_RADIO = 0x0A, + ST_NTSC_CODED_SIGNAL = 0x0B, + ST_DATA_BROADCAST_SERVICE = 0x0C, + ST_COMMON_INTERFACE_RESERVED = 0x0D, + ST_RCS_MAP = 0x0E, + ST_RCS_FLS = 0x0F, + ST_DVB_MHP_SERVICE = 0x10, + /* 0x11 - 0x7F: reserved for future use */ + ST_MULTIFEED = 0x69 + /* 0x80 - 0xFE: user defined */ + /* 0xFF: reserved for future use */ +}; + +#endif /* __dvb_id_service_type_h__ */ diff --git a/lib/dvb_si/short_crc_table.cpp b/lib/dvb_si/short_crc_table.cpp new file mode 100644 index 00000000..0f56d16a --- /dev/null +++ b/lib/dvb_si/short_crc_table.cpp @@ -0,0 +1,36 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/short_crc_table.h> + +ShortCrcTable::ShortCrcTable(const uint8_t * const buffer) : ShortTable(buffer) +{ + crc32 = (buffer[sectionLength - 1] << 24) | + (buffer[sectionLength + 0] << 16) | + (buffer[sectionLength + 1] << 8) | + (buffer[sectionLength + 2]); +} + +uint32_t ShortCrcTable::getCrc32(void) const +{ + return crc32; +} + diff --git a/lib/dvb_si/short_crc_table.h b/lib/dvb_si/short_crc_table.h new file mode 100644 index 00000000..a612a35a --- /dev/null +++ b/lib/dvb_si/short_crc_table.h @@ -0,0 +1,44 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_table_short_crc_table_h__ +#define __dvb_table_short_crc_table_h__ + +#include "short_table.h" + +class ShortCrcTable : public ShortTable +{ + protected: + unsigned crc32 : 32; + + public: + ShortCrcTable(const uint8_t * const buffer); + + static const uint8_t CRC32 = 1; + + uint32_t getCrc32(void) const; +}; + +typedef std::vector<ShortCrcTable *> ShortCrcTableVector; +typedef ShortCrcTableVector::iterator ShortCrcTableIterator; +typedef ShortCrcTableVector::const_iterator ShortCrcTableConstIterator; + +#endif /* __dvb_table_short_crc_table_h__ */ diff --git a/lib/dvb_si/short_event_descriptor.cpp b/lib/dvb_si/short_event_descriptor.cpp new file mode 100644 index 00000000..0f69628c --- /dev/null +++ b/lib/dvb_si/short_event_descriptor.cpp @@ -0,0 +1,47 @@ +/* + * $Id$ + * + * (C) 2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/short_event_descriptor.h> + +ShortEventDescriptor::ShortEventDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + iso639LanguageCode.assign((char *)&buffer[2], 3); + eventNameLength = buffer[5]; + eventName.assign((char *)&buffer[6], eventNameLength); + textLength = buffer[6 + eventNameLength]; + text.assign((char *)&buffer[7 + eventNameLength], textLength); +} + +std::string ShortEventDescriptor::getIso639LanguageCode(void) const +{ + return iso639LanguageCode; +} + +std::string ShortEventDescriptor::getEventName(void) const +{ + return eventName; +} + +std::string ShortEventDescriptor::getText(void) const +{ + return text; +} + diff --git a/lib/dvb_si/short_event_descriptor.h b/lib/dvb_si/short_event_descriptor.h new file mode 100644 index 00000000..f85f6ab9 --- /dev/null +++ b/lib/dvb_si/short_event_descriptor.h @@ -0,0 +1,44 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_short_event_descriptor_h__ +#define __dvb_descriptor_short_event_descriptor_h__ + +#include "descriptor.h" + +class ShortEventDescriptor : public Descriptor +{ + protected: + std::string iso639LanguageCode; + unsigned eventNameLength : 8; + std::string eventName; + unsigned textLength : 8; + std::string text; + + public: + ShortEventDescriptor(const uint8_t * const buffer); + + std::string getIso639LanguageCode(void) const; + std::string getEventName(void) const; + std::string getText(void) const; +}; + +#endif /* __dvb_descriptor_short_event_descriptor_h__ */ diff --git a/lib/dvb_si/short_smoothing_buffer_descriptor.h b/lib/dvb_si/short_smoothing_buffer_descriptor.h new file mode 100644 index 00000000..10750369 --- /dev/null +++ b/lib/dvb_si/short_smoothing_buffer_descriptor.h @@ -0,0 +1,41 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_short_smoothing_buffer_descriptor_h__ +#define __dvb_descriptor_short_smoothing_buffer_descriptor_h__ + +#include "descriptor.h" + +class ShortSmoothingBufferDescriptor : public Descriptor +{ + protected: + unsigned sbSize : 2; + unsigned sbLeakRate : 6; + std::vector<uint8_t> reserved; + + public: + ShortSmoothingBufferDescriptor(const uint8_t * const buffer); + + uint8_t getSbSize(void) const; + uint8_t getSbLeakRate(void) const; +}; + +#endif /* __dvb_descriptor_short_smoothing_buffer_descriptor_h__ */ diff --git a/lib/dvb_si/short_table.cpp b/lib/dvb_si/short_table.cpp new file mode 100644 index 00000000..72783002 --- /dev/null +++ b/lib/dvb_si/short_table.cpp @@ -0,0 +1,47 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/short_table.h> + +ShortTable::ShortTable(const uint8_t * const buffer) +{ + tableId = buffer[0]; + sectionSyntaxIndicator = (buffer[1] >> 7) & 0x01; + reserved1 = (buffer[1] >> 6) & 0x01; + reserved2 = (buffer[1] >> 4) & 0x03; + sectionLength = ((buffer[1] & 0x0F) << 8) | buffer[2]; +} + +uint8_t ShortTable::getTableId(void) const +{ + return tableId; +} + +uint8_t ShortTable::getSectionSyntaxIndicator(void) const +{ + return sectionSyntaxIndicator; +} + +uint16_t ShortTable::getSectionLength(void) const +{ + return sectionLength; +} + diff --git a/lib/dvb_si/short_table.h b/lib/dvb_si/short_table.h new file mode 100644 index 00000000..59f50240 --- /dev/null +++ b/lib/dvb_si/short_table.h @@ -0,0 +1,58 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_table_short_table_h__ +#define __dvb_table_short_table_h__ + +#include <lib/dvb_si/packet_id.h> +#include <lib/dvb_si/table_id.h> +#include <inttypes.h> +#include <vector> + +class ShortTable +{ + protected: + unsigned tableId : 8; + unsigned sectionSyntaxIndicator : 1; + unsigned reserved1 : 1; + unsigned reserved2 : 2; + unsigned sectionLength : 12; + + public: + ShortTable(const uint8_t * const buffer); + + static const uint8_t CRC32 = 0; + static const uint16_t LENGTH = 1024; + static const enum PacketId PID = PID_RESERVED; + static const uint8_t SYNTAX = 0; + static const enum TableId TID = TID_RESERVED; + static const uint32_t TIMEOUT = 0; + + uint8_t getTableId(void) const; + uint8_t getSectionSyntaxIndicator(void) const; + uint16_t getSectionLength(void) const; +}; + +typedef std::vector<ShortTable *> ShortTableVector; +typedef ShortTableVector::iterator ShortTableIterator; +typedef ShortTableVector::const_iterator ShortTableConstIterator; + +#endif /* __dvb_table_short_table_h__ */ diff --git a/lib/dvb_si/smoothing_buffer_descriptor.h b/lib/dvb_si/smoothing_buffer_descriptor.h new file mode 100644 index 00000000..bd056eea --- /dev/null +++ b/lib/dvb_si/smoothing_buffer_descriptor.h @@ -0,0 +1,42 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_smoothing_buffer_descriptor_h__ +#define __dvb_descriptor_smoothing_buffer_descriptor_h__ + +#include "descriptor.h" + +class SmoothingBufferDescriptor : public Descriptor +{ + protected: + unsigned reserved : 2; + unsigned sbLeakRate : 22; + unsigned reserved2 : 2; + unsigned sbSize : 22; + + public: + SmoothingBufferDescriptor(const uint8_t * const buffer); + + uint32_t getSbLeakRate(void) const; + uint32_t getSbSize(void) const; +}; + +#endif /* __dvb_descriptor_smoothing_buffer_descriptor_h__ */ diff --git a/lib/dvb_si/std_descriptor.h b/lib/dvb_si/std_descriptor.h new file mode 100644 index 00000000..977a39bb --- /dev/null +++ b/lib/dvb_si/std_descriptor.h @@ -0,0 +1,39 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_std_descriptor_h__ +#define __dvb_descriptor_std_descriptor_h__ + +#include "descriptor.h" + +class StdDescriptor : public Descriptor +{ + protected: + unsigned reserved : 7; + unsigned leakValidFlag : 1; + + public: + StdDescriptor(const uint8_t * const buffer); + + uint8_t getLeakValidFlag(void) const; +}; + +#endif /* __dvb_descriptor_std_descriptor_h__ */ diff --git a/lib/dvb_si/stream_identifier_descriptor.cpp b/lib/dvb_si/stream_identifier_descriptor.cpp new file mode 100644 index 00000000..f39ed9f9 --- /dev/null +++ b/lib/dvb_si/stream_identifier_descriptor.cpp @@ -0,0 +1,33 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/stream_identifier_descriptor.h> + +StreamIdentifierDescriptor::StreamIdentifierDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + componentTag = buffer[2]; +} + +uint8_t StreamIdentifierDescriptor::getComponentTag(void) const +{ + return componentTag; +} + diff --git a/lib/dvb_si/stream_identifier_descriptor.h b/lib/dvb_si/stream_identifier_descriptor.h new file mode 100644 index 00000000..bf7233c2 --- /dev/null +++ b/lib/dvb_si/stream_identifier_descriptor.h @@ -0,0 +1,38 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_stream_identifier_descriptor_h__ +#define __dvb_descriptor_stream_identifier_descriptor_h__ + +#include "descriptor.h" + +class StreamIdentifierDescriptor : public Descriptor +{ + protected: + unsigned componentTag : 8; + + public: + StreamIdentifierDescriptor(const uint8_t * const buffer); + + uint8_t getComponentTag(void) const; +}; + +#endif /* __dvb_descriptor_stream_identifier_descriptor_h__ */ diff --git a/lib/dvb_si/stream_type.h b/lib/dvb_si/stream_type.h new file mode 100644 index 00000000..22a07fa5 --- /dev/null +++ b/lib/dvb_si/stream_type.h @@ -0,0 +1,51 @@ +/* + * $Id$ + * + * (C) 2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_id_stream_type_h__ +#define __dvb_id_stream_type_h__ + +enum StreamType { + STT_RESERVED = 0x00, + STT_MPEG1_VIDEO = 0x01, + STT_MPEG2_VIDEO = 0x02, + STT_MPEG1_AUDIO = 0x03, + STT_MPEG2_AUDIO = 0x04, + STT_MPEG2_SECTIONS = 0x05, + STT_MPEG2_PES = 0x06, + STT_MHEG = 0x07, + STT_DSM_CC = 0x08, + STT_TREC_H_222_1 = 0x09, + STT_13818_6_A = 0x0A, + STT_13818_6_B = 0x0B, + STT_13818_6_C = 0x0C, + STT_13818_6_D = 0x0D, + STT_AUXILIARY = 0x0E, + STT_ADTS_AUDIO = 0x0F, + STT_MPEG4_VIDEO = 0x10, + STT_MPEG4_AUDIO = 0x11, + STT_MPEG4_PES = 0x12, + STT_MPEG4_SECTIONS = 0x13, + STT_SYNC_DOWNLOAD_PROT = 0x14 + /* 0x15 - 0x7F: ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Reserved */ + /* 0x80 - 0xFF: User Private */ +}; + +#endif /* __dvb_id_stream_type_h__ */ diff --git a/lib/dvb_si/stuffing_descriptor.cpp b/lib/dvb_si/stuffing_descriptor.cpp new file mode 100644 index 00000000..8aa27b33 --- /dev/null +++ b/lib/dvb_si/stuffing_descriptor.cpp @@ -0,0 +1,29 @@ +/* + * $Id$ + * + * (C) 2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/stuffing_descriptor.h> + +StuffingDescriptor::StuffingDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + for (uint16_t i = 0; i < descriptorLength; ++i) + stuffingByte.push_back(buffer[i + 2]); +} + diff --git a/lib/dvb_si/stuffing_descriptor.h b/lib/dvb_si/stuffing_descriptor.h new file mode 100644 index 00000000..c9dbba56 --- /dev/null +++ b/lib/dvb_si/stuffing_descriptor.h @@ -0,0 +1,36 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_stuffing_descriptor_h__ +#define __dvb_descriptor_stuffing_descriptor_h__ + +#include "descriptor.h" + +class StuffingDescriptor : public Descriptor +{ + protected: + std::vector<uint8_t> stuffingByte; + + public: + StuffingDescriptor(const uint8_t * const buffer); +}; + +#endif /* __dvb_descriptor_stuffing_descriptor_h__ */ diff --git a/lib/dvb_si/subtitling_descriptor.cpp b/lib/dvb_si/subtitling_descriptor.cpp new file mode 100644 index 00000000..3d5407f0 --- /dev/null +++ b/lib/dvb_si/subtitling_descriptor.cpp @@ -0,0 +1,68 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/subtitling_descriptor.h> + +Subtitling::Subtitling(const uint8_t * const buffer) +{ + iso639LanguageCode.assign((char *)&buffer[0], 3); + subtitlingType = buffer[3]; + compositionPageId = (buffer[4] << 8) | buffer[5]; + ancillaryPageId = (buffer[6] << 8) | buffer[7]; +} + +std::string Subtitling::getIso639LanguageCode(void) const +{ + return iso639LanguageCode; +} + +uint8_t Subtitling::getSubtitlingType(void) const +{ + return subtitlingType; +} + +uint16_t Subtitling::getCompositionPageId(void) const +{ + return compositionPageId; +} + +uint16_t Subtitling::getAncillaryPageId(void) const +{ + return ancillaryPageId; +} + +SubtitlingDescriptor::SubtitlingDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + for (uint16_t i = 0; i < descriptorLength; i += 8) + subtitlings.push_back(new Subtitling(&buffer[i + 2])); +} + +SubtitlingDescriptor::~SubtitlingDescriptor(void) +{ + for (SubtitlingIterator i = subtitlings.begin(); i != subtitlings.end(); ++i) + delete *i; +} + +const SubtitlingVector *SubtitlingDescriptor::getSubtitlings(void) const +{ + return &subtitlings; +} + diff --git a/lib/dvb_si/subtitling_descriptor.h b/lib/dvb_si/subtitling_descriptor.h new file mode 100644 index 00000000..07bee4ae --- /dev/null +++ b/lib/dvb_si/subtitling_descriptor.h @@ -0,0 +1,60 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_subtitling_descriptor_h__ +#define __dvb_descriptor_subtitling_descriptor_h__ + +#include "descriptor.h" + +class Subtitling +{ + protected: + std::string iso639LanguageCode; + unsigned subtitlingType : 8; + unsigned compositionPageId : 16; + unsigned ancillaryPageId : 16; + + public: + Subtitling(const uint8_t * const buffer); + + std::string getIso639LanguageCode(void) const; + uint8_t getSubtitlingType(void) const; + uint16_t getCompositionPageId(void) const; + uint16_t getAncillaryPageId(void) const; +}; + +typedef std::vector<Subtitling *> SubtitlingVector; +typedef SubtitlingVector::iterator SubtitlingIterator; +typedef SubtitlingVector::const_iterator SubtitlingConstIterator; + +class SubtitlingDescriptor : public Descriptor +{ + protected: + SubtitlingVector subtitlings; + + public: + SubtitlingDescriptor(const uint8_t * const buffer); + ~SubtitlingDescriptor(void); + + const SubtitlingVector *getSubtitlings(void) const; +}; + +#endif /* __dvb_descriptor_subtitling_descriptor_h__ */ diff --git a/lib/dvb_si/system_clock_descriptor.h b/lib/dvb_si/system_clock_descriptor.h new file mode 100644 index 00000000..bc0d36b6 --- /dev/null +++ b/lib/dvb_si/system_clock_descriptor.h @@ -0,0 +1,44 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_system_clock_descriptor_h__ +#define __dvb_descriptor_system_clock_descriptor_h__ + +#include "descriptor.h" + +class SystemClockDescriptor : public Descriptor +{ + protected: + unsigned externalClockReferenceIndicator : 1; + unsigned reserved : 1; + unsigned clockAccuracyInteger : 6; + unsigned clockAccuracyExponent : 3; + unsigned reserved2 : 5; + + public: + SystemClockDescriptor(const uint8_t * const buffer); + + uint8_t getExternalClockReferenceIndicator(void) const; + uint8_t getClockAccuracyInteger(void) const; + uint8_t getClockAccuracyExponent(void) const; +}; + +#endif /* __dvb_descriptor_system_clock_descriptor_h__ */ diff --git a/lib/dvb_si/table_id.h b/lib/dvb_si/table_id.h new file mode 100644 index 00000000..ad45be86 --- /dev/null +++ b/lib/dvb_si/table_id.h @@ -0,0 +1,123 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_id_table_id_h__ +#define __dvb_id_table_id_h__ + +enum TableId { + /* ISO/IEC 13818-1, ITU T-REC H.222.0 */ + TID_PAT = 0x00, /* program_association_section */ + TID_CAT = 0x01, /* conditional_access_section */ + TID_PMT = 0x02, /* TS_program_map_section */ + TID_TSDT = 0x03, /* TS_description_section */ + TID_SDT = 0x04, /* ISO_IEC_14496_scene_description_section */ + TID_ODT = 0x05, /* ISO_IEC_14496_object_descriptor_section */ + + /* 0x06 - 0x09: ITU-T Rec. H.222.0 | ISO/IEC 13818-1 reserved */ + + /* 0x0A - 0x0D: ISO/IEC 13818-6 */ + TID_DSMCC_MULTIPROTOCOL = 0x0A, /* Multiprotocol */ + TID_DSMCC_MSG_HEADER = 0x0B, /* DSM-CC Messages Header (U-N) */ + TID_DSMCC_DESCR_LOOP = 0x0C, /* DSM-CC Descriptors Loop */ + TID_DSMCC_TBD = 0x0D, /* TBD */ + + /* 0x0E - 0x37: ITU-T Rec. H.222.0 | ISO/IEC 13818-1 reserved */ + + /* 0x38 - 0x3F: Defined in ISO/IEC 13818-6 */ + TID_DSMCC_DL_MESSAGE = 0x3B, /* DSM-CC Download Message */ + TID_DSMCC_DL_DATA = 0x3C, /* DSM-CC Download Data */ + TID_DSMCC_DL_EVENT = 0x3D, /* DSM-CC Download Event */ + + /* 0x40 - 0x7F: ETSI EN 300 468 V1.5.1 (2003-01) */ + TID_NIT_ACTUAL = 0x40, /* network_information_section - actual_network */ + TID_NIT_OTHER = 0x41, /* network_information_section - other_network */ + TID_SDT_ACTUAL = 0x42, /* service_description_section - actual_transport_stream */ + TID_SDT_OTHER = 0x46, /* service_description_section - other_transport_stream */ + TID_BAT = 0x4A, /* bouquet_association_section */ + TID_EIT_ACTUAL = 0x4E, /* event_information_section - actual_transport_stream, present/following */ + TID_EIT_OTHER = 0x4F, /* event_information_section - other_transport_stream, present/following */ + TID_EIT_ACTUAL_SCHED_0 = 0x50, /* event_information_section - actual_transport_stream, schedule */ + TID_EIT_ACTUAL_SCHED_1 = 0x51, /* event_information_section - actual_transport_stream, schedule */ + TID_EIT_ACTUAL_SCHED_2 = 0x52, /* event_information_section - actual_transport_stream, schedule */ + TID_EIT_ACTUAL_SCHED_3 = 0x53, /* event_information_section - actual_transport_stream, schedule */ + TID_EIT_ACTUAL_SCHED_4 = 0x54, /* event_information_section - actual_transport_stream, schedule */ + TID_EIT_ACTUAL_SCHED_5 = 0x55, /* event_information_section - actual_transport_stream, schedule */ + TID_EIT_ACTUAL_SCHED_6 = 0x56, /* event_information_section - actual_transport_stream, schedule */ + TID_EIT_ACTUAL_SCHED_7 = 0x57, /* event_information_section - actual_transport_stream, schedule */ + TID_EIT_ACTUAL_SCHED_8 = 0x58, /* event_information_section - actual_transport_stream, schedule */ + TID_EIT_ACTUAL_SCHED_9 = 0x59, /* event_information_section - actual_transport_stream, schedule */ + TID_EIT_ACTUAL_SCHED_A = 0x5A, /* event_information_section - actual_transport_stream, schedule */ + TID_EIT_ACTUAL_SCHED_B = 0x5B, /* event_information_section - actual_transport_stream, schedule */ + TID_EIT_ACTUAL_SCHED_C = 0x5C, /* event_information_section - actual_transport_stream, schedule */ + TID_EIT_ACTUAL_SCHED_D = 0x5D, /* event_information_section - actual_transport_stream, schedule */ + TID_EIT_ACTUAL_SCHED_E = 0x5E, /* event_information_section - actual_transport_stream, schedule */ + TID_EIT_ACTUAL_SCHED_F = 0x5F, /* event_information_section - actual_transport_stream, schedule */ + TID_EIT_OTHER_SCHED_0 = 0x60, /* event_information_section - other_transport_stream, schedule */ + TID_EIT_OTHER_SCHED_1 = 0x61, /* event_information_section - other_transport_stream, schedule */ + TID_EIT_OTHER_SCHED_2 = 0x62, /* event_information_section - other_transport_stream, schedule */ + TID_EIT_OTHER_SCHED_3 = 0x63, /* event_information_section - other_transport_stream, schedule */ + TID_EIT_OTHER_SCHED_4 = 0x64, /* event_information_section - other_transport_stream, schedule */ + TID_EIT_OTHER_SCHED_5 = 0x65, /* event_information_section - other_transport_stream, schedule */ + TID_EIT_OTHER_SCHED_6 = 0x66, /* event_information_section - other_transport_stream, schedule */ + TID_EIT_OTHER_SCHED_7 = 0x67, /* event_information_section - other_transport_stream, schedule */ + TID_EIT_OTHER_SCHED_8 = 0x68, /* event_information_section - other_transport_stream, schedule */ + TID_EIT_OTHER_SCHED_9 = 0x69, /* event_information_section - other_transport_stream, schedule */ + TID_EIT_OTHER_SCHED_A = 0x6A, /* event_information_section - other_transport_stream, schedule */ + TID_EIT_OTHER_SCHED_B = 0x6B, /* event_information_section - other_transport_stream, schedule */ + TID_EIT_OTHER_SCHED_C = 0x6C, /* event_information_section - other_transport_stream, schedule */ + TID_EIT_OTHER_SCHED_D = 0x6D, /* event_information_section - other_transport_stream, schedule */ + TID_EIT_OTHER_SCHED_E = 0x6E, /* event_information_section - other_transport_stream, schedule */ + TID_EIT_OTHER_SCHED_F = 0x6F, /* event_information_section - other_transport_stream, schedule */ + TID_TDT = 0x70, /* time_date_section */ + TID_RST = 0x71, /* running_status_section */ + TID_ST = 0x72, /* stuffing_section */ + TID_TOT = 0x73, /* time_offset_section */ + TID_AIT = 0x74, /* application_information_section */ + TID_DIT = 0x7E, /* discontinuity_information_section */ + TID_SIT = 0x7F, /* selection_information_section */ + + /* 0x80 - 0x8F: ETSI ETR 289 ed.1 (1996-10) */ + TID_CAMT_ECM_0 = 0x80, + TID_CAMT_ECM_1 = 0x81, + TID_CAMT_PRIVATE_0 = 0x82, + TID_CAMT_PRIVATE_1 = 0x83, + TID_CAMT_PRIVATE_2 = 0x84, + TID_CAMT_PRIVATE_3 = 0x85, + TID_CAMT_PRIVATE_4 = 0x86, + TID_CAMT_PRIVATE_5 = 0x87, + TID_CAMT_PRIVATE_6 = 0x88, + TID_CAMT_PRIVATE_7 = 0x89, + TID_CAMT_PRIVATE_8 = 0x8A, + TID_CAMT_PRIVATE_9 = 0x8B, + TID_CAMT_PRIVATE_A = 0x8C, + TID_CAMT_PRIVATE_B = 0x8D, + TID_CAMT_PRIVATE_C = 0x8E, + TID_CAMT_PRIVATE_D = 0x8F, + + /* 0x90 - 0xFE: PRIVATE */ + TID_TOC = 0x91, + TID_HIT = 0x92, + + /* 0xFF: ISO RESERVED */ + TID_RESERVED = 0xFF +}; + +#endif /* __dvb_id_table_id_h__ */ diff --git a/lib/dvb_si/target_background_grid_descriptor.cpp b/lib/dvb_si/target_background_grid_descriptor.cpp new file mode 100644 index 00000000..92f99eb3 --- /dev/null +++ b/lib/dvb_si/target_background_grid_descriptor.cpp @@ -0,0 +1,45 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/target_background_grid_descriptor.h> + +TargetBackgroundGridDescriptor::TargetBackgroundGridDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + horizontalSize = ((buffer[2] << 8) | (buffer[3] & 0xF3)) >> 2; + verticalSize = (((buffer[3] & 0x03) << 16) | (buffer[4] << 8) | (buffer[5] & 0xF0)) >> 4; + aspectRatioInformation = buffer[5] & 0x0F; +} + +uint16_t TargetBackgroundGridDescriptor::getHorizontalSize(void) const +{ + return horizontalSize; +} + +uint16_t TargetBackgroundGridDescriptor::getVerticalSize(void) const +{ + return verticalSize; +} + +uint8_t TargetBackgroundGridDescriptor::getAspectRatioInformation(void) const +{ + return aspectRatioInformation; +} + diff --git a/lib/dvb_si/target_background_grid_descriptor.h b/lib/dvb_si/target_background_grid_descriptor.h new file mode 100644 index 00000000..2b4ccf1a --- /dev/null +++ b/lib/dvb_si/target_background_grid_descriptor.h @@ -0,0 +1,42 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_target_background_grid_descriptor_h__ +#define __dvb_descriptor_target_background_grid_descriptor_h__ + +#include "descriptor.h" + +class TargetBackgroundGridDescriptor : public Descriptor +{ + protected: + unsigned horizontalSize : 14; + unsigned verticalSize : 14; + unsigned aspectRatioInformation : 4; + + public: + TargetBackgroundGridDescriptor(const uint8_t * const buffer); + + uint16_t getHorizontalSize(void) const; + uint16_t getVerticalSize(void) const; + uint8_t getAspectRatioInformation(void) const; +}; + +#endif /* __dvb_descriptor_target_background_grid_descriptor_h__ */ diff --git a/lib/dvb_si/tdt.cpp b/lib/dvb_si/tdt.cpp new file mode 100644 index 00000000..9a8d53cb --- /dev/null +++ b/lib/dvb_si/tdt.cpp @@ -0,0 +1,39 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/tdt.h> + +TimeAndDateTable::TimeAndDateTable(const uint8_t * const buffer) : ShortTable(buffer) +{ + utcTimeMjd = (buffer[3] << 8) | buffer[4]; + utcTimeBcd = (buffer[5] << 16) | (buffer[6] << 8) | buffer[7]; +} + +uint16_t TimeAndDateTable::getUtcTimeMjd(void) const +{ + return utcTimeMjd; +} + +uint32_t TimeAndDateTable::getUtcTimeBcd(void) const +{ + return utcTimeBcd; +} + diff --git a/lib/dvb_si/tdt.h b/lib/dvb_si/tdt.h new file mode 100644 index 00000000..cfe9935a --- /dev/null +++ b/lib/dvb_si/tdt.h @@ -0,0 +1,48 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_table_tdt_h__ +#define __dvb_table_tdt_h__ + +#include "short_table.h" + +class TimeAndDateTable : public ShortTable +{ + protected: + unsigned utcTimeMjd : 16; + unsigned utcTimeBcd : 24; + + public: + TimeAndDateTable(const uint8_t * const buffer); + + static const enum PacketId PID = PID_TDT; + static const enum TableId TID = TID_TDT; + static const uint32_t TIMEOUT = 36000; + + uint16_t getUtcTimeMjd(void) const; + uint32_t getUtcTimeBcd(void) const; +}; + +typedef std::vector<TimeAndDateTable *> TimeAndDateTableVector; +typedef TimeAndDateTableVector::iterator TimeAndDateTableIterator; +typedef TimeAndDateTableVector::const_iterator TimeAndDateTableConstIterator; + +#endif /* __dvb_table_tdt_h__ */ diff --git a/lib/dvb_si/telephone_descriptor.cpp b/lib/dvb_si/telephone_descriptor.cpp new file mode 100644 index 00000000..49a45930 --- /dev/null +++ b/lib/dvb_si/telephone_descriptor.cpp @@ -0,0 +1,83 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/telephone_descriptor.h> + +TelephoneDescriptor::TelephoneDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + reserved = (buffer[2] >> 6) & 0x03; + foreignAvailability = (buffer[2] >> 5) & 0x01; + connectionType = buffer[2] & 0x1f; + reserved2 = (buffer[3] >> 7) & 0x01; + countryPrefixLength = (buffer[3] >> 5) & 0x03; + internationalAreaCodeLength = (buffer[3] >> 2) & 0x07; + operatorCodeLength = buffer[3] & 0x03; + reserved3 = (buffer[4] >> 7) & 0x01; + nationalAreaCodeLength = (buffer[4] >> 4) & 0x07; + coreNumberLength = buffer[4] & 0x0f; + + uint16_t offset = 5; + countryPrefix.assign((char *)&buffer[offset], countryPrefixLength); + offset += countryPrefixLength; + internationalAreaCode.assign((char *)&buffer[offset], internationalAreaCodeLength); + offset += internationalAreaCodeLength; + operatorCode.assign((char *)&buffer[offset], operatorCodeLength); + offset += operatorCodeLength; + nationalAreaCode.assign((char *)&buffer[offset], nationalAreaCodeLength); + offset += nationalAreaCodeLength; + coreNumber.assign((char *)&buffer[offset], coreNumberLength); +} + +uint8_t TelephoneDescriptor::getForeignAvailability(void) const +{ + return foreignAvailability; +} + +uint8_t TelephoneDescriptor::getConnectionType(void) const +{ + return connectionType; +} + +std::string TelephoneDescriptor::getCountryPrefix(void) const +{ + return countryPrefix; +} + +std::string TelephoneDescriptor::getInternationalAreaCode(void) const +{ + return internationalAreaCode; +} + +std::string TelephoneDescriptor::getOperatorCode(void) const +{ + return operatorCode; +} + +std::string TelephoneDescriptor::getNationalAreaCode(void) const +{ + return nationalAreaCode; +} + +std::string TelephoneDescriptor::getCoreNumber(void) const +{ + return coreNumber; +} + diff --git a/lib/dvb_si/telephone_descriptor.h b/lib/dvb_si/telephone_descriptor.h new file mode 100644 index 00000000..851edcb6 --- /dev/null +++ b/lib/dvb_si/telephone_descriptor.h @@ -0,0 +1,58 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_telephone_descriptor_h__ +#define __dvb_descriptor_telephone_descriptor_h__ + +#include "descriptor.h" + +class TelephoneDescriptor : public Descriptor +{ + protected: + unsigned reserved : 2; + unsigned foreignAvailability : 1; + unsigned connectionType : 5; + unsigned reserved2 : 1; + unsigned countryPrefixLength : 2; + unsigned internationalAreaCodeLength : 3; + unsigned operatorCodeLength : 2; + unsigned reserved3 : 1; + unsigned nationalAreaCodeLength : 3; + unsigned coreNumberLength : 4; + std::string countryPrefix; + std::string internationalAreaCode; + std::string operatorCode; + std::string nationalAreaCode; + std::string coreNumber; + + public: + TelephoneDescriptor(const uint8_t * const buffer); + + uint8_t getForeignAvailability(void) const; + uint8_t getConnectionType(void) const; + std::string getCountryPrefix(void) const; + std::string getInternationalAreaCode(void) const; + std::string getOperatorCode(void) const; + std::string getNationalAreaCode(void) const; + std::string getCoreNumber(void) const; +}; + +#endif /* __dvb_descriptor_telephone_descriptor_h__ */ diff --git a/lib/dvb_si/teletext_descriptor.cpp b/lib/dvb_si/teletext_descriptor.cpp new file mode 100644 index 00000000..639f9729 --- /dev/null +++ b/lib/dvb_si/teletext_descriptor.cpp @@ -0,0 +1,27 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/teletext_descriptor.h> + +TeletextDescriptor::TeletextDescriptor(const uint8_t * const buffer) : VbiTeletextDescriptor(buffer) +{ +} + diff --git a/lib/dvb_si/teletext_descriptor.h b/lib/dvb_si/teletext_descriptor.h new file mode 100644 index 00000000..6e13bc6c --- /dev/null +++ b/lib/dvb_si/teletext_descriptor.h @@ -0,0 +1,33 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_teletext_descriptor_h__ +#define __dvb_descriptor_teletext_descriptor_h__ + +#include "vbi_teletext_descriptor.h" + +class TeletextDescriptor : public VbiTeletextDescriptor +{ + public: + TeletextDescriptor(const uint8_t * const buffer); +}; + +#endif /* __dvb_descriptor_teletext_descriptor_h__ */ diff --git a/lib/dvb_si/terrestrial_delivery_system_descriptor.cpp b/lib/dvb_si/terrestrial_delivery_system_descriptor.cpp new file mode 100644 index 00000000..8bb39238 --- /dev/null +++ b/lib/dvb_si/terrestrial_delivery_system_descriptor.cpp @@ -0,0 +1,83 @@ +/* + * $Id$ + * + * (C) 2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/terrestrial_delivery_system_descriptor.h> + +TerrestrialDeliverySystemDescriptor::TerrestrialDeliverySystemDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + centreFrequency = (buffer[2] << 24) | (buffer[3] << 16) | (buffer[4] << 8) | buffer[5]; + bandwidth = (buffer[6] >> 5) & 0x07; + reserved = buffer[6] & 0x1f; + constellation = (buffer[7] >> 6) & 0x03; + hierarchyInformation = (buffer[7] >> 3) & 0x07; + codeRateHpStream = buffer[7] & 0x07; + codeRateLpStream = (buffer[8] >> 5) & 0x07; + guardInterval = (buffer[8] >> 3) & 0x03; + transmissionMode = (buffer[8] >> 1) & 0x03; + otherFrequencyFlag = buffer[8] & 0x01; + reserved2 = (buffer[9] << 24) | (buffer[10] << 16) | (buffer[11] << 8) | buffer[12]; +} + +uint32_t TerrestrialDeliverySystemDescriptor::getCentreFrequency(void) const +{ + return centreFrequency; +} + +uint8_t TerrestrialDeliverySystemDescriptor::getBandwidth(void) const +{ + return bandwidth; +} + +uint8_t TerrestrialDeliverySystemDescriptor::getConstellation(void) const +{ + return constellation; +} + +uint8_t TerrestrialDeliverySystemDescriptor::getHierarchyInformation(void) const +{ + return hierarchyInformation; +} + +uint8_t TerrestrialDeliverySystemDescriptor::getCodeRateHpStream(void) const +{ + return codeRateHpStream; +} + +uint8_t TerrestrialDeliverySystemDescriptor::getCodeRateLpStream(void) const +{ + return codeRateLpStream; +} + +uint8_t TerrestrialDeliverySystemDescriptor::getGuardInterval(void) const +{ + return guardInterval; +} + +uint8_t TerrestrialDeliverySystemDescriptor::getTransmissionMode(void) const +{ + return transmissionMode; +} + +uint8_t TerrestrialDeliverySystemDescriptor::getOtherFrequencyFlag(void) const +{ + return otherFrequencyFlag; +} + diff --git a/lib/dvb_si/terrestrial_delivery_system_descriptor.h b/lib/dvb_si/terrestrial_delivery_system_descriptor.h new file mode 100644 index 00000000..c36f6a57 --- /dev/null +++ b/lib/dvb_si/terrestrial_delivery_system_descriptor.h @@ -0,0 +1,56 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_terrestrial_delivery_system_descriptor_h__ +#define __dvb_descriptor_terrestrial_delivery_system_descriptor_h__ + +#include "descriptor.h" + +class TerrestrialDeliverySystemDescriptor : public Descriptor +{ + protected: + unsigned centreFrequency : 32; + unsigned bandwidth : 3; + unsigned reserved : 5; + unsigned constellation : 2; + unsigned hierarchyInformation : 3; + unsigned codeRateHpStream : 3; + unsigned codeRateLpStream : 3; + unsigned guardInterval : 2; + unsigned transmissionMode : 2; + unsigned otherFrequencyFlag : 1; + unsigned reserved2 : 32; + + public: + TerrestrialDeliverySystemDescriptor(const uint8_t * const buffer); + + uint32_t getCentreFrequency(void) const; + uint8_t getBandwidth(void) const; + uint8_t getConstellation(void) const; + uint8_t getHierarchyInformation(void) const; + uint8_t getCodeRateHpStream(void) const; + uint8_t getCodeRateLpStream(void) const; + uint8_t getGuardInterval(void) const; + uint8_t getTransmissionMode(void) const; + uint8_t getOtherFrequencyFlag(void) const; +}; + +#endif /* __dvb_descriptor_terrestrial_delivery_system_descriptor_h__ */ diff --git a/lib/dvb_si/time_shifted_event_descriptor.h b/lib/dvb_si/time_shifted_event_descriptor.h new file mode 100644 index 00000000..869ce7c9 --- /dev/null +++ b/lib/dvb_si/time_shifted_event_descriptor.h @@ -0,0 +1,40 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_time_shifted_event_descriptor_h__ +#define __dvb_descriptor_time_shifted_event_descriptor_h__ + +#include "descriptor.h" + +class TimeShiftedEventDescriptor : public Descriptor +{ + protected: + unsigned referenceServiceId : 16; + unsigned referenceEventId : 16; + + public: + TimeShiftedEventDescriptor(const uint8_t * const buffer); + + uint16_t getReferenceServiceId(void) const; + uint16_t getReferenceEventId(void) const; +}; + +#endif /* __dvb_descriptor_time_shifted_event_descriptor_h__ */ diff --git a/lib/dvb_si/time_shifted_service_descriptor.cpp b/lib/dvb_si/time_shifted_service_descriptor.cpp new file mode 100644 index 00000000..0b029147 --- /dev/null +++ b/lib/dvb_si/time_shifted_service_descriptor.cpp @@ -0,0 +1,33 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/time_shifted_service_descriptor.h> + +TimeShiftedServiceDescriptor::TimeShiftedServiceDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + referenceServiceId = (buffer[2] << 8) | buffer[3]; +} + +uint16_t TimeShiftedServiceDescriptor::getReferenceServiceId(void) const +{ + return referenceServiceId; +} + diff --git a/lib/dvb_si/time_shifted_service_descriptor.h b/lib/dvb_si/time_shifted_service_descriptor.h new file mode 100644 index 00000000..a16f9d73 --- /dev/null +++ b/lib/dvb_si/time_shifted_service_descriptor.h @@ -0,0 +1,38 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_time_shifted_service_descriptor_h__ +#define __dvb_descriptor_time_shifted_service_descriptor_h__ + +#include "descriptor.h" + +class TimeShiftedServiceDescriptor : public Descriptor +{ + protected: + unsigned referenceServiceId : 16; + + public: + TimeShiftedServiceDescriptor(const uint8_t * const buffer); + + uint16_t getReferenceServiceId(void) const; +}; + +#endif /* __dvb_descriptor_time_shifted_service_descriptor_h__ */ diff --git a/lib/dvb_si/tot.cpp b/lib/dvb_si/tot.cpp new file mode 100644 index 00000000..9e168c57 --- /dev/null +++ b/lib/dvb_si/tot.cpp @@ -0,0 +1,44 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/tot.h> + +TimeOffsetTable::TimeOffsetTable(const uint8_t * const buffer) : ShortCrcTable(buffer) +{ + utcTimeMjd = (buffer[3] << 8) | buffer[4]; + utcTimeBcd = (buffer[5] << 16) | (buffer[6] << 8) | buffer[7]; + reserved = (buffer[8] >> 4) & 0x0f; + descriptorsLoopLength = ((buffer[8] & 0x0f) << 8) | buffer[9]; + + for (uint16_t i = 0; i < descriptorsLoopLength; i += buffer[i + 11] + 2) + descriptor(&buffer[i + 10]); +} + +uint16_t TimeOffsetTable::getUtcTimeMjd(void) const +{ + return utcTimeMjd; +} + +uint32_t TimeOffsetTable::getUtcTimeBcd(void) const +{ + return utcTimeBcd; +} + diff --git a/lib/dvb_si/tot.h b/lib/dvb_si/tot.h new file mode 100644 index 00000000..303efbe5 --- /dev/null +++ b/lib/dvb_si/tot.h @@ -0,0 +1,51 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_table_tot_h__ +#define __dvb_table_tot_h__ + +#include <lib/dvb_si/container.h> +#include "short_crc_table.h" + +class TimeOffsetTable : public ShortCrcTable, public DescriptorContainer +{ + protected: + unsigned utcTimeMjd : 16; + unsigned utcTimeBcd : 24; + unsigned reserved : 4; + unsigned descriptorsLoopLength : 12; + + public: + TimeOffsetTable(const uint8_t * const buffer); + + static const enum PacketId PID = PID_TOT; + static const enum TableId TID = TID_TOT; + static const uint32_t TIMEOUT = 36000; + + uint16_t getUtcTimeMjd(void) const; + uint32_t getUtcTimeBcd(void) const; +}; + +typedef std::vector<TimeOffsetTable *> TimeOffsetTableVector; +typedef TimeOffsetTableVector::iterator TimeOffsetTableIterator; +typedef TimeOffsetTableVector::const_iterator TimeOffsetTableConstIterator; + +#endif /* __dvb_table_tot_h__ */ diff --git a/lib/dvb_si/transport_stream_descriptor.h b/lib/dvb_si/transport_stream_descriptor.h new file mode 100644 index 00000000..57d97391 --- /dev/null +++ b/lib/dvb_si/transport_stream_descriptor.h @@ -0,0 +1,38 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_transport_stream_descriptor_h__ +#define __dvb_descriptor_transport_stream_descriptor_h__ + +#include "descriptor.h" + +class TransportStreamDescriptor : public Descriptor +{ + protected: + std::string bytes; + + public: + TransportStreamDescriptor(const uint8_t * const buffer); + + std::string getBytes(void) const; +}; + +#endif /* __dvb_descriptor_transport_stream_descriptor_h__ */ diff --git a/lib/dvb_si/url_descriptor.h b/lib/dvb_si/url_descriptor.h new file mode 100644 index 00000000..7b544bdd --- /dev/null +++ b/lib/dvb_si/url_descriptor.h @@ -0,0 +1,34 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_url_descriptor_h__ +#define __dvb_descriptor_url_descriptor_h__ + +#include "descriptor.h" + +/* 0x90 */ +class UrlDescriptor : public Descriptor +{ + public: + UrlDescriptor(const uint8_t * const buffer); +}; + +#endif /* __dvb_descriptor_url_descriptor_h__ */ diff --git a/lib/dvb_si/vbi_data_descriptor.cpp b/lib/dvb_si/vbi_data_descriptor.cpp new file mode 100644 index 00000000..6778d344 --- /dev/null +++ b/lib/dvb_si/vbi_data_descriptor.cpp @@ -0,0 +1,98 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/vbi_data_descriptor.h> + +VbiDataLine::VbiDataLine(const uint8_t * const buffer) +{ + reserved = (buffer[0] >> 6) & 0x03; + fieldParity = (buffer[0] >> 5) & 0x01; + lineOffset = buffer[0] & 0x1F; +} + +uint8_t VbiDataLine::getFieldParity(void) const +{ + return fieldParity; +} + +uint8_t VbiDataLine::getLineOffset(void) const +{ + return lineOffset; +} + +VbiDataService::VbiDataService(const uint8_t * const buffer) +{ + uint16_t i; + + dataServiceId = buffer[0]; + dataServiceDescriptorLength = buffer[1]; + + switch (dataServiceId) { + case 0x01: + case 0x02: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + for (i = 0; i < dataServiceDescriptorLength; ++i); + vbiDataLines.push_back(new VbiDataLine(&buffer[i + 2])); + break; + + default: + for (i = 0; i < dataServiceDescriptorLength; ++i) + reserved.push_back(buffer[i + 2]); + break; + } +} + +VbiDataService::~VbiDataService(void) +{ + for (VbiDataLineIterator i = vbiDataLines.begin(); i != vbiDataLines.end(); ++i) + delete *i; +} + +uint8_t VbiDataService::getDataServiceId(void) const +{ + return dataServiceId; +} + +const VbiDataLineVector *VbiDataService::getVbiDataLines(void) const +{ + return &vbiDataLines; +} + +VbiDataDescriptor::VbiDataDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + for (uint16_t i = 0; i < descriptorLength; i += buffer[i + 3] + 2) + vbiDataServices.push_back(new VbiDataService(&buffer[i + 2])); +} + +VbiDataDescriptor::~VbiDataDescriptor(void) +{ + for (VbiDataServiceIterator i = vbiDataServices.begin(); i != vbiDataServices.end(); ++i) + delete *i; +} + +const VbiDataServiceVector *VbiDataDescriptor::getVbiDataServices(void) const +{ + return &vbiDataServices; +} + diff --git a/lib/dvb_si/vbi_data_descriptor.h b/lib/dvb_si/vbi_data_descriptor.h new file mode 100644 index 00000000..fe833ab2 --- /dev/null +++ b/lib/dvb_si/vbi_data_descriptor.h @@ -0,0 +1,77 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_vbi_data_descriptor_h__ +#define __dvb_descriptor_vbi_data_descriptor_h__ + +#include "descriptor.h" + +class VbiDataLine +{ + protected: + unsigned reserved : 2; + unsigned fieldParity : 1; + unsigned lineOffset : 5; + + public: + VbiDataLine(const uint8_t * const buffer); + + uint8_t getFieldParity(void) const; + uint8_t getLineOffset(void) const; +}; + +typedef std::vector<VbiDataLine *> VbiDataLineVector; +typedef VbiDataLineVector::iterator VbiDataLineIterator; +typedef VbiDataLineVector::const_iterator VbiDataLineConstIterator; + +class VbiDataService +{ + protected: + unsigned dataServiceId : 8; + unsigned dataServiceDescriptorLength : 8; + VbiDataLineVector vbiDataLines; + std::vector<uint8_t> reserved; + + public: + VbiDataService(const uint8_t * const buffer); + ~VbiDataService(void); + + uint8_t getDataServiceId(void) const; + const VbiDataLineVector *getVbiDataLines(void) const; +}; + +typedef std::vector<VbiDataService *> VbiDataServiceVector; +typedef VbiDataServiceVector::iterator VbiDataServiceIterator; +typedef VbiDataServiceVector::const_iterator VbiDataServiceConstIterator; + +class VbiDataDescriptor : public Descriptor +{ + protected: + VbiDataServiceVector vbiDataServices; + + public: + VbiDataDescriptor(const uint8_t * const buffer); + ~VbiDataDescriptor(void); + + const VbiDataServiceVector *getVbiDataServices(void) const; +}; + +#endif /* __dvb_descriptor_vbi_data_descriptor_h__ */ diff --git a/lib/dvb_si/vbi_teletext_descriptor.cpp b/lib/dvb_si/vbi_teletext_descriptor.cpp new file mode 100644 index 00000000..bdfafbac --- /dev/null +++ b/lib/dvb_si/vbi_teletext_descriptor.cpp @@ -0,0 +1,68 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/vbi_teletext_descriptor.h> + +VbiTeletext::VbiTeletext(const uint8_t * const buffer) +{ + iso639LanguageCode.assign((char *)&buffer[0], 3); + teletextType = (buffer[3] >> 3) & 0x1F; + teletextMagazineNumber = buffer[3] & 0x07; + teletextPageNumber = buffer[4]; +} + +std::string VbiTeletext::getIso639LanguageCode(void) const +{ + return iso639LanguageCode; +} + +uint8_t VbiTeletext::getTeletextType(void) const +{ + return teletextType; +} + +uint8_t VbiTeletext::getTeletextMagazineNumber(void) const +{ + return teletextMagazineNumber; +} + +uint8_t VbiTeletext::getTeletextPageNumber(void) const +{ + return teletextPageNumber; +} + +VbiTeletextDescriptor::VbiTeletextDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + for (uint16_t i = 0; i < descriptorLength; i += 5) + vbiTeletexts.push_back(new VbiTeletext(&buffer[i + 2])); +} + +VbiTeletextDescriptor::~VbiTeletextDescriptor(void) +{ + for (VbiTeletextIterator i = vbiTeletexts.begin(); i != vbiTeletexts.end(); ++i) + delete *i; +} + +const VbiTeletextVector *VbiTeletextDescriptor::getVbiTeletexts(void) const +{ + return &vbiTeletexts; +} + diff --git a/lib/dvb_si/vbi_teletext_descriptor.h b/lib/dvb_si/vbi_teletext_descriptor.h new file mode 100644 index 00000000..70fa3577 --- /dev/null +++ b/lib/dvb_si/vbi_teletext_descriptor.h @@ -0,0 +1,60 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_vbi_teletext_descriptor_h__ +#define __dvb_descriptor_vbi_teletext_descriptor_h__ + +#include "descriptor.h" + +class VbiTeletext +{ + protected: + std::string iso639LanguageCode; + unsigned teletextType : 5; + unsigned teletextMagazineNumber : 3; + unsigned teletextPageNumber : 8; + + public: + VbiTeletext(const uint8_t * const buffer); + + std::string getIso639LanguageCode(void) const; + uint8_t getTeletextType(void) const; + uint8_t getTeletextMagazineNumber(void) const; + uint8_t getTeletextPageNumber(void) const; +}; + +typedef std::vector<VbiTeletext *> VbiTeletextVector; +typedef VbiTeletextVector::iterator VbiTeletextIterator; +typedef VbiTeletextVector::const_iterator VbiTeletextConstIterator; + +class VbiTeletextDescriptor : public Descriptor +{ + protected: + VbiTeletextVector vbiTeletexts; + + public: + VbiTeletextDescriptor(const uint8_t * const buffer); + ~VbiTeletextDescriptor(void); + + const VbiTeletextVector *getVbiTeletexts(void) const; +}; + +#endif /* __dvb_descriptor_vbi_teletext_descriptor_h__ */ diff --git a/lib/dvb_si/video_stream_descriptor.cpp b/lib/dvb_si/video_stream_descriptor.cpp new file mode 100644 index 00000000..0bf50ee2 --- /dev/null +++ b/lib/dvb_si/video_stream_descriptor.cpp @@ -0,0 +1,73 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/video_stream_descriptor.h> + +VideoStreamDescriptor::VideoStreamDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + multipleFrameRateFlag = (buffer[2] >> 7) & 0x01; + frameRateCode = (buffer[2] >> 3) & 0x0F; + mpeg1OnlyFlag = (buffer[2] >> 2) & 0x01; + constrainedParameterFlag = (buffer[2] >> 1) & 0x01; + + if (!mpeg1OnlyFlag) { + profileAndLevelIndication = buffer[3]; + chromaFormat = (buffer[4] >> 6) & 0x03; + frameRateExtensionFlag = (buffer[4] >> 5) & 0x01; + reserved = buffer[4] & 0x1F; + } +} + +uint8_t VideoStreamDescriptor::getMultipleFrameRateFlag(void) const +{ + return multipleFrameRateFlag; +} + +uint8_t VideoStreamDescriptor::getFrameRateCode(void) const +{ + return frameRateCode; +} + +uint8_t VideoStreamDescriptor::getMpeg1OnlyFlag(void) const +{ + return mpeg1OnlyFlag; +} + +uint8_t VideoStreamDescriptor::getConstrainedParameterFlag(void) const +{ + return constrainedParameterFlag; +} + +uint8_t VideoStreamDescriptor::getProfileAndLevelIndication(void) const +{ + return profileAndLevelIndication; +} + +uint8_t VideoStreamDescriptor::getChromaFormat(void) const +{ + return chromaFormat; +} + +uint8_t VideoStreamDescriptor::getFrameRateExtensionFlag(void) const +{ + return frameRateExtensionFlag; +} + diff --git a/lib/dvb_si/video_stream_descriptor.h b/lib/dvb_si/video_stream_descriptor.h new file mode 100644 index 00000000..c671f23d --- /dev/null +++ b/lib/dvb_si/video_stream_descriptor.h @@ -0,0 +1,53 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_video_stream_descriptor_h__ +#define __dvb_descriptor_video_stream_descriptor_h__ + +#include "descriptor.h" + +class VideoStreamDescriptor : public Descriptor +{ + protected: + unsigned multipleFrameRateFlag : 1; + unsigned frameRateCode : 4; + unsigned mpeg1OnlyFlag : 1; + unsigned constrainedParameterFlag : 1; + unsigned stillPictureFlag : 1; + unsigned profileAndLevelIndication : 8; + unsigned chromaFormat : 2; + unsigned frameRateExtensionFlag : 1; + unsigned reserved : 5; + + public: + VideoStreamDescriptor(const uint8_t * const buffer); + + uint8_t getMultipleFrameRateFlag(void) const; + uint8_t getFrameRateCode(void) const; + uint8_t getMpeg1OnlyFlag(void) const; + uint8_t getConstrainedParameterFlag(void) const; + uint8_t getStillPictureFlag(void) const; + uint8_t getProfileAndLevelIndication(void) const; + uint8_t getChromaFormat(void) const; + uint8_t getFrameRateExtensionFlag(void) const; +}; + +#endif /* __dvb_descriptor_video_stream_descriptor_h__ */ diff --git a/lib/dvb_si/video_window_descriptor.cpp b/lib/dvb_si/video_window_descriptor.cpp new file mode 100644 index 00000000..ea073bf4 --- /dev/null +++ b/lib/dvb_si/video_window_descriptor.cpp @@ -0,0 +1,45 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <lib/dvb_si/video_window_descriptor.h> + +VideoWindowDescriptor::VideoWindowDescriptor(const uint8_t * const buffer) : Descriptor(buffer) +{ + horizontalOffset = ((buffer[2] << 8) | (buffer[3] & 0xF3)) >> 2; + verticalOffset = (((buffer[3] & 0x03) << 16) | (buffer[4] << 8) | (buffer[5] & 0xF0)) >> 4; + windowPriority = buffer[5] & 0x0F; +} + +uint16_t VideoWindowDescriptor::getHorizontalOffset(void) const +{ + return horizontalOffset; +} + +uint16_t VideoWindowDescriptor::getVerticalOffset(void) const +{ + return verticalOffset; +} + +uint8_t VideoWindowDescriptor::getWindowPriority(void) const +{ + return windowPriority; +} + diff --git a/lib/dvb_si/video_window_descriptor.h b/lib/dvb_si/video_window_descriptor.h new file mode 100644 index 00000000..6ea49b2d --- /dev/null +++ b/lib/dvb_si/video_window_descriptor.h @@ -0,0 +1,42 @@ +/* + * $Id$ + * + * (C) 2002-2003 Andreas Oberritter <obi@saftware.de> + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __dvb_descriptor_video_window_descriptor_h__ +#define __dvb_descriptor_video_window_descriptor_h__ + +#include "descriptor.h" + +class VideoWindowDescriptor : public Descriptor +{ + protected: + unsigned horizontalOffset : 14; + unsigned verticalOffset : 14; + unsigned windowPriority : 4; + + public: + VideoWindowDescriptor(const uint8_t * const buffer); + + uint16_t getHorizontalOffset(void) const; + uint16_t getVerticalOffset(void) const; + uint8_t getWindowPriority(void) const; +}; + +#endif /* __dvb_descriptor_video_window_descriptor_h__ */ |
