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

📄 dvb_av.h

📁 DVB软件,基于CT216软件的开发源程序.
💻 H
📖 第 1 页 / 共 2 页
字号:
/**************************************************************************

        (C)Copyright Cheertek Inc. 2002-2004,
           D700, all right reserved.

        Product : STB Firmware

****************************************************************************/
#ifndef __DVB_AV_H
#define __DVB_AV_H
/*! \file
* This module provides the video and audio control API.
*
*/

#include "ct_os.h"
#include "dvb_type.h"
#include "ap_defs.h"

/**
* Define the maximum audio level.
*/
#ifdef ENABLE_MAX_VOLUME_62
	#define MAX_VOLUME_LEVEL	62
#else
	#define MAX_VOLUME_LEVEL	32	
#endif

/**
* Define the Audio Freq type.
*/
#define AUDIO_FREQ_BASE         0
#define AUDIO_FREQ_8K          	(AUDIO_FREQ_BASE+ 0)
#define AUDIO_FREQ_16K          (AUDIO_FREQ_BASE+ 1)
#define AUDIO_FREQ_32K          (AUDIO_FREQ_BASE+ 2)
#define AUDIO_FREQ_64K          (AUDIO_FREQ_BASE+ 3)
#define AUDIO_FREQ_24K          (AUDIO_FREQ_BASE+ 4)
#define AUDIO_FREQ_48K          (AUDIO_FREQ_BASE+ 5)
#define AUDIO_FREQ_96K          (AUDIO_FREQ_BASE+ 6)
#define AUDIO_FREQ_11K          (AUDIO_FREQ_BASE+ 7)
#define AUDIO_FREQ_22K          (AUDIO_FREQ_BASE+ 8)
#define AUDIO_FREQ_44K          (AUDIO_FREQ_BASE+ 9)
#define AUDIO_FREQ_88K          (AUDIO_FREQ_BASE+ 10)
#define AUDIO_FREQ_END          AUDIO_FREQ_88K

/**
* Define the NIM ID.
*/
typedef enum
{
	EN_DVB_NIM_0,
	EN_DVB_NIM_1,
	EN_DVB_NIM_MAX
}EN_DVB_NIM_ID;

/**
* Define the video display type.
*/
typedef enum
{
	EN_VID_DISPLAY_4_3,	    /**< the video display type 4:3 */
    EN_VID_DISPLAY_16_9,	/**< the video display type 16:9 */
	EN_VID_DISPLAY_UNKNOWS  /**< the video display type unknows */
}EN_VID_DISPLAY;

/**
* Define the audio stream type.
*/
typedef enum
{
    EN_AUDIO_TYPE_MPG,      /**< the audio type MPG */
    EN_AUDIO_TYPE_AC3,       /**< the audio type AC3 */
    EN_AUDIO_TYPE_AC3_BY_PASS
}EN_AUDIO_TYPE;

/**
* Define the first screen of video display style.
*/
typedef enum
{
	EN_FIRST_SCR_TYPE_I_FRAME,	    /**< the I frame deocde complete display  */
    EN_FIRST_SCR_TYPE_AV_SYNC,		/**< the Audio and Video sync time display */
	EN_FIRST_SCR_TYPE_UNKNOWS
}EN_FIRST_SCR_TYPE;

/**
* Define the TVE output mode.
*/
typedef enum
{
	EN_TVE_OUTPUT_MODE_2CVBS_SVIDEO,	/**< the TVE output mode is 2 CVBS + S-Video */
	EN_TVE_OUTPUT_MODE_YUV,		    /**< the TVE output mode is YUV */
	EN_TVE_OUTPUT_MODE_VGA,	        /**< the TVE output mode is VGA */
	EN_TVE_OUTPUT_MODE_RGB	        /**< the TVE output mode is RGB */
}EN_TVE_OUTPUT_MODE;

#ifdef HDMI_ENABLE
/**
 * Define the HDMI sigal format
 */
typedef enum
{
    EN_HDMI_OUTPUT_MODE_480I_576I,           /**< the HDMI output mode is 480i or 576i */
    EN_HDMI_OUTPUT_MODE_480P_576P,           /**< the HDMI output mode is 480p or 576p */
    EN_HDMI_OUTPUT_MODE_720P,                /**< the HDMI output mode is 720p     */
    EN_HDMI_OUTPUT_MODE_1080I,               /**< the HDMI output mode is 1080p    */
    #ifdef HDMI_1080P_ENABLE
    EN_HDMI_OUTPUT_MODE_1080P,               /**< the HDMI output mode is 1080p    */
    #endif //HDMI_1080P_ENABLE
    EN_HDMI_OUTPUT_MODE_NUMBER
}EN_HDMI_OUTPUT_MODE;
#endif  //HDMI_ENABLE


/**
* Define the video signal format.
*/
typedef enum
{
	EN_VID_FORMAT_2CVBS_SVIDEO,	/**< the video format is 2 CVBS + S-Video and progressive off */
	EN_VID_FORMAT_CVBS_RGB,		/**< the video format is CVBS + RGB and progressive off */
	EN_VID_FORMAT_YCbCr,		/**< the video format is YPbPr and progressive off */
	EN_VID_FORMAT_VGA_PSCAN,	/**< the video format is VGA and progressive on */
	EN_VID_FORMAT_YPbPr_PSCAN,	/**< the video format is YPbPr and progressive on */
	EN_VID_FORMAT_RGB_PSCAN,	/**< the video format is YPbPr and progressive on */
	EN_VID_FORMAT_2CVBS_SVIDEO_CCIR601,	/**< the video format is 2 CVBS + S-Video and include CCIR601 output,
	this mode conflict with PIO port AL */
	EN_VID_FORMAT_CVBS_RGB_CCIR601,		/**< the video format is CVBS + RGB and include CCIR601 output,
	this mode conflict with PIO port AL */
	EN_VID_FORMAT_YCbCr_CCIR601,		/**< the video format is YPbPr and include CCIR601 output,
	this mode conflict with PIO port AL */
	EN_VID_FORMAT_2CVBS_SVIDEO_CCIR656,	/**< the video format is 2 CVBS + S-Video and include CCIR601 output */
	EN_VID_FORMAT_CVBS_RGB_CCIR656,		/**< the video format is CVBS + RGB and include CCIR601 output */
	EN_VID_FORMAT_YCbCr_CCIR656,		/**< the video format is YPbPr and include CCIR601 output */
	EN_VID_FORMAT_NUMBER
}EN_VID_FORMAT;

/**
* Position of structure

*/
typedef struct
{
	u16	u16X;
	u16 u16Y;
	u16 u16Width;
	u16	u16Height;
}ST_WIN_POS;

/**
* Define the video scaling type.
*/
typedef enum
{
	EN_VID_SCALING_NORMAL,	/**< the video output full screen */
	EN_VID_SCALING_1_2,		/**< the video output 1/4 screen */
	EN_VID_SCALING_1_3,		/**< the video output 1/9 screen */
	EN_VID_SCALING_1_4,		/**< the video output 1/16 screen */
    EN_VID_SCALING_2,		/**< the video output 1/16 screen */
    EN_VID_SCALING_4,		/**< the video output 1/16 screen */
    EN_VID_SCALING_8,		/**< the video output 1/16 screen */
	EN_VID_SCALING_USERDEFINE	/**< the video output userdefine screen */		//add by wilson 20070316
}EN_VID_SCALING;

/**
* Define the base band video output mode.
*/
typedef enum
{
	EN_VID_FIELD_FREQ_50HZ,	/**< video field frequency 50 Hz : PAL BGDHI, PAL N, SECAM*/
    EN_VID_FIELD_FREQ_60HZ	/**< video field frequency 60 Hz : NTSC, PAL M*/
}EN_VID_FIELD_FREQ;

typedef enum
{
	EN_VID_MODE_AUTO,	/**< This mode will auto detect by video stream
		, it will setting the video mode to PAL or NTSC. */
    EN_VID_MODE_PAL,	/**< Force setup the mode to PAL. */
	EN_VID_MODE_NTSC,	/**< Force setup the mode to NTSC. */
	EN_VID_MODE_PAL_M,	/**< Force setup the mode to PAL_M. */
	EN_VID_MODE_PAL_N,	/**< Force setup the mode to PAL_N. */
	#ifdef CT956
	EN_VID_MODE_TFT_DIGITAL,
	#endif
	EN_VID_MODE_NUMBER
}EN_VID_MODE;

/**
* Define the Audio Channel Type.
*/
typedef enum
{
	EN_AUD_CHANNEL_2,	    /**< the Audio Channel : 2CH */
    EN_AUD_CHANNEL_5_1	    /**< the Audio Channel : 5.1CH */
}EN_AUD_CHANNEL;

/**
* Define the audio output mode.
*/
typedef enum
{
	EN_AUD_MODE_LR,		/**< The audio output is stereo. */
	EN_AUD_MODE_RL,		/**< The audio output is swap LR. */
	EN_AUD_MODE_LL,		/**< The audio output is mono left. */
    EN_AUD_MODE_RR,		/**< The audio output is mono right. */
	EN_AUD_MODE_LR_MIX	/**< The audio output is mono right + left. */
}EN_AUD_MODE;

/**
* Define the stream type.
*/
typedef enum
{
	EN_STREAM_TYPE_NONE,		/**< The decoder can't detect any stream. */
    EN_STREAM_TYPE_FREE,		/**< The AV stream is free. */
	EN_STREAM_TYPE_SCRAMBLED,	/**< The AV stream is scrambled. */
    EN_STREAM_TYPE_FREE_RADIO,		/**< The AV stream is free without video stream. */
	EN_STREAM_TYPE_SCRAMBLED_RADIO,	/**< The AV stream is scrambled without video stream. */
	EN_STREAM_TYPE_HDTV		/**< The Video stream is HDTV. */
}EN_STREAM_TYPE;


/**
* Define the video zoom type.
*/
typedef enum
{
    EN_RATIO_LETTER_BOX,	/**< letter box for 16:9 content */
	EN_RATIO_PAN_SCAN,	    /**< pan-scan for 16:9 content */
	EN_RATIO_FIT_SCREEN,    /**< do nothing in scaling*/
	EN_TOTAL_RATIO_TYPE,
	EN_RATIO_ORIGINAL,      /**< temporary restore to EN_RATIO_FIT_SCREEN*/
	EN_RATIO_DEFAULT	    /**< the behavior is depend on previous setting */
}EN_RATIO_TYPE;


/**
* Define the iframe show layer.
*/
typedef enum
{
	EN_IFRAM_TURN_OFF,			/**< turn off iframe */
    EN_IFRAM_VIDEO_LAYER,		/**< show iframe in video layer */
	EN_IFRAM_BACKGROUND_LAYER	/**< show iframe in background layern */
}EN_IFRAME_MODE;


//<<ts type>>
typedef enum
{
    TS_TYPE_NO_STREAM,  			/**< no this stream */
    TS_TYPE_FREE,       			/**< stream is free */
    TS_TYPE_SCRAMBLED   			/**< stream is scramble */
}EN_TS_TYPE;


/*!
* For SF Serial port Format Definition
*/
typedef enum
{
	EN_AUDIO_PCM_LENGTH_24,			/*!< The pcm word length 24*/
    EN_AUDIO_PCM_LENGTH_20,			/*!< The pcm word length 20*/
    EN_AUDIO_PCM_LENGTH_18,			/*!< The pcm word length 18*/
    EN_AUDIO_PCM_LENGTH_16,			/*!< The pcm word length 16*/
} EN_AUDIO_PCM_LENGTH;


/*!
* For SF Serial port Format Definition
*/
typedef enum
{
	EN_AUDIO_ALIGN_FORMAT_RIGHT,			/*!< The SF Serial port format for Right align*/
    EN_AUDIO_ALIGN_FORMAT_I2S,			/*!< The SF Serial port format for I2S align*/
    EN_AUDIO_ALIGN_FORMAT_LEFT,			/*!< The SF Serial port format for Left align*/
} EN_AUDIO_ALIGN_FORMAT;

typedef enum
{
	EN_VIDEO_BRIGHTVIEW_NORMAL,
	EN_VIDEO_BRIGHTVIEW_BRIGHT,
	EN_VIDEO_BRIGHTVIEW_SOFT,
	EN_VIDEO_BRIGHTVIEW_END
} EN_VIDEO_BRIGHTVIEW;

typedef enum
{
	EN_VIDEO_CONTRAST_LEVEL_0,
	EN_VIDEO_CONTRAST_LEVEL_1,
	EN_VIDEO_CONTRAST_LEVEL_2,
	EN_VIDEO_CONTRAST_LEVEL_3,
	EN_VIDEO_CONTRAST_LEVEL_4,		// normal contrast
	EN_VIDEO_CONTRAST_LEVEL_5,
	EN_VIDEO_CONTRAST_LEVEL_6,
	EN_VIDEO_CONTRAST_LEVEL_7,
	EN_VIDEO_CONTRAST_LEVEL_8,
	EN_VIDEO_CONTRAST_LEVEL_END
} EN_VIDEO_CONTRAST_LEVEL;

typedef struct
{
	EN_AUDIO_PCM_LENGTH		enAudioPCMWordLength;	/* initial Audio support PCM Word Length, default is 16 */
	EN_AUDIO_ALIGN_FORMAT	enAudioAlignFormat;		/* initial Audio align format, default is right align */
	bool8   b8VideoSystemPAL;
}DVB_AVInitParameters;

/*!
* Audio EQ
*/
typedef enum _EN_AUDIO_EQ_MODE
{
	EN_AUDIO_EQ_NORMAL,
	EN_AUDIO_EQ_BASS_BOOSTER,
	EN_AUDIO_EQ_FULL_TREBLE,
	EN_AUDIO_EQ_JAZZ,
	EN_AUDIO_EQ_ROCK,
	EN_AUDIO_EQ_CLASSICAL,
	EN_AUDIO_EQ_POP,
	EN_AUDIO_EQ_NUMBER
} EN_AUDIO_EQ_MODE;

/*!
* For Instant Replay define
*/
#define TS_RING_BUFFER_BASIC_UNIT (47*1024) // for 188,1024 allignment
#define TS_RING_BUFFER_ONE_MB (21*TS_RING_BUFFER_BASIC_UNIT)

#ifdef DRAM_256MBIT
#ifdef CT_INSTANT_DELAY
#define TS_RING_BUFFER_SIZE (25*TS_RING_BUFFER_ONE_MB+1024)  // about 30s for 8Mb video, +1024 for ct_filter alignment
#else
#define TS_RING_BUFFER_SIZE (20*TS_RING_BUFFER_ONE_MB+1024)  // about 24s for 8Mb video, +1024 for ct_filter alignment
#endif
#endif

#ifdef DRAM_128MBIT
#define TS_RING_BUFFER_SIZE (7*TS_RING_BUFFER_ONE_MB+1024)  // about 8s for 8Mb video, +1024 for ct_filter alignment
#endif

#ifdef DRAM_64MBIT
//#define TS_RING_BUFFER_SIZE (1*TS_RING_BUFFER_ONE_MB+1024)  // about 1s for 8Mb video, +1024 for ct_filter alignment
#define TS_RING_BUFFER_SIZE 0   // disable instant replay
#endif

typedef enum
{
	EN_TSSTRM_INIT_MESSAGEQ_FAIL = 0,
	EN_TSSTRM_INIT_SEMAPHORE_FAIL,
	EN_TSSTRM_INIT_TASK_FAIL,
	EN_TSSTRM_INIT_BUFFERSIZE_FAIL,
	EN_TSSTRM_INIT_DONE
} EN_TSSTRM_INIT_STATUS;

typedef enum
{
	EN_TSSTRM_TASK_COMMAND_NONE = 0,
	EN_TSSTRM_TASK_COMMAND_CACHE_START,
	EN_TSSTRM_TASK_COMMAND_CACHE_STOP,
	EN_TSSTRM_TASK_COMMAND_PLAY_START,
	EN_TSSTRM_TASK_COMMAND_PLAY_STOP,
	EN_TSSTRM_TASK_COMMAND_FREE_MEM
} EN_TSSTRM_TASK_CMD;

/*!
 * Cheertek logo data structure
 */
#define LOGO_IFRAME_TAG					0x4D  /*!< Cheertek LOGO data header */
#define LOGO_IFRAME_OFFSET_TAG0			0	  /*!< Cheertek LOGO data header : 1st byte */
#define LOGO_IFRAME_OFFSET_TAG1			1	  /*!< Cheertek LOGO data header : 2nd byte */
#define LOGO_IFRAME_OFFSET_LEN			2	  /*!< Cheertek LOGO data header : 3th byte */
#define LOGO_IFRAME_OFFSET_FLAG			4	  /*!< Cheertek LOGO data header : 5th byte */
#define LOGO_IFRAME_OFFSET_WIDTH		6	  /*!< Cheertek LOGO data header : 7th byte */
#define LOGO_IFRAME_OFFSET_HEIGHT		8	  /*!< Cheertek LOGO data header : 9th byte */
#define LOGO_IFRAME_OFFSET_DATA			10	  /*!< Cheertek LOGO data header : 11th byte */

#define DVB_TVE_DAC_0 		0x1
#define DVB_TVE_DAC_1 		0x2
#define DVB_TVE_DAC_2 		0x4
#define DVB_TVE_DAC_3 		0x8
#define DVB_TVE_DAC_ALL 	0xF

void DVB_VideoPosition (EN_VID_SCALING enScaling_type, u16 u16PosX, u16 u16PosY);
/*! \fn void DVB_VideoPosition (EN_VID_SCALING enScaling_type, u16 u16PosX, u16 u16PosY)
\brief Setting the video screen position.
\param enScaling_type (Input) the video scale type
\param u16PosX (Input) the position of X
\param u16PoxY (Input) the position of Y
*/

void DVB_VideoSetPID (u16 u16VidPID);
/*! \fn void DVB_VideoSetPID (u16 u16VidPID)
\brief Setting the video PID.
\param u16VidPID (Input) the video PID
*/

u16 DVB_VideoGetPID (void);
/*! \fn u16 DVB_VideoGetPID (void)
\brief Get the video PID. If the return is 0 or 0x2000, the video PID is disabled.
\return the video PID.
*/

void DVB_VideoFreeze (bool8 b8Freeze);
/*! \fn void DVB_VideoFreeze (bool8 b8Freeze)
\brief Freeze the video.
\param b8Freeze (Input) Freeze or not.
*/
#ifdef WITHOUT_BACKGROUND_LAYER 
void DVB_IFrameModeSet(bool8 b8Enable);
bool8 DVB_IFrameModeGet(void);
#endif

bool8 DVB_IFrameLoad (u8 *pu8Data, u32 u32Length);
/*! \fn bool8 DVB_IFrameLoad (u8 *pu8Data, u32 u32Length)
\brief Load the IFrame data to decoder.
\param pu8Data The (Input) start pointer of the IFrame.
\param u32Length (Input) the length of IFrame
\return TRUE - success
\return FALSE - fail
*/

bool8 DVB_IFrameShow (EN_IFRAME_MODE enIframe_mode, u16 u16PosX, u16 u16PosY);
/*! \fn bool8 DVB_IFrameShow (EN_VID_SCALING enScaling_type, u16 u16PosX, u16 u16PosY)

⌨️ 快捷键说明

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