mirror of
https://github.com/mpv-player/mpv
synced 2025-02-16 20:27:23 +00:00
ao_null: add untimed sub-option
This commit is contained in:
parent
621cff80df
commit
e5fec0ad07
@ -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
|
||||
|
@ -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}
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user