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.
|
* 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>
|
#include <fcntl.h>
|
||||||
@ -43,8 +43,7 @@ bool cIptvProtocolFile::OpenFile(void)
|
|||||||
debug("cIptvProtocolFile::OpenFile()\n");
|
debug("cIptvProtocolFile::OpenFile()\n");
|
||||||
// Check that stream address is valid
|
// Check that stream address is valid
|
||||||
if (!fileActive && !isempty(streamAddr)) {
|
if (!fileActive && !isempty(streamAddr)) {
|
||||||
|
fileStream = fopen(streamAddr, "rb");
|
||||||
fileStream = fopen(streamAddr, "rb");
|
|
||||||
if (ferror(fileStream) || !fileStream) {
|
if (ferror(fileStream) || !fileStream) {
|
||||||
char tmp[64];
|
char tmp[64];
|
||||||
error("ERROR: fopen(): %s", strerror_r(errno, tmp, sizeof(tmp)));
|
error("ERROR: fopen(): %s", strerror_r(errno, tmp, sizeof(tmp)));
|
||||||
@ -59,10 +58,10 @@ bool cIptvProtocolFile::OpenFile(void)
|
|||||||
void cIptvProtocolFile::CloseFile(void)
|
void cIptvProtocolFile::CloseFile(void)
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolFile::CloseFile()\n");
|
debug("cIptvProtocolFile::CloseFile()\n");
|
||||||
// Check that stream address is valid
|
// Check that file stream is valid
|
||||||
if (fileActive && !isempty(streamAddr)) {
|
if (fileActive && !isempty(streamAddr)) {
|
||||||
fclose(fileStream);
|
fclose(fileStream);
|
||||||
// Update multicasting flag
|
// Update active flag
|
||||||
fileActive = false;
|
fileActive = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -71,21 +70,22 @@ int cIptvProtocolFile::Read(unsigned char* *BufferAddr)
|
|||||||
{
|
{
|
||||||
//debug("cIptvProtocolFile::Read()\n");
|
//debug("cIptvProtocolFile::Read()\n");
|
||||||
*BufferAddr = readBuffer;
|
*BufferAddr = readBuffer;
|
||||||
if(ferror(fileStream)) {
|
// Check errors
|
||||||
debug("Read error\n");
|
if (ferror(fileStream)) {
|
||||||
return -1;
|
debug("Read error\n");
|
||||||
}
|
return -1;
|
||||||
if(feof(fileStream)) {
|
}
|
||||||
rewind(fileStream);
|
// Rewind if EOF
|
||||||
return -1;
|
if (feof(fileStream))
|
||||||
}
|
rewind(fileStream);
|
||||||
|
// Read the file stream
|
||||||
return fread(readBuffer, sizeof(unsigned char), readBufferLen, fileStream);
|
return fread(readBuffer, sizeof(unsigned char), readBufferLen, fileStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cIptvProtocolFile::Open(void)
|
bool cIptvProtocolFile::Open(void)
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolFile::Open(): streamAddr=%s\n", streamAddr);
|
debug("cIptvProtocolFile::Open(): streamAddr=%s\n", streamAddr);
|
||||||
// Open the file for input
|
// Open the file stream
|
||||||
OpenFile();
|
OpenFile();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -93,7 +93,7 @@ bool cIptvProtocolFile::Open(void)
|
|||||||
bool cIptvProtocolFile::Close(void)
|
bool cIptvProtocolFile::Close(void)
|
||||||
{
|
{
|
||||||
debug("cIptvProtocolFile::Close(): streamAddr=%s\n", streamAddr);
|
debug("cIptvProtocolFile::Close(): streamAddr=%s\n", streamAddr);
|
||||||
// Close the file input
|
// Close the file stream
|
||||||
CloseFile();
|
CloseFile();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -102,13 +102,13 @@ bool cIptvProtocolFile::Set(const char* Address, const int Port)
|
|||||||
{
|
{
|
||||||
debug("cIptvProtocolFile::Set(): %s:%d\n", Address, Port);
|
debug("cIptvProtocolFile::Set(): %s:%d\n", Address, Port);
|
||||||
if (!isempty(Address)) {
|
if (!isempty(Address)) {
|
||||||
// Close the file input
|
// Close the file stream
|
||||||
CloseFile();
|
CloseFile();
|
||||||
// Update stream address and port
|
// Update stream address and port
|
||||||
streamAddr = strcpyrealloc(streamAddr, Address);
|
streamAddr = strcpyrealloc(streamAddr, Address);
|
||||||
streamPort = Port;
|
streamPort = Port;
|
||||||
// Open the file for input
|
// Open the file for input
|
||||||
OpenFile();
|
OpenFile();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user