FrameRateAdjust Class Reference

Adaptor class FrameRateAdjust adjusts the incoming framerate to a predefined outgoing framerate (both expressed by a timeIncrement) so either by-passing frames are dropped (eg. <short description="">. More...

#include <FrameRateAdjust.hpp>

Inheritance diagram for FrameRateAdjust:

Adaptor List of all members.

Public Member Functions

 FrameRateAdjust (ESInfo *esi, u32 newTimeIncrement)
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
u32 timeInc
u32 oldTimeInc
u32 currentFrameNumber
u32 currentTicks

Detailed Description

Adaptor class FrameRateAdjust adjusts the incoming framerate to a predefined outgoing framerate (both expressed by a timeIncrement) so either by-passing frames are dropped (eg. <short description="">.

25fps -> 15fps) or doubly inserted (eg. 15 fps -:> 25fps) with the mpeg4-used ticksPerSecond, the base is always 90000 ticks 30 fps use a timeincrement of 3000 ticks/frame 25 fps use a timeincrement of 3600 ticks/frame 20 fps means 4500 ticks/frame 15 fps means 6000 ticks/frame 10 fps means 9000 ticks/frame

Author:
Michael Kropfberger
Version:
Id
FrameRateAdjust.hpp,v 1.4 2006/01/20 15:37:17 mkropfbe Exp

Definition at line 72 of file FrameRateAdjust.hpp.


Member Function Documentation

list< Frame * > FrameRateAdjust::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 74 of file FrameRateAdjust.cpp.

References Frame::getAU(), and ESInfo::getMediaTimeScale().

00074 { 00075 list < Frame * >tmp; 00076 u32 thisCTS; 00077 int thisSec; 00078 00079 thisCTS = frm->getAU()->cts; 00080 thisSec = (int)floor((double)thisCTS / es->getMediaTimeScale()); 00081 dprintf_full("FrameRateAdjust::adapt frame CTS %i (dropped until %i), VOP increment %i, playoutSec: %i \n", 00082 thisCTS, currentTicks, oldTimeInc, thisSec ); 00083 00084 currentFrameNumber++; 00085 if (oldTimeInc <= timeInc) { // remove some frames 00086 if (thisCTS >= currentTicks) { 00087 //standard forwarding adaptor behaviour 00088 tmp.push_front(frm); 00089 currentTicks += timeInc; 00090 } else { 00091 //this frame is dropped.... 00092 dprintf_full("FrameRateAdjust::adapt: this frame %p is dropped (will be deleted by AdaptorChain)....\n",frm); 00093 } 00094 } else { // add some frames 00095 dprintf_err("FrameRateAdjust::adapt should add frames now (from %i to %i timeInc)... NOT SUPPORTED!\n", 00096 oldTimeInc,timeInc); 00097 ::exit(1); 00098 } 00099 00100 return tmp; 00101 }

Adaptor* FrameRateAdjust::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 FrameRateAdjust.hpp.

00086 { return new FrameRateAdjust(es, timeInc); };

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

00090 { 00091 list < Frame * >tmp; 00092 return tmp; 00093 };

void FrameRateAdjust::initialize  )  [virtual]
 

Initialize internal data structures.

Implements Adaptor.

Definition at line 69 of file FrameRateAdjust.cpp.

00069 { 00070 }

void FrameRateAdjust::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 99 of file FrameRateAdjust.hpp.

00099 {es=esi;};


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