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_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); ManageRenderArea(); m_bMMALConfigured = init_vout(format, m_opaque); m_bConfigured = m_bMMALConfigured; assert(m_bConfigured); return m_bConfigured; }
bool CWinRenderer::Configure(const VideoPicture &picture, float fps, unsigned flags, unsigned int orientation) { m_sourceWidth = picture.iWidth; m_sourceHeight = picture.iHeight; m_renderOrientation = orientation; // need to recreate textures m_NumYV12Buffers = 0; m_iYV12RenderBuffer = 0; // reinitialize the filters/shaders m_bFilterInitialized = false; m_fps = fps; m_iFlags = flags; m_format = picture.videoBuffer->GetFormat(); if (m_format == AV_PIX_FMT_D3D11VA_VLD) { DXVA::CDXVAOutputBuffer *dxvaBuf = static_cast<DXVA::CDXVAOutputBuffer*>(picture.videoBuffer); m_dxva_format = dxvaBuf->format; } // calculate the input frame aspect ratio CalculateFrameAspectRatio(picture.iDisplayWidth, picture.iDisplayHeight); SetViewMode(m_videoSettings.m_ViewMode); ManageRenderArea(); SelectRenderMethod(); m_bConfigured = true; // load 3DLUT ColorManagmentUpdate(); return true; }
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; }
bool CRendererMediaCodecSurface::Configure(const VideoPicture &picture, float fps, unsigned flags, unsigned int orientation) { CLog::Log(LOGNOTICE, "CRendererMediaCodecSurface::Configure"); m_sourceWidth = picture.iWidth; m_sourceHeight = picture.iHeight; m_renderOrientation = orientation; // Save the flags. m_iFlags = flags; // Calculate the input frame aspect ratio. CalculateFrameAspectRatio(picture.iDisplayWidth, picture.iDisplayHeight); SetViewMode(CMediaSettings::GetInstance().GetCurrentVideoSettings().m_ViewMode); return true; }
bool CRendererMediaCodecSurface::Configure(const VideoPicture &picture, float fps, unsigned int orientation) { CLog::Log(LOGNOTICE, "CRendererMediaCodecSurface::Configure"); m_sourceWidth = picture.iWidth; m_sourceHeight = picture.iHeight; m_renderOrientation = orientation; m_iFlags = GetFlagsChromaPosition(picture.chroma_position) | GetFlagsColorMatrix(picture.color_space, picture.iWidth, picture.iHeight) | GetFlagsColorPrimaries(picture.color_primaries) | GetFlagsStereoMode(picture.stereoMode); // Calculate the input frame aspect ratio. CalculateFrameAspectRatio(picture.iDisplayWidth, picture.iDisplayHeight); SetViewMode(m_videoSettings.m_ViewMode); return true; }
bool CRendererDRMPRIME::Configure(const VideoPicture& picture, float fps, unsigned int orientation) { m_format = picture.videoBuffer->GetFormat(); m_sourceWidth = picture.iWidth; m_sourceHeight = picture.iHeight; m_renderOrientation = orientation; m_iFlags = GetFlagsChromaPosition(picture.chroma_position) | GetFlagsColorMatrix(picture.color_space, picture.iWidth, picture.iHeight) | GetFlagsColorPrimaries(picture.color_primaries) | GetFlagsStereoMode(picture.stereoMode); // Calculate the input frame aspect ratio. CalculateFrameAspectRatio(picture.iDisplayWidth, picture.iDisplayHeight); SetViewMode(m_videoSettings.m_ViewMode); ManageRenderArea(); Reset(); m_bConfigured = true; 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) { 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; }
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]; }