pub fn open_codec_context(
context: &mut AVCodecContext,
options: AVDictionary,
) -> Result<Option<AVDictionary>, RsmpegError>Expand description
Opens context with options, returning what FFmpeg did not consume.
avcodec_open2 frees the dictionary it is handed and writes the unconsumed
remainder back through the same pointer. It does this on its failure path
as well as its success path, at the shared end: label. rsmpeg 0.18’s
AVCodecContext::open only accounts for that when the call succeeds: on
failure it drops the caller’s AVDictionary, which frees memory FFmpeg
has already freed. That is reachable from the export path the moment a
candidate encoder fails to open, which is exactly what the open-time
fallback is for, and it aborts the process instead of trying the next
candidate. Observed as a segfault opening h264_vulkan with
AV_PIX_FMT_YUV420P; avcodec_open2 itself returns EINVAL cleanly.
§Errors
Returns the FFmpeg status when the encoder or decoder cannot be opened.