mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-03-19 12:30:55 +08:00
Add proportional scaling (720p) for the player at startup (#4567)
This commit is contained in:
@@ -26,7 +26,7 @@ void AudioSRC::setOutputAudioConfig(const SDL_AudioSpec &cfg) {
|
||||
int format = _delegate->getPCMFormat();
|
||||
int channels = _delegate->getPCMChannel();
|
||||
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 info, "
|
||||
|
||||
@@ -135,16 +135,27 @@ public:
|
||||
}
|
||||
bool displayYUV(AVFrame *pFrame){
|
||||
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) {
|
||||
_win = SDL_CreateWindowFrom(_hwnd);
|
||||
}else {
|
||||
_win = SDL_CreateWindow(_title.data(),
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
pFrame->width,
|
||||
pFrame->height,
|
||||
SDL_WINDOW_OPENGL);
|
||||
w,
|
||||
h,
|
||||
SDL_WINDOW_OPENGL |SDL_WINDOW_RESIZABLE | SDL_WINDOW_SHOWN); // 允许最大化
|
||||
}
|
||||
SDL_SetWindowInputFocus(_win);
|
||||
SDL_RaiseWindow(_win);
|
||||
// SDL_GL_SetSwapInterval(1); // 1 ,“开启垂直同步”就是让程序“等显示器”,以牺牲一点延迟换取画面完整无撕裂。
|
||||
|
||||
}
|
||||
if (_win && ! _render){
|
||||
#if 0
|
||||
|
||||
Reference in New Issue
Block a user