- Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathFrameCache.cpp
More file actions
Latest commit
32 lines (24 loc) · 658 Bytes
/
Copy pathFrameCache.cpp
File metadata and controls
32 lines (24 loc) · 658 Bytes
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
//
// Created by Cry on 2018-12-20.
//
#include"FrameCache.h"
SDL_bool FrameCache::product_frame() {
if (consume_render == SDL_FALSE) {
//上一个帧,还没送显。这里不做处理。直接跳过
}
frames_swap();
SDL_bool previous_frame_consumed = consume_render;
consume_render = SDL_FALSE;
return previous_frame_consumed;
}
voidFrameCache::frames_swap() {
AVFrame *temp = decode_frame;
render_frame = temp;
decode_frame = render_frame;
}
SDL_bool FrameCache::init() {
decode_frame = av_frame_alloc();
render_frame = av_frame_alloc();
consume_render = SDL_TRUE;
returnSDL_TRUE;
}