/// <summary> /// Initializes a new instance of the <see cref="AVCodec"/> class. /// </summary> /// <param name="client"> /// An implementation of the <see cref="FFmpegClient"/> which provides access to the native FFmpeg functions. /// </param> /// <param name="stream"> /// The identifier of the requested codec. /// </param> public AVCodec(FFmpegClient client, AVStream stream) { this.context = stream.CodecContext; this.native = (NativeAVCodec *)client.FindDecoder(context->codec_id); this.client = client; if ((this.Capabilities & AVCodecCapabilities.Truncated) == AVCodecCapabilities.Truncated) { context->flags |= (int)AVCodecCapabilities.Truncated; } this.Open(this.context); }
/// <summary> /// Initialize the AVCodecContext to use the given AVCodec. /// </summary> /// <param name="codecContext"> /// The context to initialize. /// </param> /// <param name="codec"> /// The codec to open this context for. /// </param> /// <param name="options"> /// A dictionary filled with AVCodecContext and codec-private options. /// </param> /// <returns> /// zero on success, a negative value on error. /// </returns> public int OpenCodec(AVCodecContext *codecContext, NativeAVCodec *codec, NativeAVDictionary **options) { return(ffmpeg.avcodec_open2(codecContext, codec, options)); }
/// <summary> /// Returns a value indicating whether the codec is an encoder. /// </summary> /// <param name="codec"> /// The codec. /// </param> /// <returns> /// Avalue indicating whether the codec is an encoder. /// </returns> public bool IsEncoder(NativeAVCodec *codec) { return(ffmpeg.av_codec_is_encoder(codec) > 0); }
/// <summary> /// Initializes a new instance of the <see cref="AVCodec"/> class. /// </summary> /// <param name="client"> /// An implementation of the <see cref="FFmpegClient"/> which provides access to the native FFmpeg functions. /// </param> /// <param name="context"> /// The the native codec context. /// </param> /// <param name="codec"> /// The netive codec object. /// </param> /// <remarks> /// Use only for testing purposes. /// </remarks> public AVCodec(FFmpegClient client, NativeAVCodecContext *context, NativeAVCodec *codec) { this.context = context; this.native = codec; this.client = client; }