⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 id3_ext.c

📁 瑞星微公司RK27XX系列芯片的SDK开发包
💻 C
📖 第 1 页 / 共 2 页
字号:
/* Copyright (C) 2007 ROCK-CHIPS FUZHOU . All Rights Reserved. */
/*
File : \Audio\ID3
Desc : ID3

Author : FSH , Vincent Hisung
Date : 2007-08-xx
Notes :

$Log :
* FSH     2007/08/xx 建立此文件
*
* vincent     2007/08/xx
*
*/
/****************************************************************/
#include "../include/audio_main.h"
#include "../include/audio_globals.h"
#include "../include/file_access.h"

#ifdef RK_TAG_JPEG



#include "ID3.H"
#include "ID3_Jpeg.h"


#ifdef WMA_INCLUDE
// ASF Format Signature
unsigned char ASF_Header_Object[] =
{
    0x30, 0x26, 0xb2, 0x75,
    0x8e, 0x66, 0xcf, 0x11,
    0xa6, 0xd9, 0x00, 0xaa,
    0x00, 0x62, 0xce, 0x6c
};

// ASF_Content_Description_Object
unsigned char ASF_Content_Description_Object[] =
{
    0x33, 0x26, 0xb2, 0x75,
    0x8e, 0x66, 0xcf, 0x11,
    0xa6, 0xd9, 0x00, 0xaa,
    0x00, 0x62, 0xce, 0x6c
};

// Signature to get Time Duration
unsigned char ASF_File_Properties_Object[] =
{
    0xa1, 0xdc, 0xab, 0x8c,
    0x47, 0xa9, 0xcf, 0x11,
    0x8e, 0xe4, 0x00, 0xc0,
    0x0c, 0x20, 0x53, 0x65
};

// ASF_Extended_Content_Description_Object
unsigned char ASF_Extended_Content_Description_Object[] =
{
    0x40, 0xA4, 0xD0, 0xD2,
    0x07, 0xE3, 0xD2, 0x11,
    0x97, 0xF0, 0x00, 0xA0,
    0xC9, 0x5E, 0xA8, 0x50
};





unsigned char ContentDescriptorID3TAG[] =
{
    'I', 0x00,
    'D', 0x00,
    '3', 0x00,
    0x00, 0x00,
};
unsigned char ContentDescriptorAlbum[] =
{
    'W', 0x00,
    'M', 0x00,
    '/', 0x00,
    'A', 0x00,
    'l', 0x00,
    'b', 0x00,
    'u', 0x00,
    'm', 0x00,
    'T', 0x00,
    'i', 0x00,
    't', 0x00,
    'l', 0x00,
    'e', 0x00,
    0x00, 0x00,
};

unsigned char ContentDescriptorGenre[] =
{
    'W', 0x00,
    'M', 0x00,
    '/', 0x00,
    'G', 0x00,
    'e', 0x00,
    'n', 0x00,
    'r', 0x00,
    'e', 0x00,
// 'I',0x00,
// 'D',0x00,
    0x00, 0x00,
};

unsigned char ContentDescriptorTrack[] =
{
    'W', 0x00,
    'M', 0x00,
    '/', 0x00,
    'T', 0x00,
    'r', 0x00,
    'a', 0x00,
    'c', 0x00,
    'k', 0x00,
    0x00, 0x00,
};

unsigned char ContentDescriptorTrackNumber[] =
{
    'W', 0x00,
    'M', 0x00,
    '/', 0x00,
    'T', 0x00,
    'r', 0x00,
    'a', 0x00,
    'c', 0x00,
    'k', 0x00,
    'N', 0x00,
    'u', 0x00,
    'm', 0x00,
    'b', 0x00,
    'e', 0x00,
    'r', 0x00,
    0x00, 0x00,
};
unsigned char ContentDescriptorYear[] =
{
    'W', 0x00,
    'M', 0x00,
    '/', 0x00,
    'Y', 0x00,
    'e', 0x00,
    'a', 0x00,
    'r', 0x00,
    0x00, 0x00,
};

#ifdef RK_JPEG_ASF
unsigned char ContentDescriptorPicture[] =
{
    'W', 0x00,
    'M', 0x00,
    '/', 0x00,
    'P', 0x00,
    'i', 0x00,
    'c', 0x00,
    't', 0x00,
    'u', 0x00,
    'r', 0x00,
    'e', 0x00,
    0x00, 0x00,
};
#endif

ASFContentDescriptorType ASFContentDescriptor[] =
{
    {sizeof(ContentDescriptorID3TAG), WMA_DESCRIPTOR_ID3TAG, ContentDescriptorID3TAG},
    {sizeof(ContentDescriptorAlbum), WMA_DESCRIPTOR_ALBUM, ContentDescriptorAlbum},
    {sizeof(ContentDescriptorGenre), WMA_DESCRIPTOR_GENRE, ContentDescriptorGenre},
    {sizeof(ContentDescriptorTrack), WMA_DESCRIPTOR_TRACK, ContentDescriptorTrack},
    {sizeof(ContentDescriptorTrackNumber), WMA_DESCRIPTOR_TRACKNUMBER, ContentDescriptorTrackNumber},
    {sizeof(ContentDescriptorYear), WMA_DESCRIPTOR_YEAR, ContentDescriptorYear},
#ifdef RK_JPEG_ASF
    {sizeof(ContentDescriptorPicture), WMA_DESCRIPTOR_PICTURE, ContentDescriptorPicture},
#endif

};
#endif





#ifdef WMA_INCLUDE

/******************************************************
Name:  PROFILE_FillWMAMetaData
Desc:
Param:
Return:
Global: 无
Note:  无
Author: FSH
Log:
******************************************************/
/*
int PROFILE_FillWMAMetaData(int iDataSize,char *SrcBuf,char *TrgBuf)
{
 int iSize;

 if(iDataSize > 2 && SrcBuf!=NULL && TrgBuf != NULL) // because of NULL chararter
 {
  if(iDataSize > 252 )
  {
   iSize = 252;
   TrgBuf[253] = 0;
   TrgBuf[254] = 0;
  }
  else
  {
   iSize = iDataSize;
  }

  RKmemcpy(&TrgBuf[1],SrcBuf,iSize);
  TrgBuf[0] = (iSize/2);
 }
 else
 {
  memset(TrgBuf,0x00,256);
 }

 return iDataSize;
}
*/
/******************************************************
Name:  PROFILE_GetASFFilePropertiesObject
Desc:
Param:
Return:
Global: 无
Note:  无
Author: FSH
Log:
******************************************************/
int PROFILE_GetASFFilePropertiesObject(char *tempbuf, void *pID3Info)
{
    pASFFilePropertiesObjectType pASFFilePropertiesObject;

    int iSize;
    int iOffset = 0;

    if (tempbuf[0] == 0xA1 && tempbuf[0+1] == 0xDC)
    {
        pASFFilePropertiesObject = (pASFFilePropertiesObjectType) & tempbuf[0];

        iSize = sizeof(ASF_File_Properties_Object);

        if (!memcmp((void*)pASFFilePropertiesObject->mObjectID, ASF_File_Properties_Object, iSize))
        {
            iOffset = (pASFFilePropertiesObject->mObjectSize[0]);
        }
    }
    return iOffset;
}


/******************************************************
Name:  PROFILE_GetASFContentDescriptionObject
Desc:
Param:
Return:
Global: 无
Note:  无
Author: FSH
Log:
******************************************************/
int PROFILE_GetASFContentDescriptionObject(char *tempbuf, void *pID3Info)
{
    pWMAMetaHeaderType     pWMAMetaHeader;

    int iSize;
    int iOffset = 0;

    if (tempbuf[0] == 0x33 && tempbuf[1] == 0x26)
    {
        pWMAMetaHeader = (pWMAMetaHeaderType) & tempbuf[0];

        iSize = sizeof(ASF_Content_Description_Object);
        if (!memcmp((void*)pWMAMetaHeader->mObjectID, ASF_Content_Description_Object, iSize))
        {
            iOffset += sizeof(WMAMetaHeaderType); // 16(signature) + 8(?)

            // extract the Title data from file
            // iOffset += PROFILE_FillWMAMetaData(pWMAMetaHeader->cbCDTitle,&tempbuf[iOffset],pID3Info);

            // extract the Author data from file
            // iOffset += PROFILE_FillWMAMetaData(pWMAMetaHeader->cbCDAuthor,&tempbuf[iOffset],pID3Info);
#ifdef ID3_EXT_INCLUDE
            // extract the Copyright data from file
            iOffset += PROFILE_FillWMAMetaData(pWMAMetaHeader->cbCDCopyright, NULL, NULL);

            // extract the Description data from file
            iOffset += PROFILE_FillWMAMetaData(pWMAMetaHeader->cbCDDescription, NULL, NULL);

            // extract the Rating data from file
            if (pWMAMetaHeader->cbCDRating)
            {
                /*cbActual = WMA_GetData(cbCDRating);
                if(cbActual != cbCDRating)
                {
                 return WMAERR_BUFFERTOOSMALL;
                }
                cbObjectOffset += cbActual;*/
                iOffset += pWMAMetaHeader->cbCDRating;
            }
#endif
            iOffset = pWMAMetaHeader->mObjectSize[0];
        }
    }
    return iOffset;
}

/******************************************************

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -