TemporalAdaptor Class Reference

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

#include <TemporalAdaptor.hpp>

Inheritance diagram for TemporalAdaptor:

VideoAdaptor Adaptor List of all members.

Public Member Functions

 TemporalAdaptor (VideoESInfo *esi)
 Temporaladaptor updates.
list< Frame * > adapt (Frame *frm)
 accepts as input a frame, and directly modifies this frame.
Adaptorclone ()
 Create a shallow copy of the Adaptor.
list< Frame * > close ()
 Close and destroy an Adaptor.
void initialize ()
 Initialize internal data structures.
u32 getTranscodingCosts () const
 returns adaptation costs (CPU only)

Protected Member Functions

bool doAdapt (Frame *&frm)

Protected Attributes

u32 inFrames
u32 outFrames
u32 lastDTS
u32 origVopTimeIncr

Detailed Description

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

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

Definition at line 62 of file TemporalAdaptor.hpp.


Constructor & Destructor Documentation

TemporalAdaptor::TemporalAdaptor VideoESInfo *  esi  ) 
 

Temporaladaptor updates.

Parameters:
esi to reflect the change in the framerate
Definition at line 51 of file TemporalAdaptor.cpp.

Referenced by clone().

00051 { 00052 es = esi; 00053 inFrames = 0; 00054 outFrames = 0; 00055 lastDTS = 0; 00056 initialized = false; 00057 strcpy(name,"TemporalAdaptor"); 00058 };


Member Function Documentation

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

accepts as input a frame, and directly modifies this frame.

After adaptation the payload of the frame might be null

Reimplemented from Adaptor.

Definition at line 87 of file TemporalAdaptor.cpp.

References initialize().

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

Adaptor* TemporalAdaptor::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 71 of file TemporalAdaptor.hpp.

References TemporalAdaptor().

00071 { 00072 return new TemporalAdaptor(es); 00073 };

list< Frame * > TemporalAdaptor::close  )  [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 103 of file TemporalAdaptor.cpp.

00104 { 00105 list < Frame * >tmp; 00106 00107 // set the fps 00108 // make sure it's a multiple of origVopTimeIncr 00109 if (es) { 00110 origVopTimeIncr=es->getVOPTimeIncrement(); 00111 u32 vInc=es->getDuration()/this->outFrames; 00112 u32 t=vInc%origVopTimeIncr; 00113 vInc-=t; 00114 es->setVOPTimeIncrement(vInc); 00115 u64 fs=es->getCurrentDemuxedMediaSize(); 00116 fs*=8000; 00117 fs/=es->getDurationInMs(); 00118 es->setAvgBandwidth((u32)fs); 00119 } 00120 // correct the bitfield, which now shows a too small complete status 00121 if(es && es->getFrameStatistic()) { 00122 BitField* b=new BitField(es->getFrameStatistic()->getSize(),true); 00123 es->setFrameStatistic(b); 00124 } 00125 return tmp; 00126 };

void TemporalAdaptor::initialize  )  [virtual]
 

Initialize internal data structures.

Implements Adaptor.

Definition at line 68 of file TemporalAdaptor.cpp.

Referenced by adapt().

00069 { 00070 if(initialized) 00071 return; 00072 initialized = true; 00073 if(es) { 00074 u32 oldBW=es->getAvgBandwidth(); 00075 float bFrame=es->getAvgBFrameSize(); 00076 u32 newBW=(u32)(oldBW*bFrame); 00077 dprintf_full("TemporalAdaptor::initialize BW %u -%f-> %u\n",oldBW,bFrame,newBW); 00078 es->setAvgBFrameSize(0.0); 00079 es->setNum_B_frames(0); 00080 es->setAvgBandwidth(newBW); 00081 } 00082 }


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