Commit b2eb303a authored by Sandrine Avakian's avatar Sandrine Avakian

Merge branch 'dev_msfactory'

parents bce67425 f6fb1dc8
......@@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <ortp/ortp.h>
#include <ortp/event.h>
#include <mediastreamer2/msfactory.h>
#include <mediastreamer2/msfilter.h>
#include <mediastreamer2/msticker.h>
#include <mediastreamer2/mssndcard.h>
......@@ -63,8 +64,8 @@ struct _RingStream
typedef struct _RingStream RingStream;
MS2_PUBLIC RingStream *ring_start (const char * file, int interval, MSSndCard *sndcard);
MS2_PUBLIC RingStream *ring_start_with_cb(const char * file, int interval, MSSndCard *sndcard, MSFilterNotifyFunc func, void * user_data);
MS2_PUBLIC RingStream *ring_start (const char * file, int interval, MSSndCard *sndcard, MSFactory *factory);
MS2_PUBLIC RingStream *ring_start_with_cb( MSFactory *factory, const char * file, int interval, MSSndCard *sndcard, MSFilterNotifyFunc func, void * user_data);
MS2_PUBLIC void ring_stop (RingStream * stream);
/**
......@@ -410,9 +411,10 @@ typedef struct _AudioStream AudioStream;
/* start a thread that does sampling->encoding->rtp_sending|rtp_receiving->decoding->playing */
MS2_PUBLIC AudioStream *audio_stream_start (RtpProfile * prof, int locport, const char *remip,
int remport, int payload_type, int jitt_comp, bool_t echo_cancel);
int remport, int payload_type, int jitt_comp, bool_t echo_cancel, MSFactory* factory);
MS2_PUBLIC AudioStream *audio_stream_start_with_sndcards(RtpProfile * prof, int locport, const char *remip4, int remport, int payload_type, int jitt_comp, MSSndCard *playcard, MSSndCard *captcard, bool_t echocancel);
MS2_PUBLIC AudioStream *audio_stream_start_with_sndcards(RtpProfile* prof, int locport, const char *remip4, int remport, int payload_type, int jitt_comp, MSSndCard *playcard,
MSSndCard *captcard, bool_t echocancel, MSFactory* factory);
MS2_PUBLIC int audio_stream_start_with_files (AudioStream * stream, RtpProfile * prof,
const char *remip, int remport, int rem_rtcp_port,
......@@ -475,25 +477,28 @@ MS2_PUBLIC void audio_stream_play_received_dtmfs(AudioStream *st, bool_t yesno);
* @param loc_rtp_port the local UDP port to listen for RTP packets.
* @param loc_rtcp_port the local UDP port to listen for RTCP packets
* @param ipv6 TRUE if ipv6 must be used.
* @param factory
* @return a new AudioStream.
**/
MS2_PUBLIC AudioStream *audio_stream_new(int loc_rtp_port, int loc_rtcp_port, bool_t ipv6);
MS2_PUBLIC AudioStream *audio_stream_new(int loc_rtp_port, int loc_rtcp_port, bool_t ipv6, MSFactory* factory);
/**
* Creates an AudioStream object listening on a RTP port for a dedicated address.
* @param loc_ip the local ip to listen for RTP packets. Can be ::, O.O.O.O or any ip4/6 addresses
* @param loc_rtp_port the local UDP port to listen for RTP packets.
* @param loc_rtcp_port the local UDP port to listen for RTCP packets
* @param factory
* @return a new AudioStream.
**/
MS2_PUBLIC AudioStream *audio_stream_new2(const char* ip, int loc_rtp_port, int loc_rtcp_port);
MS2_PUBLIC AudioStream *audio_stream_new2(const char* ip, int loc_rtp_port, int loc_rtcp_port, MSFactory* factory);
/**Creates an AudioStream object from initialized MSMediaStreamSessions.
* @param sessions the MSMediaStreamSessions
* @param factory the MSFActory from the core object
* @return a new AudioStream
**/
MS2_PUBLIC AudioStream *audio_stream_new_with_sessions(const MSMediaStreamSessions *sessions);
MS2_PUBLIC AudioStream *audio_stream_new_with_sessions(const MSMediaStreamSessions *sessions, MSFactory* factory);
#define AUDIO_STREAM_FEATURE_PLC (1 << 0)
#define AUDIO_STREAM_FEATURE_EC (1 << 1)
......@@ -812,7 +817,7 @@ typedef struct _VideoStream VideoStream;
MS2_PUBLIC VideoStream *video_stream_new(int loc_rtp_port, int loc_rtcp_port, bool_t use_ipv6);
MS2_PUBLIC VideoStream *video_stream_new(int loc_rtp_port, int loc_rtcp_port, bool_t use_ipv6, MSFactory* factory);
/**
* Creates a VideoStream object listening on a RTP port for a dedicated address.
* @param loc_ip the local ip to listen for RTP packets. Can be ::, O.O.O.O or any ip4/6 addresses
......@@ -820,9 +825,9 @@ MS2_PUBLIC VideoStream *video_stream_new(int loc_rtp_port, int loc_rtcp_port, bo
* @param [in] loc_rtcp_port the local UDP port to listen for RTCP packets
* @return a new VideoStream.
**/
MS2_PUBLIC VideoStream *video_stream_new2(const char* ip, int loc_rtp_port, int loc_rtcp_port);
MS2_PUBLIC VideoStream *video_stream_new2(const char* ip, int loc_rtp_port, int loc_rtcp_port, MSFactory* factory);
MS2_PUBLIC VideoStream *video_stream_new_with_sessions(const MSMediaStreamSessions *sessions);
MS2_PUBLIC VideoStream *video_stream_new_with_sessions(const MSMediaStreamSessions *sessions, MSFactory* factory);
MS2_PUBLIC void video_stream_set_direction(VideoStream *vs, MediaStreamDir dir);
static MS2_INLINE void video_stream_enable_adaptive_bitrate_control(VideoStream *stream, bool_t enabled) {
media_stream_enable_adaptive_bitrate_control(&stream->ms, enabled);
......@@ -1200,25 +1205,28 @@ typedef struct _TextStream TextStream;
* @param loc_rtp_port the local UDP port to listen for RTP packets.
* @param loc_rtcp_port the local UDP port to listen for RTCP packets
* @param ipv6 TRUE if ipv6 must be used.
* @param factory
* @return a new TextStream.
**/
MS2_PUBLIC TextStream *text_stream_new(int loc_rtp_port, int loc_rtcp_port, bool_t ipv6);
MS2_PUBLIC TextStream *text_stream_new(int loc_rtp_port, int loc_rtcp_port, bool_t ipv6, MSFactory *factory);
/**
* Creates a TextStream object from initialized MSMediaStreamSessions.
* @param sessions the MSMediaStreamSessions
* @param factory
* @return a new TextStream
**/
MS2_PUBLIC TextStream *text_stream_new_with_sessions(const MSMediaStreamSessions *sessions);
MS2_PUBLIC TextStream *text_stream_new_with_sessions(const MSMediaStreamSessions *sessions, MSFactory *factory);
/**
* Creates a TextStream object listening on a RTP port for a dedicated address.
* @param loc_ip the local ip to listen for RTP packets. Can be ::, O.O.O.O or any ip4/6 addresses
* @param [in] loc_rtp_port the local UDP port to listen for RTP packets.
* @param [in] loc_rtcp_port the local UDP port to listen for RTCP packets
* @param factory
* @return a new TextStream.
**/
MS2_PUBLIC TextStream *text_stream_new2(const char* ip, int loc_rtp_port, int loc_rtcp_port);
MS2_PUBLIC TextStream *text_stream_new2(const char* ip, int loc_rtp_port, int loc_rtcp_port,MSFactory *factory);
/**
* Starts a text stream.
......@@ -1230,8 +1238,10 @@ MS2_PUBLIC TextStream *text_stream_new2(const char* ip, int loc_rtp_port, int lo
* @param[in] rem_rtcp_addr The remote IP address for RTCP.
* @param[in] rem_rtcp_port The remote port for RTCP.
* @param[in] payload_type The payload type number used to send the text stream. A valid PayloadType must be available at this index in the profile.
* @param[in] factory
*/
MS2_PUBLIC TextStream* text_stream_start(TextStream *stream, RtpProfile *profile, const char *rem_rtp_addr, int rem_rtp_port, const char *rem_rtcp_addr, int rem_rtcp_port, int payload_type);
MS2_PUBLIC TextStream* text_stream_start(TextStream *stream, RtpProfile *profile, const char *rem_rtp_addr, int rem_rtp_port, const char *rem_rtcp_addr, int rem_rtcp_port,
int payload_type, MSFactory *factory);
/**
* Stops the text streaming thread and free everything
......
......@@ -28,6 +28,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "TargetConditionals.h"
#endif
#ifndef LINPHONE_DEPRECATED
#if defined(_MSC_VER)
#define LINPHONE_DEPRECATED __declspec(deprecated)
#else
#define LINPHONE_DEPRECATED __attribute__ ((deprecated))
#endif
#endif
#define MS_UNUSED(x) ((void)(x))
#define ms_malloc ortp_malloc
......@@ -132,6 +139,7 @@ typedef struct _MSList MSList;
typedef int (*MSCompareFunc)(const void *a, const void *b);
typedef void (*MSIterateFunc)(void *a);
typedef void (*MSIterate2Func)(void *a, void *b);
typedef void (*MSIterate3Func)(void *a, void *b, void *c);
#ifdef __cplusplus
extern "C"{
......@@ -220,8 +228,11 @@ MS2_PUBLIC void ms_list_for_each(const MSList *list, MSIterateFunc iterate_func)
* @param list List object
* @param iterate_func Function to invoke on each element.
* @param user_data User data to pass to iterate_func function.
*
**/
MS2_PUBLIC void ms_list_for_each2(const MSList *list, MSIterate2Func iterate_func, void *user_data);
MS2_PUBLIC void ms_list_for_each3(const MSList *list, MSIterate3Func iterate_func, void *user_data, void *factory);
/** Finds and remove given element in list.
* @param list List in which element must be removed
......@@ -337,14 +348,14 @@ MS2_PUBLIC bool_t ms_tags_list_contains_tag(const MSList *list, const char *tag)
*
* This must be called once before calling any other API.
*/
MS2_PUBLIC void ms_base_init(void);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_base_init(void);
/**
* Initialize the mediastreamer2 VoIP library.
*
* This must be called one before calling any other API.
*/
MS2_PUBLIC void ms_voip_init(void);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_voip_init(void);
/**
* Load the plugins from the default plugin directory.
......@@ -352,13 +363,13 @@ MS2_PUBLIC void ms_voip_init(void);
* This is just a wrapper around ms_load_plugins().
* This must be called after ms_base_init() and after ms_voip_init().
*/
MS2_PUBLIC void ms_plugins_init(void);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_plugins_init(void);
/**
* Set the directory from where the plugins are to be loaded when calling ms_plugins_init().
* @param[in] path The path to the plugins directory.
*/
MS2_PUBLIC void ms_set_plugins_dir(const char *path);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_set_plugins_dir(const char *path);
/**
* Load plugins from a specific directory.
......@@ -371,26 +382,26 @@ MS2_PUBLIC void ms_set_plugins_dir(const char *path);
*
* Returns: >0 if successfull, 0 if not plugins loaded, -1 otherwise.
*/
MS2_PUBLIC int ms_load_plugins(const char *directory);
MS2_PUBLIC LINPHONE_DEPRECATED int ms_load_plugins(const char *directory);
/**
* Release resource allocated in the mediastreamer2 base library.
*
* This must be called once before closing program.
*/
MS2_PUBLIC void ms_base_exit(void);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_base_exit(void);
/**
* Release resource allocated in the mediastreamer2 VoIP library.
*
* This must be called once before closing program.
*/
MS2_PUBLIC void ms_voip_exit(void);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_voip_exit(void);
/**
* Unload the plugins loaded by ms_plugins_init().
*/
MS2_PUBLIC void ms_plugins_exit(void);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_plugins_exit(void);
struct _MSSndCardDesc;
......@@ -407,9 +418,9 @@ MS2_PUBLIC void ms_usleep(uint64_t usec);
* value works for both.
*
**/
MS2_PUBLIC int ms_get_payload_max_size(void);
MS2_PUBLIC LINPHONE_DEPRECATED int ms_get_payload_max_size(void);
MS2_PUBLIC void ms_set_payload_max_size(int size);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_set_payload_max_size(int size);
/**
* Returns the network Max Transmission Unit to reach destination_host.
......@@ -422,8 +433,7 @@ MS2_PUBLIC int ms_discover_mtu(const char *destination_host);
* Set mediastreamer default mtu, used to compute the default RTP max payload size.
* This function will call ms_set_payload_max_size(mtu-[ipv6 header size]).
**/
MS2_PUBLIC void ms_set_mtu(int mtu);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_set_mtu(int mtu);
/**
* Get mediastreamer default mtu, used to compute the default RTP max payload size.
......@@ -433,9 +443,9 @@ MS2_PUBLIC int ms_get_mtu(void);
/**
* Declare how many cpu (cores) are available on the platform
*/
MS2_PUBLIC void ms_set_cpu_count(unsigned int c);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_set_cpu_count(unsigned int c);
MS2_PUBLIC unsigned int ms_get_cpu_count(void);
MS2_PUBLIC LINPHONE_DEPRECATED unsigned int ms_get_cpu_count(void);
/**
* Adds a new entry in the SoundDeviceDescription table
......
......@@ -75,9 +75,10 @@ extern "C" {
/**
* Creates a conference.
* @param params a MSAudioConferenceParams structure, containing conference parameters.
* @param factory a MSFactory structure, containing filters parameters
* @return a MSAudioConference object.
**/
MS2_PUBLIC MSAudioConference * ms_audio_conference_new(const MSAudioConferenceParams *params);
MS2_PUBLIC MSAudioConference * ms_audio_conference_new(const MSAudioConferenceParams *params, MSFactory *factory);
/**
* Gets conference's current parameters.
......@@ -176,7 +177,7 @@ MS2_PUBLIC void ms_audio_endpoint_release_from_stream(MSAudioEndpoint *obj);
/**
* Creates an audio endpoint (or virtual participant) to record the conference into a wav file.
**/
MS2_PUBLIC MSAudioEndpoint * ms_audio_endpoint_new_recorder(void);
MS2_PUBLIC MSAudioEndpoint * ms_audio_endpoint_new_recorder(MSFactory* factory);
/**
* Start audio recording.
......
......@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define mseventqueue_h
#include <mediastreamer2/mscommon.h>
#include <mediastreamer2/msfactory.h>
typedef struct _MSEventQueue MSEventQueue;
......@@ -40,7 +41,7 @@ MS2_PUBLIC MSEventQueue *ms_event_queue_new(void);
* to the event queue.
*
**/
MS2_PUBLIC void ms_set_global_event_queue(MSEventQueue *q);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_set_global_event_queue(MSEventQueue *q);
/**
* Run callbacks associated to the events received.
......@@ -58,6 +59,6 @@ MS2_PUBLIC void ms_event_queue_skip(MSEventQueue *q);
/**
* Destroys an event queue.
**/
//MS2_PUBLIC LINPHONE_DEPRECATED void ms_event_queue_destroy(MSEventQueue *q);
MS2_PUBLIC void ms_event_queue_destroy(MSEventQueue *q);
#endif
......@@ -20,6 +20,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef msfactory_h
#define msfactory_h
#include "mediastreamer2/msfilter.h"
/*do not use these fields directly*/
struct _MSFactory{
MSList *desc_list;
......@@ -38,6 +42,10 @@ struct _MSFactory{
int mtu;
bool_t statistics_enabled;
bool_t voip_initd;
int ref_count;
int managers_ref;
struct _MSSndCardManager* sndcardmanager;
struct _MSWebCamManager* wbcmanager;
};
typedef struct _MSFactory MSFactory;
......@@ -46,6 +54,14 @@ typedef struct _MSFactory MSFactory;
extern "C" {
#endif
#ifndef LINPHONE_DEPRECATED
#if defined(_MSC_VER)
#define LINPHONE_DEPRECATED __declspec(deprecated)
#else
#define LINPHONE_DEPRECATED __attribute__ ((deprecated))
#endif
#endif
/**
* Create a mediastreamer2 factory. This is the root object that will create everything else from mediastreamer2.
**/
......@@ -54,13 +70,13 @@ MS2_PUBLIC MSFactory *ms_factory_new(void);
/**
* Create the fallback factory (for compatibility with applications not using MSFactory to create ms2 object)
**/
MS2_PUBLIC MSFactory *ms_factory_create_fallback(void);
LINPHONE_DEPRECATED MS2_PUBLIC MSFactory *ms_factory_create_fallback(void);
/**
* Used by the legacy functions before MSFactory was added.
* Do not use in an application.
**/
MS2_PUBLIC MSFactory *ms_factory_get_fallback(void);
LINPHONE_DEPRECATED MS2_PUBLIC MSFactory *ms_factory_get_fallback(void);
/**
* Destroy the factory.
......@@ -68,6 +84,17 @@ MS2_PUBLIC MSFactory *ms_factory_get_fallback(void);
**/
MS2_PUBLIC void ms_factory_destroy(MSFactory *factory);
/**
* Exits the factory : unset voip and destroys the factory if there is no references to it.
* Ensures it can be destroyed before destroying all objects created by the factory.
**/
MS2_PUBLIC MSFactory* ms_factory_exit(MSFactory* factory);
MS2_PUBLIC MSFactory* ms_factory_create(MSFactory* f);
MS2_PUBLIC struct _MSSndCardManager* ms_factory_get_snd_manager(MSFactory *f);
MS2_PUBLIC void ms_factory_register_filter(MSFactory *factory, MSFilterDesc *desc);
/**
......@@ -142,7 +169,7 @@ MS2_PUBLIC MSFilterDesc* ms_factory_lookup_filter_by_id( MSFactory* factory, MSF
* @param id a filter interface id
* @return a newly allocated MSList of #MSFilterDesc.
**/
MSList *ms_factory_lookup_filter_by_interface(MSFactory *factory, MSFilterInterfaceId id);
MS2_PUBLIC MSList *ms_factory_lookup_filter_by_interface(MSFactory *factory, MSFilterInterfaceId id);
/**
* Create encoder filter according to codec name.
......@@ -255,8 +282,10 @@ MS2_PUBLIC void ms_factory_uninit_voip(MSFactory *obj);
* @return The created event queue.
*/
MS2_PUBLIC struct _MSEventQueue * ms_factory_create_event_queue(MSFactory *obj);
/**
MS2_PUBLIC void ms_factory_destroy_event_queue(MSFactory *obj);
/**
* Gets the event queue associated with the factory.
* Can be NULL if no event queue has been created.
* @param[in] obj MSFactory object.
......@@ -269,6 +298,8 @@ MS2_PUBLIC void ms_factory_set_event_queue(MSFactory *obj,struct _MSEventQueue *
MS2_PUBLIC int ms_factory_get_payload_max_size(MSFactory *factory);
MS2_PUBLIC void ms_factory_set_payload_max_size(MSFactory *obj, int size);
MS2_PUBLIC void ms_factory_set_mtu(MSFactory *obj, int mtu);
MS2_PUBLIC const struct _MSFmtDescriptor * ms_factory_get_audio_format(MSFactory *obj, const char *mime, int rate, int channels, const char *fmtp);
......
......@@ -243,7 +243,7 @@ extern "C"{
*
* @param desc a filter description.
*/
MS2_PUBLIC void ms_filter_register(MSFilterDesc *desc);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_filter_register(MSFilterDesc *desc);
/**
* Retrieve capture filter that supports encoding to codec name.
......@@ -252,7 +252,7 @@ MS2_PUBLIC void ms_filter_register(MSFilterDesc *desc);
*
* Returns: a MSFilterDesc if successfull, NULL otherwise.
*/
MS2_PUBLIC MSFilterDesc * ms_filter_get_encoding_capturer(const char *mime);
MS2_PUBLIC LINPHONE_DEPRECATED MSFilterDesc * ms_filter_get_encoding_capturer(const char *mime);
/**
* Retrieve render filter that supports decoding to codec name.
......@@ -261,7 +261,7 @@ MS2_PUBLIC MSFilterDesc * ms_filter_get_encoding_capturer(const char *mime);
*
* Returns: a MSFilterDesc if successfull, NULL otherwise.
*/
MS2_PUBLIC MSFilterDesc * ms_filter_get_decoding_renderer(const char *mime);
MS2_PUBLIC LINPHONE_DEPRECATED MSFilterDesc * ms_filter_get_decoding_renderer(const char *mime);
/**
* Retrieve encoders according to codec name.
......@@ -275,7 +275,7 @@ MS2_PUBLIC MSFilterDesc * ms_filter_get_decoding_renderer(const char *mime);
*
* Returns: a MSFilterDesc if successfull, NULL otherwise.
*/
MS2_PUBLIC MSFilterDesc * ms_filter_get_encoder(const char *mime);
MS2_PUBLIC LINPHONE_DEPRECATED MSFilterDesc * ms_filter_get_encoder(const char *mime);
/**
* Retrieve decoders according to codec name.
......@@ -289,7 +289,7 @@ MS2_PUBLIC MSFilterDesc * ms_filter_get_encoder(const char *mime);
*
* Returns: a MSFilterDesc if successfull, NULL otherwise.
*/
MS2_PUBLIC MSFilterDesc * ms_filter_get_decoder(const char *mime);
MS2_PUBLIC LINPHONE_DEPRECATED MSFilterDesc * ms_filter_get_decoder(const char *mime);
/**
* Lookup a mediastreamer2 filter using its name.
......@@ -299,7 +299,7 @@ MS2_PUBLIC MSFilterDesc * ms_filter_get_decoder(const char *mime);
*
* @param filter_name The filter name.
**/
MS2_PUBLIC MSFilterDesc *ms_filter_lookup_by_name(const char *filter_name);
MS2_PUBLIC LINPHONE_DEPRECATED MSFilterDesc *ms_filter_lookup_by_name(const char *filter_name);
/**
* Returns a list of filter descriptions implementing a given interface.
......@@ -307,7 +307,7 @@ MS2_PUBLIC MSFilterDesc *ms_filter_lookup_by_name(const char *filter_name);
* @param id a filter interface id
* @return a newly allocated MSList of #MSFilterDesc.
**/
MS2_PUBLIC MSList *ms_filter_lookup_by_interface(MSFilterInterfaceId id);
MS2_PUBLIC LINPHONE_DEPRECATED MSList *ms_filter_lookup_by_interface(MSFilterInterfaceId id);
/**
* Create encoder filter according to codec name.
......@@ -321,7 +321,7 @@ MS2_PUBLIC MSList *ms_filter_lookup_by_interface(MSFilterInterfaceId id);
*
* Returns: a MSFilter if successfull, NULL otherwise.
*/
MS2_PUBLIC MSFilter * ms_filter_create_encoder(const char *mime);
MS2_PUBLIC LINPHONE_DEPRECATED MSFilter * ms_filter_create_encoder(const char *mime);
/**
* Create decoder filter according to codec name.
......@@ -335,7 +335,7 @@ MS2_PUBLIC MSFilter * ms_filter_create_encoder(const char *mime);
*
* Returns: a MSFilter if successfull, NULL otherwise.
*/
MS2_PUBLIC MSFilter * ms_filter_create_decoder(const char *mime);
MS2_PUBLIC LINPHONE_DEPRECATED MSFilter * ms_filter_create_decoder(const char *mime);
/**
* Check if a encode or decode filter exists for a codec name.
......@@ -349,7 +349,7 @@ MS2_PUBLIC MSFilter * ms_filter_create_decoder(const char *mime);
*
* Returns: TRUE if successfull, FALSE otherwise.
*/
MS2_PUBLIC bool_t ms_filter_codec_supported(const char *mime);
MS2_PUBLIC LINPHONE_DEPRECATED bool_t ms_filter_codec_supported(const char *mime);
/**
* Create decoder filter according to a filter's MSFilterId.
......@@ -358,7 +358,7 @@ MS2_PUBLIC bool_t ms_filter_codec_supported(const char *mime);
*
* Returns: a MSFilter if successfull, NULL otherwise.
*/
MS2_PUBLIC MSFilter *ms_filter_new(MSFilterId id);
MS2_PUBLIC LINPHONE_DEPRECATED MSFilter *ms_filter_new(MSFilterId id);
/**
* Create decoder filter according to a filter's name.
......@@ -367,7 +367,7 @@ MS2_PUBLIC MSFilter *ms_filter_new(MSFilterId id);
*
* Returns: a MSFilter if successfull, NULL otherwise.
*/
MS2_PUBLIC MSFilter *ms_filter_new_from_name(const char *name);
MS2_PUBLIC LINPHONE_DEPRECATED MSFilter *ms_filter_new_from_name(const char *name);
/**
* Create decoder filter according to a filter's description.
......@@ -379,7 +379,7 @@ MS2_PUBLIC MSFilter *ms_filter_new_from_name(const char *name);
*
* Returns: a MSFilter if successfull, NULL otherwise.
*/
MS2_PUBLIC MSFilter *ms_filter_new_from_desc(MSFilterDesc *desc);
MS2_PUBLIC LINPHONE_DEPRECATED MSFilter *ms_filter_new_from_desc(MSFilterDesc *desc);
/**
* Link one OUTPUT pin from a filter to an INPUT pin of another filter.
......@@ -587,26 +587,26 @@ MS2_PUBLIC int ms_connection_helper_unlink(MSConnectionHelper *h, MSFilter *f, i
* \brief Enable processing time measurements statistics for filters.
*
**/
MS2_PUBLIC void ms_filter_enable_statistics(bool_t enabled);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_filter_enable_statistics(bool_t enabled);
/**
* \brief Reset processing time statistics for filters.
*
**/
MS2_PUBLIC void ms_filter_reset_statistics(void);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_filter_reset_statistics(void);
/**
* \brief Retrieves statistics for running filters.
* Returns a list of MSFilterStats
**/
MS2_PUBLIC const MSList * ms_filter_get_statistics(void);
MS2_PUBLIC LINPHONE_DEPRECATED const MSList * ms_filter_get_statistics(void);
/**
* \brief Logs runtime statistics for running filters.
*
**/
MS2_PUBLIC void ms_filter_log_statistics(void);
MS2_PUBLIC LINPHONE_DEPRECATED void ms_filter_log_statistics(void);
......
......@@ -80,7 +80,7 @@ MS2_PUBLIC void ms_media_player_set_eof_callback(MSMediaPlayer *obj, MSMediaPlay
* @param filepath Path of the file to open
* @return TRUE if the file could be opened
*/
MS2_PUBLIC bool_t ms_media_player_open(MSMediaPlayer *obj, const char *filepath);
MS2_PUBLIC bool_t ms_media_player_open(MSMediaPlayer *obj, const char *filepath, MSFactory *factory);
/**
* Close a media file
......
......@@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define sndcard_h
#include <mediastreamer2/mscommon.h>
#include <mediastreamer2/msfactory.h>
/**
* @file mssndcard.h
* @brief mediastreamer2 mssndcard.h include file
......@@ -37,6 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
struct _MSSndCardManager{
MSFactory* factory;
MSList *cards;
MSList *descs;
};
......@@ -130,6 +131,7 @@ typedef struct _MSSndCardDesc MSSndCardDesc;
struct _MSSndCard{
MSSndCardDesc *desc;
MSSndCardManager* sndcardmanager;
char *name;
char *id;
unsigned int capabilities;
......@@ -159,13 +161,15 @@ extern "C"{
*
* Returns: MSSndCardManager if successfull, NULL otherwise.
*/
MS2_PUBLIC MSSndCardManager * ms_snd_card_manager_get(void);
MS2_PUBLIC MSSndCardManager * ms_snd_card_manager_get(MSSndCardManager* scm);
MS2_PUBLIC MSFactory * ms_snd_card_factory_get(MSSndCard * c);
/**
* Destroy a sound card manager object.
*
*/
MS2_PUBLIC void ms_snd_card_manager_destroy(void);
MS2_PUBLIC void ms_snd_card_manager_destroy(void* sndcardmanager);
/**
* Retreive a sound card object based on its name.
......@@ -221,6 +225,8 @@ MS2_PUBLIC const MSList * ms_snd_card_manager_get_list(MSSndCardManager *m);
*
*/
MS2_PUBLIC void ms_snd_card_manager_add_card(MSSndCardManager *m, MSSndCard *c);
MS2_PUBLIC void ms_snd_card_set_manager(MSSndCardManager*m, MSSndCard *c);
/**
* Prepend a list of sound card object to the sound card manager's list.
......
......@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define webcam_h
#include <mediastreamer2/mscommon.h>
#include <mediastreamer2/msfactory.h>
/**
* @file mswebcam.h
......@@ -38,6 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
struct _MSWebCamManager{
MSFactory* factory;
MSList *cams;
MSList *descs;
};
......@@ -54,7 +56,7 @@ struct _MSWebCam;
typedef void (*MSWebCamDetectFunc)(MSWebCamManager *obj);
typedef void (*MSWebCamInitFunc)(struct _MSWebCam *obj);
typedef void (*MSWebCamUninitFunc)(struct _MSWebCam *obj);
typedef struct _MSFilter * (*MSWebCamCreateReaderFunc)(struct _MSWebCam *obj);
typedef struct _MSFilter * (*MSWebCamCreateReaderFunc)(struct _MSWebCam *obj, MSFactory* factory);
typedef bool_t (*MSWebCamEncodeToMimeType)(struct _MSWebCam *obj, const char *mime_type);
struct _MSWebCamDesc{
......@@ -73,6 +75,7 @@ struct _MSWebCamDesc{
typedef struct _MSWebCamDesc MSWebCamDesc;
struct _MSWebCam{
MSWebCamManager* wbcmanager;
MSWebCamDesc *desc;
char *name;
char *id;
......@@ -94,13 +97,17 @@ extern "C"{
*
* Returns: MSWebCamManager if successfull, NULL otherwise.
*/
MS2_PUBLIC MSWebCamManager * ms_web_cam_manager_get(void);
MS2_PUBLIC MSWebCamManager * ms_web_cam_manager_get(MSWebCamManager *scm);
MS2_PUBLIC MSFactory * ms_web_cam_factory_get(MSWebCam *c);
MS2_PUBLIC MSWebCamManager* ms_factory_get_wbc_manager(MSFactory* f);
/**
* Destroy the webcam manager object.
*
*/
MS2_PUBLIC void ms_web_cam_manager_destroy(void);
MS2_PUBLIC void ms_web_cam_manager_destroy(MSWebCamManager* scm);
/**
* Retreive a webcam object based on its name.
......@@ -138,7 +145,9 @@ MS2_PUBLIC const MSList * ms_web_cam_manager_get_list(MSWebCamManager *m);
*
*/
MS2_PUBLIC void ms_web_cam_manager_add_cam(MSWebCamManager *m, MSWebCam *c);
MS2_PUBLIC void ms_web_cam_set_manager(MSWebCamManager*m, MSWebCam *c);
/**
* Add a webcam object on top of list of the webcam manager's list.
*
......@@ -173,7 +182,7 @@ MS2_PUBLIC void ms_web_cam_manager_reload(MSWebCamManager *m);
*
* Returns: A MSFilter if successfull, NULL otherwise.
*/
MS2_PUBLIC struct _MSFilter * ms_web_cam_create_reader(MSWebCam *obj);
MS2_PUBLIC struct _MSFilter * ms_web_cam_create_reader(MSWebCam *obj, MSFactory* factory);
/**
* Create a new webcam object.
......
......@@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <mediastreamer2/mscommon.h>
#include <mediastreamer2/msqueue.h>
#include <mediastreamer2/msfactory.h>
/*
This file declares an API useful to pack/unpack H264 nals as described in RFC3984
It is part of the public API to allow external H264 plugins use this api.
......@@ -46,7 +46,7 @@ typedef struct Rfc3984Context{
MS2_PUBLIC Rfc3984Context *rfc3984_new(void);
MS2_PUBLIC void rfc3984_destroy(Rfc3984Context *ctx);
void rfc3984_init(Rfc3984Context *ctx);
void rfc3984_init(MSFactory* factory, Rfc3984Context *ctx);
MS2_PUBLIC void rfc3984_set_mode(Rfc3984Context *ctx, int mode);
......
......@@ -40,8 +40,8 @@ using namespace::fake_android;
static const float audio_buf_ms=0.01;
static MSSndCard * android_snd_card_new(SoundDeviceDescription *d);
static MSFilter * ms_android_snd_read_new(void);
static MSFilter * ms_android_snd_write_new(void);
static MSFilter * ms_android_snd_read_new(MSFactory* factory);
static MSFilter * ms_android_snd_write_new(MSFactory* factory);
static Library *libmedia=0;
static Library *libutils=0;
......@@ -205,13 +205,13 @@ struct AndroidSndWriteData{
};
static MSFilter *android_snd_card_create_reader(MSSndCard *card){
MSFilter *f=ms_android_snd_read_new();
MSFilter *f=ms_android_snd_read_new(ms_snd_card_factory_get(card));
(static_cast<AndroidSndReadData*>(f->data))->setCard(card);
return f;
}
static MSFilter *android_snd_card_create_writer(MSSndCard *card){
MSFilter *f=ms_android_snd_write_new();
MSFilter *f=ms_android_snd_write_new(ms_snd_card_factory_get(card));