libtriple: add workaround for 'odd filter length' problem in cDemux

Origin commit data
------------------
Branch: master
Commit: bad7975133
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2011-02-06 (Sun, 06 Feb 2011)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2011-02-06 19:22:12 +01:00
parent a9af47e7ab
commit 3ea81a587e

View File

@@ -212,13 +212,17 @@ bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filte
const unsigned char * const negmask)
{
struct demux_filter_para flt;
int length;
memset(&flt, 0, sizeof(flt));
if (len > FILTER_LENGTH - 2)
fprintf(stderr, "cDemux::sectionFilter #%d: len too long: %d, FILTER_LENGTH: %d\n", num, len, FILTER_LENGTH);
length = (len + 2 + 1) & 0xfe; /* reportedly, the TD drivers don't handle odd filter */
if (length > FILTER_LENGTH) /* lengths well. So make sure the length is a multiple */
length = FILTER_LENGTH; /* of 2. The unused mask is zeroed anyway. */
flt.pid = pid;
flt.filter_length = len + 2 * (len > 1); /* only add the two bytes if required */
flt.filter_length = length;
flt.filter[0] = filter[0];
flt.mask[0] = mask[0];
flt.timeout = timeout;