Home

Dokumentation

Impressum

Dokumentation VDR
 

Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

cDvbPlayer Class Reference

Inheritance diagram for cDvbPlayer:

Inheritance graph
[legend]
Collaboration diagram for cDvbPlayer:

Collaboration graph
[legend]

Public Methods

 cDvbPlayer (const char *FileName)
virtual ~cDvbPlayer ()
bool Active (void)
void Pause (void)
void Play (void)
void Forward (void)
void Backward (void)
int SkipFrames (int Frames)
void SkipSeconds (int Seconds)
void Goto (int Position, bool Still=false)
virtual bool GetIndex (int &Current, int &Total, bool SnapToIFrame=false)
virtual bool GetReplayMode (bool &Play, bool &Forward, int &Speed)
virtual int NumAudioTracks (void) const
virtual const char ** GetAudioTracks (int *CurrentTrack=NULL) const
virtual void SetAudioTrack (int Index)

Protected Methods

virtual void Activate (bool On)
virtual void Action (void)

Private Types

enum  ePlayModes {
  pmPlay, pmPause, pmSlow, pmFast,
  pmStill
}
enum  ePlayDirs { pdForward, pdBackward }

Private Methods

void TrickSpeed (int Increment)
void Empty (void)
void StripAudioPackets (uchar *b, int Length, uchar Except=0x00)
bool NextFile (uchar FileNumber=0, int FileOffset=-1)
int Resume (void)
bool Save (void)

Private Attributes

cRingBufferFrameringBuffer
cBackTracebackTrace
cFileNamefileName
cIndexFileindex
int replayFile
bool eof
bool active
bool running
ePlayModes playMode
ePlayDirs playDir
int trickSpeed
int readIndex
int writeIndex
bool canToggleAudioTrack
uchar audioTrack
cFramereadFrame
const cFrameplayFrame

Static Private Attributes

int Speeds [] = { 0, -2, -4, -8, 1, 2, 4, 12, 0 }

Member Enumeration Documentation

enum cDvbPlayer::ePlayDirs [private]
 

Enumeration values:
pdForward 
pdBackward 

Definition at line 108 of file dvbplayer.c.

enum cDvbPlayer::ePlayModes [private]
 

Enumeration values:
pmPlay 
pmPause 
pmSlow 
pmFast 
pmStill 

Definition at line 107 of file dvbplayer.c.


Constructor & Destructor Documentation

cDvbPlayer::cDvbPlayer const char *    FileName
 

Definition at line 174 of file dvbplayer.c.

References active, audioTrack, backTrace, canToggleAudioTrack, eof, esyslog, fileName, index, isyslog, NORMAL_SPEED, cIndexFile::Ok(), cFileName::Open(), pdForward, playDir, playFrame, playMode, pmPlay, readFrame, readIndex, replayFile, ringBuffer, running, trickSpeed, and writeIndex.

cDvbPlayer::~cDvbPlayer   [virtual]
 

Definition at line 207 of file dvbplayer.c.

References backTrace, cPlayer::Detach(), fileName, index, ringBuffer, and Save().


Member Function Documentation

void cDvbPlayer::Action void    [protected, virtual]
 

Read the next frame from the file:

can't call Play() here, because those functions may only be called from the foreground thread - and we also don't need to empty the buffer here

must call StripAudioPackets() here because the buffer is not emptied when falling back from "fast forward" to "play" (see above)

allows replay even if the index file is missing

this keeps the CPU load low

Store the frame in the buffer:

Get the next frame from the buffer:

Play the frame:

Implements cThread.

Definition at line 351 of file dvbplayer.c.

References active, cBackTrace::Add(), cPoller::Add(), cRingBufferFrame::Available(), backTrace, cFrame::Count(), cFrame::Data(), cPlayer::DevicePlay(), cPlayer::DevicePoll(), cRingBufferFrame::Drop(), dsyslog, eof, FATALERRNO, cRingBufferFrame::Get(), cIndexFile::Get(), cIndexFile::GetNextIFrame(), cFrame::Index(), index, IndexToHMSF(), isyslog, LOCK_THREAD, LOG_ERROR, MAXFRAMESIZE, NextFile(), pdBackward, playDir, playFrame, playMode, cPlayer::PlayVideo(), pmFast, pmPlay, pmSlow, pmStill, cRingBufferFrame::Put(), ReadFrame(), readFrame, readIndex, replayFile, Resume(), ringBuffer, running, StripAudioPackets(), uchar, and writeIndex.

void cDvbPlayer::Activate bool    On [protected, virtual]
 

This function is called right after the cPlayer has been attached to (On == true) or before it gets detached from (On == false) a cDevice. It can be used to do things like starting/stopping a thread.

Reimplemented from cPlayer.

Definition at line 338 of file dvbplayer.c.

References active, cThread::Cancel(), replayFile, running, and cThread::Start().

bool cDvbPlayer::Active void    [inline]
 

Reimplemented from cThread.

Definition at line 138 of file dvbplayer.c.

Referenced by cDvbPlayerControl::Active().

void cDvbPlayer::Backward void   
 

run into pmPlay

run into pmPause

Definition at line 569 of file dvbplayer.c.

References cPlayer::DeviceMute(), Empty(), LOCK_THREAD, NORMAL_SPEED, Pause(), pdBackward, Play(), playDir, playMode, pmFast, pmPause, pmPlay, pmSlow, pmStill, trickSpeed, and TrickSpeed().

Referenced by cDvbPlayerControl::Backward().

void cDvbPlayer::Empty void    [private]
 

Definition at line 237 of file dvbplayer.c.

References backTrace, cBackTrace::Clear(), cRingBufferFrame::Clear(), cPlayer::DeviceClear(), cBackTrace::Get(), cThread::Lock(), playFrame, readFrame, readIndex, ringBuffer, cThread::Unlock(), and writeIndex.

Referenced by Backward(), Forward(), Goto(), Pause(), Play(), SetAudioTrack(), and SkipSeconds().

void cDvbPlayer::Forward void   
 

run into pmPlay

run into pmPause

Definition at line 516 of file dvbplayer.c.

References cPlayer::DeviceMute(), Empty(), LOCK_THREAD, NORMAL_SPEED, Pause(), pdForward, Play(), playDir, playMode, pmFast, pmPause, pmPlay, pmSlow, pmStill, trickSpeed, and TrickSpeed().

Referenced by cDvbPlayerControl::Forward().

const char ** cDvbPlayer::GetAudioTracks int *    CurrentTrack = NULL const [virtual]
 

Returns a list of currently available audio tracks. The last entry in the list must be NULL. The number of entries does not necessarily have to be the same as returned by a previous call to NumAudioTracks(). If CurrentTrack is given, it will be set to the index of the current track in the returned list. Note that the list must not be changed after it has been returned by a call to GetAudioTracks()! The only time the list may change is *inside* the GetAudioTracks() function. By default the return value is NULL and CurrentTrack, if given, will not have any meaning.

Reimplemented from cPlayer.

Definition at line 716 of file dvbplayer.c.

References audioTrack, and NumAudioTracks().

bool cDvbPlayer::GetIndex int &    Current,
int &    Total,
bool    SnapToIFrame = false
[virtual]
 

Returns the current and total frame index, optionally snapped to the nearest I-frame.

Reimplemented from cPlayer.

Definition at line 680 of file dvbplayer.c.

References cIndexFile::GetNextIFrame(), index, cIndexFile::Last(), max(), playMode, and pmStill.

Referenced by cDvbPlayerControl::GetIndex(), and SkipFrames().

bool cDvbPlayer::GetReplayMode bool &    Play,
bool &    Forward,
int &    Speed
[virtual]
 

Returns the current replay mode (if applicable). 'Play' tells whether we are playing or pausing, 'Forward' tells whether we are going forward or backward and 'Speed' is -1 if this is normal play/pause mode, 0 if it is single speed fast/slow forward/back mode and >0 if this is multi speed mode.

Reimplemented from cPlayer.

Definition at line 700 of file dvbplayer.c.

References pdForward, playDir, playMode, pmFast, pmPlay, and pmSlow.

Referenced by cDvbPlayerControl::GetReplayMode().

void cDvbPlayer::Goto int    Position,
bool    Still = false
 

Definition at line 655 of file dvbplayer.c.

References cPlayer::DevicePlay(), cPlayer::DeviceStillPicture(), Empty(), cIndexFile::GetNextIFrame(), index, LOCK_THREAD, MAXFRAMESIZE, NextFile(), playMode, pmPause, pmStill, ReadFrame(), readIndex, StripAudioPackets(), uchar, and writeIndex.

Referenced by cDvbPlayerControl::Goto().

bool cDvbPlayer::NextFile uchar    FileNumber = 0,
int    FileOffset = -1
[private]
 

Definition at line 297 of file dvbplayer.c.

References eof, fileName, cFileName::NextFile(), replayFile, and cFileName::SetOffset().

Referenced by Action(), Goto(), and Resume().

int cDvbPlayer::NumAudioTracks void    const [virtual]
 

Returns the number of audio tracks that are currently available on this player. The default return value is 0, meaning that this player doesn't have multiple audio track capabilities. The return value may change with every call and need not necessarily be the number of list entries returned by GetAudioTracks(). This function is mainly called to decide whether there should be an "Audio" button in a menu.

Reimplemented from cPlayer.

Definition at line 711 of file dvbplayer.c.

References canToggleAudioTrack.

Referenced by GetAudioTracks().

void cDvbPlayer::Pause void   
 

Definition at line 491 of file dvbplayer.c.

References cPlayer::DeviceFreeze(), Empty(), LOCK_THREAD, pdBackward, Play(), playDir, playMode, pmFast, pmPause, pmSlow, and pmStill.

Referenced by Backward(), Forward(), cDvbPlayerControl::Pause(), and TrickSpeed().

void cDvbPlayer::Play void   
 

Definition at line 504 of file dvbplayer.c.

References cPlayer::DevicePlay(), Empty(), LOCK_THREAD, pdBackward, pdForward, playDir, playMode, pmFast, pmPlay, pmSlow, and pmStill.

Referenced by Backward(), Forward(), Pause(), cDvbPlayerControl::Play(), SkipSeconds(), and TrickSpeed().

int cDvbPlayer::Resume void    [private]
 

Definition at line 307 of file dvbplayer.c.

References cIndexFile::Get(), cIndexFile::GetResume(), index, NextFile(), and uchar.

Referenced by Action().

bool cDvbPlayer::Save void    [private]
 

Definition at line 321 of file dvbplayer.c.

References cIndexFile::GetNextIFrame(), index, RESUMEBACKUP, cIndexFile::StoreResume(), and writeIndex.

Referenced by ~cDvbPlayer().

void cDvbPlayer::SetAudioTrack int    Index [virtual]
 

Sets the current audio track to the given value, which should be within the range of the list returned by a previous call to GetAudioTracks() (otherwise nothing will happen).

Reimplemented from cPlayer.

Definition at line 728 of file dvbplayer.c.

References audioTrack, and Empty().

int cDvbPlayer::SkipFrames int    Frames
 

Definition at line 626 of file dvbplayer.c.

References GetIndex(), cIndexFile::GetNextIFrame(), and index.

Referenced by cDvbPlayerControl::SkipFrames().

void cDvbPlayer::SkipSeconds int    Seconds
 

Definition at line 638 of file dvbplayer.c.

References Empty(), cIndexFile::GetNextIFrame(), index, LOCK_THREAD, max(), Play(), readIndex, and writeIndex.

Referenced by cDvbPlayerControl::SkipSeconds().

void cDvbPlayer::StripAudioPackets uchar   b,
int    Length,
uchar    Except = 0x00
[private]
 

dolby

audio

video

Definition at line 250 of file dvbplayer.c.

References canToggleAudioTrack, cPlayer::PlayAudio(), and uchar.

Referenced by Action(), and Goto().

void cDvbPlayer::TrickSpeed int    Increment [private]
 

Definition at line 217 of file dvbplayer.c.

References cPlayer::DeviceTrickSpeed(), MAX_VIDEO_SLOWMOTION, Pause(), pdForward, Play(), playDir, playMode, pmFast, pmSlow, SPEED_MULT, Speeds, and trickSpeed.

Referenced by Backward(), and Forward().


Field Documentation

bool cDvbPlayer::active [private]
 

Definition at line 116 of file dvbplayer.c.

Referenced by Action(), Activate(), and cDvbPlayer().

uchar cDvbPlayer::audioTrack [private]
 

Definition at line 123 of file dvbplayer.c.

Referenced by cDvbPlayer(), GetAudioTracks(), and SetAudioTrack().

cBackTrace* cDvbPlayer::backTrace [private]
 

Definition at line 111 of file dvbplayer.c.

Referenced by Action(), cDvbPlayer(), Empty(), and ~cDvbPlayer().

bool cDvbPlayer::canToggleAudioTrack [private]
 

Definition at line 122 of file dvbplayer.c.

Referenced by cDvbPlayer(), NumAudioTracks(), and StripAudioPackets().

bool cDvbPlayer::eof [private]
 

Definition at line 115 of file dvbplayer.c.

Referenced by Action(), cDvbPlayer(), and NextFile().

cFileName* cDvbPlayer::fileName [private]
 

Definition at line 112 of file dvbplayer.c.

Referenced by cDvbPlayer(), NextFile(), and ~cDvbPlayer().

cIndexFile* cDvbPlayer::index [private]
 

Definition at line 113 of file dvbplayer.c.

Referenced by Action(), cDvbPlayer(), GetIndex(), Goto(), Resume(), Save(), SkipFrames(), SkipSeconds(), and ~cDvbPlayer().

ePlayDirs cDvbPlayer::playDir [private]
 

Definition at line 119 of file dvbplayer.c.

Referenced by Action(), Backward(), cDvbPlayer(), Forward(), GetReplayMode(), Pause(), Play(), and TrickSpeed().

const cFrame* cDvbPlayer::playFrame [private]
 

Definition at line 125 of file dvbplayer.c.

Referenced by Action(), cDvbPlayer(), and Empty().

ePlayModes cDvbPlayer::playMode [private]
 

Reimplemented from cPlayer.

Definition at line 118 of file dvbplayer.c.

Referenced by Action(), Backward(), cDvbPlayer(), Forward(), GetIndex(), GetReplayMode(), Goto(), Pause(), Play(), and TrickSpeed().

cFrame* cDvbPlayer::readFrame [private]
 

Definition at line 124 of file dvbplayer.c.

Referenced by Action(), cDvbPlayer(), and Empty().

int cDvbPlayer::readIndex [private]
 

Definition at line 121 of file dvbplayer.c.

Referenced by Action(), cDvbPlayer(), Empty(), Goto(), and SkipSeconds().

int cDvbPlayer::replayFile [private]
 

Definition at line 114 of file dvbplayer.c.

Referenced by Action(), Activate(), cDvbPlayer(), and NextFile().

cRingBufferFrame* cDvbPlayer::ringBuffer [private]
 

Definition at line 110 of file dvbplayer.c.

Referenced by Action(), cDvbPlayer(), Empty(), and ~cDvbPlayer().

bool cDvbPlayer::running [private]
 

Reimplemented from cThread.

Definition at line 117 of file dvbplayer.c.

Referenced by Action(), Activate(), and cDvbPlayer().

int cDvbPlayer::Speeds = { 0, -2, -4, -8, 1, 2, 4, 12, 0 } [static, private]
 

Definition at line 172 of file dvbplayer.c.

Referenced by TrickSpeed().

int cDvbPlayer::trickSpeed [private]
 

Definition at line 120 of file dvbplayer.c.

Referenced by Backward(), cDvbPlayer(), Forward(), and TrickSpeed().

int cDvbPlayer::writeIndex [private]
 

Definition at line 121 of file dvbplayer.c.

Referenced by Action(), cDvbPlayer(), Empty(), Goto(), Save(), and SkipSeconds().


The documentation for this class was generated from the following file:
Generated on Wed Feb 5 23:31:10 2003 for VDR by doxygen1.3-rc2