diff options
author | wm4 <wm4@nowhere> | 2017-02-07 17:05:17 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-02-07 17:05:17 +0100 |
commit | 96a45a16af5594900ca94e7d4abb18d1e6d5ed4a (patch) | |
tree | d08473b07adfa7963ce6735c72af1e5d220930a9 /sub/dec_sub.c | |
parent | 061b752217d15d41496ca6e4777835fcd945e237 (diff) | |
download | mpv-96a45a16af5594900ca94e7d4abb18d1e6d5ed4a.tar.bz2 mpv-96a45a16af5594900ca94e7d4abb18d1e6d5ed4a.tar.xz |
player: add experimental stream recording feature
This is basically a WIP, but it can't remain in a branch forever. A
warning is print when using it as it's still a bit "shaky".
Diffstat (limited to 'sub/dec_sub.c')
-rw-r--r-- | sub/dec_sub.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sub/dec_sub.c b/sub/dec_sub.c index b9f04b3123..743a06ed14 100644 --- a/sub/dec_sub.c +++ b/sub/dec_sub.c @@ -29,6 +29,7 @@ #include "options/options.h" #include "common/global.h" #include "common/msg.h" +#include "common/recorder.h" #include "osdep/threads.h" extern const struct sd_functions sd_ass; @@ -49,6 +50,8 @@ struct dec_sub { struct mpv_global *global; struct MPOpts *opts; + struct mp_recorder_sink *recorder_sink; + struct attachment_list *attachments; struct sh_stream *sh; @@ -240,6 +243,9 @@ bool sub_read_packets(struct dec_sub *sub, double video_pts) break; } + if (sub->recorder_sink) + mp_recorder_feed_packet(sub->recorder_sink, pkt); + sub->last_pkt_pts = pkt->pts; if (is_new_segment(sub, pkt)) { @@ -323,3 +329,11 @@ int sub_control(struct dec_sub *sub, enum sd_ctrl cmd, void *arg) pthread_mutex_unlock(&sub->lock); return r; } + +void sub_set_recorder_sink(struct dec_sub *sub, struct mp_recorder_sink *sink) +{ + pthread_mutex_lock(&sub->lock); + sub->recorder_sink = sink; + pthread_mutex_unlock(&sub->lock); +} + |