2016-12-21 18:05:56 +00:00
|
|
|
// Copyright 2016 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
#include "core/frontend/camera/interface.h"
|
|
|
|
|
|
|
|
namespace Camera {
|
|
|
|
|
|
|
|
class CameraFactory {
|
|
|
|
public:
|
|
|
|
virtual ~CameraFactory();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a camera object based on the configuration string.
|
2017-02-27 01:58:51 +00:00
|
|
|
* @param config Configuration string to create the camera. The implementation can decide the
|
|
|
|
* meaning of this string.
|
2018-05-20 01:07:37 +00:00
|
|
|
* @param flip The image flip to apply
|
2016-12-21 18:05:56 +00:00
|
|
|
* @returns a unique_ptr to the created camera object.
|
|
|
|
*/
|
2018-05-20 01:07:37 +00:00
|
|
|
virtual std::unique_ptr<CameraInterface> Create(const std::string& config,
|
2018-06-03 03:29:46 +00:00
|
|
|
const Service::CAM::Flip& flip) = 0;
|
2018-05-11 17:42:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a camera object for preview based on the configuration string.
|
|
|
|
* @param config Configuration string to create the camera. The implementation can decide the
|
|
|
|
* meaning of this string.
|
2018-05-20 01:07:37 +00:00
|
|
|
* @param flip The image flip to apply
|
2018-05-11 17:42:23 +00:00
|
|
|
* @returns a unique_ptr to the created camera object.
|
|
|
|
* Note: The default implementation for this is to call Create(). Derived classes may have other
|
2018-06-29 11:18:07 +00:00
|
|
|
* Implementations. For example, A dialog may be used instead of LOG_ERROR when error
|
2018-05-11 17:42:23 +00:00
|
|
|
* occurs.
|
|
|
|
*/
|
|
|
|
virtual std::unique_ptr<CameraInterface> CreatePreview(const std::string& config, int width,
|
2018-05-20 01:07:37 +00:00
|
|
|
int height,
|
2018-06-03 03:29:46 +00:00
|
|
|
const Service::CAM::Flip& flip) {
|
2018-05-20 01:07:37 +00:00
|
|
|
return Create(config, flip);
|
2018-05-11 17:42:23 +00:00
|
|
|
}
|
2016-12-21 18:05:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Registers an external camera factory.
|
|
|
|
* @param name Identifier of the camera factory.
|
|
|
|
* @param factory Camera factory to register.
|
|
|
|
*/
|
|
|
|
void RegisterFactory(const std::string& name, std::unique_ptr<CameraFactory> factory);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a camera from the factory.
|
|
|
|
* @param name Identifier of the camera factory.
|
|
|
|
* @param config Configuration string to create the camera. The meaning of this string is
|
|
|
|
* defined by the factory.
|
|
|
|
*/
|
2018-05-20 01:07:37 +00:00
|
|
|
std::unique_ptr<CameraInterface> CreateCamera(const std::string& name, const std::string& config,
|
|
|
|
const Service::CAM::Flip& flip);
|
2016-12-21 18:05:56 +00:00
|
|
|
|
2018-05-11 17:42:23 +00:00
|
|
|
/**
|
|
|
|
* Creates a camera from the factory for previewing.
|
|
|
|
* @param name Identifier of the camera factory.
|
|
|
|
* @param config Configuration string to create the camera. The meaning of this string is
|
|
|
|
* defined by the factory.
|
|
|
|
*/
|
|
|
|
std::unique_ptr<CameraInterface> CreateCameraPreview(const std::string& name,
|
|
|
|
const std::string& config, int width,
|
2018-05-20 01:07:37 +00:00
|
|
|
int height, const Service::CAM::Flip& flip);
|
2018-05-11 17:42:23 +00:00
|
|
|
|
2016-12-21 18:05:56 +00:00
|
|
|
} // namespace Camera
|