Path: blob/master/Documentation/DocBook/dvb/demux.xml
10821 views
<title>DVB Demux Device</title>12<para>The DVB demux device controls the filters of the DVB hardware/software. It can be3accessed through <emphasis role="tt">/dev/adapter0/demux0</emphasis>. Data types and and ioctl definitions can be4accessed by including <emphasis role="tt">linux/dvb/dmx.h</emphasis> in your application.5</para>6<section id="dmx_types">7<title>Demux Data Types</title>89<section id="dmx_output_t">10<title>dmx_output_t</title>11<programlisting>12typedef enum13{14DMX_OUT_DECODER,15DMX_OUT_TAP,16DMX_OUT_TS_TAP17} dmx_output_t;18</programlisting>19<para><emphasis role="tt">DMX_OUT_TAP</emphasis> delivers the stream output to the demux device on which the ioctl is20called.21</para>22<para><emphasis role="tt">DMX_OUT_TS_TAP</emphasis> routes output to the logical DVR device <emphasis role="tt">/dev/dvb/adapter0/dvr0</emphasis>,23which delivers a TS multiplexed from all filters for which <emphasis role="tt">DMX_OUT_TS_TAP</emphasis> was24specified.25</para>26</section>2728<section id="dmx_input_t">29<title>dmx_input_t</title>30<programlisting>31typedef enum32{33DMX_IN_FRONTEND,34DMX_IN_DVR35} dmx_input_t;36</programlisting>37</section>3839<section id="dmx_pes_type_t">40<title>dmx_pes_type_t</title>41<programlisting>42typedef enum43{44DMX_PES_AUDIO,45DMX_PES_VIDEO,46DMX_PES_TELETEXT,47DMX_PES_SUBTITLE,48DMX_PES_PCR,49DMX_PES_OTHER50} dmx_pes_type_t;51</programlisting>52</section>5354<section id="dmx_event_t">55<title>dmx_event_t</title>56<programlisting>57typedef enum58{59DMX_SCRAMBLING_EV,60DMX_FRONTEND_EV61} dmx_event_t;62</programlisting>63</section>6465<section id="dmx_scrambling_status_t">66<title>dmx_scrambling_status_t</title>67<programlisting>68typedef enum69{70DMX_SCRAMBLING_OFF,71DMX_SCRAMBLING_ON72} dmx_scrambling_status_t;73</programlisting>74</section>7576<section id="dmx_filter">77<title>struct dmx_filter</title>78<programlisting>79typedef struct dmx_filter80{81uint8_t filter[DMX_FILTER_SIZE];82uint8_t mask[DMX_FILTER_SIZE];83} dmx_filter_t;84</programlisting>85</section>8687<section id="dmx_sct_filter_params">88<title>struct dmx_sct_filter_params</title>89<programlisting>90struct dmx_sct_filter_params91{92uint16_t pid;93dmx_filter_t filter;94uint32_t timeout;95uint32_t flags;96#define DMX_CHECK_CRC 197#define DMX_ONESHOT 298#define DMX_IMMEDIATE_START 499};100</programlisting>101</section>102103<section id="dmx_pes_filter_params">104<title>struct dmx_pes_filter_params</title>105<programlisting>106struct dmx_pes_filter_params107{108uint16_t pid;109dmx_input_t input;110dmx_output_t output;111dmx_pes_type_t pes_type;112uint32_t flags;113};114</programlisting>115</section>116117<section id="dmx_event">118<title>struct dmx_event</title>119<programlisting>120struct dmx_event121{122dmx_event_t event;123time_t timeStamp;124union125{126dmx_scrambling_status_t scrambling;127} u;128};129</programlisting>130</section>131132<section id="dmx_stc">133<title>struct dmx_stc</title>134<programlisting>135struct dmx_stc {136unsigned int num; /⋆ input : which STC? 0..N ⋆/137unsigned int base; /⋆ output: divisor for stc to get 90 kHz clock ⋆/138uint64_t stc; /⋆ output: stc in 'base'⋆90 kHz units ⋆/139};140</programlisting>141</section>142143</section>144145<section id="dmx_fcalls">146<title>Demux Function Calls</title>147148<section id="dmx_fopen">149<title>open()</title>150<para>DESCRIPTION151</para>152<informaltable><tgroup cols="1"><tbody><row><entry153align="char">154<para>This system call, used with a device name of /dev/dvb/adapter0/demux0,155allocates a new filter and returns a handle which can be used for subsequent156control of that filter. This call has to be made for each filter to be used, i.e. every157returned file descriptor is a reference to a single filter. /dev/dvb/adapter0/dvr0158is a logical device to be used for retrieving Transport Streams for digital159video recording. When reading from this device a transport stream containing160the packets from all PES filters set in the corresponding demux device161(/dev/dvb/adapter0/demux0) having the output set to DMX_OUT_TS_TAP. A162recorded Transport Stream is replayed by writing to this device. </para>163<para>The significance of blocking or non-blocking mode is described in the164documentation for functions where there is a difference. It does not affect the165semantics of the open() call itself. A device opened in blocking mode can later166be put into non-blocking mode (and vice versa) using the F_SETFL command167of the fcntl system call.</para>168</entry>169</row></tbody></tgroup></informaltable>170<para>SYNOPSIS171</para>172<informaltable><tgroup cols="1"><tbody><row><entry173align="char">174<para>int open(const char ⋆deviceName, int flags);</para>175</entry>176</row></tbody></tgroup></informaltable>177<para>PARAMETERS178</para>179<informaltable><tgroup cols="2"><tbody><row><entry180align="char">181<para>const char182*deviceName</para>183</entry><entry184align="char">185<para>Name of demux device.</para>186</entry>187</row><row><entry188align="char">189<para>int flags</para>190</entry><entry191align="char">192<para>A bit-wise OR of the following flags:</para>193</entry>194</row><row><entry195align="char">196</entry><entry197align="char">198<para>O_RDWR read/write access</para>199</entry>200</row><row><entry201align="char">202</entry><entry203align="char">204<para>O_NONBLOCK open in non-blocking mode</para>205</entry>206</row><row><entry207align="char">208</entry><entry209align="char">210<para>(blocking mode is the default)</para>211</entry>212</row></tbody></tgroup></informaltable>213<para>ERRORS214</para>215<informaltable><tgroup cols="2"><tbody><row><entry216align="char">217<para>ENODEV</para>218</entry><entry219align="char">220<para>Device driver not loaded/available.</para>221</entry>222</row><row><entry223align="char">224<para>EINVAL</para>225</entry><entry226align="char">227<para>Invalid argument.</para>228</entry>229</row><row><entry230align="char">231<para>EMFILE</para>232</entry><entry233align="char">234<para>“Too many open files”, i.e. no more filters available.</para>235</entry>236</row><row><entry237align="char">238<para>ENOMEM</para>239</entry><entry240align="char">241<para>The driver failed to allocate enough memory.</para>242</entry>243</row></tbody></tgroup></informaltable>244</section>245246<section id="dmx_fclose">247<title>close()</title>248<para>DESCRIPTION249</para>250<informaltable><tgroup cols="1"><tbody><row><entry251align="char">252<para>This system call deactivates and deallocates a filter that was previously253allocated via the open() call.</para>254</entry>255</row></tbody></tgroup></informaltable>256<para>SYNOPSIS257</para>258<informaltable><tgroup cols="1"><tbody><row><entry259align="char">260<para>int close(int fd);</para>261</entry>262</row></tbody></tgroup></informaltable>263<para>PARAMETERS264</para>265<informaltable><tgroup cols="2"><tbody><row><entry266align="char">267<para>int fd</para>268</entry><entry269align="char">270<para>File descriptor returned by a previous call to open().</para>271</entry>272</row></tbody></tgroup></informaltable>273<para>ERRORS274</para>275<informaltable><tgroup cols="2"><tbody><row><entry276align="char">277<para>EBADF</para>278</entry><entry279align="char">280<para>fd is not a valid open file descriptor.</para>281</entry>282</row></tbody></tgroup></informaltable>283</section>284285<section id="dmx_fread">286<title>read()</title>287<para>DESCRIPTION288</para>289<informaltable><tgroup cols="1"><tbody><row><entry290align="char">291<para>This system call returns filtered data, which might be section or PES data. The292filtered data is transferred from the driver’s internal circular buffer to buf. The293maximum amount of data to be transferred is implied by count.</para>294</entry>295</row><row><entry296align="char">297<para>When returning section data the driver always tries to return a complete single298section (even though buf would provide buffer space for more data). If the size299of the buffer is smaller than the section as much as possible will be returned,300and the remaining data will be provided in subsequent calls.</para>301</entry>302</row><row><entry303align="char">304<para>The size of the internal buffer is 2 * 4096 bytes (the size of two maximum305sized sections) by default. The size of this buffer may be changed by using the306DMX_SET_BUFFER_SIZE function. If the buffer is not large enough, or if307the read operations are not performed fast enough, this may result in a buffer308overflow error. In this case EOVERFLOW will be returned, and the circular309buffer will be emptied. This call is blocking if there is no data to return, i.e. the310process will be put to sleep waiting for data, unless the O_NONBLOCK flag311is specified.</para>312</entry>313</row><row><entry314align="char">315<para>Note that in order to be able to read, the filtering process has to be started316by defining either a section or a PES filter by means of the ioctl functions,317and then starting the filtering process via the DMX_START ioctl function318or by setting the DMX_IMMEDIATE_START flag. If the reading is done319from a logical DVR demux device, the data will constitute a Transport Stream320including the packets from all PES filters in the corresponding demux device321/dev/dvb/adapter0/demux0 having the output set to DMX_OUT_TS_TAP.</para>322</entry>323</row></tbody></tgroup></informaltable>324<para>SYNOPSIS325</para>326<informaltable><tgroup cols="1"><tbody><row><entry327align="char">328<para>size_t read(int fd, void ⋆buf, size_t count);</para>329</entry>330</row></tbody></tgroup></informaltable>331<para>PARAMETERS332</para>333<informaltable><tgroup cols="2"><tbody><row><entry334align="char">335<para>int fd</para>336</entry><entry337align="char">338<para>File descriptor returned by a previous call to open().</para>339</entry>340</row><row><entry341align="char">342<para>void *buf</para>343</entry><entry344align="char">345<para>Pointer to the buffer to be used for returned filtered data.</para>346</entry>347</row><row><entry348align="char">349<para>size_t count</para>350</entry><entry351align="char">352<para>Size of buf.</para>353</entry>354</row></tbody></tgroup></informaltable>355<para>ERRORS356</para>357<informaltable><tgroup cols="2"><tbody><row><entry358align="char">359<para>EWOULDBLOCK</para>360</entry><entry361align="char">362<para>No data to return and O_NONBLOCK was specified.</para>363</entry>364</row><row><entry365align="char">366<para>EBADF</para>367</entry><entry368align="char">369<para>fd is not a valid open file descriptor.</para>370</entry>371</row><row><entry372align="char">373<para>ECRC</para>374</entry><entry375align="char">376<para>Last section had a CRC error - no data returned. The377buffer is flushed.</para>378</entry>379</row><row><entry380align="char">381<para>EOVERFLOW</para>382</entry><entry383align="char">384</entry>385</row><row><entry386align="char">387</entry><entry388align="char">389<para>The filtered data was not read from the buffer in due390time, resulting in non-read data being lost. The buffer is391flushed.</para>392</entry>393</row><row><entry394align="char">395<para>ETIMEDOUT</para>396</entry><entry397align="char">398<para>The section was not loaded within the stated timeout399period. See ioctl DMX_SET_FILTER for how to set a400timeout.</para>401</entry>402</row><row><entry403align="char">404<para>EFAULT</para>405</entry><entry406align="char">407<para>The driver failed to write to the callers buffer due to an408invalid *buf pointer.</para>409</entry>410</row></tbody></tgroup></informaltable>411</section>412413<section id="dmx_fwrite">414<title>write()</title>415<para>DESCRIPTION416</para>417<informaltable><tgroup cols="1"><tbody><row><entry418align="char">419<para>This system call is only provided by the logical device /dev/dvb/adapter0/dvr0,420associated with the physical demux device that provides the actual DVR421functionality. It is used for replay of a digitally recorded Transport Stream.422Matching filters have to be defined in the corresponding physical demux423device, /dev/dvb/adapter0/demux0. The amount of data to be transferred is424implied by count.</para>425</entry>426</row></tbody></tgroup></informaltable>427<para>SYNOPSIS428</para>429<informaltable><tgroup cols="1"><tbody><row><entry430align="char">431<para>ssize_t write(int fd, const void ⋆buf, size_t432count);</para>433</entry>434</row></tbody></tgroup></informaltable>435<para>PARAMETERS436</para>437<informaltable><tgroup cols="2"><tbody><row><entry438align="char">439<para>int fd</para>440</entry><entry441align="char">442<para>File descriptor returned by a previous call to open().</para>443</entry>444</row><row><entry445align="char">446<para>void *buf</para>447</entry><entry448align="char">449<para>Pointer to the buffer containing the Transport Stream.</para>450</entry>451</row><row><entry452align="char">453<para>size_t count</para>454</entry><entry455align="char">456<para>Size of buf.</para>457</entry>458</row></tbody></tgroup></informaltable>459<para>ERRORS460</para>461<informaltable><tgroup cols="2"><tbody><row><entry462align="char">463<para>EWOULDBLOCK</para>464</entry><entry465align="char">466<para>No data was written. This467might happen if O_NONBLOCK was specified and there468is no more buffer space available (if O_NONBLOCK is469not specified the function will block until buffer space is470available).</para>471</entry>472</row><row><entry473align="char">474<para>EBUSY</para>475</entry><entry476align="char">477<para>This error code indicates that there are conflicting478requests. The corresponding demux device is setup to479receive data from the front- end. Make sure that these480filters are stopped and that the filters with input set to481DMX_IN_DVR are started.</para>482</entry>483</row><row><entry484align="char">485<para>EBADF</para>486</entry><entry487align="char">488<para>fd is not a valid open file descriptor.</para>489</entry>490</row></tbody></tgroup></informaltable>491</section>492493<section id="dmx_start">494<title>DMX_START</title>495<para>DESCRIPTION496</para>497<informaltable><tgroup cols="1"><tbody><row><entry498align="char">499<para>This ioctl call is used to start the actual filtering operation defined via the ioctl500calls DMX_SET_FILTER or DMX_SET_PES_FILTER.</para>501</entry>502</row></tbody></tgroup></informaltable>503<para>SYNOPSIS504</para>505<informaltable><tgroup cols="1"><tbody><row><entry506align="char">507<para>int ioctl( int fd, int request = DMX_START);</para>508</entry>509</row></tbody></tgroup></informaltable>510<para>PARAMETERS511</para>512<informaltable><tgroup cols="2"><tbody><row><entry513align="char">514<para>int fd</para>515</entry><entry516align="char">517<para>File descriptor returned by a previous call to open().</para>518</entry>519</row><row><entry520align="char">521<para>int request</para>522</entry><entry523align="char">524<para>Equals DMX_START for this command.</para>525</entry>526</row></tbody></tgroup></informaltable>527<para>ERRORS528</para>529<informaltable><tgroup cols="2"><tbody><row><entry530align="char">531<para>EBADF</para>532</entry><entry533align="char">534<para>fd is not a valid file descriptor.</para>535</entry>536</row><row><entry537align="char">538<para>EINVAL</para>539</entry><entry540align="char">541<para>Invalid argument, i.e. no filtering parameters provided via542the DMX_SET_FILTER or DMX_SET_PES_FILTER543functions.</para>544</entry>545</row><row><entry546align="char">547<para>EBUSY</para>548</entry><entry549align="char">550<para>This error code indicates that there are conflicting551requests. There are active filters filtering data from552another input source. Make sure that these filters are553stopped before starting this filter.</para>554</entry>555</row></tbody></tgroup></informaltable>556</section>557558<section id="dmx_stop">559<title>DMX_STOP</title>560<para>DESCRIPTION561</para>562<informaltable><tgroup cols="1"><tbody><row><entry563align="char">564<para>This ioctl call is used to stop the actual filtering operation defined via the565ioctl calls DMX_SET_FILTER or DMX_SET_PES_FILTER and started via566the DMX_START command.</para>567</entry>568</row></tbody></tgroup></informaltable>569<para>SYNOPSIS570</para>571<informaltable><tgroup cols="1"><tbody><row><entry572align="char">573<para>int ioctl( int fd, int request = DMX_STOP);</para>574</entry>575</row></tbody></tgroup></informaltable>576<para>PARAMETERS577</para>578<informaltable><tgroup cols="2"><tbody><row><entry579align="char">580<para>int fd</para>581</entry><entry582align="char">583<para>File descriptor returned by a previous call to open().</para>584</entry>585</row><row><entry586align="char">587<para>int request</para>588</entry><entry589align="char">590<para>Equals DMX_STOP for this command.</para>591</entry>592</row></tbody></tgroup></informaltable>593<para>ERRORS594</para>595<informaltable><tgroup cols="2"><tbody><row><entry596align="char">597<para>EBADF</para>598</entry><entry599align="char">600<para>fd is not a valid file descriptor.</para>601</entry>602</row></tbody></tgroup></informaltable>603</section>604605<section id="dmx_set_filter">606<title>DMX_SET_FILTER</title>607<para>DESCRIPTION608</para>609<informaltable><tgroup cols="1"><tbody><row><entry610align="char">611<para>This ioctl call sets up a filter according to the filter and mask parameters612provided. A timeout may be defined stating number of seconds to wait for a613section to be loaded. A value of 0 means that no timeout should be applied.614Finally there is a flag field where it is possible to state whether a section should615be CRC-checked, whether the filter should be a ”one-shot” filter, i.e. if the616filtering operation should be stopped after the first section is received, and617whether the filtering operation should be started immediately (without waiting618for a DMX_START ioctl call). If a filter was previously set-up, this filter will619be canceled, and the receive buffer will be flushed.</para>620</entry>621</row></tbody></tgroup></informaltable>622<para>SYNOPSIS623</para>624<informaltable><tgroup cols="1"><tbody><row><entry625align="char">626<para>int ioctl( int fd, int request = DMX_SET_FILTER,627struct dmx_sct_filter_params ⋆params);</para>628</entry>629</row></tbody></tgroup></informaltable>630<para>PARAMETERS631</para>632<informaltable><tgroup cols="2"><tbody><row><entry633align="char">634<para>int fd</para>635</entry><entry636align="char">637<para>File descriptor returned by a previous call to open().</para>638</entry>639</row><row><entry640align="char">641<para>int request</para>642</entry><entry643align="char">644<para>Equals DMX_SET_FILTER for this command.</para>645</entry>646</row><row><entry647align="char">648<para>struct649dmx_sct_filter_params650*params</para>651</entry><entry652align="char">653<para>Pointer to structure containing filter parameters.</para>654</entry>655</row></tbody></tgroup></informaltable>656<para>ERRORS657</para>658<informaltable><tgroup cols="2"><tbody><row><entry659align="char">660<para>EBADF</para>661</entry><entry662align="char">663<para>fd is not a valid file descriptor.</para>664</entry>665</row><row><entry666align="char">667<para>EINVAL</para>668</entry><entry669align="char">670<para>Invalid argument.</para>671</entry>672</row></tbody></tgroup></informaltable>673</section>674675<section id="dmx_set_pes_filter">676<title>DMX_SET_PES_FILTER</title>677<para>DESCRIPTION678</para>679<informaltable><tgroup cols="1"><tbody><row><entry680align="char">681<para>This ioctl call sets up a PES filter according to the parameters provided. By a682PES filter is meant a filter that is based just on the packet identifier (PID), i.e.683no PES header or payload filtering capability is supported.</para>684</entry>685</row><row><entry686align="char">687<para>The transport stream destination for the filtered output may be set. Also the688PES type may be stated in order to be able to e.g. direct a video stream directly689to the video decoder. Finally there is a flag field where it is possible to state690whether the filtering operation should be started immediately (without waiting691for a DMX_START ioctl call). If a filter was previously set-up, this filter will692be cancelled, and the receive buffer will be flushed.</para>693</entry>694</row></tbody></tgroup></informaltable>695<para>SYNOPSIS696</para>697<informaltable><tgroup cols="1"><tbody><row><entry698align="char">699<para>int ioctl( int fd, int request = DMX_SET_PES_FILTER,700struct dmx_pes_filter_params ⋆params);</para>701</entry>702</row></tbody></tgroup></informaltable>703<para>PARAMETERS704</para>705<informaltable><tgroup cols="2"><tbody><row><entry706align="char">707<para>int fd</para>708</entry><entry709align="char">710<para>File descriptor returned by a previous call to open().</para>711</entry>712</row><row><entry713align="char">714<para>int request</para>715</entry><entry716align="char">717<para>Equals DMX_SET_PES_FILTER for this command.</para>718</entry>719</row><row><entry720align="char">721<para>struct722dmx_pes_filter_params723*params</para>724</entry><entry725align="char">726<para>Pointer to structure containing filter parameters.</para>727</entry>728</row></tbody></tgroup></informaltable>729<para>ERRORS730</para>731<informaltable><tgroup cols="2"><tbody><row><entry732align="char">733<para>EBADF</para>734</entry><entry735align="char">736<para>fd is not a valid file descriptor.</para>737</entry>738</row><row><entry739align="char">740<para>EINVAL</para>741</entry><entry742align="char">743<para>Invalid argument.</para>744</entry>745</row><row><entry746align="char">747<para>EBUSY</para>748</entry><entry749align="char">750<para>This error code indicates that there are conflicting751requests. There are active filters filtering data from752another input source. Make sure that these filters are753stopped before starting this filter.</para>754</entry>755</row></tbody></tgroup></informaltable>756</section>757758<section id="dms_set_buffer_size">759<title>DMX_SET_BUFFER_SIZE</title>760<para>DESCRIPTION761</para>762<informaltable><tgroup cols="1"><tbody><row><entry763align="char">764<para>This ioctl call is used to set the size of the circular buffer used for filtered data.765The default size is two maximum sized sections, i.e. if this function is not called766a buffer size of 2 * 4096 bytes will be used.</para>767</entry>768</row></tbody></tgroup></informaltable>769<para>SYNOPSIS770</para>771<informaltable><tgroup cols="1"><tbody><row><entry772align="char">773<para>int ioctl( int fd, int request =774DMX_SET_BUFFER_SIZE, unsigned long size);</para>775</entry>776</row></tbody></tgroup></informaltable>777<para>PARAMETERS778</para>779<informaltable><tgroup cols="2"><tbody><row><entry780align="char">781<para>int fd</para>782</entry><entry783align="char">784<para>File descriptor returned by a previous call to open().</para>785</entry>786</row><row><entry787align="char">788<para>int request</para>789</entry><entry790align="char">791<para>Equals DMX_SET_BUFFER_SIZE for this command.</para>792</entry>793</row><row><entry794align="char">795<para>unsigned long size</para>796</entry><entry797align="char">798<para>Size of circular buffer.</para>799</entry>800</row></tbody></tgroup></informaltable>801<para>ERRORS802</para>803<informaltable><tgroup cols="2"><tbody><row><entry804align="char">805<para>EBADF</para>806</entry><entry807align="char">808<para>fd is not a valid file descriptor.</para>809</entry>810</row><row><entry811align="char">812<para>ENOMEM</para>813</entry><entry814align="char">815<para>The driver was not able to allocate a buffer of the816requested size.</para>817</entry>818</row></tbody></tgroup></informaltable>819</section>820821<section id="dmx_get_event">822<title>DMX_GET_EVENT</title>823<para>DESCRIPTION824</para>825<informaltable><tgroup cols="1"><tbody><row><entry826align="char">827<para>This ioctl call returns an event if available. If an event is not available,828the behavior depends on whether the device is in blocking or non-blocking829mode. In the latter case, the call fails immediately with errno set to830EWOULDBLOCK. In the former case, the call blocks until an event becomes831available.</para>832</entry>833</row><row><entry834align="char">835<para>The standard Linux poll() and/or select() system calls can be used with the836device file descriptor to watch for new events. For select(), the file descriptor837should be included in the exceptfds argument, and for poll(), POLLPRI should838be specified as the wake-up condition. Only the latest event for each filter is839saved.</para>840</entry>841</row></tbody></tgroup></informaltable>842<para>SYNOPSIS843</para>844<informaltable><tgroup cols="1"><tbody><row><entry845align="char">846<para>int ioctl( int fd, int request = DMX_GET_EVENT,847struct dmx_event ⋆ev);</para>848</entry>849</row></tbody></tgroup></informaltable>850<para>PARAMETERS851</para>852<informaltable><tgroup cols="2"><tbody><row><entry853align="char">854<para>int fd</para>855</entry><entry856align="char">857<para>File descriptor returned by a previous call to open().</para>858</entry>859</row><row><entry860align="char">861<para>int request</para>862</entry><entry863align="char">864<para>Equals DMX_GET_EVENT for this command.</para>865</entry>866</row><row><entry867align="char">868<para>struct dmx_event *ev</para>869</entry><entry870align="char">871<para>Pointer to the location where the event is to be stored.</para>872</entry>873</row></tbody></tgroup></informaltable>874<para>ERRORS875</para>876<informaltable><tgroup cols="2"><tbody><row><entry877align="char">878<para>EBADF</para>879</entry><entry880align="char">881<para>fd is not a valid file descriptor.</para>882</entry>883</row><row><entry884align="char">885<para>EFAULT</para>886</entry><entry887align="char">888<para>ev points to an invalid address.</para>889</entry>890</row><row><entry891align="char">892<para>EWOULDBLOCK</para>893</entry><entry894align="char">895<para>There is no event pending, and the device is in896non-blocking mode.</para>897</entry>898</row></tbody></tgroup></informaltable>899</section>900901<section id="dmx_get_stc">902<title>DMX_GET_STC</title>903<para>DESCRIPTION904</para>905<informaltable><tgroup cols="1"><tbody><row><entry906align="char">907<para>This ioctl call returns the current value of the system time counter (which is driven908by a PES filter of type DMX_PES_PCR). Some hardware supports more than one909STC, so you must specify which one by setting the num field of stc before the ioctl910(range 0...n). The result is returned in form of a ratio with a 64 bit numerator911and a 32 bit denominator, so the real 90kHz STC value is stc->stc /912stc->base913.</para>914</entry>915</row></tbody></tgroup></informaltable>916<para>SYNOPSIS917</para>918<informaltable><tgroup cols="1"><tbody><row><entry919align="char">920<para>int ioctl( int fd, int request = DMX_GET_STC, struct921dmx_stc ⋆stc);</para>922</entry>923</row></tbody></tgroup></informaltable>924<para>PARAMETERS925</para>926<informaltable><tgroup cols="2"><tbody><row><entry927align="char">928<para>int fd</para>929</entry><entry930align="char">931<para>File descriptor returned by a previous call to open().</para>932</entry>933</row><row><entry934align="char">935<para>int request</para>936</entry><entry937align="char">938<para>Equals DMX_GET_STC for this command.</para>939</entry>940</row><row><entry941align="char">942<para>struct dmx_stc *stc</para>943</entry><entry944align="char">945<para>Pointer to the location where the stc is to be stored.</para>946</entry>947</row></tbody></tgroup></informaltable>948<para>ERRORS949</para>950<informaltable><tgroup cols="2"><tbody><row><entry951align="char">952<para>EBADF</para>953</entry><entry954align="char">955<para>fd is not a valid file descriptor.</para>956</entry>957</row><row><entry958align="char">959<para>EFAULT</para>960</entry><entry961align="char">962<para>stc points to an invalid address.</para>963</entry>964</row><row><entry965align="char">966<para>EINVAL</para>967</entry><entry968align="char">969<para>Invalid stc number.</para>970</entry>971</row></tbody></tgroup></informaltable>972</section></section>973974975