Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #3340 from da-anda/3d-streamdetails

[3D] Add stereomode of videos to streamdetails and expose info to skins
  • Loading branch information...
commit cb381b3348ead68dc295da8df36229b7f89c8f0b 2 parents 1a41036 + 481e7c9
@jmarshallnz jmarshallnz authored
View
1  addons/skin.confluence/720p/DialogVideoInfo.xml
@@ -61,6 +61,7 @@
<include>AudioCodecFlaggingConditions</include>
<include>AudioChannelsFlaggingConditions</include>
<include>AspectCodecFlaggingConditions</include>
+ <include>VideoStereoscopicsFlaggingConditions</include>
<include>VideoTypeHackFlaggingConditions</include>
</control>
<control type="group">
View
10 addons/skin.confluence/720p/IncludesCodecFlagging.xml
@@ -34,6 +34,16 @@
<texture>$VAR[videocodec,flagging/video/,.png]</texture>
</control>
</include>
+ <include name="VideoStereoscopicsFlaggingConditions">
+ <control type="image">
+ <description>Video stereoscopics flagging image</description>
+ <width>55</width>
+ <height>35</height>
+ <aspectratio align="right">keep</aspectratio>
+ <texture>flagging/video/3D.png</texture>
+ <visible>ListItem.IsStereoscopic</visible>
+ </control>
+ </include>
<include name="VideoTypeHackFlaggingConditions">
<control type="image">
<description>Video Type Image</description>
View
40 addons/skin.confluence/720p/ViewsFileMode.xml
@@ -70,6 +70,16 @@
<height>26</height>
<texture>$INFO[ListItem.VideoResolution,flagging/lists/,.png]</texture>
<visible>Window.IsVisible(Videos) + [Container.Content(Movies) | Container.Content(Episodes) | Container.Content(MusicVideos)]</visible>
+ <visible>!ListItem.IsStereoscopic</visible>
+ </control>
+ <control type="image">
+ <left>625</left>
+ <top>8</top>
+ <width>40</width>
+ <height>26</height>
+ <texture>flagging/lists/3D.png</texture>
+ <visible>Window.IsVisible(Videos) + [Container.Content(Movies) | Container.Content(Episodes) | Container.Content(MusicVideos)]</visible>
+ <visible>ListItem.IsStereoscopic</visible>
</control>
<control type="image">
<left>665</left>
@@ -161,6 +171,16 @@
<height>26</height>
<texture>$INFO[ListItem.VideoResolution,flagging/lists/,.png]</texture>
<visible>Window.IsVisible(Videos) + [Container.Content(Movies) | Container.Content(Episodes) | Container.Content(MusicVideos)]</visible>
+ <visible>!ListItem.IsStereoscopic</visible>
+ </control>
+ <control type="image">
+ <left>625</left>
+ <top>8</top>
+ <width>40</width>
+ <height>26</height>
+ <texture>flagging/lists/3D.png</texture>
+ <visible>Window.IsVisible(Videos) + [Container.Content(Movies) | Container.Content(Episodes) | Container.Content(MusicVideos)]</visible>
+ <visible>ListItem.IsStereoscopic</visible>
</control>
<control type="image">
<left>665</left>
@@ -559,6 +579,16 @@
<height>26</height>
<texture>$INFO[ListItem.VideoResolution,flagging/lists/,.png]</texture>
<visible>Window.IsVisible(Videos) + [Container.Content(Movies) | Container.Content(Episodes) | Container.Content(MusicVideos)]</visible>
+ <visible>!ListItem.IsStereoscopic</visible>
+ </control>
+ <control type="image">
+ <left>1010</left>
+ <top>8</top>
+ <width>40</width>
+ <height>26</height>
+ <texture>flagging/lists/3D.png</texture>
+ <visible>Window.IsVisible(Videos) + [Container.Content(Movies) | Container.Content(Episodes) | Container.Content(MusicVideos)]</visible>
+ <visible>ListItem.IsStereoscopic</visible>
</control>
<control type="image">
<left>1050</left>
@@ -657,6 +687,16 @@
<height>26</height>
<texture>$INFO[ListItem.VideoResolution,flagging/lists/,.png]</texture>
<visible>Window.IsVisible(Videos) + [Container.Content(Movies) | Container.Content(Episodes) | Container.Content(MusicVideos)]</visible>
+ <visible>!ListItem.IsStereoscopic</visible>
+ </control>
+ <control type="image">
+ <left>1010</left>
+ <top>8</top>
+ <width>40</width>
+ <height>26</height>
+ <texture>flagging/lists/3D.png</texture>
+ <visible>Window.IsVisible(Videos) + [Container.Content(Movies) | Container.Content(Episodes) | Container.Content(MusicVideos)]</visible>
+ <visible>ListItem.IsStereoscopic</visible>
</control>
<control type="image">
<left>1050</left>
View
48 addons/skin.confluence/720p/ViewsVideoLibrary.xml
@@ -168,6 +168,7 @@
<include>AudioCodecFlaggingConditions</include>
<include>AudioChannelsFlaggingConditions</include>
<include>AspectCodecFlaggingConditions</include>
+ <include>VideoStereoscopicsFlaggingConditions</include>
<include>VideoTypeHackFlaggingConditions</include>
</control>
</control>
@@ -739,6 +740,7 @@
<include>AudioCodecFlaggingConditions</include>
<include>AudioChannelsFlaggingConditions</include>
<include>AspectCodecFlaggingConditions</include>
+ <include>VideoStereoscopicsFlaggingConditions</include>
<include>VideoTypeHackFlaggingConditions</include>
</control>
<control type="grouplist">
@@ -811,6 +813,16 @@
<height>26</height>
<texture>$INFO[ListItem.VideoResolution,flagging/lists/,.png]</texture>
<visible>Window.IsVisible(Videos) + [Container.Content(Movies) | Container.Content(Episodes) | Container.Content(MusicVideos)]</visible>
+ <visible>!ListItem.IsStereoscopic</visible>
+ </control>
+ <control type="image">
+ <left>515</left>
+ <top>8</top>
+ <width>40</width>
+ <height>26</height>
+ <texture>flagging/lists/3D.png</texture>
+ <visible>Window.IsVisible(Videos) + [Container.Content(Movies) | Container.Content(Episodes) | Container.Content(MusicVideos)]</visible>
+ <visible>ListItem.IsStereoscopic</visible>
</control>
<control type="image">
<left>555</left>
@@ -889,6 +901,16 @@
<height>26</height>
<texture>$INFO[ListItem.VideoResolution,flagging/lists/,.png]</texture>
<visible>Window.IsVisible(Videos) + [Container.Content(Movies) | Container.Content(Episodes) | Container.Content(MusicVideos)]</visible>
+ <visible>!ListItem.IsStereoscopic</visible>
+ </control>
+ <control type="image">
+ <left>515</left>
+ <top>8</top>
+ <width>40</width>
+ <height>26</height>
+ <texture>flagging/lists/3D.png</texture>
+ <visible>Window.IsVisible(Videos) + [Container.Content(Movies) | Container.Content(Episodes) | Container.Content(MusicVideos)]</visible>
+ <visible>ListItem.IsStereoscopic</visible>
</control>
<control type="image">
<left>555</left>
@@ -1059,6 +1081,7 @@
<include>AudioCodecFlaggingConditions</include>
<include>AudioChannelsFlaggingConditions</include>
<include>AspectCodecFlaggingConditions</include>
+ <include>VideoStereoscopicsFlaggingConditions</include>
<include>VideoTypeHackFlaggingConditions</include>
</control>
<control type="label">
@@ -1164,6 +1187,7 @@
<include>AudioCodecFlaggingConditions</include>
<include>AudioChannelsFlaggingConditions</include>
<include>AspectCodecFlaggingConditions</include>
+ <include>VideoStereoscopicsFlaggingConditions</include>
<include>VideoTypeHackFlaggingConditions</include>
</control>
<control type="textbox">
@@ -1239,6 +1263,16 @@
<height>26</height>
<texture>$INFO[ListItem.VideoResolution,flagging/lists/,.png]</texture>
<visible>Window.IsVisible(Videos) + [Container.Content(Movies) | Container.Content(Episodes) | Container.Content(MusicVideos)]</visible>
+ <visible>!ListItem.IsStereoscopic</visible>
+ </control>
+ <control type="image">
+ <left>515</left>
+ <top>8</top>
+ <width>40</width>
+ <height>26</height>
+ <texture>flagging/lists/3D.png</texture>
+ <visible>Window.IsVisible(Videos) + [Container.Content(Movies) | Container.Content(Episodes) | Container.Content(MusicVideos)]</visible>
+ <visible>ListItem.IsStereoscopic</visible>
</control>
<control type="image">
<left>555</left>
@@ -1317,6 +1351,16 @@
<height>26</height>
<texture>$INFO[ListItem.VideoResolution,flagging/lists/,.png]</texture>
<visible>Window.IsVisible(Videos) + [Container.Content(Movies) | Container.Content(Episodes) | Container.Content(MusicVideos)]</visible>
+ <visible>!ListItem.IsStereoscopic</visible>
+ </control>
+ <control type="image">
+ <left>515</left>
+ <top>8</top>
+ <width>40</width>
+ <height>26</height>
+ <texture>flagging/lists/3D.png</texture>
+ <visible>Window.IsVisible(Videos) + [Container.Content(Movies) | Container.Content(Episodes) | Container.Content(MusicVideos)]</visible>
+ <visible>ListItem.IsStereoscopic</visible>
</control>
<control type="image">
<left>555</left>
@@ -1392,6 +1436,7 @@
<include>AudioCodecFlaggingConditions</include>
<include>AudioChannelsFlaggingConditions</include>
<include>AspectCodecFlaggingConditions</include>
+ <include>VideoStereoscopicsFlaggingConditions</include>
<include>VideoTypeHackFlaggingConditions</include>
</control>
<control type="image">
@@ -1497,6 +1542,7 @@
<include>AudioCodecFlaggingConditions</include>
<include>AudioChannelsFlaggingConditions</include>
<include>AspectCodecFlaggingConditions</include>
+ <include>VideoStereoscopicsFlaggingConditions</include>
<include>VideoTypeHackFlaggingConditions</include>
</control>
<control type="image">
@@ -1745,6 +1791,7 @@
<include>AudioCodecFlaggingConditions</include>
<include>AudioChannelsFlaggingConditions</include>
<include>AspectCodecFlaggingConditions</include>
+ <include>VideoStereoscopicsFlaggingConditions</include>
<include>VideoTypeHackFlaggingConditions</include>
</control>
<control type="image">
@@ -1906,6 +1953,7 @@
<include>AudioCodecFlaggingConditions</include>
<include>AudioChannelsFlaggingConditions</include>
<include>AspectCodecFlaggingConditions</include>
+ <include>VideoStereoscopicsFlaggingConditions</include>
<include>VideoTypeHackFlaggingConditions</include>
</control>
<control type="image">
View
BIN  addons/skin.confluence/media/flagging/lists/3D.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  addons/skin.confluence/media/flagging/video/3D.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
22 xbmc/GUIInfoManager.cpp
@@ -51,6 +51,7 @@
#include "settings/Settings.h"
#include "settings/SkinSettings.h"
#include "guilib/LocalizeStrings.h"
+#include "guilib/StereoscopicsManager.h"
#include "utils/CharsetConverter.h"
#include "utils/CPUInfo.h"
#include "utils/StringUtils.h"
@@ -403,7 +404,7 @@ const infomap videoplayer[] = {{ "title", VIDEOPLAYER_TITLE },
{ "hasepg", VIDEOPLAYER_HAS_EPG },
{ "parentalrating", VIDEOPLAYER_PARENTAL_RATING },
{ "isstereoscopic", VIDEOPLAYER_IS_STEREOSCOPIC },
- { "stereoscopicmode", VIDEOPLAYER_STEREOSCOPIC_MODE },
+ { "stereoscopicmode", VIDEOPLAYER_STEREOSCOPIC_MODE }
};
const infomap mediacontainer[] = {{ "hasfiles", CONTAINER_HASFILES },
@@ -581,7 +582,9 @@ const infomap listitem_labels[]= {{ "thumb", LISTITEM_THUMB },
{ "progress", LISTITEM_PROGRESS },
{ "dateadded", LISTITEM_DATE_ADDED },
{ "dbtype", LISTITEM_DBTYPE },
- { "dbid", LISTITEM_DBID }};
+ { "dbid", LISTITEM_DBID },
+ { "stereoscopicmode", LISTITEM_STEREOSCOPIC_MODE },
+ { "isstereoscopic", LISTITEM_IS_STEREOSCOPIC }};
const infomap visualisation[] = {{ "locked", VISUALISATION_LOCKED },
{ "preset", VISUALISATION_PRESET },
@@ -4962,6 +4965,13 @@ CStdString CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, CStdSt
return dbid;
}
break;
+ case LISTITEM_STEREOSCOPIC_MODE:
+ {
+ std::string stereoMode = item->GetProperty("stereomode").asString();
+ if (stereoMode.empty() && item->HasVideoInfoTag())
+ stereoMode = CStereoscopicsManager::Get().NormalizeStereoMode(item->GetVideoInfoTag()->m_streamDetails.GetStereoMode());
+ return stereoMode;
+ }
}
return "";
}
@@ -5095,6 +5105,14 @@ bool CGUIInfoManager::GetItemBool(const CGUIListItem *item, int condition) const
return pItem->GetEPGInfoTag()->ChannelTag()->IsEncrypted();
}
}
+ else if (condition == LISTITEM_IS_STEREOSCOPIC)
+ {
+ std::string stereoMode = pItem->GetProperty("stereomode").asString();
+ if (stereoMode.empty() && pItem->HasVideoInfoTag())
+ stereoMode = CStereoscopicsManager::Get().NormalizeStereoMode(pItem->GetVideoInfoTag()->m_streamDetails.GetStereoMode());
+ if (!stereoMode.empty() && stereoMode != "mono")
+ return true;
+ }
}
return false;
View
2  xbmc/GUIInfoManager.h
@@ -642,6 +642,8 @@ namespace INFO
#define LISTITEM_PROGRESS (LISTITEM_START + 137)
#define LISTITEM_HAS_EPG (LISTITEM_START + 138)
#define LISTITEM_VOTES (LISTITEM_START + 139)
+#define LISTITEM_STEREOSCOPIC_MODE (LISTITEM_START + 140)
+#define LISTITEM_IS_STEREOSCOPIC (LISTITEM_START + 141)
#define LISTITEM_PROPERTY_START (LISTITEM_START + 200)
#define LISTITEM_PROPERTY_END (LISTITEM_PROPERTY_START + 1000)
View
1  xbmc/cores/dvdplayer/DVDFileInfo.cpp
@@ -392,6 +392,7 @@ bool CDVDFileInfo::DemuxerToStreamDetails(CDVDInputStream *pInputStream, CDVDDem
p->m_fAspect = (float)p->m_iWidth / p->m_iHeight;
pDemux->GetStreamCodecName(iStream, p->m_strCodec);
p->m_iDuration = pDemux->GetStreamLength();
+ p->m_strStereoMode = ((CDemuxStreamVideo *)stream)->stereo_mode;
// stack handling
if (URIUtils::IsStack(path))
View
13 xbmc/guilib/StereoscopicsManager.cpp
@@ -290,6 +290,19 @@ const char* CStereoscopicsManager::ConvertGuiStereoModeToString(const RENDER_STE
return "";
}
+std::string CStereoscopicsManager::NormalizeStereoMode(const std::string &mode)
+{
+ if (!mode.empty() && mode != "mono")
+ {
+ int guiMode = ConvertStringToGuiStereoMode(mode);
+ if (guiMode > -1)
+ return ConvertGuiStereoModeToString((RENDER_STEREO_MODE) guiMode);
+ else
+ return mode;
+ }
+ return "mono";
+}
+
CAction CStereoscopicsManager::ConvertActionCommandToAction(const std::string &command, const std::string &parameter)
{
if (command == "SetStereoMode")
View
1  xbmc/guilib/StereoscopicsManager.h
@@ -68,6 +68,7 @@ class CStereoscopicsManager : public ISettingCallback,
* @return The integer of the according cAction or -1 if not valid
*/
CAction ConvertActionCommandToAction(const std::string &command, const std::string &parameter);
+ std::string NormalizeStereoMode(const std::string &mode);
virtual void OnSettingChanged(const CSetting *setting);
virtual bool OnMessage(CGUIMessage &message);
/*!
View
2  xbmc/interfaces/legacy/ListItem.cpp
@@ -493,6 +493,8 @@ namespace XBMCAddon
video->m_iHeight = strtol(value, NULL, 10);
else if (key == "duration")
video->m_iDuration = strtol(value, NULL, 10);
+ else if (key == "stereomode")
+ video->m_strStereoMode = value;
}
item->GetVideoInfoTag()->m_streamDetails.AddStream(video);
}
View
1  xbmc/utils/DatabaseUtils.h
@@ -122,6 +122,7 @@ typedef enum {
FieldBandFormed,
FieldDisbanded,
FieldDied,
+ FieldStereoMode,
FieldMax
} Field;
View
12 xbmc/utils/StreamDetails.cpp
@@ -49,6 +49,7 @@ void CStreamDetailVideo::Archive(CArchive& ar)
ar << m_iHeight;
ar << m_iWidth;
ar << m_iDuration;
+ ar << m_strStereoMode;
}
else
{
@@ -57,6 +58,7 @@ void CStreamDetailVideo::Archive(CArchive& ar)
ar >> m_iHeight;
ar >> m_iWidth;
ar >> m_iDuration;
+ ar >> m_strStereoMode;
}
}
void CStreamDetailVideo::Serialize(CVariant& value) const
@@ -66,6 +68,7 @@ void CStreamDetailVideo::Serialize(CVariant& value) const
value["height"] = m_iHeight;
value["width"] = m_iWidth;
value["duration"] = m_iDuration;
+ value["stereomode"] = m_strStereoMode;
}
bool CStreamDetailVideo::IsWorseThan(CStreamDetail *that)
@@ -389,6 +392,15 @@ int CStreamDetails::GetVideoDuration(int idx) const
return 0;
}
+std::string CStreamDetails::GetStereoMode(int idx) const
+{
+ CStreamDetailVideo *item = (CStreamDetailVideo *)GetNthStream(CStreamDetail::VIDEO, idx);
+ if (item)
+ return item->m_strStereoMode;
+ else
+ return "";
+}
+
CStdString CStreamDetails::GetAudioCodec(int idx) const
{
CStreamDetailAudio *item = (CStreamDetailAudio *)GetNthStream(CStreamDetail::AUDIO, idx);
View
2  xbmc/utils/StreamDetails.h
@@ -59,6 +59,7 @@ class CStreamDetailVideo : public CStreamDetail
float m_fAspect;
int m_iDuration;
CStdString m_strCodec;
+ std::string m_strStereoMode;
};
class CStreamDetailAudio : public CStreamDetail
@@ -111,6 +112,7 @@ class CStreamDetails : public IArchivable, public ISerializable
int GetVideoWidth(int idx = 0) const;
int GetVideoHeight(int idx = 0) const;
int GetVideoDuration(int idx = 0) const;
+ std::string GetStereoMode(int idx = 0) const;
CStdString GetAudioCodec(int idx = 0) const;
CStdString GetAudioLanguage(int idx = 0) const;
View
3  xbmc/utils/test/TestStreamDetails.cpp
@@ -34,6 +34,7 @@ TEST(TestStreamDetails, General)
video->m_fAspect = 2.39f;
video->m_iDuration = 30;
video->m_strCodec = "h264";
+ video->m_strStereoMode = "left_right";
audio->m_iChannels = 2;
audio->m_strCodec = "aac";
@@ -53,6 +54,7 @@ TEST(TestStreamDetails, General)
EXPECT_EQ(0, a.GetVideoWidth());
EXPECT_EQ(0, a.GetVideoHeight());
EXPECT_EQ(0, a.GetVideoDuration());
+ EXPECT_STREQ("", a.GetStereoMode().c_str());
EXPECT_EQ(1, a.GetStreamCount(CStreamDetail::AUDIO));
EXPECT_EQ(1, a.GetAudioStreamCount());
@@ -70,6 +72,7 @@ TEST(TestStreamDetails, General)
EXPECT_EQ(1920, a.GetVideoWidth());
EXPECT_EQ(1080, a.GetVideoHeight());
EXPECT_EQ(30, a.GetVideoDuration());
+ EXPECT_STREQ("left_right", a.GetStereoMode().c_str());
}
TEST(TestStreamDetails, VideoDimsToResolutionDescription)
View
15 xbmc/video/VideoDatabase.cpp
@@ -295,7 +295,7 @@ bool CVideoDatabase::CreateTables()
CLog::Log(LOGINFO, "create streaminfo table");
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)");
+ "strAudioCodec text, iAudioChannels integer, strAudioLanguage text, strSubtitleLanguage text, iVideoDuration integer, strStereoMode text)");
m_pDS->exec("CREATE INDEX ix_streamdetails ON streamdetails (idFile)");
CLog::Log(LOGINFO, "create sets table");
@@ -2477,11 +2477,12 @@ void CVideoDatabase::SetStreamDetailsForFileId(const CStreamDetails& details, in
for (int i=1; i<=details.GetVideoStreamCount(); i++)
{
m_pDS->exec(PrepareSQL("INSERT INTO streamdetails "
- "(idFile, iStreamType, strVideoCodec, fVideoAspect, iVideoWidth, iVideoHeight, iVideoDuration) "
- "VALUES (%i,%i,'%s',%f,%i,%i,%i)",
+ "(idFile, iStreamType, strVideoCodec, fVideoAspect, iVideoWidth, iVideoHeight, iVideoDuration, strStereoMode) "
+ "VALUES (%i,%i,'%s',%f,%i,%i,%i,'%s')",
idFile, (int)CStreamDetail::VIDEO,
details.GetVideoCodec(i).c_str(), details.GetVideoAspect(i),
- details.GetVideoWidth(i), details.GetVideoHeight(i), details.GetVideoDuration(i)));
+ details.GetVideoWidth(i), details.GetVideoHeight(i), details.GetVideoDuration(i),
+ details.GetStereoMode(i).c_str()));
}
for (int i=1; i<=details.GetAudioStreamCount(); i++)
{
@@ -3298,6 +3299,7 @@ bool CVideoDatabase::GetStreamDetails(CVideoInfoTag& tag) const
p->m_iWidth = pDS->fv(4).get_asInt();
p->m_iHeight = pDS->fv(5).get_asInt();
p->m_iDuration = pDS->fv(10).get_asInt();
+ p->m_strStereoMode = pDS->fv(11).get_asString();
details.AddStream(p);
retVal = true;
break;
@@ -4538,6 +4540,9 @@ bool CVideoDatabase::UpdateOldVersion(int iVersion)
m_pDS->exec("ALTER TABLE settings ADD StereoMode integer");
m_pDS->exec("ALTER TABLE settings ADD StereoInvert bool");
}
+ if (iVersion < 77)
+ m_pDS->exec("ALTER TABLE streamdetails ADD strStereoMode text");
+
// always recreate the view after any table change
CreateViews();
return true;
@@ -4545,7 +4550,7 @@ bool CVideoDatabase::UpdateOldVersion(int iVersion)
int CVideoDatabase::GetMinVersion() const
{
- return 76;
+ return 77;
}
bool CVideoDatabase::LookupByFolders(const CStdString &path, bool shows)
View
4 xbmc/video/VideoInfoTag.cpp
@@ -197,6 +197,7 @@ bool CVideoInfoTag::Save(TiXmlNode *node, const CStdString &tag, bool savePathIn
XMLUtils::SetInt(&stream, "width", m_streamDetails.GetVideoWidth(iStream));
XMLUtils::SetInt(&stream, "height", m_streamDetails.GetVideoHeight(iStream));
XMLUtils::SetInt(&stream, "durationinseconds", m_streamDetails.GetVideoDuration(iStream));
+ XMLUtils::SetString(&stream, "stereomode", m_streamDetails.GetStereoMode(iStream));
streamdetails.InsertEndChild(stream);
}
for (int iStream=1; iStream<=m_streamDetails.GetAudioStreamCount(); iStream++)
@@ -521,6 +522,7 @@ void CVideoInfoTag::ToSortable(SortItem& sortable, Field field) const
case FieldVideoResolution: sortable[FieldVideoResolution] = m_streamDetails.GetVideoHeight(); break;
case FieldVideoAspectRatio: sortable[FieldVideoAspectRatio] = m_streamDetails.GetVideoAspect(); break;
case FieldVideoCodec: sortable[FieldVideoCodec] = m_streamDetails.GetVideoCodec(); break;
+ case FieldStereoMode: sortable[FieldStereoMode] = m_streamDetails.GetStereoMode(); break;
case FieldAudioChannels: sortable[FieldAudioChannels] = m_streamDetails.GetAudioChannels(); break;
case FieldAudioCodec: sortable[FieldAudioCodec] = m_streamDetails.GetAudioCodec(); break;
@@ -712,7 +714,9 @@ void CVideoInfoTag::ParseNative(const TiXmlElement* movie, bool prioritise)
XMLUtils::GetInt(nodeDetail, "width", p->m_iWidth);
XMLUtils::GetInt(nodeDetail, "height", p->m_iHeight);
XMLUtils::GetInt(nodeDetail, "durationinseconds", p->m_iDuration);
+ XMLUtils::GetString(nodeDetail, "stereomode", p->m_strStereoMode);
p->m_strCodec.MakeLower();
+ StringUtils::ToLower(p->m_strStereoMode);
m_streamDetails.AddStream(p);
}
nodeDetail = NULL;
View
35 xbmc/video/VideoThumbLoader.cpp
@@ -26,8 +26,11 @@
#include "filesystem/DirectoryCache.h"
#include "FileItem.h"
#include "settings/Settings.h"
+#include "settings/VideoSettings.h"
#include "GUIUserMessages.h"
#include "guilib/GUIWindowManager.h"
+#include "guilib/StereoscopicsManager.h"
+#include "rendering/RenderSystem.h"
#include "TextureCache.h"
#include "utils/log.h"
#include "video/VideoInfoTag.h"
@@ -301,6 +304,8 @@ bool CVideoThumbLoader::LoadItemLookup(CFileItem* pItem)
pItem->GetVideoInfoTag()->m_type != "musicvideo")
return false; // Nothing to do here
+ DetectAndAddMissingItemData(*pItem);
+
m_videoDatabase->Open();
map<string, string> artwork = pItem->GetArt();
@@ -519,3 +524,33 @@ void CVideoThumbLoader::OnJobComplete(unsigned int jobID, bool success, CJob* jo
}
CJobQueue::OnJobComplete(jobID, success, job);
}
+
+void CVideoThumbLoader::DetectAndAddMissingItemData(CFileItem &item)
+{
+ if (item.m_bIsFolder) return;
+
+ std::string stereoMode;
+ // detect stereomode for videos
+ if (item.HasVideoInfoTag())
+ stereoMode = item.GetVideoInfoTag()->m_streamDetails.GetStereoMode();
+ if (stereoMode.empty())
+ {
+ std::string path = item.GetPath();
+ if (item.IsVideoDb() && item.HasVideoInfoTag())
+ path = item.GetVideoInfoTag()->GetPath();
+
+ // check for custom stereomode setting in video settings
+ CVideoSettings itemVideoSettings;
+ m_videoDatabase->Open();
+ if (m_videoDatabase->GetVideoSettings(path, itemVideoSettings) && itemVideoSettings.m_StereoMode != RENDER_STEREO_MODE_OFF)
+ stereoMode = CStereoscopicsManager::Get().ConvertGuiStereoModeToString( (RENDER_STEREO_MODE) itemVideoSettings.m_StereoMode );
+ m_videoDatabase->Close();
+
+ // still empty, try grabbing from filename
+ // TODO: in case of too many false positives due to using the full path, extract the filename only using string utils
+ if (stereoMode.empty())
+ stereoMode = CStereoscopicsManager::Get().DetectStereoModeByString( path );
+ }
+ if (!stereoMode.empty())
+ item.SetProperty("stereomode", CStereoscopicsManager::Get().NormalizeStereoMode(stereoMode));
+}
View
6 xbmc/video/VideoThumbLoader.h
@@ -127,4 +127,10 @@ class CVideoThumbLoader : public CThumbLoader, public CJobQueue
CVideoDatabase *m_videoDatabase;
typedef std::map<int, std::map<std::string, std::string> > ArtCache;
ArtCache m_showArt;
+
+ /*! \brief Tries to detect missing data/info from a file and adds those
+ \param item The CFileItem to process
+ \return void
+ */
+ void DetectAndAddMissingItemData(CFileItem &item);
};
Please sign in to comment.
Something went wrong with that request. Please try again.