summaryrefslogtreecommitdiff
path: root/src/include/ffmpeg_backend.h
blob: 0c778f7f54c8cc5b33795b6023cdba948fb62555 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// NOTE(fox): Even though each layer has its own completely isolated AV
// instance, it appears two layers with the same file still share something.
// When the layers aren't at the same position in time, the playhead of one
// layer gets misaligned every few frames and causes a manual seek back to the
// position. Different files don't exhibit this behavior.

struct av_stream_info {
    uint32 Index;
    AVCodecParameters *CodecParameters;  // Used to supply info about the decoder.
    const AVCodec* Codec;
    AVStream *Stream;    // Which stream, or channel, the video is in. Holds FPS info and is used to verify that the decoded packet belongs to this stream.
    AVCodecContext *CodecContext;
};


struct av_info {
    uint8 Occupied;

    uint16 Block_Source_Index;

    int LastFrameRendered; // Convenient to know this to only seek when we actually need to.
    uint64 PreviousPTS;  // PTS value of the previous frame, used to check timings in debug.

    AVFormatContext *FileFormatContext; // Umbrella for everything else, seems to contain the playhead state

    av_stream_info Video;
    av_stream_info Audio;

    AVPacket *Packet;
    AVFrame *Frame;

    real32 SecondCount;
    uint64 PTSDuration;     // likely not always 100% accurate

    SwsContext *RGBContext;
};