Repository: xbmc/xbmc
File: xbmc/application/ApplicationPlay.cpp (C++)

Code before:
  {
    if (!ResolveStack())
      return false;

    m_player.clear();
    restart = true;
  }

  // Ensure the MIME type has been retrieved for http:// and shout:// streams
  if (m_item.GetMimeType().empty())
    m_item.FillInMimeType();

  if (VIDEO::IsDiscStub(m_item))
    return true;

  if (PLAYLIST::IsPlayList(m_item))
    return false;

  if (!ResolvePath())
    return false;

  m_options = {};
  GetOptionsAndUpdateItem(restart);

  if (const bool continuePlayback{GetPlaylistIfDisc()}; !continuePlayback)
    return false; // Playlist needed but none selected (ie. user cancelled) so abort playback

  DetermineFullScreen();

  // Stereo streams may have lower quality, i.e. 32bit vs 16 bit
  m_options.preferStereo =
      CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_videoPreferStereoStream &&
      CServiceBroker::GetActiveAE()->HasStereoAudioChannelCount();

  return true;
}


Review comment (suggestion):
Small issue which I think is related to the return value here.

In the original code in CApplication returned true here. I remember puzzling over this but it was needed.

I think it causes this issue - which is present with this PR, but not without.
1) Enable play next video automatically for episodes.
2) Play the first episode on a multi-episode bluray disc (which has not been played before - ie. playlists still need to be selected for episodes)
3) If you cancel the playlist selection dialog it will still prompt you for the next episodes - it shouldn't do (and doesn't without this PR)

OR

3) Select a playlist and play the first episode and then cancel at the next episode playlist selection dialog.
4) You will get the following toast error:
<img width="843" height="178" alt="Image" src="https://github.com/user-attachments/assets/37e0a6d8-4772-45d8-bef9-b34921a99e9c" />

I guess the quick fix would be to return an enum from GatherPlaybackDetails so CApplication can return either true or false at that point.

Probably the better fix would be to figure out why the Playlist player keeps going - but that might be beyond the remit of this PR.

Code after:
    if (!ResolveStack())
      return GatherPlaybackDetailsResult::RESULT_ERROR;

    m_player.clear();
    restart = true;
  }

  // Ensure the MIME type has been retrieved for http:// and shout:// streams
  if (m_item.GetMimeType().empty())
    m_item.FillInMimeType();

  if (VIDEO::IsDiscStub(m_item))
    return GatherPlaybackDetailsResult::RESULT_SUCCESS; // all done

  if (PLAYLIST::IsPlayList(m_item))
    return GatherPlaybackDetailsResult::RESULT_ERROR; // playlists not supported

  if (!ResolvePath())
    return GatherPlaybackDetailsResult::RESULT_ERROR;

  m_options = {};
  GetOptionsAndUpdateItem(restart);

  if (!GetPlaylistIfDisc())
    return GatherPlaybackDetailsResult::RESULT_NO_PLAYLIST_SELECTED;

  DetermineFullScreen();

  // Stereo streams may have lower quality, i.e. 32bit vs 16 bit
  m_options.preferStereo =
      CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_videoPreferStereoStream &&
      CServiceBroker::GetActiveAE()->HasStereoAudioChannelCount();

  return GatherPlaybackDetailsResult::RESULT_SUCCESS;
}