#include "stdio.h"
#include "gfx_utils/list.h"
#include "UiServersMsg.h"
-#include "player.h"
-#include "source.h"
#include "audio_manager.h"
#include "audio_base_type.h"
#include "record/include/RecordingPresenter.h"
#include <vector>
#include <sys/types.h>
#include <dirent.h>
+#include "../../../../../../middleware/services/media/foundation/utils/include/source.h"
+#include "../../../../../../middleware/services/media/foundation/player/interfaces/kits/player.h"
namespace OHOS
{
using OHOS::Media::Player;
using namespace ::Audio;
using Audio::AudioManager;
- // 播放器
- class RecordingPlayerInterruptListener : public InterruptListener
+ /*
+ * @brief 录音播放器状态
+ */
+ enum RecorderPlayerStatus
{
- public:
- RecordingPlayerInterruptListener() {}
- ~RecordingPlayerInterruptListener() {}
-
- void SetOwner(std::shared_ptr<Player> player);
- void SetPaused(bool value);
- void SetResumed(bool value);
- void RestFlag();
- bool IsPaused();
- bool IsDelayed();
- bool IsResumed();
- bool IsBeginStopped();
- bool IsEndStopped();
- void OnInterrupt(int32_t type, int32_t hint) override;
- void PausePlayer(void);
- void ResumePlayer(void);
- void StopPlayer(void);
- std::shared_ptr<Player> GetPlayer();
-
- private:
- std::shared_ptr<Player> player_{nullptr};
- bool isPaused_{false};
- bool isDelayed_{false};
- bool isResumed_{false};
- bool isBeginStopped_{false};
- bool isEndStopped_{false};
+ RECORDER_NORMAL,
+ RECORDER_ALREADY_PLAYING, // 录音播放中
+ RECORDER_ALREADY_PAUSED, // 录音暂停
+ RECORDER_ALREADY_STOPPED, // 录音停止
+ RECORDER_PLAYBACK_COMPLETED, // 录音播放完成
+ RECORDER_EXECUTE_FUNC_FAILED, // 函数执行失败
+ RECORDER_RESPONSE_MAX,
};
+ class RecordingPlayerInterruptListener;
class RecordingModel
{
public:
std::string GetRecordingPlayerUri(void);
void SetRecordingPlayerUri(std::string src);
void SetRecordingPlayButtonState(bool state);
- int RecordingPlayerStat();
+ void AudioInit(void);
+ void ConvertMillisecondToTime(int32_t milliseconds);
+ int RecordingPlayerInit(void);
+ int RecordingPlayerStat(void);
+ int BasePlayerStateOperate(int state);
+ int GetRecordingPlayerState(void);
+ bool HasRecordingPlayerPlayed(void);
+ int RecordingPlayerPlay(void);
+ int RecordingPlayerPause(void);
+
/* -------------------------------------------------------------------------- */
void InitRecordingListItem();
std::vector<RecordingListItem> &GetRecordinglistItems();
int GetClickRecordingIndex(void);
std::vector<std::string> &GetFileNames(void);
void KeepTotalRecordDuration(std::string time);
- const char *GetTotalRecordDuration(void);
+ std::string GetTotalRecordDuration(void) const;
+ std::string Getyyyymmhhh_date(void) const;
+
/* ----------------------------------- 定时器 ---------------------------------- */
void Recording_StartTimer(uint32_t interval);
void Recording_StopTimer(void);
std::shared_ptr<PlayerCallback> PlayerCallback{nullptr}; // 为媒体播放期间发生的事件和异常通知提供侦听器。
std::string Uri; // 唯一标识一个资源的字符串。
std::map<std::string, std::string> Header;
- std::shared_ptr<Source> Resource{nullptr};
+ std::shared_ptr<Source> Resource{nullptr}; // 提供函数来实现与资源相关的操作。
+ bool isStopAndReset{false}; // 判断是否是停止还是重置状态
+ bool audioInitStatus{false};
/* -------------------------------------------------------------------------- */
std::vector<std::string> fileNames; // 文件名
int RecordingMp3FileCount = 0; // 录音MP3数量