summaryrefslogtreecommitdiff
path: root/libsi/section.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2004-01-04 18:00:00 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2004-01-04 18:00:00 +0100
commit93a94b18b540fbcb9bcdaaea9abd26cdf23d6ee6 (patch)
treebede17e6cd329d36ec02bc53dfe567b95ec835a5 /libsi/section.c
parentc432905dd60630f906ac89f58592ad835a9063ef (diff)
downloadvdr-patch-lnbsharing-93a94b18b540fbcb9bcdaaea9abd26cdf23d6ee6.tar.gz
vdr-patch-lnbsharing-93a94b18b540fbcb9bcdaaea9abd26cdf23d6ee6.tar.bz2
Version 1.3.0vdr-1.3.0
- Changed thread handling to make it work with NPTL ("Native Posix Thread Library"). Thanks to Jon Burgess, Andreas Schultz, Werner Fink and Stefan Huelswitt. - The cThread class now accepts a 'Description' parameter, which is used to log the beginning and end of the thread, together with its process and thread id. For descriptions that need additional parameters you can use the function cThread::SetDescription(), which accepts 'printf()' like arguments. Existing plugins that use threads should be changed to use this functionality instead of explicit 'dsyslog()' calls inside their Action() function in order to support logging the thread ids. - Added "Slovak Link" and "Czech Link" to 'ca.conf' (thanks to Emil Petersky). However, 'ca.conf' is now pretty much obsolete due to the automatic CA handling. - Mutexes are now created with PTHREAD_MUTEX_ERRORCHECK_NP, which makes the 'lockingTid' stuff obsolete (thanks to Stefan Huelswitt). - Changed font handling to allow language specific character sets. - Adopted the small font character set from the "Elchi" patch (originally provided by Alessio Sangalli). - Greek language texts now use iso8859-7 character set (thanks to Dimitrios Dimitrakos). - Rearranged section data handling, so that the actual data handling can be done separately, even from within plugins. - The EPG data structures have been moved from eit.[hc] to epg.[hc] and have been adapted to the general VDR coding style. Plugins that use these data structures may need to change some function names (which should be obvious). The name 'subtitle' has been changed to 'shortText' to avoid clashes with actual subtitles that are part of a movie. The name 'extendedDescription' has been shortened to 'description'. - Replaced 'libdtv' with 'libsi' (thanks to Marcel Wiesweg), which is thread safe and can be used by multiple section filters simultaneously. - Added 'cRwLock' to 'thread.[hc]'. Note that all plugin Makefiles need to define _GNU_SOURCE for this to work (see the example plugin Makefiles and 'newplugin'). - Fixed a problem with crc32 in SI handling on 64bit systems (thanks to Pedro Miguel Sequeira de Justo Teixeira for reporting this one). - Fixed an alignment problem in CAM access on 64bit systems (thanks to Pedro Miguel Sequeira de Justo Teixeira for reporting this one). - Added 'StreamType' setting to CAM communication, which is important for Aston/SECA CAMs (thanks to Antonino Sergi). - Now the CA descriptors are sent to the CAM in the 'program' or 'ES level' sections, depending on where they are found in the PMT (thanks to Hans-Peter Raschke for reporting this one). This should make SkyCrypt CAMs work. - Now using the 'version number' of EPG events to avoid unnecessary work. - Channel data is now automatically derived from the DVB data stream (inspired by the 'autopid' patch from Andreas Schultz). - The current channel is now automatically re-tuned if the PIDs or other settings change. If a recording is going on on a channel that has a change in its settings, the recording will be stopped and immediately restarted to use the new channel settings. - EPG events now use the complete channel ID with NID, TID and SID. - Channel names in 'channels.conf' can now have a short form, as provided by some tv stations (see man vdr(5)). Currently channels that provide short names in addition to long ones are listed in the OSD as "short,long name", as in "RTL,RTL Television". The short names will be used explicitly later. - The Ca parameter in 'channels.conf' has been extended and now contains all the CA system ids for the given channel. When switching to a channel VDR now tests for a device that provides one of these CA system ids. The devices automatically get their supported ids from the CI handler. - The values in 'ca.conf' are currently without any real meaning. Whether or not a channel with conditional access can be received is now determined automatically by evaluating its CA descriptors and comparing them to the CA system ids provided by the installed CAM. Only the special values 1-16 are used to assign a channel to a particular device. - Increased the maximum number of possible OSD colors to 256. - Limited the line length in the EPG bugfix report, which appears to fix a buffer overflow that caused a crash when cleaning up the EPG data (at 05:00 in the morning).
Diffstat (limited to 'libsi/section.c')
-rw-r--r--libsi/section.c328
1 files changed, 328 insertions, 0 deletions
diff --git a/libsi/section.c b/libsi/section.c
new file mode 100644
index 0000000..0de2a57
--- /dev/null
+++ b/libsi/section.c
@@ -0,0 +1,328 @@
+/***************************************************************************
+ * Copyright (c) 2003 by Marcel Wiesweg *
+ * *
+ * 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. *
+ * *
+ * $Id: section.c 1.2 2003/12/13 10:42:14 kls Exp $
+ * *
+ ***************************************************************************/
+
+#include "section.h"
+#include <stdio.h>
+
+namespace SI {
+
+/*********************** PAT ***********************/
+
+void PAT::Parse() {
+ unsigned int offset=0;
+ data.setPointerAndOffset<const pat>(s, offset);
+ associationLoop.setData(data+offset, getLength()-offset-4);
+}
+
+int PAT::getTransportStreamId() const {
+ return HILO(s->transport_stream_id);
+}
+
+int PAT::Association::getServiceId() const {
+ return HILO(s->program_number);
+}
+
+int PAT::Association::getPid() const {
+ return HILO(s->network_pid);
+}
+
+void PAT::Association::Parse() {
+ s=data.getData<pat_prog>();
+}
+
+/*********************** CAT ***********************/
+
+void CAT::Parse() {
+ loop.setData(data+sizeof(cat), getLength()-sizeof(cat)-4);
+}
+
+/*********************** PMT ***********************/
+
+void PMT::Parse() {
+ unsigned int offset=0;
+ data.setPointerAndOffset<const pmt>(s, offset);
+ commonDescriptors.setDataAndOffset(data+offset, HILO(s->program_info_length), offset);
+ streamLoop.setData(data+offset, getLength()-offset-4);
+}
+
+int PMT::getServiceId() const {
+ return HILO(s->program_number);
+}
+
+int PMT::getPCRPid() const {
+ return HILO(s->PCR_PID);
+}
+
+int PMT::Stream::getPid() const {
+ return HILO(s->elementary_PID);
+}
+
+int PMT::Stream::getStreamType() const {
+ return s->stream_type;
+}
+
+void PMT::Stream::Parse() {
+ unsigned int offset=0;
+ data.setPointerAndOffset<const pmt_info>(s, offset);
+ streamDescriptors.setData(data+offset, HILO(s->ES_info_length));
+}
+
+/*********************** NIT ***********************/
+
+int NIT::getNetworkId() const {
+ return HILO(s->network_id);
+}
+
+void NIT::Parse() {
+ unsigned int offset=0;
+ data.setPointerAndOffset<const nit>(s, offset);
+ commonDescriptors.setDataAndOffset(data+offset, HILO(s->network_descriptor_length), offset);
+ const nit_mid *mid;
+ data.setPointerAndOffset<const nit_mid>(mid, offset);
+ transportStreamLoop.setData(data+offset, HILO(mid->transport_stream_loop_length));
+}
+
+int NIT::TransportStream::getTransportStreamId() const {
+ return HILO(s->transport_stream_id);
+}
+
+int NIT::TransportStream::getOriginalNetworkId() const {
+ return HILO(s->original_network_id);
+}
+
+void NIT::TransportStream::Parse() {
+ unsigned int offset=0;
+ data.setPointerAndOffset<const ni_ts>(s, offset);
+ transportStreamDescriptors.setData(data+offset, HILO(s->transport_descriptors_length));
+}
+
+/*********************** SDT ***********************/
+
+void SDT::Parse() {
+ unsigned int offset=0;
+ data.setPointerAndOffset<const sdt>(s, offset);
+ serviceLoop.setData(data+offset, getLength()-offset-4); //4 is for CRC
+}
+
+int SDT::getTransportStreamId() const {
+ return HILO(s->transport_stream_id);
+}
+
+int SDT::getOriginalNetworkId() const {
+ return HILO(s->original_network_id);
+}
+
+int SDT::Service::getServiceId() const {
+ return HILO(s->service_id);
+}
+
+int SDT::Service::getEITscheduleFlag() const {
+ return s->eit_schedule_flag;
+}
+
+int SDT::Service::getEITpresentFollowingFlag() const {
+ return s->eit_present_following_flag;
+}
+
+RunningStatus SDT::Service::getRunningStatus() const {
+ return (RunningStatus)s->running_status;
+}
+
+int SDT::Service::getFreeCaMode() const {
+ return s->free_ca_mode;
+}
+
+void SDT::Service::Parse() {
+ unsigned int offset=0;
+ data.setPointerAndOffset<const sdt_descr>(s, offset);
+ serviceDescriptors.setData(data+offset, HILO(s->descriptors_loop_length));
+}
+
+/*********************** EIT ***********************/
+
+int EIT::getServiceId() const {
+ return HILO(s->service_id);
+}
+
+int EIT::getTransportStreamId() const {
+ return HILO(s->transport_stream_id);
+}
+
+int EIT::getOriginalNetworkId() const {
+ return HILO(s->original_network_id);
+}
+
+bool EIT::isPresentFollowing() const {
+ return getTableId() == TableIdEIT_presentFollowing || getTableId() == TableIdEIT_presentFollowing_other;
+}
+
+bool EIT::isActualTS() const {
+ return
+ (getTableId() ==TableIdEIT_presentFollowing)
+ || (TableIdEIT_schedule_first <= getTableId() && getTableId() <= TableIdEIT_schedule_last);
+}
+
+void EIT::Parse() {
+ unsigned int offset=0;
+ data.setPointerAndOffset<const eit>(s, offset);
+ //printf("%d %d %d %d %d\n", getServiceId(), getTransportStreamId(), getOriginalNetworkId(), isPresentFollowing(), isActualTS());
+ eventLoop.setData(data+offset, getLength()-offset-4); //4 is for CRC
+}
+
+time_t EIT::Event::getStartTime() const {
+ return DVBTime::getTime(s->mjd_hi, s->mjd_lo, s->start_time_h, s->start_time_m, s->start_time_s);
+}
+
+time_t EIT::Event::getDuration() const {
+ return DVBTime::getDuration(s->duration_h, s->duration_m, s->duration_s);
+}
+
+int EIT::Event::getEventId() const {
+ return HILO(s->event_id);
+}
+
+int EIT::Event::getMJD() const {
+ return HILO(s->mjd);
+}
+
+int EIT::Event::getStartTimeHour() const {
+ return DVBTime::bcdToDec(s->start_time_h);
+}
+
+int EIT::Event::getStartTimeMinute() const {
+ return DVBTime::bcdToDec(s->start_time_m);
+}
+
+int EIT::Event::getStartTimeSecond() const {
+ return DVBTime::bcdToDec(s->start_time_s);
+}
+
+int EIT::Event::getDurationHour() const {
+ return DVBTime::bcdToDec(s->duration_h);
+}
+
+int EIT::Event::getDurationMinute() const {
+ return DVBTime::bcdToDec(s->duration_m);
+}
+
+int EIT::Event::getDurationSecond() const {
+ return DVBTime::bcdToDec(s->duration_s);
+}
+
+RunningStatus EIT::Event::getRunningStatus() const {
+ return (RunningStatus)s->running_status;
+}
+
+int EIT::Event::getFreeCaMode() const {
+ return s->free_ca_mode;
+}
+
+void EIT::Event::Parse() {
+ unsigned int offset=0;
+ data.setPointerAndOffset<const eit_event>(s, offset);
+ //printf("%d %d %d\n", getStartTime(), getDuration(), getRunningStatus());
+ eventDescriptors.setData(data+offset, HILO(s->descriptors_loop_length));
+}
+
+/*********************** TDT ***********************/
+
+time_t TDT::getTime() const {
+ return DVBTime::getTime(s->utc_mjd_hi, s->utc_mjd_lo, s->utc_time_h, s->utc_time_m, s->utc_time_s);
+}
+
+void TDT::Parse() {
+ s=data.getData<const tdt>();
+}
+
+/*********************** TOT ***********************/
+
+time_t TOT::getTime() const {
+ return DVBTime::getTime(s->utc_mjd_hi, s->utc_mjd_lo, s->utc_time_h, s->utc_time_m, s->utc_time_s);
+}
+
+void TOT::Parse() {
+ unsigned int offset=0;
+ data.setPointerAndOffset<const tot>(s, offset);
+ descriptorLoop.setData(data+offset, getLength()-offset-4);
+}
+
+/*********************** RST ***********************/
+
+void RST::Parse() {
+ unsigned int offset=0;
+ const rst *s;
+ data.setPointerAndOffset<const rst>(s, offset);
+ infoLoop.setData(data+offset, getLength()-offset);
+}
+
+int RST::RunningInfo::getTransportStreamId() const {
+ return HILO(s->transport_stream_id);
+}
+
+int RST::RunningInfo::getOriginalNetworkId() const {
+ return HILO(s->original_network_id);
+}
+
+int RST::RunningInfo::getServiceId() const {
+ return HILO(s->service_id);
+}
+
+int RST::RunningInfo::getEventId() const {
+ return HILO(s->event_id);
+}
+
+RunningStatus RST::RunningInfo::getRunningStatus() const {
+ return (RunningStatus)s->running_status;
+}
+
+void RST::RunningInfo::Parse() {
+ s=data.getData<const rst_info>();
+}
+
+/*********************** AIT ***********************/
+
+int AIT::getApplicationType() const {
+ return HILO(first->application_type);
+}
+
+int AIT::getAITVersion() const {
+ return first->version_number;
+}
+
+void AIT::Parse() {
+ unsigned int offset=0;
+ data.setPointerAndOffset<const ait>(first, offset);
+ commonDescriptors.setDataAndOffset(data+offset, HILO(first->common_descriptors_length), offset);
+ const ait_mid *mid;
+ data.setPointerAndOffset<const ait_mid>(mid, offset);
+ applicationLoop.setData(data+offset, HILO(mid->application_loop_length));
+}
+
+long AIT::Application::getOrganisationId() const {
+ return data.FourBytes(0);
+}
+
+int AIT::Application::getApplicationId() const {
+ return HILO(s->application_id);
+}
+
+int AIT::Application::getControlCode() const {
+ return s->application_control_code;
+}
+
+void AIT::Application::Parse() {
+ unsigned int offset=0;
+ data.setPointerAndOffset<const ait_app>(s, offset);
+ applicationDescriptors.setData(data+offset, HILO(s->application_descriptors_length));
+}
+
+} //end of namespace