StrongTemporalAdaptor Class Reference

drops all bypassing B- and P-frames <short description=""> More...

#include <StrongTemporalAdaptor.hpp>

Inheritance diagram for StrongTemporalAdaptor:

VideoAdaptor Adaptor List of all members.

Public Member Functions

 StrongTemporalAdaptor (VideoESInfo *esi)
Adaptorclone ()
 Create a shallow copy of the Adaptor.
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.
void initialize ()
 Initialize internal data structures.
list< Frame * > close ()
 Close and destroy an Adaptor.
u32 getTranscodingCosts () const
 returns adaptation costs (CPU only)

Protected Member Functions

bool doAdapt (Frame *&frm)
 drops B and P frames

Protected Attributes

u32 inFrames
u32 outFrames
u32 lastDTS
u32 origVopTimeIncr

Detailed Description

drops all bypassing B- and P-frames <short description="">

Author:
Michael Kropfberger and Peter Schojer
Version:
Id
StrongTemporalAdaptor.hpp,v 1.8 2005/01/19 13:41:41 mkropfbe Exp

Definition at line 64 of file StrongTemporalAdaptor.hpp.


Member Function Documentation

list< Frame * > StrongTemporalAdaptor::adapt Frame frm  )  [inline, 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 90 of file StrongTemporalAdaptor.hpp.

References doAdapt(), and initialize().

00090 { 00091 if(!initialized) 00092 initialize(); 00093 // a temporaladaptor is not allowed to delete the input frame 00094 // because other DataSinks might need it as input 00095 inFrames++; 00096 list < Frame * >tmp; 00097 if (!doAdapt(frm)) { 00098 tmp.push_front(frm); 00099 outFrames++; 00100 } 00101 00102 return tmp; 00103 };

Adaptor* StrongTemporalAdaptor::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 86 of file StrongTemporalAdaptor.hpp.

00086 { 00087 return new StrongTemporalAdaptor(es); 00088 };

list< Frame * > StrongTemporalAdaptor::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 119 of file StrongTemporalAdaptor.hpp.

00119 { 00120 00121 list < Frame * >tmp; 00122 00123 // set the fps 00124 if (es) { 00125 origVopTimeIncr=es->getVOPTimeIncrement(); 00126 u32 vInc=es->getDuration()/this->outFrames; 00127 u32 t=vInc%origVopTimeIncr; 00128 vInc-=t; 00129 es->setVOPTimeIncrement(vInc); 00130 u64 fs=es->getCurrentDemuxedMediaSize(); 00131 fs*=8000; 00132 fs/=es->getDurationInMs(); 00133 es->setAvgBandwidth((u32)fs); 00134 } 00135 // correct the bitfield, which now shows a too small complete status 00136 if(es && es->getFrameStatistic()) { 00137 BitField* b=new BitField(es->getFrameStatistic()->getSize(),true); 00138 es->setFrameStatistic(b); 00139 } 00140 return tmp; 00141 };

void StrongTemporalAdaptor::initialize  )  [inline, virtual]
 

Initialize internal data structures.

Implements Adaptor.

Definition at line 105 of file StrongTemporalAdaptor.hpp.

Referenced by adapt().

00105 { 00106 if(initialized) 00107 return; 00108 initialized = true; 00109 if(es) { 00110 u32 oldBW=es->getAvgBandwidth(); 00111 float bFrame=es->getAvgBFrameSize(); 00112 u32 newBW=(u32)(oldBW*bFrame); 00113 dprintf_full("TemporalAdaptor::initialize BW %u -%f-> %u\n",oldBW,bFrame,newBW); 00114 es->setAvgBFrameSize(0.0); 00115 es->setNum_B_frames(0); 00116 es->setAvgBandwidth(newBW); 00117 } 00118 };


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