Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复movie coredump #556

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/backends/mpv/mpv_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,7 @@ void MpvProxy::slotStateChanged()
void MpvProxy::refreshDecode()
{
QList<QString> canHwTypes;
if (dynamic_cast<PlayerEngine *>(m_pParentWidget)->getplaylist()->size() <= 0) return;
//bool bIsCanHwDec = HwdecProbe::get().isFileCanHwdec(_file.url(), canHwTypes);

if (DecodeMode::SOFTWARE == m_decodeMode) { //1.设置软解
Expand Down
4 changes: 2 additions & 2 deletions src/libdmr/player_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ void PlayerEngine::onSubtitlesDownloaded(const QUrl &url, const QList<QString> &
}
if (!_current) return;

if (playlist().currentInfo().url != url)
if (playlist().count() <= 0 || playlist().currentInfo().url != url)
return;

bool res = false;
Expand All @@ -318,7 +318,7 @@ void PlayerEngine::onSubtitlesDownloaded(const QUrl &url, const QList<QString> &

bool PlayerEngine::loadSubtitle(const QFileInfo &fi)
{
if (state() == CoreState::Idle) {
if (state() == CoreState::Idle || playlist().count() <= 0) {
return true;
}
if (!_current) return true;
Expand Down
12 changes: 7 additions & 5 deletions src/widgets/mircastwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,11 +500,13 @@ void MircastWidget::startDlnaTp(ItemWidget *item)
return;
} else {
dmr::PlayerEngine *pEngine = static_cast<dmr::PlayerEngine *>(m_pEngine);
if(pEngine && pEngine->playlist().currentInfo().url.isLocalFile()) {
m_dlnaContentServer->setDlnaFileName(pEngine->playlist().currentInfo().url.toLocalFile());
m_sLocalUrl = m_dlnaContentServer->getBaseUrl() + QFileInfo(pEngine->playlist().currentInfo().url.toLocalFile()).fileName().toLatin1();
} else {
m_sLocalUrl = pEngine->playlist().currentInfo().url.toString();
if(pEngine && pEngine->playlist().count() > 0) {
if(pEngine && pEngine->playlist().currentInfo().url.isLocalFile()) {
m_dlnaContentServer->setDlnaFileName(pEngine->playlist().currentInfo().url.toLocalFile());
m_sLocalUrl = m_dlnaContentServer->getBaseUrl() + QFileInfo(pEngine->playlist().currentInfo().url.toLocalFile()).fileName().toLatin1();
} else {
m_sLocalUrl = pEngine->playlist().currentInfo().url.toString();
}
}
m_isStartHttpServer = m_dlnaContentServer->getIsStartHttpServer();
}
Expand Down
26 changes: 15 additions & 11 deletions src/widgets/platform/platform_toolbox_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ void Platform_viewProgBarLoad::loadViewProgBar(QSize size)
int length = strlen(time.toString("hh:mm:ss").toLatin1().data());
memcpy(m_seekTime, time.toString("hh:mm:ss").toLatin1().data(), length + 1);
m_video_thumbnailer->seek_time = m_seekTime;

if(m_pEngine->playlist().count() <= 0 ) return;
auto url = m_pEngine->playlist().currentInfo().url;
auto file = QFileInfo(url.toLocalFile()).absoluteFilePath();

Expand Down Expand Up @@ -894,11 +894,13 @@ void Platform_ToolboxProxy::finishLoadSlot(QSize size)

if(CompositingManager::get().platform() == Platform::X86) {
if (m_pEngine->state() != PlayerEngine::CoreState::Idle) {
PlayItemInfo info = m_pEngine->playlist().currentInfo();
if (!info.url.isLocalFile()) {
return;
if(m_pEngine->playlist().count() > 0) {
PlayItemInfo info = m_pEngine->playlist().currentInfo();
if (!info.url.isLocalFile()) {
return;
}
m_pProgBar_Widget->setCurrentIndex(2);
}
m_pProgBar_Widget->setCurrentIndex(2);
}
}
}
Expand Down Expand Up @@ -1418,7 +1420,7 @@ void Platform_ToolboxProxy::updateHoverPreview(const QUrl &url, int secs)
if (m_pEngine->state() == PlayerEngine::CoreState::Idle)
return;

if (m_pEngine->playlist().currentInfo().url != url)
if (m_pEngine->playlist().count() <= 0 || m_pEngine->playlist().currentInfo().url != url)
return;

if (!Settings::get().isSet(Settings::PreviewOnMouseover))
Expand Down Expand Up @@ -1569,7 +1571,9 @@ void Platform_ToolboxProxy::slotThemeTypeChanged()
}

if(m_pEngine->state() != PlayerEngine::CoreState::Idle) {
bRawFormat = m_pEngine->getplaylist()->currentInfo().mi.isRawFormat();
if(m_pEngine->getplaylist()->count() > 0) {
bRawFormat = m_pEngine->getplaylist()->currentInfo().mi.isRawFormat();
}
if(bRawFormat && !m_pEngine->currFileIsAudio()) {
m_pTimeLabel->setPalette(textPalette);
m_pTimeLabelend->setPalette(textPalette);
Expand Down Expand Up @@ -1691,7 +1695,7 @@ void Platform_ToolboxProxy::slotFileLoaded()
}
}
}
if(isAllAudio) {
if(isAllAudio || m_pEngine->getplaylist()->count() <= 0) {
m_pMainWindow->slotExitMircast();
return;
}
Expand Down Expand Up @@ -1798,7 +1802,7 @@ void Platform_ToolboxProxy::slotPlayListStateChange(bool isShortcut)
void Platform_ToolboxProxy::slotUpdateThumbnailTimeOut()
{
//如果视频长度小于1s应该直接返回不然会UI错误
if (m_pEngine->playlist().currentInfo().mi.duration < 1) {
if (m_pEngine->getplaylist()->count() <= 0 || m_pEngine->playlist().currentInfo().mi.duration < 1) {
return;
}

Expand Down Expand Up @@ -1947,7 +1951,7 @@ void Platform_ToolboxProxy::progressHoverChanged(int nValue)
if (m_pEngine->state() == PlayerEngine::CoreState::Idle)
return;

if (m_pVolSlider->isVisible())
if (m_pVolSlider->isVisible() || m_pEngine->getplaylist()->count() <= 0)
return;

const auto &pif = m_pEngine->playlist().currentInfo();
Expand Down Expand Up @@ -2055,7 +2059,7 @@ void Platform_ToolboxProxy::updateButtonStates()
palette.setColor(QPalette::Text, QColor(255, 255, 255, 40));
}

if(m_pEngine->state() != PlayerEngine::CoreState::Idle) {
if(m_pEngine->state() != PlayerEngine::CoreState::Idle && m_pEngine->getplaylist()->count() > 0) {
bRawFormat = m_pEngine->getplaylist()->currentInfo().mi.isRawFormat();
m_pMircastBtn->setEnabled(!m_pEngine->currFileIsAudio());
if(m_pEngine->currFileIsAudio())
Expand Down
17 changes: 10 additions & 7 deletions src/widgets/toolbox_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -995,11 +995,13 @@ void ToolboxProxy::finishLoadSlot(QSize size)

if(CompositingManager::get().platform() == Platform::X86) {
if (m_pEngine->state() != PlayerEngine::CoreState::Idle) {
PlayItemInfo info = m_pEngine->playlist().currentInfo();
if (!info.url.isLocalFile()) {
return;
if(m_pEngine->playlist().count() > 0) {
PlayItemInfo info = m_pEngine->playlist().currentInfo();
if (!info.url.isLocalFile()) {
return;
}
m_pProgBar_Widget->setCurrentIndex(2);
}
m_pProgBar_Widget->setCurrentIndex(2);
}
}
}
Expand Down Expand Up @@ -1544,7 +1546,7 @@ void ToolboxProxy::updateHoverPreview(const QUrl &url, int secs)
if (m_pEngine->state() == PlayerEngine::CoreState::Idle)
return;

if (m_pEngine->playlist().currentInfo().url != url)
if (m_pEngine->playlist().count() <= 0 || m_pEngine->playlist().currentInfo().url != url)
return;

if (!Settings::get().isSet(Settings::PreviewOnMouseover))
Expand Down Expand Up @@ -1823,6 +1825,7 @@ void ToolboxProxy::slotFileLoaded()
m_pMainWindow->slotExitMircast();
return;
}
if(m_pEngine->getplaylist()->count() <= 0) return;
QString sCurPath = m_pEngine->getplaylist()->currentInfo().mi.filePath;
int nIndex = -1;
for(int i = 0; i < lstItemInfo.count(); i++) {
Expand Down Expand Up @@ -2119,7 +2122,7 @@ void ToolboxProxy::progressHoverChanged(int nValue)
if (m_pEngine->state() == PlayerEngine::CoreState::Idle)
return;

if (m_pVolSlider->isVisible())
if (m_pEngine->getplaylist()->count() <= 0 || m_pVolSlider->isVisible())
return;

const auto &pif = m_pEngine->playlist().currentInfo();
Expand Down Expand Up @@ -2228,7 +2231,7 @@ void ToolboxProxy::updateButtonStates()
palette.setColor(QPalette::Text, QColor(255, 255, 255, 40));
}

if(m_pEngine->state() != PlayerEngine::CoreState::Idle) {
if(m_pEngine->state() != PlayerEngine::CoreState::Idle && m_pEngine->getplaylist()->count() > 0) {
bRawFormat = m_pEngine->getplaylist()->currentInfo().mi.isRawFormat();
m_pMircastBtn->setEnabled(!m_pEngine->currFileIsAudio());
if(m_pEngine->currFileIsAudio())
Expand Down
Loading