mp3_app.h

来自「AMLOGIC DPF source code」· C头文件 代码 · 共 106 行

H
106
字号
/*****************************************************************
**                                                             	**
**  Copyright (C) 2004 Amlogic,Inc.                            	**
**  All rights reserved                                        	**
**        Filename : mp3_app.h /Project:AVOS  					** 
**        Revision : 1.0                                       	**
**        Author: LiChao                                       	**
**        Created: Mar.16, 2005                                 **
**                                                             	**
*****************************************************************/
#ifndef __MP3_APP_H
#define __MP3_APP_H

#include "includes.h"
#include "aw_windows.h"
#include "datasrc.h"

typedef enum {
    MP3_INIT, 
    MP3_PLAY,                   /* normal seamless playback */ 
    MP3_PAUSE,                  /* paused during normal seamless playback */ 
    MP3_SEAMLESS_FF,            /* 2x seamless FF */ 
    MP3_SEAMLESS_FB,            /* 2x seamless FB */ 
    MP3_NON_SEAMLESS_BREAK,

    MP3_STOP, 
    MP3_PLAYEND, 
    MP3_ERROR,
    MP3_QUIT,
} mp3_status_e;

typedef struct {
    //byte1
	unsigned sync1:8;
    //byte2
	unsigned crc_flag:1;
	unsigned mp3_layer:2; // 11 -- layer 1; 10 -- layer 2; 01 -- layer 3
	unsigned mpeg_flag:2; // 00 -- MPEG V2.5(later extension of MPEG 2); 01 -- reserved; 10 -- MPEG v2(ISO/IEC 13818-3); 11 -- MPEG v1(ISO/IEC 11172-3)
	unsigned sync2:3;
    //byte3
	unsigned reserve:1;
	unsigned buffer_flag:1;
	//MPEG V1: 00 -- 44.1 ; 01 -- 48 ; 10 -- 32
	//MPEG V2: 00 -- 22.05 ; 01 -- 24 ; 10 -- 16
	//MPEG V2.5: 00 -- 11 ; 01 -- 12 ; 10 -- 8
	unsigned sample_rate_flag:2; 
	unsigned bit_rate_flag:4;
    //byte4
	unsigned emphasis_flag:2;
	unsigned original_flag:1;
	unsigned copyright_flag:1;
	unsigned mode_flag:2;
	unsigned channel_flag:2;
} mp3_frame_head_t;

typedef struct {
    int         fd_target_a;
    OS_EVENT   *audio_if;

    mp3_status_e stat;                                  /* current status */
    mp3_status_e ab_stat;                             /* last abnormal play status */ 
    //mp3 file frame data
    mp3_frame_head_t frame_head;
    /* mp3 stream info */
    unsigned    bit_rate;
    unsigned    played_ticks;
    unsigned    last_ticks;
    unsigned    played_size ;

    /* seamless play information */
    unsigned    audio_offset;                           /* current mp3 file read offset */
    
    /* non_seamless play information */
    int         ns_playspeed;                           /* FF,FB speed */
    
    /* played time */
    unsigned    play_time ;
    /*mp3 data buffer */
    unsigned    buffer_size;
    char        *buffer ;

} mp3_play_t;

typedef struct {
    DataSrc_t           mp3_fd ;        /* MP3 file handle, for new source struct */
    PAPPTASKARG         app;            /* application handle */
    mp3_play_t          play;           /* playback control and running info */
    EventSubscriber_t   *listener;      /* event loop listener */
} mp3_t;

extern void mp3_evh_ui_cmd(unsigned arg);
extern unsigned mp3_uop_loadapp(mp3_t *mp3_arg, unsigned param);
extern unsigned mp3_uop_play(mp3_t *mp3_arg, unsigned file_path);
extern unsigned mp3_uop_pause(mp3_t *mp3_arg);
extern unsigned mp3_uop_fastforward(mp3_t *mp3_arg, unsigned speed);
extern unsigned mp3_uop_fastbackward(mp3_t *mp3_arg, unsigned speed);
extern unsigned mp3_uop_timesearch(mp3_t *mp3_arg, unsigned time);
extern unsigned mp3_uop_stop(mp3_t *mp3_arg);
extern int mp3_init_decoder(mp3_t *mp3_arg);
extern void mp3_init_play(mp3_t *mp3_arg);
extern INT32S mp3_set_default_bit_rate(mp3_t *mp3_arg);

extern int mp3_reset_target(mp3_t *mp3_arg) ;
extern int mp3_release_decoder(mp3_t *mp3_arg) ;
extern int mp3_reset_decoder(mp3_t *mp3_arg) ;
#endif

⌨️ 快捷键说明

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