Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

mxcpcStreamFile Class Reference
[mxcpc_core (Core Module - MxPEG Decoding Infrastructure)]

File serving as stream source for stream decoding via mxcpcStreamDecoder. More...

#include <mxcpcStreamFile.h>

Inheritance diagram for mxcpcStreamFile:

mxcpcStreamSource List of all members.

Public Member Functions

 mxcpcStreamFile (const char *filename)
 mxcpcStreamFile (int fd)
 ~mxcpcStreamFile ()
void setTimedBlockModeEnabled (bool enabled, long timeout=1000)
 Toggles/configures the timed block mode, see mxcpcStreamFile.
int fetchBytes (unsigned char *buffer, int num)
 (Re)implemented.
bool stillUp (void)
 (Re)implemented.

Private Attributes

int InFile
bool StillUp
bool TimedBlockMode
long BlockTimeout
bool CloseFileUponDestruction
int RestoreMode
 only used on WINDOWS
long OSFHandle

Detailed Description

File serving as stream source for stream decoding via mxcpcStreamDecoder.

If invoked by specifying a filename to the constructor, the respective file is automatically opened. It is also automatically closed again when the stream file is deleted later.

If, on the other hand, the stream file is invoked by specifying a POSIX file descriptor to the constructor, the file descriptor is used instead. Note that in this case the corresponing file is not closed upon stream file destruction.

The stream file sports a so-called Timed Block Mode that can be toggled at any time using the setTimedBlockModeEnabled() method. If enabled, a UNIX select() call is issued prior to read attempts on the encapsuled file descriptor using the specified timeout. This causes the fetchBytes() implementation to block in the kernel if no data is available, but at most for that many milliseconds as was specified to setTimedBlockModeEnabled(). If such a blocking times out before any new data come in over the file descriptor, fetchBytes() returns with a return value of 0.

As usual, with Microsoft happily adding non-POSIX flags to POSIX interfaces, we have to provide a modified implementation for the WINDOWS platform.

Definition at line 56 of file mxcpcStreamFile.h.


The documentation for this class was generated from the following files:
Generated on Mon Jan 30 15:13:10 2006 for mxcpc by  doxygen 1.4.4