Skip to content

Commit 7b44ace

Browse files
committed
tools/ipc_frame: Fix color_spec selection
1 parent 3c0e7d5 commit 7b44ace

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

tools/ipc_frame_ug.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,15 @@ bool ipc_frame_from_ug_frame_hq(struct Ipc_frame *dst,
104104
return true;
105105
}
106106

107+
Ipc_frame_color_spec ipc_frame_color_spec_from_ug(codec_t codec){
108+
switch(codec){
109+
case RGBA: return IPC_FRAME_COLOR_RGBA;
110+
case RGB: return IPC_FRAME_COLOR_RGB;
111+
case UYVY: return IPC_FRAME_COLOR_UYVY;
112+
default: return IPC_FRAME_COLOR_NONE;
113+
}
114+
}
115+
107116
bool ipc_frame_from_ug_frame(struct Ipc_frame *dst,
108117
const struct video_frame *src,
109118
codec_t codec,
@@ -125,7 +134,7 @@ bool ipc_frame_from_ug_frame(struct Ipc_frame *dst,
125134

126135
dst->header.width = src->tiles[0].width;
127136
dst->header.height = src->tiles[0].height;
128-
dst->header.color_spec = static_cast<Ipc_frame_color_spec>(codec);
137+
dst->header.color_spec = ipc_frame_color_spec_from_ug(codec);
129138

130139
int dst_frame_to_allocate = 0;
131140

tools/ipc_frame_ug.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,6 @@ bool ipc_frame_write_to_fd(const struct Ipc_frame *f, int fd);
3333

3434
int ipc_frame_get_scale_factor(int src_w, int src_h, int target_w, int target_h);
3535

36+
Ipc_frame_color_spec ipc_frame_color_spec_from_ug(codec_t codec);
37+
3638
#endif //IPC_FRAME_UG_32ee5c748f3e

0 commit comments

Comments
 (0)