Skip to content

Commit

Permalink
added: manual orientation setting for videos
Browse files Browse the repository at this point in the history
  • Loading branch information
notspiff authored and akva2 committed Aug 19, 2018
1 parent 5f77b6d commit 40bd3c3
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 7 deletions.
10 changes: 9 additions & 1 deletion addons/resource.language.en_gb/resources/strings.po
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3167,7 +3167,11 @@ msgctxt "#686"
msgid "Verbose logging of [B]EPG[/B] component" msgid "Verbose logging of [B]EPG[/B] component"
msgstr "" 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/infoscanner/MusicInfoScanner.cpp
#: xbmc/music/MusicDatabase.cpp #: xbmc/music/MusicDatabase.cpp
Expand Down Expand Up @@ -14186,6 +14190,7 @@ msgctxt "#21842"
msgid "GPS altitude" msgid "GPS altitude"
msgstr "" msgstr ""


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


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


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


#. Label of the thumbnail for when the video is rotated to the left #. Label of the thumbnail for when the video is rotated to the left
#: xbmc/games/dialogs/osd/DialogGameVideoRotation.cpp #: xbmc/games/dialogs/osd/DialogGameVideoRotation.cpp
#: xbmc/video/dialogs/GUIDialogVideoSettings.cpp
msgctxt "#35231" msgctxt "#35231"
msgid "270°" msgid "270°"
msgstr "" msgstr ""
Expand Down
6 changes: 5 additions & 1 deletion xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -837,9 +837,13 @@ CVideoPlayerVideo::EOutputState CVideoPlayerVideo::OutputPicture(const VideoPict
config_framerate = 59.94; 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, if (!m_renderManager.Configure(*pPicture,
static_cast<float>(config_framerate), static_cast<float>(config_framerate),
m_hints.orientation, orientation,
m_pVideoCodec->GetAllowedReferences())) m_pVideoCodec->GetAllowedReferences()))
{ {
CLog::Log(LOGERROR, "%s - failed to configure renderer", __FUNCTION__); CLog::Log(LOGERROR, "%s - failed to configure renderer", __FUNCTION__);
Expand Down
1 change: 1 addition & 0 deletions xbmc/cores/VideoSettings.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ bool CVideoSettings::operator!=(const CVideoSettings &right) const
if (m_VideoStream != right.m_VideoStream) return true; if (m_VideoStream != right.m_VideoStream) return true;
if (m_ToneMapMethod != right.m_ToneMapMethod) return true; if (m_ToneMapMethod != right.m_ToneMapMethod) return true;
if (m_ToneMapParam != right.m_ToneMapParam) return true; if (m_ToneMapParam != right.m_ToneMapParam) return true;
if (m_Orientation != right.m_Orientation) return true;
return false; return false;
} }


Expand Down
1 change: 1 addition & 0 deletions xbmc/cores/VideoSettings.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class CVideoSettings
int m_VideoStream; int m_VideoStream;
int m_ToneMapMethod = VS_TONEMAPMETHOD_REINHARD; int m_ToneMapMethod = VS_TONEMAPMETHOD_REINHARD;
float m_ToneMapParam = 1.0; float m_ToneMapParam = 1.0;
int m_Orientation = 0;
}; };


class CCriticalSection; class CCriticalSection;
Expand Down
14 changes: 9 additions & 5 deletions xbmc/video/VideoDatabase.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void CVideoDatabase::CreateTables()
"VolumeAmplification float, AudioDelay float, ResumeTime integer," "VolumeAmplification float, AudioDelay float, ResumeTime integer,"
"Sharpness float, NoiseReduction float, NonLinStretch bool, PostProcess bool," "Sharpness float, NoiseReduction float, NonLinStretch bool, PostProcess bool,"
"ScalingMethod integer, DeinterlaceMode integer, StereoMode integer, StereoInvert bool, VideoStream integer," "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"); CLog::Log(LOGINFO, "create stacktimes table");
m_pDS->exec("CREATE TABLE stacktimes (idFile integer, times text)\n"); m_pDS->exec("CREATE TABLE stacktimes (idFile integer, times text)\n");
Expand Down Expand Up @@ -4325,6 +4325,7 @@ bool CVideoDatabase::GetVideoSettings(int idFile, CVideoSettings &settings)
settings.m_VideoStream = m_pDS->fv("VideoStream").get_asInt(); settings.m_VideoStream = m_pDS->fv("VideoStream").get_asInt();
settings.m_ToneMapMethod = m_pDS->fv("TonemapMethod").get_asInt(); settings.m_ToneMapMethod = m_pDS->fv("TonemapMethod").get_asInt();
settings.m_ToneMapParam = m_pDS->fv("TonemapParam").get_asFloat(); settings.m_ToneMapParam = m_pDS->fv("TonemapParam").get_asFloat();
settings.m_Orientation = m_pDS->fv("Orientation").get_asInt();
m_pDS->close(); m_pDS->close();


if (settings.m_ToneMapParam == 0.0) if (settings.m_ToneMapParam == 0.0)
Expand Down Expand Up @@ -4389,15 +4390,15 @@ void CVideoDatabase::SetVideoSettings(int idFile, const CVideoSettings &setting)
"AudioStream,SubtitleStream,SubtitleDelay,SubtitlesOn,Brightness," "AudioStream,SubtitleStream,SubtitleDelay,SubtitlesOn,Brightness,"
"Contrast,Gamma,VolumeAmplification,AudioDelay," "Contrast,Gamma,VolumeAmplification,AudioDelay,"
"ResumeTime," "ResumeTime,"
"Sharpness,NoiseReduction,NonLinStretch,PostProcess,ScalingMethod,StereoMode,StereoInvert,VideoStream,TonemapMethod,TonemapParam) " "Sharpness,NoiseReduction,NonLinStretch,PostProcess,ScalingMethod,StereoMode,StereoInvert,VideoStream,TonemapMethod,TonemapParam,Orientation) "
"VALUES "; "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, 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_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_Contrast, setting.m_Gamma, setting.m_VolumeAmplification, setting.m_AudioDelay,
setting.m_ResumeTime, setting.m_ResumeTime,
setting.m_Sharpness, setting.m_NoiseReduction, setting.m_CustomNonLinStretch, setting.m_PostProcess, setting.m_ScalingMethod, 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); m_pDS->exec(strSQL);
} }
} }
Expand Down Expand Up @@ -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 TonemapMethod integer");
m_pDS->exec("ALTER TABLE settings ADD TonemapParam float"); 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 int CVideoDatabase::GetSchemaVersion() const
{ {
return 110; return 111;
} }


bool CVideoDatabase::LookupByFolders(const std::string &path, bool shows) bool CVideoDatabase::LookupByFolders(const std::string &path, bool shows)
Expand Down
18 changes: 18 additions & 0 deletions xbmc/video/dialogs/GUIDialogVideoSettings.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#define SETTING_VIDEO_VERTICAL_SHIFT "video.verticalshift" #define SETTING_VIDEO_VERTICAL_SHIFT "video.verticalshift"
#define SETTING_VIDEO_TONEMAP_METHOD "video.tonemapmethod" #define SETTING_VIDEO_TONEMAP_METHOD "video.tonemapmethod"
#define SETTING_VIDEO_TONEMAP_PARAM "video.tonemapparam" #define SETTING_VIDEO_TONEMAP_PARAM "video.tonemapparam"
#define SETTING_VIDEO_ORIENTATION "video.orientation"


#define SETTING_VIDEO_VDPAU_NOISE "vdpau.noise" #define SETTING_VIDEO_VDPAU_NOISE "vdpau.noise"
#define SETTING_VIDEO_VDPAU_SHARPNESS "vdpau.sharpness" #define SETTING_VIDEO_VDPAU_SHARPNESS "vdpau.sharpness"
Expand Down Expand Up @@ -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()); vs.m_ToneMapParam = static_cast<float>(std::static_pointer_cast<const CSettingNumber>(setting)->GetValue());
g_application.GetAppPlayer().SetVideoSettings(vs); 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) else if (settingId == SETTING_VIDEO_STEREOSCOPICMODE)
{ {
CVideoSettings vs = g_application.GetAppPlayer().GetVideoSettings(); CVideoSettings vs = g_application.GetAppPlayer().GetVideoSettings();
Expand Down Expand Up @@ -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); 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)) 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); 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)) if (g_application.GetAppPlayer().Supports(RENDERFEATURE_POSTPROCESS))
AddToggle(groupVideo, SETTING_VIDEO_POSTPROCESS, 16400, SettingLevel::Basic, videoSettings.m_PostProcess); AddToggle(groupVideo, SETTING_VIDEO_POSTPROCESS, 16400, SettingLevel::Basic, videoSettings.m_PostProcess);
if (g_application.GetAppPlayer().Supports(RENDERFEATURE_BRIGHTNESS)) if (g_application.GetAppPlayer().Supports(RENDERFEATURE_BRIGHTNESS))
Expand Down Expand Up @@ -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::string CGUIDialogVideoSettings::FormatFlags(StreamFlags flags)
{ {
std::vector<std::string> localizedFlags; std::vector<std::string> localizedFlags;
Expand Down
2 changes: 2 additions & 0 deletions xbmc/video/dialogs/GUIDialogVideoSettings.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ class CGUIDialogVideoSettings : public CGUIDialogSettingsManualBase
void AddVideoStreams(std::shared_ptr<CSettingGroup> group, const std::string & settingId); 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 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); static std::string FormatFlags(StreamFlags flags);


// specialization of CGUIDialogSettingsBase // specialization of CGUIDialogSettingsBase
Expand Down

0 comments on commit 40bd3c3

Please sign in to comment.