bool CWinRenderer::Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height, float fps, unsigned flags) { if(m_sourceWidth != width || m_sourceHeight != height) { m_sourceWidth = width; m_sourceHeight = height; // need to recreate textures m_NumYV12Buffers = 0; m_iYV12RenderBuffer = 0; } m_flags = flags; // calculate the input frame aspect ratio CalculateFrameAspectRatio(d_width, d_height); ChooseBestResolution(fps); SetViewMode(g_settings.m_currentVideoSettings.m_ViewMode); ManageDisplay(); m_bConfigured = true; SelectRenderMethod(); UpdateRenderMethod(); return true; }
bool CMMALRenderer::Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height, float fps, unsigned flags, ERenderFormat format, unsigned extended_format, unsigned int orientation) { CSingleLock lock(m_sharedSection); ReleaseBuffers(); m_sourceWidth = width; m_sourceHeight = height; m_renderOrientation = orientation; m_fps = fps; m_iFlags = flags; CLog::Log(LOGDEBUG, "%s::%s - %dx%d->%dx%d@%.2f flags:%x format:%d ext:%x orient:%d", CLASSNAME, __func__, width, height, d_width, d_height, fps, flags, format, extended_format, orientation); m_RenderUpdateCallBackFn = NULL; m_RenderUpdateCallBackCtx = NULL; // calculate the input frame aspect ratio CalculateFrameAspectRatio(d_width, d_height); SetViewMode(CMediaSettings::GetInstance().GetCurrentVideoSettings().m_ViewMode); ManageDisplay(); m_bMMALConfigured = init_vout(format); m_bConfigured = m_bMMALConfigured; assert(m_bConfigured); return m_bConfigured; }
bool CMMALRenderer::Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height, float fps, unsigned flags, ERenderFormat format, unsigned extended_format, unsigned int orientation) { CSingleLock lock(m_sharedSection); ReleaseBuffers(); m_sourceWidth = width; m_sourceHeight = height; m_renderOrientation = orientation; m_fps = fps; m_iFlags = flags; // cause SetVideoRect to trigger - needed after a hdmi mode change m_src_rect.SetRect(0, 0, 0, 0); m_dst_rect.SetRect(0, 0, 0, 0); CLog::Log(LOGDEBUG, "%s::%s - %dx%d->%dx%d@%.2f flags:%x format:%d ext:%x orient:%d", CLASSNAME, __func__, width, height, d_width, d_height, fps, flags, format, extended_format, orientation); if (format != RENDER_FMT_YUV420P && format != RENDER_FMT_BYPASS && format != RENDER_FMT_MMAL) { CLog::Log(LOGERROR, "%s::%s - format:%d not supported", CLASSNAME, __func__, format); return false; } // calculate the input frame aspect ratio CalculateFrameAspectRatio(d_width, d_height); SetViewMode(CMediaSettings::GetInstance().GetCurrentVideoSettings().m_ViewMode); ManageDisplay(); m_bMMALConfigured = init_vout(format); m_bConfigured = m_bMMALConfigured; assert(m_bConfigured); return m_bConfigured; }
void CWinRenderer::Update(bool bPauseDrawing) { if (!m_bConfigured) return; CSingleLock lock(g_graphicsContext); ManageDisplay(); ManageTextures(); }
bool CWinRenderer::Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height, float fps, unsigned flags) { m_fps = fps; m_iSourceWidth = width; m_iSourceHeight = height; // calculate the input frame aspect ratio CalculateFrameAspectRatio(d_width, d_height); ChooseBestResolution(m_fps); SetViewMode(g_stSettings.m_currentVideoSettings.m_ViewMode); ManageDisplay(); return true; }
void CWinRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) { if (!m_YUVTexture[m_iYV12RenderBuffer][0]) return ; CSingleLock lock(g_graphicsContext); ManageDisplay(); ManageTextures(); if (clear) m_pD3DDevice->Clear( 0L, NULL, D3DCLEAR_TARGET, m_clearColour, 1.0f, 0L ); if(alpha < 255) m_pD3DDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE ); else m_pD3DDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE ); Render(flags); }
void CWinRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) { LPDIRECT3DDEVICE9 pD3DDevice = g_Windowing.Get3DDevice(); if (clear) pD3DDevice->Clear( 0L, NULL, D3DCLEAR_TARGET, m_clearColour, 1.0f, 0L ); if(alpha < 255) pD3DDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE ); else pD3DDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE ); if (!m_bConfigured) return; ManageTextures(); CSingleLock lock(g_graphicsContext); ManageDisplay(); Render(flags); }
bool CMMALRenderer::Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height, float fps, unsigned flags, ERenderFormat format, unsigned extended_format, unsigned int orientation) { ReleaseBuffers(); m_sourceWidth = width; m_sourceHeight = height; m_renderOrientation = orientation; m_fps = fps; m_iFlags = flags; m_format = format; CLog::Log(LOGDEBUG, "%s::%s - %dx%d->%dx%d@%.2f flags:%x format:%d ext:%x orient:%d", CLASSNAME, __func__, width, height, d_width, d_height, fps, flags, format, extended_format, orientation); m_RenderUpdateCallBackFn = NULL; m_RenderUpdateCallBackCtx = NULL; // calculate the input frame aspect ratio CalculateFrameAspectRatio(d_width, d_height); ChooseBestResolution(fps); m_destWidth = g_graphicsContext.GetResInfo(m_resolution).iWidth; m_destHeight = g_graphicsContext.GetResInfo(m_resolution).iHeight; SetViewMode(CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode); ManageDisplay(); if (m_format == RENDER_FMT_MMAL|| m_format == RENDER_FMT_YUV420P) { MMAL_ES_FORMAT_T *es_format = mmal_format_alloc(); es_format->type = MMAL_ES_TYPE_VIDEO; es_format->es->video.crop.width = m_sourceWidth; es_format->es->video.crop.height = m_sourceHeight; if (m_format == RENDER_FMT_MMAL) { es_format->encoding = MMAL_ENCODING_OPAQUE; es_format->es->video.width = m_sourceWidth; es_format->es->video.height = m_sourceHeight; } else if (m_format == RENDER_FMT_YUV420P) { const int pitch = ALIGN_UP(m_sourceWidth, 32); const int aligned_height = ALIGN_UP(m_sourceHeight, 16); es_format->encoding = MMAL_ENCODING_I420; es_format->es->video.width = pitch; es_format->es->video.height = aligned_height; if (CONF_FLAGS_YUVCOEF_MASK(m_iFlags) == CONF_FLAGS_YUVCOEF_BT709) es_format->es->video.color_space = MMAL_COLOR_SPACE_ITUR_BT709; else if (CONF_FLAGS_YUVCOEF_MASK(m_iFlags) == CONF_FLAGS_YUVCOEF_BT601) es_format->es->video.color_space = MMAL_COLOR_SPACE_ITUR_BT601; else if (CONF_FLAGS_YUVCOEF_MASK(m_iFlags) == CONF_FLAGS_YUVCOEF_240M) es_format->es->video.color_space = MMAL_COLOR_SPACE_SMPTE240M; } if (m_bConfigured) UnInitMMAL(); m_bConfigured = init_vout(es_format); mmal_format_free(es_format); } else m_bConfigured = true; return m_bConfigured; }
void CWinRenderer::Update(bool bPauseDrawing) { if (!m_bConfigured) return; ManageDisplay(); }
bool CLinuxRenderer::Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height, float fps, unsigned flags) { CLog::Log(LOGDEBUG,"CLinuxRenderer::Configure - w: %d, h: %d, dw: %d, dh: %d, fps: %4.2f", width, height, d_width, d_height, fps); m_fps = fps; m_iSourceWidth = width; m_iSourceHeight = height; // calculate the input frame aspect ratio CalculateFrameAspectRatio(d_width, d_height); ChooseBestResolution(m_fps); SetViewMode(g_stSettings.m_currentVideoSettings.m_ViewMode); ManageDisplay(); #ifdef USE_SDL_OVERLAY m_screen = g_graphicsContext.getScreenSurface()->SDL(); if (m_overlay && (m_overlay->w != width || m_overlay->h != height)) { SDL_FreeYUVOverlay(m_overlay); m_overlay = NULL; } if (m_overlay == NULL && m_screen != NULL) { m_overlay = SDL_CreateYUVOverlay(width, height, SDL_YV12_OVERLAY, m_screen); if (m_overlay == NULL) { CLog::Log(LOGERROR, "CLinuxRenderer::Configure - failed to create YUV overlay. w: %d, h: %d", width, height); return false; } } if (m_image.plane[0] == NULL) { m_image.stride[0] = m_overlay->pitches[0]; m_image.stride[1] = m_overlay->pitches[1]; m_image.stride[2] = m_overlay->pitches[2]; m_image.plane[0] = m_overlay->pixels[0]; m_image.plane[1] = m_overlay->pixels[1]; m_image.plane[2] = m_overlay->pixels[2]; } #else if (m_backbuffer && (m_backbuffer->w != (int)width || m_backbuffer->h != (int)height)) { SDL_FreeSurface(m_backbuffer); m_backbuffer=NULL; for (int p=0;p<MAX_PLANES;p++) { if (m_image.plane[p]) delete [] m_image.plane[p]; m_image.plane[p]=NULL; } } if (m_screenbuffer && (m_screenbuffer->w != (int)width || m_screenbuffer->h != (int)height)) { SDL_FreeSurface(m_screenbuffer); m_screenbuffer=NULL; #ifdef HAS_SDL_OPENGL if (m_texture) delete m_texture; m_texture=NULL; #endif } if (m_backbuffer == NULL) m_backbuffer = SDL_CreateRGBSurface(SDL_HWSURFACE, width, height, 32, RMASK, GMASK, BMASK, AMASK);; if (m_screenbuffer == NULL) m_screenbuffer = SDL_CreateRGBSurface(SDL_HWSURFACE, width, height, 32, RMASK, GMASK, BMASK, AMASK);; if (m_image.plane[0] == NULL) { m_image.stride[0] = m_iSourceWidth; m_image.stride[1] = m_iSourceWidth>>1; m_image.stride[2] = m_iSourceWidth>>1; m_image.plane[0] = new BYTE[m_image.stride[0] * height]; if (m_image.plane[1]) delete [] m_image.plane[1]; m_image.plane[1] = new BYTE[m_image.stride[1] * height]; if (m_image.plane[2]) delete [] m_image.plane[2]; m_image.plane[2] = new BYTE[m_image.stride[2] * height]; }
bool CRendererIMX::RenderUpdateVideoHook(bool clear, DWORD flags, DWORD alpha) { #if 0 static unsigned long long previous = 0; unsigned long long current = XbmcThreads::SystemClockMillis(); printf("r->r: %d\n", (int)(current-previous)); previous = current; #endif CDVDVideoCodecIMXBuffer *buffer = m_buffers[m_iYV12RenderBuffer].IMXBuffer; if (buffer != NULL && buffer->IsValid()) { // this hack is needed to get the 2D mode of a 3D movie going RENDER_STEREO_MODE stereo_mode = g_graphicsContext.GetStereoMode(); if (stereo_mode) g_graphicsContext.SetStereoView(RENDER_STEREO_VIEW_LEFT); ManageDisplay(); if (stereo_mode) g_graphicsContext.SetStereoView(RENDER_STEREO_VIEW_OFF); CRect dstRect(m_destRect); CRect srcRect(m_sourceRect); switch (stereo_mode) { case RENDER_STEREO_MODE_SPLIT_HORIZONTAL: dstRect.y2 *= 2.0; srcRect.y2 *= 2.0; break; case RENDER_STEREO_MODE_SPLIT_VERTICAL: dstRect.x2 *= 2.0; srcRect.x2 *= 2.0; break; default: break; } //CLog::Log(LOGDEBUG, "BLIT RECTS: source x1 %f x2 %f y1 %f y2 %f dest x1 %f x2 %f y1 %f y2 %f", srcRect.x1, srcRect.x2, srcRect.y1, srcRect.y2, dstRect.x1, dstRect.x2, dstRect.y1, dstRect.y2); g_IMXContext.SetBlitRects(srcRect, dstRect); bool topFieldFirst = true; // Deinterlacing requested if (flags & RENDER_FLAG_FIELDMASK) { if ((buffer->GetFieldType() == VPU_FIELD_BOTTOM) || (buffer->GetFieldType() == VPU_FIELD_BT) ) topFieldFirst = false; if (flags & RENDER_FLAG_FIELD0) { // Double rate first frame g_IMXContext.SetDeInterlacing(true); g_IMXContext.SetDoubleRate(true); g_IMXContext.SetInterpolatedFrame(true); } else if (flags & RENDER_FLAG_FIELD1) { // Double rate second frame g_IMXContext.SetDeInterlacing(true); g_IMXContext.SetDoubleRate(true); g_IMXContext.SetInterpolatedFrame(false); } else { // Fast motion g_IMXContext.SetDeInterlacing(true); g_IMXContext.SetDoubleRate(false); } } // Progressive else g_IMXContext.SetDeInterlacing(false); g_IMXContext.BlitAsync(NULL, buffer, topFieldFirst); } #if 0 unsigned long long current2 = XbmcThreads::SystemClockMillis(); printf("r: %d %d\n", m_iYV12RenderBuffer, (int)(current2-current)); #endif return true; }