色哟哟视频在线观看-色哟哟视频在线-色哟哟欧美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 )
主站蜘蛛池模板: 欧美深深色噜噜狠狠yyy| 肉多荤文高h羞耻校园| 日本精品久久无码影院| 性888xxxx入欧美| 5g天天奭视频| 国产久青青青青在线观看| 久久中文字幕综合不卡一二区 | 欧美精品成人a多人在线观看| 无码专区久久综合久综合字幕 | 国产电影尺度| 久久这里只精品国产99re66| 色爱AV综合区| 最近最新的日本字幕MV| 国产成人拍精品免费视频爱情岛| 久久久国产精品免费A片蜜芽广| 日产亚洲一区二区三区| 在线观看免费av网| 国产精品亚洲精品久久品| 男女牲交大战免费播放| 亚洲精品久久7777777| 被窝伦理电影午夜| 久久香蕉国产线看观看首页| 忘忧草在线影院www日本| 99久久国产综合色| 教室眠催白丝美女校花| 色综合欧美色综合七久久| 91精品国产免费入口| 黄色软件视频app| 失禁 调教 刺激 哭喊男男| 99国产这里只有精品视频| 精品国产麻豆免费人成网站| 台湾果冻传媒在线观看| youjizz怎么看| 免费高清在线影片一区| 亚洲人成www在线播放| 国产精品18久久久久网站| 人C交ZZZ0OOZZZ000| 97久久精品人人槡人妻人| 九九黄色大片| 亚洲99精品A片久久久久久| 公粗挺进了我的密道在线播放贝壳|