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_base.h
00001 // Copyright 2017 Baidu Inc. All Rights Reserved. 00002 // Author: Chen Xihao (chenxihao@baidu.com) 00003 // 00004 // Description: Base class of Media 00005 00006 #ifndef BAIDU_TINYDU_IOT_OS_SRC_MEDIA_BASE_BAIDU_MEDIA_BASE_H 00007 #define BAIDU_TINYDU_IOT_OS_SRC_MEDIA_BASE_BAIDU_MEDIA_BASE_H 00008 00009 #include "mbed.h" 00010 #include "baidu_recorder.h" 00011 #include "baidu_media_type.h" 00012 00013 namespace duer { 00014 00015 class MediaBase : public Recorder::IPlugin { 00016 public: 00017 int start_play(MediaType type); 00018 00019 int write(const void* data, size_t size); 00020 00021 int regulate_voice(unsigned char vol); 00022 00023 int pause_play(); 00024 00025 int stop_play(); 00026 00027 virtual int start_record(); 00028 00029 virtual size_t read(void* data, size_t size); 00030 00031 virtual int stop_record(); 00032 00033 protected: 00034 virtual int on_start_play(MediaType type) = 0; 00035 00036 virtual int on_write(const void* data, size_t size) = 0; 00037 00038 virtual int on_voice(unsigned char vol) = 0; 00039 00040 virtual int on_pause_play() = 0; 00041 00042 virtual int on_stop_play() = 0; 00043 00044 virtual int on_start_record() = 0; 00045 00046 virtual size_t on_read(void* data, size_t size) = 0; 00047 00048 virtual int on_stop_record() = 0; 00049 00050 private: 00051 static rtos::Mutex _s_lock; 00052 static int _s_status; 00053 }; 00054 00055 } // namespace duer 00056 00057 #endif // BAIDU_TINYDU_IOT_OS_SRC_MEDIA_BASE_BAIDU_MEDIA_BASE_H
Generated on Tue Jul 12 2022 16:28:52 by
1.7.2
