private avcodec_find_decoder ( AVCodecID id ) : IntPtr | ||
id | AVCodecID | |
return | IntPtr |
public AVStream(IntPtr fileContext) { rawFormatCtx = fileContext; pFormatCtx = new NativeGetter <AV.AVFormatContext>(fileContext).Get(); for (var i = 0; i < pFormatCtx.nb_streams; i++) { var stream = new NativeGetter <AV.AVStream>(pFormatCtx.Streams[i]).Get(); var codecContext = new NativeGetter <AV.AVCodecContext>(stream.codec).Get(); IntPtr codec = AV.avcodec_find_decoder(codecContext.codec_id); if (codec != IntPtr.Zero) { var codecHandle = new NativeGetter <AV.AVCodec>(codec).Get(); if ((codecHandle.capabilities & AV.CODEC_FLAG_TRUNCATED) != 0) { codecContext.flags |= AV.CODEC_FLAG_TRUNCATED; new NativeSetter <AV.AVCodecContext>(stream.codec).Set(codecContext); } int ret = AV.avcodec_open2(stream.codec, codec, IntPtr.Zero); if (ret < 0) { throw new Exception("Can not open codec for type " + codecContext.codec_type.ToString()); } decoderTable.Add(i, stream.codec); mediaTypeTable.Add(i, codecContext.codec_type); } } }