diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2009-01-24 11:20:24 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2009-01-24 11:20:24 +0100 |
commit | c2ecee3d40438bbc0e736d19ecaacdca45b5fa4e (patch) | |
tree | ced8dd714af584f60c20455f0b5d73d75d11c057 /device.c | |
parent | 2b174b07bde731981068895a780e3e0564bb85ac (diff) | |
download | vdr-c2ecee3d40438bbc0e736d19ecaacdca45b5fa4e.tar.gz vdr-c2ecee3d40438bbc0e736d19ecaacdca45b5fa4e.tar.bz2 |
Fixed cDevice::PlayTsAudio() and made cDevice::PlayTsVideo() return 0 if PlayVideo() didn't play anything
Diffstat (limited to 'device.c')
-rw-r--r-- | device.c | 27 |
1 files changed, 11 insertions, 16 deletions
@@ -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; } |