diff options
author | wm4 <wm4@nowhere> | 2013-11-13 19:47:41 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-11-13 20:10:17 +0100 |
commit | e5fec0ad07d0b66d0433a86af723c71ca3374a88 (patch) | |
tree | 56168b7d0313901ddd7b6663dcc0fa54a28bdc76 /audio | |
parent | 621cff80df1f17f883e2ec028a4fe3d1f2470c0f (diff) | |
download | mpv-e5fec0ad07d0b66d0433a86af723c71ca3374a88.tar.bz2 mpv-e5fec0ad07d0b66d0433a86af723c71ca3374a88.tar.xz |
ao_null: add untimed sub-option
Diffstat (limited to 'audio')
-rw-r--r-- | audio/out/ao_null.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/audio/out/ao_null.c b/audio/out/ao_null.c index 3e51df8a4f..ec15f145f1 100644 --- a/audio/out/ao_null.c +++ b/audio/out/ao_null.c @@ -25,6 +25,7 @@ #include "config.h" #include "osdep/timer.h" +#include "mpvcore/m_option.h" #include "audio/format.h" #include "ao.h" @@ -35,12 +36,19 @@ struct priv { float buffered; int buffersize; int outburst; + + int untimed; }; static void drain(struct ao *ao) { struct priv *priv = ao->priv; + if (ao->untimed) { + priv->buffered = 0; + return; + } + if (priv->paused) return; @@ -53,8 +61,9 @@ static void drain(struct ao *ao) static int init(struct ao *ao) { - struct priv *priv = talloc_zero(ao, struct priv); - ao->priv = priv; + struct priv *priv = ao->priv; + + ao->untimed = priv->untimed; struct mp_chmap_sel sel = {0}; mp_chmap_sel_add_any(&sel); @@ -133,6 +142,8 @@ static float get_delay(struct ao *ao) return priv->buffered / (double)ao->samplerate; } +#define OPT_BASE_STRUCT struct priv + const struct ao_driver audio_out_null = { .description = "Null audio output", .name = "null", @@ -144,4 +155,9 @@ const struct ao_driver audio_out_null = { .get_delay = get_delay, .pause = pause, .resume = resume, + .priv_size = sizeof(struct priv), + .options = (const struct m_option[]) { + OPT_FLAG("untimed", untimed, 0), + {0} + }, }; |