Add proportional scaling (720p) for the player at startup (#4567)
Some checks are pending
Android / build (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
Docker / build (push) Waiting to run
Linux / build (push) Waiting to run
macOS / build (push) Waiting to run
Windows / build (push) Waiting to run

This commit is contained in:
PioLing 2025-11-27 10:56:43 +08:00 committed by GitHub
parent b1f55ec402
commit 2cf386d45a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 4 deletions

View File

@ -26,7 +26,7 @@ void AudioSRC::setOutputAudioConfig(const SDL_AudioSpec &cfg) {
int format = _delegate->getPCMFormat(); int format = _delegate->getPCMFormat();
int channels = _delegate->getPCMChannel(); int channels = _delegate->getPCMChannel();
if (-1 == SDL_BuildAudioCVT(&_audio_cvt, format, channels, freq, cfg.format, cfg.channels, cfg.freq)) { if (-1 == SDL_BuildAudioCVT(&_audio_cvt, format, channels, freq, cfg.format, cfg.channels, cfg.freq)) {
throw std::runtime_error("the format conversion is not supported"); throw std::runtime_error("the format conversion is not supported, " + string(SDL_GetError()));
} }
InfoL << "audio cvt origin format, freq:" << freq << ", format:" << hex << format << dec << ", channels:" << channels; InfoL << "audio cvt origin format, freq:" << freq << ", format:" << hex << format << dec << ", channels:" << channels;
InfoL << "audio cvt info, " InfoL << "audio cvt info, "

View File

@ -135,16 +135,27 @@ public:
} }
bool displayYUV(AVFrame *pFrame){ bool displayYUV(AVFrame *pFrame){
if (!_win) { if (!_win) {
int w, h;
double hw = 0.0f;
w = pFrame->width;
h = pFrame->height;
hw = (double)h / (double)w;
w = 720;
h = w * hw;
if (_hwnd) { if (_hwnd) {
_win = SDL_CreateWindowFrom(_hwnd); _win = SDL_CreateWindowFrom(_hwnd);
}else { }else {
_win = SDL_CreateWindow(_title.data(), _win = SDL_CreateWindow(_title.data(),
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
pFrame->width, w,
pFrame->height, h,
SDL_WINDOW_OPENGL); SDL_WINDOW_OPENGL |SDL_WINDOW_RESIZABLE | SDL_WINDOW_SHOWN); // 允许最大化
} }
SDL_SetWindowInputFocus(_win);
SDL_RaiseWindow(_win);
// SDL_GL_SetSwapInterval(1); // 1 ,“开启垂直同步”就是让程序“等显示器”,以牺牲一点延迟换取画面完整无撕裂。
} }
if (_win && ! _render){ if (_win && ! _render){
#if 0 #if 0