-
Notifications
You must be signed in to change notification settings - Fork 45
/
video_filterer.h
63 lines (53 loc) · 1.72 KB
/
video_filterer.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
59
60
61
62
63
#pragma once
#include "config.h"
#include "demuxer.h"
#include "video_decoder.h"
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavfilter/buffersink.h>
#include <libavfilter/buffersrc.h>
}
class VideoFilterer {
public:
VideoFilterer(const Demuxer* demuxer,
const VideoDecoder* video_decoder,
int peak_luminance_nits,
const std::string& custom_video_filters,
const std::string& custom_color_space,
const std::string& custom_color_range,
const std::string& custom_color_primaries,
const std::string& custom_color_trc,
const Demuxer* other_demuxer,
const VideoDecoder* other_video_decoder,
int other_peak_luminance_nits,
const ToneMapping tone_mapping_mode,
const float boost_tone,
const bool disable_auto_filters);
~VideoFilterer();
void init();
void free();
void reinit();
void close_src();
bool send(AVFrame* decoded_frame);
bool receive(AVFrame* filtered_frame);
std::string filter_description() const;
size_t src_width() const;
size_t src_height() const;
AVPixelFormat src_pixel_format() const;
size_t dest_width() const;
size_t dest_height() const;
AVPixelFormat dest_pixel_format() const;
private:
int init_filters(const AVCodecContext* dec_ctx, AVRational time_base);
const Demuxer* demuxer_;
const VideoDecoder* video_decoder_;
std::string filter_description_;
int width_;
int height_;
AVPixelFormat pixel_format_;
AVColorSpace color_space_;
AVColorRange color_range_;
AVFilterContext* buffersrc_ctx_;
AVFilterContext* buffersink_ctx_;
AVFilterGraph* filter_graph_;
};