1
mirror of https://github.com/mpv-player/mpv synced 2024-10-30 04:46:41 +01:00
mpv/video/sws_utils.h
wm4 03cf150ff3 video: redo video equalizer option handling
I really wouldn't care much about this, but some parts of the core code
are under HAVE_GPL, so there's some need to get rid of it. Simply turn
the video equalizer from its current fine-grained handling with vf/vo
fallbacks into global options. This makes updating them much simpler.

This removes any possibility of applying video equalizers in filters,
which affects vf_scale, and the previously removed vf_eq. Not a big
loss, since the preferred VOs have this builtin.

Remove video equalizer handling from vo_direct3d, vo_sdl, vo_vaapi, and
vo_xv. I'm not going to waste my time on these legacy VOs.

vo.eq_opts_cache exists _only_ to send a VOCTRL_SET_EQUALIZER, which
exists _only_ to trigger a redraw. This seems silly, but for now I feel
like this is less of a pain. The rest of the equalizer using code is
self-updating.

See commit 96b906a51d for how some video equalizer code was GPL only.
Some command line option names and ranges can probably be traced back to
a GPL only committer, but we don't consider these copyrightable.
2017-08-22 17:01:35 +02:00

64 lines
1.9 KiB
C

#ifndef MPLAYER_SWS_UTILS_H
#define MPLAYER_SWS_UTILS_H
#include <stdbool.h>
#include "mp_image.h"
struct mp_image;
struct sws_opts;
// libswscale currently requires 16 bytes alignment for row pointers and
// strides. Otherwise, it will print warnings and use slow codepaths.
// Guaranteed to be a power of 2 and > 1.
#define SWS_MIN_BYTE_ALIGN 16
extern const int mp_sws_hq_flags;
extern const int mp_sws_fast_flags;
bool mp_sws_supported_format(int imgfmt);
int mp_image_swscale(struct mp_image *dst, struct mp_image *src,
int my_sws_flags);
int mp_image_sw_blur_scale(struct mp_image *dst, struct mp_image *src,
float gblur);
struct mp_sws_context {
// Can be set for verbose error printing.
struct mp_log *log;
// User configuration. These can be changed freely, at any time.
// mp_sws_scale() will handle the changes transparently.
int flags;
int brightness, contrast, saturation;
bool force_reload;
// These are also implicitly set by mp_sws_scale(), and thus optional.
// Setting them before that call makes sense when using mp_sws_reinit().
struct mp_image_params src, dst;
// Changing these requires setting force_reload=true.
// By default, they are NULL.
// Freeing the mp_sws_context will deallocate these if set.
struct SwsFilter *src_filter, *dst_filter;
double params[2];
// Cached context (if any)
struct SwsContext *sws;
bool supports_csp;
// Contains parameters for which sws is valid
struct mp_sws_context *cached;
};
struct mp_sws_context *mp_sws_alloc(void *talloc_ctx);
int mp_sws_reinit(struct mp_sws_context *ctx);
void mp_sws_set_from_cmdline(struct mp_sws_context *ctx, struct sws_opts *opts);
int mp_sws_scale(struct mp_sws_context *ctx, struct mp_image *dst,
struct mp_image *src);
struct mp_image *mp_img_swap_to_native(struct mp_image *img);
#endif /* MP_SWS_UTILS_H */
// vim: ts=4 sw=4 et tw=80