mediastreamer2 2.8.0
Typedefs | Enumerations | Functions

Ticker API - manage mediastreamer2 graphs.

Mediastreamer2's base APIs

Ticker API to manage mediastreamer2 graphs. More...

Typedefs

typedef uint64_t(* MSTickerTimeFunc )(void *)
typedef struct _MSTicker MSTicker

Enumerations

enum  _MSTickerPrio {
  MS_TICKER_PRIO_NORMAL,
  MS_TICKER_PRIO_HIGH,
  MS_TICKER_PRIO_REALTIME
}

Functions

MS2_PUBLIC MSTickerms_ticker_new (void)
MS2_PUBLIC void ms_ticker_set_name (MSTicker *ticker, const char *name)
MS2_PUBLIC void ms_ticker_set_priority (MSTicker *ticker, MSTickerPrio prio)
MS2_PUBLIC int ms_ticker_attach (MSTicker *ticker, MSFilter *f)
MS2_PUBLIC int ms_ticker_detach (MSTicker *ticker, MSFilter *f)
MS2_PUBLIC void ms_ticker_destroy (MSTicker *ticker)
MS2_PUBLIC void ms_ticker_set_time_func (MSTicker *ticker, MSTickerTimeFunc func, void *user_data)
MS2_PUBLIC void ms_ticker_print_graphs (MSTicker *ticker)
MS2_PUBLIC float ms_ticker_get_average_load (MSTicker *ticker)

Detailed Description

Ticker API to manage mediastreamer2 graphs.

Describes the ticker API. The ticker is the thread responsible for scheduling audio & video processing for one or several filter graphs.


Typedef Documentation

Structure for method getting time in miliseconds from an external source.

Structure for ticker object.


Enumeration Type Documentation

Enum for ticker priority

Enumerator:
MS_TICKER_PRIO_NORMAL 

the default OS priority for threads

MS_TICKER_PRIO_HIGH 

Increased priority: done by setpriority() or sched_setschedparams() with SCHED_RR on linux/MacOS

MS_TICKER_PRIO_REALTIME 

Topmost priority, running SCHED_FIFO on linux


Function Documentation

MS2_PUBLIC MSTicker* ms_ticker_new ( void  )

Create a ticker that will be used to start and stop a graph.

Returns: MSTicker * if successfull, NULL otherwise.

MS2_PUBLIC void ms_ticker_set_name ( MSTicker ticker,
const char *  name 
)

Set a name to the ticker (used for logging)

MS2_PUBLIC void ms_ticker_set_priority ( MSTicker ticker,
MSTickerPrio  prio 
)

Set priority to the ticker

MS2_PUBLIC int ms_ticker_attach ( MSTicker ticker,
MSFilter f 
)

Attach a chain of filters to a ticker. The processing chain will be executed until ms_ticker_detach will be called.

Parameters:
tickerA MSTicker object.
fA MSFilter object.

Returns: 0 if successfull, -1 otherwise.

MS2_PUBLIC int ms_ticker_detach ( MSTicker ticker,
MSFilter f 
)

Dettach a chain of filters to a ticker. The processing chain will no more be executed.

Parameters:
tickerA MSTicker object.
fA MSFilter object.

Returns: 0 if successfull, -1 otherwise.

MS2_PUBLIC void ms_ticker_destroy ( MSTicker ticker)

Destroy a ticker.

Parameters:
tickerA MSTicker object.
MS2_PUBLIC void ms_ticker_set_time_func ( MSTicker ticker,
MSTickerTimeFunc  func,
void *  user_data 
)

Override MSTicker's time function. This can be used to control the ticker from an external time provider, for example the clock of a sound card.

Parameters:
tickerA MSTicker object.
funcA replacement method for calculating "current time"
user_dataAny pointer to user private data.
MS2_PUBLIC void ms_ticker_print_graphs ( MSTicker ticker)

Print on stdout all filters of a ticker. (INTERNAL: DO NOT USE)

Parameters:
tickerA MSTicker object.
MS2_PUBLIC float ms_ticker_get_average_load ( MSTicker ticker)

Get the average load of the ticker. It is expressed as the ratio between real time spent in processing all graphs for a tick divided by the tick interval (default is 10 ms). This value is averaged over several ticks to get consistent and useful value. A load greater than 100% clearly means that the ticker is over loaded and runs late.