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

Improved cDvbDevice::StillPicture()

This commit is contained in:
Klaus Schmidinger 2003-10-19 12:59:16 +02:00
parent e7b6b2fff7
commit 2b29a5ce36
2 changed files with 13 additions and 5 deletions

View File

@ -2434,6 +2434,10 @@ Video Disk Recorder Revision History
- Channel IDs are now checked when reading 'channels.conf' to avoid later - Channel IDs are now checked when reading 'channels.conf' to avoid later
problems with timers. problems with timers.
2003-10-19: Version 1.2.6pre2
- Improved cDvbDevice::StillPicture() (thanks to Thomas Heiligenmann).
2003-10-18: Version 1.3.0 2003-10-18: Version 1.3.0
- Changed thread handling to make it work with NPTL ("Native Posix Thread Library"). - Changed thread handling to make it work with NPTL ("Native Posix Thread Library").

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: dvbdevice.c 1.68 2003/10/18 12:20:38 kls Exp $ * $Id: dvbdevice.c 1.69 2003/10/19 12:59:16 kls Exp $
*/ */
#include "dvbdevice.h" #include "dvbdevice.h"
@ -956,10 +956,14 @@ void cDvbDevice::StillPicture(const uchar *Data, int Length)
// skip header extension // skip header extension
if ((Data[i + 6] & 0xC0) == 0x80) { if ((Data[i + 6] & 0xC0) == 0x80) {
// MPEG-2 PES header // MPEG-2 PES header
if (Data[i + 8] >= Length)
break;
offs += 3; offs += 3;
offs += Data[i + 8]; offs += Data[i + 8];
len -= 3; len -= 3;
len -= Data[i + 8]; len -= Data[i + 8];
if (len < 0 || offs + len >= Length)
break;
} }
else { else {
// MPEG-1 PES header // MPEG-1 PES header
@ -967,19 +971,19 @@ void cDvbDevice::StillPicture(const uchar *Data, int Length)
offs++; offs++;
len--; len--;
} }
if ((Data[offs] & 0xC0) == 0x40) { if (offs <= Length - 2 && len >= 2 && (Data[offs] & 0xC0) == 0x40) {
offs += 2; offs += 2;
len -= 2; len -= 2;
} }
if ((Data[offs] & 0xF0) == 0x20) { if (offs <= Length - 5 && len >= 5 && (Data[offs] & 0xF0) == 0x20) {
offs += 5; offs += 5;
len -= 5; len -= 5;
} }
else if ((Data[offs] & 0xF0) == 0x30) { else if (offs <= Length - 10 && len >= 10 && (Data[offs] & 0xF0) == 0x30) {
offs += 10; offs += 10;
len -= 10; len -= 10;
} }
else if (Data[offs] == 0x0F) { else if (offs < Length && len > 0) {
offs++; offs++;
len--; len--;
} }