### Get Virtual Camera Device Description
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Configure-the-cameras
This command retrieves and displays the description of a specific virtual camera device.
```bash
AkVCamManager description AkVCamVideoDevice0
```
--------------------------------
### Install AKVirtualCamera Assistant on Windows
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Build-and-install
Installs the AKVirtualCamera assistant executable on Windows. It requires running commands in an administrator CMD, specifying the correct bitness (x64 or x86) for the assistant executable, and then starting the service.
```batch
rem If you are running in 64 bits Windows run:
/path/to/x64/AkVCamAssistant.exe --install
rem If you are running in 32 bits Windows run:
/path/to/x86/AkVCamAssistant.exe --install
rem Start the service
sc start AkVCamAssistant
```
--------------------------------
### List All Virtual Camera Devices
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Configure-the-cameras
This command lists all currently configured virtual camera devices.
```bash
AkVCamManager devices
```
--------------------------------
### List Supported Formats
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Configure-the-cameras
This command lists all supported capture formats for virtual cameras, outputting the information for review.
```bash
AkVCamManager supported-formats --output
```
--------------------------------
### Setup and Start Virtual Camera Service
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Hacks
This safe hack sets up and starts the virtual camera service if it is not already working. It requires no parameters.
```bash
AkVCamManager hack set-service-up
```
--------------------------------
### Get Default Recommended Output Format
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Configure-the-cameras
This command retrieves and displays the default recommended output format for virtual cameras.
```bash
AkVCamManager default-format --output
```
--------------------------------
### List Formats for a Virtual Camera Device
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Configure-the-cameras
This command lists all the capture formats currently associated with a specific virtual camera device.
```bash
AkVCamManager formats AkVCamVideoDevice0
```
--------------------------------
### Get Placeholder Picture Path
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Configure-the-cameras
This command retrieves and displays the current path of the placeholder picture used for the no-signal display.
```bash
AkVCamManager picture
```
--------------------------------
### Load Virtual Camera Configurations from INI File
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Configure-the-cameras
This command loads and applies all virtual device configurations defined in a specified INI file. The `load` command automatically calls `update`, so a separate update is not needed. The INI file follows the QSettings file format.
```bash
AkVCamManager load settings.ini
```
--------------------------------
### Install AKVirtualCamera Plugin on Mac
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Build-and-install
Installs the AKVirtualCamera plugin on macOS by linking the plugin to the CoreMediaIO directory and setting up a launch daemon for the assistant service.
```bash
# Is highly recommendable Linking the plugin instead of copying it.
ln -s /path/to/AkVirtualCamera.plugin /Library/CoreMediaIO/Plug-Ins/DAL/AkVirtualCamera.plugin
# Create the configuration file for the assistant.
cat << EOF > /Library/LaunchDaemons/org.webcamoid.cmio.AkVCam.Assistant.plist
Label
org.webcamoid.cmio.AkVCam.Assistant
ProgramArguments
/path/to/AkVirtualCamera.plugin/Contents/Resources/AkVCamAssistant
--timeout
300.0
MachServices
org.webcamoid.cmio.AkVCam.Assistant
StandardOutPath
/tmp/AkVCamAssistant.log
StandardErrorPath
/tmp/AkVCamAssistant.log
EOF
# If the service was disabled re-enable it.
launchctl enable system/org.webcamoid.cmio.AkVCam.Assistant
# Configure and launch the service.
launchctl bootstrap system /Library/LaunchDaemons/org.webcamoid.cmio.AkVCam.Assistant.plist
```
--------------------------------
### Video Output Example in C for akvirtualcamera
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Home
Demonstrates how to output video using C for the akvirtualcamera plugin. This example is useful for developers looking to integrate video streams.
```C
#include
int main() {
printf("Video output example in C\n");
// Placeholder for actual video output code
return 0;
}
```
--------------------------------
### Set Virtual Camera Device Description
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Configure-the-cameras
This command allows you to change the description of a virtual camera device.
```bash
AkVCamManager set-description AkVCamVideoDevice0 "My Virtual Camera"
```
--------------------------------
### Apply Virtual Camera Configuration Changes
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Configure-the-cameras
This command applies all pending changes made to the virtual camera configuration to the system. It's essential to run this after modifying any parameters. Modifications should not be made while a client is actively using the virtual camera.
```bash
AkVCamManager update
```
--------------------------------
### Define Video Formats for AKVirtualCamera
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Configure-the-cameras
Configures the supported video formats, including pixel format, resolution, and frame rate. Multiple formats and frame rates can be specified.
```ini
[Formats]
formats/size = 2
formats/1/format = YUY2
formats/1/width = 640
formats/1/height = 480
formats/1/fps = 30
formats/2/format = RGB24, YUY2
formats/2/width = 640
formats/2/height = 480
formats/2/fps = 20/1, 15/2
```
--------------------------------
### Remove All Virtual Camera Devices
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Configure-the-cameras
This command removes all virtual camera devices that have been configured.
```bash
AkVCamManager remove-devices
```
--------------------------------
### Add Virtual Camera Device
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Configure-the-cameras
This command adds a new virtual camera device with a specified description. The system returns a device ID, which is crucial for subsequent operations. A custom device ID can also be assigned.
```bash
AkVCamManager add-device "Virtual Camera"
```
```bash
AkVCamManager add-device -i FakeCamera0 "Virtual Camera"
```
--------------------------------
### List AVFoundation Devices (macOS)
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Usage-and-examples
Lists all available AVFoundation devices on macOS, which is a prerequisite for capturing video from devices using FFmpeg.
```bash
ffmpeg -f avfoundation -list_devices true -i dummy
```
--------------------------------
### List DirectShow Devices (Windows)
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Usage-and-examples
Lists all available DirectShow devices on Windows, necessary for capturing video from devices using FFmpeg.
```bash
ffmpeg -f dshow -list_devices true -i dummy
```
--------------------------------
### List Virtual Camera Clients
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Usage-and-examples
Lists all programs currently utilizing the virtual camera. The output includes the Process IDs (PIDs) and the executable path for each client.
```bash
AkVCamManager clients
```
--------------------------------
### Add Virtual Camera Format at Specific Index
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Configure-the-cameras
This command adds a new capture format to a virtual camera device at a specified index, allowing for ordered format lists.
```bash
AkVCamManager add-format --index 5 AkVCamVideoDevice0 YUY2 640 480 30
```
--------------------------------
### Install Target
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/windows/dshow/Test/CMakeLists.txt
Installs the 'VCamTest_dshow' target to the specified destination directory on Windows systems.
```CMake
if (WIN32)
install(TARGETS VCamTest_dshow DESTINATION ${BINDIR})
endif ()
```
--------------------------------
### Define Capture Format for Virtual Camera
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Configure-the-cameras
This command defines a capture format for a virtual camera device, specifying the format, width, height, and frame rate. The first format defined becomes the default.
```bash
AkVCamManager add-format AkVCamVideoDevice0 FORMAT WIDTH HEIGHT FRAME_RATE
```
```bash
AkVCamManager add-format AkVCamVideoDevice0 YUY2 640 480 30
```
--------------------------------
### List Supported Input Formats
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Usage-and-examples
Lists all supported input formats for the virtual camera manager. This is useful for determining compatible video formats for streaming.
```bash
AkVCamManager supported-formats --input
```
--------------------------------
### Build AKVirtualCamera with CMake on Mac
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Build-and-install
Builds the AKVirtualCamera project on macOS using CMake. It configures the build directory and then compiles the project using make.
```bash
cmake -S /path/to/akvirtualcamera -B /path/to/akvirtualcamera-build-directory
make -C /path/to/akvirtualcamera-build-directory
```
--------------------------------
### Play Virtual Camera with ffplay (Windows)
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Usage-and-examples
Plays the virtual camera feed on Windows using ffplay by specifying the virtual camera's name.
```bash
ffplay -f dshow -i video="Virtual Camera"
```
--------------------------------
### Set Default Placeholder Picture
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Configure-the-cameras
Specifies a placeholder image to be used when no video signal is available for the virtual camera.
```ini
[General]
default_frame = /path/to/place_holder_picture.png
```
--------------------------------
### Build AKVirtualCamera with CMake for Visual Studio
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Build-and-install
Builds the AKVirtualCamera project on Windows using CMake with the 'Visual Studio 16 2019' generator. It configures the build directory and then builds the project.
```bash
cmake -G "Visual Studio 16 2019" -S /path/to/akvirtualcamera -B /path/to/akvirtualcamera-build-directory
cmake --build /path/to/akvirtualcamera-build-directory
```
--------------------------------
### Install Virtual Camera Plugin on Windows
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/windows/dshow/VirtualCamera/CMakeLists.txt
Installs the VirtualCamera_dshow shared library to the specified destination directory on Windows systems. This makes the plugin available for use.
```CMake
if (WIN32)
install(TARGETS VirtualCamera_dshow DESTINATION ${BINDIR})
```
--------------------------------
### CMake Project Setup
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/CMakeLists.txt
Initializes a CMake project named 'AkVirtualCamera' and sets the minimum required CMake version to 3.16. It also includes common CMake scripts for shared functionality.
```cmake
cmake_minimum_required(VERSION 3.16)
project(AkVirtualCamera)
include(commons.cmake)
```
--------------------------------
### Install Service Executable
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/Service/CMakeLists.txt
Defines the installation rules for the 'Service' executable. The destination directory depends on the target operating system, placing it in DATAROOTDIR for macOS and BINDIR for Windows.
```CMake
if (APPLE OR FAKE_APPLE)
install(TARGETS Service DESTINATION ${DATAROOTDIR})
elseif (WIN32)
install(TARGETS Service DESTINATION ${BINDIR})
endif ()
```
--------------------------------
### Install akvirtualcamera Executable on Windows
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/windows/mf/Test/CMakeLists.txt
Installs the akvirtualcamera executable to the specified destination directory on Windows systems after a successful build.
```CMake
if (WIN32)
install(TARGETS VCamTest_mf DESTINATION ${BINDIR})
endif ()
```
--------------------------------
### Build AKVirtualCamera with CMake on MSYS2
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Build-and-install
Builds the AKVirtualCamera project on MSYS2 using CMake with the 'MSYS Makefiles' generator. It configures the build directory and then compiles the project using make.
```bash
cmake -G "MSYS Makefiles" -S /path/to/akvirtualcamera -B /path/to/akvirtualcamera-build-directory
make -C /path/to/akvirtualcamera-build-directory
```
--------------------------------
### Windows-Specific Libraries and Installation
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/windows/mf/VirtualCamera/CMakeLists.txt
This snippet defines extra libraries required for Windows builds, including 'mfplat', 'mfuuid', and 'winmm'. It then links these libraries along with other project dependencies to the 'VirtualCamera_mf' target. Finally, it installs the target to the specified directory on Windows.
```CMake
if (WIN32)
set(EXTRA_LIBS
mfplat
mfuuid
winmm)
endif ()
target_link_libraries(VirtualCamera_mf
VCamMediaSource
VCamIPC_windows
PlatformUtils_windows
VCamUtils
MFUtils
${EXTRA_LIBS})
add_definitions(-DSTRSAFE_NO_DEPRECATE)
if (WIN32)
install(TARGETS VirtualCamera_mf DESTINATION ${BINDIR})
endif ()
```
--------------------------------
### Install Executable on Windows
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/windows/mf/Service/CMakeLists.txt
Installs the 'VirtualCameraMFService' executable to the specified destination directory on Windows systems. This ensures the built application is placed in the correct location after compilation.
```CMake
if (WIN32)
install(TARGETS VirtualCameraMFService DESTINATION ${BINDIR})
endif ()
```
--------------------------------
### Install VCam_capi Library
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/capi/CMakeLists.txt
Defines the installation rules for the VCam_capi library. The library is installed to the appropriate directory (${LIBDIR} for macOS, ${BINDIR} for Windows) based on the target platform.
```CMake
if (APPLE OR FAKE_APPLE)
install(TARGETS VCam_capi DESTINATION ${LIBDIR})
elseif (WIN32)
install(TARGETS VCam_capi DESTINATION ${BINDIR})
endif ()
```
--------------------------------
### Play Virtual Camera with ffplay (macOS)
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Usage-and-examples
Plays the virtual camera feed on macOS using ffplay. Requires identifying the correct DEVICE_INDEX from the AVFoundation device list and setting the framerate.
```bash
ffplay -f avfoundation -i DEVICE_INDEX -framerate 30
```
--------------------------------
### CMake Project Setup and Library Creation
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/cmio/VirtualCamera/CMakeLists.txt
This snippet sets the minimum CMake version, defines the project name and language, includes common CMake modules, and configures C++ standards. It then defines the source files and creates a shared library named 'VirtualCamera_cmio', conditionally excluding it from all targets on non-macOS platforms.
```cmake
cmake_minimum_required(VERSION 3.16)
project(VirtualCamera_cmio LANGUAGES CXX)
include(../../commons.cmake)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(SOURCES
src/clock.cpp
src/clock.h
src/device.cpp
src/device.h
src/object.cpp
src/object.h
src/objectinterface.cpp
src/objectinterface.h
src/objectproperties.cpp
src/objectproperties.h
src/plugin.cpp
src/plugin.h
src/plugininterface.cpp
src/plugininterface.h
src/queue.h
src/stream.cpp
src/stream.h)
if (APPLE OR FAKE_APPLE)
add_library(VirtualCamera_cmio SHARED ${SOURCES})
else ()
add_library(VirtualCamera_cmio SHARED EXCLUDE_FROM_ALL ${SOURCES})
endif ()
```
--------------------------------
### INI Configuration for Virtual Cameras
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Configure-the-cameras
This INI file snippet defines two virtual camera devices. It specifies the number of cameras, and for each camera, its description, supported formats (as a comma-separated list of indices), and an optional custom device ID.
```ini
[Cameras]
cameras/size = 2
cameras/1/description = My Virtual Camera
cameras/1/formats = 1
cameras/1/id = MyFakeCamera0
cameras/2/description = My Other Virtual Camera
cameras/2/formats = 1, 2
```
--------------------------------
### Configure CMake Project
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/windows/mf/FakeMFSensorGroup/CMakeLists.txt
Sets the minimum required CMake version and defines the project name and languages. This is a standard starting point for CMake projects.
```CMake
cmake_minimum_required(VERSION 3.16)
project(FakeMFSensorGroup LANGUAGES CXX)
```
--------------------------------
### Conditional Compilation and Installation
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/cmio/VirtualCamera/CMakeLists.txt
This snippet conditionally defines the 'FAKE_APPLE' preprocessor macro if 'FAKE_APPLE' is set. It also includes installation commands to copy the built library and Info.plist file to their respective destinations based on the build configuration.
```cmake
if (FAKE_APPLE)
add_definitions(-DFAKE_APPLE)
endif ()
if (APPLE OR FAKE_APPLE)
install(TARGETS VirtualCamera_cmio DESTINATION ${BINDIR})
install(FILES ${CMAKE_BINARY_DIR}/${BUILDDIR}/${EXECPREFIX}/Info.plist DESTINATION ${EXECPREFIX})
endif ()
```
--------------------------------
### Listen to Virtual Camera Events
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Usage-and-examples
Keeps track of global virtual camera events such as device additions, removals, and default picture changes. Press Ctrl-C to stop the manager.
```bash
AkVCamManager listen-events
```
--------------------------------
### CMake Project Setup for akvirtualcamera
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/windows/mf/CMakeLists.txt
This snippet configures the CMake build environment for the akvirtualcamera project. It specifies the minimum required CMake version and defines the project name. It then includes various subdirectories that contain the project's modules.
```cmake
cmake_minimum_required(VERSION 3.16)
project(MFVirtualCamera)
add_subdirectory(MFUtils)
add_subdirectory(MediaSource)
add_subdirectory(Service)
add_subdirectory(VirtualCamera)
add_subdirectory(Test)
add_subdirectory(FakeMFSensorGroup)
```
--------------------------------
### CMake Project Setup for akvirtualcamera
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/windows/dshow/BaseFilter/CMakeLists.txt
This snippet shows the basic CMake configuration for the akvirtualcamera project. It sets the minimum required CMake version, defines the project name and languages, and includes common CMake modules. It also configures C++ standards and includes directories.
```CMake
cmake_minimum_required(VERSION 3.16)
project(VCamBaseFilter LANGUAGES CXX)
include(../../../commons.cmake)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
```
--------------------------------
### CMake Project Setup and C++ Standard
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/Manager/CMakeLists.txt
Initializes the CMake project named 'Manager' and sets the C++ standard to C++20. It also includes common CMake modules from a 'commons.cmake' file.
```cmake
cmake_minimum_required(VERSION 3.16)
project(Manager LANGUAGES CXX)
include(../commons.cmake)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
```
--------------------------------
### CMake Project Setup for akvirtualcamera
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/windows/mf/VirtualCamera/CMakeLists.txt
This snippet configures the CMake build for the akvirtualcamera project. It sets the minimum CMake version, project name, C++ standard to 20, and includes common CMake modules. It defines the source files and creates a shared library named 'VirtualCamera_mf'.
```CMake
cmake_minimum_required(VERSION 3.16)
project(VirtualCamera_mf LANGUAGES CXX)
include(../../../commons.cmake)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(SOURCES
src/classfactory.h
src/classfactory.cpp
src/plugin.cpp
src/plugin.h
src/plugininterface.cpp
src/plugininterface.h
VirtualCamera.def)
if (WIN32)
add_library(VirtualCamera_mf SHARED ${SOURCES})
else ()
add_library(VirtualCamera_mf SHARED EXCLUDE_FROM_ALL ${SOURCES})
endif ()
```
--------------------------------
### Stream Raw Video Frames
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Usage-and-examples
Streams raw video frames from standard input to the virtual camera. Requires specifying the input format, width, and height of the video frames.
```bash
frame_producer_program | AkVCamManager stream AkVCamVideoDevice0 INPUT_FORMAT WIDTH HEIGHT
```
--------------------------------
### Get AKVirtualCamera Control Parameters
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Device-controls
Retrieves detailed parameters for a specific control of a virtual webcam device. This includes its description, type, minimum and maximum values, step size, default value, and menu options if applicable.
```bash
AkVCamManager get-control --description AkVCamVideoDevice0 CONTROL_NAME
```
```bash
AkVCamManager get-control --type AkVCamVideoDevice0 CONTROL_NAME
```
```bash
AkVCamManager get-control --min AkVCamVideoDevice0 CONTROL_NAME
```
```bash
AkVCamManager get-control --max AkVCamVideoDevice0 CONTROL_NAME
```
```bash
AkVCamManager get-control --step AkVCamVideoDevice0 CONTROL_NAME
```
```bash
AkVCamManager get-control --default AkVCamVideoDevice0 CONTROL_NAME
```
```bash
AkVCamManager get-control --menu AkVCamVideoDevice0 CONTROL_NAME
```
--------------------------------
### Remove Virtual Camera Device
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Configure-the-cameras
This command removes a specific virtual camera device identified by its device ID.
```bash
AkVCamManager remove-device AkVCamVideoDevice0
```
--------------------------------
### Remove All Formats for a Virtual Camera Device
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Configure-the-cameras
This command removes all capture formats associated with a specific virtual camera device.
```bash
AkVCamManager remove-formats AkVCamVideoDevice0
```
--------------------------------
### Remove Virtual Camera Device Format
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Configure-the-cameras
This command removes a specific capture format from a virtual camera device, identified by its index in the format list.
```bash
AkVCamManager remove-format AkVCamVideoDevice0 INDEX
```
--------------------------------
### Set No-Signal Placeholder Picture
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Configure-the-cameras
This command sets a custom picture to be displayed when the virtual camera is not receiving any frames. The path to the image file must be provided. Supported formats include BMP, JPG, and PNG.
```bash
AkVCamManager set-picture /path/to/place_holder_picture.png
```
--------------------------------
### Plugin Information and Linking Libraries
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/cmio/VirtualCamera/CMakeLists.txt
This part sets CMake variables for plugin vendor and product names, then adds them as preprocessor definitions. It also finds necessary macOS frameworks (CoreFoundation, CoreGraphics, etc.) and links them along with other project libraries to the 'VirtualCamera_cmio' target.
```cmake
set(CMIO_PLUGIN_VENDOR "Webcamoid Project")
set(CMIO_PLUGIN_PRODUCT ${AKVCAM_PLUGIN_NAME})
add_definitions(-DCMIO_PLUGIN_VENDOR="${CMIO_PLUGIN_VENDOR}"
-DCMIO_PLUGIN_PRODUCT="${CMIO_PLUGIN_PRODUCT}")
if (APPLE OR FAKE_APPLE)
if (APPLE)
find_library(COREFOUNDATION_FRAMEWORK NAMES CoreFoundation)
find_library(COREGRAPHICS_FRAMEWORK NAMES CoreGraphics)
find_library(COREMEDIA_FRAMEWORK NAMES CoreMedia)
find_library(COREMEDIAIO_FRAMEWORK NAMES CoreMediaIO)
find_library(COREVIDEO_FRAMEWORK NAMES CoreVideo)
find_library(FOUNDATION_FRAMEWORK NAMES Foundation)
find_library(IOKIT_FRAMEWORK NAMES IOKit)
set(EXTRA_LIBS
${COREFOUNDATION_FRAMEWORK}
${COREGRAPHICS_FRAMEWORK}
${COREMEDIA_FRAMEWORK}
${COREMEDIAIO_FRAMEWORK}
${COREVIDEO_FRAMEWORK}
${FOUNDATION_FRAMEWORK}
${IOKIT_FRAMEWORK})
endif ()
endif ()
target_link_libraries(VirtualCamera_cmio
VCamIPC_cmio
PlatformUtils_cmio
VCamUtils
${EXTRA_LIBS})
```
--------------------------------
### Install Manager Executable
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/Manager/CMakeLists.txt
Installs the 'Manager' executable to the appropriate directory based on the operating system. On macOS, it's installed under ${DATAROOTDIR}, and on Windows, it's installed under ${BINDIR}.
```cmake
if (APPLE OR FAKE_APPLE)
install(TARGETS Manager DESTINATION ${DATAROOTDIR})
elseif (WIN32)
install(TARGETS Manager DESTINATION ${BINDIR})
endif ()
```
--------------------------------
### Configure Include Directories and Link Libraries
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/Service/CMakeLists.txt
Sets include directories and links necessary libraries for the 'Service' target. This includes general includes, platform-specific headers, and libraries like VCamUtils, VCamIPC, and PlatformUtils.
```CMake
target_include_directories(Service
PRIVATE
..)
target_link_libraries(Service
VCamUtils)
if (APPLE OR FAKE_APPLE)
target_include_directories(Service
PRIVATE
../cmio)
if (FAKE_APPLE)
target_include_directories(Service
PRIVATE
../cmio/FakeAPI)
endif ()
target_link_libraries(Service
VCamIPC_cmio
PlatformUtils_cmio)
elseif (WIN32)
target_include_directories(Service
PRIVATE
../windows)
target_link_libraries(Service
VCamIPC_windows
PlatformUtils_windows)
endif ()
```
--------------------------------
### Define Static Library for VCamUtils
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/VCamUtils/CMakeLists.txt
Creates a static library named 'VCamUtils' and lists all the source and header files that comprise the library's functionality, including utilities for color, fractions, logging, messages, settings, sockets, timers, and video formats.
```CMake
add_library(VCamUtils STATIC
src/color.h
src/fraction.cpp
src/fraction.h
src/ipcbridge.h
src/logger.cpp
src/logger.h
src/message.cpp
src/message.h
src/messageclient.cpp
src/messageclient.h
src/messageserver.cpp
src/messageserver.h
src/servicemsg.h
src/settings.cpp
src/settings.h
src/sockets.cpp
src/sockets.h
src/timer.cpp
src/timer.h
src/utils.cpp
src/utils.h
src/videoformat.cpp
src/videoformat.h
src/videoformattypes.h
src/videoframe.cpp
src/videoframe.h
src/videoframetypes.h)
```
--------------------------------
### Install FakeMFSensorGroup on Windows
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/windows/mf/FakeMFSensorGroup/CMakeLists.txt
Conditionally installs the `FakeMFSensorGroup` library to the specified destination directory (`${BINDIR}`) if the build is for Windows and the `FAKE_MFSENSORGROUP` option is enabled.
```CMake
if (WIN32 AND FAKE_MFSENSORGROUP)
install(TARGETS FakeMFSensorGroup DESTINATION ${BINDIR})
endif ()
```
--------------------------------
### Configure CMake Project
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/cmio/CMakeLists.txt
Sets the minimum required CMake version and defines the project name. It then includes subdirectories for platform utilities, VCam IPC, and the virtual camera module.
```cmake
cmake_minimum_required(VERSION 3.16)
project(cmio)
add_subdirectory(PlatformUtils)
add_subdirectory(VCamIPC)
add_subdirectory(VirtualCamera)
```
--------------------------------
### Set Compile Definitions and Include Directories (CMake)
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/cmio/PlatformUtils/CMakeLists.txt
This snippet sets compile definitions for the 'PlatformUtils_cmio' library, including the CMIO assistant name, binary directory, data root directory, and the default service port. It also configures include directories and conditionally adds include paths for 'FakeAPI' on FAKE_APPLE platforms.
```cmake
add_dependencies(PlatformUtils_cmio VCamUtils)
target_compile_definitions(PlatformUtils_cmio PRIVATE PLATFORMUTILS_LIBRARY)
target_include_directories(PlatformUtils_cmio
PRIVATE
..
../..)
set(CMIO_ASSISTANT_NAME "io.github.webcamoid.${AKVCAM_PLUGIN_NAME}.${AKVCAM_SERVICE_NAME}")
add_definitions(-DCMIO_ASSISTANT_NAME="${CMIO_ASSISTANT_NAME}")
if (FAKE_APPLE)
target_include_directories(PlatformUtils_cmio
PRIVATE
../FakeAPI)
endif ()
add_definitions(-DBINDIR="${BINDIR}"
-DDATAROOTDIR="${DATAROOTDIR}"
-DAKVCAM_SERVICEPORT_DEFAULT="${AKVCAM_SERVICEPORT}")
if (FAKE_APPLE)
add_definitions(-DFAKE_APPLE)
endif ()
```
--------------------------------
### Dump AKVirtualCamera Configurations
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Debugging-the-plugin
Retrieves a summary of the virtual camera configurations in a parsable XML format. This command is useful for inspecting and understanding the current settings of the virtual cameras.
```bash
AkVCamManager dump
```
--------------------------------
### Stream Video with FFmpeg (RGB24)
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Usage-and-examples
Streams video content from a file (e.g., video.webm) to the virtual camera using FFmpeg. It specifies the input format as RGB24 with a resolution of 480x360.
```bash
ffmpeg -i video.webm -pix_fmt rgb24 -f rawvideo - | AkVCamManager stream AkVCamVideoDevice0 RGB24 480 360
```
--------------------------------
### Manage Dependencies and Include Directories
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/cmio/VCamIPC/CMakeLists.txt
Adds dependencies for the virtual camera IPC library and specifies include directories. It also conditionally adds include directories for a fake Apple environment.
```CMake
add_dependencies(VCamIPC_cmio VCamUtils)
target_compile_definitions(VCamIPC_cmio PRIVATE VCAMIPC_LIBRARY)
target_include_directories(VCamIPC_cmio
PRIVATE
..
../..)
if (FAKE_APPLE)
target_include_directories(VCamIPC_cmio
PRIVATE
../FakeAPI)
endif ()
```
--------------------------------
### Get AKVirtualCamera Control Value
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Device-controls
Retrieves the current value of a specific control for a given virtual webcam device. Replace CONTROL_NAME with the actual name of the control you want to query.
```bash
AkVCamManager get-control AkVCamVideoDevice0 CONTROL_NAME
```
--------------------------------
### Link Libraries for Windows Target
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/windows/VCamIPC/CMakeLists.txt
This CMake code defines a list of extra libraries required for the Windows target, including 'advapi32', 'kernel32', and 'psapi'. It then links these libraries, along with 'PlatformUtils_windows', to the 'VCamIPC_windows' static library.
```CMake
if (WIN32)
set(EXTRA_LIBS
advapi32
kernel32
psapi)
endif ()
target_link_libraries(VCamIPC_windows PlatformUtils_windows ${EXTRA_LIBS})
```
--------------------------------
### Dependency Management and Compile Definitions
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/cmio/VirtualCamera/CMakeLists.txt
This snippet adds dependencies on other CMake targets ('VCamIPC_cmio', 'PlatformUtils_cmio', 'VCamUtils') and defines the 'VIRTUALCAMERA_LIBRARY' compile definition. It also sets include directories for the project and a platform-specific include directory for 'FakeAPI' if FAKE_APPLE is defined.
```cmake
add_dependencies(VirtualCamera_cmio VCamIPC_cmio PlatformUtils_cmio VCamUtils)
target_compile_definitions(VirtualCamera_cmio PRIVATE VIRTUALCAMERA_LIBRARY)
target_include_directories(VirtualCamera_cmio
PRIVATE ..
PRIVATE ..)
if (FAKE_APPLE)
target_include_directories(VirtualCamera_cmio
PRIVATE
../FakeAPI)
endif ()
```
--------------------------------
### Add Target Dependencies and Definitions
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/windows/mf/Service/CMakeLists.txt
Specifies dependencies on other targets like 'VCamMediaSource', 'PlatformUtils_windows', 'MFUtils', and Windows-specific libraries ('mfplat', 'mfuuid'). It also defines a preprocessor macro 'VIRTUALCAMERAMF_SERVICE' and includes specific directories.
```CMake
add_dependencies(VirtualCameraMFService VCamMediaSource PlatformUtils_windows MFUtils)
target_compile_definitions(VirtualCameraMFService PRIVATE VIRTUALCAMERAMF_SERVICE)
target_include_directories(VirtualCameraMFService
PRIVATE
../MediaSource/src
..
../..
../../..)
if (WIN32)
set(EXTRA_LIBS
mfplat
mfuuid)
endif ()
target_link_libraries(VirtualCameraMFService
VCamMediaSource
PlatformUtils_windows
MFUtils
${EXTRA_LIBS})
add_definitions(-DSTRSAFE_NO_DEPRECATE)
```
--------------------------------
### Stream Video with FFmpeg (Regulated FPS)
Source: https://github.com/webcamoid/akvirtualcamera/wiki/Usage-and-examples
Streams video content from a file to the virtual camera using FFmpeg, with a regulated frame rate. The --fps flag controls the input stream's frame rate.
```bash
ffmpeg -i video.webm -pix_fmt rgb24 -f rawvideo - | AkVCamManager stream --fps 30 AkVCamVideoDevice0 RGB24 480 360
```
--------------------------------
### Define Library Sources and Creation
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/cmio/VCamIPC/CMakeLists.txt
Defines the source files for the virtual camera IPC library and creates a static library. The library is created differently for Apple platforms (including a fake Apple environment) versus other platforms.
```CMake
set(SOURCES
src/ipcbridge.cpp)
if (APPLE OR FAKE_APPLE)
add_library(VCamIPC_cmio STATIC ${SOURCES})
else ()
add_library(VCamIPC_cmio STATIC EXCLUDE_FROM_ALL ${SOURCES})
endif ()
```
--------------------------------
### Include Directories and Link Libraries
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/Manager/CMakeLists.txt
Configures include paths and links necessary libraries to the 'Manager' target. It includes a general include path and platform-specific libraries for macOS and Windows.
```cmake
target_include_directories(Manager
PRIVATE ..)
target_link_libraries(Manager
VCamUtils)
if (APPLE OR FAKE_APPLE)
target_link_libraries(Manager
VCamIPC_cmio
PlatformUtils_cmio)
elseif (WIN32)
target_link_libraries(Manager
VCamIPC_windows
PlatformUtils_windows)
endif ()
```
--------------------------------
### Link Libraries for Virtual Camera
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/windows/dshow/VirtualCamera/CMakeLists.txt
Links the VirtualCamera_dshow library with its dependencies, including base filters, IPC modules, utility libraries, and Windows-specific libraries. It also defines a preprocessor macro.
```CMake
add_dependencies(VirtualCamera_dshow VCamBaseFilter VCamIPC_windows PlatformUtils_windows VCamUtils)
target_compile_definitions(VirtualCamera_dshow PRIVATE VIRTUALCAMERA_LIBRARY)
if (WIN32)
set(EXTRA_LIBS
advapi32
gdi32
kernel32
ole32
oleaut32
psapi
shell32
strmiids
user32
uuid
winmm)
endif ()
target_link_libraries(VirtualCamera_dshow
VCamBaseFilter
VCamIPC_windows
PlatformUtils_windows
VCamUtils
${EXTRA_LIBS})
add_definitions(-DSTRSAFE_NO_DEPRECATE)
```
--------------------------------
### Configure CMake Project for akvirtualcamera
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/windows/mf/Test/CMakeLists.txt
Sets up the CMake build environment for the akvirtualcamera project. It specifies the minimum required CMake version, project name, and the programming language (C++).
```CMake
cmake_minimum_required(VERSION 3.16)
project(VCamTest_mf LANGUAGES CXX)
```
--------------------------------
### Link Libraries for akvirtualcamera
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/windows/mf/Test/CMakeLists.txt
Links the akvirtualcamera executable with its own modules (VCamMediaSource, MFUtils) and any platform-specific libraries defined in EXTRA_LIBS.
```CMake
target_link_libraries(VCamTest_mf
VCamMediaSource
MFUtils
${EXTRA_LIBS})
```
--------------------------------
### Define Virtual Camera Source Files
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/windows/dshow/VirtualCamera/CMakeLists.txt
Lists the source and header files required to build the VirtualCamera_dshow library. This includes plugin-related files and definitions.
```CMake
set(SOURCES
src/classfactory.cpp
src/classfactory.h
src/plugin.cpp
src/plugin.h
src/plugininterface.cpp
src/plugininterface.h
VirtualCamera.def)
```
--------------------------------
### Define Extra Libraries for Windows Build
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/windows/mf/Test/CMakeLists.txt
Defines a list of extra libraries required for the Windows build of akvirtualcamera, including Media Foundation components.
```CMake
if (WIN32)
set(EXTRA_LIBS
mfplat
mfreadwrite
mfuuid
winmm)
endif ()
```
--------------------------------
### Configure CMake Project
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/windows/CMakeLists.txt
Sets the minimum required CMake version and defines the project name. It then includes subdirectories for different platform-specific modules and functionalities.
```cmake
cmake_minimum_required(VERSION 3.16)
project(windows)
add_subdirectory(PlatformUtils)
add_subdirectory(dshow)
add_subdirectory(mf)
add_subdirectory(VCamIPC)
```
--------------------------------
### Add Dependencies and Compile Definitions
Source: https://github.com/webcamoid/akvirtualcamera/blob/master/windows/VCamIPC/CMakeLists.txt
This CMake snippet adds dependencies for the 'VCamIPC_windows' library, specifically 'PlatformUtils_windows' and 'VCamUtils'. It also sets a compile definition 'VCAMIPC_LIBRARY' for the library and includes necessary directories.
```CMake
add_dependencies(VCamIPC_windows PlatformUtils_windows VCamUtils)
target_compile_definitions(VCamIPC_windows PRIVATE VCAMIPC_LIBRARY)
target_include_directories(VCamIPC_windows
PRIVATE ..
PRIVATE ../..)
```