/// <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); }
/// <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)); }
/// <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. }
/// <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(); }
private InputContainer(AVFormatContext *formatContext, bool useCustomAvioContext) : base(formatContext) { packet = MediaPacket.AllocateEmpty(0); avioContextDisposingRequired = useCustomAvioContext; }