aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthe-black-eagle <g.moore@gmx.co.uk>2021-06-30 12:58:06 +0100
committerthe-black-eagle <g.moore@gmx.co.uk>2022-01-08 12:19:18 +0000
commita49156bf13ff8a33146b4e79c8f2f52b47b28be3 (patch)
treef1359f53ca7335f7769f66adbd1b023ab4468806
parent2e6a1045519ed5cb8087558c58b68f691540261c (diff)
[VIDEO] Add, store and process HDR type flags
-rw-r--r--addons/resource.language.en_gb/resources/strings.po8
-rw-r--r--xbmc/GUIInfoManager.cpp16
-rw-r--r--xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemux.h1
-rw-r--r--xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp23
-rw-r--r--xbmc/cores/VideoPlayer/DVDFileInfo.cpp1
-rw-r--r--xbmc/cores/VideoPlayer/Interface/StreamInfo.h9
-rw-r--r--xbmc/cores/VideoPlayer/VideoPlayer.cpp2
-rw-r--r--xbmc/cores/VideoPlayer/VideoPlayer.h1
-rw-r--r--xbmc/guilib/guiinfo/GUIInfoLabels.h2
-rw-r--r--xbmc/guilib/guiinfo/VideoGUIInfo.cpp6
-rw-r--r--xbmc/interfaces/json-rpc/schema/version.txt2
-rw-r--r--xbmc/playlists/SmartPlayList.cpp4
-rw-r--r--xbmc/utils/DatabaseUtils.h1
-rw-r--r--xbmc/utils/StreamDetails.cpp33
-rw-r--r--xbmc/utils/StreamDetails.h4
-rw-r--r--xbmc/video/VideoDatabase.cpp18
-rw-r--r--xbmc/video/VideoInfoTag.cpp4
17 files changed, 124 insertions, 11 deletions
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po
index ce040da7e0..72b0062f4b 100644
--- a/addons/resource.language.en_gb/resources/strings.po
+++ b/addons/resource.language.en_gb/resources/strings.po
@@ -13796,7 +13796,13 @@ msgctxt "#20473"
msgid "Premiered"
msgstr ""
-#empty strings from id 20474 to 21329
+#. Used in smart playlists to select items based on the HDR type (HDR10, HLG, Dolbyvision)
+#: xbmc/playlists/SmartPlayList.cpp
+msgctxt "#20474"
+msgid "HDR type"
+msgstr ""
+
+#empty strings from id 20475 to 21329
#up to 21329 is reserved for the video db !! !
#: system/settings/settings.xml
diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp
index 40845c49a5..a7d16c72fa 100644
--- a/xbmc/GUIInfoManager.cpp
+++ b/xbmc/GUIInfoManager.cpp
@@ -3759,6 +3759,13 @@ const infomap musicplayer[] = {{ "title", MUSICPLAYER_TITLE },
/// @skinning_v20 **[New Infolabel]** \link VideoPlayer_AudioStreamCount `VideoPlayer.AudioStreamCount`\endlink
/// <p>
/// }
+///   \table_row3{   <b>`VideoPlayer.HdrType`</b>,
+///                  \anchor VideoPlayer_HdrType
+///                  _string_,
+///     @return String containing the name of the detected HDR type or empty if not HDR. See \ref StreamHdrType for the list of possible values.
+///     <p><hr>
+///     @skinning_v20 **[New Infolabel]** \link ListItem_HdrType `ListItem.HdrType`\endlink
+///   }
/// \table_end
///
/// -----------------------------------------------------------------------------
@@ -3832,6 +3839,7 @@ const infomap videoplayer[] = {{ "title", VIDEOPLAYER_TITLE },
{ "uniqueid", VIDEOPLAYER_UNIQUEID },
{ "tvshowdbid", VIDEOPLAYER_TVSHOWDBID },
{ "audiostreamcount", VIDEOPLAYER_AUDIOSTREAMCOUNT },
+ { "hdrtype", VIDEOPLAYER_HDR_TYPE },
};
/// \page modules__infolabels_boolean_conditions
@@ -6700,6 +6708,13 @@ const infomap container_str[] = {{ "property", CONTAINER_PROPERTY },
/// <p><hr>
/// @skinning_v19 **[New Infolabel]** \link ListItem_AlbumStatus `ListItem.AlbumStatus`\endlink
/// }
+///   \table_row3{   <b>`ListItem.HdrType`</b>,
+///                  \anchor ListItem_HdrType
+///                  _string_,
+///     @return String containing the name of the detected HDR type or empty if not HDR. See \ref StreamHdrType for the list of possible values.
+///     <p><hr>
+///     @skinning_v20 **[New Infolabel]** \link ListItem_HdrType `ListItem.HdrType`\endlink
+///   }
/// \table_end
///
/// -----------------------------------------------------------------------------
@@ -6911,6 +6926,7 @@ const infomap listitem_labels[]= {{ "thumb", LISTITEM_THUMB },
{ "tvshowdbid", LISTITEM_TVSHOWDBID },
{ "albumstatus", LISTITEM_ALBUMSTATUS },
{ "isautoupdateable", LISTITEM_ISAUTOUPDATEABLE },
+ { "hdrtype", LISTITEM_VIDEO_HDR_TYPE },
};
/// \page modules__infolabels_boolean_conditions
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemux.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemux.h
index 04c0adb62c..031b2cfe35 100644
--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemux.h
+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemux.h
@@ -148,6 +148,7 @@ public:
std::shared_ptr<AVContentLightMetadata> contentLightMetaData;
std::string stereo_mode; // expected stereo mode
+ StreamHdrType hdr_type = StreamHdrType::HDR_TYPE_NONE; // type of HDR for this stream (hdr10, etc)
};
class CDemuxStreamAudio : public CDemuxStream
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
index d1c3b14b89..c9dc971f69 100644
--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
@@ -511,13 +511,17 @@ bool CDVDDemuxFFmpeg::Open(const std::shared_ptr<CDVDInputStream>& pInput, bool
bool skipCreateStreams = false;
bool isBluray = pInput->IsStreamType(DVDSTREAM_TYPE_BLURAY);
- if (iformat && (strcmp(iformat->name, "mpegts") == 0) && !fileinfo && !isBluray)
+ // don't re-open mpegts streams with hevc encoding as the params are not correctly detected again
+ if (iformat && (strcmp(iformat->name, "mpegts") == 0) && !fileinfo && !isBluray &&
+ m_pFormatContext->streams[0]->codecpar->codec_id != AV_CODEC_ID_HEVC)
{
av_opt_set_int(m_pFormatContext, "analyzeduration", 500000, 0);
m_checkTransportStream = true;
skipCreateStreams = true;
}
- else if (!iformat || (strcmp(iformat->name, "mpegts") != 0))
+ else if (!iformat || ((strcmp(iformat->name, "mpegts") != 0) ||
+ ((strcmp(iformat->name, "mpegts") == 0) &&
+ m_pFormatContext->streams[0]->codecpar->codec_id == AV_CODEC_ID_HEVC)))
{
m_streaminfo = true;
}
@@ -1643,11 +1647,26 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx)
int size = 0;
uint8_t* side_data = nullptr;
+ side_data = av_stream_get_side_data(pStream, AV_PKT_DATA_DOVI_CONF, &size);
+ if (side_data && size)
+ st->hdr_type = StreamHdrType::HDR_TYPE_DOLBYVISION;
+ else if (st->colorPrimaries == AVCOL_PRI_BT2020)
+ {
+ if (st->colorTransferCharacteristic == AVCOL_TRC_SMPTE2084) // hdr10
+ st->hdr_type = StreamHdrType::HDR_TYPE_HDR10;
+ else if (st->colorTransferCharacteristic == AVCOL_TRC_ARIB_STD_B67) // hlg
+ st->hdr_type = StreamHdrType::HDR_TYPE_HLG;
+ }
+
side_data = av_stream_get_side_data(pStream, AV_PKT_DATA_MASTERING_DISPLAY_METADATA, &size);
if (side_data && size)
{
st->masteringMetaData = std::make_shared<AVMasteringDisplayMetadata>(
*reinterpret_cast<AVMasteringDisplayMetadata*>(side_data));
+ // file could be SMPTE2086 which FFmpeg currently returns as unknown so use the presence
+ // of static metadata to detect it
+ if (st->masteringMetaData->has_primaries && st->masteringMetaData->has_luminance)
+ st->hdr_type = StreamHdrType::HDR_TYPE_HDR10;
}
side_data = av_stream_get_side_data(pStream, AV_PKT_DATA_CONTENT_LIGHT_LEVEL, &size);
diff --git a/xbmc/cores/VideoPlayer/DVDFileInfo.cpp b/xbmc/cores/VideoPlayer/DVDFileInfo.cpp
index cfe28c7728..6e8f673298 100644
--- a/xbmc/cores/VideoPlayer/DVDFileInfo.cpp
+++ b/xbmc/cores/VideoPlayer/DVDFileInfo.cpp
@@ -396,6 +396,7 @@ bool CDVDFileInfo::DemuxerToStreamDetails(const std::shared_ptr<CDVDInputStream>
p->m_iDuration = pDemux->GetStreamLength();
p->m_strStereoMode = vstream->stereo_mode;
p->m_strLanguage = vstream->language;
+ p->m_strHdrType = CStreamDetails::HdrTypeToString(vstream->hdr_type);
// stack handling
if (URIUtils::IsStack(path))
diff --git a/xbmc/cores/VideoPlayer/Interface/StreamInfo.h b/xbmc/cores/VideoPlayer/Interface/StreamInfo.h
index 3ebefb4615..a7a935ac21 100644
--- a/xbmc/cores/VideoPlayer/Interface/StreamInfo.h
+++ b/xbmc/cores/VideoPlayer/Interface/StreamInfo.h
@@ -30,6 +30,14 @@ enum StreamFlags
FLAG_STILL_IMAGES = 0x100000
};
+enum class StreamHdrType
+{
+ HDR_TYPE_NONE, /// < will return an empty string
+ HDR_TYPE_HDR10, /// < returns "hdr10" when converted to a string
+ HDR_TYPE_DOLBYVISION, /// < returns "dolbyvision"
+ HDR_TYPE_HLG /// < returns "hlg"
+};
+
struct StreamInfo
{
bool valid = false;
@@ -64,6 +72,7 @@ struct VideoStreamInfo : StreamInfo
CRect VideoRect;
std::string stereoMode;
int angles = 0;
+ StreamHdrType hdrType = StreamHdrType::HDR_TYPE_NONE;
};
struct ProgramInfo
diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp
index 217d0290a9..6f8e7c9431 100644
--- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp
+++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp
@@ -523,6 +523,7 @@ void CSelectionStreams::Update(const std::shared_ptr<CDVDInputStream>& input,
s.aspect_ratio = vstream->fAspect;
s.stereo_mode = vstream->stereo_mode;
s.bitrate = vstream->iBitRate;
+ s.hdrType = vstream->hdr_type;
}
if(stream->type == STREAM_AUDIO)
{
@@ -5122,6 +5123,7 @@ void CVideoPlayer::GetVideoStreamInfo(int streamId, VideoStreamInfo &info)
info.videoAspectRatio = s.aspect_ratio;
info.stereoMode = s.stereo_mode;
info.flags = s.flags;
+ info.hdrType = s.hdrType;
}
int CVideoPlayer::GetVideoStreamCount() const
diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.h b/xbmc/cores/VideoPlayer/VideoPlayer.h
index f470b9c38d..46dfa33622 100644
--- a/xbmc/cores/VideoPlayer/VideoPlayer.h
+++ b/xbmc/cores/VideoPlayer/VideoPlayer.h
@@ -196,6 +196,7 @@ struct SelectionStream
CRect VideoRect;
std::string stereo_mode;
float aspect_ratio = 0.0f;
+ StreamHdrType hdrType = StreamHdrType::HDR_TYPE_NONE;
};
class CSelectionStreams
diff --git a/xbmc/guilib/guiinfo/GUIInfoLabels.h b/xbmc/guilib/guiinfo/GUIInfoLabels.h
index f1d61bc172..98b6fa2756 100644
--- a/xbmc/guilib/guiinfo/GUIInfoLabels.h
+++ b/xbmc/guilib/guiinfo/GUIInfoLabels.h
@@ -253,6 +253,7 @@
#define VIDEOPLAYER_USER_RATING 277
#define VIDEOPLAYER_DBID 278
#define VIDEOPLAYER_TVSHOWDBID 279
+#define VIDEOPLAYER_HDR_TYPE 280
// Range of videoplayer infolabels that work with offset and position
#define VIDEOPLAYER_OFFSET_POSITION_FIRST VIDEOPLAYER_TITLE
@@ -948,6 +949,7 @@
#define LISTITEM_TVSHOWDBID (LISTITEM_START + 205)
#define LISTITEM_ALBUMSTATUS (LISTITEM_START + 206)
#define LISTITEM_ISAUTOUPDATEABLE (LISTITEM_START + 207)
+#define LISTITEM_VIDEO_HDR_TYPE (LISTITEM_START + 208)
#define LISTITEM_END (LISTITEM_START + 2500)
diff --git a/xbmc/guilib/guiinfo/VideoGUIInfo.cpp b/xbmc/guilib/guiinfo/VideoGUIInfo.cpp
index 55cbf18d3f..e0ffd02fee 100644
--- a/xbmc/guilib/guiinfo/VideoGUIInfo.cpp
+++ b/xbmc/guilib/guiinfo/VideoGUIInfo.cpp
@@ -492,6 +492,9 @@ bool CVideoGUIInfo::GetLabel(std::string& value, const CFileItem *item, int cont
value = CURL(value).GetWithoutUserDetails();
return true;
+ case LISTITEM_VIDEO_HDR_TYPE:
+ value = tag->m_streamDetails.GetVideoHdrType();
+ return true;
}
}
@@ -553,6 +556,9 @@ bool CVideoGUIInfo::GetLabel(std::string& value, const CFileItem *item, int cont
case VIDEOPLAYER_VIDEO_RESOLUTION:
value = CStreamDetails::VideoDimsToResolutionDescription(m_videoInfo.width, m_videoInfo.height);
return true;
+ case VIDEOPLAYER_HDR_TYPE:
+ value = CStreamDetails::HdrTypeToString(m_videoInfo.hdrType);
+ return true;
case VIDEOPLAYER_AUDIO_CODEC:
value = m_audioInfo.codecName;
return true;
diff --git a/xbmc/interfaces/json-rpc/schema/version.txt b/xbmc/interfaces/json-rpc/schema/version.txt
index 30a0348f9c..a60c61c016 100644
--- a/xbmc/interfaces/json-rpc/schema/version.txt
+++ b/xbmc/interfaces/json-rpc/schema/version.txt
@@ -1 +1 @@
-JSONRPC_VERSION 12.7.0
+JSONRPC_VERSION 12.8.0 \ No newline at end of file
diff --git a/xbmc/playlists/SmartPlayList.cpp b/xbmc/playlists/SmartPlayList.cpp
index 40164eccd9..8b764bac45 100644
--- a/xbmc/playlists/SmartPlayList.cpp
+++ b/xbmc/playlists/SmartPlayList.cpp
@@ -130,6 +130,7 @@ static const translateField fields[] = {
{ "channels", FieldNoOfChannels, CDatabaseQueryRule::NUMERIC_FIELD, StringValidation::IsPositiveInteger, false, 253 },
{ "albumstatus", FieldAlbumStatus, CDatabaseQueryRule::TEXT_FIELD, NULL, false, 38081 },
{ "albumduration", FieldAlbumDuration, CDatabaseQueryRule::SECONDS_FIELD, StringValidation::IsTime, false, 180 },
+ { "hdrtype", FieldHdrType, CDatabaseQueryRule::TEXTIN_FIELD, NULL, false, 20474 },
};
// clang-format on
@@ -507,6 +508,7 @@ std::vector<Field> CSmartPlaylistRule::GetFields(const std::string &type)
fields.push_back(FieldAudioLanguage);
fields.push_back(FieldSubtitleLanguage);
fields.push_back(FieldVideoAspectRatio);
+ fields.push_back(FieldHdrType);
}
fields.push_back(FieldPlaylist);
fields.push_back(FieldVirtualFolder);
@@ -1047,6 +1049,8 @@ std::string CSmartPlaylistRule::FormatWhereClause(const std::string &negate, con
query = db.PrepareSQL(negate + " EXISTS (SELECT 1 FROM streamdetails WHERE streamdetails.idFile = " + table + ".idFile AND streamdetails.iStreamtype = %i GROUP BY streamdetails.idFile HAVING COUNT(streamdetails.iStreamType) " + parameter + ")",CStreamDetail::AUDIO);
else if (m_field == FieldSubtitleCount)
query = db.PrepareSQL(negate + " EXISTS (SELECT 1 FROM streamdetails WHERE streamdetails.idFile = " + table + ".idFile AND streamdetails.iStreamType = %i GROUP BY streamdetails.idFile HAVING COUNT(streamdetails.iStreamType) " + parameter + ")",CStreamDetail::SUBTITLE);
+ else if (m_field == FieldHdrType)
+ query = negate + " EXISTS (SELECT 1 FROM streamdetails WHERE streamdetails.idFile = " + table + ".idFile AND strHdrType " + parameter + ")";
if (m_field == FieldPlaycount && strType != "songs" && strType != "albums" && strType != "tvshows")
{ // playcount IS stored as NULL OR number IN video db
if ((m_operator == OPERATOR_EQUALS && param == "0") ||
diff --git a/xbmc/utils/DatabaseUtils.h b/xbmc/utils/DatabaseUtils.h
index 2e43effdb0..dbe5e4a7e6 100644
--- a/xbmc/utils/DatabaseUtils.h
+++ b/xbmc/utils/DatabaseUtils.h
@@ -145,6 +145,7 @@ typedef enum {
FieldNoOfChannels,
FieldAlbumStatus,
FieldAlbumDuration,
+ FieldHdrType,
FieldMax
} Field;
diff --git a/xbmc/utils/StreamDetails.cpp b/xbmc/utils/StreamDetails.cpp
index acc644e109..662f68371b 100644
--- a/xbmc/utils/StreamDetails.cpp
+++ b/xbmc/utils/StreamDetails.cpp
@@ -10,7 +10,6 @@
#include "LangInfo.h"
#include "StreamUtils.h"
-#include "cores/VideoPlayer/Interface/StreamInfo.h"
#include "utils/Archive.h"
#include "utils/LangCodeExpander.h"
#include "utils/Variant.h"
@@ -32,7 +31,8 @@ CStreamDetailVideo::CStreamDetailVideo(const VideoStreamInfo &info, int duration
m_iDuration(duration),
m_strCodec(info.codecName),
m_strStereoMode(info.stereoMode),
- m_strLanguage(info.language)
+ m_strLanguage(info.language),
+ m_strHdrType(CStreamDetails::HdrTypeToString(info.hdrType))
{
}
@@ -47,6 +47,7 @@ void CStreamDetailVideo::Archive(CArchive& ar)
ar << m_iDuration;
ar << m_strStereoMode;
ar << m_strLanguage;
+ ar << m_strHdrType;
}
else
{
@@ -57,6 +58,7 @@ void CStreamDetailVideo::Archive(CArchive& ar)
ar >> m_iDuration;
ar >> m_strStereoMode;
ar >> m_strLanguage;
+ ar >> m_strHdrType;
}
}
void CStreamDetailVideo::Serialize(CVariant& value) const
@@ -68,6 +70,7 @@ void CStreamDetailVideo::Serialize(CVariant& value) const
value["duration"] = m_iDuration;
value["stereomode"] = m_strStereoMode;
value["language"] = m_strLanguage;
+ value["hdrtype"] = m_strHdrType;
}
bool CStreamDetailVideo::IsWorseThan(const CStreamDetail &that) const
@@ -398,6 +401,16 @@ int CStreamDetails::GetVideoHeight(int idx) const
return 0;
}
+std::string CStreamDetails::GetVideoHdrType( int idx) const
+{
+ const CStreamDetailVideo* item =
+ static_cast<const CStreamDetailVideo*>(GetNthStream(CStreamDetail::VIDEO, idx));
+ if (item)
+ return item->m_strHdrType;
+ else
+ return "";
+}
+
int CStreamDetails::GetVideoDuration(int idx) const
{
const CStreamDetailVideo *item = static_cast<const CStreamDetailVideo*>(GetNthStream(CStreamDetail::VIDEO, idx));
@@ -625,3 +638,19 @@ bool CStreamDetails::SetStreams(const VideoStreamInfo& videoInfo, int videoDurat
DetermineBestStreams();
return true;
}
+
+std::string CStreamDetails::HdrTypeToString(StreamHdrType hdrType)
+{
+ switch (hdrType)
+ {
+ case StreamHdrType::HDR_TYPE_DOLBYVISION:
+ return "dolbyvision";
+ case StreamHdrType::HDR_TYPE_HDR10:
+ return "hdr10";
+ case StreamHdrType::HDR_TYPE_HLG:
+ return "hlg";
+ case StreamHdrType::HDR_TYPE_NONE:
+ default:
+ return "";
+ }
+}
diff --git a/xbmc/utils/StreamDetails.h b/xbmc/utils/StreamDetails.h
index 80ba659034..f897900899 100644
--- a/xbmc/utils/StreamDetails.h
+++ b/xbmc/utils/StreamDetails.h
@@ -9,6 +9,7 @@
#pragma once
#include "ISerializable.h"
+#include "cores/VideoPlayer/Interface/StreamInfo.h"
#include "utils/IArchivable.h"
#include <memory>
@@ -57,6 +58,7 @@ public:
std::string m_strCodec;
std::string m_strStereoMode;
std::string m_strLanguage;
+ std::string m_strHdrType;
};
class CStreamDetailAudio final : public CStreamDetail
@@ -103,12 +105,14 @@ public:
int GetVideoStreamCount(void) const;
int GetAudioStreamCount(void) const;
int GetSubtitleStreamCount(void) const;
+ static std::string HdrTypeToString(StreamHdrType hdrType);
const CStreamDetail* GetNthStream(CStreamDetail::StreamType type, int idx) const;
std::string GetVideoCodec(int idx = 0) const;
float GetVideoAspect(int idx = 0) const;
int GetVideoWidth(int idx = 0) const;
int GetVideoHeight(int idx = 0) const;
+ std::string GetVideoHdrType (int idx = 0) const;
int GetVideoDuration(int idx = 0) const;
void SetVideoDuration(int idx, const int duration);
std::string GetStereoMode(int idx = 0) const;
diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp
index c5a6e09ad0..504505f486 100644
--- a/xbmc/video/VideoDatabase.cpp
+++ b/xbmc/video/VideoDatabase.cpp
@@ -178,7 +178,8 @@ void CVideoDatabase::CreateTables()
m_pDS->exec("CREATE TABLE streamdetails (idFile integer, iStreamType integer, "
"strVideoCodec text, fVideoAspect float, iVideoWidth integer, iVideoHeight integer, "
"strAudioCodec text, iAudioChannels integer, strAudioLanguage text, "
- "strSubtitleLanguage text, iVideoDuration integer, strStereoMode text, strVideoLanguage text)");
+ "strSubtitleLanguage text, iVideoDuration integer, strStereoMode text, strVideoLanguage text, "
+ "strHdrType text)");
CLog::Log(LOGINFO, "create sets table");
m_pDS->exec("CREATE TABLE sets ( idSet integer primary key, strSet text, strOverview text)");
@@ -3057,13 +3058,15 @@ void CVideoDatabase::SetStreamDetailsForFileId(const CStreamDetails& details, in
{
m_pDS->exec(PrepareSQL("INSERT INTO streamdetails "
"(idFile, iStreamType, strVideoCodec, fVideoAspect, iVideoWidth, "
- "iVideoHeight, iVideoDuration, strStereoMode, strVideoLanguage) "
- "VALUES (%i,%i,'%s',%f,%i,%i,%i,'%s','%s')",
+ "iVideoHeight, iVideoDuration, strStereoMode, strVideoLanguage, "
+ "strHdrType)"
+ "VALUES (%i,%i,'%s',%f,%i,%i,%i,'%s','%s','%s')",
idFile, (int)CStreamDetail::VIDEO, details.GetVideoCodec(i).c_str(),
static_cast<double>(details.GetVideoAspect(i)),
details.GetVideoWidth(i), details.GetVideoHeight(i),
details.GetVideoDuration(i), details.GetStereoMode(i).c_str(),
- details.GetVideoLanguage(i).c_str()));
+ details.GetVideoLanguage(i).c_str(),
+ details.GetVideoHdrType(i).c_str()));
}
for (int i=1; i<=details.GetAudioStreamCount(); i++)
{
@@ -3894,6 +3897,7 @@ bool CVideoDatabase::GetStreamDetails(CVideoInfoTag& tag) const
p->m_iDuration = pDS->fv(10).get_asInt();
p->m_strStereoMode = pDS->fv(11).get_asString();
p->m_strLanguage = pDS->fv(12).get_asString();
+ p->m_strHdrType = pDS->fv(13).get_asString();
details.AddStream(p);
retVal = true;
break;
@@ -5830,11 +5834,15 @@ void CVideoDatabase::UpdateTables(int iVersion)
if (iVersion < 119)
m_pDS->exec("ALTER TABLE path ADD allAudio bool");
+ if (iVersion < 120)
+ {
+ m_pDS->exec("ALTER TABLE streamdetails ADD strHdrType text");
+ }
}
int CVideoDatabase::GetSchemaVersion() const
{
- return 119;
+ return 120;
}
bool CVideoDatabase::LookupByFolders(const std::string &path, bool shows)
diff --git a/xbmc/video/VideoInfoTag.cpp b/xbmc/video/VideoInfoTag.cpp
index 489c6bd1bc..1893a7cbb6 100644
--- a/xbmc/video/VideoInfoTag.cpp
+++ b/xbmc/video/VideoInfoTag.cpp
@@ -248,6 +248,7 @@ bool CVideoInfoTag::Save(TiXmlNode *node, const std::string &tag, bool savePathI
XMLUtils::SetInt(&stream, "height", m_streamDetails.GetVideoHeight(iStream));
XMLUtils::SetInt(&stream, "durationinseconds", m_streamDetails.GetVideoDuration(iStream));
XMLUtils::SetString(&stream, "stereomode", m_streamDetails.GetStereoMode(iStream));
+ XMLUtils::SetString(&stream, "hdrtype", m_streamDetails.GetVideoHdrType(iStream));
streamdetails.InsertEndChild(stream);
}
for (int iStream=1; iStream<=m_streamDetails.GetAudioStreamCount(); iStream++)
@@ -1305,10 +1306,13 @@ void CVideoInfoTag::ParseNative(const TiXmlElement* movie, bool prioritise)
p->m_strStereoMode = StringUtils::Trim(value);
if (XMLUtils::GetString(nodeDetail, "language", value))
p->m_strLanguage = StringUtils::Trim(value);
+ if (XMLUtils::GetString(nodeDetail, "hdrtype", value))
+ p->m_strHdrType = StringUtils::Trim(value);
StringUtils::ToLower(p->m_strCodec);
StringUtils::ToLower(p->m_strStereoMode);
StringUtils::ToLower(p->m_strLanguage);
+ StringUtils::ToLower(p->m_strHdrType);
m_streamDetails.AddStream(p);
}
nodeDetail = NULL;