1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Made GetCaDescriptors() and GetCaPids() return all values if CaSystemIds is 0xFFFF

This commit is contained in:
Klaus Schmidinger 2014-01-04 11:17:24 +01:00
parent a84defe86f
commit 7cbced0c12
2 changed files with 8 additions and 6 deletions

6
pat.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: pat.c 3.1 2014/01/01 12:02:39 kls Exp $ * $Id: pat.c 3.2 2014/01/04 11:17:24 kls Exp $
*/ */
#include "pat.h" #include "pat.h"
@ -167,7 +167,7 @@ int cCaDescriptors::GetCaDescriptors(const int *CaSystemIds, int BufSize, uchar
if (EsPid < 0 || d->EsPid() == EsPid) { if (EsPid < 0 || d->EsPid() == EsPid) {
const int *caids = CaSystemIds; const int *caids = CaSystemIds;
do { do {
if (d->CaSystem() == *caids) { if (*caids == 0xFFFF || d->CaSystem() == *caids) {
if (length + d->Length() <= BufSize) { if (length + d->Length() <= BufSize) {
memcpy(Data + length, d->Data(), d->Length()); memcpy(Data + length, d->Data(), d->Length());
length += d->Length(); length += d->Length();
@ -192,7 +192,7 @@ int cCaDescriptors::GetCaPids(const int *CaSystemIds, int BufSize, int *Pids)
for (cCaDescriptor *d = caDescriptors.First(); d; d = caDescriptors.Next(d)) { for (cCaDescriptor *d = caDescriptors.First(); d; d = caDescriptors.Next(d)) {
const int *caids = CaSystemIds; const int *caids = CaSystemIds;
do { do {
if (d->CaSystem() == *caids) { if (*caids == 0xFFFF || d->CaSystem() == *caids) {
if (numPids + 1 < BufSize) { if (numPids + 1 < BufSize) {
Pids[numPids++] = d->CaPid(); Pids[numPids++] = d->CaPid();
Pids[numPids] = 0; Pids[numPids] = 0;

8
pat.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: pat.h 3.1 2013/12/30 11:32:40 kls Exp $ * $Id: pat.h 3.2 2014/01/04 11:16:48 kls Exp $
*/ */
#ifndef __PAT_H #ifndef __PAT_H
@ -36,7 +36,8 @@ int GetCaDescriptors(int Source, int Transponder, int ServiceId, const int *CaSy
///< Gets all CA descriptors for a given channel. ///< Gets all CA descriptors for a given channel.
///< Copies all available CA descriptors for the given Source, Transponder and ServiceId ///< Copies all available CA descriptors for the given Source, Transponder and ServiceId
///< into the provided buffer at Data (at most BufSize bytes). Only those CA descriptors ///< into the provided buffer at Data (at most BufSize bytes). Only those CA descriptors
///< are copied that match one of the given CA system IDs. ///< are copied that match one of the given CA system IDs (or all of them, if CaSystemIds
///< is 0xFFFF).
///< Returns the number of bytes copied into Data (0 if no CA descriptors are ///< Returns the number of bytes copied into Data (0 if no CA descriptors are
///< available), or -1 if BufSize was too small to hold all CA descriptors. ///< available), or -1 if BufSize was too small to hold all CA descriptors.
@ -44,7 +45,8 @@ int GetCaPids(int Source, int Transponder, int ServiceId, const int *CaSystemIds
///< Gets all CA pids for a given channel. ///< Gets all CA pids for a given channel.
///< Copies all available CA pids from the CA descriptors for the given Source, Transponder and ServiceId ///< Copies all available CA pids from the CA descriptors for the given Source, Transponder and ServiceId
///< into the provided buffer at Pids (at most BufSize - 1 entries, the list will be zero-terminated). ///< into the provided buffer at Pids (at most BufSize - 1 entries, the list will be zero-terminated).
///< Only the CA pids of those CA descriptors are copied that match one of the given CA system IDs. ///< Only the CA pids of those CA descriptors are copied that match one of the given CA system IDs
///< (or all of them, if CaSystemIds is 0xFFFF).
///< Returns the number of pids copied into Pids (0 if no CA descriptors are ///< Returns the number of pids copied into Pids (0 if no CA descriptors are
///< available), or -1 if BufSize was too small to hold all CA pids. ///< available), or -1 if BufSize was too small to hold all CA pids.