1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed cDevice::PlayTsVideo() and cDevice::PlayTsAudio() in case only part of the buffer has been accepted by the device

This commit is contained in:
Klaus Schmidinger 2009-06-21 13:34:40 +02:00
parent b14d498613
commit e33ba08af4
5 changed files with 36 additions and 4 deletions

View File

@ -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

View File

@ -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).

View File

@ -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();

22
remux.c
View File

@ -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 -----------------------------------

View File

@ -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