android: camera_stream: Break out CameraStream
Break CameraStream out of the CameraDevice class. No functional changes, only the code is moved. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
5fbda0dfda
commit
5cf64b26a2
5 changed files with 60 additions and 29 deletions
|
@ -169,12 +169,6 @@ MappedCamera3Buffer::MappedCamera3Buffer(const buffer_handle_t camera3buffer,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CameraStream::CameraStream(PixelFormat format, Size size,
|
|
||||||
unsigned int index, Encoder *encoder)
|
|
||||||
: format_(format), size_(size), index_(index), encoder_(encoder)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* \struct Camera3RequestDescriptor
|
* \struct Camera3RequestDescriptor
|
||||||
*
|
*
|
||||||
|
|
|
@ -23,33 +23,11 @@
|
||||||
#include "libcamera/internal/log.h"
|
#include "libcamera/internal/log.h"
|
||||||
#include "libcamera/internal/message.h"
|
#include "libcamera/internal/message.h"
|
||||||
|
|
||||||
|
#include "camera_stream.h"
|
||||||
#include "jpeg/encoder.h"
|
#include "jpeg/encoder.h"
|
||||||
|
|
||||||
class CameraMetadata;
|
class CameraMetadata;
|
||||||
|
|
||||||
class CameraStream
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CameraStream(libcamera::PixelFormat format, libcamera::Size size,
|
|
||||||
unsigned int index, Encoder *encoder = nullptr);
|
|
||||||
|
|
||||||
const libcamera::PixelFormat &format() const { return format_; }
|
|
||||||
const libcamera::Size &size() const { return size_; }
|
|
||||||
unsigned int index() const { return index_; }
|
|
||||||
Encoder *encoder() const { return encoder_.get(); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
libcamera::PixelFormat format_;
|
|
||||||
libcamera::Size size_;
|
|
||||||
/*
|
|
||||||
* The index of the libcamera StreamConfiguration as added during
|
|
||||||
* configureStreams(). A single libcamera Stream may be used to deliver
|
|
||||||
* one or more streams to the Android framework.
|
|
||||||
*/
|
|
||||||
unsigned int index_;
|
|
||||||
std::unique_ptr<Encoder> encoder_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CameraDevice : protected libcamera::Loggable
|
class CameraDevice : protected libcamera::Loggable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
18
src/android/camera_stream.cpp
Normal file
18
src/android/camera_stream.cpp
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020, Google Inc.
|
||||||
|
*
|
||||||
|
* camera_stream.cpp - Camera HAL stream
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "camera_stream.h"
|
||||||
|
|
||||||
|
#include "jpeg/encoder.h"
|
||||||
|
|
||||||
|
using namespace libcamera;
|
||||||
|
|
||||||
|
CameraStream::CameraStream(PixelFormat format, Size size,
|
||||||
|
unsigned int index, Encoder *encoder)
|
||||||
|
: format_(format), size_(size), index_(index), encoder_(encoder)
|
||||||
|
{
|
||||||
|
}
|
40
src/android/camera_stream.h
Normal file
40
src/android/camera_stream.h
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020, Google Inc.
|
||||||
|
*
|
||||||
|
* camera_stream.h - Camera HAL stream
|
||||||
|
*/
|
||||||
|
#ifndef __ANDROID_CAMERA_STREAM_H__
|
||||||
|
#define __ANDROID_CAMERA_STREAM_H__
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include <libcamera/geometry.h>
|
||||||
|
#include <libcamera/pixel_format.h>
|
||||||
|
|
||||||
|
class Encoder;
|
||||||
|
|
||||||
|
class CameraStream
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CameraStream(libcamera::PixelFormat format, libcamera::Size size,
|
||||||
|
unsigned int index, Encoder *encoder = nullptr);
|
||||||
|
|
||||||
|
const libcamera::PixelFormat &format() const { return format_; }
|
||||||
|
const libcamera::Size &size() const { return size_; }
|
||||||
|
unsigned int index() const { return index_; }
|
||||||
|
Encoder *encoder() const { return encoder_.get(); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
libcamera::PixelFormat format_;
|
||||||
|
libcamera::Size size_;
|
||||||
|
/*
|
||||||
|
* The index of the libcamera StreamConfiguration as added during
|
||||||
|
* configureStreams(). A single libcamera Stream may be used to deliver
|
||||||
|
* one or more streams to the Android framework.
|
||||||
|
*/
|
||||||
|
unsigned int index_;
|
||||||
|
std::unique_ptr<Encoder> encoder_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __ANDROID_CAMERA_STREAM__ */
|
|
@ -20,6 +20,7 @@ android_hal_sources = files([
|
||||||
'camera_device.cpp',
|
'camera_device.cpp',
|
||||||
'camera_metadata.cpp',
|
'camera_metadata.cpp',
|
||||||
'camera_ops.cpp',
|
'camera_ops.cpp',
|
||||||
|
'camera_stream.cpp',
|
||||||
'jpeg/encoder_libjpeg.cpp',
|
'jpeg/encoder_libjpeg.cpp',
|
||||||
'jpeg/exif.cpp',
|
'jpeg/exif.cpp',
|
||||||
])
|
])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue