=====avcodec_open===== ====Overview==== 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 [[ffmpeg:avcodec_find_decoder_by_name()]], [[ffmpeg:avcodec_find_encoder_by_name()]], [[ffmpeg:avcodec_find_decoder()]] and [[ffmpeg: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); ====Parameters==== ===avctx=== AVCodecContext *avctx The [[ffmpeg:AVCodecContext]] which will be set up to use the given codec. ===codec=== AVCodec *codec The [[ffmpeg:AVCodec]] to use within the context. ====Return value==== Zero on success, a negative value on error ====See also==== [[ffmpeg:avcodec_alloc_context()]], [[ffmpeg:avcodec_find_decoder()]], [[ffmpeg:avcodec_find_encoder()]] ---- Back to [[ffmpeg:ffmpeg]]