mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-08-06 04:47:16 +08:00
FIX: ffmpeg swscale & frame_size
Change-Id: I9f4cb8c739b726f7e5cdbe0df7ed06b2eb2154d5 Jira: STUDIO-7624
This commit is contained in:
parent
b7f8fa1efd
commit
5a2c75d835
@ -79,7 +79,7 @@ bool AVVideoDecoder::toWxImage(wxImage &image, wxSize const &size2)
|
||||
sws_ctx_ = sws_getCachedContext(sws_ctx_,
|
||||
frame_->width, frame_->height, AVPixelFormat(frame_->format),
|
||||
size.GetWidth(), size.GetHeight(), wxFmt,
|
||||
SWS_POINT, // SWS_FAST_BILINEAR //SWS_BICUBIC
|
||||
SWS_GAUSS,
|
||||
nullptr, nullptr, nullptr);
|
||||
int length = size.GetWidth() * size.GetHeight() * 3;
|
||||
if (bits_.size() < length)
|
||||
@ -108,7 +108,7 @@ bool AVVideoDecoder::toWxBitmap(wxBitmap &bitmap, wxSize const &size2)
|
||||
sws_ctx_ = sws_getCachedContext(sws_ctx_,
|
||||
frame_->width, frame_->height, AVPixelFormat(frame_->format),
|
||||
size.GetWidth(), size.GetHeight(), wxFmt,
|
||||
SWS_POINT, // SWS_FAST_BILINEAR //SWS_BICUBIC
|
||||
SWS_GAUSS,
|
||||
nullptr, nullptr, nullptr);
|
||||
int length = size.GetWidth() * size.GetHeight() * 4;
|
||||
if (bits_.size() < length)
|
||||
|
@ -62,7 +62,7 @@ MediaPlayCtrl::MediaPlayCtrl(wxWindow *parent, wxMediaCtrl2 *media_ctrl, const w
|
||||
m_media_ctrl->Bind(EVT_MEDIA_CTRL_STAT, [this](auto & e) {
|
||||
#if !BBL_RELEASE_TO_PUBLIC
|
||||
wxSize size = m_media_ctrl->GetVideoSize();
|
||||
m_label_stat->SetLabel(e.GetString() + wxString::Format(" VS:%ix%i LD:%i", size.x, size.y, m_load_duration));
|
||||
m_label_stat->SetLabel(e.GetString() + wxString::Format(" VS:%ix%i IDLE:%i", size.x, size.y, SecondsSinceLastInput()));
|
||||
#endif
|
||||
wxString str = e.GetString();
|
||||
m_stat.clear();
|
||||
|
@ -139,6 +139,8 @@ void wxMediaCtrl3::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
wxWindow::DoSetSize(x, y, width, height, sizeFlags);
|
||||
if (sizeFlags & wxSIZE_USE_EXISTING) return;
|
||||
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)
|
||||
@ -232,10 +234,11 @@ void wxMediaCtrl3::PlayThread()
|
||||
error = 1;
|
||||
break;
|
||||
}
|
||||
auto frame_size = m_frame_size;
|
||||
lk.unlock();
|
||||
wxBitmap bm;
|
||||
decoder.decode(sample);
|
||||
decoder.toWxBitmap(bm, m_frame_size);
|
||||
decoder.toWxBitmap(bm, frame_size);
|
||||
lk.lock();
|
||||
if (bm.IsOk())
|
||||
m_frame = bm;
|
||||
|
Loading…
x
Reference in New Issue
Block a user