mirror of
https://github.com/mpv-player/mpv
synced 2025-02-16 12:17:12 +00:00
af_lavcac3enc: don't use deprecated avcodec_close
Deprecated upstream 1cc24d7495
We need to reallocate the context here because `avcodec_free_context`
also frees the context, and we want to reuse the context with some
reconfig.
This commit is contained in:
parent
0ef78c1aa5
commit
6a5a3ec3bf
@ -103,7 +103,15 @@ static bool reinit(struct mp_filter *f)
|
||||
if (!bit_rate && chmap.num < AC3_MAX_CHANNELS + 1)
|
||||
bit_rate = default_bit_rate[chmap.num];
|
||||
|
||||
avcodec_close(s->lavc_actx);
|
||||
avcodec_free_context(&s->lavc_actx);
|
||||
s->lavc_actx = avcodec_alloc_context3(s->lavc_acodec);
|
||||
if (!s->lavc_actx) {
|
||||
MP_ERR(f, "Audio LAVC, couldn't reallocate context!\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mp_set_avopts(f->log, s->lavc_actx, s->opts->avopts) < 0)
|
||||
return false;
|
||||
|
||||
// Put sample parameters
|
||||
s->lavc_actx->sample_fmt = af_to_avformat(format);
|
||||
|
Loading…
Reference in New Issue
Block a user