brintos

brintos / linux-shallow public Read only

0
0
Text · 42.6 KiB · b9fd5ca Raw
2431 lines · plain
1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later OR GPL-2.02 3.. c:namespace:: dtv.legacy.video4 5.. _dvb_video:6 7================8DVB Video Device9================10 11.. attention:: Do **not** use in new drivers!12             See: :ref:`legacy_dvb_decoder_notes`13 14The DVB video device controls the MPEG2 video decoder of the DVB15hardware. It can be accessed through ``/dev/dvb/adapter0/video0``. Data16types and ioctl definitions can be accessed by including17``linux/dvb/video.h`` in your application.18 19Note that the DVB video device only controls decoding of the MPEG video20stream, not its presentation on the TV or computer screen. On PCs this21is typically handled by an associated video4linux device, e.g.22``/dev/video``, which allows scaling and defining output windows.23 24Most DVB cards don’t have their own MPEG decoder, which results in the25omission of the audio and video device as well as the video4linux26device.27 28These ioctls were also used by V4L2 to control MPEG decoders implemented29in V4L2. The use of these ioctls for that purpose has been made obsolete30and proper V4L2 ioctls or controls have been created to replace that31functionality. Use :ref:`V4L2 ioctls<video>` for new drivers!32 33 34Video Data Types35================36 37 38 39video_format_t40--------------41 42Synopsis43~~~~~~~~44 45.. code-block:: c46 47    typedef enum {48	VIDEO_FORMAT_4_3,49	VIDEO_FORMAT_16_9,50	VIDEO_FORMAT_221_151    } video_format_t;52 53Constants54~~~~~~~~~55 56.. flat-table::57    :header-rows:  058    :stub-columns: 059 60    -  ..61 62       -  ``VIDEO_FORMAT_4_3``63 64       -  Select 4:3 format.65 66    -  ..67 68       -  ``VIDEO_FORMAT_16_9``69 70       -  Select 16:9 format.71 72    -  ..73 74       -  ``VIDEO_FORMAT_221_1``75 76       -  Select 2.21:1 format.77 78Description79~~~~~~~~~~~80 81The ``video_format_t`` data type82is used in the `VIDEO_SET_FORMAT`_ function to tell the driver which83aspect ratio the output hardware (e.g. TV) has. It is also used in the84data structures `video_status`_ returned by `VIDEO_GET_STATUS`_85and `video_event`_ returned by `VIDEO_GET_EVENT`_ which report86about the display format of the current video stream.87 88 89-----90 91 92video_displayformat_t93---------------------94 95Synopsis96~~~~~~~~97 98.. code-block:: c99 100    typedef enum {101	VIDEO_PAN_SCAN,102	VIDEO_LETTER_BOX,103	VIDEO_CENTER_CUT_OUT104    } video_displayformat_t;105 106Constants107~~~~~~~~~108 109.. flat-table::110    :header-rows:  0111    :stub-columns: 0112 113    -  ..114 115       -  ``VIDEO_PAN_SCAN``116 117       -  Use pan and scan format.118 119    -  ..120 121       -  ``VIDEO_LETTER_BOX``122 123       -  Use letterbox format.124 125    -  ..126 127       -  ``VIDEO_CENTER_CUT_OUT``128 129       -  Use center cut out format.130 131Description132~~~~~~~~~~~133 134In case the display format of the video stream and of the display135hardware differ the application has to specify how to handle the136cropping of the picture. This can be done using the137`VIDEO_SET_DISPLAY_FORMAT`_ call which accepts this enum as argument.138 139 140-----141 142 143video_size_t144------------145 146Synopsis147~~~~~~~~148 149.. code-block:: c150 151    typedef struct {152	int w;153	int h;154	video_format_t aspect_ratio;155    } video_size_t;156 157Variables158~~~~~~~~~159 160.. flat-table::161    :header-rows:  0162    :stub-columns: 0163 164    -  ..165 166       -  ``int w``167 168       -  Video width in pixels.169 170    -  ..171 172       -  ``int h``173 174       -  Video height in pixels.175 176    -  ..177 178       -  `video_format_t`_ ``aspect_ratio``179 180       -  Aspect ratio.181 182Description183~~~~~~~~~~~184 185Used in the struct `video_event`_. It stores the resolution and186aspect ratio of the video.187 188 189-----190 191 192video_stream_source_t193---------------------194 195Synopsis196~~~~~~~~197 198.. code-block:: c199 200    typedef enum {201	VIDEO_SOURCE_DEMUX,202	VIDEO_SOURCE_MEMORY203    } video_stream_source_t;204 205Constants206~~~~~~~~~207 208.. flat-table::209    :header-rows:  0210    :stub-columns: 0211 212    -  ..213 214       -  ``VIDEO_SOURCE_DEMUX``215 216       -  :cspan:`1` Select the demux as the main source.217 218    -  ..219 220       -  ``VIDEO_SOURCE_MEMORY``221 222       -  If this source is selected, the stream223          comes from the user through the write224          system call.225 226Description227~~~~~~~~~~~228 229The video stream source is set through the `VIDEO_SELECT_SOURCE`_ call230and can take the following values, depending on whether we are replaying231from an internal (demuxer) or external (user write) source.232VIDEO_SOURCE_DEMUX selects the demultiplexer (fed either by the233frontend or the DVR device) as the source of the video stream. If234VIDEO_SOURCE_MEMORY is selected the stream comes from the application235through the `write()`_ system call.236 237 238-----239 240 241video_play_state_t242------------------243 244Synopsis245~~~~~~~~246 247.. code-block:: c248 249    typedef enum {250	VIDEO_STOPPED,251	VIDEO_PLAYING,252	VIDEO_FREEZED253    } video_play_state_t;254 255Constants256~~~~~~~~~257 258.. flat-table::259    :header-rows:  0260    :stub-columns: 0261 262    -  ..263 264       -  ``VIDEO_STOPPED``265 266       -  Video is stopped.267 268    -  ..269 270       -  ``VIDEO_PLAYING``271 272       -  Video is currently playing.273 274    -  ..275 276       -  ``VIDEO_FREEZED``277 278       -  Video is frozen.279 280Description281~~~~~~~~~~~282 283This values can be returned by the `VIDEO_GET_STATUS`_ call284representing the state of video playback.285 286 287-----288 289 290struct video_command291--------------------292 293Synopsis294~~~~~~~~295 296.. code-block:: c297 298    struct video_command {299	__u32 cmd;300	__u32 flags;301	union {302	    struct {303		__u64 pts;304	    } stop;305 306	    struct {307		__s32 speed;308		__u32 format;309	    } play;310 311	    struct {312		__u32 data[16];313	    } raw;314	};315    };316 317 318Variables319~~~~~~~~~320 321.. flat-table::322    :header-rows:  0323    :stub-columns: 0324 325    -  ..326 327       -  ``__u32 cmd``328 329       -  `Decoder command`_330 331    -  ..332 333       -  ``__u32 flags``334 335       -  Flags for the `Decoder command`_.336 337    -  ..338 339       -  ``struct stop``340 341       -  ``__u64 pts``342 343       -  MPEG PTS344 345    -  ..346 347       -  :rspan:`5` ``stuct play``348 349       -  :rspan:`4` ``__s32 speed``350 351       -   0 or 1000 specifies normal speed,352 353    -  ..354 355       -   1:  specifies forward single stepping,356 357    -  ..358 359       -   -1: specifies backward single stepping,360 361    -  ..362 363       -   >1: playback at speed / 1000 of the normal speed364 365    -  ..366 367       -   <-1: reverse playback at ( -speed / 1000 ) of the normal speed.368 369    -  ..370 371       -  ``__u32 format``372 373       -  `Play input formats`_374 375    -  ..376 377       -  ``__u32 data[16]``378 379       -  Reserved380 381Description382~~~~~~~~~~~383 384The structure must be zeroed before use by the application. This ensures385it can be extended safely in the future.386 387 388-----389 390 391Predefined decoder commands and flags392-------------------------------------393 394Synopsis395~~~~~~~~396 397.. code-block:: c398 399    #define VIDEO_CMD_PLAY                      (0)400    #define VIDEO_CMD_STOP                      (1)401    #define VIDEO_CMD_FREEZE                    (2)402    #define VIDEO_CMD_CONTINUE                  (3)403 404    #define VIDEO_CMD_FREEZE_TO_BLACK      (1 << 0)405 406    #define VIDEO_CMD_STOP_TO_BLACK        (1 << 0)407    #define VIDEO_CMD_STOP_IMMEDIATELY     (1 << 1)408 409    #define VIDEO_PLAY_FMT_NONE                 (0)410    #define VIDEO_PLAY_FMT_GOP                  (1)411 412    #define VIDEO_VSYNC_FIELD_UNKNOWN           (0)413    #define VIDEO_VSYNC_FIELD_ODD               (1)414    #define VIDEO_VSYNC_FIELD_EVEN              (2)415    #define VIDEO_VSYNC_FIELD_PROGRESSIVE       (3)416 417Constants418~~~~~~~~~419 420.. flat-table::421    :header-rows:  0422    :stub-columns: 0423 424    -  ..425 426       -  :rspan:`3` _`Decoder command`427 428       -  ``VIDEO_CMD_PLAY``429 430       -  Start playback.431 432    -  ..433 434       -  ``VIDEO_CMD_STOP``435 436       -  Stop playback.437 438    -  ..439 440       -  ``VIDEO_CMD_FREEZE``441 442       -  Freeze playback.443 444    -  ..445 446       -  ``VIDEO_CMD_CONTINUE``447 448       -  Continue playback after freeze.449 450    -  ..451 452       -  Flags for ``VIDEO_CMD_FREEZE``453 454       -  ``VIDEO_CMD_FREEZE_TO_BLACK``455 456       -  Show black picture on freeze.457 458    -  ..459 460       -  :rspan:`1` Flags for ``VIDEO_CMD_STOP``461 462       -  ``VIDEO_CMD_STOP_TO_BLACK``463 464       -  Show black picture on stop.465 466    -  ..467 468       -  ``VIDEO_CMD_STOP_IMMEDIATELY``469 470       -  Stop immediately, without emptying buffers.471 472    -  ..473 474       -  :rspan:`1` _`Play input formats`475 476       -  ``VIDEO_PLAY_FMT_NONE``477 478       -  The decoder has no special format requirements479 480    -  ..481 482       -  ``VIDEO_PLAY_FMT_GOP``483 484       -  The decoder requires full GOPs485 486    -  ..487 488       -  :rspan:`3` Field order489 490       -  ``VIDEO_VSYNC_FIELD_UNKNOWN``491 492       -  FIELD_UNKNOWN can be used if the hardware does not know493          whether the Vsync is for an odd, even or progressive494          (i.e. non-interlaced) field.495 496    -  ..497 498       -  ``VIDEO_VSYNC_FIELD_ODD``499 500       -  Vsync is for an odd field.501 502    -  ..503 504       -  ``VIDEO_VSYNC_FIELD_EVEN``505 506       -  Vsync is for an even field.507 508    -  ..509 510       -  ``VIDEO_VSYNC_FIELD_PROGRESSIVE``511 512       -  progressive (i.e. non-interlaced)513 514 515-----516 517 518video_event519-----------520 521Synopsis522~~~~~~~~523 524.. code-block:: c525 526    struct video_event {527	__s32 type;528    #define VIDEO_EVENT_SIZE_CHANGED        1529    #define VIDEO_EVENT_FRAME_RATE_CHANGED  2530    #define VIDEO_EVENT_DECODER_STOPPED     3531    #define VIDEO_EVENT_VSYNC               4532	long timestamp;533	union {534	    video_size_t size;535	    unsigned int frame_rate;536	    unsigned char vsync_field;537	} u;538    };539 540Variables541~~~~~~~~~542 543.. flat-table::544    :header-rows:  0545    :stub-columns: 0546 547    -  ..548 549       -  :rspan:`4` ``__s32 type``550 551       -  :cspan:`1` Event type.552 553    -  ..554 555       -  ``VIDEO_EVENT_SIZE_CHANGED``556 557       -  Size changed.558 559    -  ..560 561       -  ``VIDEO_EVENT_FRAME_RATE_CHANGED``562 563       -  Framerate changed.564 565    -  ..566 567       -  ``VIDEO_EVENT_DECODER_STOPPED``568 569       -  Decoder stopped.570 571    -  ..572 573       -  ``VIDEO_EVENT_VSYNC``574 575       -  Vsync occurred.576 577    -  ..578 579       -  ``long timestamp``580 581       -  :cspan:`1` MPEG PTS at occurrence.582 583    -  ..584 585       -  :rspan:`2` ``union u``586 587       -  `video_size_t`_ size588 589       -  Resolution and aspect ratio of the video.590 591    -  ..592 593       -  ``unsigned int frame_rate``594 595       -  in frames per 1000sec596 597    -  ..598 599       -  ``unsigned char vsync_field``600 601       -  | unknown / odd / even / progressive602          | See: `Predefined decoder commands and flags`_603 604Description605~~~~~~~~~~~606 607This is the structure of a video event as it is returned by the608`VIDEO_GET_EVENT`_ call. See there for more details.609 610 611-----612 613 614video_status615------------616 617Synopsis618~~~~~~~~619 620The `VIDEO_GET_STATUS`_ call returns the following structure informing621about various states of the playback operation.622 623.. code-block:: c624 625    struct video_status {626	int                    video_blank;627	video_play_state_t     play_state;628	video_stream_source_t  stream_source;629	video_format_t         video_format;630	video_displayformat_t  display_format;631    };632 633Variables634~~~~~~~~~635 636.. flat-table::637    :header-rows:  0638    :stub-columns: 0639 640    -  ..641 642       -  :rspan:`2` ``int video_blank``643 644       -  :cspan:`1` Show blank video on freeze?645 646    -  ..647 648       -  TRUE  ( != 0 )649 650       -  Blank screen when freeze.651 652    -  ..653 654       -  FALSE ( == 0 )655 656       -  Show last decoded frame.657 658    -  ..659 660       -  `video_play_state_t`_ ``play_state``661 662       -  Current state of playback.663 664    -  ..665 666       -  `video_stream_source_t`_ ``stream_source``667 668       -  Current source (demux/memory).669 670    -  ..671 672       -  `video_format_t`_ ``video_format``673 674       -  Current aspect ratio of stream.675 676    -  ..677 678       -  `video_displayformat_t`_ ``display_format``679 680       -  Applied cropping mode.681 682Description683~~~~~~~~~~~684 685If ``video_blank`` is set ``TRUE`` video will be blanked out if the686channel is changed or if playback is stopped. Otherwise, the last picture687will be displayed. ``play_state`` indicates if the video is currently688frozen, stopped, or being played back. The ``stream_source`` corresponds689to the selected source for the video stream. It can come either from the690demultiplexer or from memory. The ``video_format`` indicates the aspect691ratio (one of 4:3 or 16:9) of the currently played video stream.692Finally, ``display_format`` corresponds to the applied cropping mode in693case the source video format is not the same as the format of the output694device.695 696 697-----698 699 700video_still_picture701-------------------702 703Synopsis704~~~~~~~~705 706.. code-block:: c707 708    struct video_still_picture {709    char *iFrame;710    int32_t size;711    };712 713Variables714~~~~~~~~~715 716.. flat-table::717    :header-rows:  0718    :stub-columns: 0719 720    -  ..721 722       -  ``char *iFrame``723 724       -  Pointer to a single iframe in memory.725 726    -  ..727 728       -  ``int32_t size``729 730       -  Size of the iframe.731 732 733Description734~~~~~~~~~~~735 736An I-frame displayed via the `VIDEO_STILLPICTURE`_ call is passed on737within this structure.738 739 740-----741 742 743video capabilities744------------------745 746Synopsis747~~~~~~~~748 749.. code-block:: c750 751    #define VIDEO_CAP_MPEG1   1752    #define VIDEO_CAP_MPEG2   2753    #define VIDEO_CAP_SYS     4754    #define VIDEO_CAP_PROG    8755 756Constants757~~~~~~~~~758Bit definitions for capabilities:759 760.. flat-table::761    :header-rows:  0762    :stub-columns: 0763 764    -  ..765 766       -  ``VIDEO_CAP_MPEG1``767 768       -  :cspan:`1` The hardware can decode MPEG1.769 770    -  ..771 772       -  ``VIDEO_CAP_MPEG2``773 774       -  The hardware can decode MPEG2.775 776    -  ..777 778       -  ``VIDEO_CAP_SYS``779 780       -  The video device accepts system stream.781 782          You still have to open the video and the audio device783          but only send the stream to the video device.784 785    -  ..786 787       -  ``VIDEO_CAP_PROG``788 789       -  The video device accepts program stream.790 791          You still have to open the video and the audio device792          but only send the stream to the video device.793 794Description795~~~~~~~~~~~796 797A call to `VIDEO_GET_CAPABILITIES`_ returns an unsigned integer with the798following bits set according to the hardware's capabilities.799 800 801-----802 803 804Video Function Calls805====================806 807 808VIDEO_STOP809----------810 811Synopsis812~~~~~~~~813 814.. c:macro:: VIDEO_STOP815 816.. code-block:: c817 818	int ioctl(fd, VIDEO_STOP, int mode)819 820Arguments821~~~~~~~~~822 823.. flat-table::824    :header-rows:  0825    :stub-columns: 0826 827    -  ..828 829       -  ``int fd``830 831       -  :cspan:`1` File descriptor returned by a previous call832          to `open()`_.833 834    -  ..835 836       -  ``int request``837 838       -  :cspan:`1` Equals ``VIDEO_STOP`` for this command.839 840    -  ..841 842       -  :rspan:`2` ``int mode``843 844       -  :cspan:`1` Indicates how the screen shall be handled.845 846    -  ..847 848       -  TRUE  ( != 0 )849 850       -  Blank screen when stop.851 852    -  ..853 854       -  FALSE ( == 0 )855 856       -  Show last decoded frame.857 858Description859~~~~~~~~~~~860 861.. attention:: Do **not** use in new drivers!862             See: :ref:`legacy_dvb_decoder_notes`863 864This ioctl is for Digital TV devices only. To control a V4L2 decoder use865the V4L2 :ref:`VIDIOC_DECODER_CMD` instead.866 867This ioctl call asks the Video Device to stop playing the current868stream. Depending on the input parameter, the screen can be blanked out869or displaying the last decoded frame.870 871Return Value872~~~~~~~~~~~~873 874On success 0 is returned, on error -1 and the ``errno`` variable is set875appropriately. The generic error codes are described at the876:ref:`Generic Error Codes <gen-errors>` chapter.877 878 879-----880 881 882VIDEO_PLAY883----------884 885Synopsis886~~~~~~~~887 888.. c:macro:: VIDEO_PLAY889 890.. code-block:: c891 892	int ioctl(fd, VIDEO_PLAY)893 894Arguments895~~~~~~~~~896 897.. flat-table::898    :header-rows:  0899    :stub-columns: 0900 901    -  ..902 903       -  ``int fd``904 905       -  :cspan:`1` File descriptor returned by a previous call906          to `open()`_.907 908    -  ..909 910       -  ``int request``911 912       -  Equals ``VIDEO_PLAY`` for this command.913 914Description915~~~~~~~~~~~916 917.. attention:: Do **not** use in new drivers!918             See: :ref:`legacy_dvb_decoder_notes`919 920This ioctl is for Digital TV devices only. To control a V4L2 decoder use921the V4L2 :ref:`VIDIOC_DECODER_CMD` instead.922 923This ioctl call asks the Video Device to start playing a video stream924from the selected source.925 926Return Value927~~~~~~~~~~~~928 929On success 0 is returned, on error -1 and the ``errno`` variable is set930appropriately. The generic error codes are described at the931:ref:`Generic Error Codes <gen-errors>` chapter.932 933 934-----935 936 937VIDEO_FREEZE938------------939 940Synopsis941~~~~~~~~942 943.. c:macro:: VIDEO_FREEZE944 945.. code-block:: c946 947	int ioctl(fd, VIDEO_FREEZE)948 949Arguments950~~~~~~~~~951 952.. flat-table::953    :header-rows:  0954    :stub-columns: 0955 956    -  ..957 958       -  ``int fd``959 960       -  :cspan:`1` File descriptor returned by a previous call961          to `open()`_.962 963    -  ..964 965       -  ``int request``966 967       -  Equals ``VIDEO_FREEZE`` for this command.968 969Description970~~~~~~~~~~~971 972.. attention:: Do **not** use in new drivers!973             See: :ref:`legacy_dvb_decoder_notes`974 975This ioctl is for Digital TV devices only. To control a V4L2 decoder use976the V4L2 :ref:`VIDIOC_DECODER_CMD` instead.977 978This ioctl call suspends the live video stream being played, if979VIDEO_SOURCE_DEMUX is selected. Decoding and playing are frozen.980It is then possible to restart the decoding and playing process of the981video stream using the `VIDEO_CONTINUE`_ command.982If VIDEO_SOURCE_MEMORY is selected in the ioctl call983`VIDEO_SELECT_SOURCE`_, the Digital TV subsystem will not decode any more984data until the ioctl call `VIDEO_CONTINUE`_ or `VIDEO_PLAY`_ is performed.985 986Return Value987~~~~~~~~~~~~988 989On success 0 is returned, on error -1 and the ``errno`` variable is set990appropriately. The generic error codes are described at the991:ref:`Generic Error Codes <gen-errors>` chapter.992 993 994-----995 996 997VIDEO_CONTINUE998--------------999 1000Synopsis1001~~~~~~~~1002 1003.. c:macro:: VIDEO_CONTINUE1004 1005.. code-block:: c1006 1007	int ioctl(fd, VIDEO_CONTINUE)1008 1009Arguments1010~~~~~~~~~1011 1012.. flat-table::1013    :header-rows:  01014    :stub-columns: 01015 1016    -  ..1017 1018       -  ``int fd``1019 1020       -  :cspan:`1` File descriptor returned by a previous call1021          to `open()`_.1022 1023    -  ..1024 1025       -  ``int request``1026 1027       -  Equals ``VIDEO_CONTINUE`` for this command.1028 1029Description1030~~~~~~~~~~~1031 1032.. attention:: Do **not** use in new drivers!1033             See: :ref:`legacy_dvb_decoder_notes`1034 1035This ioctl is for Digital TV devices only. To control a V4L2 decoder use1036the V4L2 :ref:`VIDIOC_DECODER_CMD` instead.1037 1038This ioctl call restarts decoding and playing processes of the video1039stream which was played before a call to `VIDEO_FREEZE`_ was made.1040 1041Return Value1042~~~~~~~~~~~~1043 1044On success 0 is returned, on error -1 and the ``errno`` variable is set1045appropriately. The generic error codes are described at the1046:ref:`Generic Error Codes <gen-errors>` chapter.1047 1048 1049-----1050 1051 1052VIDEO_SELECT_SOURCE1053-------------------1054 1055Synopsis1056~~~~~~~~1057 1058.. c:macro:: VIDEO_SELECT_SOURCE1059 1060.. code-block:: c1061 1062	int ioctl(fd, VIDEO_SELECT_SOURCE, video_stream_source_t source)1063 1064Arguments1065~~~~~~~~~1066 1067.. flat-table::1068    :header-rows:  01069    :stub-columns: 01070 1071    -  ..1072 1073       -  ``int fd``1074 1075       -  :cspan:`1` File descriptor returned by a previous call1076          to `open()`_.1077 1078    -  ..1079 1080       -  ``int request``1081 1082       -  Equals ``VIDEO_SELECT_SOURCE`` for this command.1083 1084    -  ..1085 1086       -  `video_stream_source_t`_ ``source``1087 1088       -  Indicates which source shall be used for the Video stream.1089 1090Description1091~~~~~~~~~~~1092 1093.. attention:: Do **not** use in new drivers!1094             See: :ref:`legacy_dvb_decoder_notes`1095 1096This ioctl is for Digital TV devices only. This ioctl was also supported1097by the V4L2 ivtv driver, but that has been replaced by the ivtv-specific1098``IVTV_IOC_PASSTHROUGH_MODE`` ioctl.1099 1100This ioctl call informs the video device which source shall be used for1101the input data. The possible sources are demux or memory. If memory is1102selected, the data is fed to the video device through the write command1103using the struct `video_stream_source_t`_. If demux is selected, the data1104is directly transferred from the onboard demux-device to the decoder.1105 1106The data fed to the decoder is also controlled by the PID-filter.1107Output selection: :c:type:`dmx_output` ``DMX_OUT_DECODER``.1108 1109 1110Return Value1111~~~~~~~~~~~~1112 1113On success 0 is returned, on error -1 and the ``errno`` variable is set1114appropriately. The generic error codes are described at the1115:ref:`Generic Error Codes <gen-errors>` chapter.1116 1117 1118-----1119 1120 1121VIDEO_SET_BLANK1122---------------1123 1124Synopsis1125~~~~~~~~1126 1127.. c:macro:: VIDEO_SET_BLANK1128 1129.. code-block:: c1130 1131	int ioctl(fd, VIDEO_SET_BLANK, int mode)1132 1133Arguments1134~~~~~~~~~1135 1136.. flat-table::1137    :header-rows:  01138    :stub-columns: 01139 1140    -  ..1141 1142       -  ``int fd``1143 1144       -  :cspan:`1` File descriptor returned by a previous call1145          to `open()`_.1146 1147    -  ..1148 1149       -  ``int request``1150 1151       -  :cspan:`1` Equals ``VIDEO_SET_BLANK`` for this command.1152 1153    -  ..1154 1155       -  :rspan:`2` ``int mode``1156 1157       -  :cspan:`1` Indicates if the screen shall be blanked.1158 1159    -  ..1160 1161       -  TRUE  ( != 0 )1162 1163       -  Blank screen when stop.1164 1165    -  ..1166 1167       -  FALSE ( == 0 )1168 1169       -  Show last decoded frame.1170 1171Description1172~~~~~~~~~~~1173 1174.. attention:: Do **not** use in new drivers!1175             See: :ref:`legacy_dvb_decoder_notes`1176 1177This ioctl call asks the Video Device to blank out the picture.1178 1179Return Value1180~~~~~~~~~~~~1181 1182On success 0 is returned, on error -1 and the ``errno`` variable is set1183appropriately. The generic error codes are described at the1184:ref:`Generic Error Codes <gen-errors>` chapter.1185 1186 1187-----1188 1189 1190VIDEO_GET_STATUS1191----------------1192 1193Synopsis1194~~~~~~~~1195 1196.. c:macro:: VIDEO_GET_STATUS1197 1198.. code-block:: c1199 1200	int ioctl(fd, int request = VIDEO_GET_STATUS,1201	struct video_status *status)1202 1203Arguments1204~~~~~~~~~1205 1206.. flat-table::1207    :header-rows:  01208    :stub-columns: 01209 1210    -  ..1211 1212       -  ``int fd``1213 1214       -  :cspan:`1` File descriptor returned by a previous call1215          to `open()`_.1216 1217    -  ..1218 1219       -  ``int request``1220 1221       -  Equals ``VIDEO_GET_STATUS`` for this command.1222 1223    -  ..1224 1225       -  ``struct`` `video_status`_ ``*status``1226 1227       -  Returns the current status of the Video Device.1228 1229Description1230~~~~~~~~~~~1231 1232.. attention:: Do **not** use in new drivers!1233             See: :ref:`legacy_dvb_decoder_notes`1234 1235This ioctl call asks the Video Device to return the current status of1236the device.1237 1238Return Value1239~~~~~~~~~~~~1240 1241On success 0 is returned, on error -1 and the ``errno`` variable is set1242appropriately. The generic error codes are described at the1243:ref:`Generic Error Codes <gen-errors>` chapter.1244 1245 1246-----1247 1248 1249VIDEO_GET_EVENT1250---------------1251 1252Synopsis1253~~~~~~~~1254 1255.. c:macro:: VIDEO_GET_EVENT1256 1257.. code-block:: c1258 1259	int ioctl(fd, int request = VIDEO_GET_EVENT,1260	struct video_event *ev)1261 1262Arguments1263~~~~~~~~~1264 1265.. flat-table::1266    :header-rows:  01267    :stub-columns: 01268 1269    -  ..1270 1271       -  ``int fd``1272 1273       -  :cspan:`1` File descriptor returned by a previous call1274          to `open()`_.1275 1276    -  ..1277 1278       -  ``int request``1279 1280       -  Equals ``VIDEO_GET_EVENT`` for this command.1281 1282    -  ..1283 1284       -  ``struct`` `video_event`_ ``*ev``1285 1286       -  Points to the location where the event, if any, is to be stored.1287 1288Description1289~~~~~~~~~~~1290 1291.. attention:: Do **not** use in new drivers!1292             See: :ref:`legacy_dvb_decoder_notes`1293 1294This ioctl is for DVB devices only. To get events from a V4L2 decoder1295use the V4L2 :ref:`VIDIOC_DQEVENT` ioctl instead.1296 1297This ioctl call returns an event of type `video_event`_ if available. A1298certain number of the latest events will be cued and returned in order of1299occurrence. Older events may be discarded if not fetched in time. If1300an event is not available, the behavior depends on whether the device is1301in blocking or non-blocking mode. In the latter case, the call fails1302immediately with errno set to ``EWOULDBLOCK``. In the former case, the1303call blocks until an event becomes available. The standard Linux poll()1304and/or select() system calls can be used with the device file descriptor1305to watch for new events. For select(), the file descriptor should be1306included in the exceptfds argument, and for poll(), POLLPRI should be1307specified as the wake-up condition. Read-only permissions are sufficient1308for this ioctl call.1309 1310Return Value1311~~~~~~~~~~~~1312 1313On success 0 is returned, on error -1 and the ``errno`` variable is set1314appropriately. The generic error codes are described at the1315:ref:`Generic Error Codes <gen-errors>` chapter.1316 1317.. flat-table::1318    :header-rows:  01319    :stub-columns: 01320 1321    -  ..1322 1323       -  ``EWOULDBLOCK``1324 1325       -  :cspan:`1` There is no event pending, and the device is in1326          non-blocking mode.1327 1328    -  ..1329 1330       -  ``EOVERFLOW``1331 1332       -  Overflow in event queue - one or more events were lost.1333 1334 1335-----1336 1337 1338VIDEO_SET_DISPLAY_FORMAT1339------------------------1340 1341Synopsis1342~~~~~~~~1343 1344.. c:macro:: VIDEO_SET_DISPLAY_FORMAT1345 1346.. code-block:: c1347 1348	int ioctl(fd, int request = VIDEO_SET_DISPLAY_FORMAT,1349	video_display_format_t format)1350 1351Arguments1352~~~~~~~~~1353 1354.. flat-table::1355    :header-rows:  01356    :stub-columns: 01357 1358    -  ..1359 1360       -  ``int fd``1361 1362       -  :cspan:`1` File descriptor returned by a previous call1363          to `open()`_.1364 1365    -  ..1366 1367       -  ``int request``1368 1369       -  Equals ``VIDEO_SET_DISPLAY_FORMAT`` for this command.1370 1371    -  ..1372 1373       -  `video_displayformat_t`_ ``format``1374 1375       -  Selects the video format to be used.1376 1377Description1378~~~~~~~~~~~1379 1380.. attention:: Do **not** use in new drivers!1381             See: :ref:`legacy_dvb_decoder_notes`1382 1383This ioctl call asks the Video Device to select the video format to be1384applied by the MPEG chip on the video.1385 1386Return Value1387~~~~~~~~~~~~1388 1389On success 0 is returned, on error -1 and the ``errno`` variable is set1390appropriately. The generic error codes are described at the1391:ref:`Generic Error Codes <gen-errors>` chapter.1392 1393 1394-----1395 1396 1397VIDEO_STILLPICTURE1398------------------1399 1400Synopsis1401~~~~~~~~1402 1403.. c:macro:: VIDEO_STILLPICTURE1404 1405.. code-block:: c1406 1407	int ioctl(fd, int request = VIDEO_STILLPICTURE,1408	struct video_still_picture *sp)1409 1410Arguments1411~~~~~~~~~1412 1413.. flat-table::1414    :header-rows:  01415    :stub-columns: 01416 1417    -  ..1418 1419       -  ``int fd``1420 1421       -  :cspan:`1` File descriptor returned by a previous call1422          to `open()`_.1423 1424    -  ..1425 1426       -  ``int request``1427 1428       -  Equals ``VIDEO_STILLPICTURE`` for this command.1429 1430    -  ..1431 1432       -  ``struct`` `video_still_picture`_ ``*sp``1433 1434       -  Pointer to the location where the struct with the I-frame1435          and size is stored.1436 1437Description1438~~~~~~~~~~~1439 1440.. attention:: Do **not** use in new drivers!1441             See: :ref:`legacy_dvb_decoder_notes`1442 1443This ioctl call asks the Video Device to display a still picture1444(I-frame). The input data shall be the section of an elementary video1445stream containing an I-frame. Typically this section is extracted from a1446TS or PES recording. Resolution and codec (see `video capabilities`_) must1447be supported by the device. If the pointer is NULL, then the current1448displayed still picture is blanked.1449 1450e.g. The AV7110 supports MPEG1 and MPEG2 with the common PAL-SD1451resolutions.1452 1453Return Value1454~~~~~~~~~~~~1455 1456On success 0 is returned, on error -1 and the ``errno`` variable is set1457appropriately. The generic error codes are described at the1458:ref:`Generic Error Codes <gen-errors>` chapter.1459 1460 1461-----1462 1463 1464VIDEO_FAST_FORWARD1465------------------1466 1467Synopsis1468~~~~~~~~1469 1470.. c:macro:: VIDEO_FAST_FORWARD1471 1472.. code-block:: c1473 1474	int ioctl(fd, int request = VIDEO_FAST_FORWARD, int nFrames)1475 1476Arguments1477~~~~~~~~~1478 1479.. flat-table::1480    :header-rows:  01481    :stub-columns: 01482 1483    -  ..1484 1485       -  ``int fd``1486 1487       -  :cspan:`1` File descriptor returned by a previous call1488          to `open()`_.1489 1490    -  ..1491 1492       -  ``int request``1493 1494       -  Equals ``VIDEO_FAST_FORWARD`` for this command.1495 1496    -  ..1497 1498       -  ``int nFrames``1499 1500       -  The number of frames to skip.1501 1502Description1503~~~~~~~~~~~1504 1505.. attention:: Do **not** use in new drivers!1506             See: :ref:`legacy_dvb_decoder_notes`1507 1508This ioctl call asks the Video Device to skip decoding of N number of1509I-frames. This call can only be used if ``VIDEO_SOURCE_MEMORY`` is1510selected.1511 1512Return Value1513~~~~~~~~~~~~1514 1515On success 0 is returned, on error -1 and the ``errno`` variable is set1516appropriately. The generic error codes are described at the1517:ref:`Generic Error Codes <gen-errors>` chapter.1518 1519.. flat-table::1520    :header-rows:  01521    :stub-columns: 01522 1523    -  ..1524 1525       -  ``EPERM``1526 1527       -  Mode ``VIDEO_SOURCE_MEMORY`` not selected.1528 1529 1530-----1531 1532 1533VIDEO_SLOWMOTION1534----------------1535 1536Synopsis1537~~~~~~~~1538 1539.. c:macro:: VIDEO_SLOWMOTION1540 1541.. code-block:: c1542 1543	int ioctl(fd, int request = VIDEO_SLOWMOTION, int nFrames)1544 1545Arguments1546~~~~~~~~~1547 1548.. flat-table::1549    :header-rows:  01550    :stub-columns: 01551 1552    -  ..1553 1554       -  ``int fd``1555 1556       -  :cspan:`1` File descriptor returned by a previous call1557          to `open()`_.1558 1559    -  ..1560 1561       -  ``int request``1562 1563       -  Equals ``VIDEO_SLOWMOTION`` for this command.1564 1565    -  ..1566 1567       -  ``int nFrames``1568 1569       -  The number of times to repeat each frame.1570 1571Description1572~~~~~~~~~~~1573 1574.. attention:: Do **not** use in new drivers!1575             See: :ref:`legacy_dvb_decoder_notes`1576 1577This ioctl call asks the video device to repeat decoding frames N number1578of times. This call can only be used if ``VIDEO_SOURCE_MEMORY`` is1579selected.1580 1581Return Value1582~~~~~~~~~~~~1583 1584On success 0 is returned, on error -1 and the ``errno`` variable is set1585appropriately. The generic error codes are described at the1586:ref:`Generic Error Codes <gen-errors>` chapter.1587 1588.. flat-table::1589    :header-rows:  01590    :stub-columns: 01591 1592    -  ..1593 1594       -  ``EPERM``1595 1596       -  Mode ``VIDEO_SOURCE_MEMORY`` not selected.1597 1598 1599-----1600 1601 1602VIDEO_GET_CAPABILITIES1603----------------------1604 1605Synopsis1606~~~~~~~~1607 1608.. c:macro:: VIDEO_GET_CAPABILITIES1609 1610.. code-block:: c1611 1612	int ioctl(fd, int request = VIDEO_GET_CAPABILITIES, unsigned int *cap)1613 1614Arguments1615~~~~~~~~~1616 1617.. flat-table::1618    :header-rows:  01619    :stub-columns: 01620 1621    -  ..1622 1623       -  ``int fd``1624 1625       -  :cspan:`1` File descriptor returned by a previous call1626          to `open()`_.1627 1628    -  ..1629 1630       -  ``int request``1631 1632       -  Equals ``VIDEO_GET_CAPABILITIES`` for this command.1633 1634    -  ..1635 1636       -  ``unsigned int *cap``1637 1638       -  Pointer to a location where to store the capability information.1639 1640Description1641~~~~~~~~~~~1642 1643.. attention:: Do **not** use in new drivers!1644             See: :ref:`legacy_dvb_decoder_notes`1645 1646This ioctl call asks the video device about its decoding capabilities.1647On success it returns an integer which has bits set according to the1648defines in `video capabilities`_.1649 1650Return Value1651~~~~~~~~~~~~1652 1653On success 0 is returned, on error -1 and the ``errno`` variable is set1654appropriately. The generic error codes are described at the1655:ref:`Generic Error Codes <gen-errors>` chapter.1656 1657 1658-----1659 1660 1661VIDEO_CLEAR_BUFFER1662------------------1663 1664Synopsis1665~~~~~~~~1666 1667.. c:macro:: VIDEO_CLEAR_BUFFER1668 1669.. code-block:: c1670 1671	int ioctl(fd, int request = VIDEO_CLEAR_BUFFER)1672 1673Arguments1674~~~~~~~~~1675 1676.. flat-table::1677    :header-rows:  01678    :stub-columns: 01679 1680    -  ..1681 1682       -  ``int fd``1683 1684       -  :cspan:`1` File descriptor returned by a previous call1685          to `open()`_.1686 1687    -  ..1688 1689       -  ``int request``1690 1691       -  Equals ``VIDEO_CLEAR_BUFFER`` for this command.1692 1693Description1694~~~~~~~~~~~1695 1696.. attention:: Do **not** use in new drivers!1697             See: :ref:`legacy_dvb_decoder_notes`1698 1699This ioctl call clears all video buffers in the driver and in the1700decoder hardware.1701 1702Return Value1703~~~~~~~~~~~~1704 1705On success 0 is returned, on error -1 and the ``errno`` variable is set1706appropriately. The generic error codes are described at the1707:ref:`Generic Error Codes <gen-errors>` chapter.1708 1709 1710-----1711 1712 1713VIDEO_SET_STREAMTYPE1714--------------------1715 1716Synopsis1717~~~~~~~~1718 1719.. c:macro:: VIDEO_SET_STREAMTYPE1720 1721.. code-block:: c1722 1723	int ioctl(fd, int request = VIDEO_SET_STREAMTYPE, int type)1724 1725Arguments1726~~~~~~~~~1727 1728.. flat-table::1729    :header-rows:  01730    :stub-columns: 01731 1732    -  ..1733 1734       -  ``int fd``1735 1736       -  :cspan:`1` File descriptor returned by a previous call1737          to `open()`_.1738 1739    -  ..1740 1741       -  ``int request``1742 1743       -  Equals ``VIDEO_SET_STREAMTYPE`` for this command.1744 1745    -  ..1746 1747       -  ``int type``1748 1749       -  Stream type.1750 1751Description1752~~~~~~~~~~~1753 1754.. attention:: Do **not** use in new drivers!1755             See: :ref:`legacy_dvb_decoder_notes`1756 1757This ioctl tells the driver which kind of stream to expect being written1758to it.1759Intelligent decoder might also not support or ignore (like the AV7110)1760this call and determine the stream type themselves.1761 1762Currently used stream types:1763 1764.. flat-table::1765    :header-rows:  11766    :stub-columns: 01767 1768    -  ..1769 1770       -  Codec1771 1772       -  Stream type1773 1774    -  ..1775 1776       -  MPEG21777 1778       -  01779 1780    -  ..1781 1782       -  MPEG4 h.2641783 1784       -  11785 1786    -  ..1787 1788       -  VC11789 1790       -  31791 1792    -  ..1793 1794       -  MPEG4 Part21795 1796       -  41797 1798    -  ..1799 1800       -  VC1 SM1801 1802       -  51803 1804    -  ..1805 1806       -  MPEG11807 1808       -  61809 1810    -  ..1811 1812       -  HEVC h.2651813 1814       -  | 71815          | DREAMBOX: 221816 1817    -  ..1818 1819       -  AVS1820 1821       -  161822 1823    -  ..1824 1825       -  AVS21826 1827       -  401828 1829Not every decoder supports all stream types.1830 1831Return Value1832~~~~~~~~~~~~1833 1834On success 0 is returned, on error -1 and the ``errno`` variable is set1835appropriately. The generic error codes are described at the1836:ref:`Generic Error Codes <gen-errors>` chapter.1837 1838 1839-----1840 1841 1842VIDEO_SET_FORMAT1843----------------1844 1845Synopsis1846~~~~~~~~1847 1848.. c:macro:: VIDEO_SET_FORMAT1849 1850.. code-block:: c1851 1852	int ioctl(fd, int request = VIDEO_SET_FORMAT, video_format_t format)1853 1854Arguments1855~~~~~~~~~1856 1857.. flat-table::1858    :header-rows:  01859    :stub-columns: 01860 1861    -  ..1862 1863       -  ``int fd``1864 1865       -  :cspan:`1` File descriptor returned by a previous call1866          to `open()`_.1867 1868    -  ..1869 1870       -  ``int request``1871 1872       -  Equals ``VIDEO_SET_FORMAT`` for this command.1873 1874    -  ..1875 1876       -  `video_format_t`_ ``format``1877 1878       -  Video format of TV as defined in section `video_format_t`_.1879 1880Description1881~~~~~~~~~~~1882 1883.. attention:: Do **not** use in new drivers!1884             See: :ref:`legacy_dvb_decoder_notes`1885 1886This ioctl sets the screen format (aspect ratio) of the connected output1887device (TV) so that the output of the decoder can be adjusted1888accordingly.1889 1890Return Value1891~~~~~~~~~~~~1892 1893On success 0 is returned, on error -1 and the ``errno`` variable is set1894appropriately. The generic error codes are described at the1895:ref:`Generic Error Codes <gen-errors>` chapter.1896 1897 1898-----1899 1900 1901VIDEO_GET_SIZE1902--------------1903 1904Synopsis1905~~~~~~~~1906 1907.. c:macro:: VIDEO_GET_SIZE1908 1909.. code-block:: c1910 1911	int ioctl(int fd, int request = VIDEO_GET_SIZE, video_size_t *size)1912 1913Arguments1914~~~~~~~~~1915 1916.. flat-table::1917    :header-rows:  01918    :stub-columns: 01919 1920    -  ..1921 1922       -  ``int fd``1923 1924       -  :cspan:`1` File descriptor returned by a previous call,1925          to `open()`_.1926 1927    -  ..1928 1929       -  ``int request``1930 1931       -  Equals ``VIDEO_GET_SIZE`` for this command.1932 1933    -  ..1934 1935       -  `video_size_t`_ ``*size``1936 1937       -  Returns the size and aspect ratio.1938 1939Description1940~~~~~~~~~~~1941 1942.. attention:: Do **not** use in new drivers!1943             See: :ref:`legacy_dvb_decoder_notes`1944 1945This ioctl returns the size and aspect ratio.1946 1947Return Value1948~~~~~~~~~~~~1949 1950On success 0 is returned, on error -1 and the ``errno`` variable is set1951appropriately. The generic error codes are described at the1952:ref:`Generic Error Codes <gen-errors>` chapter.1953 1954 1955-----1956 1957 1958VIDEO_GET_PTS1959-------------1960 1961Synopsis1962~~~~~~~~1963 1964.. c:macro:: VIDEO_GET_PTS1965 1966.. code-block:: c1967 1968	int ioctl(int fd, int request = VIDEO_GET_PTS, __u64 *pts)1969 1970Arguments1971~~~~~~~~~1972 1973.. flat-table::1974    :header-rows:  01975    :stub-columns: 01976 1977    -  ..1978 1979       -  ``int fd``1980 1981       -  :cspan:`1` File descriptor returned by a previous call1982          to `open()`_.1983 1984    -  ..1985 1986       -  ``int request``1987 1988       -  Equals ``VIDEO_GET_PTS`` for this command.1989 1990    -  ..1991 1992       -  ``__u64 *pts``1993 1994       -  Returns the 33-bit timestamp as defined in ITU T-REC-H.222.0 /1995          ISO/IEC 13818-1.1996 1997          The PTS should belong to the currently played frame if possible,1998          but may also be a value close to it like the PTS of the last1999          decoded frame or the last PTS extracted by the PES parser.2000 2001Description2002~~~~~~~~~~~2003 2004.. attention:: Do **not** use in new drivers!2005             See: :ref:`legacy_dvb_decoder_notes`2006 2007For V4L2 decoders this ioctl has been replaced by the2008``V4L2_CID_MPEG_VIDEO_DEC_PTS`` control.2009 2010This ioctl call asks the Video Device to return the current PTS2011timestamp.2012 2013Return Value2014~~~~~~~~~~~~2015 2016On success 0 is returned, on error -1 and the ``errno`` variable is set2017appropriately. The generic error codes are described at the2018:ref:`Generic Error Codes <gen-errors>` chapter.2019 2020 2021-----2022 2023 2024VIDEO_GET_FRAME_COUNT2025---------------------2026 2027Synopsis2028~~~~~~~~2029 2030.. c:macro:: VIDEO_GET_FRAME_COUNT2031 2032.. code-block:: c2033 2034	int ioctl(int fd, VIDEO_GET_FRAME_COUNT, __u64 *pts)2035 2036Arguments2037~~~~~~~~~2038 2039.. flat-table::2040    :header-rows:  02041    :stub-columns: 02042 2043    -  ..2044 2045       -  ``int fd``2046 2047       -  :cspan:`1` File descriptor returned by a previous call2048          to `open()`_.2049 2050    -  ..2051 2052       -  ``int request``2053 2054       -  Equals ``VIDEO_GET_FRAME_COUNT`` for this command.2055 2056    -  ..2057 2058       -  ``__u64 *pts``2059 2060       -  Returns the number of frames displayed since the decoder was2061          started.2062 2063Description2064~~~~~~~~~~~2065 2066.. attention:: Do **not** use in new drivers!2067             See: :ref:`legacy_dvb_decoder_notes`2068 2069For V4L2 decoders this ioctl has been replaced by the2070``V4L2_CID_MPEG_VIDEO_DEC_FRAME`` control.2071 2072This ioctl call asks the Video Device to return the number of displayed2073frames since the decoder was started.2074 2075Return Value2076~~~~~~~~~~~~2077 2078On success 0 is returned, on error -1 and the ``errno`` variable is set2079appropriately. The generic error codes are described at the2080:ref:`Generic Error Codes <gen-errors>` chapter.2081 2082 2083-----2084 2085 2086VIDEO_COMMAND2087-------------2088 2089Synopsis2090~~~~~~~~2091 2092.. c:macro:: VIDEO_COMMAND2093 2094.. code-block:: c2095 2096	int ioctl(int fd, int request = VIDEO_COMMAND,2097	struct video_command *cmd)2098 2099Arguments2100~~~~~~~~~2101 2102.. flat-table::2103    :header-rows:  02104    :stub-columns: 02105 2106    -  ..2107 2108       -  ``int fd``2109 2110       -  :cspan:`1` File descriptor returned by a previous call2111          to `open()`_.2112 2113    -  ..2114 2115       -  ``int request``2116 2117       -  Equals ``VIDEO_COMMAND`` for this command.2118 2119    -  ..2120 2121       -  `struct video_command`_ ``*cmd``2122 2123       -  Commands the decoder.2124 2125Description2126~~~~~~~~~~~2127 2128.. attention:: Do **not** use in new drivers!2129             See: :ref:`legacy_dvb_decoder_notes`2130 2131For V4L2 decoders this ioctl has been replaced by the2132:ref:`VIDIOC_DECODER_CMD` ioctl.2133 2134This ioctl commands the decoder. The `struct video_command`_ is a2135subset of the ``v4l2_decoder_cmd`` struct, so refer to the2136:ref:`VIDIOC_DECODER_CMD` documentation for2137more information.2138 2139Return Value2140~~~~~~~~~~~~2141 2142On success 0 is returned, on error -1 and the ``errno`` variable is set2143appropriately. The generic error codes are described at the2144:ref:`Generic Error Codes <gen-errors>` chapter.2145 2146 2147-----2148 2149 2150VIDEO_TRY_COMMAND2151-----------------2152 2153Synopsis2154~~~~~~~~2155 2156.. c:macro:: VIDEO_TRY_COMMAND2157 2158.. code-block:: c2159 2160	int ioctl(int fd, int request = VIDEO_TRY_COMMAND,2161	struct video_command *cmd)2162 2163Arguments2164~~~~~~~~~2165 2166.. flat-table::2167    :header-rows:  02168    :stub-columns: 02169 2170    -  ..2171 2172       -  ``int fd``2173 2174       -  :cspan:`1` File descriptor returned by a previous call2175          to `open()`_.2176 2177    -  ..2178 2179       -  ``int request``2180 2181       -  Equals ``VIDEO_TRY_COMMAND`` for this command.2182 2183    -  ..2184 2185       -  `struct video_command`_ ``*cmd``2186 2187       -  Try a decoder command.2188 2189Description2190~~~~~~~~~~~2191 2192.. attention:: Do **not** use in new drivers!2193             See: :ref:`legacy_dvb_decoder_notes`2194 2195For V4L2 decoders this ioctl has been replaced by the2196:ref:`VIDIOC_TRY_DECODER_CMD <VIDIOC_DECODER_CMD>` ioctl.2197 2198This ioctl tries a decoder command. The `struct video_command`_ is a2199subset of the ``v4l2_decoder_cmd`` struct, so refer to the2200:ref:`VIDIOC_TRY_DECODER_CMD <VIDIOC_DECODER_CMD>` documentation2201for more information.2202 2203Return Value2204~~~~~~~~~~~~2205 2206On success 0 is returned, on error -1 and the ``errno`` variable is set2207appropriately. The generic error codes are described at the2208:ref:`Generic Error Codes <gen-errors>` chapter.2209 2210 2211-----2212 2213 2214open()2215------2216 2217Synopsis2218~~~~~~~~2219 2220.. code-block:: c2221 2222    #include <fcntl.h>2223 2224.. c:function:: 	int open(const char *deviceName, int flags)2225 2226Arguments2227~~~~~~~~~2228 2229.. flat-table::2230    :header-rows:  02231    :stub-columns: 02232 2233    -  ..2234 2235       -  ``const char *deviceName``2236 2237       -  Name of specific video device.2238 2239    -  ..2240 2241       -  :rspan:`3` ``int flags``2242 2243       -  :cspan:`1` A bit-wise OR of the following flags:2244 2245    -  ..2246 2247       -  ``O_RDONLY``2248 2249       -  read-only access2250 2251    -  ..2252 2253       -  ``O_RDWR``2254 2255       -  read/write access2256 2257    -  ..2258 2259       -  ``O_NONBLOCK``2260       -  | Open in non-blocking mode2261          | (blocking mode is the default)2262 2263Description2264~~~~~~~~~~~2265 2266This system call opens a named video device (e.g.2267/dev/dvb/adapter?/video?) for subsequent use.2268 2269When an open() call has succeeded, the device will be ready for use. The2270significance of blocking or non-blocking mode is described in the2271documentation for functions where there is a difference. It does not2272affect the semantics of the open() call itself. A device opened in2273blocking mode can later be put into non-blocking mode (and vice versa)2274using the F_SETFL command of the fcntl system call. This is a standard2275system call, documented in the Linux manual page for fcntl. Only one2276user can open the Video Device in O_RDWR mode. All other attempts to2277open the device in this mode will fail, and an error-code will be2278returned. If the Video Device is opened in O_RDONLY mode, the only2279ioctl call that can be used is `VIDEO_GET_STATUS`_. All other call will2280return an error code.2281 2282Return Value2283~~~~~~~~~~~~2284 2285.. flat-table::2286    :header-rows:  02287    :stub-columns: 02288 2289    -  ..2290 2291       -  ``ENODEV``2292 2293       -  :cspan:`1` Device driver not loaded/available.2294 2295    -  ..2296 2297       -  ``EINTERNAL``2298 2299       -  Internal error.2300 2301    -  ..2302 2303       -  ``EBUSY``2304 2305       -  Device or resource busy.2306 2307    -  ..2308 2309       -  ``EINVAL``2310 2311       -  Invalid argument.2312 2313 2314-----2315 2316 2317close()2318-------2319 2320Synopsis2321~~~~~~~~2322 2323.. c:function:: 	int close(int fd)2324 2325Arguments2326~~~~~~~~~2327 2328.. flat-table::2329    :header-rows:  02330    :stub-columns: 02331 2332    -  ..2333 2334       -  ``int fd``2335 2336       -  :cspan:`1` File descriptor returned by a previous call2337          to `open()`_.2338 2339Description2340~~~~~~~~~~~2341 2342This system call closes a previously opened video device.2343 2344Return Value2345~~~~~~~~~~~~2346 2347.. flat-table::2348    :header-rows:  02349    :stub-columns: 02350 2351    -  ..2352 2353       -  ``EBADF``2354 2355       -  fd is not a valid open file descriptor.2356 2357 2358-----2359 2360 2361write()2362-------2363 2364Synopsis2365~~~~~~~~2366 2367.. c:function:: size_t write(int fd, const void *buf, size_t count)2368 2369Arguments2370~~~~~~~~~2371 2372.. flat-table::2373    :header-rows:  02374    :stub-columns: 02375 2376    -  ..2377 2378       -  ``int fd``2379 2380       -  :cspan:`1` File descriptor returned by a previous call2381          to `open()`_.2382 2383    -  ..2384 2385       -  ``void *buf``2386 2387       -  Pointer to the buffer containing the PES data.2388 2389    -  ..2390 2391       -  ``size_t count``2392 2393       -  Size of buf.2394 2395Description2396~~~~~~~~~~~2397 2398This system call can only be used if VIDEO_SOURCE_MEMORY is selected2399in the ioctl call `VIDEO_SELECT_SOURCE`_. The data provided shall be in2400PES format, unless the capability allows other formats. TS is the2401most common format for storing DVB-data, it is usually supported too.2402If O_NONBLOCK is not specified the function will block until buffer space2403is available. The amount of data to be transferred is implied by count.2404 2405.. note:: See: :ref:`DVB Data Formats <legacy_dvb_decoder_formats>`2406 2407Return Value2408~~~~~~~~~~~~2409 2410.. flat-table::2411    :header-rows:  02412    :stub-columns: 02413 2414    -  ..2415 2416       -  ``EPERM``2417 2418       -  :cspan:`1` Mode ``VIDEO_SOURCE_MEMORY`` not selected.2419 2420    -  ..2421 2422       -  ``ENOMEM``2423 2424       -  Attempted to write more data than the internal buffer can hold.2425 2426    -  ..2427 2428       -  ``EBADF``2429 2430       -  fd is not a valid open file descriptor.2431