Improve:app get thumbnail file.
This commit is contained in:
parent
f5366a4bcf
commit
1a06ed0494
|
@ -17,6 +17,7 @@
|
|||
#include "IFilesManager.h"
|
||||
#include "ILog.h"
|
||||
#include "IStorageManager.h"
|
||||
#include "MediaTask.h"
|
||||
#include "StatusCode.h"
|
||||
#include <vector>
|
||||
AppMonitor::AppMonitor() : mMicStatus(SwitchStatus::END)
|
||||
|
@ -170,7 +171,10 @@ StatusCode AppMonitor::UploadFile(AppUploadFile ¶m)
|
|||
}
|
||||
StatusCode AppMonitor::GetThumbnail(AppGetThumbnail ¶m)
|
||||
{
|
||||
param.mThumbnail = "./34a396526922a33e97906920dbfef2a5.jpg";
|
||||
// param.mThumbnail = "./34a396526922a33e97906920dbfef2a5.jpg";
|
||||
const std::string webServerDocumentRoot = IAppManager::GetInstance()->GetFilesSavingRootPath();
|
||||
const std::string thumbnailFile = MediaTask::GetThumbnailNameByTargetName(param.mFile);
|
||||
param.mThumbnail = RemovePrefix(thumbnailFile, webServerDocumentRoot);
|
||||
return CreateStatusCode(STATUS_CODE_OK);
|
||||
}
|
||||
SdCardStatus AppMonitor::SdCardStatusConvert(const StorageEvent &event)
|
||||
|
|
|
@ -62,23 +62,23 @@ std::string MediaTask::GetTargetNameForSaving(void)
|
|||
}
|
||||
std::string MediaTask::GetThumbnailNameForSaving(const std::string &targetName)
|
||||
{
|
||||
std::string thumbnailName = targetName;
|
||||
size_t dot_pos = thumbnailName.find_last_of('.');
|
||||
if (dot_pos != std::string::npos) {
|
||||
std::string extension = thumbnailName.substr(dot_pos);
|
||||
if (extension == ".mp4") {
|
||||
thumbnailName.replace(dot_pos, extension.length(), ".jpeg");
|
||||
LogInfo("GetThumbnailNameForSaving: %s\n", thumbnailName.c_str());
|
||||
return thumbnailName;
|
||||
}
|
||||
}
|
||||
LogError("TargetName is not a mp4 file.\n");
|
||||
std::string unknowFile = "unknow";
|
||||
return unknowFile;
|
||||
return MediaTask::GetThumbnailNameByTargetName(targetName);
|
||||
// std::string thumbnailName = targetName;
|
||||
// size_t dot_pos = thumbnailName.find_last_of('.');
|
||||
// if (dot_pos != std::string::npos) {
|
||||
// std::string extension = thumbnailName.substr(dot_pos);
|
||||
// if (extension == ".mp4") {
|
||||
// thumbnailName.replace(dot_pos, extension.length(), "-thumbnail.jpeg");
|
||||
// LogInfo("GetThumbnailNameForSaving: %s\n", thumbnailName.c_str());
|
||||
// return thumbnailName;
|
||||
// }
|
||||
// }
|
||||
// LogError("TargetName is not a mp4 file.\n");
|
||||
// std::string unknowFile = "unknow";
|
||||
// return unknowFile;
|
||||
}
|
||||
int MediaTask::GetVideoDuration_ms(void)
|
||||
{
|
||||
return 1000 * 60;
|
||||
return DEFAULT_VIDEO_DURATION_MS;
|
||||
}
|
||||
void MediaTask::Response(const std::vector<MediaTaskResponse> &response)
|
||||
|
@ -95,4 +95,20 @@ void MediaTask::Response(const std::vector<MediaTaskResponse> &response)
|
|||
.mCreateTime_s = mCreateTime_s,
|
||||
};
|
||||
iniator->TaskResponse(info);
|
||||
}
|
||||
std::string MediaTask::GetThumbnailNameByTargetName(const std::string &targetName)
|
||||
{
|
||||
std::string thumbnailName = targetName;
|
||||
size_t dot_pos = thumbnailName.find_last_of('.');
|
||||
if (dot_pos != std::string::npos) {
|
||||
std::string extension = thumbnailName.substr(dot_pos);
|
||||
if (extension == ".mp4") {
|
||||
thumbnailName.replace(dot_pos, extension.length(), "-thumbnail.jpeg");
|
||||
LogInfo("GetThumbnailNameForSaving: %s\n", thumbnailName.c_str());
|
||||
return thumbnailName;
|
||||
}
|
||||
}
|
||||
LogError("TargetName is not a mp4 file.\n");
|
||||
std::string unknowFile = "unknow";
|
||||
return unknowFile;
|
||||
}
|
|
@ -46,6 +46,9 @@ public:
|
|||
int GetVideoDuration_ms(void) override;
|
||||
void Response(const std::vector<MediaTaskResponse> &response) override;
|
||||
|
||||
public:
|
||||
static std::string GetThumbnailNameByTargetName(const std::string &targetName);
|
||||
|
||||
private:
|
||||
const MediaTaskType mType;
|
||||
const InternalStateEvent mBindEvent;
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include "IMissionManager.h"
|
||||
#include "IStateMachine.h"
|
||||
#include "IStorageManager.h"
|
||||
#include "LedControl.h"
|
||||
#include "LedsHandle.h"
|
||||
#include "MissionStateMachine.h"
|
||||
#include "StatusCode.h"
|
||||
#include <functional>
|
||||
|
|
|
@ -93,10 +93,10 @@ void CameraHalTest::MockReportMediaStream(void)
|
|||
{
|
||||
mTaskRuning = true;
|
||||
if (nullptr != mReadH264File) {
|
||||
IStartReadFile(mReadH264File, TEST_SOURCE_PATH "/support_test/video_sync.h264");
|
||||
IStartReadFile(mReadH264File, TEST_SOURCE_PATH "/support_test/chip.h264");
|
||||
}
|
||||
if (nullptr != mReadG711aFile) {
|
||||
IStartReadFile(mReadG711aFile, TEST_SOURCE_PATH "/support_test/audio_sync.g711a");
|
||||
IStartReadFile(mReadG711aFile, TEST_SOURCE_PATH "/support_test/chip.g711a");
|
||||
}
|
||||
while (mTaskRuning) {
|
||||
std::unique_lock<std::mutex> lock(mMutex);
|
||||
|
|
1
test/support_test/chip.g711a
Executable file
1
test/support_test/chip.g711a
Executable file
File diff suppressed because one or more lines are too long
BIN
test/support_test/chip.h264
Executable file
BIN
test/support_test/chip.h264
Executable file
Binary file not shown.
|
@ -170,6 +170,9 @@ void FfmpegMuxStreamV2::GetAVPacketDataCallback(AVPacket *pkt)
|
|||
}
|
||||
void FfmpegMuxStreamV2::CalculatingDuration(const unsigned long long &pts_us)
|
||||
{
|
||||
// LogInfo("mFileMuxingDuration ms: %lld, mOutputFileInfo->mDuration_ms: %lld\n",
|
||||
// mFileMuxingDuration_us / 1000,
|
||||
// mOutputFileInfo->mDuration_ms);
|
||||
mFileMuxingDuration_us = pts_us - mStartPts;
|
||||
if (mFileMuxingDuration_us / 1000 >= mOutputFileInfo->mDuration_ms) {
|
||||
LogInfo("Muxing file finished, duration: %lld ms\n", mFileMuxingDuration_us / 1000);
|
||||
|
|
Loading…
Reference in New Issue
Block a user