static void test_filterdesc_enable_disable_base(const char* mime, const char* filtername,bool_t is_enc) {
	MSFilter *filter;

	ms_init();

	if (is_enc)
			filter = ms_filter_create_encoder(mime);
		else
			filter = ms_filter_create_decoder(mime);

	BC_ASSERT_PTR_NOT_NULL(filter);
	ms_filter_destroy(filter);

	BC_ASSERT_FALSE(ms_factory_enable_filter_from_name(ms_factory_get_fallback(),filtername,FALSE));
	BC_ASSERT_FALSE(ms_factory_filter_from_name_enabled(ms_factory_get_fallback(),filtername));
	if (is_enc)
			filter = ms_filter_create_encoder(mime);
		else
			filter = ms_filter_create_decoder(mime);
	BC_ASSERT_PTR_NULL(filter);

	BC_ASSERT_FALSE(ms_factory_enable_filter_from_name(ms_factory_get_fallback(),filtername,TRUE));
	BC_ASSERT_TRUE(ms_factory_filter_from_name_enabled(ms_factory_get_fallback(),filtername));
	if (is_enc)
		filter = ms_filter_create_encoder(mime);
	else
		filter = ms_filter_create_decoder(mime);
	BC_ASSERT_PTR_NOT_NULL(filter);

	ms_filter_destroy(filter);
	ms_exit();
}
Beispiel #2
0
void ms_event_queue_destroy(MSEventQueue *q){
	/*compatibility code*/
	if (q==ms_factory_get_event_queue(ms_factory_get_fallback())){
		ms_factory_set_event_queue(ms_factory_get_fallback(),NULL);
	}
	ms_mutex_destroy(&q->mutex);
	ms_free(q);
}
Beispiel #3
0
JNIEXPORT jboolean JNICALL Java_org_linphone_mediastream_MediastreamerAndroidContext_filterFromNameEnabledImpl(JNIEnv* env, jobject obj, jstring jname) {
	if (ms_factory_get_fallback() == NULL) {
		ms_error("Java_org_linphone_mediastream_MediastreamerAndroidContext_filterFromNameEnabledImpl(): no fallback factory. Use Factory.filterFromNameEnabled()");
		return FALSE;
	}
	const char *mime = jname ? (*env)->GetStringUTFChars(env, jname, NULL) : NULL;
	jboolean result = ms_factory_filter_from_name_enabled(ms_factory_get_fallback(),mime);
	(*env)->ReleaseStringUTFChars(env, jname, mime);
	return result;
}
TextStream *text_stream_new_with_sessions(const MSMediaStreamSessions *sessions) {
	TextStream *stream = (TextStream *)ms_new0(TextStream, 1);
	stream->pt_red = 0;
	stream->pt_t140 = 0;

	stream->ms.type = MSText;
	stream->ms.sessions = *sessions;
	media_stream_init(&stream->ms, ms_factory_get_fallback());

	ms_filter_enable_statistics(TRUE);
	ms_filter_reset_statistics();

	if (sessions->zrtp_context != NULL) {
		ms_zrtp_set_stream_sessions(sessions->zrtp_context, &(stream->ms.sessions));
	}
	if (sessions->dtls_context != NULL) {
		ms_dtls_srtp_set_stream_sessions(sessions->dtls_context, &(stream->ms.sessions));
	}
	rtp_session_resync(stream->ms.sessions.rtp_session);
	/*some filters are created right now to allow configuration by the application before start() */
	stream->ms.rtpsend = ms_filter_new(MS_RTP_SEND_ID);
	stream->ms.ice_check_list = NULL;
	stream->ms.qi = ms_quality_indicator_new(stream->ms.sessions.rtp_session);
	ms_quality_indicator_set_label(stream->ms.qi, "text");
	stream->ms.process_rtcp = text_stream_process_rtcp;

	return stream;
}
Beispiel #5
0
void ms_voip_exit() {
    if (--ms_voip_ref >0 ) {
        ms_message ("Skiping ms_voip_exit, still [%i] ref",ms_voip_ref);
        return;
    }
    ms_srtp_shutdown();
    ms_factory_uninit_voip(ms_factory_get_fallback());
}
Beispiel #6
0
void ms_plugins_init(void) {
	ms_plugins_ref++;
	if ( ms_plugins_ref>1 ) {
		ms_message ("Skiping ms_plugins_init, because [%i] ref",ms_plugins_ref);
		return;
	}
	ms_factory_init_plugins(ms_factory_get_fallback());
}
Beispiel #7
0
void ms_base_exit(){
	--ms_base_ref;
	if ( ms_base_ref>0 ) {
		ms_message ("Skiping ms_base_exit, still [%i] ref",ms_base_ref);
		return;
	}
	ms_factory_destroy(ms_factory_get_fallback());
}
Beispiel #8
0
void ms_plugins_exit(void) {
	--ms_plugins_ref;
	if ( ms_plugins_ref>0 ) {
		ms_message ("Skiping ms_plugins_exit, still [%i] ref",ms_plugins_ref);
		return;
	}
	ms_factory_uninit_plugins(ms_factory_get_fallback());
}
Beispiel #9
0
void ms_voip_init() {
    if (ms_voip_ref++ >0 ) {
        ms_message ("Skiping ms_voip_init, because [%i] ref",ms_voip_ref);
        return;
    }
    ms_srtp_init();
    ms_factory_init_voip(ms_factory_get_fallback());
}
Beispiel #10
0
void ms_base_init(){
	ms_base_ref++;
	if ( ms_base_ref>1 ) {
		ms_message ("Skiping ms_base_init, because [%i] ref",ms_base_ref);
		return;
	}
	ms_factory_create_fallback();
	ms_factory_get_fallback();
}
Beispiel #11
0
static void _create_decoders(MSMediaPlayer *obj) {
	int sample_rate, nchannels;
	switch(obj->format) {
	case FILE_FORMAT_WAVE:
		ms_filter_call_method(obj->player, MS_FILTER_GET_SAMPLE_RATE, &sample_rate);
		ms_filter_call_method(obj->player, MS_FILTER_GET_NCHANNELS, &nchannels);
		obj->audio_pin_fmt.pin = 0;
		obj->audio_pin_fmt.fmt = ms_factory_get_audio_format(ms_factory_get_fallback(), "pcm", sample_rate, nchannels, NULL);
		break;
	case FILE_FORMAT_MATROSKA:
		obj->audio_pin_fmt.pin = 1;
		obj->video_pin_fmt.pin = 0;
		ms_filter_call_method(obj->player, MS_FILTER_GET_OUTPUT_FMT, &obj->audio_pin_fmt);
		ms_filter_call_method(obj->player, MS_FILTER_GET_OUTPUT_FMT, &obj->video_pin_fmt);
		if(obj->audio_pin_fmt.fmt) {
			obj->audio_decoder = ms_factory_create_decoder(ms_factory_get_fallback(), obj->audio_pin_fmt.fmt->encoding);
			if(obj->audio_decoder == NULL) {
				ms_error("Could not create audio decoder for %s", obj->audio_pin_fmt.fmt->encoding);
				obj->audio_pin_fmt.fmt = NULL;
			}
			sample_rate = obj->audio_pin_fmt.fmt->rate;
			nchannels = obj->audio_pin_fmt.fmt->nchannels;
			ms_filter_call_method(obj->audio_decoder, MS_FILTER_SET_SAMPLE_RATE, &sample_rate);
			ms_filter_call_method(obj->audio_decoder, MS_FILTER_SET_NCHANNELS, &nchannels);
		}
		if(obj->video_pin_fmt.fmt) {
			obj->video_decoder = ms_factory_create_decoder(ms_factory_get_fallback(), obj->video_pin_fmt.fmt->encoding);
			if(obj->video_decoder == NULL) {
				ms_error("Could not create video decoder for %s", obj->video_pin_fmt.fmt->encoding);
				obj->video_pin_fmt.fmt = NULL;
			}
		}
		break;
	default:
		break;
	}
}
static void filter_register_tester(void) {
	MSFilter* filter;

	ms_init();
	ms_init();

	CU_ASSERT_PTR_NOT_NULL(ms_filter_lookup_by_name("MSVoidSource"));
	filter= ms_filter_create_decoder("pcma");
	CU_ASSERT_PTR_NOT_NULL(filter);
	ms_filter_destroy(filter);

	ms_exit();

	CU_ASSERT_PTR_NOT_NULL(ms_filter_lookup_by_name("MSVoidSource"));
	filter= ms_filter_create_decoder("pcma");
	CU_ASSERT_PTR_NOT_NULL(filter);
	ms_filter_destroy(filter);

	ms_exit();
	CU_ASSERT_PTR_NULL(ms_factory_get_fallback());
}
Beispiel #13
0
int ms_load_plugins(const char *dir){
	return ms_factory_load_plugins(ms_factory_get_fallback(),dir);
}
Beispiel #14
0
void ms_set_global_event_queue(MSEventQueue *q){
	ms_factory_set_event_queue(ms_factory_get_fallback(),q);
}
Beispiel #15
0
JNIEXPORT jint JNICALL Java_org_linphone_mediastream_MediastreamerAndroidContext_enableFilterFromNameImpl(JNIEnv* env,  jobject obj, jstring jname, jboolean enable) {
	const char *mime = jname ? (*env)->GetStringUTFChars(env, jname, NULL) : NULL;
	int result = ms_factory_enable_filter_from_name(ms_factory_get_fallback(),mime,enable);
	(*env)->ReleaseStringUTFChars(env, jname, mime);
	return result;
}
Beispiel #16
0
void ms_filter_log_statistics(void){
	ms_factory_log_statistics(ms_factory_get_fallback());
}
Beispiel #17
0
unsigned int ms_get_cpu_count() {
	return ms_factory_get_cpu_count(ms_factory_get_fallback());
}
Beispiel #18
0
int ms_get_payload_max_size(){
	return ms_factory_get_payload_max_size(ms_factory_get_fallback());
}
Beispiel #19
0
MSFilter *ms_filter_new_from_desc(MSFilterDesc *desc){
	return ms_factory_create_filter_from_desc(ms_factory_get_fallback(),desc);
}
Beispiel #20
0
MSFilter * ms_filter_create_decoder(const char *mime){
	return ms_factory_create_decoder(ms_factory_get_fallback(),mime);
}
Beispiel #21
0
MSFilterDesc * ms_filter_get_decoder(const char *mime){
	return ms_factory_get_decoder(ms_factory_get_fallback(),mime);
}
Beispiel #22
0
MSFilterDesc * ms_filter_get_encoding_capturer(const char *mime) {
	return ms_factory_get_encoding_capturer(ms_factory_get_fallback(),mime);
}
Beispiel #23
0
MSFilter *ms_filter_new(MSFilterId id){
	return ms_factory_create_filter(ms_factory_get_fallback(),id);
}
Beispiel #24
0
const MSList * ms_filter_get_statistics(void){
	return ms_factory_get_statistics(ms_factory_get_fallback());
}
Beispiel #25
0
void ms_set_plugins_dir(const char *path) {
	ms_factory_set_plugins_dir(ms_factory_get_fallback(),path);
}
Beispiel #26
0
MSFilterDesc *ms_filter_lookup_by_name(const char *filter_name){
	return ms_factory_lookup_filter_by_name(ms_factory_get_fallback(),filter_name);
}
Beispiel #27
0
void ms_set_payload_max_size(int size){
	ms_factory_set_payload_max_size(ms_factory_get_fallback(),size);
}
Beispiel #28
0
MSList *ms_filter_lookup_by_interface(MSFilterInterfaceId id){
	return ms_factory_lookup_filter_by_interface(ms_factory_get_fallback(),id);
}
Beispiel #29
0
void ms_set_cpu_count(unsigned int c) {
	ms_factory_set_cpu_count(ms_factory_get_fallback(),c);
}
Beispiel #30
0
MSFilter *ms_filter_new_from_name(const char *filter_name){
	return ms_factory_create_filter_from_name(ms_factory_get_fallback(),filter_name);
}