mediastreamer2 5.2.0
Data Structures | Macros | Typedefs | Enumerations | Functions
msfilter.h File Reference

mediastreamer2 msfilter.h include file More...

#include "mediastreamer2/mscommon.h"
#include "mediastreamer2/msqueue.h"
#include "mediastreamer2/allfilters.h"
#include "mediastreamer2/formats.h"
#include "mediastreamer2/box-plot.h"
#include "mediastreamer2/msinterfaces.h"
#include "mediastreamer2/msfactory.h"
Include dependency graph for msfilter.h:
This graph shows which files directly or indirectly include this file:

Data Structures

struct  _MSFilterMethod
 
struct  _MSFilterStats
 
struct  _MSFilterDesc
 
struct  _MSFilter
 
struct  _MSConnectionPoint
 
struct  _MSConnectionHelper
 
struct  _MSPinFormat
 
struct  _MSFilterTask
 

Macros

#define MS_FILTER_METHOD_ID(_id_, _cnt_, _argsize_)    (unsigned int)(((((unsigned int)(_id_)) & 0xFFFF)<<16) | (((unsigned int)(_cnt_))<<8) | (((unsigned int)_argsize_) & 0xFF))
 
#define MS_FILTER_METHOD(_id_, _count_, _argtype_)    MS_FILTER_METHOD_ID(_id_,_count_,sizeof(_argtype_))
 
#define MS_FILTER_METHOD_NO_ARG(_id_, _count_)    MS_FILTER_METHOD_ID(_id_,_count_,0)
 
#define MS_FILTER_BASE_METHOD(_count_, _argtype_)    MS_FILTER_METHOD_ID(MS_FILTER_BASE_ID,_count_,sizeof(_argtype_))
 
#define MS_FILTER_BASE_METHOD_NO_ARG(_count_)    MS_FILTER_METHOD_ID(MS_FILTER_BASE_ID,_count_,0)
 
#define MS_FILTER_EVENT(_id_, _count_, _argtype_)    MS_FILTER_METHOD_ID(_id_,_count_,sizeof(_argtype_))
 
#define MS_FILTER_EVENT_NO_ARG(_id_, _count_)    MS_FILTER_METHOD_ID(_id_,_count_,0)
 
#define MS_FILTER_BASE_EVENT(_count_, _argtype_)    MS_FILTER_EVENT(MS_FILTER_BASE_ID,_count_,_argtype_)
 
#define MS_FILTER_BASE_EVENT_NO_ARG(_count_)    MS_FILTER_EVENT_NO_ARG(MS_FILTER_BASE_ID,_count_)
 
#define MS_FILTER_SET_SAMPLE_RATE   MS_FILTER_BASE_METHOD(0,int)
 
#define MS_FILTER_GET_SAMPLE_RATE   MS_FILTER_BASE_METHOD(1,int)
 
#define MS_FILTER_SET_BITRATE   MS_FILTER_BASE_METHOD(2,int)
 
#define MS_FILTER_GET_BITRATE   MS_FILTER_BASE_METHOD(3,int)
 
#define MS_FILTER_GET_NCHANNELS   MS_FILTER_BASE_METHOD(5,int)
 
#define MS_FILTER_SET_NCHANNELS   MS_FILTER_BASE_METHOD(6,int)
 
#define MS_FILTER_ADD_FMTP   MS_FILTER_BASE_METHOD(7,const char)
 
#define MS_FILTER_ADD_ATTR   MS_FILTER_BASE_METHOD(8,const char)
 
#define MS_FILTER_SET_MTU   MS_FILTER_BASE_METHOD(9,int)
 
#define MS_FILTER_GET_MTU   MS_FILTER_BASE_METHOD(10,int)
 
#define MS_FILTER_GET_LATENCY   MS_FILTER_BASE_METHOD(11,int)
 
#define MS_FILTER_GET_INPUT_FMT   MS_FILTER_BASE_METHOD(30,MSPinFormat)
 
#define MS_FILTER_SET_INPUT_FMT   MS_FILTER_BASE_METHOD(31,MSPinFormat)
 
#define MS_FILTER_GET_OUTPUT_FMT   MS_FILTER_BASE_METHOD(32,MSPinFormat)
 
#define MS_FILTER_SET_OUTPUT_FMT   MS_FILTER_BASE_METHOD(33,MSPinFormat)
 
#define MS_FILTER_OUTPUT_FMT_CHANGED   MS_FILTER_BASE_EVENT_NO_ARG(0)
 
#define MS_FILTER_SET_FILTERLENGTH   MS_FILTER_BASE_METHOD(12,int)
 
#define MS_FILTER_SET_OUTPUT_SAMPLE_RATE   MS_FILTER_BASE_METHOD(13,int)
 
#define MS_FILTER_ENABLE_DIRECTMODE   MS_FILTER_BASE_METHOD(14,int)
 
#define MS_FILTER_ENABLE_VAD   MS_FILTER_BASE_METHOD(15,int)
 
#define MS_FILTER_GET_STAT_DISCARDED   MS_FILTER_BASE_METHOD(16,int)
 
#define MS_FILTER_GET_STAT_MISSED   MS_FILTER_BASE_METHOD(17,int)
 
#define MS_FILTER_GET_STAT_INPUT   MS_FILTER_BASE_METHOD(18,int)
 
#define MS_FILTER_GET_STAT_OUTPUT   MS_FILTER_BASE_METHOD(19,int)
 
#define MS_FILTER_ENABLE_AGC   MS_FILTER_BASE_METHOD(20,int)
 
#define MS_FILTER_SET_PLAYBACKDELAY   MS_FILTER_BASE_METHOD(21,int)
 
#define MS_FILTER_ENABLE_HALFDUPLEX   MS_FILTER_BASE_METHOD(22,int)
 
#define MS_FILTER_SET_VAD_PROB_START   MS_FILTER_BASE_METHOD(23,int)
 
#define MS_FILTER_SET_VAD_PROB_CONTINUE   MS_FILTER_BASE_METHOD(24,int)
 
#define MS_FILTER_SET_MAX_GAIN   MS_FILTER_BASE_METHOD(25,int)
 
#define MS_VIDEO_CAPTURE_SET_AUTOFOCUS   MS_FILTER_BASE_METHOD(26,int)
 
#define MS_FILTER_SET_RTP_PAYLOAD_PICKER   MS_FILTER_BASE_METHOD(27,void*)
 
#define MS_FILTER_SET_OUTPUT_NCHANNELS   MS_FILTER_BASE_METHOD(28,int)
 
#define ms_filter_lock(f)   ms_mutex_lock(&(f)->lock)
 
#define ms_filter_unlock(f)   ms_mutex_unlock(&(f)->lock)
 
#define MS_FILTER_DESC_EXPORT(desc)
 

Typedefs

typedef void(* MSFilterFunc) (struct _MSFilter *f)
 
typedef int(* MSFilterMethodFunc) (struct _MSFilter *f, void *arg)
 
typedef void(* MSFilterNotifyFunc) (void *userdata, struct _MSFilter *f, unsigned int id, void *arg)
 
typedef enum _MSFilterInterfaceId MSFilterInterfaceId
 
typedef struct _MSFilterMethod MSFilterMethod
 
typedef enum _MSFilterCategory MSFilterCategory
 
typedef enum _MSFilterFlags MSFilterFlags
 
typedef struct _MSFilterStats MSFilterStats
 
typedef struct _MSFilterDesc MSFilterDesc
 
typedef struct _MSFilter MSFilter
 
typedef struct _MSConnectionPoint MSConnectionPoint
 
typedef struct _MSConnectionHelper MSConnectionHelper
 
typedef struct _MSPinFormat MSPinFormat
 
typedef struct _MSFilterTask MSFilterTask
 

Enumerations

enum  _MSFilterInterfaceId {
  MSFilterInterfaceBegin =16384 ,
  MSFilterPlayerInterface ,
  MSFilterRecorderInterface ,
  MSFilterVideoDisplayInterface ,
  MSFilterEchoCancellerInterface ,
  MSFilterVideoDecoderInterface ,
  MSFilterVideoCaptureInterface ,
  MSFilterAudioDecoderInterface ,
  MSFilterVideoEncoderInterface ,
  MSFilterAudioCaptureInterface ,
  MSFilterAudioPlaybackInterface ,
  MSFilterAudioEncoderInterface ,
  MSFilterVADInterface ,
  MSFilterVoidInterface
}
 
enum  _MSFilterCategory {
  MS_FILTER_OTHER ,
  MS_FILTER_ENCODER ,
  MS_FILTER_DECODER ,
  MS_FILTER_ENCODING_CAPTURER ,
  MS_FILTER_DECODER_RENDERER
}
 
enum  _MSFilterFlags {
  MS_FILTER_IS_PUMP = 1 ,
  MS_FILTER_IS_ENABLED = 1<<31
}
 

Functions

void ms_filter_register (MSFilterDesc *desc)
 
MSFilterDescms_filter_get_encoding_capturer (const char *mime)
 
MSFilterDescms_filter_get_decoding_renderer (const char *mime)
 
MSFilterDescms_filter_get_encoder (const char *mime)
 
MSFilterDescms_filter_get_decoder (const char *mime)
 
MSFilterDescms_filter_lookup_by_name (const char *filter_name)
 
MSList * ms_filter_lookup_by_interface (MSFilterInterfaceId id)
 
MSFilterms_filter_create_encoder (const char *mime)
 
MSFilterms_filter_create_decoder (const char *mime)
 
bool_t ms_filter_codec_supported (const char *mime)
 
MSFilterms_filter_new (MSFilterId id)
 
MSFilterms_filter_new_from_name (const char *name)
 
MSFilterms_filter_new_from_desc (MSFilterDesc *desc)
 
int ms_filter_link (MSFilter *f1, int pin1, MSFilter *f2, int pin2)
 
int ms_filter_unlink (MSFilter *f1, int pin1, MSFilter *f2, int pin2)
 
int ms_filter_call_method (MSFilter *f, unsigned int id, void *arg)
 
int ms_filter_call_method_noarg (MSFilter *f, unsigned int id)
 
bool_t ms_filter_has_method (MSFilter *f, unsigned int id)
 
bool_t ms_filter_implements_interface (MSFilter *f, MSFilterInterfaceId id)
 
bool_t ms_filter_desc_implements_interface (MSFilterDesc *desc, MSFilterInterfaceId id)
 
void ms_filter_add_notify_callback (MSFilter *f, MSFilterNotifyFunc fn, void *userdata, bool_t synchronous)
 
void ms_filter_remove_notify_callback (MSFilter *f, MSFilterNotifyFunc fn, void *userdata)
 
MSFilterId ms_filter_get_id (MSFilter *f)
 
const char * ms_filter_get_name (MSFilter *f)
 
MSList * ms_filter_find_neighbours (MSFilter *me)
 
struct _MSTickerms_filter_get_ticker (MSFilter *f)
 
void ms_filter_destroy (MSFilter *f)
 
void ms_connection_helper_start (MSConnectionHelper *h)
 
int ms_connection_helper_link (MSConnectionHelper *h, MSFilter *f, int inpin, int outpin)
 Enter a MSFilter to be connected into the MSConnectionHelper object.
 
int ms_connection_helper_unlink (MSConnectionHelper *h, MSFilter *f, int inpin, int outpin)
 Enter a MSFilter to be disconnected into the MSConnectionHelper object. Process exactly the same way as ms_connection_helper_link() but calls ms_filter_unlink() on the entered filters.
 
void ms_filter_enable_statistics (bool_t enabled)
 Enable processing time measurements statistics for filters.
 
void ms_filter_reset_statistics (void)
 Reset processing time statistics for filters.
 
const MSList * ms_filter_get_statistics (void)
 Retrieves statistics for running filters. Returns a list of MSFilterStats.
 
void ms_filter_log_statistics (void)
 Logs runtime statistics for running filters.
 
void ms_filter_process (MSFilter *f)
 
void ms_filter_preprocess (MSFilter *f, struct _MSTicker *t)
 
void ms_filter_postprocess (MSFilter *f)
 
bool_t ms_filter_inputs_have_data (MSFilter *f)
 
void ms_filter_notify (MSFilter *f, unsigned int id, void *arg)
 
void ms_filter_notify_no_arg (MSFilter *f, unsigned int id)
 
void ms_filter_clear_notify_callback (MSFilter *f)
 
void ms_filter_clean_pending_events (MSFilter *f)
 
void ms_filter_unregister_all (void)
 
void ms_filter_task_process (MSFilterTask *task)
 
void ms_filter_postpone_task (MSFilter *f, MSFilterFunc taskfunc)
 

Detailed Description

mediastreamer2 msfilter.h include file

This file provide the API needed to create, link, unlink, find and destroy filter.

It also provides definitions if you wish to implement your own filters.

Function Documentation

◆ ms_filter_postpone_task()

void ms_filter_postpone_task ( MSFilter f,
MSFilterFunc  taskfunc 
)

Allow a filter to request the ticker to call him the tick after. The ticker will call the taskfunc prior to all filter's process func.