summaryrefslogtreecommitdiffstats
path: root/Documentation/DocBook/media/dvb/demux.xml
blob: 86de89cfbd676cbeda054aba040432e25c4f68d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
<title>DVB Demux Device</title>

<para>The DVB demux device controls the filters of the DVB hardware/software. It can be
accessed through <emphasis role="tt">/dev/adapter0/demux0</emphasis>. Data types and and ioctl definitions can be
accessed by including <emphasis role="tt">linux/dvb/dmx.h</emphasis> in your application.
</para>
<section id="dmx_types">
<title>Demux Data Types</title>

<section id="dmx-output-t">
<title>dmx_output_t</title>
<programlisting>
typedef enum
{
	DMX_OUT_DECODER, /&#x22C6; Streaming directly to decoder. &#x22C6;/
	DMX_OUT_TAP,     /&#x22C6; Output going to a memory buffer &#x22C6;/
			 /&#x22C6; (to be retrieved via the read command).&#x22C6;/
	DMX_OUT_TS_TAP,  /&#x22C6; Output multiplexed into a new TS  &#x22C6;/
			 /&#x22C6; (to be retrieved by reading from the &#x22C6;/
			 /&#x22C6; logical DVR device).                 &#x22C6;/
	DMX_OUT_TSDEMUX_TAP /&#x22C6; Like TS_TAP but retrieved from the DMX device &#x22C6;/
} dmx_output_t;
</programlisting>
<para><emphasis role="tt">DMX_OUT_TAP</emphasis> delivers the stream output to the demux device on which the ioctl is
called.
</para>
<para><emphasis role="tt">DMX_OUT_TS_TAP</emphasis> routes output to the logical DVR device <emphasis role="tt">/dev/dvb/adapter0/dvr0</emphasis>,
which delivers a TS multiplexed from all filters for which <emphasis role="tt">DMX_OUT_TS_TAP</emphasis> was
specified.
</para>
</section>

<section id="dmx-input-t">
<title>dmx_input_t</title>
<programlisting>
typedef enum
{
	DMX_IN_FRONTEND, /&#x22C6; Input from a front-end device.  &#x22C6;/
	DMX_IN_DVR       /&#x22C6; Input from the logical DVR device.  &#x22C6;/
} dmx_input_t;
</programlisting>
</section>

<section id="dmx-pes-type-t">
<title>dmx_pes_type_t</title>
<programlisting>
typedef enum
{
	DMX_PES_AUDIO0,
	DMX_PES_VIDEO0,
	DMX_PES_TELETEXT0,
	DMX_PES_SUBTITLE0,
	DMX_PES_PCR0,

	DMX_PES_AUDIO1,
	DMX_PES_VIDEO1,
	DMX_PES_TELETEXT1,
	DMX_PES_SUBTITLE1,
	DMX_PES_PCR1,

	DMX_PES_AUDIO2,
	DMX_PES_VIDEO2,
	DMX_PES_TELETEXT2,
	DMX_PES_SUBTITLE2,
	DMX_PES_PCR2,

	DMX_PES_AUDIO3,
	DMX_PES_VIDEO3,
	DMX_PES_TELETEXT3,
	DMX_PES_SUBTITLE3,
	DMX_PES_PCR3,

	DMX_PES_OTHER
} dmx_pes_type_t;
</programlisting>
</section>

<section id="dmx-filter">
<title>struct dmx_filter</title>
 <programlisting>
 typedef struct dmx_filter
{
	__u8  filter[DMX_FILTER_SIZE];
	__u8  mask[DMX_FILTER_SIZE];
	__u8  mode[DMX_FILTER_SIZE];
} dmx_filter_t;
</programlisting>
</section>

<section id="dmx-sct-filter-params">
<title>struct dmx_sct_filter_params</title>
<programlisting>
struct dmx_sct_filter_params
{
	__u16          pid;
	dmx_filter_t   filter;
	__u32          timeout;
	__u32          flags;
#define DMX_CHECK_CRC       1
#define DMX_ONESHOT         2
#define DMX_IMMEDIATE_START 4
#define DMX_KERNEL_CLIENT   0x8000
};
</programlisting>
</section>

<section id="dmx-pes-filter-params">
<title>struct dmx_pes_filter_params</title>
<programlisting>
struct dmx_pes_filter_params
{
	__u16          pid;
	dmx_input_t    input;
	dmx_output_t   output;
	dmx_pes_type_t pes_type;
	__u32          flags;
};
</programlisting>
</section>

<section id="dmx-event">
<title>struct dmx_event</title>
 <programlisting>
 struct dmx_event
 {
	 dmx_event_t          event;
	 time_t               timeStamp;
	 union
	 {
		 dmx_scrambling_status_t scrambling;
	 } u;
 };
</programlisting>
</section>

<section id="dmx-stc">
<title>struct dmx_stc</title>
<programlisting>
struct dmx_stc {
	unsigned int num;	/&#x22C6; input : which STC? 0..N &#x22C6;/
	unsigned int base;	/&#x22C6; output: divisor for stc to get 90 kHz clock &#x22C6;/
	__u64 stc;		/&#x22C6; output: stc in 'base'&#x22C6;90 kHz units &#x22C6;/
};
</programlisting>
</section>

<section id="dmx-caps">
<title>struct dmx_caps</title>
<programlisting>
 typedef struct dmx_caps {
	__u32 caps;
	int num_decoders;
} dmx_caps_t;
</programlisting>
</section>

<section id="dmx-source-t">
<title>enum dmx_source_t</title>
<programlisting>
typedef enum {
	DMX_SOURCE_FRONT0 = 0,
	DMX_SOURCE_FRONT1,
	DMX_SOURCE_FRONT2,
	DMX_SOURCE_FRONT3,
	DMX_SOURCE_DVR0   = 16,
	DMX_SOURCE_DVR1,
	DMX_SOURCE_DVR2,
	DMX_SOURCE_DVR3
} dmx_source_t;
</programlisting>
</section>

</section>
<section id="dmx_fcalls">
<title>Demux Function Calls</title>

<section id="dmx_fopen">
<title>open()</title>
<para>DESCRIPTION
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>This system call, used with a device name of /dev/dvb/adapter0/demux0,
 allocates a new filter and returns a handle which can be used for subsequent
 control of that filter. This call has to be made for each filter to be used, i.e. every
 returned file descriptor is a reference to a single filter. /dev/dvb/adapter0/dvr0
 is a logical device to be used for retrieving Transport Streams for digital
 video recording. When reading from this device a transport stream containing
 the packets from all PES filters set in the corresponding demux device
 (/dev/dvb/adapter0/demux0) having the output set to DMX_OUT_TS_TAP. A
 recorded Transport Stream is replayed by writing to this device. </para>
<para>The significance of blocking or non-blocking mode is described in the
 documentation for functions where there is a difference. It does not affect the
 semantics of the open() call itself. A device opened in blocking mode can later
 be put into non-blocking mode (and vice versa) using the F_SETFL command
 of the fcntl system call.</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>SYNOPSIS
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>int open(const char &#x22C6;deviceName, int flags);</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>PARAMETERS
</para>
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>const char
 *deviceName</para>
</entry><entry
 align="char">
<para>Name of demux device.</para>
</entry>
 </row><row><entry
 align="char">
<para>int flags</para>
</entry><entry
 align="char">
<para>A bit-wise OR of the following flags:</para>
</entry>
 </row><row><entry
 align="char">
</entry><entry
 align="char">
<para>O_RDWR read/write access</para>
</entry>
 </row><row><entry
 align="char">
</entry><entry
 align="char">
<para>O_NONBLOCK open in non-blocking mode</para>
</entry>
 </row><row><entry
 align="char">
</entry><entry
 align="char">
<para>(blocking mode is the default)</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>RETURN VALUE</para>
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>ENODEV</para>
</entry><entry
 align="char">
<para>Device driver not loaded/available.</para>
</entry>
 </row><row><entry
 align="char">
<para>EINVAL</para>
</entry><entry
 align="char">
<para>Invalid argument.</para>
</entry>
 </row><row><entry
 align="char">
<para>EMFILE</para>
</entry><entry
 align="char">
<para>&#8220;Too many open files&#8221;, i.e. no more filters available.</para>
</entry>
 </row><row><entry
 align="char">
<para>ENOMEM</para>
</entry><entry
 align="char">
<para>The driver failed to allocate enough memory.</para>
</entry>
 </row></tbody></tgroup></informaltable>
</section>

<section id="dmx_fclose">
<title>close()</title>
<para>DESCRIPTION
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>This system call deactivates and deallocates a filter that was previously
 allocated via the open() call.</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>SYNOPSIS
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>int close(int fd);</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>PARAMETERS
</para>
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>int fd</para>
</entry><entry
 align="char">
<para>File descriptor returned by a previous call to open().</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>RETURN VALUE</para>
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>EBADF</para>
</entry><entry
 align="char">
<para>fd is not a valid open file descriptor.</para>
</entry>
 </row></tbody></tgroup></informaltable>
</section>

<section id="dmx_fread">
<title>read()</title>
<para>DESCRIPTION
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>This system call returns filtered data, which might be section or PES data. The
 filtered data is transferred from the driver&#8217;s internal circular buffer to buf. The
 maximum amount of data to be transferred is implied by count.</para>
</entry>
 </row><row><entry
 align="char">
<para>When returning section data the driver always tries to return a complete single
 section (even though buf would provide buffer space for more data). If the size
 of the buffer is smaller than the section as much as possible will be returned,
 and the remaining data will be provided in subsequent calls.</para>
</entry>
 </row><row><entry
 align="char">
<para>The size of the internal buffer is 2 * 4096 bytes (the size of two maximum
 sized sections) by default. The size of this buffer may be changed by using the
 DMX_SET_BUFFER_SIZE function. If the buffer is not large enough, or if
 the read operations are not performed fast enough, this may result in a buffer
 overflow error. In this case EOVERFLOW will be returned, and the circular
 buffer will be emptied. This call is blocking if there is no data to return, i.e. the
 process will be put to sleep waiting for data, unless the O_NONBLOCK flag
 is specified.</para>
</entry>
 </row><row><entry
 align="char">
<para>Note that in order to be able to read, the filtering process has to be started
 by defining either a section or a PES filter by means of the ioctl functions,
 and then starting the filtering process via the DMX_START ioctl function
 or by setting the DMX_IMMEDIATE_START flag. If the reading is done
 from a logical DVR demux device, the data will constitute a Transport Stream
 including the packets from all PES filters in the corresponding demux device
 /dev/dvb/adapter0/demux0 having the output set to DMX_OUT_TS_TAP.</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>SYNOPSIS
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>size_t read(int fd, void &#x22C6;buf, size_t count);</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>PARAMETERS
</para>
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>int fd</para>
</entry><entry
 align="char">
<para>File descriptor returned by a previous call to open().</para>
</entry>
 </row><row><entry
 align="char">
<para>void *buf</para>
</entry><entry
 align="char">
<para>Pointer to the buffer to be used for returned filtered data.</para>
</entry>
 </row><row><entry
 align="char">
<para>size_t count</para>
</entry><entry
 align="char">
<para>Size of buf.</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>RETURN VALUE</para>
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>EWOULDBLOCK</para>
</entry><entry
 align="char">
<para>No data to return and O_NONBLOCK was specified.</para>
</entry>
 </row><row><entry
 align="char">
<para>EBADF</para>
</entry><entry
 align="char">
<para>fd is not a valid open file descriptor.</para>
</entry>
 </row><row><entry
 align="char">
<para>ECRC</para>
</entry><entry
 align="char">
<para>Last section had a CRC error - no data returned. The
 buffer is flushed.</para>
</entry>
 </row><row><entry
 align="char">
<para>EOVERFLOW</para>
</entry><entry
 align="char">
</entry>
 </row><row><entry
 align="char">
</entry><entry
 align="char">
<para>The filtered data was not read from the buffer in due
 time, resulting in non-read data being lost. The buffer is
 flushed.</para>
</entry>
 </row><row><entry
 align="char">
<para>ETIMEDOUT</para>
</entry><entry
 align="char">
<para>The section was not loaded within the stated timeout
 period. See ioctl DMX_SET_FILTER for how to set a
 timeout.</para>
</entry>
 </row><row><entry
 align="char">
<para>EFAULT</para>
</entry><entry
 align="char">
<para>The driver failed to write to the callers buffer due to an
 invalid *buf pointer.</para>
</entry>
 </row></tbody></tgroup></informaltable>
</section>

<section id="dmx_fwrite">
<title>write()</title>
<para>DESCRIPTION
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>This system call is only provided by the logical device /dev/dvb/adapter0/dvr0,
 associated with the physical demux device that provides the actual DVR
 functionality. It is used for replay of a digitally recorded Transport Stream.
 Matching filters have to be defined in the corresponding physical demux
 device, /dev/dvb/adapter0/demux0. The amount of data to be transferred is
 implied by count.</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>SYNOPSIS
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>ssize_t write(int fd, const void &#x22C6;buf, size_t
 count);</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>PARAMETERS
</para>
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>int fd</para>
</entry><entry
 align="char">
<para>File descriptor returned by a previous call to open().</para>
</entry>
 </row><row><entry
 align="char">
<para>void *buf</para>
</entry><entry
 align="char">
<para>Pointer to the buffer containing the Transport Stream.</para>
</entry>
 </row><row><entry
 align="char">
<para>size_t count</para>
</entry><entry
 align="char">
<para>Size of buf.</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>RETURN VALUE</para>
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>EWOULDBLOCK</para>
</entry><entry
 align="char">
<para>No data was written. This
 might happen if O_NONBLOCK was specified and there
 is no more buffer space available (if O_NONBLOCK is
 not specified the function will block until buffer space is
 available).</para>
</entry>
 </row><row><entry
 align="char">
<para>EBUSY</para>
</entry><entry
 align="char">
<para>This error code indicates that there are conflicting
 requests. The corresponding demux device is setup to
 receive data from the front- end. Make sure that these
 filters are stopped and that the filters with input set to
 DMX_IN_DVR are started.</para>
</entry>
 </row><row><entry
 align="char">
<para>EBADF</para>
</entry><entry
 align="char">
<para>fd is not a valid open file descriptor.</para>
</entry>
 </row></tbody></tgroup></informaltable>
</section>

<section id="DMX_START">
<title>DMX_START</title>
<para>DESCRIPTION
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>This ioctl call is used to start the actual filtering operation defined via the ioctl
 calls DMX_SET_FILTER or DMX_SET_PES_FILTER.</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>SYNOPSIS
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>int ioctl( int fd, int request = DMX_START);</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>PARAMETERS
</para>
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>int fd</para>
</entry><entry
 align="char">
<para>File descriptor returned by a previous call to open().</para>
</entry>
 </row><row><entry
 align="char">
<para>int request</para>
</entry><entry
 align="char">
<para>Equals DMX_START for this command.</para>
</entry>
 </row></tbody></tgroup></informaltable>
&return-value-dvb;
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>EINVAL</para>
</entry><entry
 align="char">
<para>Invalid argument, i.e. no filtering parameters provided via
 the DMX_SET_FILTER or DMX_SET_PES_FILTER
 functions.</para>
</entry>
 </row><row><entry
 align="char">
<para>EBUSY</para>
</entry><entry
 align="char">
<para>This error code indicates that there are conflicting
 requests. There are active filters filtering data from
 another input source. Make sure that these filters are
 stopped before starting this filter.</para>
</entry>
 </row></tbody></tgroup></informaltable>
</section>

<section id="DMX_STOP">
<title>DMX_STOP</title>
<para>DESCRIPTION
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>This ioctl call is used to stop the actual filtering operation defined via the
 ioctl calls DMX_SET_FILTER or DMX_SET_PES_FILTER and started via
 the DMX_START command.</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>SYNOPSIS
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>int ioctl( int fd, int request = DMX_STOP);</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>PARAMETERS
</para>
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>int fd</para>
</entry><entry
 align="char">
<para>File descriptor returned by a previous call to open().</para>
</entry>
 </row><row><entry
 align="char">
<para>int request</para>
</entry><entry
 align="char">
<para>Equals DMX_STOP for this command.</para>
</entry>
 </row></tbody></tgroup></informaltable>
&return-value-dvb;
</section>

<section id="DMX_SET_FILTER">
<title>DMX_SET_FILTER</title>
<para>DESCRIPTION
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>This ioctl call sets up a filter according to the filter and mask parameters
 provided. A timeout may be defined stating number of seconds to wait for a
 section to be loaded. A value of 0 means that no timeout should be applied.
 Finally there is a flag field where it is possible to state whether a section should
 be CRC-checked, whether the filter should be a &#8221;one-shot&#8221; filter, i.e. if the
 filtering operation should be stopped after the first section is received, and
 whether the filtering operation should be started immediately (without waiting
 for a DMX_START ioctl call). If a filter was previously set-up, this filter will
 be canceled, and the receive buffer will be flushed.</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>SYNOPSIS
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>int ioctl( int fd, int request = DMX_SET_FILTER,
 struct dmx_sct_filter_params &#x22C6;params);</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>PARAMETERS
</para>
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>int fd</para>
</entry><entry
 align="char">
<para>File descriptor returned by a previous call to open().</para>
</entry>
 </row><row><entry
 align="char">
<para>int request</para>
</entry><entry
 align="char">
<para>Equals DMX_SET_FILTER for this command.</para>
</entry>
 </row><row><entry
 align="char">
<para>struct
 dmx_sct_filter_params
 *params</para>
</entry><entry
 align="char">
<para>Pointer to structure containing filter parameters.</para>
</entry>
 </row></tbody></tgroup></informaltable>
&return-value-dvb;
</section>

<section id="DMX_SET_PES_FILTER">
<title>DMX_SET_PES_FILTER</title>
<para>DESCRIPTION
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>This ioctl call sets up a PES filter according to the parameters provided. By a
 PES filter is meant a filter that is based just on the packet identifier (PID), i.e.
 no PES header or payload filtering capability is supported.</para>
</entry>
 </row><row><entry
 align="char">
<para>The transport stream destination for the filtered output may be set. Also the
 PES type may be stated in order to be able to e.g. direct a video stream directly
 to the video decoder. Finally there is a flag field where it is possible to state
 whether the filtering operation should be started immediately (without waiting
 for a DMX_START ioctl call). If a filter was previously set-up, this filter will
 be cancelled, and the receive buffer will be flushed.</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>SYNOPSIS
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>int ioctl( int fd, int request = DMX_SET_PES_FILTER,
 struct dmx_pes_filter_params &#x22C6;params);</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>PARAMETERS
</para>
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>int fd</para>
</entry><entry
 align="char">
<para>File descriptor returned by a previous call to open().</para>
</entry>
 </row><row><entry
 align="char">
<para>int request</para>
</entry><entry
 align="char">
<para>Equals DMX_SET_PES_FILTER for this command.</para>
</entry>
 </row><row><entry
 align="char">
<para>struct
 dmx_pes_filter_params
 *params</para>
</entry><entry
 align="char">
<para>Pointer to structure containing filter parameters.</para>
</entry>
 </row></tbody></tgroup></informaltable>
&return-value-dvb;
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>EBUSY</para>
</entry><entry
 align="char">
<para>This error code indicates that there are conflicting
 requests. There are active filters filtering data from
 another input source. Make sure that these filters are
 stopped before starting this filter.</para>
</entry>
 </row></tbody></tgroup></informaltable>
</section>

<section id="DMX_SET_BUFFER_SIZE">
<title>DMX_SET_BUFFER_SIZE</title>
<para>DESCRIPTION
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>This ioctl call is used to set the size of the circular buffer used for filtered data.
 The default size is two maximum sized sections, i.e. if this function is not called
 a buffer size of 2 * 4096 bytes will be used.</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>SYNOPSIS
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>int ioctl( int fd, int request =
 DMX_SET_BUFFER_SIZE, unsigned long size);</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>PARAMETERS
</para>
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>int fd</para>
</entry><entry
 align="char">
<para>File descriptor returned by a previous call to open().</para>
</entry>
 </row><row><entry
 align="char">
<para>int request</para>
</entry><entry
 align="char">
<para>Equals DMX_SET_BUFFER_SIZE for this command.</para>
</entry>
 </row><row><entry
 align="char">
<para>unsigned long size</para>
</entry><entry
 align="char">
<para>Size of circular buffer.</para>
</entry>
 </row></tbody></tgroup></informaltable>
&return-value-dvb;
</section>

<section id="DMX_GET_EVENT">
<title>DMX_GET_EVENT</title>
<para>DESCRIPTION
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>This ioctl call returns an event if available. If an event is not available,
 the behavior depends on whether the device is in blocking or non-blocking
 mode. In the latter case, the call fails immediately with errno set to
 EWOULDBLOCK. In the former case, the call blocks until an event becomes
 available.</para>
</entry>
 </row><row><entry
 align="char">
<para>The standard Linux poll() and/or select() system calls can be used with the
 device file descriptor to watch for new events. For select(), the file descriptor
 should be included in the exceptfds argument, and for poll(), POLLPRI should
 be specified as the wake-up condition. Only the latest event for each filter is
 saved.</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>SYNOPSIS
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>int ioctl( int fd, int request = DMX_GET_EVENT,
 struct dmx_event &#x22C6;ev);</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>PARAMETERS
</para>
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>int fd</para>
</entry><entry
 align="char">
<para>File descriptor returned by a previous call to open().</para>
</entry>
 </row><row><entry
 align="char">
<para>int request</para>
</entry><entry
 align="char">
<para>Equals DMX_GET_EVENT for this command.</para>
</entry>
 </row><row><entry
 align="char">
<para>struct dmx_event *ev</para>
</entry><entry
 align="char">
<para>Pointer to the location where the event is to be stored.</para>
</entry>
 </row></tbody></tgroup></informaltable>
&return-value-dvb;
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>EWOULDBLOCK</para>
</entry><entry
 align="char">
<para>There is no event pending, and the device is in
 non-blocking mode.</para>
</entry>
 </row></tbody></tgroup></informaltable>
</section>

<section id="DMX_GET_STC">
<title>DMX_GET_STC</title>
<para>DESCRIPTION
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>This ioctl call returns the current value of the system time counter (which is driven
 by a PES filter of type DMX_PES_PCR). Some hardware supports more than one
 STC, so you must specify which one by setting the num field of stc before the ioctl
 (range 0...n). The result is returned in form of a ratio with a 64 bit numerator
 and a 32 bit denominator, so the real 90kHz STC value is stc-&#x003E;stc /
 stc-&#x003E;base
 .</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>SYNOPSIS
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>int ioctl( int fd, int request = DMX_GET_STC, struct
 dmx_stc &#x22C6;stc);</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>PARAMETERS
</para>
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>int fd</para>
</entry><entry
 align="char">
<para>File descriptor returned by a previous call to open().</para>
</entry>
 </row><row><entry
 align="char">
<para>int request</para>
</entry><entry
 align="char">
<para>Equals DMX_GET_STC for this command.</para>
</entry>
 </row><row><entry
 align="char">
<para>struct dmx_stc *stc</para>
</entry><entry
 align="char">
<para>Pointer to the location where the stc is to be stored.</para>
</entry>
 </row></tbody></tgroup></informaltable>
&return-value-dvb;
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>EINVAL</para>
</entry><entry
 align="char">
<para>Invalid stc number.</para>
</entry>
 </row></tbody></tgroup></informaltable>
 </section>

<section id="DMX_GET_PES_PIDS"
role="subsection"><title>DMX_GET_PES_PIDS</title>
<para>DESCRIPTION
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>This ioctl is undocumented. Documentation is welcome.</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>SYNOPSIS
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>int ioctl(fd, int request = DMX_GET_PES_PIDS,
 __u16[5]);</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>PARAMETERS
</para>
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>int fd</para>
</entry><entry
 align="char">
<para>File descriptor returned by a previous call to open().</para>
</entry>
 </row><row><entry
 align="char">
<para>int request</para>
</entry><entry
 align="char">
<para>Equals DMX_GET_PES_PIDS for this command.</para>
</entry>
 </row><row><entry
 align="char">
<para>__u16[5]
</para>
</entry><entry
 align="char">
<para>Undocumented.</para>
</entry>
 </row></tbody></tgroup></informaltable>
&return-value-dvb;
</section>

<section id="DMX_GET_CAPS"
role="subsection"><title>DMX_GET_CAPS</title>
<para>DESCRIPTION
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>This ioctl is undocumented. Documentation is welcome.</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>SYNOPSIS
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>int ioctl(fd, int request = DMX_GET_CAPS,
 dmx_caps_t *);</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>PARAMETERS
</para>
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>int fd</para>
</entry><entry
 align="char">
<para>File descriptor returned by a previous call to open().</para>
</entry>
 </row><row><entry
 align="char">
<para>int request</para>
</entry><entry
 align="char">
<para>Equals DMX_GET_CAPS for this command.</para>
</entry>
 </row><row><entry
 align="char">
<para>dmx_caps_t *
</para>
</entry><entry
 align="char">
<para>Undocumented.</para>
</entry>
 </row></tbody></tgroup></informaltable>
&return-value-dvb;
</section>

<section id="DMX_SET_SOURCE"
role="subsection"><title>DMX_SET_SOURCE</title>
<para>DESCRIPTION
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>This ioctl is undocumented. Documentation is welcome.</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>SYNOPSIS
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>int ioctl(fd, int request = DMX_SET_SOURCE,
 dmx_source_t *);</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>PARAMETERS
</para>
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>int fd</para>
</entry><entry
 align="char">
<para>File descriptor returned by a previous call to open().</para>
</entry>
 </row><row><entry
 align="char">
<para>int request</para>
</entry><entry
 align="char">
<para>Equals DMX_SET_SOURCE for this command.</para>
</entry>
 </row><row><entry
 align="char">
<para>dmx_source_t *
</para>
</entry><entry
 align="char">
<para>Undocumented.</para>
</entry>
 </row></tbody></tgroup></informaltable>
&return-value-dvb;
</section>

<section id="DMX_ADD_PID"
role="subsection"><title>DMX_ADD_PID</title>
<para>DESCRIPTION
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>This ioctl is undocumented. Documentation is welcome.</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>SYNOPSIS
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>int ioctl(fd, int request = DMX_ADD_PID,
 __u16 *);</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>PARAMETERS
</para>
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>int fd</para>
</entry><entry
 align="char">
<para>File descriptor returned by a previous call to open().</para>
</entry>
 </row><row><entry
 align="char">
<para>int request</para>
</entry><entry
 align="char">
<para>Equals DMX_ADD_PID for this command.</para>
</entry>
 </row><row><entry
 align="char">
<para>__u16 *
</para>
</entry><entry
 align="char">
<para>Undocumented.</para>
</entry>
 </row></tbody></tgroup></informaltable>
&return-value-dvb;
</section>

<section id="DMX_REMOVE_PID"
role="subsection"><title>DMX_REMOVE_PID</title>
<para>DESCRIPTION
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>This ioctl is undocumented. Documentation is welcome.</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>SYNOPSIS
</para>
<informaltable><tgroup cols="1"><tbody><row><entry
 align="char">
<para>int ioctl(fd, int request = DMX_REMOVE_PID,
 __u16 *);</para>
</entry>
 </row></tbody></tgroup></informaltable>
<para>PARAMETERS
</para>
<informaltable><tgroup cols="2"><tbody><row><entry
 align="char">
<para>int fd</para>
</entry><entry
 align="char">
<para>File descriptor returned by a previous call to open().</para>
</entry>
 </row><row><entry
 align="char">
<para>int request</para>
</entry><entry
 align="char">
<para>Equals DMX_REMOVE_PID for this command.</para>
</entry>
 </row><row><entry
 align="char">
<para>__u16 *
</para>
</entry><entry
 align="char">
<para>Undocumented.</para>
</entry>
 </row></tbody></tgroup></informaltable>
&return-value-dvb;
</section>


</section>