Example #1
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="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);
        }
Example #2
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;
 }
Example #3
0
 /// <summary>
 /// Close a given AVCodecContext and free all the data associated with it (but not the AVCodecContext itself).
 /// </summary>
 /// <param name="context">
 /// The context.
 /// </param>
 public void Close(NativeAVCodecContext *context)
 {
     this.client.CloseCodec(context);
 }
Example #4
0
        /// <summary>
        /// Initialize the AVCodecContext to use the given AVCodec.
        /// </summary>
        /// <param name="context">
        /// The context to initialize.
        /// </param>
        public void Open(NativeAVCodecContext *context)
        {
            var ret = this.client.OpenCodec(context, this.native, null);

            this.client.ThrowOnAVError(ret);
        }