From c2ecee3d40438bbc0e736d19ecaacdca45b5fa4e Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 24 Jan 2009 11:20:24 +0100 Subject: Fixed cDevice::PlayTsAudio() and made cDevice::PlayTsVideo() return 0 if PlayVideo() didn't play anything --- HISTORY | 4 +++- device.c | 27 +++++++++++---------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/HISTORY b/HISTORY index e34a8774..25241902 100644 --- a/HISTORY +++ b/HISTORY @@ -5912,7 +5912,7 @@ Video Disk Recorder Revision History can handle DVB-S2. The #define is still there to allow people with older drivers who don't need DVB-S2 to use this version without pathcing. -2009-01-23: Version 1.7.4 +2009-01-24: Version 1.7.4 - Removed the '#define FE_CAN_2ND_GEN_MODULATION', since it was wrong and the flag is now in the driver, anyway. @@ -5954,3 +5954,5 @@ Video Disk Recorder Revision History packets (suggested by Frank Schmirler). - Changed cPatPmtGenerator to make sure the PMT pid doesn't collide with any of the actual pids of the channel. +- Fixed cDevice::PlayTsAudio() and made cDevice::PlayTsVideo() return 0 if + PlayVideo() didn't play anything. diff --git a/device.c b/device.c index 3679651e..d1e350f2 100644 --- a/device.c +++ b/device.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 2.8 2009/01/23 16:02:21 kls Exp $ + * $Id: device.c 2.9 2009/01/24 11:16:31 kls Exp $ */ #include "device.h" @@ -1273,7 +1273,7 @@ int cDevice::PlayTsVideo(const uchar *Data, int Length) int l; while (const uchar *p = tsToPesVideo.GetPes(l)) { int w = PlayVideo(p, l); - if (w < 0) + if (w <= 0) return w; } tsToPesVideo.Reset(); @@ -1284,20 +1284,15 @@ int cDevice::PlayTsVideo(const uchar *Data, int Length) int cDevice::PlayTsAudio(const uchar *Data, int Length) { - bool PayloadStart = TsPayloadStart(Data); - for (int Pass = 0; Pass < 2; Pass++) { - if (Pass == 0 && !PayloadStart) // if no new payload is started, we can always put the packet into the converter - tsToPesAudio.PutTs(Data, Length); - if (const uchar *p = tsToPesAudio.GetPes(Length)) { - int w = PlayAudio(p, Length, 0); - if (w > 0) - tsToPesAudio.Reset(); - else if (PayloadStart) - return w; // must get out the old packet before starting a new one - } - if (Pass == 0 && PayloadStart) - tsToPesAudio.PutTs(Data, Length); - } + // Audio PES always has an explicit length and consists of single packets: + int l; + if (const uchar *p = tsToPesAudio.GetPes(l)) { + int w = PlayAudio(p, l, 0); + if (w <= 0) + return w; + tsToPesAudio.Reset(); + } + tsToPesAudio.PutTs(Data, Length); return Length; } -- cgit v1.2.3