'What does the avformat_open_input() do?

I am following this code to work with FFmpeg library in C. FFmpeg library has very little documentation and it is difficult to understand what each function exactly does.

I understand the code (what is being done). But I am lacking clarity. Can anyone help me out please?

Q1) A **struct AVFrameContext **** and filename (the minimum non-NULL parameters required) are passed to the function avformat_open_input(). As the name suggests, the input file is 'opened'. How ?



Solution 1:[1]

You can look it up in FFmpeg's libavformat\utils.c what is really taking place 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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Roman R.