Skip to content

Commit 34f0587

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 c35d1fb commit 34f0587

File tree

1 file changed

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

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,11 @@ int main(void)
340340

341341
/* Size to allocate for each buffer */
342342
if (caps.min_line_count == LINE_COUNT_HEIGHT) {
343-
bsize = fmt.pitch * fmt.height;
343+
if (fmt.pixelformat == VIDEO_PIX_FMT_NV12) {
344+
bsize = fmt.width * fmt.height * 3 / 2;
345+
} else {
346+
bsize = fmt.pitch * fmt.height;
347+
}
344348
} else {
345349
bsize = fmt.pitch * caps.min_line_count;
346350
}

0 commit comments

Comments
 (0)