#10770: avcodec_open2 overwrites flags contrary to what the doc says
-------------------------------------+-------------------------------------
Reporter: Jean- | Type: defect
Michaƫl Celerier |
Status: new | Priority: normal
Component: | Version:
undetermined | unspecified
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
The avcodec_open2 documentation states, about the options parameter:
{{{
* @param options A dictionary filled with AVCodecContext and codec-
private
* options, which are set on top of the options already set
in
* avctx, can be NULL. On return this object will be filled
with
* options that were not found in the avctx codec context.
}}}
Yet given the following program, the final assert does not pass:
AV_CODEC_FLAG_GLOBAL_HEADER gets overwritten in the codec context's flags.
{{{
extern "C" {
#include <libavcodec/avcodec.h>
}
#include <cassert>
int main()
{
auto codec = avcodec_find_encoder_by_name("libx264");
auto c = avcodec_alloc_context3(codec);
c->width = 1280;
c->height = 720;
c->time_base = (AVRational){100000, int(100000 * 30)};
c->framerate = AVRational{c->time_base.den, c->time_base.num};
c->gop_size = 0;
c->max_b_frames = 0;
c->pix_fmt = AV_PIX_FMT_YUV420P;
c->strict_std_compliance = FF_COMPLIANCE_NORMAL;
c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
AVDictionary* opt{};
av_dict_set(&opt, "flags", "low_delay", 0);
avcodec_open2(c, codec, &opt);
assert(c->flags & AV_CODEC_FLAG_GLOBAL_HEADER);
}
}}}
--
Ticket URL: <https://trac.ffmpeg.org/ticket/10770>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker_______________________________________________
FFmpeg-trac mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-trac
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".