95 lines
3.0 KiB
C++
95 lines
3.0 KiB
C++
/*
|
|
* Copyright (c) 2023 Fancy Code.
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
#ifndef I_MEDIA_MANAGER_H
|
|
#define I_MEDIA_MANAGER_H
|
|
#include "StatusCode.h"
|
|
#include <memory>
|
|
#include <vector>
|
|
bool CreateMediaManagerModule(void);
|
|
bool DestroyMediaManagerModule(void);
|
|
enum class MediaChannel
|
|
{
|
|
MEDIA_1 = 0,
|
|
MEDIA_2,
|
|
END
|
|
};
|
|
enum class MediaTaskType
|
|
{
|
|
TAKE_PICTURE = 0,
|
|
TAKE_VIDEO,
|
|
TAKE_PICTURE_AND_VIDEO,
|
|
SAVE_STREAM_VIDEO,
|
|
SAVE_STREAM_AUDIO,
|
|
SAVE_STREAM_AUDIO_AND_VIDEO,
|
|
GET_STREAM_AUDIO,
|
|
GET_STREAM_VIDEO,
|
|
GET_STREAM_AUDIO_AND_VIDEO,
|
|
MONITOR,
|
|
END
|
|
};
|
|
typedef struct media_report_event
|
|
{
|
|
media_report_event(const std::string &fileName, const MediaChannel &mediaChannedl);
|
|
const std::string mFileName;
|
|
const MediaChannel mMediaChannedl;
|
|
} MediaReportEvent;
|
|
typedef struct media_task_response
|
|
{
|
|
media_task_response(const std::string &fileName, const unsigned int &duration_ms);
|
|
const std::string mFileName;
|
|
const unsigned int mDuration_ms;
|
|
} MediaTaskResponse;
|
|
class VMediaTask
|
|
{
|
|
public:
|
|
VMediaTask() = default;
|
|
virtual ~VMediaTask() = default;
|
|
virtual const MediaTaskType GetTaskType(void);
|
|
virtual std::string GetTargetNameForSaving(void);
|
|
virtual std::string GetThumbnailNameForSaving(const std::string &targetName);
|
|
virtual void Response(const std::vector<MediaTaskResponse> &response);
|
|
virtual bool IsTaskFinished(void);
|
|
virtual const signed int GetIsNight(void);
|
|
virtual const unsigned int GetIsMultShot(void);
|
|
};
|
|
class VMediaMonitor
|
|
{
|
|
public:
|
|
VMediaMonitor() = default;
|
|
virtual ~VMediaMonitor() = default;
|
|
virtual StatusCode ReportEvent(const MediaReportEvent &event);
|
|
};
|
|
class VMediaHandle
|
|
{
|
|
public:
|
|
VMediaHandle() = default;
|
|
virtual ~VMediaHandle() = default;
|
|
virtual StatusCode ExecuteTask(std::shared_ptr<VMediaTask> &task);
|
|
virtual StatusCode StopTask(void);
|
|
virtual StatusCode ClearTask(void);
|
|
virtual StatusCode SetSpontaneousTaskMonitor(std::shared_ptr<VMediaTask> &task);
|
|
};
|
|
class IMediaManager
|
|
{
|
|
public:
|
|
IMediaManager() = default;
|
|
virtual ~IMediaManager() = default;
|
|
static std::shared_ptr<IMediaManager> &GetInstance(std::shared_ptr<IMediaManager> *impl = nullptr);
|
|
virtual StatusCode Init(void);
|
|
virtual StatusCode UnInit(void);
|
|
virtual StatusCode SetMediaMonitor(std::shared_ptr<VMediaMonitor> &monitor);
|
|
virtual StatusCode GetMediaChannel(const MediaChannel &channel, std::shared_ptr<VMediaHandle> &handle);
|
|
};
|
|
#endif |