What does avformat_open_input () do?

I follow this code to work with the ffmpeg library in C. There is very little documentation in the ffmpeg library, and it's hard to understand what exactly each function performs.
I understand the code (what is being done). But I lack clarity. Can someone help me please?

Q1) A struct AVFrameContext **** and ** filename (the minimum optional NULL values) are passed to the avformat_open_input () function. As the name implies, the input file is "open." How?

+6
source share
2 answers

The main functions that are performed in file_open are to

  • Allocate memory for AVFormatContext.
  • Read sample file information from file (input url)
  • Trying to guess the format of the input file, the codec parameter for the input file. This is done by calling the read_probe function pointer for each of demuxer
  • Highlight codec context, demo context, I / O context.
+5
source

You can look in FFmpeg libavformat\utils.c what really happens there:

 int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options) { AVFormatContext *s = *ps; int ret = 0; AVDictionary *tmp = NULL; ID3v2ExtraMeta *id3v2_extra_meta = NULL; if (!s && !(s = avformat_alloc_context())) return AVERROR(ENOMEM); // on and on 
+3
source

All Articles