1
mirror of https://github.com/mpv-player/mpv synced 2024-10-02 16:25:33 +02:00
mpv/filters/f_swscale.h
wm4 c99d95ac17 vf_format: add gross mechanism for forcing scaler for testing
This sucks, but is helpful for testing.

Obviously, it would be much nicer if there were a way to specify _all_
scaler options per filter (if the user wanted), instead of always using
the global options. But this is "too hard" for now. For testing, it is
extremely convenient to select the scaler backend, so add this option,
but make clear that it could go away. We'd delete it once there is a
better mechanism for this.
2020-04-13 15:56:27 +02:00

35 lines
1.2 KiB
C

#pragma once
#include <stdbool.h>
#include "video/mp_image.h"
#include "video/sws_utils.h"
struct mp_sws_filter {
struct mp_filter *f;
// Desired output imgfmt. If 0, uses the input format.
int out_format;
// If set, force all image params; ignores out_format.
bool use_out_params;
struct mp_image_params out_params;
// Other options.
enum mp_sws_scaler force_scaler;
// private state
struct mp_sws_context *sws;
struct mp_image_pool *pool;
};
// Create the filter. Free it with talloc_free(mp_sws_filter.f).
struct mp_sws_filter *mp_sws_filter_create(struct mp_filter *parent);
// Return the best format based on the input format and a list of allowed output
// formats. This tries to set the output format to the one that will result in
// the least loss. Returns a format from out_formats[], or 0 if no format could
// be chosen (or it's not supported by libswscale).
int mp_sws_find_best_out_format(struct mp_sws_filter *sws,
int in_format, int *out_formats,
int num_out_formats);
// Whether the given format is supported as input format.
bool mp_sws_supports_input(int imgfmt);