Version 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).
This commit is contained in:
Klaus Schmidinger
2004-01-04 18:00:00 +01:00
parent c432905dd6
commit 93a94b18b5
98 changed files with 30394 additions and 9643 deletions

71
ci.c
View File

@@ -4,14 +4,11 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: ci.c 1.17 2003/10/26 13:04:23 kls Exp $
* $Id: ci.c 1.21 2004/01/02 15:07:36 kls Exp $
*/
/* XXX TODO
- update CA descriptors in case they change
XXX*/
#include "ci.h"
#include <asm/unaligned.h>
#include <ctype.h>
#include <linux/dvb/ca.h>
#include <malloc.h>
@@ -21,6 +18,7 @@ XXX*/
#include <sys/ioctl.h>
#include <time.h>
#include <unistd.h>
#include "pat.h"
#include "tools.h"
/* these might come in handy in case you want to use this code without VDR's other files:
@@ -793,10 +791,10 @@ bool cCiApplicationInformation::Process(int Length, const uint8_t *Data)
if ((l -= 1) < 0) break;
applicationType = *d++;
if ((l -= 2) < 0) break;
applicationManufacturer = ntohs(*(uint16_t *)d);
applicationManufacturer = ntohs(get_unaligned((uint16_t *)d));
d += 2;
if ((l -= 2) < 0) break;
manufacturerCode = ntohs(*(uint16_t *)d);
manufacturerCode = ntohs(get_unaligned((uint16_t *)d));
d += 2;
free(menuString);
menuString = GetString(l, &d);
@@ -1265,8 +1263,9 @@ bool cCiEnquiry::Cancel(void)
#define CPCI_QUERY 0x03
#define CPCI_NOT_SELECTED 0x04
cCiCaPmt::cCiCaPmt(int ProgramNumber)
cCiCaPmt::cCiCaPmt(int Source, int Transponder, int ProgramNumber, const unsigned short *CaSystemIds)
{
caDescriptorsLength = GetCaDescriptors(Source, Transponder, ProgramNumber, CaSystemIds, sizeof(caDescriptors), caDescriptors, streamFlag);
length = 0;
capmt[length++] = CPLM_ONLY;
capmt[length++] = (ProgramNumber >> 8) & 0xFF;
@@ -1275,20 +1274,31 @@ cCiCaPmt::cCiCaPmt(int ProgramNumber)
esInfoLengthPos = length;
capmt[length++] = 0x00; // program_info_length H (at program level)
capmt[length++] = 0x00; // program_info_length L
if (!streamFlag)
AddCaDescriptors(caDescriptorsLength, caDescriptors);
}
void cCiCaPmt::AddPid(int Pid)
bool cCiCaPmt::Valid(void)
{
//XXX buffer overflow check???
capmt[length++] = 0x00; //XXX stream_type (apparently doesn't matter)
capmt[length++] = (Pid >> 8) & 0xFF;
capmt[length++] = Pid & 0xFF;
esInfoLengthPos = length;
capmt[length++] = 0x00; // ES_info_length H (at ES level)
capmt[length++] = 0x00; // ES_info_length L
return caDescriptorsLength > 0;
}
void cCiCaPmt::AddCaDescriptor(int Length, uint8_t *Data)
void cCiCaPmt::AddPid(int Pid, uint8_t StreamType)
{
if (Pid) {
//XXX buffer overflow check???
capmt[length++] = StreamType;
capmt[length++] = (Pid >> 8) & 0xFF;
capmt[length++] = Pid & 0xFF;
esInfoLengthPos = length;
capmt[length++] = 0x00; // ES_info_length H (at ES level)
capmt[length++] = 0x00; // ES_info_length L
if (streamFlag)
AddCaDescriptors(caDescriptorsLength, caDescriptors);
}
}
void cCiCaPmt::AddCaDescriptors(int Length, const uint8_t *Data)
{
if (esInfoLengthPos) {
if (length + Length < int(sizeof(capmt))) {
@@ -1355,7 +1365,7 @@ cCiHandler *cCiHandler::CreateCiHandler(const char *FileName)
int cCiHandler::ResourceIdToInt(const uint8_t *Data)
{
return (ntohl(*(int *)Data));
return (ntohl(get_unaligned((int32_t *)Data)));
}
bool cCiHandler::Send(uint8_t Tag, int SessionId, int ResourceId, int Status)
@@ -1367,10 +1377,10 @@ bool cCiHandler::Send(uint8_t Tag, int SessionId, int ResourceId, int Status)
if (Status >= 0)
*p++ = Status;
if (ResourceId) {
*(int *)p = htonl(ResourceId);
put_unaligned(htonl(ResourceId), (int32_t *)p);
p += 4;
}
*(short *)p = htons(SessionId);
put_unaligned(htons(SessionId), (uint16_t *)p);
p += 2;
buffer[1] = p - buffer - 2; // length
return tc && tc->SendData(p - buffer, buffer) == OK;
@@ -1481,7 +1491,7 @@ bool cCiHandler::Process(void)
if (Data && Length > 1) {
switch (*Data) {
case ST_SESSION_NUMBER: if (Length > 4) {
int SessionId = ntohs(*(short *)&Data[2]);
int SessionId = ntohs(get_unaligned((uint16_t *)&Data[2]));
cCiSession *Session = GetSessionBySessionId(SessionId);
if (Session)
Session->Process(Length - 4, Data + 4);
@@ -1492,7 +1502,7 @@ bool cCiHandler::Process(void)
case ST_OPEN_SESSION_REQUEST: OpenSession(Length, Data);
break;
case ST_CLOSE_SESSION_REQUEST: if (Length == 4)
CloseSession(ntohs(*(short *)&Data[2]));
CloseSession(ntohs(get_unaligned((uint16_t *)&Data[2])));
break;
case ST_CREATE_SESSION_RESPONSE: //XXX fall through to default
case ST_CLOSE_SESSION_RESPONSE: //XXX fall through to default
@@ -1556,6 +1566,23 @@ const unsigned short *cCiHandler::GetCaSystemIds(int Slot)
return cas ? cas->GetCaSystemIds() : NULL;
}
bool cCiHandler::ProvidesCa(const unsigned short *CaSystemIds)
{
cMutexLock MutexLock(&mutex);
for (int Slot = 0; Slot < numSlots; Slot++) {
cCiConditionalAccessSupport *cas = (cCiConditionalAccessSupport *)GetSessionByResourceId(RI_CONDITIONAL_ACCESS_SUPPORT, Slot);
if (cas) {
for (const unsigned short *ids = cas->GetCaSystemIds(); ids && *ids; ids++) {
for (const unsigned short *id = CaSystemIds; *id; id++) {
if (*id == *ids)
return true;
}
}
}
}
return false;
}
bool cCiHandler::SetCaPmt(cCiCaPmt &CaPmt, int Slot)
{
cMutexLock MutexLock(&mutex);