#include <RingBuffer.h>
This class, despite its name, no-longer provides a ring buffer. It can buffer reads and provide support for streaming files. It also provides a wrapper for the ThreadedFileWriter which makes sure that the file reader does not read past where the wrapped TFW has written new data.
Definition at line 23 of file RingBuffer.h.
Public Member Functions | |
| RingBuffer (const QString &lfilename, bool write, bool usereadahead=true, uint read_retries=12) | |
| Creates a RingBuffer instance. | |
| ~RingBuffer () | |
| Shuts down any threads and closes any files. | |
| void | SetWriteBufferSize (int newSize) |
| Calls ThreadedFileWriter::SetWriteBufferSize(int). | |
| void | SetWriteBufferMinWriteSize (int newMinSize) |
| Calls ThreadedFileWriter::SetWriteBufferMinWriteSize(int). | |
| void | UpdateRawBitrate (uint rawbitrate) |
| Set the raw bit rate, to allow RingBuffer adjust effective bitrate. | |
| void | UpdatePlaySpeed (float playspeed) |
| Set the play speed, to allow RingBuffer adjust effective bitrate. | |
| QString | GetFilename (void) const |
| Returns name of file used by this RingBuffer. | |
| int | DataInReadAhead (void) const |
| Returns ReadBufAvail(void). | |
| bool | GetStopReads (void) const |
| Returns value of stopreads. | |
| bool | isPaused (void) const |
| Returns false iff read-ahead is not running and read-ahead is not paused. | |
| long long | GetReadPosition (void) const |
| Returns how far into the file we have read. | |
| long long | GetWritePosition (void) const |
| Returns how far into a ThreadedFileWriter file we have written. | |
| long long | GetRealFileSize (void) const |
| Returns the size of the file we are reading/writing, or -1 if the query fails. | |
| uint | GetBitrate (void) const |
| Returns effective bits per second (in thousands). | |
| uint | GetReadBlockSize (void) const |
| Returns size of each disk read made by read ahead thread (in bytes). | |
| bool | IsOpen (void) const |
| Returns true if the file is open for either reading or writing. | |
| void | OpenFile (const QString &lfilename, uint retryCount=12) |
| Opens a file for reading. | |
| int | Read (void *buf, int count) |
| This is the public method for reading from a file, it calls the appropriate read method if the file is remote or buffered, or a DVD. | |
| int | Peek (void *buf, int count) |
| void | Reset (bool full=false, bool toAdjust=false, bool resetInternal=false) |
| Resets the read-ahead thread and our position in the file. | |
| long long | Seek (long long pos, int whence) |
| Seeks to a particular position in the file. | |
| void | Pause (void) |
| Pauses the read-ahead thread. | |
| void | Unpause (void) |
| Unpauses the read-ahead thread. | |
| void | WaitForPause (void) |
| Waits for Pause(void) to take effect. | |
| void | Start (void) |
| Starts the read-ahead thread. | |
| void | StopReads (void) |
| ???? | |
| void | StartReads (void) |
| ???? | |
| bool | LiveMode (void) const |
| Returns true if this RingBuffer has been assigned a LiveTVChain. | |
| void | SetLiveMode (LiveTVChain *chain) |
| Assigns a LiveTVChain to this RingBuffer. | |
| void | IgnoreLiveEOF (bool ignore) |
| Tells RingBuffer whether to igonre the end-of-file. | |
| int | Write (const void *buf, uint count) |
| Writes buffer to ThreadedFileWriter::Write(const void*,uint). | |
| bool | IsIOBound (void) const |
| Returns true if a RingBuffer::Read(void*,int) is likely to block. | |
| void | WriterFlush (void) |
| Calls ThreadedFileWriter::Flush(void) and ThreadedFileWriter::Sync(void). | |
| void | Sync (void) |
| Calls ThreadedFileWriter::Sync(void). | |
| long long | WriterSeek (long long pos, int whence) |
| Calls ThreadedFileWriter::Seek(long long,int). | |
| bool | isDVD (void) const |
| Returns true if this is a DVD backed RingBuffer. | |
| DVDRingBufferPriv * | DVD () |
| bool | InDVDMenuOrStillFrame (void) |
| long long | SetAdjustFilesize (void) |
| void | SetTimeout (bool fast) |
Protected Member Functions | |
| void | ReadAheadThread (void) |
| Read-ahead run function. | |
Static Protected Member Functions | |
| static void * | StartReader (void *type) |
| Thunk that calls ReadAheadThread(void). | |
Private Member Functions | |
| void | CalcReadAheadThresh (void) |
| Calculates fill_min, fill_threshold, and readblocksize from the estimated effective bitrate of the stream. | |
| int | safe_read_dvd (void *data, uint sz) |
| int | safe_read (int fd, void *data, uint sz) |
| Reads data from the file-descriptor. | |
| int | safe_read (RemoteFile *rf, void *data, uint sz) |
| Reads data from the RemoteFile. | |
| int | ReadFromBuf (void *buf, int count, bool peek=false) |
| Reads from the read-ahead buffer, this is called by Read(void*, int) when the read-ahead thread is running. | |
| int | ReadBufFree (void) const |
| Returns number of bytes available for reading into buffer. | |
| int | ReadBufAvail (void) const |
| Returns number of bytes available for reading from buffer. | |
| void | StartupReadAheadThread (void) |
| Creates the read-ahead thread, and waits for it to start. | |
| void | ResetReadAhead (long long newinternal) |
| Restart the read-ahead threat at the 'newinternal' position. | |
| void | KillReadAheadThread (void) |
| Stops the read-ahead thread, and waits for it to stop. | |
Private Attributes | |
| QString | filename |
| ThreadedFileWriter * | tfw |
| int | fd2 |
| bool | writemode |
| long long | readpos |
| long long | writepos |
| bool | stopreads |
| pthread_rwlock_t | rwlock |
| int | recorder_num |
| RemoteEncoder * | remoteencoder |
| RemoteFile * | remotefile |
| QMutex | readAheadLock |
| pthread_t | reader |
| bool | startreadahead |
| char * | readAheadBuffer |
| bool | readaheadrunning |
| bool | readaheadpaused |
| bool | pausereadthread |
| int | rbrpos |
| int | rbwpos |
| long long | internalreadpos |
| bool | ateof |
| bool | readsallowed |
| volatile bool | wantseek |
| bool | setswitchtonext |
| QMutex | bitratelock |
| uint | rawbitrate |
| float | playspeed |
| int | fill_threshold |
| int | fill_min |
| int | readblocksize |
| QWaitCondition | pauseWait |
| int | wanttoread |
| QWaitCondition | availWait |
| QMutex | availWaitMutex |
| QWaitCondition | readsAllowedWait |
| int | numfailures |
| bool | commserror |
| DVDRingBufferPriv * | dvdPriv |
| bool | oldfile |
| LiveTVChain * | livetvchain |
| bool | ignoreliveeof |
| long long | readAdjust |
| QWaitCondition | readAheadRunningCond |
| Condition to signal that the read ahead thread is running. | |
| QMutex | readAheadRunningCondLock |
Static Private Attributes | |
| static const uint | kBufferSize = 3 * 1024 * 1024 |
| static const uint | kReadTestSize = PNG_MIN_SIZE |
| RingBuffer::RingBuffer | ( | const QString & | lfilename, | |
| bool | write, | |||
| bool | usereadahead = true, |
|||
| uint | read_retries = 12 | |||
| ) |
Creates a RingBuffer instance.
You can explicitly disable the readahead thread by setting readahead to false, or by just not calling Start(void).
| lfilename | Name of file to read or write. | |
| write | If true an encapsulated writer is created | |
| readahead | If false a call to Start(void) will not a pre-buffering thread, otherwise Start(void) will start a pre-buffering thread. | |
| read_retries | How often to retry reading the file before giving up. |
Definition at line 86 of file RingBuffer.cpp.
| RingBuffer::~RingBuffer | ( | void | ) |
| void RingBuffer::SetWriteBufferSize | ( | int | newSize | ) |
Calls ThreadedFileWriter::SetWriteBufferSize(int).
Definition at line 1269 of file RingBuffer.cpp.
Referenced by TVRec::SetupRecorder().
| void RingBuffer::SetWriteBufferMinWriteSize | ( | int | newMinSize | ) |
Calls ThreadedFileWriter::SetWriteBufferMinWriteSize(int).
Definition at line 1277 of file RingBuffer.cpp.
| void RingBuffer::UpdateRawBitrate | ( | uint | rawbitrate | ) |
Set the raw bit rate, to allow RingBuffer adjust effective bitrate.
| raw_bitrate | Streams average number of kilobits per second when playspeed is 1.0 |
Definition at line 485 of file RingBuffer.cpp.
Referenced by NuppelDecoder::GetFrame(), NuppelVideoPlayer::JumpToProgram(), NuppelDecoder::OpenFile(), IvtvDecoder::OpenFile(), AvFormatDecoder::ScanStreams(), and NuppelVideoPlayer::SwitchToProgram().
| void RingBuffer::UpdatePlaySpeed | ( | float | playspeed | ) |
Set the play speed, to allow RingBuffer adjust effective bitrate.
| play_speed | Speed to set. (1.0 for normal speed) |
Definition at line 518 of file RingBuffer.cpp.
Referenced by NuppelVideoPlayer::StartPlaying().
| QString RingBuffer::GetFilename | ( | void | ) | const [inline] |
Returns name of file used by this RingBuffer.
Definition at line 38 of file RingBuffer.h.
Referenced by FileTransfer::GetFileSize(), NuppelVideoPlayer::OpenFile(), NuppelDecoder::OpenFile(), AvFormatDecoder::OpenFile(), TV::ProcessNetworkControlCommand(), AvFormatDecoder::Reset(), RecorderBase::SetRingBuffer(), TV::SetupPlayer(), and NuppelVideoRecorder::StartRecording().
| int RingBuffer::DataInReadAhead | ( | void | ) | const [inline] |
Returns ReadBufAvail(void).
Definition at line 40 of file RingBuffer.h.
Referenced by NuppelVideoPlayer::IsReallyNearEnd().
| bool RingBuffer::GetStopReads | ( | void | ) | const [inline] |
Returns value of stopreads.
Definition at line 43 of file RingBuffer.h.
Referenced by FileTransfer::RequestBlock().
| bool RingBuffer::isPaused | ( | void | ) | const [inline] |
Returns false iff read-ahead is not running and read-ahead is not paused.
Definition at line 46 of file RingBuffer.h.
Referenced by NuppelVideoPlayer::IsPaused(), and TV::TogglePIPView().
| long long RingBuffer::GetReadPosition | ( | void | ) | const |
Returns how far into the file we have read.
Definition at line 1285 of file RingBuffer.cpp.
Referenced by NuppelVideoPlayer::calcSliderPos(), NuppelDecoder::GetFrame(), NuppelDecoder::OpenFile(), IvtvDecoder::ReadWrite(), FileTransfer::Seek(), and AvFormatDecoder::SeekReset().
| long long RingBuffer::GetWritePosition | ( | void | ) | const |
Returns how far into a ThreadedFileWriter file we have written.
Definition at line 1298 of file RingBuffer.cpp.
Referenced by DTVRecorder::FindH264Keyframes(), TVRec::GetFilePosition(), DTVRecorder::HandleKeyframe(), DVBRecorder::HandleSingleProgramPAT(), DVBRecorder::HandleSingleProgramPMT(), MpegRecorder::ProcessData(), RecorderBase::SavePositionMap(), NuppelVideoRecorder::UpdateSeekTable(), NuppelVideoRecorder::WriteHeader(), NuppelVideoRecorder::WriteKeyFrameAdjustTable(), and NuppelVideoRecorder::WriteSeekTable().
| long long RingBuffer::GetRealFileSize | ( | void | ) | const |
Returns the size of the file we are reading/writing, or -1 if the query fails.
Definition at line 1307 of file RingBuffer.cpp.
Referenced by AVF_Seek(), NuppelVideoRecorder::FinishRecording(), MpegRecorder::FinishRecording(), DTVRecorder::FinishRecording(), AvFormatDecoder::HandleGopStart(), IvtvDecoder::MpegPreProcessPkt(), IvtvDecoder::OpenFile(), AvFormatDecoder::OpenFile(), NuppelVideoRecorder::SetNextRecording(), MpegRecorder::SetNextRecording(), and DTVRecorder::SetNextRecording().
| uint RingBuffer::GetBitrate | ( | void | ) | const |
Returns effective bits per second (in thousands).
NOTE: This is reported in telecom kilobytes, to get the bits per second multiply by 1000, not 1024.
Definition at line 498 of file RingBuffer.cpp.
Referenced by NuppelVideoPlayer::IsReallyNearEnd().
| uint RingBuffer::GetReadBlockSize | ( | void | ) | const |
Returns size of each disk read made by read ahead thread (in bytes).
Definition at line 508 of file RingBuffer.cpp.
Referenced by NuppelVideoPlayer::IsReallyNearEnd().
| bool RingBuffer::IsOpen | ( | void | ) | const |
Returns true if the file is open for either reading or writing.
Definition at line 299 of file RingBuffer.cpp.
Referenced by NuppelVideoRecorder::CreateNuppelFile(), PreviewGenerator::GetScreenGrab(), TV::HandleStateChange(), NuppelVideoRecorder::Initialize(), FileTransfer::isOpen(), NuppelVideoPlayer::JumpToProgram(), NuppelVideoPlayer::OpenFile(), PlaybackBox::startPlayer(), NuppelVideoPlayer::SwitchToProgram(), and TVRec::TuningNewRecorder().
| void RingBuffer::OpenFile | ( | const QString & | lfilename, | |
| uint | retryCount = 12 | |||
| ) |
Opens a file for reading.
| lfilename | Name of file to read | |
| retryCount | How often to retry reading the file before giving up |
Definition at line 151 of file RingBuffer.cpp.
Referenced by NuppelVideoPlayer::JumpToProgram(), RingBuffer(), and NuppelVideoPlayer::SwitchToProgram().
| int RingBuffer::Read | ( | void * | buf, | |
| int | count | |||
| ) |
This is the public method for reading from a file, it calls the appropriate read method if the file is remote or buffered, or a DVD.
| buf | Pointer to where data will be written | |
| count | Number of bytes to read |
Definition at line 1077 of file RingBuffer.cpp.
Referenced by AVF_Read(), NuppelDecoder::GetFrame(), NuppelDecoder::OpenFile(), Peek(), NuppelDecoder::ReadFileheader(), NuppelDecoder::ReadFrameheader(), IvtvDecoder::ReadWrite(), and FileTransfer::RequestBlock().
| int RingBuffer::Peek | ( | void * | buf, | |
| int | count | |||
| ) |
Resets the read-ahead thread and our position in the file.
Definition at line 361 of file RingBuffer.cpp.
Referenced by NuppelVideoPlayer::FileChangedCallback(), NuppelVideoPlayer::JumpToProgram(), and NuppelVideoPlayer::SwitchToProgram().
| long long RingBuffer::Seek | ( | long long | pos, | |
| int | whence | |||
| ) |
Seeks to a particular position in the file.
Definition at line 1180 of file RingBuffer.cpp.
Referenced by AVF_Seek(), DecoderBase::DoFastForwardSeek(), DecoderBase::DoRewindSeek(), NuppelDecoder::GetFrame(), NuppelDecoder::OpenFile(), AvFormatDecoder::OpenFile(), Peek(), FileTransfer::Seek(), and TV::SwapPIP().
| void RingBuffer::Pause | ( | void | ) |
Pauses the read-ahead thread.
Calls StopReads(void).
Definition at line 671 of file RingBuffer.cpp.
Referenced by NuppelVideoPlayer::FileChangedCallback(), NuppelVideoPlayer::JumpToProgram(), PlaybackBox::killPlayer(), NuppelVideoPlayer::Pause(), ReadFromBuf(), TV::StopStuff(), TV::SwapPIP(), TV::SwitchCards(), NuppelVideoPlayer::SwitchToProgram(), and TV::TogglePIPView().
| void RingBuffer::Unpause | ( | void | ) |
Unpauses the read-ahead thread.
Calls StartReads(void).
Definition at line 681 of file RingBuffer.cpp.
Referenced by NuppelVideoPlayer::FileChangedCallback(), NuppelVideoPlayer::JumpToProgram(), NuppelVideoPlayer::OpenFile(), NuppelVideoPlayer::Play(), ReadFromBuf(), TV::SwapPIP(), and NuppelVideoPlayer::SwitchToProgram().
| void RingBuffer::WaitForPause | ( | void | ) |
Waits for Pause(void) to take effect.
Definition at line 690 of file RingBuffer.cpp.
Referenced by TV::DoPause(), NuppelVideoPlayer::FileChangedCallback(), NuppelVideoPlayer::JumpToProgram(), ReadFromBuf(), TV::StopStuff(), TV::SwapPIP(), TV::SwitchCards(), and NuppelVideoPlayer::SwitchToProgram().
| void RingBuffer::Start | ( | void | ) |
Starts the read-ahead thread.
If this RingBuffer is not in write-mode, the RingBuffer constructor was called with a usereadahead of true, and the read-ahead thread is not already running.
Definition at line 352 of file RingBuffer.cpp.
Referenced by NuppelVideoPlayer::OpenFile().
| void RingBuffer::StopReads | ( | void | ) |
????
Definition at line 652 of file RingBuffer.cpp.
Referenced by Pause(), FileTransfer::Pause(), TV::PauseLiveTV(), FileTransfer::Stop(), TV::StopStuff(), TV::SwitchCards(), TVRec::TeardownRecorder(), and TV::TogglePIPView().
| void RingBuffer::StartReads | ( | void | ) |
????
Definition at line 662 of file RingBuffer.cpp.
Referenced by TV::PauseLiveTV(), Unpause(), and FileTransfer::Unpause().
| bool RingBuffer::LiveMode | ( | void | ) | const |
Returns true if this RingBuffer has been assigned a LiveTVChain.
Definition at line 1322 of file RingBuffer.cpp.
Referenced by NuppelDecoder::GetFrame(), AvFormatDecoder::InitByteContext(), NuppelVideoRecorder::Initialize(), and NuppelVideoPlayer::OpenFile().
| void RingBuffer::SetLiveMode | ( | LiveTVChain * | chain | ) |
Assigns a LiveTVChain to this RingBuffer.
Definition at line 1331 of file RingBuffer.cpp.
Referenced by TV::HandleStateChange(), TV::SwitchCards(), and TV::TogglePIPView().
| void RingBuffer::IgnoreLiveEOF | ( | bool | ignore | ) | [inline] |
Tells RingBuffer whether to igonre the end-of-file.
Definition at line 81 of file RingBuffer.h.
Referenced by NuppelVideoPlayer::JumpToProgram(), TV::PauseLiveTV(), TV::SwitchCards(), and TV::UnpauseLiveTV().
| int RingBuffer::Write | ( | const void * | buf, | |
| uint | count | |||
| ) |
Writes buffer to ThreadedFileWriter::Write(const void*,uint).
Definition at line 1147 of file RingBuffer.cpp.
Referenced by AVF_Write(), DVBRecorder::BufferedWrite(), DTVRecorder::BufferedWrite(), DTVRecorder::FinishRecording(), MpegRecorder::ProcessData(), NuppelVideoRecorder::WriteAudio(), NuppelVideoRecorder::WriteFileHeader(), NuppelVideoRecorder::WriteFrameheader(), NuppelVideoRecorder::WriteHeader(), NuppelVideoRecorder::WriteKeyFrameAdjustTable(), NuppelVideoRecorder::WriteSeekTable(), NuppelDecoder::WriteStoredData(), NuppelVideoRecorder::WriteText(), and NuppelVideoRecorder::WriteVideo().
| bool RingBuffer::IsIOBound | ( | void | ) | const |
Returns true if a RingBuffer::Read(void*,int) is likely to block.
Definition at line 1122 of file RingBuffer.cpp.
Referenced by NuppelVideoRecorder::WriteVideo().
| void RingBuffer::WriterFlush | ( | void | ) |
Calls ThreadedFileWriter::Flush(void) and ThreadedFileWriter::Sync(void).
Definition at line 1257 of file RingBuffer.cpp.
Referenced by NuppelVideoRecorder::FinishRecording(), MpegRecorder::FinishRecording(), DTVRecorder::FinishRecording(), NuppelVideoRecorder::SetNextRecording(), MpegRecorder::SetNextRecording(), and DTVRecorder::SetNextRecording().
| void RingBuffer::Sync | ( | void | ) |
| long long RingBuffer::WriterSeek | ( | long long | pos, | |
| int | whence | |||
| ) |
Calls ThreadedFileWriter::Seek(long long,int).
Definition at line 1240 of file RingBuffer.cpp.
Referenced by NuppelVideoRecorder::WriteKeyFrameAdjustTable(), and NuppelVideoRecorder::WriteSeekTable().
| bool RingBuffer::isDVD | ( | void | ) | const [inline] |
Returns true if this is a DVD backed RingBuffer.
Definition at line 92 of file RingBuffer.h.
Referenced by NuppelVideoPlayer::ActivateDVDButton(), NuppelVideoPlayer::AddAudioData(), NuppelVideoPlayer::AutoDeint(), NuppelVideoPlayer::AVSync(), TV::BookmarkAllowed(), NuppelVideoPlayer::CalcMaxFFTime(), NuppelVideoPlayer::calcSliderPos(), NuppelVideoPlayer::ChangeDVDTrack(), DecoderBase::ChangeDVDTrack(), NuppelVideoPlayer::ClearBookmark(), TV::DeleteAllowed(), NuppelVideoPlayer::DisableCaptions(), NuppelVideoPlayer::DisplayAVSubtitles(), NuppelVideoPlayer::DisplayDVDButton(), NuppelVideoPlayer::DisplayNormalFrame(), DecoderBase::DoFastForward(), DecoderBase::DoFastForwardSeek(), NuppelVideoPlayer::DoPlay(), DecoderBase::DoRewind(), DecoderBase::DoRewindSeek(), DecoderBase::DVDFindPosition(), TV::DVDJumpBack(), TV::DVDJumpForward(), NuppelVideoPlayer::EnableCaptions(), NuppelVideoPlayer::FastForward(), TV::FillMenuPlaying(), NuppelVideoPlayer::GetBookmark(), NuppelVideoPlayer::GetDVDBookmark(), AvFormatDecoder::GetFrame(), NuppelVideoPlayer::GetFrameFFREW(), DecoderBase::GetKey(), AvFormatDecoder::GetTrackDesc(), NuppelVideoPlayer::GoToDVDMenu(), NuppelVideoPlayer::GoToDVDProgram(), TV::HandleStateChange(), AvFormatDecoder::InitByteContext(), NuppelVideoPlayer::InitVideo(), AvFormatDecoder::InitVideoCodec(), internal_play_media(), AvFormatDecoder::MpegPreProcessPkt(), NuppelVideoPlayer::OpenFile(), AvFormatDecoder::OpenFile(), NuppelVideoPlayer::OutputVideoLoop(), DecoderBase::PosMapFromDb(), TV::ProcessKeypress(), TV::ProcessNetworkControlCommand(), TV::PromptStopWatchingRecording(), AvFormatDecoder::Reset(), NuppelVideoPlayer::ResetPlaying(), NuppelVideoPlayer::Rewind(), TV::RunTV(), AvFormatDecoder::ScanStreams(), AvFormatDecoder::SeekReset(), NuppelVideoPlayer::SetBookmark(), NuppelVideoPlayer::SetDVDBookmark(), TV::ShowLCDDVDInfo(), NuppelVideoPlayer::StartPlaying(), TV::StopStuff(), DecoderBase::SyncPositionMap(), TV::ToggleOSD(), and DecoderBase::UpdateDVDFramesPlayed().
| DVDRingBufferPriv* RingBuffer::DVD | ( | ) | [inline] |
Definition at line 93 of file RingBuffer.h.
Referenced by NuppelVideoPlayer::ActivateDVDButton(), NuppelVideoPlayer::AddAudioData(), NuppelVideoPlayer::AVSync(), TV::BookmarkAllowed(), NuppelVideoPlayer::CalcMaxFFTime(), NuppelVideoPlayer::calcSliderPos(), DecoderBase::ChangeDVDTrack(), NuppelVideoPlayer::DisableCaptions(), NuppelVideoPlayer::DisplayDVDButton(), NuppelVideoPlayer::DisplayNormalFrame(), DecoderBase::DoFastForward(), NuppelVideoPlayer::DoPlay(), DecoderBase::DVDFindPosition(), TV::DVDJumpBack(), TV::DVDJumpForward(), NuppelVideoPlayer::EnableCaptions(), NuppelVideoPlayer::GetDVDBookmark(), AvFormatDecoder::GetFrame(), NuppelVideoPlayer::GetFrameFFREW(), AvFormatDecoder::GetTrackDesc(), NuppelVideoPlayer::GoToDVDMenu(), NuppelVideoPlayer::GoToDVDProgram(), internal_play_media(), NuppelVideoPlayer::OpenFile(), AvFormatDecoder::OpenFile(), NuppelVideoPlayer::OutputVideoLoop(), DecoderBase::PosMapFromDb(), TV::ProcessKeypress(), NuppelVideoPlayer::ReinitVideo(), AvFormatDecoder::ScanStreams(), NuppelVideoPlayer::SetDVDBookmark(), TV::ShowLCDDVDInfo(), NuppelVideoPlayer::StartPlaying(), TV::StopStuff(), DecoderBase::SyncPositionMap(), and DecoderBase::UpdateDVDFramesPlayed().
| bool RingBuffer::InDVDMenuOrStillFrame | ( | void | ) |
Definition at line 1336 of file RingBuffer.cpp.
Referenced by NuppelVideoPlayer::AddAudioData(), AvFormatDecoder::AutoSelectTrack(), NuppelVideoPlayer::ClearAfterSeek(), NuppelVideoPlayer::DisplayNormalFrame(), NuppelVideoPlayer::DoChangeDVDTrack(), DecoderBase::DoFastForward(), TV::DoPause(), TV::DVDJumpBack(), AvFormatDecoder::GetFrame(), NuppelVideoPlayer::OutputVideoLoop(), NuppelVideoPlayer::PrebufferEnoughFrames(), TV::ProcessKeypress(), TV::ProcessNetworkControlCommand(), NuppelVideoPlayer::ReinitVideo(), NuppelVideoPlayer::ReleaseNextVideoFrame(), TV::RunTV(), AvFormatDecoder::ScanStreams(), AvFormatDecoder::SeekReset(), NuppelVideoPlayer::SetBookmark(), and NuppelVideoPlayer::SetDVDBookmark().
| long long RingBuffer::SetAdjustFilesize | ( | void | ) |
| void RingBuffer::SetTimeout | ( | bool | fast | ) | [inline] |
| void * RingBuffer::StartReader | ( | void * | type | ) | [static, protected] |
Thunk that calls ReadAheadThread(void).
Definition at line 706 of file RingBuffer.cpp.
Referenced by StartupReadAheadThread().
| void RingBuffer::ReadAheadThread | ( | void | ) | [protected] |
Read-ahead run function.
Definition at line 716 of file RingBuffer.cpp.
Referenced by StartReader().
| void RingBuffer::CalcReadAheadThresh | ( | void | ) | [private] |
Calculates fill_min, fill_threshold, and readblocksize from the estimated effective bitrate of the stream.
Definition at line 529 of file RingBuffer.cpp.
Referenced by OpenFile(), UpdatePlaySpeed(), and UpdateRawBitrate().
| int RingBuffer::safe_read_dvd | ( | void * | data, | |
| uint | sz | |||
| ) | [private] |
| int RingBuffer::safe_read | ( | int | fd, | |
| void * | data, | |||
| uint | sz | |||
| ) | [private] |
Reads data from the file-descriptor.
This will re-read the file forever until the end-of-file is reached or the buffer is full.
| fd | File descriptor to read from | |
| data | Pointer to where data will be written | |
| sz | Number of bytes to read |
Definition at line 394 of file RingBuffer.cpp.
Referenced by Read(), and ReadAheadThread().
| int RingBuffer::safe_read | ( | RemoteFile * | rf, | |
| void * | data, | |||
| uint | sz | |||
| ) | [private] |
Reads data from the RemoteFile.
| rf | RemoteFile to read from | |
| data | Pointer to where data will be written | |
| sz | Number of bytes to read |
Definition at line 462 of file RingBuffer.cpp.
| int RingBuffer::ReadFromBuf | ( | void * | buf, | |
| int | count, | |||
| bool | peek = false | |||
| ) | [private] |
Reads from the read-ahead buffer, this is called by Read(void*, int) when the read-ahead thread is running.
| buf | Pointer to where data will be written | |
| count | Number of bytes to read | |
| peek | If true, don't increment read count |
Definition at line 932 of file RingBuffer.cpp.
| int RingBuffer::ReadBufFree | ( | void | ) | const [private] |
Returns number of bytes available for reading into buffer.
Definition at line 581 of file RingBuffer.cpp.
Referenced by ReadAheadThread().
| int RingBuffer::ReadBufAvail | ( | void | ) | const [private] |
Returns number of bytes available for reading from buffer.
Definition at line 590 of file RingBuffer.cpp.
Referenced by ReadFromBuf().
| void RingBuffer::StartupReadAheadThread | ( | void | ) | [private] |
Creates the read-ahead thread, and waits for it to start.
Definition at line 626 of file RingBuffer.cpp.
Referenced by ReadFromBuf(), and Start().
| void RingBuffer::ResetReadAhead | ( | long long | newinternal | ) | [private] |
Restart the read-ahead threat at the 'newinternal' position.
This is called after a Seek(long long, int) so that the read-ahead buffer doesn't contain any stale data, and so that it will read any new data from the new position in the file.
WARNING: Must be called with rwlock in write lock state.
| newinternal | Position in file to start reading data from |
Definition at line 608 of file RingBuffer.cpp.
Referenced by ReadAheadThread(), Reset(), and Seek().
| void RingBuffer::KillReadAheadThread | ( | void | ) | [private] |
Stops the read-ahead thread, and waits for it to stop.
Definition at line 639 of file RingBuffer.cpp.
Referenced by ReadFromBuf(), and ~RingBuffer().
QString RingBuffer::filename [private] |
Definition at line 119 of file RingBuffer.h.
Referenced by GetRealFileSize(), OpenFile(), and RingBuffer().
ThreadedFileWriter* RingBuffer::tfw [private] |
Definition at line 121 of file RingBuffer.h.
Referenced by IsIOBound(), IsOpen(), RingBuffer(), SetWriteBufferMinWriteSize(), SetWriteBufferSize(), Sync(), Write(), WriterFlush(), WriterSeek(), and ~RingBuffer().
int RingBuffer::fd2 [private] |
Definition at line 122 of file RingBuffer.h.
Referenced by IsOpen(), OpenFile(), Read(), ReadAheadThread(), Seek(), and ~RingBuffer().
bool RingBuffer::writemode [private] |
Definition at line 124 of file RingBuffer.h.
Referenced by Read(), ReadAheadThread(), RingBuffer(), Start(), and Write().
long long RingBuffer::readpos [private] |
Definition at line 126 of file RingBuffer.h.
Referenced by GetReadPosition(), Read(), Reset(), and Seek().
long long RingBuffer::writepos [private] |
Definition at line 127 of file RingBuffer.h.
Referenced by GetWritePosition(), Reset(), Write(), and WriterSeek().
bool RingBuffer::stopreads [private] |
Definition at line 129 of file RingBuffer.h.
Referenced by ReadAheadThread(), ReadFromBuf(), safe_read(), StartReads(), and StopReads().
pthread_rwlock_t RingBuffer::rwlock [mutable, private] |
Definition at line 131 of file RingBuffer.h.
Referenced by CalcReadAheadThresh(), IsIOBound(), Read(), ReadAheadThread(), Reset(), RingBuffer(), Seek(), Write(), and ~RingBuffer().
int RingBuffer::recorder_num [private] |
Definition at line 133 of file RingBuffer.h.
RemoteEncoder* RingBuffer::remoteencoder [private] |
Definition at line 134 of file RingBuffer.h.
RemoteFile* RingBuffer::remotefile [private] |
Definition at line 135 of file RingBuffer.h.
Referenced by GetRealFileSize(), IsOpen(), OpenFile(), Read(), ReadAheadThread(), Seek(), and ~RingBuffer().
QMutex RingBuffer::readAheadLock [mutable, private] |
Definition at line 137 of file RingBuffer.h.
Referenced by ReadAheadThread(), ReadBufAvail(), ReadBufFree(), ReadFromBuf(), and ResetReadAhead().
pthread_t RingBuffer::reader [private] |
Definition at line 138 of file RingBuffer.h.
Referenced by KillReadAheadThread(), and StartupReadAheadThread().
bool RingBuffer::startreadahead [private] |
char* RingBuffer::readAheadBuffer [private] |
bool RingBuffer::readaheadrunning [private] |
Definition at line 142 of file RingBuffer.h.
Referenced by KillReadAheadThread(), Peek(), Read(), ReadAheadThread(), Seek(), Start(), StartupReadAheadThread(), and WaitForPause().
bool RingBuffer::readaheadpaused [private] |
Definition at line 143 of file RingBuffer.h.
Referenced by ReadAheadThread(), ReadFromBuf(), and WaitForPause().
bool RingBuffer::pausereadthread [private] |
Definition at line 144 of file RingBuffer.h.
Referenced by Pause(), ReadAheadThread(), and Unpause().
int RingBuffer::rbrpos [private] |
Definition at line 145 of file RingBuffer.h.
Referenced by ReadAheadThread(), ReadBufAvail(), ReadBufFree(), ReadFromBuf(), and ResetReadAhead().
int RingBuffer::rbwpos [private] |
Definition at line 146 of file RingBuffer.h.
Referenced by ReadAheadThread(), ReadBufAvail(), ReadBufFree(), and ResetReadAhead().
long long RingBuffer::internalreadpos [private] |
Definition at line 147 of file RingBuffer.h.
Referenced by ReadAheadThread(), Reset(), ResetReadAhead(), safe_read(), and SetAdjustFilesize().
bool RingBuffer::ateof [private] |
Definition at line 148 of file RingBuffer.h.
Referenced by OpenFile(), ReadAheadThread(), ReadFromBuf(), and ResetReadAhead().
bool RingBuffer::readsallowed [private] |
Definition at line 149 of file RingBuffer.h.
Referenced by CalcReadAheadThresh(), ReadAheadThread(), ReadFromBuf(), and ResetReadAhead().
volatile bool RingBuffer::wantseek [private] |
Definition at line 150 of file RingBuffer.h.
Referenced by CalcReadAheadThresh(), ReadAheadThread(), Reset(), and Seek().
bool RingBuffer::setswitchtonext [private] |
Definition at line 151 of file RingBuffer.h.
Referenced by OpenFile(), ReadAheadThread(), ReadFromBuf(), Reset(), and ResetReadAhead().
QMutex RingBuffer::bitratelock [mutable, private] |
Definition at line 153 of file RingBuffer.h.
Referenced by GetBitrate(), GetReadBlockSize(), UpdatePlaySpeed(), and UpdateRawBitrate().
uint RingBuffer::rawbitrate [private] |
Definition at line 154 of file RingBuffer.h.
Referenced by CalcReadAheadThresh(), GetBitrate(), OpenFile(), and UpdateRawBitrate().
float RingBuffer::playspeed [private] |
Definition at line 155 of file RingBuffer.h.
Referenced by CalcReadAheadThresh(), GetBitrate(), and UpdatePlaySpeed().
int RingBuffer::fill_threshold [private] |
Definition at line 156 of file RingBuffer.h.
Referenced by CalcReadAheadThresh(), and ReadAheadThread().
int RingBuffer::fill_min [private] |
Definition at line 157 of file RingBuffer.h.
Referenced by CalcReadAheadThresh(), and ReadAheadThread().
int RingBuffer::readblocksize [private] |
Definition at line 158 of file RingBuffer.h.
Referenced by CalcReadAheadThresh(), GetReadBlockSize(), OpenFile(), ReadAheadThread(), and ResetReadAhead().
QWaitCondition RingBuffer::pauseWait [private] |
int RingBuffer::wanttoread [private] |
QWaitCondition RingBuffer::availWait [private] |
Definition at line 163 of file RingBuffer.h.
Referenced by ReadAheadThread(), ReadFromBuf(), and StopReads().
QMutex RingBuffer::availWaitMutex [private] |
QWaitCondition RingBuffer::readsAllowedWait [private] |
int RingBuffer::numfailures [private] |
Definition at line 168 of file RingBuffer.h.
Referenced by OpenFile(), ReadAheadThread(), Reset(), and safe_read().
bool RingBuffer::commserror [private] |
Definition at line 170 of file RingBuffer.h.
Referenced by OpenFile(), ReadAheadThread(), ReadFromBuf(), and Reset().
DVDRingBufferPriv* RingBuffer::dvdPriv [private] |
Definition at line 172 of file RingBuffer.h.
Referenced by CalcReadAheadThresh(), GetReadPosition(), InDVDMenuOrStillFrame(), IsOpen(), OpenFile(), Read(), ReadAheadThread(), Seek(), and ~RingBuffer().
bool RingBuffer::oldfile [private] |
LiveTVChain* RingBuffer::livetvchain [private] |
Definition at line 176 of file RingBuffer.h.
Referenced by LiveMode(), ReadAheadThread(), ReadFromBuf(), safe_read(), and SetLiveMode().
bool RingBuffer::ignoreliveeof [private] |
long long RingBuffer::readAdjust [private] |
Definition at line 179 of file RingBuffer.h.
Referenced by Reset(), safe_read(), Seek(), and SetAdjustFilesize().
QWaitCondition RingBuffer::readAheadRunningCond [private] |
Condition to signal that the read ahead thread is running.
Definition at line 182 of file RingBuffer.h.
Referenced by ReadAheadThread(), and StartupReadAheadThread().
QMutex RingBuffer::readAheadRunningCondLock [private] |
Definition at line 183 of file RingBuffer.h.
Referenced by ReadAheadThread(), and StartupReadAheadThread().
const uint RingBuffer::kBufferSize = 3 * 1024 * 1024 [static, private] |
Definition at line 186 of file RingBuffer.h.
Referenced by ReadAheadThread(), ReadBufAvail(), ReadBufFree(), and ReadFromBuf().
const uint RingBuffer::kReadTestSize = PNG_MIN_SIZE [static, private] |
1.5.5