aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbmc/PlayListPlayer.cpp30
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon_base.h4
-rw-r--r--xbmc/interfaces/builtins/PlayerBuiltins.cpp7
-rw-r--r--xbmc/music/windows/GUIWindowMusicBase.cpp2
-rw-r--r--xbmc/video/windows/GUIWindowVideoBase.cpp2
-rw-r--r--xbmc/windowing/wayland/Connection.cpp19
-rw-r--r--xbmc/windowing/wayland/Connection.h1
-rw-r--r--xbmc/windowing/wayland/WinSystemWayland.cpp7
8 files changed, 54 insertions, 18 deletions
diff --git a/xbmc/PlayListPlayer.cpp b/xbmc/PlayListPlayer.cpp
index b73cd665e0..b86e1cfbdf 100644
--- a/xbmc/PlayListPlayer.cpp
+++ b/xbmc/PlayListPlayer.cpp
@@ -263,21 +263,31 @@ bool CPlayListPlayer::Play(const CFileItemPtr& pItem, const std::string& player)
Id playlistId;
bool isVideo{pItem->IsVideo()};
bool isAudio{pItem->IsAudio()};
- if (isVideo && isAudio && pItem->HasProperty("playlist_type_hint"))
+
+ if (isAudio && !isVideo)
+ playlistId = TYPE_MUSIC;
+ else if (isVideo && !isAudio)
+ playlistId = TYPE_VIDEO;
+ else if (pItem->HasProperty("playlist_type_hint"))
{
- // If an extension is set in both audio / video lists (e.g. playlist .strm),
- // is not possible detect the type of playlist then we rely on the hint
+ // There are two main cases that can fall here:
+ // - If an extension is set on both audio / video extension lists example .strm
+ // see GetFileExtensionProvider() -> GetVideoExtensions() / GetAudioExtensions()
+ // When you play the .strm containing single path, cause that
+ // IsVideo() and IsAudio() methods both return true
+ //
+ // - When you play a playlist (e.g. .m3u / .strm) containing multiple paths,
+ // and the path played is generic (e.g.without extension) and have no properties
+ // to detect the media type, IsVideo() / IsAudio() both return false
+ //
+ // for these cases the type is unknown so we rely on the hint
playlistId = pItem->GetProperty("playlist_type_hint").asInteger32(TYPE_NONE);
}
- else if (isAudio)
- playlistId = TYPE_MUSIC;
- else if (isVideo)
- playlistId = TYPE_VIDEO;
else
{
- CLog::Log(
- LOGWARNING,
- "Playlist Player: ListItem type must be audio or video, use ListItem::setInfo to specify!");
+ CLog::LogF(LOGWARNING, "ListItem type must be audio or video type. The type can be specified "
+ "by using ListItem::getVideoInfoTag or ListItem::getMusicInfoTag, in "
+ "the case of playlist entries by adding #KODIPROP mimetype value.");
return false;
}
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon_base.h b/xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon_base.h
index 481f53d3d0..89403a3683 100644
--- a/xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon_base.h
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon_base.h
@@ -251,7 +251,7 @@ extern "C"
typedef int KODI_ADDON_INSTANCE_TYPE;
- struct KODI_ADDON_INSTANCE_INFO
+ typedef struct KODI_ADDON_INSTANCE_INFO
{
KODI_ADDON_INSTANCE_TYPE type;
uint32_t number;
@@ -262,7 +262,7 @@ extern "C"
bool first_instance;
struct KODI_ADDON_INSTANCE_FUNC_CB* functions;
- };
+ } KODI_ADDON_INSTANCE_INFO;
typedef struct KODI_ADDON_INSTANCE_STRUCT
{
diff --git a/xbmc/interfaces/builtins/PlayerBuiltins.cpp b/xbmc/interfaces/builtins/PlayerBuiltins.cpp
index 8620d988b2..ca69d69ea1 100644
--- a/xbmc/interfaces/builtins/PlayerBuiltins.cpp
+++ b/xbmc/interfaces/builtins/PlayerBuiltins.cpp
@@ -597,9 +597,16 @@ int PlayOrQueueMedia(const std::vector<std::string>& params, bool forcePlay)
}
if ((item.IsAudio() || item.IsVideo()) && !item.IsSmartPlayList())
+ {
+ if (!item.HasProperty("playlist_type_hint"))
+ item.SetProperty("playlist_type_hint", PLAYLIST::TYPE_MUSIC);
+
CServiceBroker::GetPlaylistPlayer().Play(std::make_shared<CFileItem>(item), "");
+ }
else
+ {
g_application.PlayMedia(item, "", PLAYLIST::TYPE_NONE);
+ }
}
return 0;
diff --git a/xbmc/music/windows/GUIWindowMusicBase.cpp b/xbmc/music/windows/GUIWindowMusicBase.cpp
index 49fa03a8c9..df45141c9b 100644
--- a/xbmc/music/windows/GUIWindowMusicBase.cpp
+++ b/xbmc/music/windows/GUIWindowMusicBase.cpp
@@ -741,7 +741,7 @@ bool CGUIWindowMusicBase::OnPlayMedia(int iItem, const std::string &player)
OnQueueItem(iItem);
return true;
}
- pItem->SetProperty("playlist_type_hint", PLAYLIST::TYPE_MUSIC);
+ pItem->SetProperty("playlist_type_hint", m_guiState->GetPlaylist());
CServiceBroker::GetPlaylistPlayer().Play(pItem, player);
return true;
}
diff --git a/xbmc/video/windows/GUIWindowVideoBase.cpp b/xbmc/video/windows/GUIWindowVideoBase.cpp
index bc3e7c58ef..161dec7f12 100644
--- a/xbmc/video/windows/GUIWindowVideoBase.cpp
+++ b/xbmc/video/windows/GUIWindowVideoBase.cpp
@@ -1005,7 +1005,7 @@ bool CGUIWindowVideoBase::OnPlayMedia(int iItem, const std::string &player)
}
CLog::Log(LOGDEBUG, "{} {}", __FUNCTION__, CURL::GetRedacted(item.GetPath()));
- item.SetProperty("playlist_type_hint", PLAYLIST::TYPE_VIDEO);
+ item.SetProperty("playlist_type_hint", m_guiState->GetPlaylist());
PlayMovie(&item, player);
diff --git a/xbmc/windowing/wayland/Connection.cpp b/xbmc/windowing/wayland/Connection.cpp
index 45d2fcdf72..9d45be63b6 100644
--- a/xbmc/windowing/wayland/Connection.cpp
+++ b/xbmc/windowing/wayland/Connection.cpp
@@ -8,17 +8,32 @@
#include "Connection.h"
+#include "utils/log.h"
+
#include <cassert>
+#include <stdexcept>
using namespace KODI::WINDOWING::WAYLAND;
CConnection::CConnection()
{
- m_display.reset(new wayland::display_t);
+ try
+ {
+ m_display = std::make_unique<wayland::display_t>();
+ }
+ catch (const std::exception& err)
+ {
+ CLog::Log(LOGERROR, "Wayland connection error: {}", err.what());
+ }
+}
+
+bool CConnection::HasDisplay() const
+{
+ return static_cast<bool>(m_display);
}
wayland::display_t& CConnection::GetDisplay()
{
assert(m_display);
return *m_display;
-} \ No newline at end of file
+}
diff --git a/xbmc/windowing/wayland/Connection.h b/xbmc/windowing/wayland/Connection.h
index 33469bfe9a..b1badd4249 100644
--- a/xbmc/windowing/wayland/Connection.h
+++ b/xbmc/windowing/wayland/Connection.h
@@ -27,6 +27,7 @@ class CConnection
public:
CConnection();
+ bool HasDisplay() const;
wayland::display_t& GetDisplay();
private:
diff --git a/xbmc/windowing/wayland/WinSystemWayland.cpp b/xbmc/windowing/wayland/WinSystemWayland.cpp
index 9ea0c8fb12..9733339ad8 100644
--- a/xbmc/windowing/wayland/WinSystemWayland.cpp
+++ b/xbmc/windowing/wayland/WinSystemWayland.cpp
@@ -158,11 +158,14 @@ bool CWinSystemWayland::InitWindowSystem()
wayland::set_log_handler([](const std::string& message)
{ CLog::Log(LOGWARNING, "wayland-client log message: {}", message); });
+ CLog::LogF(LOGINFO, "Connecting to Wayland server");
+ m_connection = std::make_unique<CConnection>();
+ if (!m_connection->HasDisplay())
+ return false;
+
VIDEOPLAYER::CProcessInfoWayland::Register();
RETRO::CRPProcessInfoWayland::Register();
- CLog::LogF(LOGINFO, "Connecting to Wayland server");
- m_connection.reset(new CConnection);
m_registry.reset(new CRegistry{*m_connection});
m_registry->RequestSingleton(m_compositor, 1, 4);