2010-01-30 16:57:40 +00:00
|
|
|
/*
|
2015-04-13 07:36:54 +00:00
|
|
|
* This file is part of mpv.
|
2010-01-30 16:57:40 +00:00
|
|
|
*
|
vf.c, vf.h: change license to LGPL
Most authors have agreed. Like with vo.c, we don't take module
declarations into consideration (see 0e09533c73dc0).
Notable issues:
115bfb9762: the author has (probably) not agreed. The vf.c changes were
removed with the removal of filter DR, though (see c54fc507da8e).
7b25afd742: the same author adds VOCTRLs for deinterlacing switching at
runtime. Put them under a HAVE_GPL ifdef just to be sure. (It looks like
we could remove the VOCTRLs immediately, as they're needed only for some
compatibility things, but no need to do that yet.)
02b199e5e9: the author had a conditional agreement to LGPL, which
doesn't allow us to change it just yet, but the code added here was
completely removed anyway. (These days, the pts is passed as mp_image
field, and put_image is gone.)
3532cd532e: same author, but code removed with DR removal.
f0626e2f8d: same author, but code was moved to mp_image.c.
e5b4b495c3: agreed to LGPLv3+ only, but the code was removed in
cfa1f9e082 anyway.
086c324692: author was not asked - minor warning fix, but no mpv
includes malloc.h anymore.
e9d0a1d609: author was not asked - removed again in 33b62af947.
c260a1139d: author could not be reached - but this code was removed when
mpv changed the image allocation code to essentially use FFmpeg's
pixdesc.
2017-05-11 12:44:46 +00:00
|
|
|
* mpv is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2010-01-30 16:57:40 +00:00
|
|
|
*
|
2015-04-13 07:36:54 +00:00
|
|
|
* mpv is distributed in the hope that it will be useful,
|
2010-01-30 16:57:40 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
vf.c, vf.h: change license to LGPL
Most authors have agreed. Like with vo.c, we don't take module
declarations into consideration (see 0e09533c73dc0).
Notable issues:
115bfb9762: the author has (probably) not agreed. The vf.c changes were
removed with the removal of filter DR, though (see c54fc507da8e).
7b25afd742: the same author adds VOCTRLs for deinterlacing switching at
runtime. Put them under a HAVE_GPL ifdef just to be sure. (It looks like
we could remove the VOCTRLs immediately, as they're needed only for some
compatibility things, but no need to do that yet.)
02b199e5e9: the author had a conditional agreement to LGPL, which
doesn't allow us to change it just yet, but the code added here was
completely removed anyway. (These days, the pts is passed as mp_image
field, and put_image is gone.)
3532cd532e: same author, but code removed with DR removal.
f0626e2f8d: same author, but code was moved to mp_image.c.
e5b4b495c3: agreed to LGPLv3+ only, but the code was removed in
cfa1f9e082 anyway.
086c324692: author was not asked - minor warning fix, but no mpv
includes malloc.h anymore.
e9d0a1d609: author was not asked - removed again in 33b62af947.
c260a1139d: author could not be reached - but this code was removed when
mpv changed the image allocation code to essentially use FFmpeg's
pixdesc.
2017-05-11 12:44:46 +00:00
|
|
|
* GNU Lesser General Public License for more details.
|
2010-01-30 16:57:40 +00:00
|
|
|
*
|
vf.c, vf.h: change license to LGPL
Most authors have agreed. Like with vo.c, we don't take module
declarations into consideration (see 0e09533c73dc0).
Notable issues:
115bfb9762: the author has (probably) not agreed. The vf.c changes were
removed with the removal of filter DR, though (see c54fc507da8e).
7b25afd742: the same author adds VOCTRLs for deinterlacing switching at
runtime. Put them under a HAVE_GPL ifdef just to be sure. (It looks like
we could remove the VOCTRLs immediately, as they're needed only for some
compatibility things, but no need to do that yet.)
02b199e5e9: the author had a conditional agreement to LGPL, which
doesn't allow us to change it just yet, but the code added here was
completely removed anyway. (These days, the pts is passed as mp_image
field, and put_image is gone.)
3532cd532e: same author, but code removed with DR removal.
f0626e2f8d: same author, but code was moved to mp_image.c.
e5b4b495c3: agreed to LGPLv3+ only, but the code was removed in
cfa1f9e082 anyway.
086c324692: author was not asked - minor warning fix, but no mpv
includes malloc.h anymore.
e9d0a1d609: author was not asked - removed again in 33b62af947.
c260a1139d: author could not be reached - but this code was removed when
mpv changed the image allocation code to essentially use FFmpeg's
pixdesc.
2017-05-11 12:44:46 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
|
2010-01-30 16:57:40 +00:00
|
|
|
*/
|
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#ifndef MPLAYER_VF_H
|
|
|
|
#define MPLAYER_VF_H
|
2002-04-06 22:05:01 +00:00
|
|
|
|
2012-11-09 00:06:43 +00:00
|
|
|
#include <stdbool.h>
|
2008-03-06 08:34:50 +00:00
|
|
|
|
2012-11-09 00:06:43 +00:00
|
|
|
#include "video/mp_image.h"
|
2013-12-17 01:39:45 +00:00
|
|
|
#include "common/common.h"
|
2012-11-09 00:06:43 +00:00
|
|
|
|
2008-04-16 04:06:44 +00:00
|
|
|
struct MPOpts;
|
2013-12-21 16:43:25 +00:00
|
|
|
struct mpv_global;
|
2008-04-24 02:49:44 +00:00
|
|
|
struct vf_instance;
|
2002-04-06 22:05:01 +00:00
|
|
|
struct vf_priv_s;
|
2013-12-07 18:32:44 +00:00
|
|
|
struct m_obj_settings;
|
2002-04-06 22:05:01 +00:00
|
|
|
|
2010-10-30 04:18:49 +00:00
|
|
|
typedef struct vf_info {
|
2013-10-23 17:06:42 +00:00
|
|
|
const char *description;
|
2002-04-06 22:05:01 +00:00
|
|
|
const char *name;
|
2013-12-03 23:01:38 +00:00
|
|
|
int (*open)(struct vf_instance *vf);
|
options: use m_config for options instead of m_struct
For some reason, both m_config and m_struct are somewhat similar, except
that m_config is much more powerful. m_config is used for VOs and some
other things, so to unify them. We plan to kick out m_struct and use
m_config for everything. (Unfortunately, m_config is also a bit more
bloated, so this commit isn't all that great, but it will allow to
reduce the option parser mess somewhat.)
This commit also switches all video filters to use the option macros.
One reason is that m_struct and m_config, even though they both use
m_option, store the offsets of the option fields differently (sigh...),
meaning the options defined for either are incompatible. It's easier to
switch everything in one go.
This commit will allow using the -vf option parser for other things,
like VOs and AOs.
2013-07-21 17:33:08 +00:00
|
|
|
int priv_size;
|
|
|
|
const void *priv_defaults;
|
|
|
|
const struct m_option *options;
|
2013-12-21 19:04:49 +00:00
|
|
|
void (*print_help)(struct mp_log *log);
|
video: remove d3d11 video processor use from OpenGL interop
We now have a video filter that uses the d3d11 video processor, so it
makes no sense to have one in the VO interop code. The VO uses it for
formats not directly supported by ANGLE (so the video data is converted
to a RGB texture, which ANGLE can take in).
Change this so that the video filter is automatically inserted if
needed. Move the code that maps RGB surfaces to its own inteorp backend.
Add a bunch of new image formats, which are used to enforce the new
constraints, and to automatically insert the filter only when needed.
The added vf mechanism to auto-insert the d3d11vpp filter is very dumb
and primitive, and will work only for this specific purpose. The format
negotiation mechanism in the filter chain is generally not very pretty,
and mostly broken as well. (libavfilter has a different mechanism, and
these mechanisms don't match well, so vf_lavfi uses some sort of hack.
It only works because hwaccel and non-hwaccel formats are strictly
separated.)
The RGB interop is now only used with older ANGLE versions. The only
reason I'm keeping it is because it's relatively isolated (uses only
existing mechanisms and adds no new concepts), and because I want to be
able to compare the behavior of the old code with the new one for
testing. It will be removed eventually.
If ANGLE has NV12 interop, P010 is now handled by converting to NV12
with the video processor, instead of converting it to RGB and using the
old mechanism to import that as a texture.
2016-05-29 15:13:22 +00:00
|
|
|
bool (*test_conversion)(int in, int out);
|
2002-04-06 22:05:01 +00:00
|
|
|
} vf_info_t;
|
|
|
|
|
2008-04-24 02:49:44 +00:00
|
|
|
typedef struct vf_instance {
|
2011-11-03 13:21:53 +00:00
|
|
|
const vf_info_t *info;
|
2017-05-31 15:42:03 +00:00
|
|
|
char *full_name;
|
2013-06-07 23:35:44 +00:00
|
|
|
|
2013-12-07 18:35:55 +00:00
|
|
|
// Initialize the filter. The filter must set *out to the same image
|
|
|
|
// params as the images the filter functions will return for the given
|
|
|
|
// *in format.
|
|
|
|
// Note that by default, only formats reported as supported by query_format
|
|
|
|
// will be allowed for *in.
|
|
|
|
// Returns >= 0 on success, < 0 on error.
|
|
|
|
int (*reconfig)(struct vf_instance *vf, struct mp_image_params *in,
|
|
|
|
struct mp_image_params *out);
|
2013-06-07 23:35:44 +00:00
|
|
|
|
2011-11-03 13:21:53 +00:00
|
|
|
int (*control)(struct vf_instance *vf, int request, void *data);
|
|
|
|
int (*query_format)(struct vf_instance *vf, unsigned int fmt);
|
video/filter: change filter API, use refcounting, remove filter DR
Change the entire filter API to use reference counted images instead
of vf_get_image().
Remove filter "direct rendering". This was useful for vf_expand and (in
rare cases) vf_sub: DR allowed these filters to pass a cropped image to
the filters before them. Then, on filtering, the image was "uncropped",
so that black bars could be added around the image without copying. This
means that in some cases, vf_expand will be slower (-vf gradfun,expand
for example).
Note that another form of DR used for in-place filters has been replaced
by simpler logic. Instead of trying to do DR, filters can check if the
image is writeable (with mp_image_is_writeable()), and do true in-place
if that's the case. This affects filters like vf_gradfun and vf_sub.
Everything has to support strides now. If something doesn't, making a
copy of the image data is required.
2012-11-05 13:25:04 +00:00
|
|
|
|
|
|
|
// Filter mpi and return the result. The input mpi reference is owned by
|
|
|
|
// the filter, the returned reference is owned by the caller.
|
|
|
|
// Return NULL if the output frame is skipped.
|
|
|
|
struct mp_image *(*filter)(struct vf_instance *vf, struct mp_image *mpi);
|
|
|
|
|
|
|
|
// Like filter(), but can return an error code ( >= 0 means success). This
|
|
|
|
// callback is also more practical when the filter can return multiple
|
|
|
|
// output images. Use vf_add_output_frame() to queue output frames.
|
video: don't drop last frame when deinterlacing with yadif
Or in other words, add support for properly draining remaining frames
from video filters. vf_yadif is buffering at least one frame, and the
buffered frame was not retrieved on EOF.
For most filters, ignore this for now, and just adjust them to the
changed semantics of filter_ext. But for vf_lavfi (used by vf_yadif),
real support is implemented. libavfilter handles this simply by passing
a NULL frame to av_buffersrc_add_frame(), so we just have to make
mp_to_av() handle NULL arguments.
In load_next_vo_frame(), we first try to output a frame buffered in the
VO, then the filter, and then (if EOF is reached and there's still no
new frame) the VO again, with draining enabled. I guess this was
implemented slightly incorrectly before, because the filter chain still
could have had remaining output frames.
2014-04-28 17:44:35 +00:00
|
|
|
// Warning: this is called with mpi==NULL if there is no more input at
|
|
|
|
// all (i.e. the video has reached end of file condition). This
|
|
|
|
// can be used to output delayed or otherwise remaining images.
|
video/filter: change filter API, use refcounting, remove filter DR
Change the entire filter API to use reference counted images instead
of vf_get_image().
Remove filter "direct rendering". This was useful for vf_expand and (in
rare cases) vf_sub: DR allowed these filters to pass a cropped image to
the filters before them. Then, on filtering, the image was "uncropped",
so that black bars could be added around the image without copying. This
means that in some cases, vf_expand will be slower (-vf gradfun,expand
for example).
Note that another form of DR used for in-place filters has been replaced
by simpler logic. Instead of trying to do DR, filters can check if the
image is writeable (with mp_image_is_writeable()), and do true in-place
if that's the case. This affects filters like vf_gradfun and vf_sub.
Everything has to support strides now. If something doesn't, making a
copy of the image data is required.
2012-11-05 13:25:04 +00:00
|
|
|
int (*filter_ext)(struct vf_instance *vf, struct mp_image *mpi);
|
|
|
|
|
2014-09-18 17:25:46 +00:00
|
|
|
// Produce an output frame. This is called after filter or filter_ext.
|
|
|
|
// You can add 0 or more frames with vf_add_output_frame(). (This allows
|
|
|
|
// distributing the filter load over time -> typically add at most 1 frame.)
|
|
|
|
// If this adds no frame (or is NULL), then the caller assumes that the
|
|
|
|
// filter needs new input.
|
|
|
|
// Return a negative value on error. (No more frames is not an error.)
|
|
|
|
// May be called multiple times, even if the filter gives no output.
|
|
|
|
int (*filter_out)(struct vf_instance *vf);
|
|
|
|
|
2015-01-03 02:01:58 +00:00
|
|
|
// Optional function that checks whether the filter needs additional
|
|
|
|
// input. This is for filters with asynchronous behavior: they filter
|
|
|
|
// frames in the background, and to get good pipelining behavior, new
|
|
|
|
// data should be fed, even if the playback core doesn't need any yet.
|
|
|
|
bool (*needs_input)(struct vf_instance *vf);
|
|
|
|
|
2010-05-29 14:15:55 +00:00
|
|
|
void (*uninit)(struct vf_instance *vf);
|
2006-07-06 06:58:17 +00:00
|
|
|
|
2013-05-22 21:19:57 +00:00
|
|
|
char *label;
|
2014-04-20 23:26:56 +00:00
|
|
|
bool autoinserted;
|
2013-05-22 21:19:57 +00:00
|
|
|
|
2013-12-07 18:33:11 +00:00
|
|
|
struct mp_image_params fmt_in, fmt_out;
|
video/filter: change filter API, use refcounting, remove filter DR
Change the entire filter API to use reference counted images instead
of vf_get_image().
Remove filter "direct rendering". This was useful for vf_expand and (in
rare cases) vf_sub: DR allowed these filters to pass a cropped image to
the filters before them. Then, on filtering, the image was "uncropped",
so that black bars could be added around the image without copying. This
means that in some cases, vf_expand will be slower (-vf gradfun,expand
for example).
Note that another form of DR used for in-place filters has been replaced
by simpler logic. Instead of trying to do DR, filters can check if the
image is writeable (with mp_image_is_writeable()), and do true in-place
if that's the case. This affects filters like vf_gradfun and vf_sub.
Everything has to support strides now. If something doesn't, making a
copy of the image data is required.
2012-11-05 13:25:04 +00:00
|
|
|
|
video: support filtering hardware frames via libavfilter
Requires a bunch of hacks:
- we access AVFilterLink.hw_frames_ctx. This is not a public API in
FFmpeg and Libav. Newer FFmpeg provides an accessor
(av_buffersink_get_hw_frames_ctx), but it's not available in Libav or
the current FFmpeg release or Libav. We need this value after filter
graph creation, so We have no choice but to access this.
One alternative is making filter creation and format negotiation
fully lazy (i.e. delay it and do it as filters are output), but this
would be a huge change.
So for now, we knowingly violate FFmpeg's and Libav's ABI and API
constraints because they don't provide anything better.
On newer FFmpeg, we use the (quite ugly) accessor, though.
- mp_image_params doesn't (and can't) have a field for the frames
context AVBufferRef. So we pass it via vf_set_proto_frame(), and even
more hacks.
- if a filter needs a hw context, but we haven't created one yet
(because normally we create them lazily), it will fail at init.
- we allow any hw format now, although this could go horrible wrong.
Why all this effort? We could move hw deinterlacing filters etc. to
FFmpeg, which is a very worthy goal.
2017-01-16 14:52:13 +00:00
|
|
|
// This is a dirty hack.
|
|
|
|
struct AVBufferRef *in_hwframes_ref, *out_hwframes_ref;
|
|
|
|
|
video/filter: change filter API, use refcounting, remove filter DR
Change the entire filter API to use reference counted images instead
of vf_get_image().
Remove filter "direct rendering". This was useful for vf_expand and (in
rare cases) vf_sub: DR allowed these filters to pass a cropped image to
the filters before them. Then, on filtering, the image was "uncropped",
so that black bars could be added around the image without copying. This
means that in some cases, vf_expand will be slower (-vf gradfun,expand
for example).
Note that another form of DR used for in-place filters has been replaced
by simpler logic. Instead of trying to do DR, filters can check if the
image is writeable (with mp_image_is_writeable()), and do true in-place
if that's the case. This affects filters like vf_gradfun and vf_sub.
Everything has to support strides now. If something doesn't, making a
copy of the image data is required.
2012-11-05 13:25:04 +00:00
|
|
|
struct mp_image_pool *out_pool;
|
2011-11-03 13:21:53 +00:00
|
|
|
struct vf_priv_s *priv;
|
2013-12-21 16:43:25 +00:00
|
|
|
struct mp_log *log;
|
2016-05-09 17:42:03 +00:00
|
|
|
struct mp_hwdec_devices *hwdec_devs;
|
video/filter: change filter API, use refcounting, remove filter DR
Change the entire filter API to use reference counted images instead
of vf_get_image().
Remove filter "direct rendering". This was useful for vf_expand and (in
rare cases) vf_sub: DR allowed these filters to pass a cropped image to
the filters before them. Then, on filtering, the image was "uncropped",
so that black bars could be added around the image without copying. This
means that in some cases, vf_expand will be slower (-vf gradfun,expand
for example).
Note that another form of DR used for in-place filters has been replaced
by simpler logic. Instead of trying to do DR, filters can check if the
image is writeable (with mp_image_is_writeable()), and do true in-place
if that's the case. This affects filters like vf_gradfun and vf_sub.
Everything has to support strides now. If something doesn't, making a
copy of the image data is required.
2012-11-05 13:25:04 +00:00
|
|
|
|
|
|
|
struct mp_image **out_queued;
|
|
|
|
int num_out_queued;
|
2013-12-07 18:32:44 +00:00
|
|
|
|
2013-12-07 18:35:55 +00:00
|
|
|
// Caches valid output formats.
|
|
|
|
uint8_t last_outfmts[IMGFMT_END - IMGFMT_START];
|
|
|
|
|
2014-06-10 20:41:14 +00:00
|
|
|
struct vf_chain *chain;
|
2013-12-07 18:33:11 +00:00
|
|
|
struct vf_instance *next;
|
2002-04-06 22:05:01 +00:00
|
|
|
} vf_instance_t;
|
|
|
|
|
2013-12-07 18:32:44 +00:00
|
|
|
// A chain of video filters
|
|
|
|
struct vf_chain {
|
|
|
|
int initialized; // 0: no, 1: yes, -1: attempted to, but failed
|
|
|
|
|
2013-12-10 18:24:58 +00:00
|
|
|
struct vf_instance *first, *last;
|
|
|
|
|
2014-05-01 16:47:07 +00:00
|
|
|
struct mp_image_params input_params;
|
2013-12-10 18:24:58 +00:00
|
|
|
struct mp_image_params output_params;
|
|
|
|
uint8_t allowed_output_formats[IMGFMT_END - IMGFMT_START];
|
2013-12-07 18:32:44 +00:00
|
|
|
|
2015-01-03 02:37:05 +00:00
|
|
|
double container_fps;
|
2015-02-08 23:05:09 +00:00
|
|
|
double display_fps;
|
2015-01-03 02:37:05 +00:00
|
|
|
|
2013-12-21 16:43:25 +00:00
|
|
|
struct mp_log *log;
|
2013-12-07 18:32:44 +00:00
|
|
|
struct MPOpts *opts;
|
2013-12-21 16:43:25 +00:00
|
|
|
struct mpv_global *global;
|
2016-05-09 17:42:03 +00:00
|
|
|
struct mp_hwdec_devices *hwdec_devs;
|
2015-01-03 02:01:58 +00:00
|
|
|
|
video: support filtering hardware frames via libavfilter
Requires a bunch of hacks:
- we access AVFilterLink.hw_frames_ctx. This is not a public API in
FFmpeg and Libav. Newer FFmpeg provides an accessor
(av_buffersink_get_hw_frames_ctx), but it's not available in Libav or
the current FFmpeg release or Libav. We need this value after filter
graph creation, so We have no choice but to access this.
One alternative is making filter creation and format negotiation
fully lazy (i.e. delay it and do it as filters are output), but this
would be a huge change.
So for now, we knowingly violate FFmpeg's and Libav's ABI and API
constraints because they don't provide anything better.
On newer FFmpeg, we use the (quite ugly) accessor, though.
- mp_image_params doesn't (and can't) have a field for the frames
context AVBufferRef. So we pass it via vf_set_proto_frame(), and even
more hacks.
- if a filter needs a hw context, but we haven't created one yet
(because normally we create them lazily), it will fail at init.
- we allow any hw format now, although this could go horrible wrong.
Why all this effort? We could move hw deinterlacing filters etc. to
FFmpeg, which is a very worthy goal.
2017-01-16 14:52:13 +00:00
|
|
|
// This is a dirty hack.
|
|
|
|
struct AVBufferRef *in_hwframes_ref;
|
|
|
|
|
2015-01-03 02:01:58 +00:00
|
|
|
// Call when the filter chain wants new processing (for filters with
|
|
|
|
// asynchronous behavior) - must be immutable once filters are created,
|
|
|
|
// since they are supposed to call it from foreign threads.
|
|
|
|
void (*wakeup_callback)(void *ctx);
|
|
|
|
void *wakeup_callback_ctx;
|
2013-12-07 18:32:44 +00:00
|
|
|
};
|
|
|
|
|
2013-10-02 19:19:16 +00:00
|
|
|
enum vf_ctrl {
|
|
|
|
VFCTRL_SEEK_RESET = 1, // reset on picture and PTS discontinuities
|
2014-04-13 14:04:23 +00:00
|
|
|
VFCTRL_GET_METADATA, // Get frame metadata from lavfi filters (e.g., cropdetect)
|
2013-10-02 19:19:16 +00:00
|
|
|
/* Hack to make the OSD state object available to vf_sub which
|
|
|
|
* access OSD/subtitle state outside of normal OSD draw time. */
|
2015-06-05 16:59:13 +00:00
|
|
|
VFCTRL_INIT_OSD,
|
2016-01-22 15:18:28 +00:00
|
|
|
VFCTRL_COMMAND,
|
2013-10-02 19:19:16 +00:00
|
|
|
};
|
2002-04-11 15:41:40 +00:00
|
|
|
|
2013-12-21 16:43:25 +00:00
|
|
|
struct vf_chain *vf_new(struct mpv_global *global);
|
2013-12-07 18:32:44 +00:00
|
|
|
void vf_destroy(struct vf_chain *c);
|
video: support filtering hardware frames via libavfilter
Requires a bunch of hacks:
- we access AVFilterLink.hw_frames_ctx. This is not a public API in
FFmpeg and Libav. Newer FFmpeg provides an accessor
(av_buffersink_get_hw_frames_ctx), but it's not available in Libav or
the current FFmpeg release or Libav. We need this value after filter
graph creation, so We have no choice but to access this.
One alternative is making filter creation and format negotiation
fully lazy (i.e. delay it and do it as filters are output), but this
would be a huge change.
So for now, we knowingly violate FFmpeg's and Libav's ABI and API
constraints because they don't provide anything better.
On newer FFmpeg, we use the (quite ugly) accessor, though.
- mp_image_params doesn't (and can't) have a field for the frames
context AVBufferRef. So we pass it via vf_set_proto_frame(), and even
more hacks.
- if a filter needs a hw context, but we haven't created one yet
(because normally we create them lazily), it will fail at init.
- we allow any hw format now, although this could go horrible wrong.
Why all this effort? We could move hw deinterlacing filters etc. to
FFmpeg, which is a very worthy goal.
2017-01-16 14:52:13 +00:00
|
|
|
void vf_set_proto_frame(struct vf_chain *c, struct mp_image *img);
|
2016-01-13 23:18:31 +00:00
|
|
|
int vf_reconfig(struct vf_chain *c, const struct mp_image_params *params);
|
2013-12-07 18:32:44 +00:00
|
|
|
int vf_control_any(struct vf_chain *c, int cmd, void *arg);
|
2014-04-13 14:00:11 +00:00
|
|
|
int vf_control_by_label(struct vf_chain *c, int cmd, void *arg, bstr label);
|
2013-12-07 18:32:44 +00:00
|
|
|
int vf_filter_frame(struct vf_chain *c, struct mp_image *img);
|
2014-05-01 17:29:17 +00:00
|
|
|
int vf_output_frame(struct vf_chain *c, bool eof);
|
2015-01-03 02:01:58 +00:00
|
|
|
int vf_needs_input(struct vf_chain *c);
|
2014-05-01 17:29:17 +00:00
|
|
|
struct mp_image *vf_read_output_frame(struct vf_chain *c);
|
2016-08-18 18:37:25 +00:00
|
|
|
void vf_unread_output_frame(struct vf_chain *c, struct mp_image *img);
|
2013-12-07 18:32:44 +00:00
|
|
|
void vf_seek_reset(struct vf_chain *c);
|
|
|
|
struct vf_instance *vf_append_filter(struct vf_chain *c, const char *name,
|
|
|
|
char **args);
|
2014-04-20 21:53:59 +00:00
|
|
|
void vf_remove_filter(struct vf_chain *c, struct vf_instance *vf);
|
2013-12-07 18:32:44 +00:00
|
|
|
int vf_append_filter_list(struct vf_chain *c, struct m_obj_settings *list);
|
|
|
|
struct vf_instance *vf_find_by_label(struct vf_chain *c, const char *label);
|
2014-05-04 14:07:43 +00:00
|
|
|
void vf_print_filter_chain(struct vf_chain *c, int msglevel,
|
|
|
|
struct vf_instance *vf);
|
2013-12-07 18:32:44 +00:00
|
|
|
|
2016-01-22 15:18:28 +00:00
|
|
|
int vf_send_command(struct vf_chain *c, char *label, char *cmd, char *arg);
|
|
|
|
|
2013-12-07 18:32:44 +00:00
|
|
|
// Filter internal API
|
video/filter: change filter API, use refcounting, remove filter DR
Change the entire filter API to use reference counted images instead
of vf_get_image().
Remove filter "direct rendering". This was useful for vf_expand and (in
rare cases) vf_sub: DR allowed these filters to pass a cropped image to
the filters before them. Then, on filtering, the image was "uncropped",
so that black bars could be added around the image without copying. This
means that in some cases, vf_expand will be slower (-vf gradfun,expand
for example).
Note that another form of DR used for in-place filters has been replaced
by simpler logic. Instead of trying to do DR, filters can check if the
image is writeable (with mp_image_is_writeable()), and do true in-place
if that's the case. This affects filters like vf_gradfun and vf_sub.
Everything has to support strides now. If something doesn't, making a
copy of the image data is required.
2012-11-05 13:25:04 +00:00
|
|
|
struct mp_image *vf_alloc_out_image(struct vf_instance *vf);
|
video: introduce failure path for image allocations
Until now, failure to allocate image data resulted in a crash (i.e.
abort() was called). This was intentional, because it's pretty silly to
degrade playback, and in almost all situations, the OOM will probably
kill you anyway. (And then there's the standard Linux overcommit
behavior, which also will kill you at some point.)
But I changed my opinion, so here we go. This change does not affect
_all_ memory allocations, just image data. Now in most failure cases,
the output will just be skipped. For video filters, this coincidentally
means that failure is treated as EOF (because the playback core assumes
EOF if nothing comes out of the video filter chain). In other
situations, output might be in some way degraded, like skipping frames,
not scaling OSD, and such.
Functions whose return values changed semantics:
mp_image_alloc
mp_image_new_copy
mp_image_new_ref
mp_image_make_writeable
mp_image_setrefp
mp_image_to_av_frame_and_unref
mp_image_from_av_frame
mp_image_new_external_ref
mp_image_new_custom_ref
mp_image_pool_make_writeable
mp_image_pool_get
mp_image_pool_new_copy
mp_vdpau_mixed_frame_create
vf_alloc_out_image
vf_make_out_image_writeable
glGetWindowScreenshot
2014-06-17 20:43:43 +00:00
|
|
|
bool vf_make_out_image_writeable(struct vf_instance *vf, struct mp_image *img);
|
video/filter: change filter API, use refcounting, remove filter DR
Change the entire filter API to use reference counted images instead
of vf_get_image().
Remove filter "direct rendering". This was useful for vf_expand and (in
rare cases) vf_sub: DR allowed these filters to pass a cropped image to
the filters before them. Then, on filtering, the image was "uncropped",
so that black bars could be added around the image without copying. This
means that in some cases, vf_expand will be slower (-vf gradfun,expand
for example).
Note that another form of DR used for in-place filters has been replaced
by simpler logic. Instead of trying to do DR, filters can check if the
image is writeable (with mp_image_is_writeable()), and do true in-place
if that's the case. This affects filters like vf_gradfun and vf_sub.
Everything has to support strides now. If something doesn't, making a
copy of the image data is required.
2012-11-05 13:25:04 +00:00
|
|
|
void vf_add_output_frame(struct vf_instance *vf, struct mp_image *img);
|
|
|
|
|
2002-04-06 22:05:01 +00:00
|
|
|
// default wrappers:
|
2010-05-29 14:15:55 +00:00
|
|
|
int vf_next_query_format(struct vf_instance *vf, unsigned int fmt);
|
2002-04-06 22:05:01 +00:00
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#endif /* MPLAYER_VF_H */
|