mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-09 20:45:41 +08:00
add wav file in UI.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@396 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
1 parent
9dfd2fd177
commit
3025e3e8b3
4 files changed
+138
-26
No files matched your search
@@ -281,7 +281,9 @@ void mp3_get_info(const char* filename, struct tag_info* info)
|
||||
/* can't get sync word */
|
||||
close(fd);
|
||||
mp3_decoder_detach(decoder);
|
||||
return;
|
||||
}
|
||||
|
||||
/* get frame information */
|
||||
MP3GetNextFrameInfo(decoder, &frame_info, &id3buffer[sync_word]);
|
||||
info->bit_rate = frame_info.bitrate;
|
||||
|
||||
@@ -91,6 +91,8 @@ rt_size_t net_buf_read(rt_uint8_t* buffer, rt_size_t length)
|
||||
/* buffer is not ready. */
|
||||
_netbuf.is_wait_ready = RT_TRUE;
|
||||
rt_kprintf("wait ready, data len: %d, stat %d\n", data_length, _netbuf.stat);
|
||||
/* set buffer status to buffering */
|
||||
player_set_buffer_status(RT_TRUE);
|
||||
rt_sem_take(_netbuf.wait_ready, RT_WAITING_FOREVER);
|
||||
}
|
||||
|
||||
@@ -192,7 +194,7 @@ static void net_buf_do_stop(struct net_buffer_job* job)
|
||||
rt_kprintf("job done, stat %d\n", _netbuf.stat);
|
||||
}
|
||||
|
||||
#define NETBUF_BLOCK_SIZE 1024
|
||||
#define NETBUF_BLOCK_SIZE 4096
|
||||
static void net_buf_do_job(struct net_buffer_job* job)
|
||||
{
|
||||
rt_uint32_t level;
|
||||
@@ -265,7 +267,10 @@ static void net_buf_do_job(struct net_buffer_job* job)
|
||||
rt_hw_interrupt_enable(level);
|
||||
}
|
||||
|
||||
// rt_kprintf("buffering ... %d %c\n", (data_length * 100) / _netbuf.size, '%');
|
||||
rt_kprintf("buffering ... %d %c\n", (data_length * 100) / _netbuf.size, '%');
|
||||
|
||||
/* set buffer position */
|
||||
player_set_position(data_length);
|
||||
|
||||
if ((_netbuf.stat == NETBUF_STAT_BUFFERING) && (data_length >= _netbuf.ready_wm))
|
||||
{
|
||||
@@ -277,6 +282,8 @@ static void net_buf_do_job(struct net_buffer_job* job)
|
||||
if (_netbuf.is_wait_ready == RT_TRUE)
|
||||
{
|
||||
_netbuf.is_wait_ready = RT_FALSE;
|
||||
/* set buffer status to playing */
|
||||
player_set_buffer_status(RT_FALSE);
|
||||
rt_sem_release(_netbuf.wait_ready);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ rt_bool_t player_is_playing()
|
||||
return is_playing;
|
||||
}
|
||||
|
||||
void player_play_file(const char* fn)
|
||||
void player_play_req(const char* fn)
|
||||
{
|
||||
struct player_request request;
|
||||
request.type = PLAYER_REQUEST_PLAY_SINGLE_FILE;
|
||||
@@ -22,6 +22,7 @@ void player_play_file(const char* fn)
|
||||
/* send to message queue */
|
||||
rt_mq_send(player_thread_mq, (void*)&request, sizeof(struct player_request));
|
||||
}
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
#include <finsh.h>
|
||||
static const char _fn[] = "/005.mp3";
|
||||
@@ -68,7 +69,18 @@ void player_thread(void* parameter)
|
||||
(strstr(request.fn, ".WAV") != RT_NULL))
|
||||
{
|
||||
is_playing = RT_TRUE;
|
||||
player_notify_play();
|
||||
wav(request.fn);
|
||||
player_notify_stop();
|
||||
is_playing = RT_FALSE;
|
||||
}
|
||||
else if ((strstr(request.fn, "http://") == request.fn ||
|
||||
(strstr(request.fn, "HTTP://") == request.fn )))
|
||||
{
|
||||
is_playing = RT_TRUE;
|
||||
player_notify_play();
|
||||
ice_mp3(request.fn);
|
||||
player_notify_stop();
|
||||
is_playing = RT_FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
+114
-23
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user