コード例 #1
0
        /// <summary>
        /// Reads the next packet from this file.
        /// </summary>
        private MediaPacket ReadPacket()
        {
            var pkt    = MediaPacket.AllocateEmpty();
            var result = ffmpeg.av_read_frame(Pointer, pkt.Pointer); // Gets the next packet from the file.

            // Check if the end of file error occurred
            if (result == ffmpeg.AVERROR_EOF)
            {
                throw new EndOfStreamException("End of the file.");
            }
            else
            {
                result.ThrowIfError("Cannot read next packet from the file");
            }

            return(pkt);
        }
コード例 #2
0
        /// <summary>
        /// Reads the next packet from this file and sends it to the packet queue.
        /// </summary>
        /// <returns>Type of the readed packet.</returns>
        public MediaType ReadPacket()
        {
            var packet = MediaPacket.AllocateEmpty(0);
            var result = ffmpeg.av_read_frame(Pointer, packet.Pointer);

            if (result == ffmpeg.AVERROR_EOF)
            {
                IsAtEndOfFile = true;
                return(MediaType.None);
            }
            else
            {
                result.ThrowIfError("Cannot read next packet from the file");
            }

            IsAtEndOfFile = false;
            return(EnqueuePacket(packet));
        }
コード例 #3
0
        /// <summary>
        /// Reads the next packet from this file and sends it to the packet queue.
        /// </summary>
        /// <returns>Type of the readed packet.</returns>
        public MediaType ReadPacket()
        {
            var packet = MediaPacket.AllocateEmpty(0);
            var result = ffmpeg.av_read_frame(Pointer, packet.Pointer); // Gets the next packet from the file.

            // Check if the end of file error ocurred
            if (result == ffmpeg.AVERROR_EOF)
            {
                IsAtEndOfFile = true;
                return(MediaType.None);
            }
            else
            {
                result.ThrowIfError("Cannot read next packet from the file");
            }

            IsAtEndOfFile = false;
            return(EnqueuePacket(packet)); // Sends packet to the internal decoder queue.
        }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OutputStream{TFrame}"/> class.
 /// </summary>
 /// <param name="stream">The multimedia stream.</param>
 /// <param name="owner">The container that owns the stream.</param>
 public OutputStream(AVStream *stream, OutputContainer owner)
     : base(stream)
 {
     OwnerFile = owner;
     packet    = MediaPacket.AllocateEmpty();
 }
コード例 #5
0
 private InputContainer(AVFormatContext *formatContext, bool useCustomAvioContext)
     : base(formatContext)
 {
     packet = MediaPacket.AllocateEmpty(0);
     avioContextDisposingRequired = useCustomAvioContext;
 }