refilter_on_resize

This commit is contained in:
Romain Vimont 2021-02-12 23:19:44 +01:00
parent 03cc0cf543
commit ba09254b38
3 changed files with 21 additions and 0 deletions

View file

@ -135,6 +135,7 @@ screen_generate_resized_frame(struct sc_frame_texture *ftex,
}
const AVFrame *input = ftex->decoded_frame;
assert(input);
int flags = to_sws_filter(ftex->scale_filter);
struct SwsContext *ctx =
@ -232,3 +233,15 @@ sc_frame_texture_update(struct sc_frame_texture *ftex, const AVFrame *frame,
}
return sc_frame_texture_update_direct(ftex, frame);
}
bool
sc_frame_texture_resize(struct sc_frame_texture *ftex,
struct size target_size) {
if (is_swscale_enabled(ftex->scale_filter)) {
return sc_frame_texture_update_swscale(ftex, ftex->decoded_frame,
target_size);
}
// Nothing to do
return true;
}

View file

@ -38,4 +38,7 @@ bool
sc_frame_texture_update(struct sc_frame_texture *ftex, const AVFrame *frame,
struct size target_size);
bool
sc_frame_texture_resize(struct sc_frame_texture *ftex, struct size target_size);
#endif

View file

@ -377,6 +377,11 @@ void
screen_render(struct screen *screen, bool update_content_rect) {
if (update_content_rect) {
screen_update_content_rect(screen);
struct size rect_size = {screen->rect.w, screen->rect.h};
if (!sc_frame_texture_resize(&screen->ftex, rect_size)) {
// FIXME return error
LOGC("oops");
}
}
struct sc_frame_texture *ftex = &screen->ftex;