TSDuck v3.40-3963
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::TunerGraph Class Reference

A specialization of a DirectShow graph for tuner reception (Windows-specific). More...

#include <tsTunerGraph.h>

Inheritance diagram for ts::TunerGraph:
Collaboration diagram for ts::TunerGraph:

Public Types

enum  PropSearch {
  psFIRST ,
  psLAST ,
  psLOWEST ,
  psHIGHEST
}
 Search criteria for properties. More...
 

Public Member Functions

 TunerGraph ()=default
 Default constructor.
 
virtual ~TunerGraph ()
 Destructor.
 
bool addFilter (::IBaseFilter *filter, const wchar_t *name, Report &report)
 Add a filter in the graph.
 
bool cleanupDownstream (::IBaseFilter *filter, Report &report)
 In the graph, cleanup everything downstream a specified filter.
 
virtual void clear (Report &report) override
 Clear the graph back to uninitialized state.
 
bool connectFilters (::IBaseFilter *filter1, ::IBaseFilter *filter2, Report &report)
 Directly connect two filters using whatever output and input pin.
 
void display (std::ostream &output, Report &report, const UString &margin=UString(), bool verbose=true)
 Display the description of the graph.
 
bool initialize (const UString &tuner_name, ::IMoniker *tuner_moniker, DeliverySystemSet &delivery_systems, Report &report)
 Initialize the graph.
 
bool initialize (Report &report)
 Initialize the graph.
 
bool isValid () const
 Check if the graph was correctly initialized.
 
bool removeFilter (::IBaseFilter *filter, Report &report)
 Remove a filter from the graph.
 
bool run (Report &report)
 Run the graph.
 
template<typename VALTYPE , typename IVALTYPE , class FILTER , typename std::enable_if< std::is_base_of<::IBDA_SignalStatistics, FILTER >::value >::type * = nullptr>
bool searchProperty (VALTYPE &retvalue, PropSearch searchtype, ::HRESULT(__stdcall FILTER::*getmethod)(IVALTYPE *), const ::GUID &propset, int propid)
 Search a property, until found, in all interfaces of a given class and then in tuner properties.
 
template<typename VALTYPE >
bool searchTunerProperty (VALTYPE &retvalue, PropSearch searchtype, const ::GUID &propset, int propid)
 Search all IKsPropertySet in the tuner until the specified data is found.
 
template<typename VALTYPE , typename ARGTYPE , typename IVALTYPE , class FILTER , typename std::enable_if< std::is_same<::IBDA_DigitalDemodulator, FILTER >::value >::type * = nullptr>
bool searchVarProperty (VALTYPE unset, std::optional< ARGTYPE > &parameter, PropSearch searchtype, bool reset_unknown, ::HRESULT(__stdcall FILTER::*getmethod)(IVALTYPE *), const ::GUID &propset, int propid)
 Search a property, until found, in all interfaces of a given class and then in tuner properties.
 
bool sendTuneRequest (DuckContext &duck, const ModulationArgs &params)
 Send a tune request.
 
void setReceiverName (const UString &name)
 Specify a receiver filter name.
 
SinkFiltersinkFilter () const
 Get the sink filter of the graph.
 
ComPtr<::IBaseFilter > startingFilter (Report &report)
 Get the starting filter of the graph.
 
bool stop (Report &report)
 Stop the graph.
 

Detailed Description

A specialization of a DirectShow graph for tuner reception (Windows-specific).

A DirectShow graph for TS capture is usually made of the following filters:

  • Network provider (typically "Microsoft DVBx Network Provider")
  • Tuner (typically provided by tuner hardware vendor as "BDA driver")
  • Receiver (optional, also provided by tuner hardware vendor)
  • Tee filter, creating two branches:
  • Branch A: actual capture of TS packets
    • SinkFiler (provided by TSDuck)
  • Branch B: MPEG-2 demux, actually unused but required by the graph
    • MPEG-2 demultiplexer
    • TIF (Transport Information Filter)

Member Enumeration Documentation

◆ PropSearch

Search criteria for properties.

Enumerator
psLAST 

Keep first value, when found.

psLOWEST 

Keep last value.

psHIGHEST 

Keep lowest value.

Keep highest value.

Member Function Documentation

◆ setReceiverName()

void ts::TunerGraph::setReceiverName ( const UString name)
inline

Specify a receiver filter name.

Must be called before initialize(). The graph will use the specified receiver filter instead of the standard algorithm.

Parameters
[in]nameName of the receiver filter to use.

◆ initialize() [1/2]

bool ts::TunerGraph::initialize ( const UString tuner_name,
::IMoniker *  tuner_moniker,
DeliverySystemSet delivery_systems,
Report report 
)

Initialize the graph.

Parameters
[in]tuner_nameTuner filter name (informational only).
[in,out]tuner_monikerA moniker to create instances of a tuner filter. This tuner filter is the base of the graph creation (not the starting point of the graph, which is the network provider filter).
[out]delivery_systemsList of delivery systems which are supported by the tuner.
[in,out]reportWhere to report errors.
Returns
True on success, false on error.

◆ clear()

virtual void ts::TunerGraph::clear ( Report report)
overridevirtual

Clear the graph back to uninitialized state.

Parameters
[in,out]reportWhere to report errors.

Reimplemented from ts::DirectShowGraph.

◆ sinkFilter()

SinkFilter * ts::TunerGraph::sinkFilter ( ) const
inline

Get the sink filter of the graph.

This is where the TS packets can be fetched out of the graph.

Returns
The address of the sink filter or a null pointer if the graph is not initialized.

◆ sendTuneRequest()

bool ts::TunerGraph::sendTuneRequest ( DuckContext duck,
const ModulationArgs params 
)

Send a tune request.

Parameters
[in,out]duckTSDuck execution context.
[in]paramsModulation parameters.
Returns
True on success, false on error.

◆ searchTunerProperty()

template<typename VALTYPE >
bool ts::TunerGraph::searchTunerProperty ( VALTYPE &  retvalue,
PropSearch  searchtype,
const ::GUID &  propset,
int  propid 
)

Search all IKsPropertySet in the tuner until the specified data is found.

Template Parameters
VALTYPEThe type of the property to search.
Parameters
[out]retvalueReturned property value.
[in]searchtypeSelection criteria for the final value.
[in]propsetGUID of the property set.
[in]propidId of the property to search.
Returns
True when the property was found, false otherwise.

◆ searchProperty()

template<typename VALTYPE , typename IVALTYPE , class FILTER , typename std::enable_if< std::is_base_of<::IBDA_SignalStatistics, FILTER >::value >::type * = nullptr>
bool ts::TunerGraph::searchProperty ( VALTYPE &  retvalue,
PropSearch  searchtype,
::HRESULT(__stdcall FILTER::*)(IVALTYPE *)  getmethod,
const ::GUID &  propset,
int  propid 
)
inline

Search a property, until found, in all interfaces of a given class and then in tuner properties.

Template Parameters
VALTYPEThe type of the property to search.
IVALTYPEThe type of the property in the get_XXX() method of the object.
FILTERThe interface class through which the property can be found.
Parameters
[out]retvalueReturned property value.
[in]searchtypeSelection criteria for the final value.
[in]getmethodThe get_XXX() method of the object to retrieve the property. Used to search in ivector.
[in]propsetGUID of the property set. Used to search in tuner properties.
[in]propidId of the property to search.
Returns
True when the property was found, false otherwise.

◆ searchVarProperty()

template<typename VALTYPE , typename ARGTYPE , typename IVALTYPE , class FILTER , typename std::enable_if< std::is_same<::IBDA_DigitalDemodulator, FILTER >::value >::type * = nullptr>
bool ts::TunerGraph::searchVarProperty ( VALTYPE  unset,
std::optional< ARGTYPE > &  parameter,
PropSearch  searchtype,
bool  reset_unknown,
::HRESULT(__stdcall FILTER::*)(IVALTYPE *)  getmethod,
const ::GUID &  propset,
int  propid 
)
inline

Search a property, until found, in all interfaces of a given class and then in tuner properties.

Same as previous method, with additional handling of unknown return value.

Template Parameters
VALTYPEThe type of the property to search.
ARGTYPE
IVALTYPEThe type of the property in the get_XXX() method of the object.
FILTERThe interface class through which the property can be found.
Parameters
[in]unsetA value which, when returned by the interface, means "value is unset".
[in,out]parameterA variable object containing the result. When the value is considered as "unset", the variable is reset (becomes uninitialized).
[in]searchtypeSelection criteria for the final value.
[in]reset_unknownIf true and the property cannot be found, reset the variable in parameter.
[in]getmethodThe get_XXX() method of the object to retrieve the property. Used to search in ivector.
[in]propsetGUID of the property set. Used to search in tuner properties.
[in]propidId of the property to search.
Returns
True when the property was found, false otherwise.

◆ initialize() [2/2]

bool ts::DirectShowGraph::initialize ( Report report)
inherited

Initialize the graph.

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

◆ isValid()

bool ts::DirectShowGraph::isValid ( ) const
inherited

Check if the graph was correctly initialized.

Returns
True if the graph was correctly initialized.

◆ addFilter()

bool ts::DirectShowGraph::addFilter ( ::IBaseFilter *  filter,
const wchar_t *  name,
Report report 
)
inherited

Add a filter in the graph.

Parameters
[in,out]filterThe filter to add.
[in]nameFilter name.
[in,out]reportWhere to report errors.
Returns
True on success, false on error.

◆ removeFilter()

bool ts::DirectShowGraph::removeFilter ( ::IBaseFilter *  filter,
Report report 
)
inherited

Remove a filter from the graph.

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

◆ connectFilters()

bool ts::DirectShowGraph::connectFilters ( ::IBaseFilter *  filter1,
::IBaseFilter *  filter2,
Report report 
)
inherited

Directly connect two filters using whatever output and input pin.

Parameters
[in,out]filter1DirectShow filter with output pins.
[in,out]filter2DirectShow filter with input pins.
[in,out]reportWhere to report errors.
Returns
True on success, false on error.

◆ cleanupDownstream()

bool ts::DirectShowGraph::cleanupDownstream ( ::IBaseFilter *  filter,
Report report 
)
inherited

In the graph, cleanup everything downstream a specified filter.

All downstream filters are disconnected and removed from the graph.

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

◆ startingFilter()

ComPtr<::IBaseFilter > ts::DirectShowGraph::startingFilter ( Report report)
inherited

Get the starting filter of the graph.

Parameters
[in,out]reportWhere to report errors.
Returns
A pointer to the first filter with no connected input pin or a null pointer if not found.

◆ run()

bool ts::DirectShowGraph::run ( Report report)
inherited

Run the graph.

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

◆ stop()

bool ts::DirectShowGraph::stop ( Report report)
inherited

Stop the graph.

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

◆ display()

void ts::DirectShowGraph::display ( std::ostream &  output,
Report report,
const UString margin = UString(),
bool  verbose = true 
)
inherited

Display the description of the graph.

Parameters
[in,out]outputWhere to display test results.
[in,out]reportWhere to report errors.
[in]marginLeft margin to display.
[in]verboseTrue for verbose information.

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