-
Notifications
You must be signed in to change notification settings - Fork 1
/
util.cpp
49 lines (40 loc) · 1.1 KB
/
util.cpp
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
// debug use
#include "util.h"
#include <vector>
#include <string>
#include <string.h>
#include <stdint.h>
#include <algorithm>
static std::vector<bool> s_bufferStatus; // true means in surface, false means in v4l2codec
void dbgSetBufferCount(uint32_t count)
{
uint32_t i;
for (i=0; i<count; i++) {
s_bufferStatus.push_back(true);
}
}
static void dbgDumpBufferStatus()
{
std::string bufferStatus;
std::string bufferInSurface, bufferInV4l2codec;
char t[10];
uint32_t i;
for (i = 0; i < s_bufferStatus.size(); i++) {
sprintf(t, "%d, ", i);
if (s_bufferStatus[i]) {
bufferStatus.append("+");
bufferInSurface.append(t);
} else {
bufferStatus.append("-");
bufferInV4l2codec.append(t);
}
}
DEBUG("buffer status: (%s), buffer in surface: (%s), buffer in v4l2codec: (%s)",
bufferStatus.c_str(), bufferInSurface.c_str(), bufferInV4l2codec.c_str());
}
void dbgToggleBufferIndex(int index)
{
// FIXME, lock
s_bufferStatus[index] = !s_bufferStatus[index];
dbgDumpBufferStatus();
}