aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2018-04-07 13:05:25 +0200
committerGravatar Jan Ekström <jeebjp@gmail.com>2018-04-15 23:11:33 +0300
commit4b48966d87d7759346f989c44e8ab3cb405d0037 (patch)
tree9bddee88c693bb038655a06e27d5d93f8e094cd9
parent66810c155030883231cbfed3a83093e21c69d9b8 (diff)
f_autoconvert: be less clever about running specific codepaths
This tried to avoid running the audio/video functions depending on whether any of the audio or video related format restrictions were called (so the filter would show an error if a mismatching media type was passed in). It was a shit idea anyway, so fuck it.
-rw-r--r--filters/f_autoconvert.c42
1 files changed, 14 insertions, 28 deletions
diff --git a/filters/f_autoconvert.c b/filters/f_autoconvert.c
index ce9d82cbc2..ee72474f09 100644
--- a/filters/f_autoconvert.c
+++ b/filters/f_autoconvert.c
@@ -161,14 +161,7 @@ static void handle_video_frame(struct mp_filter *f)
{
struct priv *p = f->priv;
- struct mp_frame frame = p->sub.frame;
- if (frame.type != MP_FRAME_VIDEO) {
- MP_ERR(p, "video input required!\n");
- mp_filter_internal_mark_failed(f);
- return;
- }
-
- struct mp_image *img = frame.data;
+ struct mp_image *img = p->sub.frame.data;
if (p->force_update)
p->in_imgfmt = p->in_subfmt = 0;
@@ -187,6 +180,11 @@ static void handle_video_frame(struct mp_filter *f)
p->in_subfmt = img->params.hw_subfmt;
p->force_update = false;
+ if (!p->num_imgfmts) {
+ mp_subfilter_continue(&p->sub);
+ return;
+ }
+
bool different_subfmt = false;
for (int n = 0; n < p->num_imgfmts; n++) {
@@ -278,14 +276,7 @@ static void handle_audio_frame(struct mp_filter *f)
{
struct priv *p = f->priv;
- struct mp_frame frame = p->sub.frame;
- if (frame.type != MP_FRAME_AUDIO) {
- MP_ERR(p, "audio input required!\n");
- mp_filter_internal_mark_failed(f);
- return;
- }
-
- struct mp_aframe *aframe = frame.data;
+ struct mp_aframe *aframe = p->sub.frame.data;
int afmt = mp_aframe_get_format(aframe);
int srate = mp_aframe_get_rate(aframe);
@@ -369,19 +360,14 @@ static void process(struct mp_filter *f)
if (!mp_subfilter_read(&p->sub))
return;
- struct mp_frame frame = p->sub.frame;
+ if (p->sub.frame.type == MP_FRAME_VIDEO) {
+ handle_video_frame(f);
+ return;
+ }
- if (!mp_frame_is_signaling(frame)) {
- if (p->num_imgfmts) {
- handle_video_frame(f);
- return;
- }
- if (p->num_afmts || p->num_srates || p->chmaps.num_chmaps ||
- p->resampling_forced)
- {
- handle_audio_frame(f);
- return;
- }
+ if (p->sub.frame.type == MP_FRAME_AUDIO) {
+ handle_audio_frame(f);
+ return;
}
mp_subfilter_continue(&p->sub);