MistServer  2.5.3-Pro-19-gf5e75b1 ( Generic_64)
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Attributes
Mist::inputBuffer Class Reference

#include <input_buffer.h>

Inheritance diagram for Mist::inputBuffer:
Mist::Input Mist::InOutBase

Public Member Functions

 inputBuffer (Util::Config *cfg)
 
 ~inputBuffer ()
 
virtual void argumentsParsed ()
 
void bufferFinalize (unsigned long tid)
 Wraps up the buffering of a shared memory data page. More...
 
void bufferLivePacket (JSON::Value &packet)
 Buffers a live packet to a page. More...
 
void bufferLivePacket (DTSC::Packet &packet)
 Buffers a live packet to a page. More...
 
void bufferNext (DTSC::Packet &pack)
 Buffers the next packet on the currently opened page. More...
 
void bufferNext (JSON::Value &pack)
 Buffers the next packet on the currently opened page. More...
 
void bufferRemove (unsigned long tid, unsigned long pageNumber)
 Removes a fully buffered page. More...
 
bool bufferStart (unsigned long tid, unsigned long pageNumber)
 
void initiateMeta ()
 Opens a shared memory page for the stream metadata. More...
 
virtual int run ()
 

Protected Member Functions

virtual bool atKeyFrame ()
 
bool bufferFrame (unsigned int track, unsigned int keyNum)
 
void checkHeaderTimes (std::string streamFile)
 
void continueNegotiate (unsigned long tid)
 
virtual void convert ()
 
void eraseTrackDataPages (unsigned long tid)
 
void finish ()
 
void getNext (bool smart=true)
 
virtual void parseHeader ()
 
void play (int until=0)
 
void playOnce ()
 
void quitPlay ()
 
bool readHeader ()
 
bool removeKey (unsigned int tid)
 
void removeUnused ()
 
void seek (int seekTime)
 
virtual void serve ()
 The main loop for inputs in stream serving mode. More...
 
bool setup ()
 
void trackSelect (std::string trackSpec)
 
void updateMeta ()
 
void updateMetaFromPage (unsigned long tNum, unsigned long pageNum)
 
void updateTrackMeta (unsigned long tNum)
 
void userCallback (char *data, size_t len, unsigned int id)
 

Static Protected Member Functions

static void callbackWrapper (char *data, size_t len, unsigned int id)
 

Protected Attributes

std::set< unsigned long > activeTracks
 
unsigned int benchMark
 
std::map< unsigned long, std::map< unsigned long, DTSCPageData > > bufferLocations
 Maps trackid to a pagenum->pageData map. More...
 
JSON::Value capa
 
std::map< unsigned long, std::string > initData
 
int initialTime
 Timestamp of the last time we received or sent something. More...
 
bool isBuffer
 
std::map< int, std::set< int > > keyTimes
 
int lastActive
 Media-timestamp of the last packet. More...
 
std::map< unsigned long, unsigned long long > lastUpdated
 
DTSC::Meta myMeta
 Stores either the input or output metadata. More...
 
std::set< unsigned long > negotiatingTracks
 
std::map< unsigned long, unsigned long long > negotiationTimeout
 
negotiationProxy nProxy
 
unsigned int packTime
 
std::map< unsigned int, std::map< unsigned int, unsigned int > > pageCounter
 
int playing
 
unsigned int playUntil
 
std::map< unsigned long, char * > pushLocation
 
long long int recBpos
 
std::ofstream recFile
 
DTSC::Meta recMeta
 
std::string recName
 
int recordingPid
 
std::set< unsigned long > selectedTracks
 Stores the track id's that are either selected for playback or input. More...
 
inputBuffersingleton
 
bool standAlone
 
std::string streamName
 
DTSC::Packet thisPacket
 
IPC::sharedServer userPage
 

Static Protected Attributes

static Util::Configconfig = NULL
 

Private Attributes

unsigned int bufferTime
 
unsigned int cutTime
 
bool hasPush
 
unsigned int lastReTime
 
bool resumeMode
 
unsigned int segmentSize
 

Constructor & Destructor Documentation

Mist::inputBuffer::inputBuffer ( Util::Config cfg)
Mist::inputBuffer::~inputBuffer ( )

Member Function Documentation

virtual void Mist::Input::argumentsParsed ( )
inlinevirtualinherited
bool Mist::Input::atKeyFrame ( )
protectedvirtualinherited

Reimplemented in Mist::inputISMV.

void Mist::InOutBase::bufferFinalize ( unsigned long  tid)
inherited

Wraps up the buffering of a shared memory data page.

Registers the data page on the track index page as well

Parameters
tidThe trackid of the page to finalize
bool Mist::Input::bufferFrame ( unsigned int  track,
unsigned int  keyNum 
)
protectedinherited
void Mist::InOutBase::bufferLivePacket ( JSON::Value packet)
inherited

Buffers a live packet to a page.

Handles both buffering and creation of new pages

Initiates/continues negotiation with the buffer as well

Parameters
packetThe packet to buffer
void Mist::InOutBase::bufferLivePacket ( DTSC::Packet packet)
inherited

Buffers a live packet to a page.

Handles both buffering and creation of new pages

Initiates/continues negotiation with the buffer as well

Parameters
packetThe packet to buffer
void Mist::InOutBase::bufferNext ( DTSC::Packet pack)
inherited

Buffers the next packet on the currently opened page.

Parameters
packThe packet to buffer
void Mist::InOutBase::bufferNext ( JSON::Value pack)
inherited

Buffers the next packet on the currently opened page.

Parameters
packThe packet to buffer
Note
Internally calls bufferNext(DTSC::Packet & pack)
void Mist::InOutBase::bufferRemove ( unsigned long  tid,
unsigned long  pageNumber 
)
inherited

Removes a fully buffered page.

Does not do anything if the process is not standalone, in this case the master process will have an overloaded version of this function.

Parameters
tidThe trackid to remove the page from
pageNumberThe number of the page to remove
bool Mist::InOutBase::bufferStart ( unsigned long  tid,
unsigned long  pageNumber 
)
inherited
void Mist::Input::callbackWrapper ( char *  data,
size_t  len,
unsigned int  id 
)
staticprotectedinherited
void Mist::Input::checkHeaderTimes ( std::string  streamFile)
protectedinherited
void Mist::InOutBase::continueNegotiate ( unsigned long  tid)
protectedinherited
void Mist::Input::convert ( )
protectedvirtualinherited
void Mist::inputBuffer::eraseTrackDataPages ( unsigned long  tid)
protected
void Mist::inputBuffer::finish ( )
protectedvirtual

Reimplemented from Mist::Input.

void Mist::inputBuffer::getNext ( bool  smart = true)
protectedvirtual

Reimplemented from Mist::Input.

void Mist::InOutBase::initiateMeta ( )
inherited

Opens a shared memory page for the stream metadata.

Assumes myMeta contains the metadata to write.

void Mist::Input::parseHeader ( )
protectedvirtualinherited
void Mist::Input::play ( int  until = 0)
protectedinherited
void Mist::Input::playOnce ( )
protectedinherited
void Mist::Input::quitPlay ( )
protectedinherited
bool Mist::inputBuffer::readHeader ( )
protectedvirtual

Implements Mist::Input.

bool Mist::inputBuffer::removeKey ( unsigned int  tid)
protected
Todo:
Fix recording
void Mist::inputBuffer::removeUnused ( )
protectedvirtual
Trigger:
The "STREAM_TRACK_REMOVE" trigger is stream-specific, and is ran whenever a track is fully removed from a live strean buffer.

It cannot be cancelled. Its payload is:

streamname
trackID
Todo:
Consider replacing with eraseTrackDataPages(it->first)?

Reimplemented from Mist::Input.

int Mist::Input::run ( )
virtualinherited
void Mist::inputBuffer::seek ( int  seekTime)
protectedvirtual

Reimplemented from Mist::Input.

void Mist::Input::serve ( )
protectedvirtualinherited

The main loop for inputs in stream serving mode.

Trigger:
The "STREAM_READY" trigger is stream-specific, and is ran whenever an input finished loading and started serving a stream. If cancelled, the input is immediately shut down again. Its payload is:
streamname
input name
The "STREAM_UNLOAD" trigger is stream-specific, and is ran right before an input shuts down and stops serving a stream. If cancelled, the shut down is delayed. Its payload is:
streamname
input name
bool Mist::inputBuffer::setup ( )
protectedvirtual

< Contains server configuration and capabilities

Implements Mist::Input.

void Mist::inputBuffer::trackSelect ( std::string  trackSpec)
protectedvirtual

Reimplemented from Mist::Input.

void Mist::inputBuffer::updateMeta ( )
protected
Trigger:
The "STREAM_BUFFER" trigger is stream-specific, and is ran whenever the buffer changes state between playable (FULL) or not (EMPTY).

It cannot be cancelled. It is possible to receive multiple EMPTY calls without FULL calls in between, as EMPTY is always generated when a stream is unloaded from memory, even if this stream never reached playable state in the first place (e.g. a broadcast was cancelled before filling enough buffer to be playable). Its payload is:

streamname
FULL or EMPTY (depending on current state)
void Mist::inputBuffer::updateMetaFromPage ( unsigned long  tNum,
unsigned long  pageNum 
)
protected
void Mist::inputBuffer::updateTrackMeta ( unsigned long  tNum)
protected
void Mist::inputBuffer::userCallback ( char *  data,
size_t  len,
unsigned int  id 
)
protectedvirtual
Trigger:
The "STREAM_TRACK_ADD" trigger is stream-specific, and is ran whenever a new track is added to a live strean buffer.

It cannot be cancelled. Its payload is:

streamname
trackID
Todo:
Optimize this part. Find a way to not have to store the metadata in JSON first, but read it from the page immediately
Todo:
Maybe switch to a new form of detecting collisions, especially with regards to multiple audio languages and camera angles.

Reimplemented from Mist::Input.

Field Documentation

std::set<unsigned long> Mist::inputBuffer::activeTracks
protected
unsigned int Mist::Input::benchMark
protectedinherited
std::map<unsigned long, std::map<unsigned long, DTSCPageData> > Mist::inputBuffer::bufferLocations
protected

Maps trackid to a pagenum->pageData map.

unsigned int Mist::inputBuffer::bufferTime
private
JSON::Value Mist::Input::capa
protectedinherited
Util::Config * Mist::InOutBase::config = NULL
staticprotectedinherited
unsigned int Mist::inputBuffer::cutTime
private
bool Mist::inputBuffer::hasPush
private
std::map<unsigned long, std::string> Mist::inputBuffer::initData
protected
int Mist::Input::initialTime
protectedinherited

Timestamp of the last time we received or sent something.

bool Mist::Input::isBuffer
protectedinherited
std::map<int,std::set<int> > Mist::Input::keyTimes
protectedinherited
int Mist::Input::lastActive
protectedinherited

Media-timestamp of the last packet.

unsigned int Mist::inputBuffer::lastReTime
private
std::map<unsigned long, unsigned long long> Mist::inputBuffer::lastUpdated
protected
DTSC::Meta Mist::InOutBase::myMeta
protectedinherited

Stores either the input or output metadata.

std::set<unsigned long> Mist::inputBuffer::negotiatingTracks
protected
std::map<unsigned long, unsigned long long> Mist::inputBuffer::negotiationTimeout
protected
negotiationProxy Mist::InOutBase::nProxy
protectedinherited
unsigned int Mist::Input::packTime
protectedinherited
std::map<unsigned int, std::map<unsigned int, unsigned int> > Mist::Input::pageCounter
protectedinherited
int Mist::Input::playing
protectedinherited
unsigned int Mist::Input::playUntil
protectedinherited
std::map<unsigned long, char *> Mist::inputBuffer::pushLocation
protected
long long int Mist::inputBuffer::recBpos
protected
std::ofstream Mist::inputBuffer::recFile
protected
DTSC::Meta Mist::inputBuffer::recMeta
protected
std::string Mist::inputBuffer::recName
protected
int Mist::inputBuffer::recordingPid
protected
bool Mist::inputBuffer::resumeMode
private
unsigned int Mist::inputBuffer::segmentSize
private
std::set<unsigned long> Mist::InOutBase::selectedTracks
protectedinherited

Stores the track id's that are either selected for playback or input.

inputBuffer* Mist::inputBuffer::singleton
protected
bool Mist::InOutBase::standAlone
protectedinherited
std::string Mist::InOutBase::streamName
protectedinherited
DTSC::Packet Mist::InOutBase::thisPacket
protectedinherited
IPC::sharedServer Mist::Input::userPage
protectedinherited

The documentation for this class was generated from the following files: