mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-25 17:45:06 +03:00
Remove the verbose #ifndef/#define/#endif pattern for maintaining header idempotency, and replace it with a simple #pragma once. This simplifies the headers, and prevents redundant changes when header files get moved. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
72 lines
1.4 KiB
C++
72 lines
1.4 KiB
C++
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
/*
|
|
* Copyright (C) 2020, Collabora Ltd.
|
|
* Author: Nicolas Dufresne <nicolas.dufresne@collabora.com>
|
|
*
|
|
* gstlibcamera-utils.h - GStreamer libcamera Utility Functions
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <libcamera/camera_manager.h>
|
|
#include <libcamera/stream.h>
|
|
|
|
#include <gst/gst.h>
|
|
#include <gst/video/video.h>
|
|
|
|
GstCaps *gst_libcamera_stream_formats_to_caps(const libcamera::StreamFormats &formats);
|
|
GstCaps *gst_libcamera_stream_configuration_to_caps(const libcamera::StreamConfiguration &stream_cfg);
|
|
void gst_libcamera_configure_stream_from_caps(libcamera::StreamConfiguration &stream_cfg,
|
|
GstCaps *caps);
|
|
void gst_libcamera_resume_task(GstTask *task);
|
|
std::shared_ptr<libcamera::CameraManager> gst_libcamera_get_camera_manager(int &ret);
|
|
|
|
/**
|
|
* \class GLibLocker
|
|
* \brief A simple scoped mutex locker for GMutex
|
|
*/
|
|
class GLibLocker
|
|
{
|
|
public:
|
|
GLibLocker(GMutex *mutex)
|
|
: mutex_(mutex)
|
|
{
|
|
g_mutex_lock(mutex_);
|
|
}
|
|
|
|
GLibLocker(GstObject *object)
|
|
: mutex_(GST_OBJECT_GET_LOCK(object))
|
|
{
|
|
g_mutex_lock(mutex_);
|
|
}
|
|
|
|
~GLibLocker()
|
|
{
|
|
g_mutex_unlock(mutex_);
|
|
}
|
|
|
|
private:
|
|
GMutex *mutex_;
|
|
};
|
|
|
|
/**
|
|
* \class GLibRecLocker
|
|
* \brief A simple scoped mutex locker for GRecMutex
|
|
*/
|
|
class GLibRecLocker
|
|
{
|
|
public:
|
|
GLibRecLocker(GRecMutex *mutex)
|
|
: mutex_(mutex)
|
|
{
|
|
g_rec_mutex_lock(mutex_);
|
|
}
|
|
|
|
~GLibRecLocker()
|
|
{
|
|
g_rec_mutex_unlock(mutex_);
|
|
}
|
|
|
|
private:
|
|
GRecMutex *mutex_;
|
|
};
|