osd_output.h

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

H
341
字号
/*****************************************************************
**                                                             	**
**  Copyright (C) 2004 Amlogic,Inc.                            	**
**  All rights reserved                                        	**
**        Filename : osd_output.h /Project:AVOS 				** 
**        Revision : 1.0                                       	**
**                                                             	**
*****************************************************************/
#ifndef _OSD_OUTPUT_H
#define _OSD_OUTPUT_H

#include "ioapi.h"

typedef unsigned int   PIXELVAL ;//pixel's color index in palette or 0x1RGB value based on device support
typedef unsigned short COORD;		/* device coordinates*/
typedef unsigned short	YUVENTRY ; /* 0UUUUYYYYYYYVVVV/0CbCbCbCbYYYYYYYCrCrCrCr */

/* 
 * Pixel formats
 * Note the two pseudo pixel formats are never returned by display drivers,
 * but rather used as a data structure type in GrArea.  The other
 * types are both returned by display drivers and used as pixel packing
 * specifiers.
 */
#define PF_PALETTE_2	  0x1	/* palette type, total 2 kinds of color*/
#define PF_PALETTE_4	  0x2	/* palette type, total 4 kinds of color*/
#define PF_PALETTE_16	  0x4	/* palette type, total 16 kinds of color*/
#define PF_PALETTE_256	  0x8	/* palette type, total 256 kinds of color*/
#define PF_TRUECOLOR888   0x10	/* pixel is packed 24 bits 8/8/8 truecolor*/
#define PF_TRUECOLOR565   0x20	/* pixel is packed 16 bits 5/6/5 truecolor*/
#define PF_TRUECOLOR332	  0x40	/* pixel is packed 8 bits 3/3/2 truecolor*/
#define PF_TRUE_COLOR	  0x80	/* 422 true color OSD */

#define	COORD_MIN	((COORD) 0)	/* minimum coordinate value */
#define	COORD_MAX	((COORD) 32767)		/* maximum coordinate value */

#define IOCMD_COMMON_OSD_GETNAME			0x01
#define IOCMD_COMMON_OSD_GET_CONFIG			0x02
#define IOCMD_COMMON_OSD_SET_CONFIG			0x03
#define IOCMD_COMMON_OSD_CREATE				0x04
#define IOCMD_COMMON_OSD_DESTORY			0x05
#define IOCMD_COMMON_OSD_SET_PALETTE		0x06
#define IOCMD_COMMON_OSD_SET_ALPHA_MASK		0x07
#define IOCMD_COMMON_OSD_DRAW_PIXEL			0x08
#define IOCMD_COMMON_OSD_DRAW_HORZ_LINE		0x09
#define IOCMD_COMMON_OSD_DRAW_VERT_LINE		0x0a
#define IOCMD_COMMON_OSD_DRAW_FONT_BITS		0x0b
#define IOCMD_COMMON_OSD_DRAW_RLE_BITS		0x0c
#define IOCMD_COMMON_OSD_FILL_RECT			0x0d
#define IOCMD_COMMON_OSD_SET_OFF_SCREEN		0x0e
#define IOCMD_COMMON_OSD_ACTIVE_OFF_SCREEN	0x0f
#define IOCMD_COMMON_OSD_TURN_OFF_SCREEN	0x10
#define IOCMD_COMMON_OSD_TURN_ON_SCREEN		0x11
#define IOCMD_COMMON_OSD_READ_PIXEL			0x12
#define IOCMD_COMMON_OSD_SET_PROGRESSIVE	0x13
#define IOCMD_COMMON_OSD_SET_BUFFER_ADDR	0x14
#define IOCMD_COMMON_OSD_ATTACH_DISPLAYCTL	0x15
#define IOCMD_COMMON_OSD_CLEAR_SCREEN		0x16
#define IOCMD_COMMON_OSD_SET_SCREEN_MAP		0x17
#define IOCMD_COMMON_OSD_SET_OUTPUT_TYPE    0x18
#define IOCMD_COMMON_OSD_MOVE_LEFT_1PIXEL   0x19
#define IOCMD_COMMON_OSD_MOVE_RIGHT_1PIXEL  0x1a
#define IOCMD_COMMON_OSD_DATA_FROM_FRAMEBUF 0x1b
#define IOCMD_COMMON_OSD_DATA_FROM_DCU1     0x1c
#define IOCMD_COMMON_OSD_RST_WINS_POSITION  0x1d
#define IOCMD_COMMON_OSD_SET_FONT_ZOOM      0x1e
#define IOCMD_COMMON_OSD_SET_WINDOWS_START  0x1f
#define IOCMD_COMMON_OSD_GET_VIDEO_OUTPUT   0x20
#define IOCMD_COMMON_OSD_SET_OSD_ROTATE     0x21
#define IOCMD_COMMON_OSD_SET_DYNAMIC_PALETTE        0x22
#define IOCMD_COMMON_OSD_ENABLE_DYNAMIC_PALETTE     0x23
#define IOCMD_COMMON_OSD_DISABLE_DYNAMIC_PALETTE    0x24
	
#define IOCMD_COMMON_OSD2_GETNAME              0x01
#define IOCMD_COMMON_OSD2_GET_CONFIG           0x02
#define IOCMD_COMMON_OSD2_SET_CONFIG           0x03
#define IOCMD_COMMON_OSD2_CREATE               0x04
#define IOCMD_COMMON_OSD2_DESTORY              0x05
#define IOCMD_COMMON_OSD2_SET_PALETTE_SPU      0x06
#define IOCMD_COMMON_OSD2_SET_PALETTE_HL1      0x07
#define IOCMD_COMMON_OSD2_SET_PALETTE_HL2      0x08
#define IOCMD_COMMON_OSD2_SET_ALPHA_MASK_SPU   0x09    
#define IOCMD_COMMON_OSD2_SET_ALPHA_MASK_HL1   0x0a
#define IOCMD_COMMON_OSD2_SET_ALPHA_MASK_HL2   0x0b
#define IOCMD_COMMON_OSD2_ATTACH_DISPLAYCTL	   0x0c  
#define IOCMD_COMMON_OSD2_SET_OFF_SCREEN       0x0d
#define IOCMD_COMMON_OSD2_ACTIVE_OFF_SCREEN    0x0e
#define IOCMD_COMMON_OSD2_TURN_OFF_SCREEN      0x0f
#define IOCMD_COMMON_OSD2_TURN_ON_SCREEN       0x10
#define IOCMD_COMMON_OSD2_SET_BUFFER_ADDR      0x11
#define IOCMD_COMMON_OSD2_CLEAR_SCREEN         0x12
#define IOCMD_COMMON_OSD2_SET_SCREEN_MAP       0x13
#define IOCMD_COMMON_OSD2_WRITE                0x14
#define IOCMD_COMMON_OSD2_FILL_ONE_LINE_PIXEL  0x15
#define IOCMD_COMMON_OSD2_SET_HL1_POSITION     0x16
#define IOCMD_COMMON_OSD2_SET_HL2_POSITION     0x17
#define IOCMD_COMMON_OSD2_SET_H_SIZE           0x18
#define IOCMD_COMMON_OSD2_ENABLE_HL            0x19
#define IOCMD_COMMON_OSD2_DISABLE_HL           0x1A

#define OSD_HDMODE                             0x01 
#define OSD_SDMODE                             0x00 
	
#define RGB2YUVENTRY(r,g,b) \
	((((2048*r + 524288 - 1715*g - 333*b) >> 5) & 0x7800) | \
	 (((1224*r + 2404*g + 467*b) >> 9) & 0x7f0) | \
	 (((2048*b + 524288 - 691*r - 1357*g) >> 16) & 0xf)) //Cr,Y,Cb

typedef struct {
	INT8U 	x;		/* width zoom */
	INT8U 	y;		/* height zoom */
} ZOOM ;

typedef struct {
	COORD 	x;		/* x coordinate of top left corner */
	COORD 	y;		/* y coordinate of top left corner */
} POINT ;
	
typedef struct {
	COORD 	left;		/* x coordinate of top left corner */
	COORD 	top;		/* y coordinate of top left corner */
	COORD 	width;		/* width of rectangle, include the left point */
	COORD 	height;		/* height of rectangle, include the top point */
} RECT;

typedef struct {
	INT8U		osd_off_screen_flag;
	//when creare a osd window, this parameter means display area number of this window;
	//when set window's palette, this parameter means which dispaly area's palette need set,0 is basic palette
	INT8U		osd_block_num; 
	//when create a window, this parameter given the coordinate of every block
	RECT		*osd_block_area ;
	//when create a window, this parameter given the pixel format of every block
	INT32U		*block_pf_type ;
	//when set window's palette or alpha blending, this parameter give the palette or alpha blending values
	YUVENTRY 	*pal;
	//the length of palette or alpha blending parameter
	INT8U		pal_num;
	//when drawing a pixel, Fontbitmap, RLEbitmap, or fill a area, this parameter given the coordinate of drawing
	RECT		drawing_coordinate ;
	//if drawing a Fontbitmap or RLEbitmap, given the bitmap data
	INT8U	*bits ;
	//if draw a pixel, this is the pixel color/color index; if draw FontBitmap, it's the color value of 1 bits
	PIXELVAL 	fg ;
	//if draw FontBitmap, it's the color value of 0 bits
	PIXELVAL 	bg ;
	//if draw FontBitmap, this parameter decide if draw 0 bits
	INT8U		draw_bg_flag ;
	//the font dat can zoomx ,and zoomy
	ZOOM        font_zoom ;
	//osd display buffer, can set or get
	void *		OSD1_Even_addr ;
	void *		OSD1_Odd_addr ;
	void *		OSD2_Even_addr ;
	void *		OSD2_Odd_addr ;
} OSDARG ,*POSDARG;

typedef struct {
	COORD StartX;
	COORD EndX;
	COORD StartY;
	COORD EndY;
} RECT2;

typedef struct {
	INT32U Y01;
	INT32U Y23;
	INT32U CB01;
	INT32U CB23;
	INT32U CR01;
	INT32U CR23;
} OSD2COLOR;

typedef struct {
	INT32U SpuBufBegin;
	INT32U MaxSpuSize;
	INT32U ptrPXDWrite;
	INT16U WrOffset;
	INT16U *ptrPXDRead;
	INT16U PXDBufferBitPos;
	INT16U nPixelData;
	INT16U StartX;
	INT16U EndX;
	INT16U SpuData;
	INT16U BgData;
	INT8U Type;
	INT8U *ptrSub;
	INT8U ClearFlag;
} SPUDATA;

typedef struct {
	INT32U Flag;
	INT32S DisplayFd ;
	INT32U MemMapType ;
	COORD Hsize;
	RECT2 Rect;
	RECT2 RectHL1;
	RECT2 RectHL2;
	OSD2COLOR ColorSPU;
	OSD2COLOR ColorHL1;
	OSD2COLOR ColorHL2;
	INT16U AlphaSPU[4];
	INT16U AlphaHL1[4];
	INT16U AlphaHL2[4];
	SPUDATA Spu;
	INT16U * ScrEvenAddr ;
	INT16U * ScrOddAddr ;
	INT16U * OffScrEvenAddr ;
	INT16U * OffScrOddAddr ;
} OSD2ARG ,*POSD2ARG;

typedef struct {
    INT32U  index;          /* palette index */
    INT32U  color_num;      /* how many choices of colors */
    INT32U  toggle_num;     /* how many vsync interrupt to switch to next choice of color */
    INT32U *color_data;     /* each entry represent one color palette to toggle */
} osd_dynamic_palette_t;

#if (defined AML3400)||(defined AML3510)||(defined AML3511)
#define PROGRESSIVE_ENC_FLAG	((READ_MPEG_REG(ENCP_VIDEO_EN) & 1) && (!(READ_MPEG_REG(ENCP_VIDEO_MODE) & 0x1000)))
#define PROGRESSIVE_OSD_FLAG    PROGRESSIVE_ENC_FLAG
#else
#define PROGRESSIVE_ENC_FLAG	(READ_MPEG_REG(ENCP_VIDEO_EN) & 1)
#define PROGRESSIVE_OSD_FLAG  ((READ_MPEG_REG(ENCP_VIDEO_EN) & 1) && (!(READ_MPEG_REG(ENCP_VIDEO_MODE) & (1 << 12))))
//#define PROGRESSIVE_FLAG 0
#endif


/********************************  OSD1 Part ************************************************************/

avfs_device_driver osd_device_init(avfs_device_major_number major, avfs_device_minor_number minor, void *arg) ;
avfs_device_driver osd_device_open(avfs_device_major_number major, avfs_device_minor_number minor, void *arg);
avfs_device_driver osd_device_close(avfs_device_major_number major, avfs_device_minor_number minor, void *arg);
avfs_device_driver osd_device_read(avfs_device_major_number major, avfs_device_minor_number minor, void *arg);
avfs_device_driver osd_device_write(avfs_device_major_number major, avfs_device_minor_number minor, void *arg);
avfs_device_driver osd_device_ioctl(avfs_device_major_number major, avfs_device_minor_number minor, void *arg);

#define DEVICE_TABLE_OSD_OUTPUT \
    { \
        osd_device_init, \
        osd_device_open, \
        osd_device_close, \
        osd_device_read, \
        osd_device_write, \
        osd_device_ioctl \
    }

#define MAX_BLOCK_NUM		4
#define FLAG_SCR_OUTPUT_VALID	0x1
#define FLAG_DRAW_ON_OFFSCREEN	0x2
#define FLAG_ACTIVE_OFFSCREEN	0x4
#define FLAG_USING_FRAMEBUFFER  0x8

//error define
//ERROR TYPE
#define FATAL_ERROR									0xff000000
#define NORMAL_ERROR								0xfe000000
#define LOWEST_ERROR								0x81000000
#define WORRYING_LEVEL_1							0x80000000
#define WORRYING_LEVEL_2							0x7f000000
#define WORRYING_LEVEL_3							0x7e000000
#define DEBUG_HINT_INFO								0x7d000000

//ERROR value define 
#define ERR_SCR_OPEN_EXCEED_MAX_WINDOW_NUM			(NORMAL_ERROR | 0x1)
#define ERR_SCR_OPEN_PIXEL_8_MULTIPLE				(NORMAL_ERROR | 0x2)
#define ERR_SCR_ILLEGAL_WINDOW_RECT					(NORMAL_ERROR | 0x3)
#define ERR_SCR_PIXEL_FORMAT_TYPE					(NORMAL_ERROR | 0x4)
#define ERR_NOT_ENOUGH_MEMORY						(NORMAL_ERROR | 0x5)
#define ERR_PARAMETER_VALUE							(NORMAL_ERROR | 0x6)
#define ERR_PIXEL_COORDICATE_ERROR					(NORMAL_ERROR | 0x7)
#define ERR_PIXEL_FORMAT_NOT_SUPPORT				(NORMAL_ERROR | 0x8)
#define WORRYING_PIXEL_OUT_OF_RECT					(WORRYING_LEVEL_2 | 0x1)
#define WORRYING_RECT_ADJUSTED						(WORRYING_LEVEL_2 | 0x2)

#define ERR_OUTPUT_TYPE_NOT_SUPPORT					(LOWEST_ERROR | 0x1)



typedef struct {
	RECT		displayarea ; /* display window's area */
	INT32U		pf_type; /* this window's pixel type */
	INT16U		alpha_mask[4] ; /* Alpha blending parameter */
	YUVENTRY 	palette[4] ; /* this window's palette value */
	INT8U *		scr_odd_addr ;
	INT8U * 	scr_even_addr ;
	INT8U *		offscr_odd_addr ;
	INT8U * 	offscr_even_addr ;
    INT32U      data_size;
} SCRRECT, *PSCRRECT ;    

typedef struct _osddevice *POSDDEV;
typedef struct _osddevice {
	INT32U		totalscrsize;		/* size of memory allocated*/
	INT32U		pf_types;	/* screen support pixel formats*/
	INT32S		flags;		/* device flags*/
	INT32U		palette_colors ;
	YUVENTRY*	sys_palettes ;
    INT32S      sys_palettes_240_update;
	YUVENTRY*   sys_palettes_240 ;
	INT16U *	sys_alpha_mask ;
	RECT		physicalrect;		/* max screen's rect(max hardware support size),hardware defined */
	INT8U		win_num ; 		/* the number of the logic window user created */
	INT8U		active_win_id ;
	SCRRECT		logicwindows[MAX_BLOCK_NUM];	/* logic display areas, user define */
	INT32S		display_fd ;
	INT32U		mem_map_type ;
	INT32U      hd_type;
}OSDDEVICE ;

/********************************  OSD2 Part ************************************************************/

avfs_device_driver osd2_device_init(avfs_device_major_number major, avfs_device_minor_number minor, void *arg) ;
avfs_device_driver osd2_device_open(avfs_device_major_number major, avfs_device_minor_number minor, void *arg);
avfs_device_driver osd2_device_close(avfs_device_major_number major, avfs_device_minor_number minor, void *arg);
avfs_device_driver osd2_device_read(avfs_device_major_number major, avfs_device_minor_number minor, void *arg);
avfs_device_driver osd2_device_write(avfs_device_major_number major, avfs_device_minor_number minor, void *arg);
avfs_device_driver osd2_device_ioctl(avfs_device_major_number major, avfs_device_minor_number minor, void *arg);

#define DEVICE_TABLE_OSD2_OUTPUT \
    { \
        osd2_device_init, \
        osd2_device_open, \
        osd2_device_close, \
        osd2_device_read, \
        osd2_device_write, \
        osd2_device_ioctl \
    }

#define FLAG_OSD2_OUTPUT_VALID              0x1
#define FLAG_OSD2_USE_HUGE_BUFFER           0x2
#define FLAG_OSD2_OFFSCREEN_ACTIVE          0x4
#define FLAG_OSD2_ODD_FIELD_ON                 0x8
#define FLAG_OSD2_HL_VALID                  0x10

#ifndef __ROM_

#else
#endif
#endif //_OSD_OUTPUT_H

⌨️ 快捷键说明

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