1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later OR GPL-2.0 2 3.. c:namespace:: dtv.legacy.video 4 5.. _dvb_video: 6 7================ 8DVB Video Device 9================ 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 DVB 15hardware. It can be accessed through ``/dev/dvb/adapter0/video0``. Data 16types and ioctl definitions can be accessed by including 17``linux/dvb/video.h`` in your application. 18 19Note that the DVB video device only controls decoding of the MPEG video 20stream, not its presentation on the TV or computer screen. On PCs this 21is 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 the 25omission of the audio and video device as well as the video4linux 26device. 27 28These ioctls were also used by V4L2 to control MPEG decoders implemented 29in V4L2. The use of these ioctls for that purpose has been made obsolete 30and proper V4L2 ioctls or controls have been created to replace that 31functionality. Use :ref:`V4L2 ioctls<video>` for new drivers! 32 33 34Video Data Types 35================ 36 37 38 39video_format_t 40-------------- 41 42Synopsis 43~~~~~~~~ 44 45.. code-block:: c 46 47 typedef enum { 48 VIDEO_FORMAT_4_3, 49 VIDEO_FORMAT_16_9, 50 VIDEO_FORMAT_221_1 51 } video_format_t; 52 53Constants 54~~~~~~~~~ 55 56.. flat-table:: 57 :header-rows: 0 58 :stub-columns: 0 59 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 78Description 79~~~~~~~~~~~ 80 81The ``video_format_t`` data type 82is used in the `VIDEO_SET_FORMAT`_ function to tell the driver which 83aspect ratio the output hardware (e.g. TV) has. It is also used in the 84data structures `video_status`_ returned by `VIDEO_GET_STATUS`_ 85and `video_event`_ returned by `VIDEO_GET_EVENT`_ which report 86about the display format of the current video stream. 87 88 89----- 90 91 92video_displayformat_t 93--------------------- 94 95Synopsis 96~~~~~~~~ 97 98.. code-block:: c 99 100 typedef enum { 101 VIDEO_PAN_SCAN, 102 VIDEO_LETTER_BOX, 103 VIDEO_CENTER_CUT_OUT 104 } video_displayformat_t; 105 106Constants 107~~~~~~~~~ 108 109.. flat-table:: 110 :header-rows: 0 111 :stub-columns: 0 112 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 131Description 132~~~~~~~~~~~ 133 134In case the display format of the video stream and of the display 135hardware differ the application has to specify how to handle the 136cropping of the picture. This can be done using the 137`VIDEO_SET_DISPLAY_FORMAT`_ call which accepts this enum as argument. 138 139 140----- 141 142 143video_size_t 144------------ 145 146Synopsis 147~~~~~~~~ 148 149.. code-block:: c 150 151 typedef struct { 152 int w; 153 int h; 154 video_format_t aspect_ratio; 155 } video_size_t; 156 157Variables 158~~~~~~~~~ 159 160.. flat-table:: 161 :header-rows: 0 162 :stub-columns: 0 163 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 182Description 183~~~~~~~~~~~ 184 185Used in the struct `video_event`_. It stores the resolution and 186aspect ratio of the video. 187 188 189----- 190 191 192video_stream_source_t 193--------------------- 194 195Synopsis 196~~~~~~~~ 197 198.. code-block:: c 199 200 typedef enum { 201 VIDEO_SOURCE_DEMUX, 202 VIDEO_SOURCE_MEMORY 203 } video_stream_source_t; 204 205Constants 206~~~~~~~~~ 207 208.. flat-table:: 209 :header-rows: 0 210 :stub-columns: 0 211 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 stream 223 comes from the user through the write 224 system call. 225 226Description 227~~~~~~~~~~~ 228 229The video stream source is set through the `VIDEO_SELECT_SOURCE`_ call 230and can take the following values, depending on whether we are replaying 231from an internal (demuxer) or external (user write) source. 232VIDEO_SOURCE_DEMUX selects the demultiplexer (fed either by the 233frontend or the DVR device) as the source of the video stream. If 234VIDEO_SOURCE_MEMORY is selected the stream comes from the application 235through the `write()`_ system call. 236 237 238----- 239 240 241video_play_state_t 242------------------ 243 244Synopsis 245~~~~~~~~ 246 247.. code-block:: c 248 249 typedef enum { 250 VIDEO_STOPPED, 251 VIDEO_PLAYING, 252 VIDEO_FREEZED 253 } video_play_state_t; 254 255Constants 256~~~~~~~~~ 257 258.. flat-table:: 259 :header-rows: 0 260 :stub-columns: 0 261 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 280Description 281~~~~~~~~~~~ 282 283This values can be returned by the `VIDEO_GET_STATUS`_ call 284representing the state of video playback. 285 286 287----- 288 289 290struct video_command 291-------------------- 292 293Synopsis 294~~~~~~~~ 295 296.. code-block:: c 297 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 318Variables 319~~~~~~~~~ 320 321.. flat-table:: 322 :header-rows: 0 323 :stub-columns: 0 324 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 PTS 344 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 speed 364 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 - Reserved 380 381Description 382~~~~~~~~~~~ 383 384The structure must be zeroed before use by the application. This ensures 385it can be extended safely in the future. 386 387 388----- 389 390 391Predefined decoder commands and flags 392------------------------------------- 393 394Synopsis 395~~~~~~~~ 396 397.. code-block:: c 398 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 417Constants 418~~~~~~~~~ 419 420.. flat-table:: 421 :header-rows: 0 422 :stub-columns: 0 423 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 requirements 479 480 - .. 481 482 - ``VIDEO_PLAY_FMT_GOP`` 483 484 - The decoder requires full GOPs 485 486 - .. 487 488 - :rspan:`3` Field order 489 490 - ``VIDEO_VSYNC_FIELD_UNKNOWN`` 491 492 - FIELD_UNKNOWN can be used if the hardware does not know 493 whether the Vsync is for an odd, even or progressive 494 (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_event 519----------- 520 521Synopsis 522~~~~~~~~ 523 524.. code-block:: c 525 526 struct video_event { 527 __s32 type; 528 #define VIDEO_EVENT_SIZE_CHANGED 1 529 #define VIDEO_EVENT_FRAME_RATE_CHANGED 2 530 #define VIDEO_EVENT_DECODER_STOPPED 3 531 #define VIDEO_EVENT_VSYNC 4 532 long timestamp; 533 union { 534 video_size_t size; 535 unsigned int frame_rate; 536 unsigned char vsync_field; 537 } u; 538 }; 539 540Variables 541~~~~~~~~~ 542 543.. flat-table:: 544 :header-rows: 0 545 :stub-columns: 0 546 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`_ size 588 589 - Resolution and aspect ratio of the video. 590 591 - .. 592 593 - ``unsigned int frame_rate`` 594 595 - in frames per 1000sec 596 597 - .. 598 599 - ``unsigned char vsync_field`` 600 601 - | unknown / odd / even / progressive 602 | See: `Predefined decoder commands and flags`_ 603 604Description 605~~~~~~~~~~~ 606 607This is the structure of a video event as it is returned by the 608`VIDEO_GET_EVENT`_ call. See there for more details. 609 610 611----- 612 613 614video_status 615------------ 616 617Synopsis 618~~~~~~~~ 619 620The `VIDEO_GET_STATUS`_ call returns the following structure informing 621about various states of the playback operation. 622 623.. code-block:: c 624 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 633Variables 634~~~~~~~~~ 635 636.. flat-table:: 637 :header-rows: 0 638 :stub-columns: 0 639 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 682Description 683~~~~~~~~~~~ 684 685If ``video_blank`` is set ``TRUE`` video will be blanked out if the 686channel is changed or if playback is stopped. Otherwise, the last picture 687will be displayed. ``play_state`` indicates if the video is currently 688frozen, stopped, or being played back. The ``stream_source`` corresponds 689to the selected source for the video stream. It can come either from the 690demultiplexer or from memory. The ``video_format`` indicates the aspect 691ratio (one of 4:3 or 16:9) of the currently played video stream. 692Finally, ``display_format`` corresponds to the applied cropping mode in 693case the source video format is not the same as the format of the output 694device. 695 696 697----- 698 699 700video_still_picture 701------------------- 702 703Synopsis 704~~~~~~~~ 705 706.. code-block:: c 707 708 struct video_still_picture { 709 char *iFrame; 710 int32_t size; 711 }; 712 713Variables 714~~~~~~~~~ 715 716.. flat-table:: 717 :header-rows: 0 718 :stub-columns: 0 719 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 733Description 734~~~~~~~~~~~ 735 736An I-frame displayed via the `VIDEO_STILLPICTURE`_ call is passed on 737within this structure. 738 739 740----- 741 742 743video capabilities 744------------------ 745 746Synopsis 747~~~~~~~~ 748 749.. code-block:: c 750 751 #define VIDEO_CAP_MPEG1 1 752 #define VIDEO_CAP_MPEG2 2 753 #define VIDEO_CAP_SYS 4 754 #define VIDEO_CAP_PROG 8 755 756Constants 757~~~~~~~~~ 758Bit definitions for capabilities: 759 760.. flat-table:: 761 :header-rows: 0 762 :stub-columns: 0 763 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 device 783 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 device 792 but only send the stream to the video device. 793 794Description 795~~~~~~~~~~~ 796 797A call to `VIDEO_GET_CAPABILITIES`_ returns an unsigned integer with the 798following bits set according to the hardware's capabilities. 799 800 801----- 802 803 804Video Function Calls 805==================== 806 807 808VIDEO_STOP 809---------- 810 811Synopsis 812~~~~~~~~ 813 814.. c:macro:: VIDEO_STOP 815 816.. code-block:: c 817 818 int ioctl(fd, VIDEO_STOP, int mode) 819 820Arguments 821~~~~~~~~~ 822 823.. flat-table:: 824 :header-rows: 0 825 :stub-columns: 0 826 827 - .. 828 829 - ``int fd`` 830 831 - :cspan:`1` File descriptor returned by a previous call 832 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 858Description 859~~~~~~~~~~~ 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 use 865the V4L2 :ref:`VIDIOC_DECODER_CMD` instead. 866 867This ioctl call asks the Video Device to stop playing the current 868stream. Depending on the input parameter, the screen can be blanked out 869or displaying the last decoded frame. 870 871Return Value 872~~~~~~~~~~~~ 873 874On success 0 is returned, on error -1 and the ``errno`` variable is set 875appropriately. The generic error codes are described at the 876:ref:`Generic Error Codes <gen-errors>` chapter. 877 878 879----- 880 881 882VIDEO_PLAY 883---------- 884 885Synopsis 886~~~~~~~~ 887 888.. c:macro:: VIDEO_PLAY 889 890.. code-block:: c 891 892 int ioctl(fd, VIDEO_PLAY) 893 894Arguments 895~~~~~~~~~ 896 897.. flat-table:: 898 :header-rows: 0 899 :stub-columns: 0 900 901 - .. 902 903 - ``int fd`` 904 905 - :cspan:`1` File descriptor returned by a previous call 906 to `open()`_. 907 908 - .. 909 910 - ``int request`` 911 912 - Equals ``VIDEO_PLAY`` for this command. 913 914Description 915~~~~~~~~~~~ 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 use 921the V4L2 :ref:`VIDIOC_DECODER_CMD` instead. 922 923This ioctl call asks the Video Device to start playing a video stream 924from the selected source. 925 926Return Value 927~~~~~~~~~~~~ 928 929On success 0 is returned, on error -1 and the ``errno`` variable is set 930appropriately. The generic error codes are described at the 931:ref:`Generic Error Codes <gen-errors>` chapter. 932 933 934----- 935 936 937VIDEO_FREEZE 938------------ 939 940Synopsis 941~~~~~~~~ 942 943.. c:macro:: VIDEO_FREEZE 944 945.. code-block:: c 946 947 int ioctl(fd, VIDEO_FREEZE) 948 949Arguments 950~~~~~~~~~ 951 952.. flat-table:: 953 :header-rows: 0 954 :stub-columns: 0 955 956 - .. 957 958 - ``int fd`` 959 960 - :cspan:`1` File descriptor returned by a previous call 961 to `open()`_. 962 963 - .. 964 965 - ``int request`` 966 967 - Equals ``VIDEO_FREEZE`` for this command. 968 969Description 970~~~~~~~~~~~ 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 use 976the V4L2 :ref:`VIDIOC_DECODER_CMD` instead. 977 978This ioctl call suspends the live video stream being played, if 979VIDEO_SOURCE_DEMUX is selected. Decoding and playing are frozen. 980It is then possible to restart the decoding and playing process of the 981video stream using the `VIDEO_CONTINUE`_ command. 982If VIDEO_SOURCE_MEMORY is selected in the ioctl call 983`VIDEO_SELECT_SOURCE`_, the Digital TV subsystem will not decode any more 984data until the ioctl call `VIDEO_CONTINUE`_ or `VIDEO_PLAY`_ is performed. 985 986Return Value 987~~~~~~~~~~~~ 988 989On success 0 is returned, on error -1 and the ``errno`` variable is set 990appropriately. The generic error codes are described at the 991:ref:`Generic Error Codes <gen-errors>` chapter. 992 993 994----- 995 996 997VIDEO_CONTINUE 998-------------- 999 1000Synopsis 1001~~~~~~~~ 1002 1003.. c:macro:: VIDEO_CONTINUE 1004 1005.. code-block:: c 1006 1007 int ioctl(fd, VIDEO_CONTINUE) 1008 1009Arguments 1010~~~~~~~~~ 1011 1012.. flat-table:: 1013 :header-rows: 0 1014 :stub-columns: 0 1015 1016 - .. 1017 1018 - ``int fd`` 1019 1020 - :cspan:`1` File descriptor returned by a previous call 1021 to `open()`_. 1022 1023 - .. 1024 1025 - ``int request`` 1026 1027 - Equals ``VIDEO_CONTINUE`` for this command. 1028 1029Description 1030~~~~~~~~~~~ 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 use 1036the V4L2 :ref:`VIDIOC_DECODER_CMD` instead. 1037 1038This ioctl call restarts decoding and playing processes of the video 1039stream which was played before a call to `VIDEO_FREEZE`_ was made. 1040 1041Return Value 1042~~~~~~~~~~~~ 1043 1044On success 0 is returned, on error -1 and the ``errno`` variable is set 1045appropriately. The generic error codes are described at the 1046:ref:`Generic Error Codes <gen-errors>` chapter. 1047 1048 1049----- 1050 1051 1052VIDEO_SELECT_SOURCE 1053------------------- 1054 1055Synopsis 1056~~~~~~~~ 1057 1058.. c:macro:: VIDEO_SELECT_SOURCE 1059 1060.. code-block:: c 1061 1062 int ioctl(fd, VIDEO_SELECT_SOURCE, video_stream_source_t source) 1063 1064Arguments 1065~~~~~~~~~ 1066 1067.. flat-table:: 1068 :header-rows: 0 1069 :stub-columns: 0 1070 1071 - .. 1072 1073 - ``int fd`` 1074 1075 - :cspan:`1` File descriptor returned by a previous call 1076 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 1090Description 1091~~~~~~~~~~~ 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 supported 1097by the V4L2 ivtv driver, but that has been replaced by the ivtv-specific 1098``IVTV_IOC_PASSTHROUGH_MODE`` ioctl. 1099 1100This ioctl call informs the video device which source shall be used for 1101the input data. The possible sources are demux or memory. If memory is 1102selected, the data is fed to the video device through the write command 1103using the struct `video_stream_source_t`_. If demux is selected, the data 1104is 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 Value 1111~~~~~~~~~~~~ 1112 1113On success 0 is returned, on error -1 and the ``errno`` variable is set 1114appropriately. The generic error codes are described at the 1115:ref:`Generic Error Codes <gen-errors>` chapter. 1116 1117 1118----- 1119 1120 1121VIDEO_SET_BLANK 1122--------------- 1123 1124Synopsis 1125~~~~~~~~ 1126 1127.. c:macro:: VIDEO_SET_BLANK 1128 1129.. code-block:: c 1130 1131 int ioctl(fd, VIDEO_SET_BLANK, int mode) 1132 1133Arguments 1134~~~~~~~~~ 1135 1136.. flat-table:: 1137 :header-rows: 0 1138 :stub-columns: 0 1139 1140 - .. 1141 1142 - ``int fd`` 1143 1144 - :cspan:`1` File descriptor returned by a previous call 1145 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 1171Description 1172~~~~~~~~~~~ 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 Value 1180~~~~~~~~~~~~ 1181 1182On success 0 is returned, on error -1 and the ``errno`` variable is set 1183appropriately. The generic error codes are described at the 1184:ref:`Generic Error Codes <gen-errors>` chapter. 1185 1186 1187----- 1188 1189 1190VIDEO_GET_STATUS 1191---------------- 1192 1193Synopsis 1194~~~~~~~~ 1195 1196.. c:macro:: VIDEO_GET_STATUS 1197 1198.. code-block:: c 1199 1200 int ioctl(fd, int request = VIDEO_GET_STATUS, 1201 struct video_status *status) 1202 1203Arguments 1204~~~~~~~~~ 1205 1206.. flat-table:: 1207 :header-rows: 0 1208 :stub-columns: 0 1209 1210 - .. 1211 1212 - ``int fd`` 1213 1214 - :cspan:`1` File descriptor returned by a previous call 1215 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 1229Description 1230~~~~~~~~~~~ 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 of 1236the device. 1237 1238Return Value 1239~~~~~~~~~~~~ 1240 1241On success 0 is returned, on error -1 and the ``errno`` variable is set 1242appropriately. The generic error codes are described at the 1243:ref:`Generic Error Codes <gen-errors>` chapter. 1244 1245 1246----- 1247 1248 1249VIDEO_GET_EVENT 1250--------------- 1251 1252Synopsis 1253~~~~~~~~ 1254 1255.. c:macro:: VIDEO_GET_EVENT 1256 1257.. code-block:: c 1258 1259 int ioctl(fd, int request = VIDEO_GET_EVENT, 1260 struct video_event *ev) 1261 1262Arguments 1263~~~~~~~~~ 1264 1265.. flat-table:: 1266 :header-rows: 0 1267 :stub-columns: 0 1268 1269 - .. 1270 1271 - ``int fd`` 1272 1273 - :cspan:`1` File descriptor returned by a previous call 1274 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 1288Description 1289~~~~~~~~~~~ 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 decoder 1295use the V4L2 :ref:`VIDIOC_DQEVENT` ioctl instead. 1296 1297This ioctl call returns an event of type `video_event`_ if available. A 1298certain number of the latest events will be cued and returned in order of 1299occurrence. Older events may be discarded if not fetched in time. If 1300an event is not available, the behavior depends on whether the device is 1301in blocking or non-blocking mode. In the latter case, the call fails 1302immediately with errno set to ``EWOULDBLOCK``. In the former case, the 1303call blocks until an event becomes available. The standard Linux poll() 1304and/or select() system calls can be used with the device file descriptor 1305to watch for new events. For select(), the file descriptor should be 1306included in the exceptfds argument, and for poll(), POLLPRI should be 1307specified as the wake-up condition. Read-only permissions are sufficient 1308for this ioctl call. 1309 1310Return Value 1311~~~~~~~~~~~~ 1312 1313On success 0 is returned, on error -1 and the ``errno`` variable is set 1314appropriately. The generic error codes are described at the 1315:ref:`Generic Error Codes <gen-errors>` chapter. 1316 1317.. flat-table:: 1318 :header-rows: 0 1319 :stub-columns: 0 1320 1321 - .. 1322 1323 - ``EWOULDBLOCK`` 1324 1325 - :cspan:`1` There is no event pending, and the device is in 1326 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_FORMAT 1339------------------------ 1340 1341Synopsis 1342~~~~~~~~ 1343 1344.. c:macro:: VIDEO_SET_DISPLAY_FORMAT 1345 1346.. code-block:: c 1347 1348 int ioctl(fd, int request = VIDEO_SET_DISPLAY_FORMAT, 1349 video_display_format_t format) 1350 1351Arguments 1352~~~~~~~~~ 1353 1354.. flat-table:: 1355 :header-rows: 0 1356 :stub-columns: 0 1357 1358 - .. 1359 1360 - ``int fd`` 1361 1362 - :cspan:`1` File descriptor returned by a previous call 1363 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 1377Description 1378~~~~~~~~~~~ 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 be 1384applied by the MPEG chip on the video. 1385 1386Return Value 1387~~~~~~~~~~~~ 1388 1389On success 0 is returned, on error -1 and the ``errno`` variable is set 1390appropriately. The generic error codes are described at the 1391:ref:`Generic Error Codes <gen-errors>` chapter. 1392 1393 1394----- 1395 1396 1397VIDEO_STILLPICTURE 1398------------------ 1399 1400Synopsis 1401~~~~~~~~ 1402 1403.. c:macro:: VIDEO_STILLPICTURE 1404 1405.. code-block:: c 1406 1407 int ioctl(fd, int request = VIDEO_STILLPICTURE, 1408 struct video_still_picture *sp) 1409 1410Arguments 1411~~~~~~~~~ 1412 1413.. flat-table:: 1414 :header-rows: 0 1415 :stub-columns: 0 1416 1417 - .. 1418 1419 - ``int fd`` 1420 1421 - :cspan:`1` File descriptor returned by a previous call 1422 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-frame 1435 and size is stored. 1436 1437Description 1438~~~~~~~~~~~ 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 picture 1444(I-frame). The input data shall be the section of an elementary video 1445stream containing an I-frame. Typically this section is extracted from a 1446TS or PES recording. Resolution and codec (see `video capabilities`_) must 1447be supported by the device. If the pointer is NULL, then the current 1448displayed still picture is blanked. 1449 1450e.g. The AV7110 supports MPEG1 and MPEG2 with the common PAL-SD 1451resolutions. 1452 1453Return Value 1454~~~~~~~~~~~~ 1455 1456On success 0 is returned, on error -1 and the ``errno`` variable is set 1457appropriately. The generic error codes are described at the 1458:ref:`Generic Error Codes <gen-errors>` chapter. 1459 1460 1461----- 1462 1463 1464VIDEO_FAST_FORWARD 1465------------------ 1466 1467Synopsis 1468~~~~~~~~ 1469 1470.. c:macro:: VIDEO_FAST_FORWARD 1471 1472.. code-block:: c 1473 1474 int ioctl(fd, int request = VIDEO_FAST_FORWARD, int nFrames) 1475 1476Arguments 1477~~~~~~~~~ 1478 1479.. flat-table:: 1480 :header-rows: 0 1481 :stub-columns: 0 1482 1483 - .. 1484 1485 - ``int fd`` 1486 1487 - :cspan:`1` File descriptor returned by a previous call 1488 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 1502Description 1503~~~~~~~~~~~ 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 of 1509I-frames. This call can only be used if ``VIDEO_SOURCE_MEMORY`` is 1510selected. 1511 1512Return Value 1513~~~~~~~~~~~~ 1514 1515On success 0 is returned, on error -1 and the ``errno`` variable is set 1516appropriately. The generic error codes are described at the 1517:ref:`Generic Error Codes <gen-errors>` chapter. 1518 1519.. flat-table:: 1520 :header-rows: 0 1521 :stub-columns: 0 1522 1523 - .. 1524 1525 - ``EPERM`` 1526 1527 - Mode ``VIDEO_SOURCE_MEMORY`` not selected. 1528 1529 1530----- 1531 1532 1533VIDEO_SLOWMOTION 1534---------------- 1535 1536Synopsis 1537~~~~~~~~ 1538 1539.. c:macro:: VIDEO_SLOWMOTION 1540 1541.. code-block:: c 1542 1543 int ioctl(fd, int request = VIDEO_SLOWMOTION, int nFrames) 1544 1545Arguments 1546~~~~~~~~~ 1547 1548.. flat-table:: 1549 :header-rows: 0 1550 :stub-columns: 0 1551 1552 - .. 1553 1554 - ``int fd`` 1555 1556 - :cspan:`1` File descriptor returned by a previous call 1557 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 1571Description 1572~~~~~~~~~~~ 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 number 1578of times. This call can only be used if ``VIDEO_SOURCE_MEMORY`` is 1579selected. 1580 1581Return Value 1582~~~~~~~~~~~~ 1583 1584On success 0 is returned, on error -1 and the ``errno`` variable is set 1585appropriately. The generic error codes are described at the 1586:ref:`Generic Error Codes <gen-errors>` chapter. 1587 1588.. flat-table:: 1589 :header-rows: 0 1590 :stub-columns: 0 1591 1592 - .. 1593 1594 - ``EPERM`` 1595 1596 - Mode ``VIDEO_SOURCE_MEMORY`` not selected. 1597 1598 1599----- 1600 1601 1602VIDEO_GET_CAPABILITIES 1603---------------------- 1604 1605Synopsis 1606~~~~~~~~ 1607 1608.. c:macro:: VIDEO_GET_CAPABILITIES 1609 1610.. code-block:: c 1611 1612 int ioctl(fd, int request = VIDEO_GET_CAPABILITIES, unsigned int *cap) 1613 1614Arguments 1615~~~~~~~~~ 1616 1617.. flat-table:: 1618 :header-rows: 0 1619 :stub-columns: 0 1620 1621 - .. 1622 1623 - ``int fd`` 1624 1625 - :cspan:`1` File descriptor returned by a previous call 1626 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 1640Description 1641~~~~~~~~~~~ 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 the 1648defines in `video capabilities`_. 1649 1650Return Value 1651~~~~~~~~~~~~ 1652 1653On success 0 is returned, on error -1 and the ``errno`` variable is set 1654appropriately. The generic error codes are described at the 1655:ref:`Generic Error Codes <gen-errors>` chapter. 1656 1657 1658----- 1659 1660 1661VIDEO_CLEAR_BUFFER 1662------------------ 1663 1664Synopsis 1665~~~~~~~~ 1666 1667.. c:macro:: VIDEO_CLEAR_BUFFER 1668 1669.. code-block:: c 1670 1671 int ioctl(fd, int request = VIDEO_CLEAR_BUFFER) 1672 1673Arguments 1674~~~~~~~~~ 1675 1676.. flat-table:: 1677 :header-rows: 0 1678 :stub-columns: 0 1679 1680 - .. 1681 1682 - ``int fd`` 1683 1684 - :cspan:`1` File descriptor returned by a previous call 1685 to `open()`_. 1686 1687 - .. 1688 1689 - ``int request`` 1690 1691 - Equals ``VIDEO_CLEAR_BUFFER`` for this command. 1692 1693Description 1694~~~~~~~~~~~ 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 the 1700decoder hardware. 1701 1702Return Value 1703~~~~~~~~~~~~ 1704 1705On success 0 is returned, on error -1 and the ``errno`` variable is set 1706appropriately. The generic error codes are described at the 1707:ref:`Generic Error Codes <gen-errors>` chapter. 1708 1709 1710----- 1711 1712 1713VIDEO_SET_STREAMTYPE 1714-------------------- 1715 1716Synopsis 1717~~~~~~~~ 1718 1719.. c:macro:: VIDEO_SET_STREAMTYPE 1720 1721.. code-block:: c 1722 1723 int ioctl(fd, int request = VIDEO_SET_STREAMTYPE, int type) 1724 1725Arguments 1726~~~~~~~~~ 1727 1728.. flat-table:: 1729 :header-rows: 0 1730 :stub-columns: 0 1731 1732 - .. 1733 1734 - ``int fd`` 1735 1736 - :cspan:`1` File descriptor returned by a previous call 1737 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 1751Description 1752~~~~~~~~~~~ 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 written 1758to 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: 1 1766 :stub-columns: 0 1767 1768 - .. 1769 1770 - Codec 1771 1772 - Stream type 1773 1774 - .. 1775 1776 - MPEG2 1777 1778 - 0 1779 1780 - .. 1781 1782 - MPEG4 h.264 1783 1784 - 1 1785 1786 - .. 1787 1788 - VC1 1789 1790 - 3 1791 1792 - .. 1793 1794 - MPEG4 Part2 1795 1796 - 4 1797 1798 - .. 1799 1800 - VC1 SM 1801 1802 - 5 1803 1804 - .. 1805 1806 - MPEG1 1807 1808 - 6 1809 1810 - .. 1811 1812 - HEVC h.265 1813 1814 - | 7 1815 | DREAMBOX: 22 1816 1817 - .. 1818 1819 - AVS 1820 1821 - 16 1822 1823 - .. 1824 1825 - AVS2 1826 1827 - 40 1828 1829Not every decoder supports all stream types. 1830 1831Return Value 1832~~~~~~~~~~~~ 1833 1834On success 0 is returned, on error -1 and the ``errno`` variable is set 1835appropriately. The generic error codes are described at the 1836:ref:`Generic Error Codes <gen-errors>` chapter. 1837 1838 1839----- 1840 1841 1842VIDEO_SET_FORMAT 1843---------------- 1844 1845Synopsis 1846~~~~~~~~ 1847 1848.. c:macro:: VIDEO_SET_FORMAT 1849 1850.. code-block:: c 1851 1852 int ioctl(fd, int request = VIDEO_SET_FORMAT, video_format_t format) 1853 1854Arguments 1855~~~~~~~~~ 1856 1857.. flat-table:: 1858 :header-rows: 0 1859 :stub-columns: 0 1860 1861 - .. 1862 1863 - ``int fd`` 1864 1865 - :cspan:`1` File descriptor returned by a previous call 1866 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 1880Description 1881~~~~~~~~~~~ 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 output 1887device (TV) so that the output of the decoder can be adjusted 1888accordingly. 1889 1890Return Value 1891~~~~~~~~~~~~ 1892 1893On success 0 is returned, on error -1 and the ``errno`` variable is set 1894appropriately. The generic error codes are described at the 1895:ref:`Generic Error Codes <gen-errors>` chapter. 1896 1897 1898----- 1899 1900 1901VIDEO_GET_SIZE 1902-------------- 1903 1904Synopsis 1905~~~~~~~~ 1906 1907.. c:macro:: VIDEO_GET_SIZE 1908 1909.. code-block:: c 1910 1911 int ioctl(int fd, int request = VIDEO_GET_SIZE, video_size_t *size) 1912 1913Arguments 1914~~~~~~~~~ 1915 1916.. flat-table:: 1917 :header-rows: 0 1918 :stub-columns: 0 1919 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 1939Description 1940~~~~~~~~~~~ 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 Value 1948~~~~~~~~~~~~ 1949 1950On success 0 is returned, on error -1 and the ``errno`` variable is set 1951appropriately. The generic error codes are described at the 1952:ref:`Generic Error Codes <gen-errors>` chapter. 1953 1954 1955----- 1956 1957 1958VIDEO_GET_PTS 1959------------- 1960 1961Synopsis 1962~~~~~~~~ 1963 1964.. c:macro:: VIDEO_GET_PTS 1965 1966.. code-block:: c 1967 1968 int ioctl(int fd, int request = VIDEO_GET_PTS, __u64 *pts) 1969 1970Arguments 1971~~~~~~~~~ 1972 1973.. flat-table:: 1974 :header-rows: 0 1975 :stub-columns: 0 1976 1977 - .. 1978 1979 - ``int fd`` 1980 1981 - :cspan:`1` File descriptor returned by a previous call 1982 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 last 1999 decoded frame or the last PTS extracted by the PES parser. 2000 2001Description 2002~~~~~~~~~~~ 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 the 2008``V4L2_CID_MPEG_VIDEO_DEC_PTS`` control. 2009 2010This ioctl call asks the Video Device to return the current PTS 2011timestamp. 2012 2013Return Value 2014~~~~~~~~~~~~ 2015 2016On success 0 is returned, on error -1 and the ``errno`` variable is set 2017appropriately. The generic error codes are described at the 2018:ref:`Generic Error Codes <gen-errors>` chapter. 2019 2020 2021----- 2022 2023 2024VIDEO_GET_FRAME_COUNT 2025--------------------- 2026 2027Synopsis 2028~~~~~~~~ 2029 2030.. c:macro:: VIDEO_GET_FRAME_COUNT 2031 2032.. code-block:: c 2033 2034 int ioctl(int fd, VIDEO_GET_FRAME_COUNT, __u64 *pts) 2035 2036Arguments 2037~~~~~~~~~ 2038 2039.. flat-table:: 2040 :header-rows: 0 2041 :stub-columns: 0 2042 2043 - .. 2044 2045 - ``int fd`` 2046 2047 - :cspan:`1` File descriptor returned by a previous call 2048 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 was 2061 started. 2062 2063Description 2064~~~~~~~~~~~ 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 the 2070``V4L2_CID_MPEG_VIDEO_DEC_FRAME`` control. 2071 2072This ioctl call asks the Video Device to return the number of displayed 2073frames since the decoder was started. 2074 2075Return Value 2076~~~~~~~~~~~~ 2077 2078On success 0 is returned, on error -1 and the ``errno`` variable is set 2079appropriately. The generic error codes are described at the 2080:ref:`Generic Error Codes <gen-errors>` chapter. 2081 2082 2083----- 2084 2085 2086VIDEO_COMMAND 2087------------- 2088 2089Synopsis 2090~~~~~~~~ 2091 2092.. c:macro:: VIDEO_COMMAND 2093 2094.. code-block:: c 2095 2096 int ioctl(int fd, int request = VIDEO_COMMAND, 2097 struct video_command *cmd) 2098 2099Arguments 2100~~~~~~~~~ 2101 2102.. flat-table:: 2103 :header-rows: 0 2104 :stub-columns: 0 2105 2106 - .. 2107 2108 - ``int fd`` 2109 2110 - :cspan:`1` File descriptor returned by a previous call 2111 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 2125Description 2126~~~~~~~~~~~ 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 the 2132:ref:`VIDIOC_DECODER_CMD` ioctl. 2133 2134This ioctl commands the decoder. The `struct video_command`_ is a 2135subset of the ``v4l2_decoder_cmd`` struct, so refer to the 2136:ref:`VIDIOC_DECODER_CMD` documentation for 2137more information. 2138 2139Return Value 2140~~~~~~~~~~~~ 2141 2142On success 0 is returned, on error -1 and the ``errno`` variable is set 2143appropriately. The generic error codes are described at the 2144:ref:`Generic Error Codes <gen-errors>` chapter. 2145 2146 2147----- 2148 2149 2150VIDEO_TRY_COMMAND 2151----------------- 2152 2153Synopsis 2154~~~~~~~~ 2155 2156.. c:macro:: VIDEO_TRY_COMMAND 2157 2158.. code-block:: c 2159 2160 int ioctl(int fd, int request = VIDEO_TRY_COMMAND, 2161 struct video_command *cmd) 2162 2163Arguments 2164~~~~~~~~~ 2165 2166.. flat-table:: 2167 :header-rows: 0 2168 :stub-columns: 0 2169 2170 - .. 2171 2172 - ``int fd`` 2173 2174 - :cspan:`1` File descriptor returned by a previous call 2175 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 2189Description 2190~~~~~~~~~~~ 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 the 2196:ref:`VIDIOC_TRY_DECODER_CMD <VIDIOC_DECODER_CMD>` ioctl. 2197 2198This ioctl tries a decoder command. The `struct video_command`_ is a 2199subset of the ``v4l2_decoder_cmd`` struct, so refer to the 2200:ref:`VIDIOC_TRY_DECODER_CMD <VIDIOC_DECODER_CMD>` documentation 2201for more information. 2202 2203Return Value 2204~~~~~~~~~~~~ 2205 2206On success 0 is returned, on error -1 and the ``errno`` variable is set 2207appropriately. The generic error codes are described at the 2208:ref:`Generic Error Codes <gen-errors>` chapter. 2209 2210 2211----- 2212 2213 2214open() 2215------ 2216 2217Synopsis 2218~~~~~~~~ 2219 2220.. code-block:: c 2221 2222 #include <fcntl.h> 2223 2224.. c:function:: int open(const char *deviceName, int flags) 2225 2226Arguments 2227~~~~~~~~~ 2228 2229.. flat-table:: 2230 :header-rows: 0 2231 :stub-columns: 0 2232 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 access 2250 2251 - .. 2252 2253 - ``O_RDWR`` 2254 2255 - read/write access 2256 2257 - .. 2258 2259 - ``O_NONBLOCK`` 2260 - | Open in non-blocking mode 2261 | (blocking mode is the default) 2262 2263Description 2264~~~~~~~~~~~ 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. The 2270significance of blocking or non-blocking mode is described in the 2271documentation for functions where there is a difference. It does not 2272affect the semantics of the open() call itself. A device opened in 2273blocking 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 standard 2275system call, documented in the Linux manual page for fcntl. Only one 2276user can open the Video Device in O_RDWR mode. All other attempts to 2277open the device in this mode will fail, and an error-code will be 2278returned. If the Video Device is opened in O_RDONLY mode, the only 2279ioctl call that can be used is `VIDEO_GET_STATUS`_. All other call will 2280return an error code. 2281 2282Return Value 2283~~~~~~~~~~~~ 2284 2285.. flat-table:: 2286 :header-rows: 0 2287 :stub-columns: 0 2288 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 2320Synopsis 2321~~~~~~~~ 2322 2323.. c:function:: int close(int fd) 2324 2325Arguments 2326~~~~~~~~~ 2327 2328.. flat-table:: 2329 :header-rows: 0 2330 :stub-columns: 0 2331 2332 - .. 2333 2334 - ``int fd`` 2335 2336 - :cspan:`1` File descriptor returned by a previous call 2337 to `open()`_. 2338 2339Description 2340~~~~~~~~~~~ 2341 2342This system call closes a previously opened video device. 2343 2344Return Value 2345~~~~~~~~~~~~ 2346 2347.. flat-table:: 2348 :header-rows: 0 2349 :stub-columns: 0 2350 2351 - .. 2352 2353 - ``EBADF`` 2354 2355 - fd is not a valid open file descriptor. 2356 2357 2358----- 2359 2360 2361write() 2362------- 2363 2364Synopsis 2365~~~~~~~~ 2366 2367.. c:function:: size_t write(int fd, const void *buf, size_t count) 2368 2369Arguments 2370~~~~~~~~~ 2371 2372.. flat-table:: 2373 :header-rows: 0 2374 :stub-columns: 0 2375 2376 - .. 2377 2378 - ``int fd`` 2379 2380 - :cspan:`1` File descriptor returned by a previous call 2381 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 2395Description 2396~~~~~~~~~~~ 2397 2398This system call can only be used if VIDEO_SOURCE_MEMORY is selected 2399in the ioctl call `VIDEO_SELECT_SOURCE`_. The data provided shall be in 2400PES format, unless the capability allows other formats. TS is the 2401most common format for storing DVB-data, it is usually supported too. 2402If O_NONBLOCK is not specified the function will block until buffer space 2403is 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 Value 2408~~~~~~~~~~~~ 2409 2410.. flat-table:: 2411 :header-rows: 0 2412 :stub-columns: 0 2413 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