@@ -136,94 +136,32 @@ audio_err_t audio_player_raw_waiting_finished(void)
136
136
137
137
audio_err_t audio_player_stop (void )
138
138
{
139
- int ret = ESP_OK ;
140
- ap_ops_t * cur_ops = ap_manager_get_cur_ops ();
141
- if (cur_ops == NULL ) {
142
- ESP_LOGW (TAG , "%s, not found the current operations" , __func__ );
143
- return ESP_ERR_AUDIO_NOT_FOUND_MEDIA_SRC ;
144
- }
145
- if (cur_ops -> stop ) {
146
- ESP_LOGI (TAG , "stop, cur media type:%x" , cur_ops -> para .media_src );
147
- ret = cur_ops -> stop (& cur_ops -> attr , & cur_ops -> para );
148
- }
149
- return ret ;
139
+ return ap_manager_stop ();
150
140
}
151
141
152
142
audio_err_t audio_player_pause (void )
153
143
{
154
- int ret = ESP_OK ;
155
- ap_ops_t * cur_ops = ap_manager_get_cur_ops ();
156
- if (cur_ops == NULL ) {
157
- ESP_LOGW (TAG , "%s, not found the current operations" , __func__ );
158
- return ESP_ERR_AUDIO_NOT_FOUND_MEDIA_SRC ;
159
- }
160
- if (cur_ops -> pause ) {
161
- ESP_LOGI (TAG , "pause, cur media type:%x" , cur_ops -> para .media_src );
162
- ret = cur_ops -> pause (& cur_ops -> attr , & cur_ops -> para );
163
- }
164
- return ret ;
144
+ return ap_manager_pause ();
165
145
}
166
146
167
147
audio_err_t audio_player_resume (void )
168
148
{
169
- int ret = ESP_OK ;
170
- ap_ops_t * cur_ops = ap_manager_get_cur_ops ();
171
- if (cur_ops == NULL ) {
172
- ESP_LOGW (TAG , "%s, not found the current operations" , __func__ );
173
- return ESP_ERR_AUDIO_NOT_FOUND_MEDIA_SRC ;
174
- }
175
- ESP_LOGI (TAG , "resume, cur media type:%x" , cur_ops -> para .media_src );
176
- if (cur_ops -> resume ) {
177
- ESP_LOGI (TAG , "resume, cur media type:%x" , cur_ops -> para .media_src );
178
- ret = cur_ops -> resume (& cur_ops -> attr , & cur_ops -> para );
179
- }
180
- return ret ;
149
+ return ap_manager_resume ();
181
150
}
182
151
183
152
audio_err_t audio_player_next (void )
184
153
{
185
- int ret = ESP_OK ;
186
- ap_ops_t * cur_ops = ap_manager_get_cur_ops ();
187
- if (cur_ops == NULL ) {
188
- ESP_LOGW (TAG , "%s, not found the current operations" , __func__ );
189
- return ESP_ERR_AUDIO_NOT_FOUND_MEDIA_SRC ;
190
- }
191
- if (cur_ops -> next ) {
192
- ESP_LOGI (TAG , "next, cur media type:%x" , cur_ops -> para .media_src );
193
- ret = cur_ops -> next (& cur_ops -> attr , & cur_ops -> para );
194
- }
195
- return ret ;
154
+ return ap_manager_next ();
196
155
}
197
156
198
157
audio_err_t audio_player_prev (void )
199
158
{
200
- int ret = ESP_OK ;
201
- ap_ops_t * cur_ops = ap_manager_get_cur_ops ();
202
- if (cur_ops == NULL ) {
203
- ESP_LOGW (TAG , "%s, not found the current operations" , __func__ );
204
- return ESP_ERR_AUDIO_NOT_FOUND_MEDIA_SRC ;
205
- }
206
- if (cur_ops -> prev ) {
207
- ESP_LOGI (TAG , "prev, cur media type:%x" , cur_ops -> para .media_src );
208
- ret = cur_ops -> prev (& cur_ops -> attr , & cur_ops -> para );
209
- }
210
- return ret ;
159
+ return ap_manager_prev ();
211
160
}
212
161
213
162
audio_err_t audio_player_seek (int seek_time_sec )
214
163
{
215
- audio_err_t ret = ESP_OK ;
216
- ap_ops_t * cur_ops = ap_manager_get_cur_ops ();
217
- if (cur_ops == NULL ) {
218
- ESP_LOGW (TAG , "%s, not found the current operations" , __func__ );
219
- return ESP_ERR_AUDIO_NOT_FOUND_MEDIA_SRC ;
220
- }
221
- if (cur_ops -> seek ) {
222
- cur_ops -> para .seek_time_sec = seek_time_sec ;
223
- ESP_LOGI (TAG , "prev, cur media type:%x" , cur_ops -> para .media_src );
224
- ret = cur_ops -> seek (& cur_ops -> attr , & cur_ops -> para );
225
- }
226
- return ret ;
164
+ return ap_manager_seek (seek_time_sec );
227
165
}
228
166
229
167
audio_err_t audio_player_duration_get (int * duration )
0 commit comments