Skip to content

Commit 0bae5f0

Browse files
committed
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 84476af commit 0bae5f0

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
@@ -367,7 +367,12 @@ int main(void)
367367

368368
/* Size to allocate for each buffer */
369369
if (caps.min_line_count == LINE_COUNT_HEIGHT) {
370-
bsize = fmt.pitch * fmt.height;
370+
if (fmt.pixelformat == VIDEO_PIX_FMT_NV12) {
371+
bsize = fmt.width * fmt.height *
372+
video_bits_per_pixel(fmt.pixelformat) / BITS_PER_BYTE;
373+
} else {
374+
bsize = fmt.pitch * fmt.height;
375+
}
371376
} else {
372377
bsize = fmt.pitch * caps.min_line_count;
373378
}

0 commit comments

Comments
 (0)