#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 26 of file RingBuffer.h.
Public Member Functions | |
| RingBuffer (const QString &lfilename, bool write, bool usereadahead=true, int timeout_ms=kDefaultOpenTimeout) | |
| 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 | SetOldFile (bool is_old) |
| Tell RingBuffer if this is an old file or not. | |
| void | SetStreamOnly (bool stream) |
| 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. | |
| QString | GetSubtitleFilename (void) const |
| 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. | |
| bool | IsOpen (void) const |
| Returns true if the file is open for either reading or writing. | |
| bool | IsNearEnd (double fps, uint vvf) const |
| void | OpenFile (const QString &lfilename, uint retry_ms=kDefaultOpenTimeout) |
| 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 BD/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, bool has_lock=false) |
| 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::Write(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, bool has_lock=false) |
| Calls ThreadedFileWriter::Seek(long long,int). | |
| bool | IsDVD (void) const |
| Returns true if this is a DVD backed RingBuffer. | |
| bool | InDVDMenuOrStillFrame (void) |
| Returns true if this is a DVD backed RingBuffer. | |
| bool | IsBD (void) const |
| Returns true if this is a Blu-ray backed RingBuffer. | |
| long long | SetAdjustFilesize (void) |
| void | SetTimeout (bool is_old) MDEPRECATED |
| Calls SetOldFile(), do not use. | |
| bool | isDVD (void) const MDEPRECATED |
| Calls IsDVD(), do not use. | |
| bool | isBD (void) const MDEPRECATED |
| Calls IsBD(), do not use. | |
| DVDRingBufferPriv * | DVD () MDEPRECATED |
| Illicitly manipulating privates is ill advised! DO NOT USE. | |
| BDRingBufferPriv * | BD () MDEPRECATED |
| Illicitly manipulating privates is ill advised! DO NOT USE. | |
Static Public Attributes | |
| static const int | kDefaultOpenTimeout = 2000 |
| static QMutex | subExtLock |
| static QStringList | subExt |
| static QStringList | subExtNoCheck |
| static const uint | kBufferSize = 4 * 1024 * 1024 |
| static const uint | kReadTestSize = PNG_MIN_SIZE |
Protected Member Functions | |
| void | run (void) |
| void | CalcReadAheadThresh (void) |
| Calculates fill_min, fill_threshold, and readblocksize from the estimated effective bitrate of the stream. | |
| bool | PauseAndWait (void) |
| int | safe_read_bd (void *data, uint sz) |
| 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 | ReadPriv (void *buf, int count, bool peek) |
| When possible reads from the read-ahead buffer, otherwise reads directly from the device. | |
| int | ReadDirect (void *buf, int count, bool peek) |
| bool | WaitForReadsAllowed (void) |
| bool | WaitForAvail (int count) |
| 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 | ResetReadAhead (long long newinternal) |
| Restart the read-ahead thread at the 'newinternal' position. | |
| void | KillReadAheadThread (void) |
| Stops the read-ahead thread, and waits for it to stop. | |
Private Attributes | |
| QReadWriteLock | poslock |
| long long | readpos |
| long long | writepos |
| long long | internalreadpos |
| long long | ignorereadpos |
| QReadWriteLock | rbrlock |
| int | rbrpos |
| QReadWriteLock | rbwlock |
| int | rbwpos |
| volatile bool | stopreads |
| QReadWriteLock | rwlock |
| QString | filename |
| QString | subtitlefilename |
| ThreadedFileWriter * | tfw |
| int | fd2 |
| bool | writemode |
| RemoteFile * | remotefile |
| bool | startreadahead |
| char * | readAheadBuffer |
| bool | readaheadrunning |
| bool | reallyrunning |
| bool | request_pause |
| bool | paused |
| bool | ateof |
| bool | readsallowed |
| bool | setswitchtonext |
| bool | streamOnly |
| bool | ignorereadahead |
| uint | rawbitrate |
| float | playspeed |
| int | fill_threshold |
| int | fill_min |
| int | readblocksize |
| int | wanttoread |
| int | numfailures |
| bool | commserror |
| DVDRingBufferPriv * | dvdPriv |
| BDRingBufferPriv * | bdPriv |
| bool | oldfile |
| LiveTVChain * | livetvchain |
| bool | ignoreliveeof |
| long long | readAdjust |
| QWaitCondition | generalWait |
| Condition to signal that the read ahead thread is running. | |
| RingBuffer::RingBuffer | ( | const QString & | lfilename, | |
| bool | write, | |||
| bool | readahead = true, |
|||
| int | timeout_ms = kDefaultOpenTimeout | |||
| ) |
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. | |
| timeout_ms | if < 0, then we will not open the file. Otherwise it's how long to try opening the file after the first failure in milliseconds before giving up. |
Definition at line 117 of file RingBuffer.cpp.
| RingBuffer::~RingBuffer | ( | void | ) |
| void RingBuffer::SetWriteBufferSize | ( | int | newSize | ) |
Calls ThreadedFileWriter::SetWriteBufferSize(int).
Definition at line 2101 of file RingBuffer.cpp.
Referenced by TVRec::SetupRecorder().
| void RingBuffer::SetWriteBufferMinWriteSize | ( | int | newMinSize | ) |
Calls ThreadedFileWriter::SetWriteBufferMinWriteSize(int).
Definition at line 2112 of file RingBuffer.cpp.
| void RingBuffer::SetOldFile | ( | bool | is_old | ) |
Tell RingBuffer if this is an old file or not.
Normally the RingBuffer determines that the file is old if it has not been modified in the last minute. This allows one to override that determination externally.
If for instance you are slowly writing to the file you could call this with the value of false. If you just finished writing the file you could call it with the value true. Knowing that the file is old allows MythTV to determine that a read at the end of the file is really an end-of-file condition more quickly. But if the file is growing it can also cause the RingBuffer to report an end-of-file condition prematurely.
Definition at line 2135 of file RingBuffer.cpp.
| void RingBuffer::SetStreamOnly | ( | bool | stream | ) |
| 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 758 of file RingBuffer.cpp.
Referenced by NuppelDecoder::GetFrame(), MythPlayer::JumpToProgram(), NuppelDecoder::OpenFile(), AvFormatDecoder::ScanStreams(), and MythPlayer::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 780 of file RingBuffer.cpp.
| QString RingBuffer::GetFilename | ( | void | ) | const |
Returns name of file used by this RingBuffer.
Definition at line 2154 of file RingBuffer.cpp.
Referenced by FileTransfer::GetFileSize(), NuppelDecoder::OpenFile(), MythPlayer::OpenFile(), AvFormatDecoder::OpenFile(), TV::ProcessNetworkControlCommand(), AvFormatDecoder::Reset(), RecorderBase::SetRingBuffer(), NuppelVideoRecorder::StartRecording(), and ImportRecorder::StartRecording().
| QString RingBuffer::GetSubtitleFilename | ( | void | ) | const |
| bool RingBuffer::GetStopReads | ( | void | ) | const [inline] |
Returns value of stopreads.
Definition at line 47 of file RingBuffer.h.
Referenced by FileTransfer::RequestBlock().
| bool RingBuffer::isPaused | ( | void | ) | const |
Returns false iff read-ahead is not running and read-ahead is not paused.
Definition at line 1034 of file RingBuffer.cpp.
| long long RingBuffer::GetReadPosition | ( | void | ) | const |
Returns how far into the file we have read.
Definition at line 2175 of file RingBuffer.cpp.
Referenced by MythDVDPlayer::calcSliderPos(), NuppelDecoder::GetFrame(), NuppelDecoder::OpenFile(), FileTransfer::Seek(), and AvFormatDecoder::SeekReset().
| long long RingBuffer::GetWritePosition | ( | void | ) | const |
Returns how far into a ThreadedFileWriter file we have written.
Definition at line 2194 of file RingBuffer.cpp.
Referenced by DTVRecorder::FindH264Keyframes(), TVRec::GetFilePosition(), DTVRecorder::HandleKeyframe(), 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 2206 of file RingBuffer.cpp.
Referenced by AVF_Seek(), NuppelVideoRecorder::FinishRecording(), DTVRecorder::FinishRecording(), AvFormatDecoder::HandleGopStart(), AvFormatDecoder::OpenFile(), NuppelVideoRecorder::SetNextRecording(), DTVRecorder::SetNextRecording(), and ImportRecorder::StartRecording().
| bool RingBuffer::IsOpen | ( | void | ) | const |
Returns true if the file is open for either reading or writing.
Definition at line 549 of file RingBuffer.cpp.
Referenced by NuppelVideoRecorder::CreateNuppelFile(), PreviewGenerator::GetScreenGrab(), TV::HandleStateChange(), NuppelVideoRecorder::Initialize(), FileTransfer::isOpen(), MythPlayer::JumpToProgram(), MythPlayer::SwitchToProgram(), and TVRec::TuningNewRecorder().
| void RingBuffer::OpenFile | ( | const QString & | lfilename, | |
| uint | retry_ms = kDefaultOpenTimeout | |||
| ) |
Opens a file for reading.
| lfilename | Name of file to read | |
| retry_ms | How many ms to retry reading the file after the first try before giving up. |
Definition at line 276 of file RingBuffer.cpp.
Referenced by MythPlayer::JumpToProgram(), mythfile_open(), RingBuffer(), and MythPlayer::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 BD/DVD.
| buf | Pointer to where data will be written | |
| count | Number of bytes to read |
Definition at line 1680 of file RingBuffer.cpp.
Referenced by AVF_Read(), NuppelDecoder::GetFrame(), NuppelDecoder::OpenFile(), read_line_from_input(), NuppelDecoder::ReadFileheader(), NuppelDecoder::ReadFrameheader(), and FileTransfer::RequestBlock().
| int RingBuffer::Peek | ( | void * | buf, | |
| int | count | |||
| ) |
Resets the read-ahead thread and our position in the file.
Definition at line 613 of file RingBuffer.cpp.
Referenced by MythPlayer::FileChangedCallback(), MythPlayer::JumpToProgram(), and MythPlayer::SwitchToProgram().
| long long RingBuffer::Seek | ( | long long | pos, | |
| int | whence, | |||
| bool | has_lock = false | |||
| ) |
Seeks to a particular position in the file.
Definition at line 1768 of file RingBuffer.cpp.
Referenced by AVF_Seek(), TV::CreatePBP(), DecoderBase::DoFastForwardSeek(), DecoderBase::DoRewindSeek(), NuppelDecoder::GetFrame(), NuppelDecoder::OpenFile(), TV::PBPRestartMainPlayer(), ReadDirect(), TV::RestartAllPlayers(), FileTransfer::Seek(), and sub_read_line_subrip().
| void RingBuffer::Pause | ( | void | ) |
Pauses the read-ahead thread.
Calls StopReads(void).
Definition at line 1010 of file RingBuffer.cpp.
Referenced by MythPlayer::PauseBuffer(), PlayerContext::PIPTeardown(), TV::StopStuff(), and TV::SwitchCards().
| void RingBuffer::Unpause | ( | void | ) |
Unpauses the read-ahead thread.
Calls StartReads(void).
Definition at line 1023 of file RingBuffer.cpp.
Referenced by TV::CreatePBP(), TV::RestartAllPlayers(), MythPlayer::SwitchToProgram(), and MythPlayer::UnpauseBuffer().
| void RingBuffer::WaitForPause | ( | void | ) |
Waits for Pause(void) to take effect.
Definition at line 1045 of file RingBuffer.cpp.
Referenced by TV::DoTogglePauseFinish(), MythPlayer::PauseBuffer(), PlayerContext::PIPTeardown(), TV::StopStuff(), and TV::SwitchCards().
| void RingBuffer::Start | ( | void | ) |
Starts the read-ahead thread.
If the RingBuffer constructor was not called with a usereadahead of true of if this was reset to false because we're dealing with a DVD the read ahead thread will not be started.
If this RingBuffer is in write-mode a warning will be printed and the read ahead thread will not be started.
If the read ahead thread is already running a warning will be printed and the read ahead thread will not be started.
Definition at line 932 of file RingBuffer.cpp.
Referenced by mythfile_open(), and MythPlayer::OpenFile().
| void RingBuffer::StopReads | ( | void | ) |
????
Definition at line 990 of file RingBuffer.cpp.
Referenced by KillReadAheadThread(), Pause(), FileTransfer::Pause(), TV::PauseLiveTV(), Seek(), FileTransfer::Stop(), TV::StopStuff(), TV::SwitchCards(), and TVRec::TeardownRecorder().
| void RingBuffer::StartReads | ( | void | ) |
????
Definition at line 1000 of file RingBuffer.cpp.
Referenced by TV::PauseLiveTV(), Seek(), Start(), Unpause(), and FileTransfer::Unpause().
| bool RingBuffer::LiveMode | ( | void | ) | const |
Returns true if this RingBuffer has been assigned a LiveTVChain.
Definition at line 2222 of file RingBuffer.cpp.
Referenced by NuppelDecoder::GetFrame(), AvFormatDecoder::InitByteContext(), and NuppelVideoRecorder::Initialize().
| void RingBuffer::SetLiveMode | ( | LiveTVChain * | chain | ) |
Assigns a LiveTVChain to this RingBuffer.
Definition at line 2234 of file RingBuffer.cpp.
Referenced by TV::HandleStateChange(), and TV::SwitchCards().
| void RingBuffer::IgnoreLiveEOF | ( | bool | ignore | ) |
Tells RingBuffer whether to igonre the end-of-file.
Definition at line 2242 of file RingBuffer.cpp.
Referenced by MythPlayer::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 1720 of file RingBuffer.cpp.
Referenced by AVF_Write(), HDHRRecorder::BufferedWrite(), DVBRecorder::BufferedWrite(), DTVRecorder::BufferedWrite(), DTVRecorder::FindPSKeyFrames(), DTVRecorder::FinishRecording(), NuppelVideoRecorder::WriteAudio(), FileTransfer::WriteBlock(), 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::Write(void*,int) is likely to block.
Definition at line 1695 of file RingBuffer.cpp.
Referenced by NuppelVideoRecorder::WriteVideo().
| void RingBuffer::WriterFlush | ( | void | ) |
Calls ThreadedFileWriter::Flush(void) and ThreadedFileWriter::Sync(void).
Definition at line 2087 of file RingBuffer.cpp.
Referenced by NuppelVideoRecorder::FinishRecording(), DTVRecorder::FinishRecording(), NuppelVideoRecorder::SetNextRecording(), DTVRecorder::SetNextRecording(), and FileTransfer::Stop().
| void RingBuffer::Sync | ( | void | ) |
| long long RingBuffer::WriterSeek | ( | long long | pos, | |
| int | whence, | |||
| bool | has_lock = false | |||
| ) |
Calls ThreadedFileWriter::Seek(long long,int).
Definition at line 2060 of file RingBuffer.cpp.
Referenced by Seek(), NuppelVideoRecorder::WriteKeyFrameAdjustTable(), and NuppelVideoRecorder::WriteSeekTable().
| bool RingBuffer::IsDVD | ( | void | ) | const |
Returns true if this is a DVD backed RingBuffer.
NOTE: This is not locked because ReadDirect calls DVD safe_read which sleeps with a write lock on rwlock in the DVDNAV_WAIT condition.
Due to the lack of locking is only safe to call once OpenFile() has completed.
Definition at line 2258 of file RingBuffer.cpp.
| bool RingBuffer::InDVDMenuOrStillFrame | ( | void | ) |
Returns true if this is a DVD backed RingBuffer.
NOTE: This is not locked because ReadDirect calls DVD safe_read which sleeps with a write lock on rwlock in the DVDNAV_WAIT condition.
Due to the lack of locking is only safe to call once OpenFile() has completed.
Definition at line 2275 of file RingBuffer.cpp.
Referenced by AvFormatDecoder::AutoSelectTrack(), MythDVDPlayer::DisplayNormalFrame(), MythDVDPlayer::DoChangeDVDTrack(), DecoderBase::DoFastForward(), TV::DoTogglePauseFinish(), TV::DoTogglePauseStart(), TV::DVDJumpBack(), AvFormatDecoder::GetFrame(), TV::HandleLCDTimerEvent(), MythDVDPlayer::PrebufferEnoughFrames(), MythDVDPlayer::PrepareAudioSample(), AvFormatDecoder::ProcessAudioPacket(), TV::ProcessKeypress(), TV::ProcessNetworkControlCommand(), MythDVDPlayer::ReleaseNextVideoFrame(), AvFormatDecoder::ScanStreams(), AvFormatDecoder::SeekReset(), MythDVDPlayer::SetBookmark(), MythDVDPlayer::SetDVDBookmark(), and MythDVDPlayer::VideoLoop().
| bool RingBuffer::IsBD | ( | void | ) | const |
Returns true if this is a Blu-ray backed RingBuffer.
Definition at line 2288 of file RingBuffer.cpp.
| long long RingBuffer::SetAdjustFilesize | ( | void | ) |
| void RingBuffer::SetTimeout | ( | bool | is_old | ) | [inline] |
Calls SetOldFile(), do not use.
Definition at line 100 of file RingBuffer.h.
Referenced by FileTransfer::SetTimeout().
| bool RingBuffer::isDVD | ( | void | ) | const [inline] |
Calls IsDVD(), do not use.
Definition at line 102 of file RingBuffer.h.
Referenced by MythDVDPlayer::CalcMaxFFTime(), MythDVDPlayer::calcSliderPos(), DecoderBase::ChangeDVDTrack(), MythDVDPlayer::ChangeSpeed(), MythDVDPlayer::DecoderGetFrameREW(), MythDVDPlayer::DisableCaptions(), MythDVDPlayer::DisplayDVDButton(), MythDVDPlayer::DisplayNormalFrame(), MythDVDPlayer::DisplayPauseFrame(), DecoderBase::DoFastForward(), DecoderBase::DoFastForwardSeek(), DecoderBase::DoRewind(), DecoderBase::DoRewindSeek(), DecoderBase::DVDFindPosition(), TV::DVDJumpBack(), TV::DVDJumpForward(), MythDVDPlayer::EnableCaptions(), MythDVDPlayer::GetBookmark(), AvFormatDecoder::GetFrame(), DecoderBase::GetKey(), AvFormatDecoder::GetTrackDesc(), MythDVDPlayer::GoToDVDMenu(), MythDVDPlayer::GoToDVDProgram(), TV::HandleLCDTimerEvent(), TV::HandleStateChange(), AvFormatDecoder::InitByteContext(), AvFormatDecoder::InitVideoCodec(), internal_play_media(), TV::IsBookmarkAllowed(), AvFormatDecoder::MpegPreProcessPkt(), MythDVDPlayer::OpenFile(), AvFormatDecoder::OpenFile(), DecoderBase::PosMapFromDb(), DecoderBase::PosMapFromEnc(), MythDVDPlayer::PrepareAudioSample(), AvFormatDecoder::PreProcessVideoPacket(), TV::ProcessKeypress(), TV::ProcessNetworkControlCommand(), AvFormatDecoder::ProcessSubtitlePacket(), AvFormatDecoder::ProcessVideoPacket(), AvFormatDecoder::Reset(), AvFormatDecoder::ScanStreams(), MythDVDPlayer::SeekForScreenGrab(), AvFormatDecoder::SeekReset(), MythDVDPlayer::SetDVDBookmark(), TV::ShowLCDDVDInfo(), TV::ShowOSDStopWatchingRecording(), TV::StopStuff(), DecoderBase::SyncPositionMap(), and DecoderBase::UpdateDVDFramesPlayed().
| bool RingBuffer::isBD | ( | void | ) | const [inline] |
Calls IsBD(), do not use.
Definition at line 104 of file RingBuffer.h.
Referenced by DecoderBase::BDFindPosition(), DecoderBase::DoFastForwardSeek(), DecoderBase::DoRewind(), DecoderBase::DoRewindSeek(), DecoderBase::GetKey(), DecoderBase::PosMapFromDb(), DecoderBase::PosMapFromEnc(), AvFormatDecoder::ScanStreams(), DecoderBase::SyncPositionMap(), and DecoderBase::UpdateBDFramesPlayed().
| DVDRingBufferPriv* RingBuffer::DVD | ( | ) | [inline] |
Illicitly manipulating privates is ill advised! DO NOT USE.
Definition at line 107 of file RingBuffer.h.
Referenced by TV::ActiveHandleAction(), TV::ActivePostQHandleAction(), MythDVDPlayer::CalcMaxFFTime(), MythDVDPlayer::calcSliderPos(), DecoderBase::ChangeDVDTrack(), MythDVDPlayer::ChangeSpeed(), MythDVDPlayer::DecoderGetFrameREW(), MythDVDPlayer::DisableCaptions(), MythDVDPlayer::DisplayDVDButton(), MythDVDPlayer::DisplayNormalFrame(), MythDVDPlayer::DisplayPauseFrame(), DecoderBase::DoFastForward(), DecoderBase::DVDFindPosition(), TV::DVDJumpBack(), TV::DVDJumpForward(), TV::DVDMenuHandleAction(), MythDVDPlayer::EnableCaptions(), MythDVDPlayer::EventEnd(), MythDVDPlayer::EventStart(), MythDVDPlayer::GetBookmark(), MythDVDPlayer::GetCurrentAngle(), AvFormatDecoder::GetFrame(), MythDVDPlayer::GetNumAngles(), AvFormatDecoder::GetTrackDesc(), MythDVDPlayer::GoToDVDMenu(), MythDVDPlayer::GoToDVDProgram(), internal_play_media(), TV::IsBookmarkAllowed(), MythDVDPlayer::OpenFile(), AvFormatDecoder::OpenFile(), DecoderBase::PosMapFromDb(), MythDVDPlayer::PrepareAudioSample(), AvFormatDecoder::ProcessSubtitlePacket(), AvFormatDecoder::ScanStreams(), MythDVDPlayer::SeekForScreenGrab(), MythDVDPlayer::SetDVDBookmark(), MythDVDPlayer::SetTrack(), TV::ShowLCDDVDInfo(), TV::StopStuff(), MythDVDPlayer::SwitchAngle(), DecoderBase::SyncPositionMap(), DecoderBase::UpdateDVDFramesPlayed(), and MythDVDPlayer::VideoLoop().
| BDRingBufferPriv* RingBuffer::BD | ( | ) | [inline] |
Illicitly manipulating privates is ill advised! DO NOT USE.
Definition at line 113 of file RingBuffer.h.
Referenced by DecoderBase::BDFindPosition(), MythBDPlayer::GetChapter(), MythBDPlayer::GetChapterTimes(), MythBDPlayer::GetCurrentAngle(), MythBDPlayer::GetCurrentChapter(), MythBDPlayer::GetCurrentTitle(), MythBDPlayer::GetNumAngles(), MythBDPlayer::GetNumChapters(), MythBDPlayer::GetNumTitles(), MythBDPlayer::GetTitleDuration(), DecoderBase::PosMapFromDb(), AvFormatDecoder::ScanStreams(), MythBDPlayer::SwitchAngle(), MythBDPlayer::SwitchTitle(), DecoderBase::SyncPositionMap(), and DecoderBase::UpdateBDFramesPlayed().
| void RingBuffer::run | ( | void | ) | [protected] |
Definition at line 1107 of file RingBuffer.cpp.
| void RingBuffer::CalcReadAheadThresh | ( | void | ) | [protected] |
Calculates fill_min, fill_threshold, and readblocksize from the estimated effective bitrate of the stream.
WARNING: Must be called with rwlock in write lock state.
Definition at line 795 of file RingBuffer.cpp.
Referenced by OpenFile(), ResetReadAhead(), UpdatePlaySpeed(), and UpdateRawBitrate().
| bool RingBuffer::PauseAndWait | ( | void | ) | [protected] |
| int RingBuffer::safe_read_bd | ( | void * | data, | |
| uint | sz | |||
| ) | [protected] |
| int RingBuffer::safe_read_dvd | ( | void * | data, | |
| uint | sz | |||
| ) | [protected] |
| int RingBuffer::safe_read | ( | int | fd, | |
| void * | data, | |||
| uint | sz | |||
| ) | [protected] |
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 660 of file RingBuffer.cpp.
Referenced by ReadDirect(), and run().
| int RingBuffer::safe_read | ( | RemoteFile * | rf, | |
| void * | data, | |||
| uint | sz | |||
| ) | [protected] |
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 731 of file RingBuffer.cpp.
| int RingBuffer::ReadPriv | ( | void * | buf, | |
| int | count, | |||
| bool | peek | |||
| ) | [protected] |
When possible reads from the read-ahead buffer, otherwise reads directly from the device.
| 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 1554 of file RingBuffer.cpp.
| int RingBuffer::ReadDirect | ( | void * | buf, | |
| int | count, | |||
| bool | peek | |||
| ) | [protected] |
| bool RingBuffer::WaitForReadsAllowed | ( | void | ) | [protected] |
| bool RingBuffer::WaitForAvail | ( | int | count | ) | [protected] |
| int RingBuffer::ReadBufFree | ( | void | ) | const [protected] |
Returns number of bytes available for reading into buffer.
WARNING: Must be called with rwlock in locked state.
Definition at line 864 of file RingBuffer.cpp.
Referenced by run().
| int RingBuffer::ReadBufAvail | ( | void | ) | const [protected] |
Returns number of bytes available for reading from buffer.
WARNING: Must be called with rwlock in locked state.
Definition at line 876 of file RingBuffer.cpp.
Referenced by IsNearEnd(), ReadPriv(), and WaitForAvail().
| void RingBuffer::ResetReadAhead | ( | long long | newinternal | ) | [protected] |
Restart the read-ahead thread 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 and poslock in write lock state.
| newinternal | Position in file to start reading data from |
Definition at line 897 of file RingBuffer.cpp.
| void RingBuffer::KillReadAheadThread | ( | void | ) | [protected] |
Stops the read-ahead thread, and waits for it to stop.
Definition at line 973 of file RingBuffer.cpp.
Referenced by ~RingBuffer().
const int RingBuffer::kDefaultOpenTimeout = 2000 [static] |
Definition at line 118 of file RingBuffer.h.
Referenced by MythPlayer::JumpToProgram(), and MythPlayer::SwitchToProgram().
QReadWriteLock RingBuffer::poslock [mutable, private] |
Definition at line 141 of file RingBuffer.h.
Referenced by GetReadPosition(), GetWritePosition(), Read(), ReadDirect(), Reset(), run(), safe_read(), Seek(), SetAdjustFilesize(), Write(), and WriterSeek().
long long RingBuffer::readpos [private] |
Definition at line 142 of file RingBuffer.h.
Referenced by GetReadPosition(), Read(), ReadDirect(), Reset(), run(), and Seek().
long long RingBuffer::writepos [private] |
Definition at line 143 of file RingBuffer.h.
Referenced by GetWritePosition(), Reset(), Write(), and WriterSeek().
long long RingBuffer::internalreadpos [private] |
Definition at line 144 of file RingBuffer.h.
Referenced by Reset(), ResetReadAhead(), run(), safe_read(), Seek(), and SetAdjustFilesize().
long long RingBuffer::ignorereadpos [private] |
Definition at line 145 of file RingBuffer.h.
Referenced by ReadDirect(), ReadPriv(), run(), and Seek().
QReadWriteLock RingBuffer::rbrlock [mutable, private] |
Definition at line 146 of file RingBuffer.h.
Referenced by ReadBufAvail(), ReadBufFree(), ReadPriv(), ResetReadAhead(), run(), and Seek().
int RingBuffer::rbrpos [private] |
Definition at line 147 of file RingBuffer.h.
Referenced by ReadBufAvail(), ReadBufFree(), ReadPriv(), ResetReadAhead(), run(), and Seek().
QReadWriteLock RingBuffer::rbwlock [mutable, private] |
Definition at line 148 of file RingBuffer.h.
Referenced by ReadBufAvail(), ReadBufFree(), ResetReadAhead(), run(), and Seek().
int RingBuffer::rbwpos [private] |
Definition at line 149 of file RingBuffer.h.
Referenced by ReadBufAvail(), ReadBufFree(), ResetReadAhead(), run(), and Seek().
volatile bool RingBuffer::stopreads [private] |
Definition at line 153 of file RingBuffer.h.
Referenced by ReadPriv(), run(), safe_read(), StartReads(), StopReads(), WaitForAvail(), and WaitForReadsAllowed().
QReadWriteLock RingBuffer::rwlock [mutable, private] |
Definition at line 155 of file RingBuffer.h.
Referenced by GetFilename(), GetReadPosition(), GetRealFileSize(), GetSubtitleFilename(), IgnoreLiveEOF(), IsIOBound(), IsNearEnd(), IsOpen(), isPaused(), KillReadAheadThread(), LiveMode(), OpenFile(), Pause(), PauseAndWait(), ReadPriv(), Reset(), run(), Seek(), SetAdjustFilesize(), SetLiveMode(), SetOldFile(), SetStreamOnly(), SetWriteBufferMinWriteSize(), SetWriteBufferSize(), Start(), Sync(), Unpause(), UpdatePlaySpeed(), UpdateRawBitrate(), WaitForAvail(), WaitForPause(), WaitForReadsAllowed(), Write(), WriterFlush(), WriterSeek(), and ~RingBuffer().
QString RingBuffer::filename [private] |
Definition at line 157 of file RingBuffer.h.
Referenced by GetFilename(), GetRealFileSize(), OpenFile(), RingBuffer(), and Seek().
QString RingBuffer::subtitlefilename [private] |
ThreadedFileWriter* RingBuffer::tfw [private] |
Definition at line 160 of file RingBuffer.h.
Referenced by IsIOBound(), IsOpen(), RingBuffer(), SetWriteBufferMinWriteSize(), SetWriteBufferSize(), Sync(), Write(), WriterFlush(), WriterSeek(), and ~RingBuffer().
int RingBuffer::fd2 [private] |
Definition at line 161 of file RingBuffer.h.
Referenced by IsOpen(), OpenFile(), ReadDirect(), run(), safe_read(), Seek(), and ~RingBuffer().
bool RingBuffer::writemode [private] |
Definition at line 163 of file RingBuffer.h.
Referenced by ReadPriv(), RingBuffer(), Seek(), Start(), and Write().
RemoteFile* RingBuffer::remotefile [private] |
Definition at line 165 of file RingBuffer.h.
Referenced by GetRealFileSize(), IsOpen(), OpenFile(), ReadDirect(), RingBuffer(), run(), Seek(), Write(), and ~RingBuffer().
bool RingBuffer::startreadahead [private] |
char* RingBuffer::readAheadBuffer [private] |
bool RingBuffer::readaheadrunning [private] |
Definition at line 169 of file RingBuffer.h.
Referenced by isPaused(), KillReadAheadThread(), PauseAndWait(), ReadPriv(), run(), Seek(), Start(), WaitForAvail(), WaitForPause(), and WaitForReadsAllowed().
bool RingBuffer::reallyrunning [private] |
bool RingBuffer::request_pause [private] |
Definition at line 171 of file RingBuffer.h.
Referenced by Pause(), PauseAndWait(), ReadPriv(), run(), Unpause(), WaitForAvail(), WaitForPause(), and WaitForReadsAllowed().
bool RingBuffer::paused [private] |
Definition at line 172 of file RingBuffer.h.
Referenced by isPaused(), PauseAndWait(), and WaitForPause().
bool RingBuffer::ateof [private] |
Definition at line 173 of file RingBuffer.h.
Referenced by OpenFile(), ReadPriv(), ResetReadAhead(), run(), Seek(), and WaitForAvail().
bool RingBuffer::readsallowed [private] |
Definition at line 174 of file RingBuffer.h.
Referenced by CalcReadAheadThresh(), ResetReadAhead(), run(), Seek(), and WaitForReadsAllowed().
bool RingBuffer::setswitchtonext [private] |
Definition at line 175 of file RingBuffer.h.
Referenced by OpenFile(), Reset(), ResetReadAhead(), run(), and WaitForAvail().
bool RingBuffer::streamOnly [private] |
bool RingBuffer::ignorereadahead [private] |
Definition at line 177 of file RingBuffer.h.
uint RingBuffer::rawbitrate [private] |
Definition at line 178 of file RingBuffer.h.
Referenced by CalcReadAheadThresh(), IsNearEnd(), OpenFile(), and UpdateRawBitrate().
float RingBuffer::playspeed [private] |
Definition at line 179 of file RingBuffer.h.
Referenced by CalcReadAheadThresh(), IsNearEnd(), and UpdatePlaySpeed().
int RingBuffer::fill_threshold [private] |
int RingBuffer::fill_min [private] |
Definition at line 181 of file RingBuffer.h.
Referenced by CalcReadAheadThresh(), run(), and Seek().
int RingBuffer::readblocksize [private] |
Definition at line 182 of file RingBuffer.h.
Referenced by CalcReadAheadThresh(), IsNearEnd(), OpenFile(), run(), and Seek().
int RingBuffer::wanttoread [private] |
int RingBuffer::numfailures [private] |
Definition at line 184 of file RingBuffer.h.
Referenced by OpenFile(), Reset(), run(), and safe_read().
bool RingBuffer::commserror [private] |
Definition at line 185 of file RingBuffer.h.
Referenced by OpenFile(), ReadPriv(), Reset(), run(), WaitForAvail(), and WaitForReadsAllowed().
DVDRingBufferPriv* RingBuffer::dvdPriv [private] |
Definition at line 189 of file RingBuffer.h.
Referenced by GetReadPosition(), InDVDMenuOrStillFrame(), IsDVD(), IsOpen(), OpenFile(), ReadDirect(), run(), Seek(), and ~RingBuffer().
BDRingBufferPriv* RingBuffer::bdPriv [private] |
Definition at line 190 of file RingBuffer.h.
Referenced by GetReadPosition(), IsBD(), IsOpen(), OpenFile(), ReadDirect(), run(), Seek(), and ~RingBuffer().
bool RingBuffer::oldfile [private] |
Definition at line 192 of file RingBuffer.h.
Referenced by OpenFile(), safe_read(), and SetOldFile().
LiveTVChain* RingBuffer::livetvchain [private] |
Definition at line 194 of file RingBuffer.h.
Referenced by LiveMode(), run(), safe_read(), SetLiveMode(), and WaitForAvail().
bool RingBuffer::ignoreliveeof [private] |
long long RingBuffer::readAdjust [private] |
Definition at line 197 of file RingBuffer.h.
Referenced by Reset(), safe_read(), Seek(), and SetAdjustFilesize().
QWaitCondition RingBuffer::generalWait [private] |
Condition to signal that the read ahead thread is running.
Definition at line 206 of file RingBuffer.h.
Referenced by KillReadAheadThread(), PauseAndWait(), ReadPriv(), Reset(), ResetReadAhead(), run(), Seek(), Start(), StartReads(), StopReads(), Unpause(), WaitForAvail(), WaitForPause(), and WaitForReadsAllowed().
QMutex RingBuffer::subExtLock [static] |
Definition at line 209 of file RingBuffer.h.
Referenced by is_subtitle_possible(), local_sub_filename(), OpenFile(), and RingBuffer().
QStringList RingBuffer::subExt [static] |
Definition at line 210 of file RingBuffer.h.
Referenced by local_sub_filename(), OpenFile(), and RingBuffer().
QStringList RingBuffer::subExtNoCheck [static] |
Definition at line 211 of file RingBuffer.h.
Referenced by is_subtitle_possible(), and RingBuffer().
const uint RingBuffer::kBufferSize = 4 * 1024 * 1024 [static] |
Definition at line 215 of file RingBuffer.h.
Referenced by CalcReadAheadThresh(), ReadBufAvail(), ReadBufFree(), ReadPriv(), run(), and Seek().
const uint RingBuffer::kReadTestSize = PNG_MIN_SIZE [static] |
Definition at line 216 of file RingBuffer.h.
Referenced by MainServer::HandleAnnounce(), local_sub_filename(), and OpenFile().
1.5.5