video.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */
  2. /*
  3. * video.h - DEPRECATED MPEG-TS video decoder API
  4. *
  5. * NOTE: should not be used on future drivers
  6. *
  7. * Copyright (C) 2000 Marcus Metzler <[email protected]>
  8. * & Ralph Metzler <[email protected]>
  9. * for convergence integrated media GmbH
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU Lesser General Public License
  13. * as published by the Free Software Foundation; either version 2.1
  14. * of the License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Lesser General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  24. *
  25. */
  26. #ifndef _UAPI_DVBVIDEO_H_
  27. #define _UAPI_DVBVIDEO_H_
  28. #include <linux/types.h>
  29. #ifndef __KERNEL__
  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_PAN_SCAN, /* use pan and scan format */
  39. VIDEO_LETTER_BOX, /* use letterbox format */
  40. VIDEO_CENTER_CUT_OUT /* use center cut out format */
  41. } video_displayformat_t;
  42. typedef struct {
  43. int w;
  44. int h;
  45. video_format_t aspect_ratio;
  46. } video_size_t;
  47. typedef enum {
  48. VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */
  49. VIDEO_SOURCE_MEMORY /* If this source is selected, the stream
  50. comes from the user through the write
  51. system call */
  52. } video_stream_source_t;
  53. typedef enum {
  54. VIDEO_STOPPED, /* Video is stopped */
  55. VIDEO_PLAYING, /* Video is currently playing */
  56. VIDEO_FREEZED /* Video is freezed */
  57. } video_play_state_t;
  58. /* Decoder commands */
  59. #define VIDEO_CMD_PLAY (0)
  60. #define VIDEO_CMD_STOP (1)
  61. #define VIDEO_CMD_FREEZE (2)
  62. #define VIDEO_CMD_CONTINUE (3)
  63. /* Flags for VIDEO_CMD_FREEZE */
  64. #define VIDEO_CMD_FREEZE_TO_BLACK (1 << 0)
  65. /* Flags for VIDEO_CMD_STOP */
  66. #define VIDEO_CMD_STOP_TO_BLACK (1 << 0)
  67. #define VIDEO_CMD_STOP_IMMEDIATELY (1 << 1)
  68. /* Play input formats: */
  69. /* The decoder has no special format requirements */
  70. #define VIDEO_PLAY_FMT_NONE (0)
  71. /* The decoder requires full GOPs */
  72. #define VIDEO_PLAY_FMT_GOP (1)
  73. /* The structure must be zeroed before use by the application
  74. This ensures it can be extended safely in the future. */
  75. struct video_command {
  76. __u32 cmd;
  77. __u32 flags;
  78. union {
  79. struct {
  80. __u64 pts;
  81. } stop;
  82. struct {
  83. /* 0 or 1000 specifies normal speed,
  84. 1 specifies forward single stepping,
  85. -1 specifies backward single stepping,
  86. >1: playback at speed/1000 of the normal speed,
  87. <-1: reverse playback at (-speed/1000) of the normal speed. */
  88. __s32 speed;
  89. __u32 format;
  90. } play;
  91. struct {
  92. __u32 data[16];
  93. } raw;
  94. };
  95. };
  96. /* FIELD_UNKNOWN can be used if the hardware does not know whether
  97. the Vsync is for an odd, even or progressive (i.e. non-interlaced)
  98. field. */
  99. #define VIDEO_VSYNC_FIELD_UNKNOWN (0)
  100. #define VIDEO_VSYNC_FIELD_ODD (1)
  101. #define VIDEO_VSYNC_FIELD_EVEN (2)
  102. #define VIDEO_VSYNC_FIELD_PROGRESSIVE (3)
  103. struct video_event {
  104. __s32 type;
  105. #define VIDEO_EVENT_SIZE_CHANGED 1
  106. #define VIDEO_EVENT_FRAME_RATE_CHANGED 2
  107. #define VIDEO_EVENT_DECODER_STOPPED 3
  108. #define VIDEO_EVENT_VSYNC 4
  109. /* unused, make sure to use atomic time for y2038 if it ever gets used */
  110. long timestamp;
  111. union {
  112. video_size_t size;
  113. unsigned int frame_rate; /* in frames per 1000sec */
  114. unsigned char vsync_field; /* unknown/odd/even/progressive */
  115. } u;
  116. };
  117. struct video_status {
  118. int video_blank; /* blank video on freeze? */
  119. video_play_state_t play_state; /* current state of playback */
  120. video_stream_source_t stream_source; /* current source (demux/memory) */
  121. video_format_t video_format; /* current aspect ratio of stream*/
  122. video_displayformat_t display_format;/* selected cropping mode */
  123. };
  124. struct video_still_picture {
  125. char __user *iFrame; /* pointer to a single iframe in memory */
  126. __s32 size;
  127. };
  128. typedef __u16 video_attributes_t;
  129. /* bits: descr. */
  130. /* 15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */
  131. /* 13-12 TV system (0=525/60, 1=625/50) */
  132. /* 11-10 Aspect ratio (0=4:3, 3=16:9) */
  133. /* 9- 8 permitted display mode on 4:3 monitor (0=both, 1=only pan-sca */
  134. /* 7 line 21-1 data present in GOP (1=yes, 0=no) */
  135. /* 6 line 21-2 data present in GOP (1=yes, 0=no) */
  136. /* 5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 */
  137. /* 2 source letterboxed (1=yes, 0=no) */
  138. /* 0 film/camera mode (0=
  139. *camera, 1=film (625/50 only)) */
  140. /* bit definitions for capabilities: */
  141. /* can the hardware decode MPEG1 and/or MPEG2? */
  142. #define VIDEO_CAP_MPEG1 1
  143. #define VIDEO_CAP_MPEG2 2
  144. /* can you send a system and/or program stream to video device?
  145. (you still have to open the video and the audio device but only
  146. send the stream to the video device) */
  147. #define VIDEO_CAP_SYS 4
  148. #define VIDEO_CAP_PROG 8
  149. /* can the driver also handle SPU, NAVI and CSS encoded data?
  150. (CSS API is not present yet) */
  151. #define VIDEO_CAP_SPU 16
  152. #define VIDEO_CAP_NAVI 32
  153. #define VIDEO_CAP_CSS 64
  154. #define VIDEO_STOP _IO('o', 21)
  155. #define VIDEO_PLAY _IO('o', 22)
  156. #define VIDEO_FREEZE _IO('o', 23)
  157. #define VIDEO_CONTINUE _IO('o', 24)
  158. #define VIDEO_SELECT_SOURCE _IO('o', 25)
  159. #define VIDEO_SET_BLANK _IO('o', 26)
  160. #define VIDEO_GET_STATUS _IOR('o', 27, struct video_status)
  161. #define VIDEO_GET_EVENT _IOR('o', 28, struct video_event)
  162. #define VIDEO_SET_DISPLAY_FORMAT _IO('o', 29)
  163. #define VIDEO_STILLPICTURE _IOW('o', 30, struct video_still_picture)
  164. #define VIDEO_FAST_FORWARD _IO('o', 31)
  165. #define VIDEO_SLOWMOTION _IO('o', 32)
  166. #define VIDEO_GET_CAPABILITIES _IOR('o', 33, unsigned int)
  167. #define VIDEO_CLEAR_BUFFER _IO('o', 34)
  168. #define VIDEO_SET_STREAMTYPE _IO('o', 36)
  169. #define VIDEO_SET_FORMAT _IO('o', 37)
  170. #define VIDEO_GET_SIZE _IOR('o', 55, video_size_t)
  171. /**
  172. * VIDEO_GET_PTS
  173. *
  174. * Read the 33 bit presentation time stamp as defined
  175. * in ITU T-REC-H.222.0 / ISO/IEC 13818-1.
  176. *
  177. * The PTS should belong to the currently played
  178. * frame if possible, but may also be a value close to it
  179. * like the PTS of the last decoded frame or the last PTS
  180. * extracted by the PES parser.
  181. */
  182. #define VIDEO_GET_PTS _IOR('o', 57, __u64)
  183. /* Read the number of displayed frames since the decoder was started */
  184. #define VIDEO_GET_FRAME_COUNT _IOR('o', 58, __u64)
  185. #define VIDEO_COMMAND _IOWR('o', 59, struct video_command)
  186. #define VIDEO_TRY_COMMAND _IOWR('o', 60, struct video_command)
  187. #endif /* _UAPI_DVBVIDEO_H_ */