Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-os-example-mbed5-blinky by
baidu_media_manager.h
00001 // Copyright 2017 Baidu Inc. All Rights Reserved. 00002 // Author: Chen Xihao (chenxihao@baidu.com) 00003 // 00004 // Description: Media Manager 00005 00006 #ifndef BAIDU_TINYDU_IOT_OS_SRC_MEDIA_DATA_MANAGER_BAIDU_MEDIA_MANAGER_H 00007 #define BAIDU_TINYDU_IOT_OS_SRC_MEDIA_DATA_MANAGER_BAIDU_MEDIA_MANAGER_H 00008 00009 #include <stddef.h> 00010 #include "baidu_media_play_type.h" 00011 00012 namespace duer { 00013 00014 class MediaManager { 00015 public: 00016 static MediaManager& instance(); 00017 00018 /* 00019 * Initialize MediaManager object. 00020 * 00021 * @Return bool, success: true, fail: false 00022 */ 00023 bool initialize(); 00024 00025 /* 00026 * Initialize MediaManager object by buffer . 00027 * 00028 * @Param buffer, buffer for media data 00029 * @Param size, size of buffer 00030 * @Return bool, success: true, fail: false 00031 */ 00032 bool initialize(void* buffer, size_t size); 00033 00034 /* 00035 * Play network media file 00036 * 00037 * @Param url, media file's url 00038 * @Return MediaPlayerStatus, the last status of media player 00039 */ 00040 MediaPlayerStatus play_url(const char* url); 00041 00042 /* 00043 * Play local media file 00044 * 00045 * @Param path, media file's path 00046 * @Return MediaPlayerStatus, the last status of media player 00047 */ 00048 MediaPlayerStatus play_local(const char* path); 00049 00050 /* 00051 * If media player's status is playing/pause, pause/resume it 00052 * 00053 * @Return MediaPlayerStatus, the last status of media player 00054 */ 00055 MediaPlayerStatus pause_or_resume(); 00056 00057 /* 00058 * Stop media player 00059 * 00060 * @Return MediaPlayerStatus, the last status of media player 00061 */ 00062 MediaPlayerStatus stop(); 00063 00064 /* 00065 * Get status of media player 00066 * 00067 * @Return MediaPlayerStatus, the current status of media player 00068 */ 00069 MediaPlayerStatus get_media_player_status(); 00070 00071 /* 00072 * Register the callback function which is called when media player stop 00073 * Can't register more than 5 function 00074 * 00075 * @Param callback, callback function 00076 * @Return int, success: 0, fail: -1 00077 */ 00078 int register_stop_callback(media_player_stop_callback callback); 00079 00080 /* 00081 * Unregister the callback function 00082 * 00083 * @Param callback, callback function 00084 * @Return int, success: 0, fail: -1 00085 */ 00086 int unregister_stop_callback(media_player_stop_callback callback); 00087 00088 /* 00089 * Set volume of audio 00090 * 00091 * @Param vol, effective range is 0~15 00092 */ 00093 void set_volume(unsigned char vol); 00094 00095 private: 00096 MediaManager(); 00097 00098 static MediaManager _s_instance; 00099 static bool _s_initialized; 00100 }; 00101 00102 } // namespace duer 00103 00104 #endif // BAIDU_TINYDU_IOT_OS_SRC_MEDIA_DATA_MANAGER_BAIDU_MEDIA_MANAGER_H
Generated on Tue Jul 12 2022 16:28:52 by
1.7.2
