mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
Fixed playing files with PES packets longer than 2048 byte through the full featured DVB card
This commit is contained in:
26
tools.c
26
tools.c
@@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: tools.c 1.87 2005/01/04 11:06:45 kls Exp $
|
||||
* $Id: tools.c 1.88 2005/01/16 11:47:44 kls Exp $
|
||||
*/
|
||||
|
||||
#include "tools.h"
|
||||
@@ -65,6 +65,30 @@ void writechar(int filedes, char c)
|
||||
safe_write(filedes, &c, sizeof(c));
|
||||
}
|
||||
|
||||
int WriteAllOrNothing(int fd, const uchar *Data, int Length, int TimeoutMs, int RetryMs)
|
||||
{
|
||||
int written = 0;
|
||||
while (Length > 0) {
|
||||
int w = write(fd, Data + written, Length);
|
||||
if (w > 0) {
|
||||
Length -= w;
|
||||
written += w;
|
||||
}
|
||||
else if (written > 0 && !FATALERRNO) {
|
||||
// we've started writing, so we must finish it!
|
||||
cTimeMs t;
|
||||
cPoller Poller(fd, true);
|
||||
Poller.Poll(RetryMs);
|
||||
if (TimeoutMs > 0 && (TimeoutMs -= t.Elapsed()) <= 0)
|
||||
break;
|
||||
}
|
||||
else
|
||||
// nothing written yet (or fatal error), so we can just return the error code:
|
||||
return w;
|
||||
}
|
||||
return written;
|
||||
}
|
||||
|
||||
char *strcpyrealloc(char *dest, const char *src)
|
||||
{
|
||||
if (src) {
|
||||
|
Reference in New Issue
Block a user