doc-rst: linux_tv: remove whitespaces
[deliverable/linux.git] / Documentation / linux_tv / media / dvb / dmx_fcalls.rst
1 .. -*- coding: utf-8; mode: rst -*-
2
3 .. _dmx_fcalls:
4
5 ********************
6 Demux Function Calls
7 ********************
8
9
10 .. _dmx_fopen:
11
12 DVB demux open()
13 ================
14
15 Description
16 -----------
17
18 This system call, used with a device name of /dev/dvb/adapter0/demux0,
19 allocates a new filter and returns a handle which can be used for
20 subsequent control of that filter. This call has to be made for each
21 filter to be used, i.e. every returned file descriptor is a reference to
22 a single filter. /dev/dvb/adapter0/dvr0 is a logical device to be used
23 for retrieving Transport Streams for digital video recording. When
24 reading from this device a transport stream containing the packets from
25 all PES filters set in the corresponding demux device
26 (/dev/dvb/adapter0/demux0) having the output set to DMX_OUT_TS_TAP. A
27 recorded Transport Stream is replayed by writing to this device.
28
29 The significance of blocking or non-blocking mode is described in the
30 documentation for functions where there is a difference. It does not
31 affect the semantics of the open() call itself. A device opened in
32 blocking mode can later be put into non-blocking mode (and vice versa)
33 using the F_SETFL command of the fcntl system call.
34
35 Synopsis
36 --------
37
38 .. c:function:: int open(const char *deviceName, int flags)
39
40 Arguments
41 ----------
42
43
44
45 .. flat-table::
46 :header-rows: 0
47 :stub-columns: 0
48
49
50 - .. row 1
51
52 - const char \*deviceName
53
54 - Name of demux device.
55
56 - .. row 2
57
58 - int flags
59
60 - A bit-wise OR of the following flags:
61
62 - .. row 3
63
64 -
65 - O_RDWR read/write access
66
67 - .. row 4
68
69 -
70 - O_NONBLOCK open in non-blocking mode
71
72 - .. row 5
73
74 -
75 - (blocking mode is the default)
76
77
78 Return Value
79 ------------
80
81
82
83 .. flat-table::
84 :header-rows: 0
85 :stub-columns: 0
86
87
88 - .. row 1
89
90 - ``ENODEV``
91
92 - Device driver not loaded/available.
93
94 - .. row 2
95
96 - ``EINVAL``
97
98 - Invalid argument.
99
100 - .. row 3
101
102 - ``EMFILE``
103
104 - “Too many open files”, i.e. no more filters available.
105
106 - .. row 4
107
108 - ``ENOMEM``
109
110 - The driver failed to allocate enough memory.
111
112
113
114 .. _dmx_fclose:
115
116 DVB demux close()
117 =================
118
119 Description
120 -----------
121
122 This system call deactivates and deallocates a filter that was
123 previously allocated via the open() call.
124
125 Synopsis
126 --------
127
128 .. c:function:: int close(int fd)
129
130 Arguments
131 ----------
132
133
134
135 .. flat-table::
136 :header-rows: 0
137 :stub-columns: 0
138
139
140 - .. row 1
141
142 - int fd
143
144 - File descriptor returned by a previous call to open().
145
146
147 Return Value
148 ------------
149
150
151
152 .. flat-table::
153 :header-rows: 0
154 :stub-columns: 0
155
156
157 - .. row 1
158
159 - ``EBADF``
160
161 - fd is not a valid open file descriptor.
162
163
164
165 .. _dmx_fread:
166
167 DVB demux read()
168 ================
169
170 Description
171 -----------
172
173 This system call returns filtered data, which might be section or PES
174 data. The filtered data is transferred from the driver’s internal
175 circular buffer to buf. The maximum amount of data to be transferred is
176 implied by count.
177
178 Synopsis
179 --------
180
181 .. c:function:: size_t read(int fd, void *buf, size_t count)
182
183 Arguments
184 ----------
185
186
187
188 .. flat-table::
189 :header-rows: 0
190 :stub-columns: 0
191
192
193 - .. row 1
194
195 - int fd
196
197 - File descriptor returned by a previous call to open().
198
199 - .. row 2
200
201 - void \*buf
202
203 - Pointer to the buffer to be used for returned filtered data.
204
205 - .. row 3
206
207 - size_t count
208
209 - Size of buf.
210
211
212 Return Value
213 ------------
214
215
216
217 .. flat-table::
218 :header-rows: 0
219 :stub-columns: 0
220
221
222 - .. row 1
223
224 - ``EWOULDBLOCK``
225
226 - No data to return and O_NONBLOCK was specified.
227
228 - .. row 2
229
230 - ``EBADF``
231
232 - fd is not a valid open file descriptor.
233
234 - .. row 3
235
236 - ``ECRC``
237
238 - Last section had a CRC error - no data returned. The buffer is
239 flushed.
240
241 - .. row 4
242
243 - ``EOVERFLOW``
244
245 -
246
247 - .. row 5
248
249 -
250 - The filtered data was not read from the buffer in due time,
251 resulting in non-read data being lost. The buffer is flushed.
252
253 - .. row 6
254
255 - ``ETIMEDOUT``
256
257 - The section was not loaded within the stated timeout period. See
258 ioctl DMX_SET_FILTER for how to set a timeout.
259
260 - .. row 7
261
262 - ``EFAULT``
263
264 - The driver failed to write to the callers buffer due to an invalid
265 \*buf pointer.
266
267
268
269 .. _dmx_fwrite:
270
271 DVB demux write()
272 =================
273
274 Description
275 -----------
276
277 This system call is only provided by the logical device
278 /dev/dvb/adapter0/dvr0, associated with the physical demux device that
279 provides the actual DVR functionality. It is used for replay of a
280 digitally recorded Transport Stream. Matching filters have to be defined
281 in the corresponding physical demux device, /dev/dvb/adapter0/demux0.
282 The amount of data to be transferred is implied by count.
283
284 Synopsis
285 --------
286
287 .. c:function:: ssize_t write(int fd, const void *buf, size_t count)
288
289 Arguments
290 ----------
291
292
293
294 .. flat-table::
295 :header-rows: 0
296 :stub-columns: 0
297
298
299 - .. row 1
300
301 - int fd
302
303 - File descriptor returned by a previous call to open().
304
305 - .. row 2
306
307 - void \*buf
308
309 - Pointer to the buffer containing the Transport Stream.
310
311 - .. row 3
312
313 - size_t count
314
315 - Size of buf.
316
317
318 Return Value
319 ------------
320
321
322
323 .. flat-table::
324 :header-rows: 0
325 :stub-columns: 0
326
327
328 - .. row 1
329
330 - ``EWOULDBLOCK``
331
332 - No data was written. This might happen if O_NONBLOCK was
333 specified and there is no more buffer space available (if
334 O_NONBLOCK is not specified the function will block until buffer
335 space is available).
336
337 - .. row 2
338
339 - ``EBUSY``
340
341 - This error code indicates that there are conflicting requests. The
342 corresponding demux device is setup to receive data from the
343 front- end. Make sure that these filters are stopped and that the
344 filters with input set to DMX_IN_DVR are started.
345
346 - .. row 3
347
348 - ``EBADF``
349
350 - fd is not a valid open file descriptor.
351
352
353
354 .. _DMX_START:
355
356 DMX_START
357 =========
358
359 Description
360 -----------
361
362 This ioctl call is used to start the actual filtering operation defined
363 via the ioctl calls DMX_SET_FILTER or DMX_SET_PES_FILTER.
364
365 Synopsis
366 --------
367
368 .. c:function:: int ioctl( int fd, int request = DMX_START)
369
370 Arguments
371 ----------
372
373
374
375 .. flat-table::
376 :header-rows: 0
377 :stub-columns: 0
378
379
380 - .. row 1
381
382 - int fd
383
384 - File descriptor returned by a previous call to open().
385
386 - .. row 2
387
388 - int request
389
390 - Equals DMX_START for this command.
391
392
393 Return Value
394 ------------
395
396 On success 0 is returned, on error -1 and the ``errno`` variable is set
397 appropriately. The generic error codes are described at the
398 :ref:`Generic Error Codes <gen-errors>` chapter.
399
400
401
402 .. flat-table::
403 :header-rows: 0
404 :stub-columns: 0
405
406
407 - .. row 1
408
409 - ``EINVAL``
410
411 - Invalid argument, i.e. no filtering parameters provided via the
412 DMX_SET_FILTER or DMX_SET_PES_FILTER functions.
413
414 - .. row 2
415
416 - ``EBUSY``
417
418 - This error code indicates that there are conflicting requests.
419 There are active filters filtering data from another input source.
420 Make sure that these filters are stopped before starting this
421 filter.
422
423
424
425 .. _DMX_STOP:
426
427 DMX_STOP
428 ========
429
430 Description
431 -----------
432
433 This ioctl call is used to stop the actual filtering operation defined
434 via the ioctl calls DMX_SET_FILTER or DMX_SET_PES_FILTER and
435 started via the DMX_START command.
436
437 Synopsis
438 --------
439
440 .. c:function:: int ioctl( int fd, int request = DMX_STOP)
441
442 Arguments
443 ----------
444
445
446
447 .. flat-table::
448 :header-rows: 0
449 :stub-columns: 0
450
451
452 - .. row 1
453
454 - int fd
455
456 - File descriptor returned by a previous call to open().
457
458 - .. row 2
459
460 - int request
461
462 - Equals DMX_STOP for this command.
463
464
465 Return Value
466 ------------
467
468 On success 0 is returned, on error -1 and the ``errno`` variable is set
469 appropriately. The generic error codes are described at the
470 :ref:`Generic Error Codes <gen-errors>` chapter.
471
472
473 .. _DMX_SET_FILTER:
474
475 DMX_SET_FILTER
476 ==============
477
478 Description
479 -----------
480
481 This ioctl call sets up a filter according to the filter and mask
482 parameters provided. A timeout may be defined stating number of seconds
483 to wait for a section to be loaded. A value of 0 means that no timeout
484 should be applied. Finally there is a flag field where it is possible to
485 state whether a section should be CRC-checked, whether the filter should
486 be a ”one-shot” filter, i.e. if the filtering operation should be
487 stopped after the first section is received, and whether the filtering
488 operation should be started immediately (without waiting for a
489 DMX_START ioctl call). If a filter was previously set-up, this filter
490 will be canceled, and the receive buffer will be flushed.
491
492 Synopsis
493 --------
494
495 .. c:function:: int ioctl( int fd, int request = DMX_SET_FILTER, struct dmx_sct_filter_params *params)
496
497 Arguments
498 ----------
499
500
501
502 .. flat-table::
503 :header-rows: 0
504 :stub-columns: 0
505
506
507 - .. row 1
508
509 - int fd
510
511 - File descriptor returned by a previous call to open().
512
513 - .. row 2
514
515 - int request
516
517 - Equals DMX_SET_FILTER for this command.
518
519 - .. row 3
520
521 - struct dmx_sct_filter_params \*params
522
523 - Pointer to structure containing filter parameters.
524
525
526 Return Value
527 ------------
528
529 On success 0 is returned, on error -1 and the ``errno`` variable is set
530 appropriately. The generic error codes are described at the
531 :ref:`Generic Error Codes <gen-errors>` chapter.
532
533
534 .. _DMX_SET_PES_FILTER:
535
536 DMX_SET_PES_FILTER
537 ==================
538
539 Description
540 -----------
541
542 This ioctl call sets up a PES filter according to the parameters
543 provided. By a PES filter is meant a filter that is based just on the
544 packet identifier (PID), i.e. no PES header or payload filtering
545 capability is supported.
546
547 Synopsis
548 --------
549
550 .. c:function:: int ioctl( int fd, int request = DMX_SET_PES_FILTER, struct dmx_pes_filter_params *params)
551
552 Arguments
553 ----------
554
555
556
557 .. flat-table::
558 :header-rows: 0
559 :stub-columns: 0
560
561
562 - .. row 1
563
564 - int fd
565
566 - File descriptor returned by a previous call to open().
567
568 - .. row 2
569
570 - int request
571
572 - Equals DMX_SET_PES_FILTER for this command.
573
574 - .. row 3
575
576 - struct dmx_pes_filter_params \*params
577
578 - Pointer to structure containing filter parameters.
579
580
581 Return Value
582 ------------
583
584 On success 0 is returned, on error -1 and the ``errno`` variable is set
585 appropriately. The generic error codes are described at the
586 :ref:`Generic Error Codes <gen-errors>` chapter.
587
588
589
590 .. flat-table::
591 :header-rows: 0
592 :stub-columns: 0
593
594
595 - .. row 1
596
597 - ``EBUSY``
598
599 - This error code indicates that there are conflicting requests.
600 There are active filters filtering data from another input source.
601 Make sure that these filters are stopped before starting this
602 filter.
603
604
605
606 .. _DMX_SET_BUFFER_SIZE:
607
608 DMX_SET_BUFFER_SIZE
609 ===================
610
611 Description
612 -----------
613
614 This ioctl call is used to set the size of the circular buffer used for
615 filtered data. The default size is two maximum sized sections, i.e. if
616 this function is not called a buffer size of 2 \* 4096 bytes will be
617 used.
618
619 Synopsis
620 --------
621
622 .. c:function:: int ioctl( int fd, int request = DMX_SET_BUFFER_SIZE, unsigned long size)
623
624 Arguments
625 ----------
626
627
628
629 .. flat-table::
630 :header-rows: 0
631 :stub-columns: 0
632
633
634 - .. row 1
635
636 - int fd
637
638 - File descriptor returned by a previous call to open().
639
640 - .. row 2
641
642 - int request
643
644 - Equals DMX_SET_BUFFER_SIZE for this command.
645
646 - .. row 3
647
648 - unsigned long size
649
650 - Size of circular buffer.
651
652
653 Return Value
654 ------------
655
656 On success 0 is returned, on error -1 and the ``errno`` variable is set
657 appropriately. The generic error codes are described at the
658 :ref:`Generic Error Codes <gen-errors>` chapter.
659
660
661 .. _DMX_GET_EVENT:
662
663 DMX_GET_EVENT
664 =============
665
666 Description
667 -----------
668
669 This ioctl call returns an event if available. If an event is not
670 available, the behavior depends on whether the device is in blocking or
671 non-blocking mode. In the latter case, the call fails immediately with
672 errno set to ``EWOULDBLOCK``. In the former case, the call blocks until an
673 event becomes available.
674
675 Synopsis
676 --------
677
678 .. c:function:: int ioctl( int fd, int request = DMX_GET_EVENT, struct dmx_event *ev)
679
680 Arguments
681 ----------
682
683
684
685 .. flat-table::
686 :header-rows: 0
687 :stub-columns: 0
688
689
690 - .. row 1
691
692 - int fd
693
694 - File descriptor returned by a previous call to open().
695
696 - .. row 2
697
698 - int request
699
700 - Equals DMX_GET_EVENT for this command.
701
702 - .. row 3
703
704 - struct dmx_event \*ev
705
706 - Pointer to the location where the event is to be stored.
707
708
709 Return Value
710 ------------
711
712 On success 0 is returned, on error -1 and the ``errno`` variable is set
713 appropriately. The generic error codes are described at the
714 :ref:`Generic Error Codes <gen-errors>` chapter.
715
716
717
718 .. flat-table::
719 :header-rows: 0
720 :stub-columns: 0
721
722
723 - .. row 1
724
725 - ``EWOULDBLOCK``
726
727 - There is no event pending, and the device is in non-blocking mode.
728
729
730
731 .. _DMX_GET_STC:
732
733 DMX_GET_STC
734 ===========
735
736 Description
737 -----------
738
739 This ioctl call returns the current value of the system time counter
740 (which is driven by a PES filter of type DMX_PES_PCR). Some hardware
741 supports more than one STC, so you must specify which one by setting the
742 num field of stc before the ioctl (range 0...n). The result is returned
743 in form of a ratio with a 64 bit numerator and a 32 bit denominator, so
744 the real 90kHz STC value is stc->stc / stc->base .
745
746 Synopsis
747 --------
748
749 .. c:function:: int ioctl( int fd, int request = DMX_GET_STC, struct dmx_stc *stc)
750
751 Arguments
752 ----------
753
754
755
756 .. flat-table::
757 :header-rows: 0
758 :stub-columns: 0
759
760
761 - .. row 1
762
763 - int fd
764
765 - File descriptor returned by a previous call to open().
766
767 - .. row 2
768
769 - int request
770
771 - Equals DMX_GET_STC for this command.
772
773 - .. row 3
774
775 - struct dmx_stc \*stc
776
777 - Pointer to the location where the stc is to be stored.
778
779
780 Return Value
781 ------------
782
783 On success 0 is returned, on error -1 and the ``errno`` variable is set
784 appropriately. The generic error codes are described at the
785 :ref:`Generic Error Codes <gen-errors>` chapter.
786
787
788
789 .. flat-table::
790 :header-rows: 0
791 :stub-columns: 0
792
793
794 - .. row 1
795
796 - ``EINVAL``
797
798 - Invalid stc number.
799
800
801
802 .. _DMX_GET_PES_PIDS:
803
804 DMX_GET_PES_PIDS
805 ================
806
807 Description
808 -----------
809
810 This ioctl is undocumented. Documentation is welcome.
811
812 Synopsis
813 --------
814
815 .. c:function:: int ioctl(fd, int request = DMX_GET_PES_PIDS, __u16[5])
816
817 Arguments
818 ----------
819
820
821
822 .. flat-table::
823 :header-rows: 0
824 :stub-columns: 0
825
826
827 - .. row 1
828
829 - int fd
830
831 - File descriptor returned by a previous call to open().
832
833 - .. row 2
834
835 - int request
836
837 - Equals DMX_GET_PES_PIDS for this command.
838
839 - .. row 3
840
841 - __u16[5]
842
843 - Undocumented.
844
845
846 Return Value
847 ------------
848
849 On success 0 is returned, on error -1 and the ``errno`` variable is set
850 appropriately. The generic error codes are described at the
851 :ref:`Generic Error Codes <gen-errors>` chapter.
852
853
854 .. _DMX_GET_CAPS:
855
856 DMX_GET_CAPS
857 ============
858
859 Description
860 -----------
861
862 This ioctl is undocumented. Documentation is welcome.
863
864 Synopsis
865 --------
866
867 .. c:function:: int ioctl(fd, int request = DMX_GET_CAPS, dmx_caps_t *)
868
869 Arguments
870 ----------
871
872
873
874 .. flat-table::
875 :header-rows: 0
876 :stub-columns: 0
877
878
879 - .. row 1
880
881 - int fd
882
883 - File descriptor returned by a previous call to open().
884
885 - .. row 2
886
887 - int request
888
889 - Equals DMX_GET_CAPS for this command.
890
891 - .. row 3
892
893 - dmx_caps_t *
894
895 - Undocumented.
896
897
898 Return Value
899 ------------
900
901 On success 0 is returned, on error -1 and the ``errno`` variable is set
902 appropriately. The generic error codes are described at the
903 :ref:`Generic Error Codes <gen-errors>` chapter.
904
905
906 .. _DMX_SET_SOURCE:
907
908 DMX_SET_SOURCE
909 ==============
910
911 Description
912 -----------
913
914 This ioctl is undocumented. Documentation is welcome.
915
916 Synopsis
917 --------
918
919 .. c:function:: int ioctl(fd, int request = DMX_SET_SOURCE, dmx_source_t *)
920
921 Arguments
922 ----------
923
924
925
926 .. flat-table::
927 :header-rows: 0
928 :stub-columns: 0
929
930
931 - .. row 1
932
933 - int fd
934
935 - File descriptor returned by a previous call to open().
936
937 - .. row 2
938
939 - int request
940
941 - Equals DMX_SET_SOURCE for this command.
942
943 - .. row 3
944
945 - dmx_source_t *
946
947 - Undocumented.
948
949
950 Return Value
951 ------------
952
953 On success 0 is returned, on error -1 and the ``errno`` variable is set
954 appropriately. The generic error codes are described at the
955 :ref:`Generic Error Codes <gen-errors>` chapter.
956
957
958 .. _DMX_ADD_PID:
959
960 DMX_ADD_PID
961 ===========
962
963 Description
964 -----------
965
966 This ioctl call allows to add multiple PIDs to a transport stream filter
967 previously set up with DMX_SET_PES_FILTER and output equal to
968 DMX_OUT_TSDEMUX_TAP.
969
970 Synopsis
971 --------
972
973 .. c:function:: int ioctl(fd, int request = DMX_ADD_PID, __u16 *)
974
975 Arguments
976 ----------
977
978
979
980 .. flat-table::
981 :header-rows: 0
982 :stub-columns: 0
983
984
985 - .. row 1
986
987 - int fd
988
989 - File descriptor returned by a previous call to open().
990
991 - .. row 2
992
993 - int request
994
995 - Equals DMX_ADD_PID for this command.
996
997 - .. row 3
998
999 - __u16 *
1000
1001 - PID number to be filtered.
1002
1003
1004 Return Value
1005 ------------
1006
1007 On success 0 is returned, on error -1 and the ``errno`` variable is set
1008 appropriately. The generic error codes are described at the
1009 :ref:`Generic Error Codes <gen-errors>` chapter.
1010
1011
1012 .. _DMX_REMOVE_PID:
1013
1014 DMX_REMOVE_PID
1015 ==============
1016
1017 Description
1018 -----------
1019
1020 This ioctl call allows to remove a PID when multiple PIDs are set on a
1021 transport stream filter, e. g. a filter previously set up with output
1022 equal to DMX_OUT_TSDEMUX_TAP, created via either
1023 DMX_SET_PES_FILTER or DMX_ADD_PID.
1024
1025 Synopsis
1026 --------
1027
1028 .. c:function:: int ioctl(fd, int request = DMX_REMOVE_PID, __u16 *)
1029
1030 Arguments
1031 ----------
1032
1033
1034
1035 .. flat-table::
1036 :header-rows: 0
1037 :stub-columns: 0
1038
1039
1040 - .. row 1
1041
1042 - int fd
1043
1044 - File descriptor returned by a previous call to open().
1045
1046 - .. row 2
1047
1048 - int request
1049
1050 - Equals DMX_REMOVE_PID for this command.
1051
1052 - .. row 3
1053
1054 - __u16 *
1055
1056 - PID of the PES filter to be removed.
1057
1058
1059 Return Value
1060 ------------
1061
1062 On success 0 is returned, on error -1 and the ``errno`` variable is set
1063 appropriately. The generic error codes are described at the
1064 :ref:`Generic Error Codes <gen-errors>` chapter.
This page took 0.066783 seconds and 5 git commands to generate.