This commit is contained in:
Fancy code 2024-07-20 15:12:27 +08:00
parent 918210d695
commit 5fccf8f991
5 changed files with 14 additions and 1 deletions

View File

@ -76,6 +76,10 @@ std::string MediaTask::GetThumbnailNameForSaving(const std::string &targetName)
std::string unknowFile = "unknow"; std::string unknowFile = "unknow";
return unknowFile; return unknowFile;
} }
int MediaTask::GetVideoDuration_ms(void)
{
return DEFAULT_VIDEO_DURATION_MS;
}
void MediaTask::Response(const std::vector<MediaTaskResponse> &response) void MediaTask::Response(const std::vector<MediaTaskResponse> &response)
{ {
LogInfo("Response handle.\n"); LogInfo("Response handle.\n");

View File

@ -19,6 +19,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
constexpr unsigned int MEDIA_TASK_TIMEOUT_MS = 1000 * 60; constexpr unsigned int MEDIA_TASK_TIMEOUT_MS = 1000 * 60;
constexpr int DEFAULT_VIDEO_DURATION_MS = 1000 * 10;
typedef struct media_task_info typedef struct media_task_info
{ {
const std::vector<MediaTaskResponse> mResponse; const std::vector<MediaTaskResponse> mResponse;
@ -42,6 +43,7 @@ public:
virtual unsigned int GetTaskTimeOutMs(void); virtual unsigned int GetTaskTimeOutMs(void);
std::string GetTargetNameForSaving(void) override; std::string GetTargetNameForSaving(void) override;
std::string GetThumbnailNameForSaving(const std::string &targetName) override; std::string GetThumbnailNameForSaving(const std::string &targetName) override;
int GetVideoDuration_ms(void) override;
void Response(const std::vector<MediaTaskResponse> &response) override; void Response(const std::vector<MediaTaskResponse> &response) override;
private: private:

View File

@ -59,6 +59,7 @@ public:
virtual const MediaTaskType GetTaskType(void); virtual const MediaTaskType GetTaskType(void);
virtual std::string GetTargetNameForSaving(void); virtual std::string GetTargetNameForSaving(void);
virtual std::string GetThumbnailNameForSaving(const std::string &targetName); virtual std::string GetThumbnailNameForSaving(const std::string &targetName);
virtual int GetVideoDuration_ms(void);
virtual void Response(const std::vector<MediaTaskResponse> &response); virtual void Response(const std::vector<MediaTaskResponse> &response);
virtual bool IsTaskFinished(void); virtual bool IsTaskFinished(void);
virtual const signed int GetIsNight(void); virtual const signed int GetIsNight(void);

View File

@ -40,6 +40,11 @@ std::string VMediaTask::GetThumbnailNameForSaving(const std::string &targetName)
const std::string fileName = "Undefined"; const std::string fileName = "Undefined";
return fileName; return fileName;
} }
int VMediaTask::GetVideoDuration_ms(void)
{
constexpr int DURATION_MS = 0;
return DURATION_MS;
}
void VMediaTask::Response(const std::vector<MediaTaskResponse> &response) void VMediaTask::Response(const std::vector<MediaTaskResponse> &response)
{ {
} }

View File

@ -39,7 +39,8 @@ StatusCode RecordMp4::Init(void)
} }
std::string videoPath = mRecordTask->GetTargetNameForSaving(); std::string videoPath = mRecordTask->GetTargetNameForSaving();
std::string thumbnailPath = mRecordTask->GetThumbnailNameForSaving(videoPath); std::string thumbnailPath = mRecordTask->GetThumbnailNameForSaving(videoPath);
OutputFileInfo fileInfo = {.mDuration_ms = 5000, .mFinished = &mIsRecordingFinished}; const unsigned int duration_ms = mRecordTask->GetVideoDuration_ms();
OutputFileInfo fileInfo = {.mDuration_ms = duration_ms, .mFinished = &mIsRecordingFinished};
if (OUTPUT_FILE_NAME_MAX >= videoPath.size()) { if (OUTPUT_FILE_NAME_MAX >= videoPath.size()) {
memcpy(fileInfo.mFileName, videoPath.c_str(), videoPath.size()); memcpy(fileInfo.mFileName, videoPath.c_str(), videoPath.size());
} }