TSDuck Version 3.15-964 (TSDuck - The MPEG Transport Stream Toolkit)
ts::Tuner Class Reference

Implementation of a DVB tuner. More...

Public Member Functions

 Tuner (const UString &device_name=UString())
 Default constructor. More...
 
 Tuner (const UString &device_name, bool info_only, Report &report)
 Constructor and open device name. More...
 
 ~Tuner ()
 Destructor.
 
bool close (Report &report)
 Close the tuner. More...
 
DeliverySystemSet deliverySystems () const
 Set of delivery systems which are supported by the tuner. More...
 
UString deviceInfo () const
 Device-specific information. More...
 
UString deviceName () const
 Get the device name of the tuner. More...
 
std::ostream & displayStatus (std::ostream &strm, const UString &margin, Report &report)
 Display the characteristics and status of the tuner. More...
 
bool getCurrentTuning (TunerParameters &params, bool reset_unknown, Report &report)
 Get the current tuning parameters. More...
 
bool hasDeliverySystem (DeliverySystem ds) const
 Check if the tuner supports the specified delivery system. More...
 
bool infoOnly () const
 Get the open mode. More...
 
bool isOpen () const
 Check if the tuner is open. More...
 
bool open (const UString &device_name, bool info_only, Report &report)
 Open the tuner. More...
 
size_t receive (TSPacket *buffer, size_t max_packets, const AbortInterface *abort, Report &report)
 Receive packets. More...
 
MilliSecond receiveTimeout () const
 Get the timeout for receive operation. More...
 
void setDemuxBufferSize (size_t s)
 Set the demux buffer size in bytes. More...
 
bool setReceiveTimeout (MilliSecond t, Report &report)
 Set the timeout for receive operations. More...
 
void setSignalPoll (MilliSecond t)
 Set the poll interval for signal timeout (Linux-specific). More...
 
void setSignalTimeout (MilliSecond t)
 Set the timeout before getting a signal on start. More...
 
void setSignalTimeoutSilent (bool silent)
 Set if an error should be reported on timeout before getting a signal on start. More...
 
void setSinkQueueSize (size_t s)
 Set the max number of queued media samples (Windows-specific). More...
 
bool signalLocked (Report &report)
 Check if a signal is present and locked. More...
 
int signalQuality (Report &report)
 Get the signal quality. More...
 
int signalStrength (Report &report)
 Get the signal strength. More...
 
bool start (Report &report)
 Start receiving packets. More...
 
bool stop (Report &report)
 Stop receiving packets. More...
 
bool tune (const TunerParameters &params, Report &report)
 Tune to the specified parameters. More...
 
bool tune (DTVProperties &props, Report &report)
 Perform a tune operation (Linux-specific). More...
 
TunerType tunerType () const
 Get the tuner type. More...
 

Static Public Member Functions

static bool GetAllTuners (TunerPtrVector &tuners, Report &report)
 Get the list of all existing DVB tuners. More...
 

Static Public Attributes

static const size_t DEFAULT_DEMUX_BUFFER_SIZE = 1024 * 1024
 Default demux buffer size in bytes (Linux-specific).
 
static const MilliSecond DEFAULT_SIGNAL_POLL = 100
 Default poll interval for signal timeout (Linux-specific).
 
static const MilliSecond DEFAULT_SIGNAL_TIMEOUT = 5000
 Default timeout before getting a signal on start.
 
static const size_t DEFAULT_SINK_QUEUE_SIZE = 1000
 Default max number of queued media samples (Windows-specific). More...
 

Detailed Description

Implementation of a DVB tuner.

The syntax of a DVB tuner "device name" depends on the operating system.

Linux:

  • Syntax: /dev/dvb/adapterA[:F[:M[:V]]]
  • A = adapter number
  • F = frontend number (default: 0)
  • M = demux number (default: 0)
  • V = dvr number (default: 0)

Windows:

  • DirectShow/BDA tuner filter name

Constructor & Destructor Documentation

◆ Tuner() [1/2]

ts::Tuner::Tuner ( const UString device_name = UString())

Default constructor.

Parameters
[in]device_nameTuner device name.

◆ Tuner() [2/2]

ts::Tuner::Tuner ( const UString device_name,
bool  info_only,
Report report 
)

Constructor and open device name.

Parameters
[in]device_nameTuner device name. If name is empty, use "first" or "default" tuner.
[in]info_onlyIf 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.
[in,out]reportWhere to report errors.

Member Function Documentation

◆ GetAllTuners()

static bool ts::Tuner::GetAllTuners ( TunerPtrVector tuners,
Report report 
)
static

Get the list of all existing DVB tuners.

Parameters
[out]tunersReturned list of DVB tuners on the system.
[in,out]reportWhere to report errors.
Returns
True on success, false on error.

◆ open()

bool ts::Tuner::open ( const UString device_name,
bool  info_only,
Report report 
)

Open the tuner.

Parameters
[in]device_nameTuner device name. If name is empty, use "first" or "default" tuner.
[in]info_onlyIf 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.
[in,out]reportWhere to report errors.
Returns
True on success, false on error.

◆ close()

bool ts::Tuner::close ( Report report)

Close the tuner.

Parameters
[in,out]reportWhere to report errors.
Returns
True on success, false on error.

◆ isOpen()

bool ts::Tuner::isOpen ( ) const
inline

Check if the tuner is open.

Returns
True if the tuner is open.

◆ infoOnly()

bool ts::Tuner::infoOnly ( ) const
inline

Get the open mode.

Returns
True if the tuner is open to fetch information only. In that case, the tuner cannot receive streams.

◆ tunerType()

TunerType ts::Tuner::tunerType ( ) const
inline

Get the tuner type.

Returns
The tuner type.

◆ deliverySystems()

DeliverySystemSet ts::Tuner::deliverySystems ( ) const
inline

Set of delivery systems which are supported by the tuner.

Returns
The set of delivery systems which are supported by the tuner.

◆ hasDeliverySystem()

bool ts::Tuner::hasDeliverySystem ( DeliverySystem  ds) const
inline

Check if the tuner supports the specified delivery system.

Parameters
[in]dsThe delivery system to check.
Returns
True if the tuner supports the specified delivery system.

◆ deviceName()

UString ts::Tuner::deviceName ( ) const
inline

Get the device name of the tuner.

Returns
The device name of the tuner.

◆ deviceInfo()

UString ts::Tuner::deviceInfo ( ) const
inline

Device-specific information.

Returns
A string with device-specific information. Can be empty.

◆ signalLocked()

bool ts::Tuner::signalLocked ( Report report)

Check if a signal is present and locked.

Parameters
[in,out]reportWhere to report errors.
Returns
True if a signal is present and locked.

◆ signalStrength()

int ts::Tuner::signalStrength ( Report report)

Get the signal strength.

Parameters
[in,out]reportWhere to report errors.
Returns
The signal strength in percent (0=bad, 100=good). Return a negative value on error.

◆ signalQuality()

int ts::Tuner::signalQuality ( Report report)

Get the signal quality.

Parameters
[in,out]reportWhere to report errors.
Returns
The signal quality in percent (0=bad, 100=good). Return a negative value on error.

◆ tune() [1/2]

bool ts::Tuner::tune ( const TunerParameters params,
Report report 
)

Tune to the specified parameters.

Parameters
[in]paramsTuning parameters.
[in,out]reportWhere to report errors.
Returns
True on success, false on error.

◆ start()

bool ts::Tuner::start ( Report report)

Start receiving packets.

Parameters
[in,out]reportWhere to report errors.
Returns
True on success, false on error.

◆ stop()

bool ts::Tuner::stop ( Report report)

Stop receiving packets.

Parameters
[in,out]reportWhere to report errors.
Returns
True on success, false on error.

◆ receive()

size_t ts::Tuner::receive ( TSPacket buffer,
size_t  max_packets,
const AbortInterface abort,
Report report 
)

Receive packets.

Parameters
[out]bufferAddress of TS packet receive buffer. Read only complete 188-byte TS packets.
[in]max_packetsMaximum number of packets to read in buffer.
[in]abortIf non-zero, invoked when I/O is interrupted (in case of user-interrupt, return, otherwise retry).
[in,out]reportWhere to report errors.
Returns
The number of actually received packets (in the range 1 to max_packets). Returning zero means error or end of input.

◆ getCurrentTuning()

bool ts::Tuner::getCurrentTuning ( TunerParameters params,
bool  reset_unknown,
Report report 
)

Get the current tuning parameters.

Parameters
[in,out]paramsReturned tuning parameters. Modify only the properties which can be reported by the tuner.
[in]reset_unknownIf true, the unknown values (those which are not reported by the tuner) are reset to unknown/zero/auto values. Otherwise, they are left unmodified.
[in,out]reportWhere to report errors.
Returns
True on success, false on error.

◆ setSignalTimeout()

void ts::Tuner::setSignalTimeout ( MilliSecond  t)
inline

Set the timeout before getting a signal on start.

If zero, do not wait for signal on start. Must be set before start().

Parameters
[in]tNumber of milliseconds to wait after start() before receiving a signal.

◆ setSignalTimeoutSilent()

void ts::Tuner::setSignalTimeoutSilent ( bool  silent)
inline

Set if an error should be reported on timeout before getting a signal on start.

Must be set before start().

Parameters
[in]silentIf true, no error message will be reported if no signal is received after the timeout on start.

◆ setReceiveTimeout()

bool ts::Tuner::setReceiveTimeout ( MilliSecond  t,
Report report 
)

Set the timeout for receive operations.

Parameters
[in]tNumber of milliseconds to wait before receiving packets in a receive() operation. If zero (the default), no timeout is applied.
[in,out]reportWhere to report errors.
Returns
True on success, false on error.

◆ receiveTimeout()

MilliSecond ts::Tuner::receiveTimeout ( ) const
inline

Get the timeout for receive operation.

Returns
The timeout for receive operation.
See also
setReceiveTimeout()

◆ setSignalPoll()

void ts::Tuner::setSignalPoll ( MilliSecond  t)
inline

Set the poll interval for signal timeout (Linux-specific).

Must be set before start().

Parameters
[in]tPoll interval in milliseconds.

◆ setDemuxBufferSize()

void ts::Tuner::setDemuxBufferSize ( size_t  s)
inline

Set the demux buffer size in bytes.

Must be set before start().

Parameters
[in]sThe demux buffer size in bytes.

◆ tune() [2/2]

bool ts::Tuner::tune ( DTVProperties props,
Report report 
)

Perform a tune operation (Linux-specific).

Parameters
[in,out]propsDTV properties.
[in,out]reportWhere to report errors.
Returns
True on success, false on error.

◆ setSinkQueueSize()

void ts::Tuner::setSinkQueueSize ( size_t  s)
inline

Set the max number of queued media samples (Windows-specific).

Must be set before start().

Parameters
[in]sMax number of media samples in the queue between the graph thread and the application thread.

◆ displayStatus()

std::ostream& ts::Tuner::displayStatus ( std::ostream &  strm,
const UString margin,
Report report 
)

Display the characteristics and status of the tuner.

Parameters
[in,out]strmOutput text stream.
[in]marginLeft margin to display.
[in,out]reportWhere to report errors.
Returns
A reference to strm.

Member Data Documentation

◆ DEFAULT_SINK_QUEUE_SIZE

const size_t ts::Tuner::DEFAULT_SINK_QUEUE_SIZE = 1000
static

Default max number of queued media samples (Windows-specific).

See also
setSinkQueueSize().

The documentation for this class was generated from the following file: