mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-28 16:14:20 +08:00
add more buffer in mp3 decoder. add picture browse support.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@418 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
#include "player_ui.h"
|
||||
#include "player_bg.h"
|
||||
|
||||
#define MP3_AUDIO_BUF_SZ 4096
|
||||
#define MP3_AUDIO_BUF_SZ 8192
|
||||
#ifndef MIN
|
||||
#define MIN(x, y) ((x) < (y)? (x) : (y))
|
||||
#endif
|
||||
@@ -118,22 +118,21 @@ static rt_int32_t mp3_decoder_fill_buffer(struct mp3_decoder* decoder)
|
||||
}
|
||||
|
||||
bytes_to_read = (MP3_AUDIO_BUF_SZ - decoder->bytes_left) & ~(512 - 1);
|
||||
// rt_kprintf("read bytes: %d\n", bytes_to_read);
|
||||
|
||||
bytes_read = decoder->fetch_data(decoder->fetch_parameter,
|
||||
(rt_uint8_t *)(decoder->read_buffer + decoder->bytes_left),
|
||||
bytes_to_read);
|
||||
|
||||
if (bytes_read == bytes_to_read)
|
||||
if (bytes_read != 0)
|
||||
{
|
||||
decoder->read_ptr = decoder->read_buffer;
|
||||
decoder->read_offset = 0;
|
||||
decoder->bytes_left = decoder->bytes_left + bytes_to_read;
|
||||
decoder->bytes_left = decoder->bytes_left + bytes_read;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("can't read more data");
|
||||
rt_kprintf("can't read more data\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -415,7 +414,7 @@ void mp3_get_info(const char* filename, struct tag_info* info)
|
||||
}
|
||||
/*
|
||||
* There're two other rarely used VBR header standards: VBRI & MLLT.
|
||||
* I can't find any sample with these headers. So I just ignored them. :)
|
||||
* I can't find any sample with these headers. So I just ignored them. :)
|
||||
*/
|
||||
else
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
#ifndef __PICTURE_H__
|
||||
#define __PICTURE_H__
|
||||
|
||||
rtgui_view_t *picture_view_create(struct rtgui_workbench* workbench);
|
||||
rtgui_view_t *picture_view_create_view_file(struct rtgui_workbench* workbench, const char* fn);
|
||||
rtgui_view_t *picture_view_create_view_list(struct rtgui_workbench* workbench, const char* list[], rt_uint8_t size);
|
||||
|
||||
#endif
|
||||
@@ -279,6 +279,8 @@ void function_play_radio(void* parameter)
|
||||
{
|
||||
next_step = PLAYER_STEP_STOP;
|
||||
player_play_url("http://syragon.com:8000/ices");
|
||||
// player_play_url("http://192.168.1.6:8000/stream");
|
||||
// player_play_url("http://radio.aozima.com:8000/stream");
|
||||
}
|
||||
|
||||
void function_filelist(void* parameter)
|
||||
@@ -381,6 +383,21 @@ void function_player(void* parameter)
|
||||
return;
|
||||
}
|
||||
|
||||
#include "picture.h"
|
||||
void function_show_picure(void* parameter)
|
||||
{
|
||||
rtgui_view_t *view;
|
||||
|
||||
view = picture_view_create(workbench);
|
||||
if (view != RT_NULL)
|
||||
{
|
||||
rtgui_view_show(view, RT_TRUE);
|
||||
rtgui_view_destroy(view);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void function_action(void* parameter)
|
||||
{
|
||||
rt_kprintf("item action!\n");
|
||||
@@ -398,6 +415,7 @@ struct list_item function_list[] =
|
||||
{"选择电台", RT_NULL, function_play_radio, RT_NULL},
|
||||
{"更新电台", RT_NULL, function_action, RT_NULL},
|
||||
{"播放文件", RT_NULL, function_filelist, RT_NULL},
|
||||
{"浏览图片", RT_NULL, function_show_picure, RT_NULL},
|
||||
{"设备信息", RT_NULL, function_device, RT_NULL},
|
||||
{"选项设置", RT_NULL, function_action, RT_NULL},
|
||||
{"USB 联机", RT_NULL, function_cable, RT_NULL},
|
||||
|
||||
+197
-190
File diff suppressed because it is too large
Load Diff
@@ -47,6 +47,7 @@ File 1,1,<.\ili9325\ili9320.c><ili9320.c>
|
||||
File 1,1,<.\codec.c><codec.c>
|
||||
File 1,1,<.\spi_flash.c><spi_flash.c>
|
||||
File 1,1,<.\remote.c><remote.c>
|
||||
File 1,1,<.\picture.c><picture.c>
|
||||
File 2,1,<..\..\src\clock.c><clock.c>
|
||||
File 2,1,<..\..\src\idle.c><idle.c>
|
||||
File 2,1,<..\..\src\ipc.c><ipc.c>
|
||||
|
||||
@@ -120,6 +120,9 @@
|
||||
/* TCP sender buffer space */
|
||||
#define RT_LWIP_TCP_SND_BUF 2048
|
||||
|
||||
/* TCP Window Size */
|
||||
#define RT_LWIP_TCP_WND (1024 * 2)
|
||||
|
||||
/* Enable SNMP protocol */
|
||||
/* #define RT_LWIP_SNMP */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user