-
Notifications
You must be signed in to change notification settings - Fork 45
/
video_decoder.h
58 lines (45 loc) · 1.52 KB
/
video_decoder.h
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once
#include <string>
#include "demuxer.h"
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavutil/mastering_display_metadata.h>
}
class VideoDecoder {
public:
explicit VideoDecoder(const std::string& decoder_name, const std::string& hw_accel_spec, const AVCodecParameters* codec_parameters, const unsigned peak_luminance_nits, AVDictionary* hwaccel_options, AVDictionary* decoder_options);
~VideoDecoder();
const AVCodec* codec() const;
AVCodecContext* codec_context() const;
bool is_hw_accelerated() const;
std::string hw_accel_name() const;
bool send(AVPacket* packet);
bool receive(AVFrame* frame, Demuxer* demuxer);
void check_content_light_level(const AVFrame* frame);
void flush();
bool swap_dimensions() const;
unsigned width() const;
unsigned height() const;
AVPixelFormat pixel_format() const;
AVPixelFormat hw_pixel_format() const;
AVColorRange color_range() const;
AVColorSpace color_space() const;
AVColorPrimaries color_primaries() const;
AVColorTransferCharacteristic color_trc() const;
AVRational time_base() const;
AVRational sample_aspect_ratio() const;
AVRational display_aspect_ratio() const;
bool is_anamorphic() const;
int64_t next_pts() const;
private:
const AVCodec* codec_{};
AVCodecContext* codec_context_{};
std::string hw_accel_name_;
AVPixelFormat hw_pixel_format_;
int64_t first_pts_;
int64_t previous_pts_;
int64_t next_pts_;
bool trust_decoded_pts_;
unsigned peak_luminance_nits_;
bool disable_metadata_maxcll_check_{false};
};