StatisticsUpdater Class Reference

Adaptor class StatisticsUpdater is used directly after InputIO and writes overall statistics on thru-passing bytes <short description="">. More...

#include <StatisticsUpdater.hpp>

Inheritance diagram for StatisticsUpdater:

Adaptor List of all members.

Public Member Functions

 StatisticsUpdater (ESInfo *esi, Statistics *statistics)
list< Frame * > adapt (Frame *frm)
 Accepts as input a frame, and checks if it can adapt the frame, If the frame is modified, a new Frame object is created and inserted into the return list.
Adaptorclone ()
 Create a shallow copy of the Adaptor.
void initialize ()
 Initialize internal data structures.
list< Frame * > close ()
 Close and destroy an Adaptor.
void setESInfo (ESInfo *esi)
 Sets a reference to an ESInfo object.
ESInfogetESInfo ()
u32 getTranscodingCosts () const
 returns adaptation costs (CPU only)

Protected Attributes

ESInfoes
Statisticsstats

Detailed Description

Adaptor class StatisticsUpdater is used directly after InputIO and writes overall statistics on thru-passing bytes <short description="">.

Author:
Michael Kropfberger and Peter Schojer
Version:
Id
StatisticsUpdater.hpp,v 1.5 2006/01/20 15:37:17 mkropfbe Exp

Definition at line 63 of file StatisticsUpdater.hpp.


Member Function Documentation

list< Frame * > StatisticsUpdater::adapt Frame frm  )  [virtual]
 

Accepts as input a frame, and checks if it can adapt the frame, If the frame is modified, a new Frame object is created and inserted into the return list.

This new frame is returned only, if the size of the payload is larger than zero. If the frame was not modified, it is also inserted into the list. For more complex adaptors, it will happen, that the adaptor caches up one complete GOP and returns the full GOP in network order. A caching adaptor has to create deep-copies for each frames. Never directly modify the payload of the input frm, always create copies!!!

Parameters:
frm object to adapt. An Adaptor is never allowed to free the input frame. This has to be done in the caller.
Returns:
List of adapted Frame objects

Reimplemented from Adaptor.

Definition at line 65 of file StatisticsUpdater.cpp.

References Statistics::checkForNewPlayoutSec(), Statistics::checkForNewStreamoutSec(), Frame::getAU(), Statistics::getFirstPacketTime(), Statistics::getHighestPacketTS(), ESInfo::getMediaTimeScale(), Frame::getType(), ESInfo::getVOPTimeIncrement(), Statistics::incPlayoutSecDataBW(), Statistics::incPlayoutSecNetFPS(), Statistics::incStreamoutSecDataBW(), Statistics::setFirstPacketTime(), Statistics::setFirstPacketTS(), Statistics::setHighestPacketTS(), and Statistics::setLastPacketTime().

00065 { 00066 list < Frame * >tmp; 00067 u32 thisCTS; 00068 00069 thisCTS = frm->getAU()->cts; 00070 dprintf_full("StatisticsUpdater::adapt frame CTS %i, VOP increment %i\n", 00071 thisCTS,es->getVOPTimeIncrement() ); 00072 00073 //STATS BLOCK 00074 struct timeval now_tv; 00075 double now_dtime; 00076 double thisFloatSec = (double)frm->getAU()->cts / es->getMediaTimeScale(); 00077 int thisSec = (int)floor(thisFloatSec); 00078 00079 gettimeofday(&now_tv,NULL); 00080 now_dtime = now_tv.tv_sec + now_tv.tv_usec/1000000.0; 00081 00082 if (stats->getFirstPacketTime() == 0) { 00083 stats->setFirstPacketTime(now_dtime); 00084 stats->setFirstPacketTS(thisCTS); 00085 } 00086 stats->setLastPacketTime(now_dtime); 00087 00088 stats->checkForNewPlayoutSec(thisSec,(int)floor((double)stats->getHighestPacketTS() 00089 / es->getMediaTimeScale())); 00090 stats->setHighestPacketTS(frm->getAU()->cts); 00091 if (frm->getType() != Frame::HEADER_VOP) 00092 stats->incPlayoutSecNetFPS(thisSec); 00093 00094 stats->checkForNewStreamoutSec(now_dtime); 00095 stats->incPlayoutSecDataBW(thisSec,frm->getAU()->size); 00096 stats->incStreamoutSecDataBW(thisSec,frm->getAU()->size); 00097 00098 //standard forwarding adaptor behaviour 00099 tmp.push_front(frm); 00100 return tmp; 00101 00102 }

Adaptor* StatisticsUpdater::clone  )  [inline, virtual]
 

Create a shallow copy of the Adaptor.

Creates an Adaptor with the same setup (without copying the current status).

Returns:
An Adaptor object.

Implements Adaptor.

Definition at line 74 of file StatisticsUpdater.hpp.

00074 { return new StatisticsUpdater(es,stats); };

list< Frame * > StatisticsUpdater::close  )  [inline, virtual]
 

Close and destroy an Adaptor.

Releases all internally buffered frame objects, and deallocate all allocated memory. The Adaptor must not be used after calling the close method!!!

Returns:
List of adapted Frame objects.

Reimplemented from Adaptor.

Definition at line 78 of file StatisticsUpdater.hpp.

00078 { 00079 list < Frame * >tmp; 00080 return tmp; 00081 };

void StatisticsUpdater::initialize  )  [virtual]
 

Initialize internal data structures.

Implements Adaptor.

Definition at line 60 of file StatisticsUpdater.cpp.

00060 { 00061 }

void StatisticsUpdater::setESInfo ESInfo esi  )  [inline, virtual]
 

Sets a reference to an ESInfo object.

Adaptors are allowed to change ESInfo objects. If you don't want that, pass an es->clone()

Reimplemented from Adaptor.

Definition at line 87 of file StatisticsUpdater.hpp.

00087 {es=esi;};


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