summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS2
-rw-r--r--HISTORY2
-rw-r--r--device.c6
-rw-r--r--remux.c22
-rw-r--r--remux.h8
5 files changed, 36 insertions, 4 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 26091096..350f8a2c 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -1643,6 +1643,8 @@ Udo Richter <udo_richter@gmx.de>
for suggesting to add a note to the INSTALL file about using subdirectories to
split a large disk into separate areas for VDR's video data and other stuff
for reporting wrong variable types in cIndexFile
+ for reporting a problem with cDevice::PlayTsVideo() and cDevice::PlayTsAudio() in
+ case only part of the buffer has been accepted by the device
Sven Kreiensen <svenk@kammer.uni-hannover.de>
for his help in keeping 'channels.conf.terr' up to date
diff --git a/HISTORY b/HISTORY
index f1a84adc..823aeef8 100644
--- a/HISTORY
+++ b/HISTORY
@@ -6140,3 +6140,5 @@ Video Disk Recorder Revision History
- Fixed storing the current OSD size in case the device has
changed it in its setup menu (reported by Reinhard Nissl).
+- Fixed cDevice::PlayTsVideo() and cDevice::PlayTsAudio() in case only part of the
+ buffer has been accepted by the device (reported by Udo Richter).
diff --git a/device.c b/device.c
index 834b6ead..00f6aa74 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.23 2009/06/06 13:25:58 kls Exp $
+ * $Id: device.c 2.24 2009/06/21 13:26:06 kls Exp $
*/
#include "device.h"
@@ -1293,6 +1293,8 @@ 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)
+ tsToPesVideo.SetRepeatLast();
if (w <= 0)
return w;
}
@@ -1308,6 +1310,8 @@ int cDevice::PlayTsAudio(const uchar *Data, int Length)
int l;
if (const uchar *p = tsToPesAudio.GetPes(l)) {
int w = PlayAudio(p, l, 0);
+ if (w == 0)
+ tsToPesAudio.SetRepeatLast();
if (w <= 0)
return w;
tsToPesAudio.Reset();
diff --git a/remux.c b/remux.c
index 97c139c9..20664d7b 100644
--- a/remux.c
+++ b/remux.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: remux.c 2.24 2009/06/06 13:24:57 kls Exp $
+ * $Id: remux.c 2.25 2009/06/21 13:30:03 kls Exp $
*/
#include "remux.h"
@@ -610,7 +610,8 @@ bool cPatPmtParser::GetVersions(int &PatVersion, int &PmtVersion)
cTsToPes::cTsToPes(void)
{
data = NULL;
- size = length = offset = 0;
+ size = 0;
+ Reset();
}
cTsToPes::~cTsToPes()
@@ -641,6 +642,11 @@ void cTsToPes::PutTs(const uchar *Data, int Length)
const uchar *cTsToPes::GetPes(int &Length)
{
+ if (repeatLast) {
+ repeatLast = false;
+ Length = lastLength;
+ return lastData;
+ }
if (offset < length && PesLongEnough(length)) {
if (!PesHasLength(data)) // this is a video PES packet with undefined length
offset = 6; // trigger setting PES length for initial slice
@@ -661,12 +667,16 @@ const uchar *cTsToPes::GetPes(int &Length)
p[4] = l / 256;
p[5] = l & 0xFF;
Length = l + 6;
+ lastLength = Length;
+ lastData = p;
return p;
}
else {
Length = PesLength(data);
if (Length <= length) {
offset = Length; // to make sure we break out in case of garbage data
+ lastLength = Length;
+ lastData = data;
return data;
}
}
@@ -674,9 +684,17 @@ const uchar *cTsToPes::GetPes(int &Length)
return NULL;
}
+void cTsToPes::SetRepeatLast(void)
+{
+ repeatLast = true;
+}
+
void cTsToPes::Reset(void)
{
length = offset = 0;
+ lastData = NULL;
+ lastLength = 0;
+ repeatLast = false;
}
// --- Some helper functions for debugging -----------------------------------
diff --git a/remux.h b/remux.h
index 0dd1a9ab..84b35f06 100644
--- a/remux.h
+++ b/remux.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: remux.h 2.17 2009/06/06 13:26:23 kls Exp $
+ * $Id: remux.h 2.18 2009/06/21 13:01:30 kls Exp $
*/
#ifndef __REMUX_H
@@ -252,6 +252,9 @@ private:
int size;
int length;
int offset;
+ uchar *lastData;
+ int lastLength;
+ bool repeatLast;
public:
cTsToPes(void);
~cTsToPes();
@@ -279,6 +282,9 @@ public:
///< TS packet that will be given to PutTs() has the "payload start" flag
///< set, because this is the only way to determine the end of a video PES
///< packet.
+ void SetRepeatLast(void);
+ ///< Makes the next call to GetPes() return exactly the same data as the
+ ///< last one (provided there was no call to Reset() in the meantime).
void Reset(void);
///< Resets the converter. This needs to be called after a PES packet has
///< been fetched by a call to GetPes(), and before the next call to