public VideoDecoder() { _pFrame = FFmpegInvoke.av_frame_alloc(); AVCodec *pCodec = FFmpegInvoke.avcodec_find_decoder(CodecId); if (pCodec == null) { throw new VideoDecoderException("Unsupported codec."); } _pDecodingContext = FFmpegInvoke.avcodec_alloc_context3(pCodec); if (FFmpegInvoke.avcodec_open2(_pDecodingContext, pCodec, null) < 0) { throw new VideoDecoderException("Could not open codec."); } }