mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-30 05:17:19 +00:00
FIX: ffmpeg swscale & frame_size
Change-Id: I9f4cb8c739b726f7e5cdbe0df7ed06b2eb2154d5 Jira: STUDIO-7624 (cherry picked from commit 5a2c75d835fb437667b590a803eef148baa30875)
This commit is contained in:
@@ -79,7 +79,7 @@ bool AVVideoDecoder::toWxImage(wxImage &image, wxSize const &size2)
|
|||||||
sws_ctx_ = sws_getCachedContext(sws_ctx_,
|
sws_ctx_ = sws_getCachedContext(sws_ctx_,
|
||||||
frame_->width, frame_->height, AVPixelFormat(frame_->format),
|
frame_->width, frame_->height, AVPixelFormat(frame_->format),
|
||||||
size.GetWidth(), size.GetHeight(), wxFmt,
|
size.GetWidth(), size.GetHeight(), wxFmt,
|
||||||
SWS_POINT, // SWS_FAST_BILINEAR //SWS_BICUBIC
|
SWS_GAUSS,
|
||||||
nullptr, nullptr, nullptr);
|
nullptr, nullptr, nullptr);
|
||||||
int length = size.GetWidth() * size.GetHeight() * 3;
|
int length = size.GetWidth() * size.GetHeight() * 3;
|
||||||
if (bits_.size() < length)
|
if (bits_.size() < length)
|
||||||
@@ -108,7 +108,7 @@ bool AVVideoDecoder::toWxBitmap(wxBitmap &bitmap, wxSize const &size2)
|
|||||||
sws_ctx_ = sws_getCachedContext(sws_ctx_,
|
sws_ctx_ = sws_getCachedContext(sws_ctx_,
|
||||||
frame_->width, frame_->height, AVPixelFormat(frame_->format),
|
frame_->width, frame_->height, AVPixelFormat(frame_->format),
|
||||||
size.GetWidth(), size.GetHeight(), wxFmt,
|
size.GetWidth(), size.GetHeight(), wxFmt,
|
||||||
SWS_POINT, // SWS_FAST_BILINEAR //SWS_BICUBIC
|
SWS_GAUSS,
|
||||||
nullptr, nullptr, nullptr);
|
nullptr, nullptr, nullptr);
|
||||||
int length = size.GetWidth() * size.GetHeight() * 4;
|
int length = size.GetWidth() * size.GetHeight() * 4;
|
||||||
if (bits_.size() < length)
|
if (bits_.size() < length)
|
||||||
|
|||||||
@@ -139,6 +139,8 @@ void wxMediaCtrl3::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
wxWindow::DoSetSize(x, y, width, height, sizeFlags);
|
wxWindow::DoSetSize(x, y, width, height, sizeFlags);
|
||||||
if (sizeFlags & wxSIZE_USE_EXISTING) return;
|
if (sizeFlags & wxSIZE_USE_EXISTING) return;
|
||||||
wxMediaCtrl_OnSize(this, m_video_size, width, height);
|
wxMediaCtrl_OnSize(this, m_video_size, width, height);
|
||||||
|
std::unique_lock<std::mutex> lk(m_mutex);
|
||||||
|
adjust_frame_size(m_frame_size, m_video_size, GetSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMediaCtrl3::bambu_log(void *ctx, int level, tchar const *msg2)
|
void wxMediaCtrl3::bambu_log(void *ctx, int level, tchar const *msg2)
|
||||||
@@ -232,10 +234,11 @@ void wxMediaCtrl3::PlayThread()
|
|||||||
error = 1;
|
error = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
auto frame_size = m_frame_size;
|
||||||
lk.unlock();
|
lk.unlock();
|
||||||
wxBitmap bm;
|
wxBitmap bm;
|
||||||
decoder.decode(sample);
|
decoder.decode(sample);
|
||||||
decoder.toWxBitmap(bm, m_frame_size);
|
decoder.toWxBitmap(bm, frame_size);
|
||||||
lk.lock();
|
lk.lock();
|
||||||
if (bm.IsOk())
|
if (bm.IsOk())
|
||||||
m_frame = bm;
|
m_frame = bm;
|
||||||
|
|||||||
Reference in New Issue
Block a user