...
This commit is contained in:
@@ -227,7 +227,7 @@ bool MediaAsset::loadVideoWithFFmpeg(int fd) {
|
||||
}
|
||||
width_ = codecCtx_->width;
|
||||
height_ = codecCtx_->height;
|
||||
swsCtx_ = sws_getContext(width_, height_, codecCtx_->pix_fmt, width_, height_, AV_PIX_FMT_RGBA, SWS_BILINEAR, nullptr, nullptr, nullptr);
|
||||
swsCtx_ = sws_getContext(width_, height_, codecCtx_->pix_fmt, width_, height_, AV_PIX_FMT_BGRA, SWS_BILINEAR, nullptr, nullptr, nullptr);
|
||||
if (!swsCtx_) {
|
||||
LOGE("Could not create SwsContext");
|
||||
release(); return false;
|
||||
@@ -265,7 +265,7 @@ bool MediaAsset::loadVideoWithFFmpeg(const std::string& path) {
|
||||
frame_ = av_frame_alloc(); packet_ = av_packet_alloc();
|
||||
if (!frame_ || !packet_) { release(); return false; }
|
||||
width_ = codecCtx_->width; height_ = codecCtx_->height;
|
||||
swsCtx_ = sws_getContext(width_, height_, codecCtx_->pix_fmt, width_, height_, AV_PIX_FMT_RGBA, SWS_BILINEAR, nullptr, nullptr, nullptr);
|
||||
swsCtx_ = sws_getContext(width_, height_, codecCtx_->pix_fmt, width_, height_, AV_PIX_FMT_BGRA, SWS_BILINEAR, nullptr, nullptr, nullptr);
|
||||
if (!swsCtx_) { release(); return false; }
|
||||
rgbBuffer_.resize(width_ * height_ * 4);
|
||||
LOGI("Successfully loaded video from path: %s", path.c_str());
|
||||
|
||||
@@ -252,7 +252,7 @@ void Renderer::renderFrame(ANativeWindow* window) {
|
||||
currentFrameDelay_ = std::chrono::milliseconds(static_cast<long long>(1000.0 / currentMedia_.getFps()));
|
||||
LOGI("Media type: Video. Frame delay set to %lldms for %.2f FPS", currentFrameDelay_.count(), currentMedia_.getFps());
|
||||
} else {
|
||||
currentFrameDelay_ = std::chrono::milliseconds(33); // 이미지일 경우 30fps
|
||||
currentFrameDelay_ = std::chrono::milliseconds(70); // 이미지일 경우 30fps
|
||||
LOGI("Media type: Image. Frame delay set to 33ms (~30 FPS)");
|
||||
}
|
||||
currentState_ = RenderState::ANIMATING;
|
||||
|
||||
@@ -93,7 +93,7 @@ Java_bums_lunatic_launcher_wall_NativeRenderer_nativeStartRenderLoop(JNIEnv* env
|
||||
LOGE("Could not get ANativeWindow from Surface.");
|
||||
return;
|
||||
}
|
||||
ANativeWindow_setBuffersGeometry(window, 0, 0, WINDOW_FORMAT_RGBA_8888);
|
||||
ANativeWindow_setBuffersGeometry(window, 0, 0, WINDOW_FORMAT_RGBX_8888);
|
||||
renderer->startRenderLoop(window);
|
||||
ANativeWindow_release(window);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user