meh/rust-ffmpeg

New Codec Context from Codec

LuoZijun opened this issue · 2 comments

Hi,
don't support new one ffmpeg::codec::Context struct from one ffmpeg::codec::codec::Codec struct ?

why this make CodecContext from Null ?

Example:

let code_id: AVCodecID           = AVCodecID::AV_CODEC_ID_MPEG1VIDEO;
let mut codec: *const AVCodec    = avcodec_find_encoder(code_id);
// Alloc Context need `Codec` data.
let mut c: AVCodecContext = avcodec_alloc_context3(codec);

But in /src/codec/context.rs#L36

Context { ptr: avcodec_alloc_context3(ptr::null()), owner: None }
meh commented

It's proper usage, check the documentation for avcodec_alloc_context3.

ah, ok.