diff options
author | wm4 <wm4@nowhere> | 2018-01-28 10:08:45 +0100 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2018-01-30 03:10:27 -0800 |
commit | 6d36fad83c779936a012e85a1eb92ec94651c7c0 (patch) | |
tree | 76762208837d18545a4a315be890d7bffad7e47f /filters/frame.c | |
parent | eaced0ebb03a078394ed01bcbe641b5b7a4312aa (diff) | |
download | mpv-6d36fad83c779936a012e85a1eb92ec94651c7c0.tar.bz2 mpv-6d36fad83c779936a012e85a1eb92ec94651c7c0.tar.xz |
video: make decoder wrapper a filter
Move dec_video.c to filters/f_decoder_wrapper.c. It essentially becomes
a source filter. vd.h mostly disappears, because mp_filter takes care of
the dataflow, but its remains are in struct mp_decoder_fns.
One goal is to simplify dataflow by letting the filter framework handle
it (or more accurately, using its conventions). One result is that the
decode calls disappear from video.c, because we simply connect the
decoder wrapper and the filter chain with mp_pin_connect().
Another goal is to eventually remove the code duplication between the
audio and video paths for this. This commit prepares for this by trying
to make f_decoder_wrapper.c extensible, so it can be used for audio as
well later.
Decoder framedropping changes a bit. It doesn't seem to be worse than
before, and it's an obscure feature, so I'm content with its new state.
Some special code that was apparently meant to avoid dropping too many
frames in a row is removed, though.
I'm not sure how the source code tree should be organized. For one,
video/decode/vd_lavc.c is the only file in its directory, which is a bit
annoying.
Diffstat (limited to 'filters/frame.c')
-rw-r--r-- | filters/frame.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/filters/frame.c b/filters/frame.c index 6c5b28e77a..f1d4c98eab 100644 --- a/filters/frame.c +++ b/filters/frame.c @@ -2,6 +2,7 @@ #include "audio/aframe.h" #include "common/av_common.h" +#include "demux/packet.h" #include "video/mp_image.h" #include "frame.h" @@ -11,7 +12,6 @@ struct frame_handler { bool is_data; bool is_signaling; void *(*new_ref)(void *data); - // The following must be non-NULL if new_ref is non-NULL. double (*get_pts)(void *data); void (*set_pts)(void *data, double pts); AVFrame *(*new_av_ref)(void *data); @@ -69,6 +69,11 @@ static void *audio_from_av_ref(AVFrame *data) return mp_aframe_from_avframe(data); } +static void *packet_ref(void *data) +{ + return demux_copy_packet(data); +} + static const struct frame_handler frame_handlers[] = { [MP_FRAME_NONE] = { .name = "none", @@ -97,6 +102,12 @@ static const struct frame_handler frame_handlers[] = { .from_av_ref = audio_from_av_ref, .free = talloc_free, }, + [MP_FRAME_PACKET] = { + .name = "packet", + .is_data = true, + .new_ref = packet_ref, + .free = talloc_free, + }, }; const char *mp_frame_type_str(enum mp_frame_type t) |