summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo_enc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-01-28 18:55:35 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-02-13 19:49:29 +0100
commit7a774a4e93e98da8ebcd796f045cf049b68e9aef (patch)
treee9443dfb53e72adb855807f384b7d39c0a6c7627 /libavcodec/mpegvideo_enc.c
parent965cfc6684e00bd7d21295554f325ff62ce6669a (diff)
avcodec/mpegvideo_enc: Don't find encoder by ID
mpegvideo-based encoders supporting bframes implement this by opening encoders of their own to test how long the chains of bframes are supposed to be. The needed AVCodec was obtained via avcodec_find_encoder(). This is complicated, as the current encoder can be directly obtained. And it also is not guaranteed that one actually gets the current encoder or not another encoder for the same codec ID (the latter does not seem to be the case now). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/mpegvideo_enc.c')
-rw-r--r--libavcodec/mpegvideo_enc.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 35b63d2652..56d41314e7 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1217,7 +1217,6 @@ static int encode_frame(AVCodecContext *c, AVFrame *frame, AVPacket *pkt)
static int estimate_best_b_count(MpegEncContext *s)
{
- const AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id);
AVPacket *pkt;
const int scale = s->brd_scale;
int width = s->width >> scale;
@@ -1301,7 +1300,7 @@ static int estimate_best_b_count(MpegEncContext *s)
c->time_base = s->avctx->time_base;
c->max_b_frames = s->max_b_frames;
- ret = avcodec_open2(c, codec, NULL);
+ ret = avcodec_open2(c, s->avctx->codec, NULL);
if (ret < 0)
goto fail;