Skip to content

Commit

Permalink
Merge pull request xbmc#24575 from ksooo/video-fix-multi-version-movi…
Browse files Browse the repository at this point in the history
…e-playback

[video] Fix multi version movie playback
  • Loading branch information
ksooo authored Jan 25, 2024
2 parents 06e2280 + 4d40b82 commit af41d9a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
26 changes: 16 additions & 10 deletions xbmc/video/ContextMenus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,33 +339,39 @@ void SetPathAndPlay(const std::shared_ptr<CFileItem>& item, PlayMode mode)
}
else
{
if (!item->m_bIsFolder && item->IsVideoDb())
const auto itemCopy{std::make_shared<CFileItem>(*item)};
if (itemCopy->IsVideoDb())
{
item->SetProperty("original_listitem_url", item->GetPath());
item->SetPath(item->GetVideoInfoTag()->m_strFileNameAndPath);
if (!itemCopy->m_bIsFolder)
{
itemCopy->SetProperty("original_listitem_url", item->GetPath());
itemCopy->SetPath(item->GetVideoInfoTag()->m_strFileNameAndPath);
}
else if (itemCopy->HasVideoInfoTag() && itemCopy->GetVideoInfoTag()->IsDefaultVideoVersion())
{
//! @todo get rid of "videos with versions as folder" hack!
itemCopy->m_bIsFolder = false;
}
}

if (mode == PlayMode::PLAY_VERSION_USING)
{
// force video version selection dialog
item->SetProperty("needs_resolved_video_version", true);
itemCopy->SetProperty("needs_resolved_video_version", true);
}
else
{
// play the given/default video version, if multiple versions are available
item->SetProperty("has_resolved_video_version", true);
itemCopy->SetProperty("has_resolved_video_version", true);
}

const bool choosePlayer{mode == PlayMode::PLAY_USING || mode == PlayMode::PLAY_VERSION_USING};
CVideoPlayActionProcessor proc{item, choosePlayer};
if (mode == PlayMode::RESUME && (item->GetStartOffset() == STARTOFFSET_RESUME ||
CVideoPlayActionProcessor proc{itemCopy, choosePlayer};
if (mode == PlayMode::RESUME && (itemCopy->GetStartOffset() == STARTOFFSET_RESUME ||
VIDEO_UTILS::GetItemResumeInformation(*item).isResumable))
proc.ProcessAction(VIDEO::GUILIB::ACTION_RESUME);
else // all other modes are actually PLAY
proc.ProcessAction(VIDEO::GUILIB::ACTION_PLAY_FROM_BEGINNING);

item->ClearProperty("needs_resolved_video_version");
item->ClearProperty("has_resolved_video_version");
}
}
} // unnamed namespace
Expand Down
4 changes: 3 additions & 1 deletion xbmc/video/windows/GUIWindowVideoBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,9 @@ void CGUIWindowVideoBase::LoadPlayList(const std::string& strPlayList,
bool CGUIWindowVideoBase::PlayItem(const std::shared_ptr<CFileItem>& pItem,
const std::string& player)
{
if (pItem->m_bIsFolder && !pItem->IsPlugin())
//! @todo get rid of "videos with versions as folder" hack!
if (pItem->m_bIsFolder && !pItem->IsPlugin() &&
!(pItem->HasVideoInfoTag() && pItem->GetVideoInfoTag()->IsDefaultVideoVersion()))
{
// take a copy so we can alter the queue state
const auto item{std::make_shared<CFileItem>(*pItem)};
Expand Down

0 comments on commit af41d9a

Please sign in to comment.