![]() |
TSDuck v3.43-4480
MPEG Transport Stream Toolkit
|
Base class for Digital TV tuners. More...
#include <tsTunerBase.h>


Public Member Functions | |
| TunerBase (DuckContext &duck) | |
| Constructor. | |
| virtual | ~TunerBase () |
| Virtual destructor. | |
| virtual void | abort (bool silent=false) |
| Abort any pending or blocked reception. | |
| virtual bool | close (bool silent=false) |
| Close the tuner. | |
| virtual const DeliverySystemSet & | deliverySystems () const |
| Set of delivery systems which are supported by the tuner. | |
| virtual UString | deviceInfo () const |
| Device-specific information. | |
| virtual UString | deviceName () const |
| Get the device name of the tuner. | |
| virtual UString | devicePath () const |
| System-specific device path (for information only). | |
| virtual std::ostream & | displayStatus (std::ostream &strm, const UString &margin=UString(), bool extended=false) |
| Display the characteristics and status of the tuner. | |
| virtual bool | getCurrentTuning (ModulationArgs ¶ms, bool reset_unknown) |
| Get the current tuning parameters. | |
| virtual bool | getSignalState (SignalState &state) |
| Check if a signal is present and get the signal state. | |
| virtual bool | infoOnly () const |
| Get the open mode. | |
| virtual bool | isOpen () const |
| Check if the tuner is open. | |
| virtual bool | open (const UString &device_name, bool info_only) |
| Open the tuner. | |
| virtual size_t | receive (TSPacket *buffer, size_t max_packets, const AbortInterface *abort=nullptr) |
| Receive packets. | |
| virtual cn::milliseconds | receiveTimeout () const |
| Get the timeout for receive operation. | |
| Report & | report () const |
| Get a reference to the error report. | |
| virtual void | setDemuxBufferSize (size_t s) |
| Set the demux buffer size in bytes (Linux-specific). | |
| virtual void | setReceiverFilterName (const UString &name) |
| Specify a receiver filter name (Windows-specific). | |
| virtual bool | setReceiveTimeout (cn::milliseconds t) |
| Set the timeout for receive operations. | |
| virtual void | setSignalPoll (cn::milliseconds t) |
| Set the poll interval for signal timeout (Linux-specific). | |
| virtual void | setSignalTimeout (cn::milliseconds t) |
| Set the timeout before getting a signal on start. | |
| virtual void | setSignalTimeoutSilent (bool silent) |
| Set if an error should be reported on timeout before getting a signal on start. | |
| virtual void | setSinkQueueSize (size_t s) |
| Set the max number of queued media samples (Windows-specific). | |
| virtual bool | start () |
| Start receiving packets. | |
| virtual bool | stop (bool silent=false) |
| Stop receiving packets. | |
| virtual bool | tune (ModulationArgs ¶ms) |
| 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. | |
Base class for Digital TV tuners.
The TunerBase class defines all virtual methods to access a tuner. All services in the base class are "unimplemented" and return an error. Actual services should be implemented by subclasses.
The main subclasses are TunerDevice which implements a physical tuner, TunerEmulator which implements a file-based fake tuner and Tuner which encapsulates both capabilities.
A note on history: In older versions of TSDuck, a tuner had a single "type" (DVT-T, DVB-S, etc.). There was also a specific subclass of tuner parameters for each type of tuner. With the advent of multi-standard tuners (DVB-T and DVB-C for instance), this was no longer appropriate. Now, each tuner device has a set of supported delivery systems. There is one single class containing all tuning parameters for all delivery systems. The selected delivery system is one of these parameter. To tune a device, we now provide an instance of the ModulationArgs class. If the tuner supports the target delivery system, it picks the appropriate parameters for the selected delivery system.
| ts::TunerBase::TunerBase | ( | DuckContext & | duck | ) |
Constructor.
| [in,out] | duck | TSDuck execution context. |
|
static |
Get the list of all existing physical tuners.
| [in,out] | duck | TSDuck execution context. |
| [out] | tuners | Returned list of physical tuners on the system. |
|
virtual |
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 in ts::TunerDevice, ts::Tuner, ts::TunerEmulator, and ts::TunerDevice.
|
virtual |
Close the tuner.
| [in] | silent | When true, do not report close errors. |
Reimplemented in ts::TunerDevice, ts::Tuner, ts::TunerEmulator, and ts::TunerDevice.
|
virtual |
Check if the tuner is open.
Reimplemented in ts::TunerDevice, ts::Tuner, ts::TunerEmulator, and ts::TunerDevice.
|
virtual |
Get the open mode.
Reimplemented in ts::TunerDevice, ts::Tuner, ts::TunerEmulator, and ts::TunerDevice.
|
virtual |
Set of delivery systems which are supported by the tuner.
Reimplemented in ts::TunerDevice, ts::Tuner, ts::TunerEmulator, and ts::TunerDevice.
|
virtual |
Get the device name of the tuner.
Reimplemented in ts::TunerDevice, ts::Tuner, ts::TunerEmulator, and ts::TunerDevice.
|
virtual |
Device-specific information.
Reimplemented in ts::TunerDevice, ts::Tuner, ts::TunerEmulator, and ts::TunerDevice.
|
virtual |
System-specific device path (for information only).
Reimplemented in ts::TunerDevice, ts::Tuner, ts::TunerEmulator, and ts::TunerDevice.
|
virtual |
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 in ts::TunerDevice, ts::Tuner, ts::TunerEmulator, and ts::TunerDevice.
|
virtual |
Tune to the specified parameters.
| [in,out] | params | Tuning parameters. Updated with missing default values. |
Reimplemented in ts::TunerDevice, ts::Tuner, ts::TunerEmulator, and ts::TunerDevice.
|
virtual |
Start receiving packets.
Reimplemented in ts::TunerDevice, ts::Tuner, ts::TunerEmulator, and ts::TunerDevice.
|
virtual |
Stop receiving packets.
| [in] | silent | When true, do not report close errors. |
Reimplemented in ts::TunerDevice, ts::Tuner, ts::TunerEmulator, and ts::TunerDevice.
|
virtual |
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 in ts::TunerDevice, ts::Tuner, and ts::TunerDevice.
|
virtual |
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 in ts::TunerDevice, ts::Tuner, ts::TunerEmulator, and ts::TunerDevice.
|
virtual |
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 in ts::TunerDevice, ts::Tuner, ts::TunerEmulator, and ts::TunerDevice.
|
virtual |
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 in ts::TunerDevice, ts::Tuner, and ts::TunerDevice.
|
virtual |
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 in ts::TunerDevice, ts::Tuner, and ts::TunerDevice.
|
virtual |
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 in ts::TunerDevice, ts::Tuner, and ts::TunerDevice.
|
virtual |
Get the timeout for receive operation.
Reimplemented in ts::TunerDevice, ts::Tuner, and ts::TunerDevice.
|
virtual |
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 in ts::TunerDevice, and ts::Tuner.
|
virtual |
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 in ts::TunerDevice, and ts::Tuner.
|
virtual |
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 in ts::Tuner, and ts::TunerDevice.
|
virtual |
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 in ts::Tuner, and ts::TunerDevice.
|
virtual |
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 in ts::TunerDevice, ts::Tuner, ts::TunerEmulator, and ts::TunerDevice.
|
inline |
Get a reference to the error report.
|
protected |
Check the consistency of tune() parameters.
| [in,out] | params | Modulation parameters. Updated with default values. |
|
protected |
Helper for unimplemented methods.
Display a standard error message.
|
staticconstexpr |
Default max number of queued media samples (Windows-specific).