mirror of
https://github.com/mpv-player/mpv
synced 2025-03-29 15:00:27 +00:00
af: remove af->setup field
Used to be used by filters that didn't use the option parser.
This commit is contained in:
parent
09bd19e59e
commit
193930ac3b
@ -139,7 +139,7 @@ static int input_control(struct af_instance* af, int cmd, void* arg)
|
|||||||
{
|
{
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case AF_CONTROL_REINIT:
|
case AF_CONTROL_REINIT:
|
||||||
assert(arg == &((struct af_stream *)af->setup)->input);
|
assert(arg == &((struct af_stream *)af->priv)->input);
|
||||||
return AF_OK;
|
return AF_OK;
|
||||||
}
|
}
|
||||||
return AF_UNKNOWN;
|
return AF_UNKNOWN;
|
||||||
@ -147,7 +147,7 @@ static int input_control(struct af_instance* af, int cmd, void* arg)
|
|||||||
|
|
||||||
static int output_control(struct af_instance* af, int cmd, void* arg)
|
static int output_control(struct af_instance* af, int cmd, void* arg)
|
||||||
{
|
{
|
||||||
struct af_stream *s = af->setup;
|
struct af_stream *s = af->priv;
|
||||||
struct mp_audio *output = &s->output;
|
struct mp_audio *output = &s->output;
|
||||||
struct mp_audio *filter_output = &s->filter_output;
|
struct mp_audio *filter_output = &s->filter_output;
|
||||||
|
|
||||||
@ -593,7 +593,7 @@ struct af_stream *af_new(struct MPOpts *opts)
|
|||||||
.info = &in,
|
.info = &in,
|
||||||
.control = input_control,
|
.control = input_control,
|
||||||
.play = dummy_play,
|
.play = dummy_play,
|
||||||
.setup = s,
|
.priv = s,
|
||||||
.data = &s->input,
|
.data = &s->input,
|
||||||
.mul = 1.0,
|
.mul = 1.0,
|
||||||
};
|
};
|
||||||
@ -603,7 +603,7 @@ struct af_stream *af_new(struct MPOpts *opts)
|
|||||||
.info = &out,
|
.info = &out,
|
||||||
.control = output_control,
|
.control = output_control,
|
||||||
.play = dummy_play,
|
.play = dummy_play,
|
||||||
.setup = s,
|
.priv = s,
|
||||||
.data = &s->filter_output,
|
.data = &s->filter_output,
|
||||||
.mul = 1.0,
|
.mul = 1.0,
|
||||||
};
|
};
|
||||||
|
@ -59,7 +59,6 @@ struct af_instance {
|
|||||||
int (*control)(struct af_instance *af, int cmd, void *arg);
|
int (*control)(struct af_instance *af, int cmd, void *arg);
|
||||||
void (*uninit)(struct af_instance *af);
|
void (*uninit)(struct af_instance *af);
|
||||||
struct mp_audio * (*play)(struct af_instance *af, struct mp_audio *data);
|
struct mp_audio * (*play)(struct af_instance *af, struct mp_audio *data);
|
||||||
void *setup; // old field for priv structs
|
|
||||||
void *priv;
|
void *priv;
|
||||||
struct mp_audio *data; // configuration and buffer for outgoing data stream
|
struct mp_audio *data; // configuration and buffer for outgoing data stream
|
||||||
struct af_instance *next;
|
struct af_instance *next;
|
||||||
|
@ -65,7 +65,7 @@ typedef struct af_ac3enc_s {
|
|||||||
// Initialization and runtime control
|
// Initialization and runtime control
|
||||||
static int control(struct af_instance *af, int cmd, void *arg)
|
static int control(struct af_instance *af, int cmd, void *arg)
|
||||||
{
|
{
|
||||||
af_ac3enc_t *s = af->setup;
|
af_ac3enc_t *s = af->priv;
|
||||||
static const int default_bit_rate[AC3_MAX_CHANNELS+1] = \
|
static const int default_bit_rate[AC3_MAX_CHANNELS+1] = \
|
||||||
{0, 96000, 192000, 256000, 384000, 448000, 448000};
|
{0, 96000, 192000, 256000, 384000, 448000, 448000};
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ static int control(struct af_instance *af, int cmd, void *arg)
|
|||||||
// Deallocate memory
|
// Deallocate memory
|
||||||
static void uninit(struct af_instance* af)
|
static void uninit(struct af_instance* af)
|
||||||
{
|
{
|
||||||
af_ac3enc_t *s = af->setup;
|
af_ac3enc_t *s = af->priv;
|
||||||
|
|
||||||
if (s) {
|
if (s) {
|
||||||
av_free_packet(&s->pkt);
|
av_free_packet(&s->pkt);
|
||||||
@ -154,7 +154,7 @@ static void uninit(struct af_instance* af)
|
|||||||
static struct mp_audio* play(struct af_instance* af, struct mp_audio* audio)
|
static struct mp_audio* play(struct af_instance* af, struct mp_audio* audio)
|
||||||
{
|
{
|
||||||
struct mp_audio *out = af->data;
|
struct mp_audio *out = af->data;
|
||||||
af_ac3enc_t *s = af->setup;
|
af_ac3enc_t *s = af->priv;
|
||||||
int num_frames = (audio->samples + mp_audio_buffer_samples(s->pending))
|
int num_frames = (audio->samples + mp_audio_buffer_samples(s->pending))
|
||||||
/ s->in_samples;
|
/ s->in_samples;
|
||||||
|
|
||||||
@ -254,7 +254,6 @@ static int af_open(struct af_instance* af){
|
|||||||
af->control=control;
|
af->control=control;
|
||||||
af->uninit=uninit;
|
af->uninit=uninit;
|
||||||
af->play=play;
|
af->play=play;
|
||||||
af->setup=s;
|
|
||||||
|
|
||||||
s->lavc_acodec = avcodec_find_encoder_by_name("ac3");
|
s->lavc_acodec = avcodec_find_encoder_by_name("ac3");
|
||||||
if (!s->lavc_acodec) {
|
if (!s->lavc_acodec) {
|
||||||
|
Loading…
Reference in New Issue
Block a user