void TFile::SetLength(size_t szNewLength, bool bRetainOldOffset) { DEBUG_VERIFY_ALLOCATION; DEBUG_VERIFY(IsOpen()); if(!(m_flOpenFlags & FOF_RESIZE)) INITIATE_FAILURE; if(bRetainOldOffset) { size_t szCurOffset = InternalTell(); SetFilePointer(m_hFile, szNewLength, NULL, FILE_BEGIN); // ... (no error check-up) if(!SetEndOfFile(m_hFile)) throw 1; InternalSeek(szCurOffset); } else { if(!(m_flOpenFlags & FOF_SEEK)) throw 1; SetFilePointer(m_hFile, szNewLength, NULL, FILE_BEGIN); // ... (no error check-up) if(!SetEndOfFile(m_hFile)) throw 1; } m_FilePos.m_szLength = szNewLength; }
void TFile::Seek(int iOffset, TFileSeekMode Mode) { DEBUG_VERIFY_ALLOCATION; DEBUG_VERIFY(IsOpen()); if(!(m_flOpenFlags & FOF_SEEK)) INITIATE_FAILURE; InternalSeek(iOffset, Mode); }
bool BaseInFileStream::SignalSeek(double &absoluteTimestamp) { //1. Seek to the correct point if (!InternalSeek(absoluteTimestamp)) { FATAL("Unable to seek to %.02f", absoluteTimestamp); return false; } //2. If the stream is active, re-initiate the feed reaction if (!_paused) ReadyForSend(); //3. Done return true; }
bool BaseInFileStream::SignalSeek(double &absoluteTimestamp) { //1. Seek to the correct point if (!InternalSeek(absoluteTimestamp)) { FATAL("Unable to seek to %.02f", absoluteTimestamp); return false; } //2. If the stream is active, re-initiate the feed reaction if (_streamingState == FILE_STREAMING_STATE_FINISHED) { _streamingState = FILE_STREAMING_STATE_PLAYING; ReadyForSend(); } //3. Done return true; }
bool BaseInFileStream::SignalPlay(double &absoluteTimestamp, double &length) { //0. fix absoluteTimestamp and length absoluteTimestamp = absoluteTimestamp < 0 ? 0 : absoluteTimestamp; //TODO: implement the limit playback //1. Seek to the correct point if (!InternalSeek(absoluteTimestamp)) { FATAL("Unable to seek to %.02f", absoluteTimestamp); return false; } //2. Put the stream in active mode _paused = false; //3. Start the feed reaction ReadyForSend(); //4. Done return true; }
bool BaseInFileStream::SignalPlay(double &absoluteTimestamp, double &length) { INFO("signal play"); //0. fix absoluteTimestamp and length absoluteTimestamp = absoluteTimestamp < 0 ? 0 : absoluteTimestamp; _playLimit = length; FINEST("absoluteTimestamp: %.2f; _playLimit: %.2f", absoluteTimestamp, _playLimit); //TODO: implement the limit playback //1. Seek to the correct point if (!InternalSeek(absoluteTimestamp)) { FATAL("Unable to seek to %.02f", absoluteTimestamp); return false; } //2. Put the stream in active mode _streamingState = FILE_STREAMING_STATE_PLAYING; //3. Start the feed reaction ReadyForSend(); //4. Done return true; }