• 大小: 3KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-01
  • 语言: 其他
  • 标签: mp3  播放时间  c++  

资源简介

获取mp3文件的播放时间(通过调用getMPEGTime返回播放的秒数)

资源截图

代码片段和文件信息

#include “GetInfo.h“

GetInFo::GetInFo()
{
    vecHeader.clear();
    iPosition = 0;
}

QByteArray GetInFo::getMaxVector(char *pDesc)
{
    QByteArray dataArry;
    dataArry.clear();
    if(!pDesc)
        return dataArry;
    char pHeader[3]={0};
    int iMax = 0;
    if(vecHeader.isEmpty())
        return dataArry;
    else
    {
        for(int i=0;i        {
            if(i==0)
            {
              memcpy(pHeadervecHeader.at(i).header3);
              iMax = vecHeader.at(i).iNumber;
            }
            else
            {
                if(vecHeader.at(i).iNumber>iMax)
                {
                  iMax = vecHeader.at(i).iNumber;
                  memcpy(pHeadervecHeader.at(i).header3);
                }
            }
        }
    }
    dataArry.append((const char *)pHeader3);
    memcpy(pDescpHeader3);
    return dataArry;
}

void GetInFo::getHeadInfo(char *pStart int iLen)
{
    if(!pStart)
        return;
    if(iLen<=4)
        return;
    int iHead = 0;
    for(int i =0;i    {
        if((pStart[i]&0xff)==0xff)
        {
            if((pStart[i+1]&0xff) <= 0xe0)
            {
               i+=1;
               continue;
            }
            if((pStart[i+1]&(0x3<<3))==0x08)
            {
               i+=1;
               continue;
            }
            if((pStart[i+1]&(0x3<<1))==0X0)
            {
                i+=1;
                continue;
            }
            if((pStart[i+2]&(0xf0))==0xf0)
            {
                i+=1;
                continue;
            }
            if((pStart[i+2]&0xf0)==0x00)
            {
                i+=1;
                continue;
            }
            if((pStart[i+2]&0x0c)==0x0c)
            {
                i+=1;
                continue;
            }
            iHead = i;
            if(iLen <= iHead+4)
            {
                i+=4;
                continue;
            }
            else
            {
              bool bExit = false;
              char Header[3]={0};
              memcpy(Header&pStart[i]3);
              if(vecHeader.isEmpty())
              {
                 bExit = true;
                 stcHeader stcNode;
                 stcNode.iNumber = 1;
                 memcpy(stcNode.headerHeader3);
                 vecHeader.append(stcNode);
              }
              else
              {
                  for(int j=0;j                  {
                      if(memcmp(vecHeader[j].headerHeader3)==0)
                      {
                          bExit= true;
                          vecHeader[j].iNumber+=1;
                      }
                  }
                  if(!bExit)
                  {
                     stcHeader stcNode;
                     memcpy(stcNode.headerHeader3);
                     stcNode.iNumber=1;
                     vecHeader.append(stcNode);
                  }
              }
              i+=4;
            }
        }

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      20336  2014-06-30 18:33  MP3\GetInfo.cpp

     文件        992  2014-06-30 18:33  MP3\GetInfo.h

     目录          0  2014-06-30 18:36  MP3

----------- ---------  ---------- -----  ----

                21328                    3


评论

共有 条评论