-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathframe_converter.h
More file actions
47 lines (39 loc) · 1.37 KB
/
Copy pathframe_converter.h
File metadata and controls
47 lines (39 loc) · 1.37 KB
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
#pragma once
#include <cassert>
#include <stdexcept>
#include "frame_consumer.h"
#include "frame_provider.h"
#include "scale_context.h"
class FrameConverter final : public FrameConsumer, public FrameProvider
{
FrameConverter(const FrameConverter&) = delete;
const FrameConverter& operator=(const FrameConverter&) = delete;
FrameConverter(FrameConverter&&) = delete;
const FrameConverter& operator=(FrameConverter&&) = delete;
public:
FrameConverter(int src_width, int src_height, AVPixelFormat src_format) throw(std::runtime_error);
~FrameConverter();
void CreateConversionContext(int dst_width, int dst_height, AVPixelFormat dst_format) throw (std::logic_error, std::runtime_error);
// implementation of FrameConsumer interface
bool AgreeWith(AVPixelFormat format, int width, int height) const noexcept override
{
return (format == _src_format && width == _src_width && height == _src_height);
}
void AcceptFrame(const Frame& frame) override;
private:
// implementation if FrameProvider interface
bool TestConsumer(const FrameConsumer* frame_consumer) const noexcept override
{
assert(frame_consumer != NULL);
return frame_consumer->AgreeWith(_dst_format, _dst_width, _dst_height);
}
private:
int _src_width;
int _src_height;
AVPixelFormat _src_format;
int _dst_width;
int _dst_height;
AVPixelFormat _dst_format;
ScaleContext _scale_context;
Frame _frame;
};