diff options
Diffstat (limited to 'src/apps')
30 files changed, 61 insertions, 47 deletions
diff --git a/src/apps/cam/camera_session.cpp b/src/apps/cam/camera_session.cpp index 6b409c98..8fcec630 100644 --- a/src/apps/cam/camera_session.cpp +++ b/src/apps/cam/camera_session.cpp @@ -13,9 +13,11 @@ #include <libcamera/control_ids.h> #include <libcamera/property_ids.h> +#include "../common/event_loop.h" +#include "../common/stream_options.h" + #include "camera_session.h" #include "capture_script.h" -#include "event_loop.h" #include "file_sink.h" #ifdef HAVE_KMS #include "kms_sink.h" @@ -24,7 +26,6 @@ #ifdef HAVE_SDL #include "sdl_sink.h" #endif -#include "stream_options.h" using namespace libcamera; diff --git a/src/apps/cam/camera_session.h b/src/apps/cam/camera_session.h index d562caae..0bab519f 100644 --- a/src/apps/cam/camera_session.h +++ b/src/apps/cam/camera_session.h @@ -21,7 +21,7 @@ #include <libcamera/request.h> #include <libcamera/stream.h> -#include "options.h" +#include "../common/options.h" class CaptureScript; class FrameSink; diff --git a/src/apps/cam/drm.cpp b/src/apps/cam/drm.cpp index 2e4d7985..8779a713 100644 --- a/src/apps/cam/drm.cpp +++ b/src/apps/cam/drm.cpp @@ -24,7 +24,7 @@ #include <libdrm/drm_mode.h> -#include "event_loop.h" +#include "../common/event_loop.h" namespace DRM { diff --git a/src/apps/cam/file_sink.cpp b/src/apps/cam/file_sink.cpp index 4dfacc10..b32aad24 100644 --- a/src/apps/cam/file_sink.cpp +++ b/src/apps/cam/file_sink.cpp @@ -15,9 +15,10 @@ #include <libcamera/camera.h> -#include "dng_writer.h" +#include "../common/dng_writer.h" +#include "../common/image.h" + #include "file_sink.h" -#include "image.h" using namespace libcamera; diff --git a/src/apps/cam/main.cpp b/src/apps/cam/main.cpp index d70130e2..5d8a57bc 100644 --- a/src/apps/cam/main.cpp +++ b/src/apps/cam/main.cpp @@ -14,11 +14,12 @@ #include <libcamera/libcamera.h> #include <libcamera/property_ids.h> +#include "../common/event_loop.h" +#include "../common/options.h" +#include "../common/stream_options.h" + #include "camera_session.h" -#include "event_loop.h" #include "main.h" -#include "options.h" -#include "stream_options.h" using namespace libcamera; diff --git a/src/apps/cam/meson.build b/src/apps/cam/meson.build index 297de64f..48c834ac 100644 --- a/src/apps/cam/meson.build +++ b/src/apps/cam/meson.build @@ -10,16 +10,12 @@ cam_enabled = true cam_sources = files([ 'camera_session.cpp', 'capture_script.cpp', - 'event_loop.cpp', 'file_sink.cpp', 'frame_sink.cpp', - 'image.cpp', 'main.cpp', - 'options.cpp', - 'stream_options.cpp', ]) -cam_cpp_args = [] +cam_cpp_args = [apps_cpp_args] libdrm = dependency('libdrm', required : false) libjpeg = dependency('libjpeg', required : false) @@ -49,14 +45,8 @@ if libsdl2.found() endif endif -if libtiff.found() - cam_cpp_args += ['-DHAVE_TIFF'] - cam_sources += files([ - 'dng_writer.cpp', - ]) -endif - cam = executable('cam', cam_sources, + link_with : apps_lib, dependencies : [ libatomic, libcamera_public, diff --git a/src/apps/cam/sdl_sink.cpp b/src/apps/cam/sdl_sink.cpp index ee177227..a2f4abc1 100644 --- a/src/apps/cam/sdl_sink.cpp +++ b/src/apps/cam/sdl_sink.cpp @@ -19,8 +19,9 @@ #include <libcamera/camera.h> #include <libcamera/formats.h> -#include "event_loop.h" -#include "image.h" +#include "../common/event_loop.h" +#include "../common/image.h" + #ifdef HAVE_LIBJPEG #include "sdl_texture_mjpg.h" #endif diff --git a/src/apps/cam/sdl_texture.h b/src/apps/cam/sdl_texture.h index 6ccd85ea..3993dd46 100644 --- a/src/apps/cam/sdl_texture.h +++ b/src/apps/cam/sdl_texture.h @@ -11,7 +11,7 @@ #include <SDL2/SDL.h> -#include "image.h" +#include "../common/image.h" class SDLTexture { diff --git a/src/apps/cam/dng_writer.cpp b/src/apps/common/dng_writer.cpp index c945edce..c945edce 100644 --- a/src/apps/cam/dng_writer.cpp +++ b/src/apps/common/dng_writer.cpp diff --git a/src/apps/cam/dng_writer.h b/src/apps/common/dng_writer.h index 38f38f62..38f38f62 100644 --- a/src/apps/cam/dng_writer.h +++ b/src/apps/common/dng_writer.h diff --git a/src/apps/cam/event_loop.cpp b/src/apps/common/event_loop.cpp index cb83845c..cb83845c 100644 --- a/src/apps/cam/event_loop.cpp +++ b/src/apps/common/event_loop.cpp diff --git a/src/apps/cam/event_loop.h b/src/apps/common/event_loop.h index ef79e8e5..ef79e8e5 100644 --- a/src/apps/cam/event_loop.h +++ b/src/apps/common/event_loop.h diff --git a/src/apps/cam/image.cpp b/src/apps/common/image.cpp index fe2cc6da..fe2cc6da 100644 --- a/src/apps/cam/image.cpp +++ b/src/apps/common/image.cpp diff --git a/src/apps/cam/image.h b/src/apps/common/image.h index 7953b177..7953b177 100644 --- a/src/apps/cam/image.h +++ b/src/apps/common/image.h diff --git a/src/apps/common/meson.build b/src/apps/common/meson.build new file mode 100644 index 00000000..479326cd --- /dev/null +++ b/src/apps/common/meson.build @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: CC0-1.0 + +apps_sources = files([ + 'image.cpp', + 'options.cpp', + 'stream_options.cpp', +]) + +apps_cpp_args = [] + +if libevent.found() + apps_sources += files([ + 'event_loop.cpp', + ]) +endif + +if libtiff.found() + apps_cpp_args += ['-DHAVE_TIFF'] + apps_sources += files([ + 'dng_writer.cpp', + ]) +endif + +apps_lib = static_library('apps', apps_sources, + cpp_args : apps_cpp_args, + dependencies : [libcamera_public]) diff --git a/src/apps/cam/options.cpp b/src/apps/common/options.cpp index 4f7e8691..4f7e8691 100644 --- a/src/apps/cam/options.cpp +++ b/src/apps/common/options.cpp diff --git a/src/apps/cam/options.h b/src/apps/common/options.h index 4ddd4987..4ddd4987 100644 --- a/src/apps/cam/options.h +++ b/src/apps/common/options.h diff --git a/src/apps/cam/stream_options.cpp b/src/apps/common/stream_options.cpp index 3a5625f5..3a5625f5 100644 --- a/src/apps/cam/stream_options.cpp +++ b/src/apps/common/stream_options.cpp diff --git a/src/apps/cam/stream_options.h b/src/apps/common/stream_options.h index 35e4e7c0..35e4e7c0 100644 --- a/src/apps/cam/stream_options.h +++ b/src/apps/common/stream_options.h diff --git a/src/apps/lc-compliance/main.cpp b/src/apps/lc-compliance/main.cpp index 7eb52ae4..74e0d4df 100644 --- a/src/apps/lc-compliance/main.cpp +++ b/src/apps/lc-compliance/main.cpp @@ -14,8 +14,9 @@ #include <libcamera/libcamera.h> +#include "../common/options.h" + #include "environment.h" -#include "../cam/options.h" using namespace libcamera; diff --git a/src/apps/lc-compliance/meson.build b/src/apps/lc-compliance/meson.build index 05d622be..51d9075a 100644 --- a/src/apps/lc-compliance/meson.build +++ b/src/apps/lc-compliance/meson.build @@ -11,8 +11,6 @@ endif lc_compliance_enabled = true lc_compliance_sources = files([ - '../cam/event_loop.cpp', - '../cam/options.cpp', 'environment.cpp', 'main.cpp', 'simple_capture.cpp', @@ -21,6 +19,7 @@ lc_compliance_sources = files([ lc_compliance = executable('lc-compliance', lc_compliance_sources, cpp_args : [ '-fexceptions' ], + link_with : apps_lib, dependencies : [ libatomic, libcamera_public, diff --git a/src/apps/lc-compliance/simple_capture.h b/src/apps/lc-compliance/simple_capture.h index 9d31f7cb..fd9d2a97 100644 --- a/src/apps/lc-compliance/simple_capture.h +++ b/src/apps/lc-compliance/simple_capture.h @@ -11,7 +11,7 @@ #include <libcamera/libcamera.h> -#include "../cam/event_loop.h" +#include "../common/event_loop.h" class SimpleCapture { diff --git a/src/apps/meson.build b/src/apps/meson.build index b722a8f1..09987635 100644 --- a/src/apps/meson.build +++ b/src/apps/meson.build @@ -12,6 +12,8 @@ endif libtiff = dependency('libtiff-4', required : false) +subdir('common') + subdir('lc-compliance') subdir('cam') diff --git a/src/apps/qcam/format_converter.cpp b/src/apps/qcam/format_converter.cpp index 9331da0c..de76b32c 100644 --- a/src/apps/qcam/format_converter.cpp +++ b/src/apps/qcam/format_converter.cpp @@ -14,7 +14,7 @@ #include <libcamera/formats.h> -#include "../cam/image.h" +#include "../common/image.h" #define RGBSHIFT 8 #ifndef MAX diff --git a/src/apps/qcam/main.cpp b/src/apps/qcam/main.cpp index d3f01a85..36cb93a5 100644 --- a/src/apps/qcam/main.cpp +++ b/src/apps/qcam/main.cpp @@ -13,8 +13,9 @@ #include <libcamera/camera_manager.h> -#include "../cam/options.h" -#include "../cam/stream_options.h" +#include "../common/options.h" +#include "../common/stream_options.h" + #include "main_window.h" #include "message_handler.h" diff --git a/src/apps/qcam/main_window.cpp b/src/apps/qcam/main_window.cpp index f553ccb0..fb2db4aa 100644 --- a/src/apps/qcam/main_window.cpp +++ b/src/apps/qcam/main_window.cpp @@ -26,8 +26,8 @@ #include <QToolButton> #include <QtDebug> -#include "../cam/dng_writer.h" -#include "../cam/image.h" +#include "../common/dng_writer.h" +#include "../common/image.h" #include "cam_select_dialog.h" #ifndef QT_NO_OPENGL diff --git a/src/apps/qcam/main_window.h b/src/apps/qcam/main_window.h index 95b64124..2e3e1b5c 100644 --- a/src/apps/qcam/main_window.h +++ b/src/apps/qcam/main_window.h @@ -27,7 +27,7 @@ #include <QQueue> #include <QTimer> -#include "../cam/stream_options.h" +#include "../common/stream_options.h" #include "viewfinder.h" diff --git a/src/apps/qcam/meson.build b/src/apps/qcam/meson.build index e298101e..eb0712d9 100644 --- a/src/apps/qcam/meson.build +++ b/src/apps/qcam/meson.build @@ -15,9 +15,6 @@ endif qcam_enabled = true qcam_sources = files([ - '../cam/image.cpp', - '../cam/options.cpp', - '../cam/stream_options.cpp', 'cam_select_dialog.cpp', 'format_converter.cpp', 'main.cpp', @@ -36,14 +33,7 @@ qcam_resources = files([ 'assets/feathericons/feathericons.qrc', ]) -qt5_cpp_args = ['-DQT_NO_KEYWORDS'] - -if libtiff.found() - qt5_cpp_args += ['-DHAVE_TIFF'] - qcam_sources += files([ - '../cam/dng_writer.cpp', - ]) -endif +qt5_cpp_args = [apps_cpp_args, '-DQT_NO_KEYWORDS'] if cxx.has_header_symbol('QOpenGLWidget', 'QOpenGLWidget', dependencies : qt5_dep, args : '-fPIC') @@ -73,6 +63,7 @@ resources = qt5.preprocess(moc_headers: qcam_moc_headers, qcam = executable('qcam', qcam_sources, resources, install : true, + link_with : apps_lib, dependencies : [ libatomic, libcamera_public, diff --git a/src/apps/qcam/viewfinder_gl.cpp b/src/apps/qcam/viewfinder_gl.cpp index 38ddad58..f83b99ad 100644 --- a/src/apps/qcam/viewfinder_gl.cpp +++ b/src/apps/qcam/viewfinder_gl.cpp @@ -16,7 +16,7 @@ #include <libcamera/formats.h> -#include "../cam/image.h" +#include "../common/image.h" static const QList<libcamera::PixelFormat> supportedFormats{ /* YUV - packed (single plane) */ diff --git a/src/apps/qcam/viewfinder_qt.cpp b/src/apps/qcam/viewfinder_qt.cpp index c20fd6bc..a7482bea 100644 --- a/src/apps/qcam/viewfinder_qt.cpp +++ b/src/apps/qcam/viewfinder_qt.cpp @@ -20,7 +20,7 @@ #include <QPainter> #include <QtDebug> -#include "../cam/image.h" +#include "../common/image.h" #include "format_converter.h" |