/// <summary> /// <para><see cref="ffmpeg.av_interleaved_write_frame(AVFormatContext*, AVPacket*)"/></para> /// <para><see cref="ffmpeg.av_packet_unref"/></para> /// </summary> /// <param name="packet"></param> /// <returns></returns> public int WritePacket([In] MediaPacket packet) { int ret = ffmpeg.av_interleaved_write_frame(pFormatContext, packet); packet.Clear(); return(ret); }
public IEnumerable <MediaPacket> ReadPacket() { using (MediaPacket packet = new MediaPacket()) { int ret; do { ret = ReadPacket(packet); if (ret < 0 && ret != ffmpeg.AVERROR_EOF) { throw new FFmpegException(ret); } yield return(packet); packet.Clear(); } while (ret >= 0); } }