/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * Copyright (C) 2019, Google Inc. * * main_window.h - qcam - Main application window */ #pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "../cam/stream_options.h" #include "viewfinder.h" class QAction; class QComboBox; class Image; class HotplugEvent; enum { OptCamera = 'c', OptHelp = 'h', OptRenderer = 'r', OptStream = 's', OptVerbose = 'v', }; class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(libcamera::CameraManager *cm, const OptionsParser::Options &options); ~MainWindow(); bool event(QEvent *e) override; private Q_SLOTS: void quit(); void updateTitle(); void switchCamera(int index); void toggleCapture(bool start); void saveImageAs(); void captureRaw(); void processRaw(libcamera::FrameBuffer *buffer, const libcamera::ControlList &metadata); void queueRequest(libcamera::FrameBuffer *buffer); private: int createToolbars(); std::string chooseCamera(); int openCamera(); int startCapture(); void stopCapture(); void addCamera(std::shared_ptr camera); void removeCamera(std::shared_ptr camera); void requestComplete(libcamera::Request *request); void processCapture(); void processHotplug(HotplugEvent *e); void processViewfinder(libcamera::FrameBuffer *buffer); /* UI elements */ QToolBar *toolbar_; QAction *startStopAction_; QComboBox *cameraCombo_; QAction *saveRaw_; ViewFinder *viewfinder_; QIcon iconPlay_; QIcon iconStop_; QString title_; QTimer titleTimer_; /* Options */ const OptionsParser::Options &options_; /* Camera manager, camera, configuration and buffers */ libcamera::CameraManager *cm_; std::shared_ptr camera_; libcamera::FrameBufferAllocator *allocator_; std::unique_ptr config_; std::map> mappedBuffers_; /* Capture state, buffers queue and statistics */ bool isCapturing_; bool captureRaw_; libcamera::Stream *vfStream_; libcamera::Stream *rawStream_; std::map> freeBuffers_; QQueue doneQueue_; QQueue freeQueue_; QMutex mutex_; /* Protects freeBuffers_, doneQueue_, and freeQueue_ */ uint64_t lastBufferTime_; QElapsedTimer frameRateInterval_; uint32_t previousFrames_; uint32_t framesCaptured_; std::vector> requests_; }; /tree/?h=rpi/streams/next&id=439cfe7fbd1b854db63900225e526f9a3a4ac08d'>root/src/v4l2/meson.build
blob: e88e0b33c51c942bed1c779e3c0d60c72b1b545d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# SPDX-License-Identifier: CC0-1.0

if not get_option('v4l2')
    v4l2_enabled = false
    subdir_done()
endif

v4l2_enabled = true

v4l2_compat_sources = files([
    'v4l2_camera.cpp',
    'v4l2_camera_file.cpp',
    'v4l2_camera_proxy.cpp',
    'v4l2_compat.cpp',
    'v4l2_compat_manager.cpp',
])

v4l2_compat_cpp_args = [
    # Meson enables large file support unconditionally, which redirect file
    # operations to 64-bit versions. This results in some symbols being
    # renamed, for instance open() being renamed to open64(). As the V4L2
    # adaptation wrapper needs to provide both 32-bit and 64-bit versions of
    # file operations, disable transparent large file support.
    '-U_FILE_OFFSET_BITS',
    '-D_FILE_OFFSET_BITS=32',
    '-D_LARGEFILE64_SOURCE',
    '-fvisibility=hidden',
]

v4l2_compat = shared_library('v4l2-compat',
                             v4l2_compat_sources,
                             name_prefix : '',
                             install : true,
                             install_dir : libcamera_libexecdir,
                             dependencies : [libcamera_private, libdl],
                             cpp_args : v4l2_compat_cpp_args)

# Provide a wrapper script to support easily loading applications with the V4L2
# adaptation layer.

cdata = configuration_data()
cdata.set('LIBCAMERA_V4L2_SO', get_option('prefix') / libcamera_libexecdir / 'v4l2-compat.so')

configure_file(input : 'libcamerify.in',
               output : 'libcamerify',
               configuration : cdata,
               install_dir : get_option('bindir'),
               install_tag : 'bin')