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

The DirectShow sink filter (Windows-specific). More...

#include <tsSinkFilter.h>

Inheritance diagram for ts::SinkFilter:
Collaboration diagram for ts::SinkFilter:

Public Member Functions

 SinkFilter (Report &report)
 Constructor.
 
virtual ~SinkFilter ()
 Destructor.
 
void Abort ()
 Abort a blocked Read() operation.
 
void Flush ()
 Discard and release all pending media samples.
 
SinkPinGetPin ()
 Get the unique input pin.
 
size_t Read (void *buffer, size_t buffer_size, cn::milliseconds timeout=cn::milliseconds::zero())
 Read data from transport stream.
 
void SetMaxMessages (size_t maxMessages)
 Set the max number of media samples in the queue between the graph thread and the application thread.
 

Detailed Description

The DirectShow sink filter (Windows-specific).

This class implements a DirectShow filter.

DirectShow is a very complicated infrastructure on Windows to support various media processing. BDA (Broadcast Device Architecture) is the generic device driver interface which links "broadcast devices" like DVB receivers to DirectShow. DirectShow is consequently the only generic way to interact with any type of DVB receiver hardware, provided that the hardware vendor supplies BDA-compatible drivers for the device.

The "sink filter" is intended to be used after a DirectShow capture filter, as provided by the hardware vendor. We call it a "sink" filter because it has one input pin (for MPEG-2 TS) but no output pin. The TS "samples" are read asynchronously by the application. This filter acts as an adapter between the push model of DirectShow and the pull model of tsp, the transport stream processor.

This module contains several classes:

The SinkPin accepts only MPEG-2 transport streams:

  • Major type : MEDIATYPE_Stream
  • Subtype : MEDIASUBTYPE_MPEG2_TRANSPORT MEDIASUBTYPE_MPEG2_TRANSPORT_STRIDE KSDATAFORMAT_SUBTYPE_BDA_MPEG2_TRANSPORT

Constructor & Destructor Documentation

◆ SinkFilter()

ts::SinkFilter::SinkFilter ( Report report)

Constructor.

Parameters
[in,out]reportWhere to report errors.

Member Function Documentation

◆ GetPin()

SinkPin * ts::SinkFilter::GetPin ( )

Get the unique input pin.

Returns
The unique input pin of the filter. The returned object has one reference for the caller. Use Release() when no longer needed.

◆ SetMaxMessages()

void ts::SinkFilter::SetMaxMessages ( size_t  maxMessages)

Set the max number of media samples in the queue between the graph thread and the application thread.

Must be called when the graph is stopped or paused.

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

◆ Read()

size_t ts::SinkFilter::Read ( void *  buffer,
size_t  buffer_size,
cn::milliseconds  timeout = cn::milliseconds::zero() 
)

Read data from transport stream.

Parameters
[out]bufferAddress of returned TS packet buffer.
[in]buffer_sizeSize in bytes of the buffer.
[in]timeoutRead timeout in milliseconds. Ignored if zero or negative. If timeout is positive and no packet has been read within this timeout, return zero.
Returns
The size in bytes of the data returned in buffer. Always return a multiple of 188, complete TS packets. Return zero on error or end of stream.

◆ Abort()

void ts::SinkFilter::Abort ( )

Abort a blocked Read() operation.

Can be called from any thread.


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