色哟哟视频在线观看-色哟哟视频在线-色哟哟欧美15最新在线-色哟哟免费在线观看-国产l精品国产亚洲区在线观看-国产l精品国产亚洲区久久

聚豐項(xiàng)目 > 即時(shí)播放視頻

即時(shí)播放視頻

即時(shí)播放視頻,主要是用于通過(guò)WiFi傳輸音頻和視頻文件到設(shè)備中即時(shí)播放,并不受限于音頻,視頻文件的大小。也不需要設(shè)備有很大的一個(gè)存儲(chǔ)空間。采用邊播邊放邊刪的一個(gè)方式,在設(shè)備中每次只存儲(chǔ)一部分要播放的文件,播過(guò)的文件即時(shí)刪掉,因此只需一個(gè)很小的存儲(chǔ)空間就可以播放一個(gè)很大的音頻視頻文件。

diney_db4 diney_db4

分享
0 喜歡這個(gè)項(xiàng)目
團(tuán)隊(duì)介紹

diney_db4 diney_db4

團(tuán)隊(duì)成員

張文雄 程序員

分享
項(xiàng)目簡(jiǎn)介
即時(shí)播放視頻,主要是用于通過(guò)WiFi傳輸音頻和視頻文件到設(shè)備中即時(shí)播放,并不受限于音頻,視頻文件的大小。也不需要設(shè)備有很大的一個(gè)存儲(chǔ)空間。采用邊播邊放邊刪的一個(gè)方式,在設(shè)備中每次只存儲(chǔ)一部分要播放的文件,播過(guò)的文件即時(shí)刪掉,因此只需一個(gè)很小的存儲(chǔ)空間就可以播放一個(gè)很大的音頻視頻文件。
硬件說(shuō)明

開(kāi)發(fā)板:NUCLEO-64 STM32F401

主控MCU:STM32F401RET6

image.png

WIFI模塊:3080B

image.png  

音頻解碼模塊:VS1053

image.png 

 

液晶顯示:TFTLCD液晶屏

image.png

軟件說(shuō)明


下位機(jī)即時(shí)播放音頻,視頻部分代碼。


void mp3_play(void)

{

         u8 res;

        DIR mp3dir;                      //????

         FILINFO mp3fileinfo;//???tD??¢

         u8 *fn;                              //3¤???t??

         u8 *pname;                        //′??·??μ????t??

         u16 totmp3num;              //ò?à????t×üêy

         u16 curindex;            //í???μ±?°?÷òy

         u8 key;                                 //?ü?μ               

        u16 temp;

         u16 *mp3indextbl;  //ò?à??÷òy±í

        while(f_opendir(&mp3dir,"0:/MUSIC"))//′ò?aí??????t?D

        {           

                   Show_Str(30,190,240,16,"MUSIC???t?D′í?ó!",16,0);

                   delay_ms(200);                                     

                   LCD_Fill(30,190,240,206,WHITE);//??3y??ê?             

                   delay_ms(200);                                     

         }                                                                                   

         totmp3num=mp3_get_tnum("0:/MUSIC"); //μ?μ?×üóDD§???têy

       while(totmp3num==NULL)//ò?à????t×üêy?a0             

        {           

                   Show_Str(30,190,240,16,"??óDò?à????t!",16,0);

                   delay_ms(200);                                     

                   LCD_Fill(30,190,240,146,WHITE);//??3y??ê?             

                   delay_ms(200);                                     

         }                                                                                              

       mp3fileinfo.lfsize=_MAX_LFN*2+1;                                                        //3¤???t??×?′ó3¤?è

         mp3fileinfo.lfname=mymalloc(SRAMIN,mp3fileinfo.lfsize);   //?a3¤???t?o′???·????ú′?

        pname=mymalloc(SRAMIN,mp3fileinfo.lfsize);                                   //?a′??·??μ????t??·????ú′?

        mp3indextbl=mymalloc(SRAMIN,2*totmp3num);                             //éê??2*totmp3num??×??úμ??ú′?,ó?óú′?·?ò?à????t?÷òy

        while(mp3fileinfo.lfname==NULL||pname==NULL||mp3indextbl==NULL)//?ú′?·???3?′í

        {           

                   Show_Str(30,190,240,16,"?ú′?·???꧰ü!",16,0);

                   delay_ms(200);                                     

                   LCD_Fill(30,190,240,146,WHITE);//??3y??ê?             

                   delay_ms(200);                                     

         }    

         VS_HD_Reset();

         VS_Soft_Reset();

         vsset.mvol=220;                                                     //??è?éè??ò?á??a220.

         mp3_vol_show((vsset.mvol-100)/5);       //ò?á??T???ú:100~250,??ê?μ?ê±oò,°′??1?ê?(vol-100)/5,??ê?,ò2?íê?0~30  

         //?????÷òy

    res=f_opendir(&mp3dir,"0:/MUSIC"); //′ò?a????

         if(res==FR_OK)

         {

                   curindex=0;//μ±?°?÷òy?a0

                   while(1)//è?2?2é?ˉò?±é

                   {

                            temp=mp3dir.index;                                                                          //????μ±?°index

                 res=f_readdir(&mp3dir,&mp3fileinfo);                      //?áè???????μ?ò??????t

                 if(res!=FR_OK||mp3fileinfo.fname[0]==0)break;    //′í?óá?/μ????2á?,í?3?            

                     fn=(u8*)(*mp3fileinfo.lfname?mp3fileinfo.lfname:mp3fileinfo.fname);                             

                            res=f_typetell(fn);  

                            if((res&0XF0)==0X40)//è???????,?′?′ê?2?ê?ò?à????t        

                            {

                                     mp3indextbl[curindex]=temp;//?????÷òy

                                     curindex++;

                            }           

                   }

         }  

     curindex=0;                                                                                                   //′ó0?aê???ê?

     res=f_opendir(&mp3dir,(const TCHAR*)"0:/MUSIC");           //′ò?a????

         while(res==FR_OK)//′ò?a3é1|

         {       

                   dir_sdi(&mp3dir,mp3indextbl[curindex]);                          //??±?μ±?°?????÷òy        

        res=f_readdir(&mp3dir,&mp3fileinfo);                      //?áè???????μ?ò??????t

        if(res!=FR_OK||mp3fileinfo.fname[0]==0)break;    //′í?óá?/μ????2á?,í?3?

            fn=(u8*)(*mp3fileinfo.lfname?mp3fileinfo.lfname:mp3fileinfo.fname);                             

                   strcpy((char*)pname,"0:/MUSIC/");                                   //?′???·??(????)

                   strcat((char*)pname,(const char*)fn);                             //?????t???ó?úoó??

                 LCD_Fill(30,190,240,190+16,WHITE);                                 //??3y???°μ???ê?

                   Show_Str(30,190,240-30,16,fn,16,0);                                 //??ê??è?ú??×?

                   mp3_index_show(curindex+1,totmp3num);

                   key=mp3_play_song(pname);                                                      //2¥·??a??MP3   

                   if(key==2)                   //é?ò??ú

                   {

                            if(curindex)curindex--;

                            else curindex=totmp3num-1;

                 }else if(key<=1)//??ò??ú

                   {

                            curindex++;                   

                            if(curindex>=totmp3num)curindex=0;//μ????2μ?ê±oò,×??ˉ′óí·?aê?

                 }else break;      //2úéúá?′í?ó     

         }                                                                                                      

         myfree(SRAMIN,mp3fileinfo.lfname);     //êí·??ú′?                            

         myfree(SRAMIN,pname);                                     //êí·??ú′?                            

         myfree(SRAMIN,mp3indextbl);                          //êí·??ú′?       

}

 

unsigned char PlayMusicStreamFunction(unsigned char *dataBuffer, unsigned short lenght)

{

    PlayMusicStream = 4;

    if(MusicStreamDataCount>100)

    {

        PlayMusicEnFlag = 1;

        MusicStreamDataRecciveCount++;

    }

    //#if  PRINTF_DEBUG == 1  

//printf(" ???? MusicStreamDataCount %d , Mp3FlieSizeCount %d  ?? %d \r\n",MusicStreamDataCount, Mp3FlieSizeCount,GetSystick1ms());

    ///#endif

    

    

    if(PLAY_MUSIC_LENGHT - MusicStreamDataCount >= lenght)

    {

        memcpy(PlayMusicData+MusicStreamDataCount,dataBuffer,lenght);

        MusicStreamDataCount += lenght;

    }

    else

    {

        MusicStreamDataCount = 0;

        memcpy(PlayMusicData+MusicStreamDataCount,dataBuffer,lenght);

        MusicStreamDataCount += lenght;

        PlayMusicFlay = 1;

    }


    if(Mp3FlieSizeCount > MusicStreamDataCount) 

    {

        if((Mp3FlieSizeCount - MusicStreamDataCount) < 4*1024)

    return 0;

    }

    else if(PlayMusicFlay)

    {

        if((MusicStreamDataCount - Mp3FlieSizeCount) < 4*1024)

    return 0;

    }

    

    return 1;

    

}


void SystemProcessPlayMusic(void)

{

    //static unsigned int size = 0;

    unsigned int lenght = 0;

    

    if(PlayMusicEnFlag)

    {

        if(StartGetMusicData)

        {

            StartGetMusicData = 0;

           if(PlayMusicStream>3)

            {

                if(Mp3FlieSizeCount < PLAY_MUSIC_LENGHT)

                {

                    if(MusicStreamDataRecciveCount)

                    {

                        MusicStreamDataRecciveCount--;

                    }

                    if(StopPlayRobotMusic)

                    {

                        StopPlayRobotMusic = 0;

                        Mp3FlieSizeCount = 0;

                        PlayMusicEnFlag = 0;

                        //StopSkillPlay();

                        //memset(Mp3FileName,0,50);

                        //memset(PlayMusicData,0,1024);

                        //f_close(&Mp3_fnew);

                        #if  PRINTF_DEBUG == 1  

                printf("StopPlayRobotMusic   í£?12¥·? \r\n");

                        #endif

                        return;

                    }

                    lenght = 1024;

                    //#if  PRINTF_DEBUG_fatfs == 1 

                    //printf(" ?y?ú2¥·? ±?2¥±?·? MusicStreamDataCount %d £? Mp3FlieSizeCount %d  ê±?? %d \r\n",MusicStreamDataCount, Mp3FlieSizeCount,GetSystick1ms());

                   

                    //#endif

                    System.Device.Music.PlayMp3File(PlayMusicData+Mp3FlieSizeCount,lenght);

                    Mp3FlieSizeCount += lenght;

                    if(Mp3FlieSizeCount == MusicStreamDataCount)

                    {

                        PlayMusicStream = 1;

                        Mp3FlieSizeCount = 0;

                        MusicStreamDataCount = 0;

                        PlayMusicFlay = 0;

                    }

                    if(Mp3FlieSizeCount >= PLAY_MUSIC_LENGHT)

                    {

                        Mp3FlieSizeCount = 0;

                    }

                }

            }

            else if(PlayMusicStream == 0)

            { 

               if(Mp3FlieSizeCount < Mp3_fnew.fsize)

               {

                   f_lseek(&Mp3_fnew, Mp3FlieSizeCount);

                   lenght = Mp3_fnew.fsize - Mp3FlieSizeCount;

                   if(lenght > MAX_BYTECOUNT)

                       lenght = MAX_BYTECOUNT;

                   

                   Mp3_res_sd = f_read(&Mp3_fnew, PlayMusicData, lenght, &Mp3_fnum);

                   if(Mp3_res_sd == FR_OK)

                   {

                       

                       play_music((unsigned char*)(&PlayMusicData[0]),lenght);

                       Mp3FlieSizeCount += lenght;

                       if(Mp3FlieSizeCount >= Mp3_fnew.fsize)

                       {

                           Mp3FlieSizeCount = 0;

                           PlayMusicEnFlag = 0;

                           f_close(&Mp3_fnew);

                       }

                   }

                   else

                   {

                       Mp3FlieSizeCount = 0;

                       PlayMusicEnFlag = 0;

                       f_close(&Mp3_fnew);

                   }

                   #if  PRINTF_DEBUG == 1  

                   printf("2¥·?mp3???t count %ld \r\n",Mp3FlieSizeCount);

                   #endif

               }

               else

               {

                   Mp3FlieSizeCount = 0;

                   PlayMusicEnFlag = 0;

                   f_close(&Mp3_fnew);

               }

            }

        }

    }

}


演示效果

image.png

評(píng)論區(qū)(0 )
主站蜘蛛池模板: 国产欧美一区二区精品仙草咪 | 国内精品不卡一区二区三区| 国产97精品久久久天天A片| 超碰97免费人妻| 纯h超级大尺度小黄文| 国产精品96久久久久久AV网址 | 亚洲AV色香蕉一区二区三区| 迅雷成人下载| 怡春院国产精品视频| 97精品国产亚洲AV高清| 不卡无线在一二三区| 国产精品-区区久久久狼| 狠很橹快播| 麻豆久久婷婷五月国产| 秋霞电影网午夜一级鲁丝片| 收集最新中文国产中文字幕| 亚洲精品乱码久久久久久v| 在线观看日本污污ww网站| AAA级精品无码久久久国片| 攻把受做哭边走边肉楼梯PLAY | 521人成a天堂v| 成人网站国产在线视频内射视频| 国产精品亚欧美一区二区三区| 教室里的激情电影| 免费精品一区二区三区AA片| 色愁愁久久久| 夜夜躁婷婷AV蜜桃视频| chinesevideoshd性舞| 国产精品一区二区激情| 久久资源365| 色偷偷伊人| 在线观看成年人免费视频| 超碰免费碰免费视频| 国产在线亚洲v天堂a| 内射人妻骚骚骚| 胸大的姑娘中文字幕视频| 最美女人体内射精一区二区 | 丫鬟粗大狠狠贯穿h| 91精品国产91热久久p| 国产浮力草草影院CCYY| 久久偷拍人|