資源簡介
1、通過文件檢索可以將固定的目錄下的三種類型的圖片和音樂給檢索出來,然后再利用libjpeg庫和libpng庫來對jpeg圖片和png圖片進(jìn)行解碼,再通過直接操作framebuffer來將圖片顯示在LCD屏上,還可以使用觸摸屏來切換圖片。而播放音樂就要移植madplay庫并使用當(dāng)中的命令來播放音樂,也可以使用觸摸屏來切換音樂。
2、拍照功能,利用V4L2來實(shí)現(xiàn)采集一幀的圖像并把它顯示在LCD屏上。
3、語言交互功能,首先在客戶端實(shí)現(xiàn)錄音功能,并將錄制的音頻數(shù)據(jù)通過socket傳輸?shù)椒?wù)端中,服務(wù)端就先進(jìn)行語法構(gòu)建然后再進(jìn)行語法識別,最后將識別的結(jié)果保存在xml文件中,再通過socket將xml文件傳輸?shù)娇蛻舳酥校蛻舳嗽賹@個文件進(jìn)行解析,并得到識別的id號,然后再根據(jù)id進(jìn)行相應(yīng)的操作,如操作上述兩個功能。
代碼片段和文件信息
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
//#include?“check_mac.h“
#define??CAMERA_DEV??“/dev/video3“
struct?buffer?{
void*?start;
size_t?length;
};
struct?buffer*?buffers?=?NULL;
static?unsigned?int?n_buffers?=?0;
unsigned?int?*fb_mem;
struct?my_error_mgr?{
??struct?jpeg_error_mgr?pub; /*?“public“?fields?*/
??jmp_buf?setjmp_buffer; /*?for?return?to?caller?*/
};
typedef?struct?my_error_mgr?*?my_error_ptr;
int?SHOW_JPEG_file?(char?*?filename)
{
??/*?This?struct?contains?the?JPEG?decompression?parameters?and?pointers?to
???*?working?space?(which?is?allocated?as?needed?by?the?JPEG?library).
???*/
??struct?jpeg_decompress_struct?cinfo;
??/*?We?use?our?private?extension?JPEG?error?handler.
???*?Note?that?this?struct?must?live?as?long?as?the?main?JPEG?parameter
???*?struct?to?avoid?dangling-pointer?problems.
???*/
??struct?my_error_mgr?jerr;
??/*?More?stuff?*/
??FILE?*?infile; /*?source?file?*/
??char?*?buffer; /*?Output?row?buffer?*/
??int?row_stride; /*?physical?row?width?in?output?buffer?*/
??/*?In?this?example?we?want?to?open?the?input?file?before?doing?anything?else
???*?so?that?the?setjmp()?error?recovery?below?can?assume?the?file?is?open.
???*?VERY?IMPORTANT:?use?“b“?option?to?fopen()?if?you?are?on?a?machine?that
???*?requires?it?in?order?to?read?binary?files.
???*/
??if?((infile?=?fopen(filename?“rb“))?==?NULL)?{
????fprintf(stderr?“can‘t?open?%s\n“?filename);
????return?0;
??}
??/*?Step?1:?allocate?and?initialize?JPEG?decompression?object?*/
??/*?We?set?up?the?normal?JPEG?error?routines?then?override?error_exit.?*/
??cinfo.err?=?jpeg_std_error(&jerr.pub);
??jerr.pub.error_exit?=?NULL;
??/*?Establish?the?setjmp?return?context?for?my_error_exit?to?use.?*/
??if?(setjmp(jerr.setjmp_buffer))?{
????/*?If?we?get?here?the?JPEG?code?has?signaled?an?error.
?????*?We?need?to?clean?up?the?JPEG?object?close?the?input?file?and?return.
?????*/
????jpeg_destroy_decompress(&cinfo);
????fclose(infile);
????return?0;
??}
??/*?Now?we?can?initialize?the?JPEG?decompression?object.?*/
??jpeg_create_decompress(&cinfo);
??/*?Step?2:?specify?data?source?(eg?a?file)?*/
??jpeg_stdio_src(&cinfo?infile);
??/*?Step?3:?read?file?parameters?with?jpeg_read_header()?*/
??(void)?jpeg_read_header(&cinfo?TRUE);
??/*?We?can?ignore?the?return?value?from?jpeg_read_header?since
???*???(a)?suspension?is?not?possible?with?the?stdio?data?source?and
???*???(b)?we?passed?TRUE?to?reject?a?tables-only?JPEG?file?as?an?error.
???*?See?libjpeg.txt?for?more?info.
???*/
??/*?Step?4:?set?parameters?for?decompression?*/
??/*?In?this?example?we?don‘t?need?to?change?any?of?the?defaults?set?by
???*?jpeg_read_header()?so?we?do?nothing?here.
???*/
??/*?Step?5:?Start?decompressor?*/
??(
評論
共有 條評論