2 mediastreamer2 library - modular sound and video processing and streaming
3 Copyright (C) 2006 Simon MORLAT (simon.morlat@linphone.org)
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #include <ortp/ortp.h>
24 #define ms_malloc ortp_malloc
25 #define ms_malloc0 ortp_malloc0
26 #define ms_realloc ortp_realloc
27 #define ms_new ortp_new
28 #define ms_new0 ortp_new0
29 #define ms_free ortp_free
30 #define ms_strdup ortp_strdup
31 #define ms_strdup_printf ortp_strdup_printf
33 #define ms_mutex_t ortp_mutex_t
34 #define ms_mutex_init ortp_mutex_init
35 #define ms_mutex_destroy ortp_mutex_destroy
36 #define ms_mutex_lock ortp_mutex_lock
37 #define ms_mutex_unlock ortp_mutex_unlock
39 #define ms_cond_t ortp_cond_t
40 #define ms_cond_init ortp_cond_init
41 #define ms_cond_wait ortp_cond_wait
42 #define ms_cond_signal ortp_cond_signal
43 #define ms_cond_broadcast ortp_cond_broadcast
44 #define ms_cond_destroy ortp_cond_destroy
47 static inline void ms_debug(const char *fmt,...)
51 ortp_logv(ORTP_DEBUG, fmt, args);
56 static inline void ms_debug(const char *fmt,...)
60 ortp_logv(ORTP_DEBUG, fmt, args);
70 #define ms_message ortp_message
71 #define ms_warning ortp_warning
72 #define ms_error ortp_error
73 #define ms_fatal ortp_fatal
75 #define ms_return_val_if_fail(_expr_,_ret_)\
76 if (!(_expr_)) { ms_error("assert "#_expr_ "failed"); return (_ret_);}
78 #define ms_return_if_fail(_expr_) \
79 if (!(_expr_)){ ms_error("assert "#_expr_ "failed"); return ;}
81 #define ms_thread_t ortp_thread_t
82 #define ms_thread_create ortp_thread_create
83 #define ms_thread_join ortp_thread_join
84 #define ms_thread_exit ortp_thread_exit
92 typedef struct _MSList MSList;
95 #define ms_list_next(elem) ((elem)->next)
102 MSList * ms_list_append(MSList *elem, void * data);
103 MSList * ms_list_prepend(MSList *elem, void * data);
104 MSList * ms_list_free(MSList *elem);
105 MSList * ms_list_concat(MSList *first, MSList *second);
106 MSList * ms_list_remove(MSList *first, void *data);
107 int ms_list_size(const MSList *first);
108 void ms_list_for_each(const MSList *list, void (*func)(void *));
109 void ms_list_for_each2(const MSList *list, void (*func)(void *, void *), void *user_data);
110 MSList *ms_list_remove_link(MSList *list, MSList *elem);
111 MSList *ms_list_find(MSList *list, void *data);
112 MSList *ms_list_find_custom(MSList *list, int (*compare_func)(const void *, const void*), void *user_data);
113 void * ms_list_nth_data(const MSList *list, int index);
114 int ms_list_position(const MSList *list, MSList *elem);
115 int ms_list_index(const MSList *list, void *data);
116 MSList *ms_list_insert_sorted(MSList *list, void *data, int (*compare_func)(const void *, const void*));
117 MSList *ms_list_insert(MSList *list, MSList *before, void *data);
118 MSList *ms_list_copy(const MSList *list);
121 #define MIN(a,b) ((a)>(b) ? (b) : (a))
123 #define MAX(a,b) ((a)>(b) ? (a) : (b))
127 * @brief mediastreamer2 mscommon.h include file
129 * This file provide the API needed to initialize
130 * and reset the mediastreamer2 library.
135 * @defgroup mediastreamer2_init Init API - manage mediastreamer2 library.
136 * @ingroup mediastreamer2_api
142 * Initialize the mediastreamer2 library.
144 * This must be called once before calling any other API.
149 * Load plugins from a specific directory.
150 * This method basically loads all libraries in the specified directory and attempts to call a C function called
151 * \<libraryname\>_init. For example if a library 'libdummy.so' or 'libdummy.dll' is found, then the loader tries to locate
152 * a C function called 'libdummy_init()' and calls it if it exists.
153 * ms_load_plugins() can be used to load non-mediastreamer2 plugins as it does not expect mediastreamer2 specific entry points.
155 * @param directory A directory where plugins library are available.
157 * Returns: >0 if successfull, 0 if not plugins loaded, -1 otherwise.
159 int ms_load_plugins(const char *directory);
162 * Release resource allocated in the mediastreamer2 library.
164 * This must be called once before closing program.
168 struct _MSSndCardDesc;
170 void ms_sleep(int seconds);
173 * The max payload size allowed.
174 * Filters that generate data that can be sent through RTP should make packets
175 * whose size is below ms_get_payload_max_size().
176 * The default value is 1440 computed as the standart internet MTU minus IPv6 header,
177 * UDP header and RTP header. As IPV4 header is smaller than IPv6 header, this
178 * value works for both.
181 int ms_get_payload_max_size();
183 void ms_set_payload_max_size(int size);
186 * Returns the network Max Transmission Unit to reach destination_host.
187 * This will attempt to send one or more big packets to destination_host, to a random port.
188 * Those packets are filled with zeroes.
190 int ms_discover_mtu(const char *destination_host);
193 * Set mediastreamer default mtu, used to compute the default RTP max payload size.
194 * This function will call ms_set_payload_max_size(mtu-[ipv6 header size]).
196 void ms_set_mtu(int mtu);