uint8_t externalEncoder::startPass2(void) { if (_openPass) _plugin->finishPass(_plugin->encoderId); return startPass(); }
uint8_t externalEncoder::configure(AVDMGenericVideoStream *instream, int useExistingLogFile) { ADV_Info *info; info = instream->getInfo(); _w = info->width; _h = info->height; _vbuffer = new ADMImage (_w, _h); ADM_assert(_vbuffer); _in = instream; _useExistingLogFile = useExistingLogFile; vidEncVideoProperties properties; memset(&properties, 0, sizeof(vidEncVideoProperties)); properties.structSize = sizeof(vidEncVideoProperties); properties.width = _w; properties.height = _h; properties.parWidth = instream->getPARWidth(); properties.parHeight = instream->getPARHeight(); properties.frameCount = info->nb_frames; properties.fpsNum = info->fps1000; properties.fpsDen = 1000; if (_globalHeader) properties.flags |= ADM_VIDENC_FLAG_GLOBAL_HEADER; if (_plugin->open(_plugin->encoderId, &properties)) { int64_t pixFmtMask = 0; for (int i = 0; i < properties.supportedCspsCount; i++) pixFmtMask |= (1 << getAvCodecColourspace(properties.supportedCsps[i])); _pixFmt = avcodec_find_best_pix_fmt(pixFmtMask, PIX_FMT_YUV420P, 0, NULL); if (_pixFmt != PIX_FMT_YUV420P) { AVPicture resamplePicture; _swsContext = sws_getContext( properties.width, properties.height, PIX_FMT_YUV420P, properties.width, properties.height, _pixFmt, SWS_SPLINE, NULL, NULL, NULL); _resampleSize = avpicture_fill(&resamplePicture, NULL, _pixFmt, properties.width, properties.height); _resampleBuffer = new uint8_t[_resampleSize]; } printf("[externalEncoder] Target colourspace: %s\n", _pixFmt == PIX_FMT_YUV420P ? "yv12" : avcodec_get_pix_fmt_name(_pixFmt)); return (startPass() == ADM_VIDENC_ERR_SUCCESS); } else return 0; }
void renderFrame(){ startPass(); RenderEngine::Instance().clear(); drawPlanets(); endPass(); GUI::Instance().draw(); glError; // LogDebug << camera->position.x() << camera->position.y() << camera->position.z(); // LogDebug << camera->yaw << camera->pitch << camera->roll; }