summaryrefslogtreecommitdiff
path: root/src/android/camera_stream.cpp
blob: 2d0c6ff99ac62cae0944c8f0b0bf4cb23bc8e035 (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
/* 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"
#include "jpeg/encoder_libjpeg.h"

using namespace libcamera;

CameraStream::CameraStream(PixelFormat format, Size size, Type type, unsigned int index)
	: format_(format), size_(size), type_(type), index_(index)
{
	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;
}