aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavilla <davilla@xbmc.org>2012-09-10 09:45:49 -0700
committerdavilla <davilla@xbmc.org>2012-09-10 09:45:49 -0700
commita49e5c0fc2330c7743c92e26d998da372ca46cd6 (patch)
tree2398c0dace6f206e8c92fc0eb33499e0131d7ae9
parenta7a9db340f0d7adf54b695c403f44fd6d0105488 (diff)
parent6c94a0b8b63e2a9cb5abf20ff7fb14aa73ad4354 (diff)
Merge pull request #1405 from popcornmix/master
[rbp] Fixes to handle zoom modes and anamorphic videos
-rw-r--r--xbmc/cores/omxplayer/OMXPlayerVideo.cpp24
-rw-r--r--xbmc/cores/omxplayer/OMXPlayerVideo.h1
-rw-r--r--xbmc/cores/omxplayer/OMXVideo.cpp35
3 files changed, 47 insertions, 13 deletions
diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp
index 72ddc35801..9888b726b8 100644
--- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp
+++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp
@@ -90,11 +90,11 @@ OMXPlayerVideo::OMXPlayerVideo(OMXClock *av_clock,
m_flags = 0;
m_bAllowFullscreen = false;
m_iCurrentPts = DVD_NOPTS_VALUE;
- m_fFrameRate = 25.0f;
m_iVideoDelay = 0;
m_droptime = 0.0;
m_dropbase = 0.0;
m_autosync = 1;
+ m_fForcedAspectRatio = 0.0f;
m_messageQueue.SetMaxDataSize(10 * 1024 * 1024);
m_messageQueue.SetMaxTimeSize(8.0);
@@ -343,8 +343,14 @@ void OMXPlayerVideo::Output(int iGroupId, double pts, bool bDropPacket)
CLog::Log(LOGDEBUG,"%s - change configuration. %dx%d. framerate: %4.2f. format: BYPASS",
__FUNCTION__, m_width, m_height, m_fps);
- if(!g_renderManager.Configure(m_video_width, m_video_height,
- m_video_width, m_video_height, m_fps, flags, format, 0,
+ unsigned int iDisplayWidth = m_hints.width;
+ unsigned int iDisplayHeight = m_hints.height;
+ /* use forced aspect if any */
+ if( m_fForcedAspectRatio != 0.0f )
+ iDisplayWidth = (int) (iDisplayHeight * m_fForcedAspectRatio);
+
+ if(!g_renderManager.Configure(m_hints.width, m_hints.height,
+ iDisplayWidth, iDisplayHeight, m_fps, flags, format, 0,
m_hints.orientation))
{
CLog::Log(LOGERROR, "%s - failed to configure renderer", __FUNCTION__);
@@ -542,6 +548,11 @@ void OMXPlayerVideo::Process()
Sleep(1);
}
}
+ else if (pMsg->IsType(CDVDMsg::VIDEO_SET_ASPECT))
+ {
+ CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::VIDEO_SET_ASPECT");
+ m_fForcedAspectRatio = *((CDVDMsgDouble*)pMsg);
+ }
else if (pMsg->IsType(CDVDMsg::GENERAL_RESET))
{
CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_RESET");
@@ -682,6 +693,11 @@ bool OMXPlayerVideo::OpenDecoder()
CLog::Log(LOGINFO, "OMXPlayerVideo::OpenDecoder : Invalid framerate %d, using forced 25fps and just trust timestamps\n", (int)m_fFrameRate);
m_fFrameRate = 25;
}
+ // use aspect in stream if available
+ if (m_hints.forced_aspect)
+ m_fForcedAspectRatio = m_hints.aspect;
+ else
+ m_fForcedAspectRatio = 0.0;
m_av_clock->Lock();
m_av_clock->OMXStop(false);
@@ -805,7 +821,7 @@ void OMXPlayerVideo::SetVideoRect(const CRect &SrcRect, const CRect &DestRect)
dst_rect.y2 *= yscale;
}
- if(!(m_flags & CONF_FLAGS_FORMAT_SBS) && !!(m_flags & CONF_FLAGS_FORMAT_TB))
+ if(!(m_flags & CONF_FLAGS_FORMAT_SBS) && !(m_flags & CONF_FLAGS_FORMAT_TB))
m_omxVideo.SetVideoRect(SrcRect, m_dst_rect);
}
diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.h b/xbmc/cores/omxplayer/OMXPlayerVideo.h
index c0dc44d780..ebc770e7d9 100644
--- a/xbmc/cores/omxplayer/OMXPlayerVideo.h
+++ b/xbmc/cores/omxplayer/OMXPlayerVideo.h
@@ -69,6 +69,7 @@ protected:
bool m_bRenderSubs;
bool m_bAllowFullscreen;
+ float m_fForcedAspectRatio;
unsigned int m_width;
unsigned int m_height;
unsigned int m_video_width;
diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp
index 0ae2230d8c..c91cfca75a 100644
--- a/xbmc/cores/omxplayer/OMXVideo.cpp
+++ b/xbmc/cores/omxplayer/OMXVideo.cpp
@@ -889,17 +889,34 @@ void COMXVideo::SetVideoRect(const CRect& SrcRect, const CRect& DestRect)
OMX_CONFIG_DISPLAYREGIONTYPE configDisplay;
OMX_INIT_STRUCTURE(configDisplay);
configDisplay.nPortIndex = m_omx_render.GetInputPort();
+ float sx1 = SrcRect.x1, sy1 = SrcRect.y1, sx2 = SrcRect.x2, sy2 = SrcRect.y2;
+ float dx1 = DestRect.x1, dy1 = DestRect.y1, dx2 = DestRect.x2, dy2 = DestRect.y2;
+ float sw = SrcRect.Width() / DestRect.Width();
+ float sh = SrcRect.Height() / DestRect.Height();
- configDisplay.set = OMX_DISPLAY_SET_FULLSCREEN;
- configDisplay.fullscreen = OMX_FALSE;
-
- m_omx_render.SetConfig(OMX_IndexConfigDisplayRegion, &configDisplay);
+ // doesn't like negative coordinates on dest_rect. So adjust by increasing src_rect
+ if (dx1 < 0.0f) {
+ sx1 -= dx1 * sw;
+ dx1 -= dx1;
+ }
+ if (dy1 < 0.0f) {
+ sy1 -= dy1 * sh;
+ dy1 -= dy1;
+ }
- configDisplay.set = OMX_DISPLAY_SET_DEST_RECT;
- configDisplay.dest_rect.x_offset = DestRect.x1;
- configDisplay.dest_rect.y_offset = DestRect.y1;
- configDisplay.dest_rect.width = DestRect.Width();
- configDisplay.dest_rect.height = DestRect.Height();
+ configDisplay.fullscreen = OMX_FALSE;
+ configDisplay.noaspect = OMX_TRUE;
+
+ configDisplay.set = (OMX_DISPLAYSETTYPE)(OMX_DISPLAY_SET_DEST_RECT|OMX_DISPLAY_SET_SRC_RECT|OMX_DISPLAY_SET_FULLSCREEN|OMX_DISPLAY_SET_NOASPECT);
+ configDisplay.dest_rect.x_offset = (int)(dx1+0.5f);
+ configDisplay.dest_rect.y_offset = (int)(dy1+0.5f);
+ configDisplay.dest_rect.width = (int)(dx2-dx1+0.5f);
+ configDisplay.dest_rect.height = (int)(dy2-dy1+0.5f);
+
+ configDisplay.src_rect.x_offset = (int)(sx1+0.5f);
+ configDisplay.src_rect.y_offset = (int)(sy1+0.5f);
+ configDisplay.src_rect.width = (int)(sx2-sx1+0.5f);
+ configDisplay.src_rect.height = (int)(sy2-sy1+0.5f);
m_omx_render.SetConfig(OMX_IndexConfigDisplayRegion, &configDisplay);