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

📄 pflac_dec.h

📁 瑞星微公司RK27XX系列芯片的SDK开发包
💻 H
字号:
#ifndef _PFLAC_DEC_H_
#define _PFLAC_DEC_H_

#include "../buffer/buffer.h"
#include <stdio.h>
#include <stdint.h>

//--------------------------------------------
typedef int16_t FLAC__int16;
typedef int32_t FLAC__int32;
typedef int64_t FLAC__int64;
typedef uint16_t FLAC__uint16;
typedef uint32_t FLAC__uint32;
typedef uint64_t FLAC__uint64;

#ifdef true
#undef true
#endif
#ifdef false
#undef false
#endif
#ifndef __cplusplus
#define true 1
#define false 0
#endif

struct FLAC__BitBuffer;
typedef struct FLAC__BitBuffer FLAC__BitBuffer;

typedef struct
{
    FLAC__uint64 sample_number;
    /**<  The sample number of the target frame. */

    FLAC__uint64 stream_offset;
    /**< The offset, in bytes, of the target frame with respect to
     * beginning of the first frame. */

    unsigned frame_samples;
    /**< The number of samples in the target frame. */
} FLAC__StreamMetadata_SeekPoint;

//--------------------------------------------
#define STRING_SIZE 32
//////////////////////////////////
#define  MAX__SEEK_POINTS_NUM  2560//256
#define  BLOCKS_PER_DECODE  (4608 + 4)                   //每帧的最大Block尺寸,4是32位对齐量
#define  FLAC__BITBUFFER_DEFAULT_CAPACITY_SIZE   4096*4  //输入缓冲大小
#define  FLAC_PCM_BUFFER_SIZE    (BLOCKS_PER_DECODE * 2)      //可以保存32位PCM输出
#define  FLAC_ENCODED_DATA_SIZE  (FLAC__BITBUFFER_DEFAULT_CAPACITY_SIZE)//以后要修改输入Buffer长度就修改FLAC__BITBUFFER_DEFAULT_CAPACITY宏

///定义文件操作结构体类型,其成员为函数指针类型 added by hxd 20070719
typedef struct
{
    size_t (*FlacReadBase)(void* ptr , size_t size , size_t nitems , FILE* strem);
    int (*FlacSeekBase)(FILE* stream , long offset , int fromwhere);
    long int (*FlacTellBase)(FILE* stream);
    size_t (*FlacWriteBase)(const void* ptr , size_t size, size_t nitems, FILE* stream);
}tFLACFileIo;



typedef struct
{
    //DecoderList *workspace;
    //eDecoderStatus status;
    long           status;
    //sDecoderBitstream bitstream;
    //sDecoderOutput output;

    //tmInstance *pmInstance;
    //tmScratch *pmScratch;


    char pcEncodedData[FLAC_ENCODED_DATA_SIZE];//编码的输出Buffer,解码的输入Buffer,4096*4 bytes


    short psLeft[FLAC_PCM_BUFFER_SIZE];//编码的左声道输入Buffer,解码的输出左声道Buffer
    short psRight[FLAC_PCM_BUFFER_SIZE];//编码的右声道输入Buffer,解码的输出右声道Buffer

    BufferState *pOutput;
    int buffer_ptr[2];

    //unsigned short usValid;

    unsigned short usSampleRate;

    unsigned char ucChannels;

    //unsigned char ucIsVBR;

    //unsigned long ulFirstFrame;

    unsigned long ulLength;

    // The number of samples in each encoded block of audio.
    //unsigned short usSamplesPerBlock; // block

    // The length of the file in milliseconds.
    unsigned long ulTimeLength;

    unsigned long ulBitRate;

    // The number of samples that have been encoded/decoded.
    unsigned long ulTimePos;


    // A buffer to contain the song title.
    unsigned char ucTitle[STRING_SIZE];

    // A buffer to contain the song artist.
    unsigned char ucArtist[STRING_SIZE];

    // A buffer to contain the song album.
    unsigned char ucAlbum[STRING_SIZE];

    // A buffer to contain the song genre.
    unsigned char ucGenre[STRING_SIZE];

    // A buffer to contain the song date.
    unsigned char ucDate[STRING_SIZE];

    // A buffer to contain the song comment.
    unsigned char ucComment[STRING_SIZE];

    // A buffer to contain the song comment.
    unsigned char ucTrackNumber[STRING_SIZE];
} tFLAC;


#endif

⌨️ 快捷键说明

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