File:  [DVB] / margi2 / testsuite / osdwrap.h
Revision 1.2: download - view: text, annotated - select for diffs
Thu Mar 15 15:58:16 2001 UTC (23 years, 2 months ago) by mocm
Branches: MAIN
CVS tags: HEAD
- added fast forward and slow motion to dvb api
- tried to add it to DVD api, but it locked up the system with some files
- ffwd and slowmo also lock up the powerbook G4

/* Header file for OSD wrapper */

#ifndef _OSDWRAP_H_
#define _OSDWRAP_H_

#include <stdio.h>
#include "../cvdvext.h"

extern FILE* OSD_device;

extern struct drawcmd osdcmd;

/* Opens the character device to acces the card's driver */
#define OSDInit(devicename) (OSD_device=fopen(devicename,"w"))  // returns NULL on error

/* closes the card device file */
#define OSDExit() fclose(OSD_device)

/* Disables OSD and releases the buffers */
#define OSDClose() {\
  osdcmd.cmd=OSD_Close;\
  OSD_Draw(OSD_device,osdcmd);\
}

/* Opens OSD with this size and bit depth */
#define OSDOpen(_x0,_y0,_x1,_y1,_bpp,_mix) {\
  osdcmd.cmd=OSD_Open;\
  osdcmd.x0=_x0;\
  osdcmd.y0=_y0;\
  osdcmd.x1=_x1;\
  osdcmd.y1=_y1;\
  osdcmd.color=((_mix&0x0F)<<4)|(_bpp&0x0F);\
  OSD_Draw(OSD_device,osdcmd);\
}

/* enables OSD mode */
#define OSDShow() {\
  osdcmd.cmd=OSD_Show;\
  OSD_Draw(OSD_device,osdcmd);\
}

/* disables OSD mode */
#define OSDHide() {\
  osdcmd.cmd=OSD_Hide;\
  OSD_Draw(OSD_device,osdcmd);\
}

/* Sets all pixel to color 0 */
#define OSDClear() {\
  osdcmd.cmd=OSD_Clear;\
  OSD_Draw(OSD_device,osdcmd);\
}

/* Sets all pixel to color <color> */
#define OSDFill(_color) {\
  osdcmd.cmd=OSD_Fill;\
  osdcmd.color=_color;\
  OSD_Draw(OSD_device,osdcmd);\
}

/* set palette entry <color> to <r,g,b>, with opacity <o>
 R,G,B: 0..255
 R=Red, G=Green, B=Blue
 opacity=0:      pixel opacity 0% (only video pixel shows)
 opacity=1..254: pixel opacity as specified in header
 opacity=255:    pixel opacity 100% (only OSD pixel shows) */
#define OSDSetColor(_color,_r,_g,_b,_o) {\
  osdcmd.cmd=OSD_SetColor;\
  osdcmd.x0=_r;\
  osdcmd.y0=_g;\
  osdcmd.x1=_b;\
  osdcmd.y1=_o;\
  osdcmd.color=_color;\
  OSD_Draw(OSD_device,osdcmd);\
}

/* Set a number of entries in the palette
 sets the entries "firstcolor" through "lastcolor" from the array "data"
 data has 4 byte for each color:
 R,G,B, and a opacity value: 0->transparent, 1..254->mix, 255->pixel */
#define OSDSetPalette(_firstcolor,_lastcolor,_data) {\
  osdcmd.cmd=OSD_SetPalette;\
  osdcmd.x0=_lastcolor;\
  osdcmd.color=_firstcolor;\
  osdcmd.data=_data;\
  OSD_Draw(OSD_device,osdcmd);\
}

/* Sets transparency of mixed pixel (0..15) */
#define OSDSetTrans(_transparency) {\
  osdcmd.cmd=OSD_SetTrans;\
  osdcmd.color=_transparency;\
  OSD_Draw(OSD_device,osdcmd);\
}

/* sets pixel <x>,<y> to color number <col> */
#define OSDSetPixel(_x,_y,_color) {\
  osdcmd.cmd=OSD_SetPixel;\
  osdcmd.x0=_x;\
  osdcmd.y0=_y;\
  osdcmd.color=_color;\
  OSD_Draw(OSD_device,osdcmd);\
}

/* returns color number of pixel <x>,<y>,  or -1 */
#define OSDGetPixel(_x,_y,_color) {\
  osdcmd.cmd=OSD_GetPixel;\
  osdcmd.x0=_x;\
  osdcmd.y0=_y;\
  _color=OSD_Draw(OSD_device,osdcmd);\
}

/* fills pixels x0,y through  x1,y with the content of data[] */
#define OSDSetRow(_x0,_y,_x1,_data) {\
  osdcmd.cmd=OSD_SetRow;\
  osdcmd.x0=_x0;\
  osdcmd.y0=_y;\
  osdcmd.x1=_x1;\
  osdcmd.data=_data;\
  OSD_Draw(OSD_device,osdcmd);\
}

/* fills pixels x0,y0 through  x1,y1 with the content of data[]
 inc contains the width of one line in the data block,
 inc<=0 uses blockwidth as linewidth */
#define OSDSetBlock(_x0,_y0,_x1,_y1,_inc,_data) {\
  osdcmd.cmd=OSD_SetBlock;\
  osdcmd.x0=_x0;\
  osdcmd.y0=_y0;\
  osdcmd.x1=_x1;\
  osdcmd.y1=_y1;\
  osdcmd.color=_inc;\
  osdcmd.data=_data;\
  OSD_Draw(OSD_device,osdcmd);\
}

/* fills pixels x0,y through  x1,y with the color <col> */
#define OSDFillRow(_x0,_y,_x1,_color) {\
  osdcmd.cmd=OSD_FillRow;\
  osdcmd.x0=_x0;\
  osdcmd.y0=_y;\
  osdcmd.x1=_x1;\
  osdcmd.color=_color;\
  OSD_Draw(OSD_device,osdcmd);\
}

/* fills pixels x0,y0 through  x1,y1 with the color <color> */
#define OSDFillBlock(_x0,_y0,_x1,_y1,_color) {\
  osdcmd.cmd=OSD_FillBlock;\
  osdcmd.x0=_x0;\
  osdcmd.y0=_y0;\
  osdcmd.x1=_x1;\
  osdcmd.y1=_y1;\
  osdcmd.color=_color;\
  OSD_Draw(OSD_device,osdcmd);\
}

/* draw a line from x0,y0 to x1,y1 with the color <color> */
#define OSDLine(_x0,_y0,_x1,_y1,_color) {\
  osdcmd.cmd=OSD_Line;\
  osdcmd.x0=_x0;\
  osdcmd.y0=_y0;\
  osdcmd.x1=_x1;\
  osdcmd.y1=_y1;\
  osdcmd.color=_color;\
  OSD_Draw(OSD_device,osdcmd);\
}

/* fills parameters with the picture dimensions and the pixel aspect ratio */
#define OSDQuery(_x0,_y0,_x1,_y1,_xasp,_yasp) {\
  osdcmd.cmd=OSD_Query;\
  OSD_Draw(OSD_device,osdcmd);\
  _x0=osdcmd.x0;\
  _y0=osdcmd.y0;\
  _x1=osdcmd.x1;\
  _y1=osdcmd.y1;\
  _xasp=osdcmd.color;\
  _yasp=11;\
}


#endif  /* _OSDWRAP_H_ */

LinuxTV legacy CVS <linuxtv.org/cvs>