TSDuck v3.44-4659
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::DSMCCModuleAssembler Class Reference

Assembles DSM-CC Object Carousel modules from DSI/DII/DDB messages. More...

#include <tsDSMCCModuleAssembler.h>

Classes

struct  ModuleContext
 Context for a single Module in the carousel. More...
 

Public Types

using DiscoveryHandler = std::function< void(uint32_t download_id, uint16_t module_id)>
 Callback type for module discovery events.
 
using ModuleHandler = std::function< void(const ModuleContext &)>
 Callback type for module completion events.
 
using ModuleKey = std::pair< uint32_t, uint16_t >
 Composite key used internally for tracking modules.
 

Public Member Functions

 DSMCCModuleAssembler (DuckContext &duck)
 Constructor.
 
void clear ()
 Clear the state of the assembler.
 
void feedDownloadData (DSMCCDownloadDataMessage &ddm)
 Feed a DSM-CC Download Data Message (DDB).
 
void feedUserToNetwork (const DSMCCUserToNetworkMessage &unm)
 Feed a DSM-CC User-to-Network Message (DSI or DII).
 
const ModuleContextmodule (uint32_t download_id, uint16_t module_id) const
 Look up a module by (download_id, module_id).
 
const std::map< ModuleKey, ModuleContext > & modules () const
 Snapshot of all known modules, keyed by (download_id, module_id).
 
void setModuleCompletedHandler (ModuleHandler handler)
 Set a callback to be invoked when a module is fully loaded.
 
void setModuleDiscoveredHandler (DiscoveryHandler handler)
 Set a callback to be invoked when a new module is announced via DII.
 

Static Public Attributes

static constexpr uint16_t DEFAULT_BLOCK_SIZE = 4066
 Default block_size when the DII announces 0 (the spec forbids it but malformed carousels show up and we must not divide by zero).
 

Detailed Description

Assembles DSM-CC Object Carousel modules from DSI/DII/DDB messages.

Demux-agnostic: callers feed already-parsed DSM-CC messages via feedUserToNetwork() and feedDownloadData(). A callback is invoked when a module is fully assembled.

Member Typedef Documentation

◆ ModuleHandler

using ts::DSMCCModuleAssembler::ModuleHandler = std::function<void(const ModuleContext&)>

Callback type for module completion events.

Parameters: The completed ModuleContext.

◆ DiscoveryHandler

using ts::DSMCCModuleAssembler::DiscoveryHandler = std::function<void(uint32_t download_id, uint16_t module_id)>

Callback type for module discovery events.

Fired once per (download_id, module_id) pair when its DII is first parsed. Not fired on version bumps of an already-known module, nor on orphan-DDB replay (the discovery already happened when the DII that announced the module arrived).

Constructor & Destructor Documentation

◆ DSMCCModuleAssembler()

ts::DSMCCModuleAssembler::DSMCCModuleAssembler ( DuckContext duck)
explicit

Constructor.

Parameters
[in,out]duckTSDuck execution context.

Member Function Documentation

◆ feedUserToNetwork()

void ts::DSMCCModuleAssembler::feedUserToNetwork ( const DSMCCUserToNetworkMessage unm)

Feed a DSM-CC User-to-Network Message (DSI or DII).

Parameters
[in]unmThe parsed message.

◆ feedDownloadData()

void ts::DSMCCModuleAssembler::feedDownloadData ( DSMCCDownloadDataMessage ddm)

Feed a DSM-CC Download Data Message (DDB).

Parameters
[in,out]ddmThe parsed message. Payload may be moved out.

◆ modules()

const std::map< ModuleKey, ModuleContext > & ts::DSMCCModuleAssembler::modules ( ) const
inline

Snapshot of all known modules, keyed by (download_id, module_id).

Returns
The internal module map.

◆ module()

const ModuleContext * ts::DSMCCModuleAssembler::module ( uint32_t  download_id,
uint16_t  module_id 
) const

Look up a module by (download_id, module_id).

Parameters
[in]download_idThe download_id.
[in]module_idThe module_id.
Returns
Pointer to the module context, or nullptr if not found.

◆ setModuleCompletedHandler()

void ts::DSMCCModuleAssembler::setModuleCompletedHandler ( ModuleHandler  handler)
inline

Set a callback to be invoked when a module is fully loaded.

Parameters
[in]handlerThe callback function.

◆ setModuleDiscoveredHandler()

void ts::DSMCCModuleAssembler::setModuleDiscoveredHandler ( DiscoveryHandler  handler)
inline

Set a callback to be invoked when a new module is announced via DII.

Parameters
[in]handlerThe callback function.

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