Ejemplo n.º 1
0
        /// <summary>
        /// Allocates all the structures needed to read an input stream.
        /// This does not open the needed codecs for decoding the stream[s].
        /// </summary>
        private static AVError av_open_input_stream(out AVFormatContext ctx, ref ByteIOContext pb,
                                                    string filename, ref AVInputFormat fmt, ref AVFormatParameters ap)
        {
            AVFormatContext *ptr;
            AVError          err = av_open_input_stream(out ptr, ref pb, filename, ref fmt, ref ap);

            ctx = *ptr;

            FFmpeg.av_free(ptr);

            return(err);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Opens a media file as input.  The codecs are not opened.  Only the file
        /// header (if present) is read.
        /// </summary>
        /// <param name="pFormatContext">the opened media file handle is put here</param>
        /// <param name="filename">filename to open</param>
        /// <returns>AVError</returns>
        public static AVError avformat_open_input_file(out AVFormatContext pFormatContext, string filename)
        {
            IntPtr  ptr;
            AVError err = avformat_open_input(out ptr, filename, null, null);

            if (ptr == IntPtr.Zero)
            {
                pFormatContext = new AVFormatContext();
                return(err);
            }

            pFormatContext = *(AVFormatContext *)ptr.ToPointer();

            return(err);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Opens a media file as input.  The codecs are not opened.  Only the file
        /// header (if present) is read.
        /// </summary>
        /// <param name="pFormatContext">the opened media file handle is put here</param>
        /// <param name="filename">filename to open</param>
        /// <param name="pAVInputFormat">if non null, force the file format to use</param>
        /// <param name="buf_size">optional buffer size (zero as default is OK)</param>
        /// <param name="pAVFormatParameters">Additional parameters needed when open the file (Null if default)</param>
        /// <returns>AVError</returns>
        public static AVError av_open_input_file(out AVFormatContext pFormatContext, string filename,
                                                 ref AVInputFormat fmt, int buf_size, ref AVFormatParameters ap)
        {
            IntPtr  ptr;
            AVError err = av_open_input_file(out ptr, filename, ref fmt, 0, ref ap);

            if (ptr == IntPtr.Zero)
            {
                pFormatContext = new AVFormatContext();
                return(err);
            }

            pFormatContext = *(AVFormatContext *)ptr.ToPointer();

            FFmpeg.av_freep(ref ptr);

            return(err);
        }
Ejemplo n.º 4
0
 public void DidFail(AVError error)
 {
     Console.WriteLine("did fail");
 }