-
Notifications
You must be signed in to change notification settings - Fork 41
/
video_decoder.h
48 lines (38 loc) · 1.19 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
#pragma once
#include <string>
#include "demuxer.h"
extern "C" {
#include <libavcodec/avcodec.h>
}
class VideoDecoder {
public:
explicit VideoDecoder(const std::string& decoder_name, const std::string& hw_accel_spec, const AVCodecParameters* codec_parameters, 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 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;
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_;
};