Skip to content

Commit da714ed

Browse files
hfruchet-sterwango
authored andcommitted
samples: video: tcpserversink: nv12 support
Add YUV420 semi-planar support (NV12). This is the video encoder prefered pixel format. Signed-off-by: Hugues Fruchet <[email protected]>
1 parent 5c54863 commit da714ed

File tree

1 file changed

+6
-1
lines changed
  • samples/drivers/video/tcpserversink/src

1 file changed

+6
-1
lines changed

samples/drivers/video/tcpserversink/src/main.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,12 @@ int main(void)
342342

343343
/* Size to allocate for each buffer */
344344
if (caps.min_line_count == LINE_COUNT_HEIGHT) {
345-
bsize = fmt.pitch * fmt.height;
345+
if (fmt.pixelformat == VIDEO_PIX_FMT_NV12) {
346+
bsize = fmt.width * fmt.height *
347+
video_bits_per_pixel(fmt.pixelformat) / BITS_PER_BYTE;
348+
} else {
349+
bsize = fmt.pitch * fmt.height;
350+
}
346351
} else {
347352
bsize = fmt.pitch * caps.min_line_count;
348353
}

0 commit comments

Comments
 (0)