/// <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; }
private static extern AVError av_open_input_stream(out AVFormatContext* ic_ptr, ref ByteIOContext pb, string filename, ref AVInputFormat fmt, ref AVFormatParameters ap);
public static extern AVError av_set_parameters(ref AVFormatContext pAVFormatContext, AVFormatParameters* pAVFormatParameters);
private static extern AVError av_open_input_file(out IntPtr pFormatContext, string filename, ref AVInputFormat fmt, int buf_size, ref AVFormatParameters ap);
/// <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; }