/*
* Copyright (c) 2010-2019 Belledonne Communications SARL.
*
* This file is part of mediastreamer2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef msfilter_h
#define msfilter_h
#include "mediastreamer2/mscommon.h"
#include "mediastreamer2/msqueue.h"
#include "mediastreamer2/allfilters.h"
#include "mediastreamer2/formats.h"
#include "mediastreamer2/box-plot.h"
/**
* @file msfilter.h
* @brief 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.
*
*/
/**
* @addtogroup mediastreamer2_filter
* @{
*/
/**
* Structure for filter's methods (init, preprocess, process, postprocess, uninit).
* @var MSFilterFunc
*/
typedef void (*MSFilterFunc)(struct _MSFilter *f);
/**
* Structure for filter's methods used to set filter's options.
* @var MSFilterMethodFunc
*/
typedef int (*MSFilterMethodFunc)(struct _MSFilter *f, void *arg);
/**
* Structure for filter's methods used as a callback to notify events.
* @var MSFilterNotifyFunc
*/
typedef void (*MSFilterNotifyFunc)(void *userdata, struct _MSFilter *f, unsigned int id, void *arg);
struct _MSFilterMethod{
unsigned int id;
MSFilterMethodFunc method;
};
/**
* Interface IDs, used to generate method names (see MS_FILTER_METHOD macro).
* The purpose of these interfaces is to allow different filter implementations to share the same methods, by implementing the method definitions for these interfaces.
* For example every video encoder implementation would need a method to request the generation of a key frame. Instead of having each implementation defining its own method to do this,
* each implementation can just implement the MS_VIDEO_ENCODER_REQ_VFU method of the MSFilterVideoEncoderInterface.
**/
enum _MSFilterInterfaceId{
MSFilterInterfaceBegin=16384,
MSFilterPlayerInterface, /**
* MS_FILTER_OTHER
* MS_FILTER_ENCODER
* MS_FILTER_DECODER
* MS_FILTER_ENCODING_CAPTURER
* MS_FILTER_DECODING_RENDERER
*
* @var MSFilterCategory
*/
typedef enum _MSFilterCategory MSFilterCategory;
/**
* Filter's flags controlling special behaviours.
**/
enum _MSFilterFlags{
MS_FILTER_IS_PUMP = 1, /**< The filter must be called in process function every tick.*/
/*...*/
/*private flags: don't use it in filters.*/
MS_FILTER_IS_ENABLED = 1<<31 /*lock)
#define ms_filter_unlock(f) ms_mutex_unlock(&(f)->lock)
MS2_PUBLIC void ms_filter_unregister_all(void);
struct _MSFilterTask{
MSFilter *f;
MSFilterFunc taskfunc;
};
typedef struct _MSFilterTask MSFilterTask;
MS2_PUBLIC void ms_filter_task_process(MSFilterTask *task);
/**
* 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.
**/
MS2_PUBLIC void ms_filter_postpone_task(MSFilter *f, MSFilterFunc taskfunc);
#ifdef __cplusplus
}
#endif
#include "mediastreamer2/msinterfaces.h"
#include "mediastreamer2/msfactory.h"
/* used by awk script in Makefile.am to generate alldescs.c */
#define MS_FILTER_DESC_EXPORT(desc)
#endif