[host] linux: add skeleton pipewire capture backend

This commit is contained in:
Quantum 2021-08-20 02:22:17 -04:00 committed by Geoffrey McRae
parent 4b3aaa7e0c
commit 28eae3bd86
4 changed files with 128 additions and 2 deletions

View file

@ -3,7 +3,19 @@ project(capture LANGUAGES C)
include("PreCapture")
add_capture("XCB")
option(USE_XCB "Enable XSHM Support" ON)
option(USE_PIPEWIRE "Enable Pipewire Support" OFF)
if (USE_XCB)
add_capture("XCB")
endif()
if (USE_PIPEWIRE)
add_capture("pipewire")
endif()
add_feature_info(USE_XCB USE_XCB "XCB/XSHM capture backend.")
add_feature_info(USE_PIPEWIRE USE_PIPEWIRE "Pipewire Screencast capture backend.")
include("PostCapture")

View file

@ -48,7 +48,7 @@ struct xcb
xcb_xfixes_get_cursor_image_cookie_t curC;
};
struct xcb * this = NULL;
static struct xcb * this = NULL;
// forwards

View file

@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.0)
project(capture_pipewire LANGUAGES C)
add_library(capture_pipewire STATIC
src/pipewire.c
)
target_link_libraries(capture_pipewire
lg_common
)
target_include_directories(capture_pipewire
PRIVATE
src
)

View file

@ -0,0 +1,99 @@
/**
* Looking Glass
* Copyright © 2017-2021 The Looking Glass Authors
* https://looking-glass.io
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., 59
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "interface/capture.h"
#include "interface/platform.h"
#include "common/debug.h"
#include <string.h>
#include <stdlib.h>
struct pipewire
{
};
static struct pipewire * this = NULL;
// forwards
static bool pipewire_deinit();
// implementation
static const char * pipewire_getName(void)
{
return "Pipewire";
}
static bool pipewire_create(CaptureGetPointerBuffer getPointerBufferFn, CapturePostPointerBuffer postPointerBufferFn)
{
DEBUG_ASSERT(!this);
this = calloc(1, sizeof(*this));
return true;
}
static bool pipewire_init(void)
{
goto fail;
fail:
pipewire_deinit();
return false;
}
static bool pipewire_deinit(void)
{
return false;
}
static void pipewire_free(void)
{
free(this);
this = NULL;
}
static CaptureResult pipewire_capture(void)
{
return CAPTURE_RESULT_ERROR;
}
static CaptureResult pipewire_waitFrame(CaptureFrame * frame,
const size_t maxFrameSize)
{
return CAPTURE_RESULT_ERROR;
}
static CaptureResult pipewire_getFrame(FrameBuffer * frame,
const unsigned int height, int frameIndex)
{
return CAPTURE_RESULT_ERROR;
}
struct CaptureInterface Capture_pipewire =
{
.shortName = "pipewire",
.asyncCapture = false,
.getName = pipewire_getName,
.create = pipewire_create,
.init = pipewire_init,
.deinit = pipewire_deinit,
.free = pipewire_free,
.capture = pipewire_capture,
.waitFrame = pipewire_waitFrame,
.getFrame = pipewire_getFrame
};