summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/en/ao.rst7
-rw-r--r--audio/out/ao_null.c20
2 files changed, 24 insertions, 3 deletions
diff --git a/DOCS/man/en/ao.rst b/DOCS/man/en/ao.rst
index a05811e2f3..c5b1b37fb3 100644
--- a/DOCS/man/en/ao.rst
+++ b/DOCS/man/en/ao.rst
@@ -150,7 +150,12 @@ Available audio output drivers are:
``null``
Produces no audio output but maintains video playback speed. Use
- ``--no-audio`` for benchmarking.
+ ``--ao=null:untimed`` for benchmarking.
+
+ ``untimed``
+ Do not simulate timing of a perfect audio device. This means audio
+ decoding will go as fast as possible, instead of timing it to the
+ system clock.
``pcm``
Raw PCM/WAVE file writer audio output
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}
+ },
};