Example #1
0
        /// <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);
        }
Example #2
0
        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);
            }
        }