Permalink
Browse files

added: manual orientation setting for videos

  • Loading branch information...
notspiff authored and akva2 committed Aug 17, 2018
1 parent 5f77b6d commit 40bd3c3f7c51b5b2059891fb12aa73791b496f7c
@@ -3167,7 +3167,11 @@ msgctxt "#686"
msgid "Verbose logging of [B]EPG[/B] component"
msgstr ""

#empty strings from id 687 to 699
msgctxt "#687"
msgid "From metadata"
msgstr ""

#empty strings from id 688 to 699

#: xbmc/music/infoscanner/MusicInfoScanner.cpp
#: xbmc/music/MusicDatabase.cpp
@@ -14186,6 +14190,7 @@ msgctxt "#21842"
msgid "GPS altitude"
msgstr ""

#: xbmc/video/dialogs/GUIDialogVideoSettings.cpp
msgctxt "#21843"
msgid "Orientation"
msgstr ""
@@ -17404,18 +17409,21 @@ msgstr ""

#. Label of the thumbnail for when the video is rotated to the right
#: xbmc/games/dialogs/osd/DialogGameVideoRotation.cpp
#: xbmc/video/dialogs/GUIDialogVideoSettings.cpp
msgctxt "#35229"
msgid "90°"
msgstr ""

#. Label of the thumbnail for when the video is rotated upside down
#: xbmc/games/dialogs/osd/DialogGameVideoRotation.cpp
#: xbmc/video/dialogs/GUIDialogVideoSettings.cpp
msgctxt "#35230"
msgid "180°"
msgstr ""

#. Label of the thumbnail for when the video is rotated to the left
#: xbmc/games/dialogs/osd/DialogGameVideoRotation.cpp
#: xbmc/video/dialogs/GUIDialogVideoSettings.cpp
msgctxt "#35231"
msgid "270°"
msgstr ""
@@ -837,9 +837,13 @@ CVideoPlayerVideo::EOutputState CVideoPlayerVideo::OutputPicture(const VideoPict
config_framerate = 59.94;
}

int sorient = m_processInfo.GetVideoSettings().m_Orientation;
int orientation = sorient != 0 ? (sorient + m_hints.orientation) % 360
: m_hints.orientation;

if (!m_renderManager.Configure(*pPicture,
static_cast<float>(config_framerate),
m_hints.orientation,
orientation,
m_pVideoCodec->GetAllowedReferences()))
{
CLog::Log(LOGERROR, "%s - failed to configure renderer", __FUNCTION__);
@@ -64,6 +64,7 @@ bool CVideoSettings::operator!=(const CVideoSettings &right) const
if (m_VideoStream != right.m_VideoStream) return true;
if (m_ToneMapMethod != right.m_ToneMapMethod) return true;
if (m_ToneMapParam != right.m_ToneMapParam) return true;
if (m_Orientation != right.m_Orientation) return true;
return false;
}

@@ -113,6 +113,7 @@ class CVideoSettings
int m_VideoStream;
int m_ToneMapMethod = VS_TONEMAPMETHOD_REINHARD;
float m_ToneMapParam = 1.0;
int m_Orientation = 0;
};

class CCriticalSection;
@@ -92,7 +92,7 @@ void CVideoDatabase::CreateTables()
"VolumeAmplification float, AudioDelay float, ResumeTime integer,"
"Sharpness float, NoiseReduction float, NonLinStretch bool, PostProcess bool,"
"ScalingMethod integer, DeinterlaceMode integer, StereoMode integer, StereoInvert bool, VideoStream integer,"
"TonemapMethod integer, TonemapParam float)\n");
"TonemapMethod integer, TonemapParam float, Orientation integer)\n");

CLog::Log(LOGINFO, "create stacktimes table");
m_pDS->exec("CREATE TABLE stacktimes (idFile integer, times text)\n");
@@ -4325,6 +4325,7 @@ bool CVideoDatabase::GetVideoSettings(int idFile, CVideoSettings &settings)
settings.m_VideoStream = m_pDS->fv("VideoStream").get_asInt();
settings.m_ToneMapMethod = m_pDS->fv("TonemapMethod").get_asInt();
settings.m_ToneMapParam = m_pDS->fv("TonemapParam").get_asFloat();
settings.m_Orientation = m_pDS->fv("Orientation").get_asInt();
m_pDS->close();

if (settings.m_ToneMapParam == 0.0)
@@ -4389,15 +4390,15 @@ void CVideoDatabase::SetVideoSettings(int idFile, const CVideoSettings &setting)
"AudioStream,SubtitleStream,SubtitleDelay,SubtitlesOn,Brightness,"
"Contrast,Gamma,VolumeAmplification,AudioDelay,"
"ResumeTime,"
"Sharpness,NoiseReduction,NonLinStretch,PostProcess,ScalingMethod,StereoMode,StereoInvert,VideoStream,TonemapMethod,TonemapParam) "
"Sharpness,NoiseReduction,NonLinStretch,PostProcess,ScalingMethod,StereoMode,StereoInvert,VideoStream,TonemapMethod,TonemapParam,Orientation) "
"VALUES ";
strSQL += PrepareSQL("(%i,%i,%i,%f,%f,%f,%i,%i,%f,%i,%f,%f,%f,%f,%f,%i,%f,%f,%i,%i,%i,%i,%i,%i,%i,%f)",
strSQL += PrepareSQL("(%i,%i,%i,%f,%f,%f,%i,%i,%f,%i,%f,%f,%f,%f,%f,%i,%f,%f,%i,%i,%i,%i,%i,%i,%i,%f,%i)",
idFile, setting.m_InterlaceMethod, setting.m_ViewMode, setting.m_CustomZoomAmount, setting.m_CustomPixelRatio, setting.m_CustomVerticalShift,
setting.m_AudioStream, setting.m_SubtitleStream, setting.m_SubtitleDelay, setting.m_SubtitleOn, setting.m_Brightness,
setting.m_Contrast, setting.m_Gamma, setting.m_VolumeAmplification, setting.m_AudioDelay,
setting.m_ResumeTime,
setting.m_Sharpness, setting.m_NoiseReduction, setting.m_CustomNonLinStretch, setting.m_PostProcess, setting.m_ScalingMethod,
setting.m_StereoMode, setting.m_StereoInvert, setting.m_VideoStream, setting.m_ToneMapMethod, setting.m_ToneMapParam);
setting.m_StereoMode, setting.m_StereoInvert, setting.m_VideoStream, setting.m_ToneMapMethod, setting.m_ToneMapParam, setting.m_Orientation);
m_pDS->exec(strSQL);
}
}
@@ -5339,11 +5340,14 @@ void CVideoDatabase::UpdateTables(int iVersion)
m_pDS->exec("ALTER TABLE settings ADD TonemapMethod integer");
m_pDS->exec("ALTER TABLE settings ADD TonemapParam float");
}

if (iVersion < 111)
m_pDS->exec("ALTER TABLE settings ADD Orientation integer");
}

int CVideoDatabase::GetSchemaVersion() const
{
return 110;
return 111;
}

bool CVideoDatabase::LookupByFolders(const std::string &path, bool shows)
@@ -41,6 +41,7 @@
#define SETTING_VIDEO_VERTICAL_SHIFT "video.verticalshift"
#define SETTING_VIDEO_TONEMAP_METHOD "video.tonemapmethod"
#define SETTING_VIDEO_TONEMAP_PARAM "video.tonemapparam"
#define SETTING_VIDEO_ORIENTATION "video.orientation"

#define SETTING_VIDEO_VDPAU_NOISE "vdpau.noise"
#define SETTING_VIDEO_VDPAU_SHARPNESS "vdpau.sharpness"
@@ -178,6 +179,12 @@ void CGUIDialogVideoSettings::OnSettingChanged(std::shared_ptr<const CSetting> s
vs.m_ToneMapParam = static_cast<float>(std::static_pointer_cast<const CSettingNumber>(setting)->GetValue());
g_application.GetAppPlayer().SetVideoSettings(vs);
}
else if (settingId == SETTING_VIDEO_ORIENTATION)
{
CVideoSettings vs = g_application.GetAppPlayer().GetVideoSettings();
vs.m_Orientation = std::static_pointer_cast<const CSettingInt>(setting)->GetValue();
g_application.GetAppPlayer().SetVideoSettings(vs);
}
else if (settingId == SETTING_VIDEO_STEREOSCOPICMODE)
{
CVideoSettings vs = g_application.GetAppPlayer().GetVideoSettings();
@@ -373,6 +380,9 @@ void CGUIDialogVideoSettings::InitializeSettings()
AddSlider(groupVideo, SETTING_VIDEO_VERTICAL_SHIFT, 225, SettingLevel::Basic, videoSettings.m_CustomVerticalShift, "%2.2f", -2.0f, 0.01f, 2.0f, 225, usePopup);
if (g_application.GetAppPlayer().Supports(RENDERFEATURE_PIXEL_RATIO))
AddSlider(groupVideo, SETTING_VIDEO_PIXEL_RATIO, 217, SettingLevel::Basic, videoSettings.m_CustomPixelRatio, "%2.2f", 0.5f, 0.01f, 2.0f, 217, usePopup);

AddList(groupVideo, SETTING_VIDEO_ORIENTATION, 21843, SettingLevel::Basic, videoSettings.m_Orientation, CGUIDialogVideoSettings::VideoOrientationFiller, 21843);

if (g_application.GetAppPlayer().Supports(RENDERFEATURE_POSTPROCESS))
AddToggle(groupVideo, SETTING_VIDEO_POSTPROCESS, 16400, SettingLevel::Basic, videoSettings.m_PostProcess);
if (g_application.GetAppPlayer().Supports(RENDERFEATURE_BRIGHTNESS))
@@ -472,6 +482,14 @@ void CGUIDialogVideoSettings::VideoStreamsOptionFiller(std::shared_ptr<const CSe
}
}

void CGUIDialogVideoSettings::VideoOrientationFiller(std::shared_ptr<const CSetting> setting, std::vector< std::pair<std::string, int> > &list, int &current, void *data)
{
list.push_back(std::make_pair(g_localizeStrings.Get(687), 0));
list.push_back(std::make_pair(g_localizeStrings.Get(35229), 90));
list.push_back(std::make_pair(g_localizeStrings.Get(35230), 180));
list.push_back(std::make_pair(g_localizeStrings.Get(35231), 270));
}

std::string CGUIDialogVideoSettings::FormatFlags(StreamFlags flags)
{
std::vector<std::string> localizedFlags;
@@ -29,6 +29,8 @@ class CGUIDialogVideoSettings : public CGUIDialogSettingsManualBase
void AddVideoStreams(std::shared_ptr<CSettingGroup> group, const std::string & settingId);
static void VideoStreamsOptionFiller(std::shared_ptr<const CSetting> setting, std::vector< std::pair<std::string, int> > &list, int &current, void *data);

static void VideoOrientationFiller(std::shared_ptr<const CSetting> setting, std::vector< std::pair<std::string, int> > &list, int &current, void *data);

static std::string FormatFlags(StreamFlags flags);

// specialization of CGUIDialogSettingsBase

0 comments on commit 40bd3c3

Please sign in to comment.