Commit 718a8160 authored by Jakob Bornecrantz's avatar Jakob Bornecrantz

d/v4l2: Add new frameserver

parent a544b4b5
Pipeline #51067 passed with stages
in 1 minute and 30 seconds
......@@ -44,6 +44,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(udev REQUIRED)
set(BUILD_WITH_LIBUDEV TRUE)
set(BUILD_DRIVER_V4L2 TRUE)
endif()
cmake_dependent_option(BUILD_WITH_WAYLAND "Enable Wayland support" ON "WAYLAND_FOUND" OFF)
......
......@@ -70,3 +70,14 @@ if(BUILD_DRIVER_PSVR)
PRIVATE ${HIDAPI_INCLUDE_DIRS}
)
endif()
if(BUILD_DRIVER_V4L2)
set(V4L2_SOURCE_FILES
v4l2/v4l2_driver.c
)
# Use OBJECT to not create a archive, since it just gets in the way.
add_library(drv_v4l2 OBJECT ${V4L2_SOURCE_FILES})
set_property(TARGET drv_v4l2 PROPERTY POSITION_INDEPENDENT_CODE ON)
endif()
This diff is collapsed.
// Copyright 2019, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
* @brief Header
* @author Pete Black <pblack@collabora.com>
* @author Jakob Bornecrantz <jakob@collabora.com>
* @ingroup drv_v4l2
*/
#pragma once
#include "xrt/xrt_frameserver.h"
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @defgroup drv_v4l2 V4L2 frameserver driver
* @ingroup drv
*
* @brief Frameserver using the Video 4 Linux 2 framework.
*/
/*!
* Descriptor of a v4l2 source.
*
* @ingroup drv_v4l2
*/
struct v4l2_source_descriptor
{
struct xrt_fs_mode base;
char format_name[32];
struct
{
uint32_t width;
uint32_t height;
uint32_t format;
uint8_t extended_format;
size_t size;
size_t stride;
} stream;
/*!
* Offset from start off frame to start of pixels.
*
* Aka crop_scanline_bytes_start.
*
* Special case for ps4 camera
*/
size_t offset;
uint32_t rate;
};
/*!
* Create a v4l2 frameserver
*
* @ingroup drv_v4l2
*/
struct xrt_fs*
v4l2_fs_create(const char* device, struct xrt_fs_sink* q);
#ifdef __cplusplus
}
#endif
......@@ -41,6 +41,11 @@ if(BUILD_DRIVER_PSVR)
list(APPEND DRIVER_LIBRARIES ${HIDAPI_LIBRARIES})
endif()
if(BUILD_DRIVER_V4L2)
set(XRT_BUILD_V4L2 TRUE)
list(APPEND DRIVER_OBJECTS $<TARGET_OBJECTS:drv_v4l2>)
endif()
configure_file(targets_enabled_drivers.h.cmake_in ${CMAKE_CURRENT_BINARY_DIR}/targets_enabled_drivers.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment