video.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /*
  2. * video.h
  3. *
  4. * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
  5. * & Ralph Metzler <ralph@convergence.de>
  6. * for convergence integrated media GmbH
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public License
  10. * as published by the Free Software Foundation; either version 2.1
  11. * of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. *
  22. */
  23. #ifndef _DVBVIDEO_H_
  24. #define _DVBVIDEO_H_
  25. #include <linux/compiler.h>
  26. #ifdef __KERNEL__
  27. #include <linux/types.h>
  28. #else
  29. #include <stdint.h>
  30. #include <time.h>
  31. #endif
  32. typedef enum {
  33. VIDEO_FORMAT_4_3, /* Select 4:3 format */
  34. VIDEO_FORMAT_16_9, /* Select 16:9 format. */
  35. VIDEO_FORMAT_221_1 /* 2.21:1 */
  36. } video_format_t;
  37. typedef enum {
  38. VIDEO_SYSTEM_PAL,
  39. VIDEO_SYSTEM_NTSC,
  40. VIDEO_SYSTEM_PALN,
  41. VIDEO_SYSTEM_PALNc,
  42. VIDEO_SYSTEM_PALM,
  43. VIDEO_SYSTEM_NTSC60,
  44. VIDEO_SYSTEM_PAL60,
  45. VIDEO_SYSTEM_PALM60
  46. } video_system_t;
  47. typedef enum {
  48. VIDEO_PAN_SCAN, /* use pan and scan format */
  49. VIDEO_LETTER_BOX, /* use letterbox format */
  50. VIDEO_CENTER_CUT_OUT /* use center cut out format */
  51. } video_displayformat_t;
  52. typedef struct {
  53. int w;
  54. int h;
  55. video_format_t aspect_ratio;
  56. } video_size_t;
  57. typedef enum {
  58. VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */
  59. VIDEO_SOURCE_MEMORY /* If this source is selected, the stream
  60. comes from the user through the write
  61. system call */
  62. } video_stream_source_t;
  63. typedef enum {
  64. VIDEO_STOPPED, /* Video is stopped */
  65. VIDEO_PLAYING, /* Video is currently playing */
  66. VIDEO_FREEZED /* Video is freezed */
  67. } video_play_state_t;
  68. struct video_event {
  69. int32_t type;
  70. #define VIDEO_EVENT_SIZE_CHANGED 1
  71. #define VIDEO_EVENT_FRAME_RATE_CHANGED 2
  72. time_t timestamp;
  73. union {
  74. video_size_t size;
  75. unsigned int frame_rate; /* in frames per 1000sec */
  76. } u;
  77. };
  78. struct video_status {
  79. int video_blank; /* blank video on freeze? */
  80. video_play_state_t play_state; /* current state of playback */
  81. video_stream_source_t stream_source; /* current source (demux/memory) */
  82. video_format_t video_format; /* current aspect ratio of stream*/
  83. video_displayformat_t display_format;/* selected cropping mode */
  84. };
  85. struct video_still_picture {
  86. char __user *iFrame; /* pointer to a single iframe in memory */
  87. int32_t size;
  88. };
  89. typedef
  90. struct video_highlight {
  91. int active; /* 1=show highlight, 0=hide highlight */
  92. uint8_t contrast1; /* 7- 4 Pattern pixel contrast */
  93. /* 3- 0 Background pixel contrast */
  94. uint8_t contrast2; /* 7- 4 Emphasis pixel-2 contrast */
  95. /* 3- 0 Emphasis pixel-1 contrast */
  96. uint8_t color1; /* 7- 4 Pattern pixel color */
  97. /* 3- 0 Background pixel color */
  98. uint8_t color2; /* 7- 4 Emphasis pixel-2 color */
  99. /* 3- 0 Emphasis pixel-1 color */
  100. uint32_t ypos; /* 23-22 auto action mode */
  101. /* 21-12 start y */
  102. /* 9- 0 end y */
  103. uint32_t xpos; /* 23-22 button color number */
  104. /* 21-12 start x */
  105. /* 9- 0 end x */
  106. } video_highlight_t;
  107. typedef struct video_spu {
  108. int active;
  109. int stream_id;
  110. } video_spu_t;
  111. typedef struct video_spu_palette { /* SPU Palette information */
  112. int length;
  113. uint8_t *palette;
  114. } video_spu_palette_t;
  115. typedef struct video_navi_pack {
  116. int length; /* 0 ... 1024 */
  117. uint8_t data[1024];
  118. } video_navi_pack_t;
  119. typedef uint16_t video_attributes_t;
  120. /* bits: descr. */
  121. /* 15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */
  122. /* 13-12 TV system (0=525/60, 1=625/50) */
  123. /* 11-10 Aspect ratio (0=4:3, 3=16:9) */
  124. /* 9- 8 permitted display mode on 4:3 monitor (0=both, 1=only pan-sca */
  125. /* 7 line 21-1 data present in GOP (1=yes, 0=no) */
  126. /* 6 line 21-2 data present in GOP (1=yes, 0=no) */
  127. /* 5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 */
  128. /* 2 source letterboxed (1=yes, 0=no) */
  129. /* 0 film/camera mode (0=camera, 1=film (625/50 only)) */
  130. /* bit definitions for capabilities: */
  131. /* can the hardware decode MPEG1 and/or MPEG2? */
  132. #define VIDEO_CAP_MPEG1 1
  133. #define VIDEO_CAP_MPEG2 2
  134. /* can you send a system and/or program stream to video device?
  135. (you still have to open the video and the audio device but only
  136. send the stream to the video device) */
  137. #define VIDEO_CAP_SYS 4
  138. #define VIDEO_CAP_PROG 8
  139. /* can the driver also handle SPU, NAVI and CSS encoded data?
  140. (CSS API is not present yet) */
  141. #define VIDEO_CAP_SPU 16
  142. #define VIDEO_CAP_NAVI 32
  143. #define VIDEO_CAP_CSS 64
  144. #define VIDEO_STOP _IO('o', 21)
  145. #define VIDEO_PLAY _IO('o', 22)
  146. #define VIDEO_FREEZE _IO('o', 23)
  147. #define VIDEO_CONTINUE _IO('o', 24)
  148. #define VIDEO_SELECT_SOURCE _IO('o', 25)
  149. #define VIDEO_SET_BLANK _IO('o', 26)
  150. #define VIDEO_GET_STATUS _IOR('o', 27, struct video_status)
  151. #define VIDEO_GET_EVENT _IOR('o', 28, struct video_event)
  152. #define VIDEO_SET_DISPLAY_FORMAT _IO('o', 29)
  153. #define VIDEO_STILLPICTURE _IOW('o', 30, struct video_still_picture)
  154. #define VIDEO_FAST_FORWARD _IO('o', 31)
  155. #define VIDEO_SLOWMOTION _IO('o', 32)
  156. #define VIDEO_GET_CAPABILITIES _IOR('o', 33, unsigned int)
  157. #define VIDEO_CLEAR_BUFFER _IO('o', 34)
  158. #define VIDEO_SET_ID _IO('o', 35)
  159. #define VIDEO_SET_STREAMTYPE _IO('o', 36)
  160. #define VIDEO_SET_FORMAT _IO('o', 37)
  161. #define VIDEO_SET_SYSTEM _IO('o', 38)
  162. #define VIDEO_SET_HIGHLIGHT _IOW('o', 39, video_highlight_t)
  163. #define VIDEO_SET_SPU _IOW('o', 50, video_spu_t)
  164. #define VIDEO_SET_SPU_PALETTE _IOW('o', 51, video_spu_palette_t)
  165. #define VIDEO_GET_NAVI _IOR('o', 52, video_navi_pack_t)
  166. #define VIDEO_SET_ATTRIBUTES _IO('o', 53)
  167. #define VIDEO_GET_SIZE _IOR('o', 55, video_size_t)
  168. #define VIDEO_GET_FRAME_RATE _IOR('o', 56, unsigned int)
  169. #endif /*_DVBVIDEO_H_*/