![]() |
TSDuck v3.43-4480
MPEG Transport Stream Toolkit
|
General-purpose implementation of a digital TV tuner. More...
#include <tsTuner.h>


Public Member Functions | |
| Tuner (DuckContext &duck) | |
| Constructor. | |
| Tuner (DuckContext &duck, const UString &device_name, bool info_only) | |
| Constructor and open device name. | |
| virtual | ~Tuner () override |
| Destructor. | |
| virtual void | abort (bool silent=false) override |
| Abort any pending or blocked reception. | |
| virtual bool | close (bool silent=false) override |
| Close the tuner. | |
| virtual const DeliverySystemSet & | deliverySystems () const override |
| Set of delivery systems which are supported by the tuner. | |
| virtual UString | deviceInfo () const override |
| Device-specific information. | |
| virtual UString | deviceName () const override |
| Get the device name of the tuner. | |
| virtual UString | devicePath () const override |
| System-specific device path (for information only). | |
| virtual std::ostream & | displayStatus (std::ostream &strm, const UString &margin=UString(), bool extended=false) override |
| Display the characteristics and status of the tuner. | |
| virtual bool | getCurrentTuning (ModulationArgs ¶ms, bool reset_unknown) override |
| Get the current tuning parameters. | |
| virtual bool | getSignalState (SignalState &state) override |
| Check if a signal is present and get the signal state. | |
| virtual bool | infoOnly () const override |
| Get the open mode. | |
| virtual bool | isOpen () const override |
| Check if the tuner is open. | |
| virtual bool | open (const UString &device_name, bool info_only) override |
| Open the tuner. | |
| virtual size_t | receive (TSPacket *buffer, size_t max_packets, const AbortInterface *abort=nullptr) override |
| Receive packets. | |
| virtual cn::milliseconds | receiveTimeout () const override |
| Get the timeout for receive operation. | |
| Report & | report () const |
| Get a reference to the error report. | |
| virtual void | setDemuxBufferSize (size_t s) override |
| Set the demux buffer size in bytes (Linux-specific). | |
| virtual void | setReceiverFilterName (const UString &name) override |
| Specify a receiver filter name (Windows-specific). | |
| virtual bool | setReceiveTimeout (cn::milliseconds t) override |
| Set the timeout for receive operations. | |
| virtual void | setSignalPoll (cn::milliseconds t) override |
| Set the poll interval for signal timeout (Linux-specific). | |
| virtual void | setSignalTimeout (cn::milliseconds t) override |
| Set the timeout before getting a signal on start. | |
| virtual void | setSignalTimeoutSilent (bool silent) override |
| Set if an error should be reported on timeout before getting a signal on start. | |
| virtual void | setSinkQueueSize (size_t s) override |
| Set the max number of queued media samples (Windows-specific). | |
| virtual bool | start () override |
| Start receiving packets. | |
| virtual bool | stop (bool silent=false) override |
| Stop receiving packets. | |
| virtual bool | tune (ModulationArgs ¶ms) override |
| Tune to the specified parameters. | |
Static Public Member Functions | |
| static bool | GetAllTuners (DuckContext &duck, TunerPtrVector &tuners) |
| Get the list of all existing physical tuners. | |
Static Public Attributes | |
| static constexpr size_t | DEFAULT_DEMUX_BUFFER_SIZE = 1024 * 1024 |
| Default demux buffer size in bytes (Linux-specific). | |
| static constexpr cn::milliseconds | DEFAULT_SIGNAL_POLL = cn::milliseconds(100) |
| Default poll interval for signal timeout (Linux-specific). | |
| static constexpr cn::milliseconds | DEFAULT_SIGNAL_TIMEOUT = cn::seconds(5) |
| Default timeout before getting a signal on start. | |
| static constexpr size_t | DEFAULT_SINK_QUEUE_SIZE = 1000 |
| Default max number of queued media samples (Windows-specific). | |
Protected Member Functions | |
| bool | checkTuneParameters (ModulationArgs ¶ms) const |
| Check the consistency of tune() parameters. | |
| bool | unimplemented () const |
| Helper for unimplemented methods. | |
Protected Attributes | |
| DuckContext & | _duck |
| TSDuck execution context for subclasses. | |
General-purpose implementation of a digital TV tuner.
This class encapsulates physical tuners and file-based tuner emulators. When a "tuner name" is an XML file (a file path ending in ".xml"), the tuner emulator is used. Otherwise, a physical tuner is used.
The syntax of a physical tuner "device name" depends on the operating system.
Linux:
Windows:
| ts::Tuner::Tuner | ( | DuckContext & | duck | ) |
Constructor.
| [in,out] | duck | TSDuck execution context. |
| ts::Tuner::Tuner | ( | DuckContext & | duck, |
| const UString & | device_name, | ||
| bool | info_only | ||
| ) |
Constructor and open device name.
| [in,out] | duck | TSDuck execution context. |
| [in] | device_name | Tuner device name. If the name is empty, use the "first" or "default" tuner. If the name is a file path ending in ".xml", a tuner emulator is used. |
| [in] | info_only | If true, we will only fetch the properties of the tuner, we won't use it to receive streams. Thus, it is possible to open tuners which are already used to actually receive a stream. |
|
overridevirtual |
Open the tuner.
| [in] | device_name | Tuner device name. If name is empty, use "first" or "default" tuner. |
| [in] | info_only | If true, we will only fetch the properties of the tuner, we won't use it to receive streams. Thus, it is possible to open tuners which are already used to actually receive a stream. |
Reimplemented from ts::TunerBase.
|
overridevirtual |
Close the tuner.
| [in] | silent | When true, do not report close errors. |
Reimplemented from ts::TunerBase.
|
overridevirtual |
|
overridevirtual |
Get the open mode.
Reimplemented from ts::TunerBase.
|
overridevirtual |
Set of delivery systems which are supported by the tuner.
Reimplemented from ts::TunerBase.
|
overridevirtual |
Get the device name of the tuner.
Reimplemented from ts::TunerBase.
|
overridevirtual |
Device-specific information.
Reimplemented from ts::TunerBase.
|
overridevirtual |
System-specific device path (for information only).
Reimplemented from ts::TunerBase.
|
overridevirtual |
Check if a signal is present and get the signal state.
| [out] | state | Returned state of the tuner. Some fields may be unset if unavailable with that tuner. |
Reimplemented from ts::TunerBase.
|
overridevirtual |
Tune to the specified parameters.
| [in,out] | params | Tuning parameters. Updated with missing default values. |
Reimplemented from ts::TunerBase.
|
overridevirtual |
|
overridevirtual |
Stop receiving packets.
| [in] | silent | When true, do not report close errors. |
Reimplemented from ts::TunerBase.
|
overridevirtual |
Abort any pending or blocked reception.
This unblocks a blocked reader but leaves the tuner in an undefined state. The only safe option after this is a close().
| [in] | silent | When true, do not report close errors. |
Reimplemented from ts::TunerBase.
|
overridevirtual |
Receive packets.
| [out] | buffer | Address of TS packet receive buffer. Read only complete 188-byte TS packets. |
| [in] | max_packets | Maximum number of packets to read in buffer. |
| [in] | abort | If non-zero, invoked when I/O is interrupted (in case of user-interrupt, return, otherwise retry). |
Reimplemented from ts::TunerBase.
|
overridevirtual |
Get the current tuning parameters.
| [in,out] | params | Returned tuning parameters. Modify only the properties which can be reported by the tuner. |
| [in] | reset_unknown | If true, the unknown values (those which are not reported by the tuner) are reset to unknown/zero/auto values. Otherwise, they are left unmodified. |
Reimplemented from ts::TunerBase.
|
overridevirtual |
Set the timeout before getting a signal on start.
If zero, do not wait for signal on start. Must be set before start().
| [in] | t | Number of milliseconds to wait after start() before receiving a signal. |
Reimplemented from ts::TunerBase.
|
overridevirtual |
Set if an error should be reported on timeout before getting a signal on start.
Must be set before start().
| [in] | silent | If true, no error message will be reported if no signal is received after the timeout on start. |
Reimplemented from ts::TunerBase.
|
overridevirtual |
Set the timeout for receive operations.
| [in] | t | Number of milliseconds to wait before receiving packets in a receive() operation. If zero (the default), no timeout is applied. |
Reimplemented from ts::TunerBase.
|
overridevirtual |
Get the timeout for receive operation.
Reimplemented from ts::TunerBase.
|
overridevirtual |
Set the poll interval for signal timeout (Linux-specific).
Must be set before start(). This is a Linux-specific method which does nothing on other systems.
| [in] | t | Poll interval in milliseconds. |
Reimplemented from ts::TunerBase.
|
overridevirtual |
Set the demux buffer size in bytes (Linux-specific).
Must be set before start(). This is a Linux-specific method which does nothing on other systems.
| [in] | s | The demux buffer size in bytes. |
Reimplemented from ts::TunerBase.
|
overridevirtual |
Set the max number of queued media samples (Windows-specific).
Must be set before start(). This is a Windows-specific method which does nothing on other systems.
| [in] | s | Max number of media samples in the queue between the graph thread and the application thread. |
Reimplemented from ts::TunerBase.
|
overridevirtual |
Specify a receiver filter name (Windows-specific).
Must be set before open(). This is a Windows-specific method which does nothing on other systems.
| [in] | name | Name of the receiver filter to use. The DirectShow graph will use the specified receiver filter instead of the standard search algorithm. |
Reimplemented from ts::TunerBase.
|
overridevirtual |
Display the characteristics and status of the tuner.
| [in,out] | strm | Output text stream. |
| [in] | margin | Left margin to display. |
| [in] | extended | Display "extended" information. Can be very verbose. |
Reimplemented from ts::TunerBase.
|
staticinherited |
Get the list of all existing physical tuners.
| [in,out] | duck | TSDuck execution context. |
| [out] | tuners | Returned list of physical tuners on the system. |
|
inlineinherited |
Get a reference to the error report.
|
protectedinherited |
Check the consistency of tune() parameters.
| [in,out] | params | Modulation parameters. Updated with default values. |
|
protectedinherited |
Helper for unimplemented methods.
Display a standard error message.
|
staticconstexprinherited |
Default max number of queued media samples (Windows-specific).