summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-02-01 07:00:37 +0100
committerKevin Mitchell <kevmitch@gmail.com>2018-02-03 05:01:28 -0800
commitdebc17663d677526bd67a7faea5233e1a49078e4 (patch)
treec9d0882d0535b4020121501eee4aba22c46f7db3
parentafb167cfd2521198539fbd23d772a252554221f0 (diff)
downloadmpv-debc17663d677526bd67a7faea5233e1a49078e4.tar.bz2
mpv-debc17663d677526bd67a7faea5233e1a49078e4.tar.xz
filter: add/use a convenience function
I guess this is generally useful for filters which buffer data internally.
-rw-r--r--filters/f_utils.c3
-rw-r--r--filters/filter.c6
-rw-r--r--filters/filter.h5
3 files changed, 12 insertions, 2 deletions
diff --git a/filters/f_utils.c b/filters/f_utils.c
index 8dc185f90e..38b4f1d3f9 100644
--- a/filters/f_utils.c
+++ b/filters/f_utils.c
@@ -251,8 +251,7 @@ static void fixed_aframe_size_process(struct mp_filter *f)
p->out = NULL;
p->out_written = 0;
} else {
- if (mp_pin_out_request_data(f->ppins[0]))
- mp_filter_internal_mark_progress(f);
+ mp_pin_out_request_data_next(f->ppins[0]);
}
}
diff --git a/filters/filter.c b/filters/filter.c
index bbd8a4ff5b..60e9bc265e 100644
--- a/filters/filter.c
+++ b/filters/filter.c
@@ -256,6 +256,12 @@ bool mp_pin_out_request_data(struct mp_pin *p)
return mp_pin_out_has_data(p);
}
+void mp_pin_out_request_data_next(struct mp_pin *p)
+{
+ if (mp_pin_out_request_data(p))
+ update_filter(p->owner, p->conn->manual_connection);
+}
+
struct mp_frame mp_pin_out_read(struct mp_pin *p)
{
if (!mp_pin_out_request_data(p))
diff --git a/filters/filter.h b/filters/filter.h
index 9ba387691a..b618a9c637 100644
--- a/filters/filter.h
+++ b/filters/filter.h
@@ -47,6 +47,11 @@ bool mp_pin_in_write(struct mp_pin *p, struct mp_frame frame);
// buffered in mp_pins goes against this.
bool mp_pin_out_request_data(struct mp_pin *p);
+// Same as mp_pin_out_request_data(), but call the filter's process() function
+// next time even if there is new data. the intention is that the filter reads
+// the data in the next iteration, without checking for the data now.
+void mp_pin_out_request_data_next(struct mp_pin *p);
+
// Same as mp_pin_out_request_data(), but does not attempt to procure new frames
// if the return value is false.
bool mp_pin_out_has_data(struct mp_pin *p);