int AndroidVideoOutput::InitScaler (AVStream *vstream) { if (mpImgConvertCtx) { sws_freeContext (mpImgConvertCtx); mpImgConvertCtx = NULL; } #if 0 if (iVideoDisplayWidth <= 0 || iVideoDisplayHeight <= 0) { ERROR ("video display size is invalid! width=%d, height=%d", iVideoDisplayWidth, iVideoDisplayHeight); return -1; } #endif if (vstream == NULL) { ERROR ("vstream == NULL!"); return -1; } AVCodecContext *codecCtx = vstream->codec; if (codecCtx == NULL) { ERROR ("error! codecCtx == NULL!"); return -1; } int width = 0, height = 0; width = codecCtx->width; height = codecCtx->height; SetFrameSize (width, height); SetDisplaySize (width, height); SwsContext *img_convert_ctx = sws_getContext (width, height, codecCtx->pix_fmt, iVideoDisplayWidth, iVideoDisplayHeight, PIX_FMT_RGB565, SWS_BICUBIC, NULL, NULL, NULL); if (img_convert_ctx == NULL) { ERROR ("img_convert_ctx == NULL!"); } mpImgConvertCtx = img_convert_ctx; return 0; }
//Init the renderer bool CRenderer::Init(int w, int h) { if(!SetDisplaySize(w, h)) return false; GLInit(); frameTimer.Start(); return true; }
void CSampleDialogScrollHelper::SetDisplaySize(CRect rect) { SetDisplaySize(rect.Width(), rect.Height()); }