blob: b01ab1d3a7e3be8286b343e705c797a02fe48047 [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SRC_CAMERA_EXAMPLES_CAMERA_DISPLAY_STREAM_PROVIDER_CONTROLLER_STREAM_PROVIDER_H_
#define SRC_CAMERA_EXAMPLES_CAMERA_DISPLAY_STREAM_PROVIDER_CONTROLLER_STREAM_PROVIDER_H_
#include <fuchsia/camera2/hal/cpp/fidl.h>
#include <lib/sys/cpp/component_context.h>
#include <map>
#include "stream_provider.h"
class ControllerStreamProvider : public StreamProvider {
public:
ControllerStreamProvider()
: configs_(std::vector<std::unique_ptr<fuchsia::camera2::hal::Config>>()) {}
~ControllerStreamProvider() override;
static std::unique_ptr<StreamProvider> Create();
fit::result<
std::tuple<fuchsia::sysmem::ImageFormat_2, fuchsia::sysmem::BufferCollectionInfo_2, bool>,
zx_status_t>
ConnectToStream(fidl::InterfaceRequest<fuchsia::camera2::Stream> request,
uint32_t index) override;
virtual std::string GetName() override { return "fuchsia.camera2.Controller service"; }
private:
fuchsia::camera2::hal::ControllerSyncPtr controller_;
fuchsia::sysmem::AllocatorSyncPtr allocator_;
std::map<uint32_t, fuchsia::sysmem::BufferCollectionSyncPtr> buffer_collections_;
fidl::VectorPtr<std::unique_ptr<fuchsia::camera2::hal::Config>> configs_;
};
#endif // SRC_CAMERA_EXAMPLES_CAMERA_DISPLAY_STREAM_PROVIDER_CONTROLLER_STREAM_PROVIDER_H_