mirror of
https://github.com/rofafor/vdr-plugin-iptv.git
synced 2023-10-10 13:37:03 +02:00
Changed rewinding to transparent.
This commit is contained in:
parent
07cb89d82e
commit
b53d25a56f
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: protocolfile.c,v 1.3 2007/09/16 14:47:01 ajhseppa Exp $
|
||||
* $Id: protocolfile.c,v 1.4 2007/09/16 17:31:38 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
@ -43,7 +43,6 @@ bool cIptvProtocolFile::OpenFile(void)
|
||||
debug("cIptvProtocolFile::OpenFile()\n");
|
||||
// Check that stream address is valid
|
||||
if (!fileActive && !isempty(streamAddr)) {
|
||||
|
||||
fileStream = fopen(streamAddr, "rb");
|
||||
if (ferror(fileStream) || !fileStream) {
|
||||
char tmp[64];
|
||||
@ -59,10 +58,10 @@ bool cIptvProtocolFile::OpenFile(void)
|
||||
void cIptvProtocolFile::CloseFile(void)
|
||||
{
|
||||
debug("cIptvProtocolFile::CloseFile()\n");
|
||||
// Check that stream address is valid
|
||||
// Check that file stream is valid
|
||||
if (fileActive && !isempty(streamAddr)) {
|
||||
fclose(fileStream);
|
||||
// Update multicasting flag
|
||||
// Update active flag
|
||||
fileActive = false;
|
||||
}
|
||||
}
|
||||
@ -71,21 +70,22 @@ int cIptvProtocolFile::Read(unsigned char* *BufferAddr)
|
||||
{
|
||||
//debug("cIptvProtocolFile::Read()\n");
|
||||
*BufferAddr = readBuffer;
|
||||
// Check errors
|
||||
if (ferror(fileStream)) {
|
||||
debug("Read error\n");
|
||||
return -1;
|
||||
}
|
||||
if(feof(fileStream)) {
|
||||
// Rewind if EOF
|
||||
if (feof(fileStream))
|
||||
rewind(fileStream);
|
||||
return -1;
|
||||
}
|
||||
// Read the file stream
|
||||
return fread(readBuffer, sizeof(unsigned char), readBufferLen, fileStream);
|
||||
}
|
||||
|
||||
bool cIptvProtocolFile::Open(void)
|
||||
{
|
||||
debug("cIptvProtocolFile::Open(): streamAddr=%s\n", streamAddr);
|
||||
// Open the file for input
|
||||
// Open the file stream
|
||||
OpenFile();
|
||||
return true;
|
||||
}
|
||||
@ -93,7 +93,7 @@ bool cIptvProtocolFile::Open(void)
|
||||
bool cIptvProtocolFile::Close(void)
|
||||
{
|
||||
debug("cIptvProtocolFile::Close(): streamAddr=%s\n", streamAddr);
|
||||
// Close the file input
|
||||
// Close the file stream
|
||||
CloseFile();
|
||||
return true;
|
||||
}
|
||||
@ -102,7 +102,7 @@ bool cIptvProtocolFile::Set(const char* Address, const int Port)
|
||||
{
|
||||
debug("cIptvProtocolFile::Set(): %s:%d\n", Address, Port);
|
||||
if (!isempty(Address)) {
|
||||
// Close the file input
|
||||
// Close the file stream
|
||||
CloseFile();
|
||||
// Update stream address and port
|
||||
streamAddr = strcpyrealloc(streamAddr, Address);
|
||||
|
Loading…
Reference in New Issue
Block a user