diff options
author | wm4 <wm4@nowhere> | 2013-12-05 00:01:46 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-12-05 00:01:46 +0100 |
commit | ed024aadb6e7be6c3d910045a64db53a6c95e98f (patch) | |
tree | f26724d268e13ee8ec8f327ea829b65ccd6fab19 /audio/filter/af_lavcac3enc.c | |
parent | 2bcfb49a390a928c535cba7cab2b4136f27fceca (diff) | |
download | mpv-ed024aadb6e7be6c3d910045a64db53a6c95e98f.tar.bz2 mpv-ed024aadb6e7be6c3d910045a64db53a6c95e98f.tar.xz |
audio/filter: change filter callback signature
The new signature is actually closer to how it actually works, and
someone who is not familiar to the API and how it works might make fewer
fatal mistakes with the new signature than the old one. Pretty weird.
Do this to sneak in a flags parameter, which will later be used to flush
remaining data of at least vf_lavfi.
Diffstat (limited to 'audio/filter/af_lavcac3enc.c')
-rw-r--r-- | audio/filter/af_lavcac3enc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/audio/filter/af_lavcac3enc.c b/audio/filter/af_lavcac3enc.c index a441dbe17d..a27418f2f7 100644 --- a/audio/filter/af_lavcac3enc.c +++ b/audio/filter/af_lavcac3enc.c @@ -151,7 +151,7 @@ static void uninit(struct af_instance* af) } // Filter data through filter -static struct mp_audio* play(struct af_instance* af, struct mp_audio* audio) +static int filter(struct af_instance* af, struct mp_audio* audio, int flags) { struct mp_audio *out = af->data; af_ac3enc_t *s = af->priv; @@ -188,7 +188,7 @@ static struct mp_audio* play(struct af_instance* af, struct mp_audio* audio) AVFrame *frame = avcodec_alloc_frame(); if (!frame) { mp_msg(MSGT_AFILTER, MSGL_FATAL, "[libaf] Could not allocate memory \n"); - return NULL; + return -1; } frame->nb_samples = s->in_samples; frame->format = s->lavc_actx->sample_fmt; @@ -202,7 +202,7 @@ static struct mp_audio* play(struct af_instance* af, struct mp_audio* audio) ret = avcodec_encode_audio2(s->lavc_actx, &s->pkt, frame, &ok); if (ret < 0 || !ok) { mp_msg(MSGT_AFILTER, MSGL_FATAL, "[lavac3enc] Encode failed.\n"); - return NULL; + return -1; } avcodec_free_frame(&frame); @@ -245,7 +245,7 @@ static struct mp_audio* play(struct af_instance* af, struct mp_audio* audio) mp_audio_buffer_append(s->pending, audio); *audio = *out; - return audio; + return 0; } static int af_open(struct af_instance* af){ @@ -253,7 +253,7 @@ static int af_open(struct af_instance* af){ af_ac3enc_t *s = af->priv; af->control=control; af->uninit=uninit; - af->play=play; + af->filter=filter; s->lavc_acodec = avcodec_find_encoder_by_name("ac3"); if (!s->lavc_acodec) { |