Permalink
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...
jmarshallnz committed Nov 6, 2013
2 parents 1a41036 + 481e7c9 commit cb381b3348ead68dc295da8df36229b7f89c8f0b
@@ -61,6 +61,7 @@
<include>AudioCodecFlaggingConditions</include>
<include>AudioChannelsFlaggingConditions</include>
<include>AspectCodecFlaggingConditions</include>
+ <include>VideoStereoscopicsFlaggingConditions</include>
<include>VideoTypeHackFlaggingConditions</include>
</control>
<control type="group">
@@ -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>
@@ -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>
@@ -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">
Binary file not shown.
Binary file not shown.
View
@@ -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
@@ -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)
@@ -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))
@@ -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")
@@ -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);
/*!
@@ -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);
}
@@ -122,6 +122,7 @@ typedef enum {
FieldBandFormed,
FieldDisbanded,
FieldDied,
+ FieldStereoMode,
FieldMax
} Field;
@@ -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);
@@ -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;
Oops, something went wrong.

0 comments on commit cb381b3

Please sign in to comment.