summaryrefslogtreecommitdiff
path: root/src/codec/ffmpeg/decoder.h
blob: a422941ad1dbef441ef9d225bffca8491d1a261e (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
#pragma once

#include <libavcodec/avcodec.h>

#include "../codec.h"

#if defined CAMU_TRY_HWACCEL && !defined CAMU_SINK_NO_VIDEO
#define CAMU_FF_DECODER_HWACCEL
#endif

struct camu_ff_decoder {
    struct camu_decoder dec;
    AVCodecParameters *codecpar;
    AVCodecContext *codec_context;
    s32 thread_count;
#ifdef CAMU_FF_DECODER_HWACCEL
    struct camu_renderer *renderer;
    const AVCodec *sw_codec;
    array(const AVCodec *) supported_hw_codecs;
    array(enum AVHWDeviceType) supported_hw_devices;
    AVBufferRef *hw_context;
    enum AVHWDeviceType hw_device_type;
    enum AVPixelFormat hw_pix_fmt;
    bool use_frames_context;
    AVCodecContext *errored_hw_context;
#endif
    void (*callback)(void *, struct camu_codec_frame *);
    void *userdata;
};

struct camu_decoder *camu_ff_decoder_create(void);