Fixed extracting the ES data and added MPEG1 handling to cDvbDevice::StillPicture()

This commit is contained in:
Klaus Schmidinger 2003-10-17 13:47:03 +02:00
parent bbffcee572
commit d800cf56f5
4 changed files with 56 additions and 18 deletions

View File

@ -176,6 +176,7 @@ Stefan Huelswitt <huels@iname.com>
for fixing a memory leak in cNonBlockingFileReader
for fixing an uninitialized variable in cDisplayChannel
for fixing a possible access of invalid file handles in cSIProcessor::Action()
for fixing extracting the ES data in cDvbDevice::StillPicture()
Ulrich Röder <roeder@efr-net.de>
for pointing out that there are channels that have a symbol rate higher than
@ -267,6 +268,7 @@ Andy Grobb <Charly98@01019freenet.de>
Thomas Heiligenmann <thomas@heiligenmann.de>
for implementing the SVDRP commands LSTR and DELR
for adding MPEG1 handling to cDvbDevice::StillPicture()
Norbert Schmidt <nschmidt-nrw@t-online.de>
for filling in some missing teletext PIDs

View File

@ -2403,7 +2403,7 @@ Video Disk Recorder Revision History
- Updated 'channels.conf.cable' (thanks to Stefan Hußfeldt).
2003-10-03: Version 1.3.0
2003-10-17: Version 1.2.6pre1
- Updated the required driver version in INSTALL (thanks to Jens Groth for
reporting this one).
@ -2420,3 +2420,7 @@ Video Disk Recorder Revision History
- Now trying to get a timer's channel without RID when loading 'timers.conf'
(thanks to Thomas Rausch).
- Removed the unused 0x73 (TOT) filter in eit.c (thanks to Andreas Trauer).
- Fixed extracting the ES data in cDvbDevice::StillPicture() (thanks to Stefan
Huelswitt).
- Added MPEG1 handling to cDvbDevice::StillPicture() (thanks to Thomas
Heiligenmann).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: config.h 1.175 2003/10/03 11:49:31 kls Exp $
* $Id: config.h 1.176 2003/10/17 12:35:23 kls Exp $
*/
#ifndef __CONFIG_H
@ -19,8 +19,8 @@
#include "device.h"
#include "tools.h"
#define VDRVERSION "1.3.0"
#define VDRVERSNUM 10300 // Version * 10000 + Major * 100 + Minor
#define VDRVERSION "1.2.6pre1"
#define VDRVERSNUM 10206 // Version * 10000 + Major * 100 + Minor
#define MAXPRIORITY 99
#define MAXLIFETIME 99

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbdevice.c 1.65 2003/10/04 12:31:15 kls Exp $
* $Id: dvbdevice.c 1.66 2003/10/17 13:31:06 kls Exp $
*/
#include "dvbdevice.h"
@ -947,21 +947,53 @@ void cDvbDevice::StillPicture(const uchar *Data, int Length)
return;
int i = 0;
int blen = 0;
while (i < Length - 4) {
if (Data[i] == 0x00 && Data[i + 1] == 0x00 && Data[i + 2] == 0x01 && (Data[i + 3] & 0xF0) == 0xE0) {
// skip PES header
int offs = i + 6;
while (i < Length - 6) {
if (Data[i] == 0x00 && Data[i + 1] == 0x00 && Data[i + 2] == 0x01) {
int len = Data[i + 4] * 256 + Data[i + 5];
// skip header extension
if ((Data[i + 6] & 0xC0) == 0x80) {
offs += 3;
offs += Data[i + 8];
len -= 3;
len -= Data[i + 8];
if ((Data[i + 3] & 0xF0) == 0xE0) { // video packet
// skip PES header
int offs = i + 6;
// skip header extension
if ((Data[i + 6] & 0xC0) == 0x80) {
// MPEG-2 PES header
offs += 3;
offs += Data[i + 8];
len -= 3;
len -= Data[i + 8];
}
else {
// MPEG-1 PES header
while (offs < Length && len > 0 && Data[offs] == 0xFF) {
offs++;
len--;
}
if ((Data[offs] & 0xC0) == 0x40) {
offs += 2;
len -= 2;
}
if ((Data[offs] & 0xF0) == 0x20) {
offs += 5;
len -= 5;
}
else if ((Data[offs] & 0xF0) == 0x30) {
offs += 10;
len -= 10;
}
else if (Data[offs] == 0x0F) {
offs++;
len--;
}
}
if (blen + len > Length) // invalid PES length field
break;
memcpy(&buf[blen], &Data[offs], len);
i = offs + len;
blen += len;
}
memcpy(&buf[blen], &Data[offs], len);
i = offs + len;
blen += len;
else if (Data[i + 3] >= 0xBD && Data[i + 3] <= 0xDF) // other PES packets
i += len + 6;
else
i++;
}
else
i++;