blob: b3d345afc61afe8a56b67a708907422cba692527 (
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
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2020, Google Inc.
*
* camera_stream.cpp - Camera HAL stream
*/
#include "camera_stream.h"
#include "camera_device.h"
#include "jpeg/encoder.h"
#include "jpeg/encoder_libjpeg.h"
using namespace libcamera;
CameraStream::CameraStream(CameraDevice *cameraDevice,
camera3_stream_t *camera3Stream,
const libcamera::StreamConfiguration &cfg,
Type type, unsigned int index)
: cameraDevice_(cameraDevice), camera3Stream_(camera3Stream),
type_(type), index_(index)
{
config_ = cameraDevice_->cameraConfiguration();
format_ = cfg.pixelFormat;
size_ = cfg.size;
if (type_ == Type::Internal || type_ == Type::Mapped)
encoder_ = std::make_unique<EncoderLibJpeg>();
}
int CameraStream::configure(const libcamera::StreamConfiguration &cfg)
{
if (encoder_)
return encoder_->configure(cfg);
return 0;
}
|