本文整理汇总了C++中CanSeek函数的典型用法代码示例。如果您正苦于以下问题:C++ CanSeek函数的具体用法?C++ CanSeek怎么用?C++ CanSeek使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CanSeek函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: SetPos
void Buffer::SetPos(int value) {
if ((value >= fileLen) && (stream != NULL) && !CanSeek()) {
// Wanted position is after buffer and the stream
// is not seek-able e.g. network or console,
// thus we have to read the stream manually till
// the wanted position is in sight.
while ((value >= fileLen) && (ReadNextStreamChunk() > 0));
}
if ((value < 0) || (value > fileLen)) {
wprintf(L"--- buffer out of bounds access, position: %d\n", value);
MX_DEBUG_BREAK;
exit(1);
}
if ((value >= bufStart) && (value < (bufStart + bufLen))) { // already in buffer
bufPos = value - bufStart;
} else if (stream != NULL) { // must be swapped in
fseek(stream, value, SEEK_SET);
bufLen = fread(buf, sizeof(unsigned char), bufCapacity, stream);
bufStart = value;
bufPos = 0;
} else {
bufPos = fileLen - bufStart; // make Pos return fileLen
}
}
开发者ID:S-V,项目名称:Lollipop,代码行数:26,代码来源:Scanner.cpp
示例2: Metadata
void MediaPlayer2Player::currentSourceChanged() const
{
QVariantMap properties;
properties["Metadata"] = Metadata();
properties["CanSeek"] = CanSeek();
Mpris2::signalPropertiesChange(this, properties);
}
开发者ID:KDE,项目名称:dragon,代码行数:7,代码来源:mediaplayer2player.cpp
示例3: Seek
void PAPlayer::Seek(bool bPlus, bool bLargeStep, bool bChapterOverride)
{
if (!CanSeek()) return;
__int64 seek;
if (g_advancedSettings.m_musicUseTimeSeeking && GetTotalTime() > 2 * g_advancedSettings.m_musicTimeSeekForwardBig)
{
if (bLargeStep)
seek = bPlus ? g_advancedSettings.m_musicTimeSeekForwardBig : g_advancedSettings.m_musicTimeSeekBackwardBig;
else
seek = bPlus ? g_advancedSettings.m_musicTimeSeekForward : g_advancedSettings.m_musicTimeSeekBackward;
seek *= 1000;
seek += GetTime();
}
else
{
float percent;
if (bLargeStep)
percent = bPlus ? (float)g_advancedSettings.m_musicPercentSeekForwardBig : (float)g_advancedSettings.m_musicPercentSeekBackwardBig;
else
percent = bPlus ? (float)g_advancedSettings.m_musicPercentSeekForward : (float)g_advancedSettings.m_musicPercentSeekBackward;
seek = (__int64)(GetTotalTime64() * (GetPercentage() + percent) / 100);
}
SeekTime(seek);
}
开发者ID:KeTao,项目名称:kodi-cmake,代码行数:26,代码来源:PAPlayer.cpp
示例4: LoopStatus
void Mpris::updateStatus()
{
QVariantMap map;
if (MPDStatus::self()->repeat()!=status.repeat) {
map.insert("LoopStatus", LoopStatus());
}
if (MPDStatus::self()->random()!=status.random) {
map.insert("Shuffle", Shuffle());
}
if (MPDStatus::self()->volume()!=status.volume) {
map.insert("Volume", Volume());
}
if (MPDStatus::self()->playlistLength()!=status.playlistLength) {
map.insert("CanGoNext", CanGoNext());
map.insert("CanGoPrevious", CanGoPrevious());
}
if (MPDStatus::self()->state()!=status.state) {
map.insert("PlaybackStatus", PlaybackStatus());
map.insert("CanPlay", CanPlay());
map.insert("CanPause", CanPause());
map.insert("CanSeek", CanSeek());
}
if (MPDStatus::self()->timeElapsed()!=status.timeElapsed) {
map.insert("Position", convertTime(MPDStatus::self()->timeElapsed()));
}
if (!map.isEmpty() || MPDStatus::self()->songId()!=status.songId) {
if (!map.contains("Position")) {
map.insert("Position", convertTime(MPDStatus::self()->timeElapsed()));
}
map.insert("Metadata", Metadata());
signalUpdate(map);
}
status=MPDStatus::self()->getValues();
}
开发者ID:edhelas,项目名称:cantata,代码行数:35,代码来源:mpris.cpp
示例5: Metadata
void MediaPlayer2Player::currentSourceChanged() const
{
QVariantMap properties;
properties["Metadata"] = Metadata();
properties["CanSeek"] = CanSeek();
properties["PlaybackStatus"] = PlaybackStatus();
signalPropertiesChange(properties);
}
开发者ID:mjs973b,项目名称:jukebox,代码行数:8,代码来源:mediaplayer2player.cpp
示例6: SeekTime
void PAPlayer::SeekTime(__int64 iTime /*=0*/)
{
if (!CanSeek()) return;
if (m_currentFile->m_lStartOffset)
iTime += m_currentFile->m_lStartOffset * 1000 / 75;
m_SeekTime = iTime;
CLog::Log(LOGDEBUG, "PAPlayer::Seeking to time %f", 0.001f * m_SeekTime);
}
开发者ID:Castlecard,项目名称:plex,代码行数:8,代码来源:paplayer_linux.cpp
示例7: SeekTime
void PAPlayer::SeekTime(__int64 iTime /*=0*/)
{
if (!CanSeek()) return;
int seekOffset = (int)(iTime - GetTime());
if (m_currentFile->m_lStartOffset)
iTime += m_currentFile->m_lStartOffset * 1000 / 75;
m_SeekTime = iTime;
m_callback.OnPlayBackSeek((int)m_SeekTime, seekOffset);
CLog::Log(LOGDEBUG, "PAPlayer::Seeking to time %f", 0.001f * m_SeekTime);
}
开发者ID:mbolhuis,项目名称:xbmc,代码行数:10,代码来源:PAPlayer.cpp
示例8: if
int Buffer::Read() {
if (bufPos < bufLen) {
return buf[bufPos++];
} else if (GetPos() < fileLen) {
SetPos(GetPos()); // shift buffer start to Pos
return buf[bufPos++];
} else if ((stream != NULL) && !CanSeek() && (ReadNextStreamChunk() > 0)) {
return buf[bufPos++];
} else {
return EoF;
}
}
开发者ID:bharcode,项目名称:nammaDB,代码行数:12,代码来源:Scanner.cpp
示例9: _setmode
Buffer::Buffer(FILE* s, bool isUserStream) {
// ensure binary read on windows
#if _MSC_VER >= 1300
_setmode(_fileno(s), _O_BINARY);
#endif
stream = s; this->isUserStream = isUserStream;
if (CanSeek()) {
fseek(s, 0, SEEK_END);
fileLen = ftell(s);
fseek(s, 0, SEEK_SET);
bufLen = (fileLen < MAX_BUFFER_LENGTH) ? fileLen : MAX_BUFFER_LENGTH;
bufStart = INT_MAX; // nothing in the buffer so far
} else {
fileLen = bufLen = bufStart = 0;
}
bufCapacity = (bufLen>0) ? bufLen : MIN_BUFFER_LENGTH;
buf = new unsigned char[bufCapacity];
if (fileLen > 0) SetPos(0); // setup buffer to position 0 (start)
else bufPos = 0; // index 0 is already after the file, thus Pos = 0 is invalid
if (bufLen == fileLen && CanSeek()) Close();
}
开发者ID:bharcode,项目名称:nammaDB,代码行数:21,代码来源:Scanner.cpp
示例10: CanSeek
int64_t CInputStreamPVRBase::Seek(int64_t offset, int whence)
{
if (whence == SEEK_POSSIBLE)
return CanSeek() ? 1 : 0;
int64_t ret = SeekPVRStream(offset, whence);
// if we succeed, we are not eof anymore
if (ret >= 0)
m_eof = false;
return ret;
}
开发者ID:BigNoid,项目名称:xbmc,代码行数:13,代码来源:InputStreamPVRBase.cpp
示例11: SeekTime
void PAPlayer::SeekTime(int64_t iTime /*=0*/)
{
if (!CanSeek()) return;
CSharedLock lock(m_streamsLock);
if (!m_currentStream)
return;
int seekOffset = (int)(iTime - GetTimeInternal());
if (m_playbackSpeed != 1)
ToFFRW(1);
m_currentStream->m_seekFrame = (int)((float)m_currentStream->m_sampleRate * ((float)iTime + (float)m_currentStream->m_startOffset) / 1000.0f);
m_callback.OnPlayBackSeek((int)iTime, seekOffset);
}
开发者ID:huigll,项目名称:xbmc,代码行数:16,代码来源:PAPlayer.cpp
示例12: GetInternal
void CApplicationPlayer::SetPlaySpeed(int iSpeed, bool bApplicationMuted)
{
boost::shared_ptr<IPlayer> player = GetInternal();
if (!player)
return;
if (!IsPlayingAudio() && !IsPlayingVideo())
return ;
if (m_iPlaySpeed == iSpeed)
return ;
if (!CanSeek())
return;
if (IsPaused())
{
if (
((m_iPlaySpeed > 1) && (iSpeed > m_iPlaySpeed)) ||
((m_iPlaySpeed < -1) && (iSpeed < m_iPlaySpeed))
)
{
iSpeed = m_iPlaySpeed; // from pause to ff/rw, do previous ff/rw speed
}
Pause();
}
m_iPlaySpeed = iSpeed;
ToFFRW(m_iPlaySpeed);
// if player has volume control, set it.
if (ControlsVolume())
{
if (m_iPlaySpeed == 1)
{ // restore volume
player->SetVolume(g_application.GetVolume(false));
}
else
{ // mute volume
player->SetVolume(VOLUME_MINIMUM);
}
player->SetMute(bApplicationMuted);
}
}
开发者ID:B0k0,项目名称:xbmc,代码行数:41,代码来源:ApplicationPlayer.cpp
示例13: Seek
size_t FileStream::Seek(StreamSeek seek, int pos)
{
if (!CanSeek())
{
return 0;
}
int stdclib_seek;
switch (seek)
{
case kSeekBegin: stdclib_seek = SEEK_SET; break;
case kSeekCurrent: stdclib_seek = SEEK_CUR; break;
case kSeekEnd: stdclib_seek = SEEK_END; break;
default:
// TODO: warning to the log
return 0;
}
fseek(_file, pos, stdclib_seek);
return GetPosition();
}
开发者ID:bitope,项目名称:ags,代码行数:21,代码来源:filestream.cpp
示例14: EmitPropertyChanged
void Mpris2::slotCurrentSourceChanged()
{
EmitPropertyChanged("Metadata", Metadata());
EmitPropertyChanged("CanSeek", CanSeek());
}
开发者ID:metalbrick,项目名称:kdoubanfm,代码行数:5,代码来源:mpris2.cpp
注:本文中的CanSeek函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论