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

📄 mpeg.h

📁 本程序为ST公司开发的源代码
💻 H
字号:
/*
 * $Copyright: 
 * ----------------------------------------------------------------
 * This confidential and proprietary software may be used only as
 * authorised by a licensing agreement from Optomech, Co., Ltd.
 *   (C) COPYRIGHT 2006 Optomech, Co., Ltd.
 *       ALL RIGHTS RESERVED
 * The entire notice above must be reproduced on all authorised
 * copies and copies may only be made to the extent permitted
 * by a licensing agreement from Optomech, Co., Ltd..
 * ----------------------------------------------------------------
 * File:     mpeg.h,v
 * Revision: 1.0
 * ----------------------------------------------------------------
 * $
 *
 * Definitions for mpeg demuxer
 */

#ifndef _MPEG_H_
#define _MPEG_H_

#include "audiodec.h"

#define MPEG_MAKE_LONG(a,b,c,d) (((a)<<24)|((b)<<16)|((c)<<8)|(d))
#define MPEG_MAKE_TAG(a,b,c,d)  MPEG_MAKE_LONG((a),(b),(c),(d))
#define MPEG_FTYP               MPEG_MAKE_TAG('f','t','y','p')
#define MPEG_TRAK               MPEG_MAKE_TAG('t','r','a','k')
#define MPEG_ESDS               MPEG_MAKE_TAG('e','s','d','s')
#define MPEG_STSC               MPEG_MAKE_TAG('s','t','s','c')
#define MPEG_STSZ               MPEG_MAKE_TAG('s','t','s','z')
#define MPEG_STCO               MPEG_MAKE_TAG('s','t','c','o')
#define MPEG_UDTA               MPEG_MAKE_TAG('u','d','t','a')
#define MPEG_ILST               MPEG_MAKE_TAG('i','l','s','t')
#define MPEG_CHECK_M4A(p)       MPEG_MAKE_TAG((p)[4],(p)[5],(p)[6],(p)[7])
#define MPEG_GET_TAG(p)         MPEG_MAKE_TAG((p)[0],(p)[1],(p)[2],(p)[3])
#define MPEG_MAKE_SIZE(p)       MPEG_MAKE_LONG((p)[0],(p)[1],(p)[2],(p)[3])

typedef unsigned int            tSize;
typedef unsigned int            tCount;
typedef unsigned short          tFrame;
typedef unsigned int            tChunk;

#define MPEG_STATUS_TRAK        (0)
#define MPEG_STATUS_ESDS        (1)
#define MPEG_STATUS_STSC        (2)
#define MPEG_STATUS_STSZ        (3)
#define MPEG_STATUS_STSZX       (4)
#define MPEG_STATUS_STCO        (5)
#define MPEG_STATUS_STCOX       (6)
#define MPEG_STATUS_UDTA        (7)
#define MPEG_STATUS_ILST        (8)
#define MPEG_STATUS_ILSTX       (9)
#define MPEG_STATUS_READY       (10)

typedef struct _sMpegEsds
{
    int             Profile;
    unsigned int    BitRate;
    char            Channel;
    tAAC_Frequency  Frequency;
} sMpegEsds;

typedef struct _tMpegIndex
{
    unsigned int    size;
    unsigned int    framePerChunk;
    unsigned int    chunkMax;
    unsigned int    frameMax;
    unsigned int    chunkCount;
    unsigned int    frameCount;
    tChunk*         chunk;
    tFrame*         frame;
} tMpegIndex;

/* Find tag position & size from buffer */
eDecoderStatus
mpeg_find_tag(unsigned int tag, char** ppos, unsigned int* psize);

/* Get data from esds */
eDecoderStatus
mpeg_decode_esds(char* pos, unsigned int size, sMpegEsds* pesds);

/* Get data from stsc */
eDecoderStatus
mpeg_decode_stsc(char* pos, unsigned int size, void* buf);

/* Get data from stsz */
eDecoderStatus
mpeg_decode_stsz(char** ppos, unsigned int* psize, void* buf);

/* Read data from stsz */
eDecoderStatus
mpeg_read_stsz(char** ppos, unsigned int size, void* buf);

/* Get data from stco */
eDecoderStatus
mpeg_decode_stco(char** ppos, unsigned int* psize, void* buf);

/* Read data from stco */
eDecoderStatus
mpeg_read_stco(char** ppos, unsigned int size, void* buf);

/* Get frame offset */
unsigned int
mpeg_get_offset(void* buf);

/* Read frame size */
eDecoderStatus
mpeg_get_frame(int offset, void* buf, unsigned int* poffset,
               unsigned int* psize);

#endif

⌨️ 快捷键说明

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