summaryrefslogtreecommitdiff
path: root/device.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2009-01-24 11:20:24 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2009-01-24 11:20:24 +0100
commitc2ecee3d40438bbc0e736d19ecaacdca45b5fa4e (patch)
treeced8dd714af584f60c20455f0b5d73d75d11c057 /device.c
parent2b174b07bde731981068895a780e3e0564bb85ac (diff)
downloadvdr-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.c27
1 files changed, 11 insertions, 16 deletions
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;
}