Valkka
1.6.1
OpenSource Video Management
|
A general class for on-disk stored streams. More...
#include <filestream.h>
Public Member Functions | |
AbstractFileStream () | |
Default constructor. | |
AbstractFileState | getState () |
void | setRefMstime (long int ms_streamtime_) |
Creates a correspondence with the current wallclock time and a desider stream time, by calculating FileStream::reftime. See Presention timing and playing. | |
void | play () |
Start playing the stream. | |
void | stop () |
Stop playing the strem. | |
long int | update (long int mstimestamp) |
Tries to achieve mstimestamp: calculates FileStream::target_mstimestamp_ and calls pullNextFrame. Returns the timeout for the next frame. | |
virtual void | seek (long int ms_streamtime_) |
Seek to a desider stream time. | |
virtual long int | pullNextFrame () |
Tries to achieve FileStream::target_mstimestamp_ . Sends frames whose timestamps are less than that to the filterchain (e.g. to FileContext::framefilter). Returns timeout to the next frame. | |
Protected Attributes | |
long int | reftime |
Relation between the stream time and wallclock time. See Presention timing and playing. | |
long int | target_mstimestamp_ |
Where the stream would like to be (underscore means stream time) | |
long int | frame_mstimestamp_ |
Timestamp of previous frame sent, -1 means there was no previous frame (underscore means stream time) | |
AbstractFileState | state |
Decribes the FileStream state: errors, stopped, playing, etc. | |
Frame * | next_frame |
Pointer to the next frame about to be presented. | |
BasicFrame | out_frame |
BasicFrame payload that's passed on to the filterchain. | |
A general class for on-disk stored streams.
This class keeps the books for each file stream, in particular:
Subclasses:
In variable names, underscore means stream time. See Presention timing and playing
Threads use the (derived) class as follows:
while (loop):
if ( (next_pts - mstime) <= 0) next_pts = AbstractFileStream->update(mstime) --> if called too early, returns => next_pts = AbstractFileStream->pullNextFrame() => writes frame into FrameFilter => take next time frame .. if frames with same timestamp, call recursively => return next_pts => set internal state : self.next_frame --> next_pts in wallclock time --> when seeking, next_pts is smaller than mstime for many consecutive frames mstime = getCurrentMsTimestamp() --> handle signals if enough time has passed (refresh mstime) timeout = next_pts - mstime --> read incoming FrameFifo with timeout --> if frame, call AbstractFileStream->pushFrame(frame) => AbstractFileStream caches the frame (refresh mstime)