Defined in avcodec.h
Initializes the AVCodecContext to use the given AVCodec. Prior to using this function the context has to be allocated.
The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(), avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for retrieving a codec.
WARNING: This function is not thread safe!
Example:
avcodec_register_all(); codec = avcodec_find_decoder(CODEC_ID_H264); if (!codec) exit(1); context = avcodec_alloc_context(); if (avcodec_open(context, codec) < 0) exit(1);
int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
AVCodecContext *avctx
The AVCodecContext which will be set up to use the given codec.
AVCodec *codec
The AVCodec to use within the context.
Zero on success, a negative value on error