mpvpart: add isSeekable() check

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
feat/libmpv-backend
Mavridis Philippe 12 months ago
parent d1fbb0527a
commit 60d44437da
No known key found for this signature in database
GPG Key ID: 93F66F98F906147D

@ -392,12 +392,26 @@ bool MpvPart::isStream() {
return false;
}
bool MpvPart::isSeekable() {
if (!m_mpv) return false;
int result;
if (mpv_get_property(m_mpv, "seekable", MPV_FORMAT_FLAG, &result) < 0) {
return false;
}
return (bool)result;
}
void MpvPart::resetTime() {
m_playtime->setText("0:00:00");
m_position->setValue(0);
}
void MpvPart::slotStartSeeking() {
if (!isSeekable()) {
emit setStatusBarText( i18n("Cannot seek current file!") );
return;
}
m_seeking = true;
slotPause(true);
}

@ -69,6 +69,7 @@ class MpvPart : public KaffeinePart
bool isPaused();
bool isMute();
bool isStream();
bool isSeekable();
bool closeURL();
static TDEAboutData* createAboutData();

Loading…
Cancel
Save