summaryrefslogtreecommitdiffstats
path: root/tinyMEDIA/test/test.c
blob: 759a96b599e4afc8b1d55b917bc92cdcb2575332 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
*	
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO 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.
*	
* DOUBANGO 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 DOUBANGO.
*
*/
#include "tinymedia/tmedia.h"
//#include "dummy.h"

#include "tinymedia.h"

#include "test_codecs.h"
#include "test_sessions.h"
#include "test_image_attr.h"
#include "test_qos.h"
#include "test_contents.h"

#define RUN_TEST_LOOP		1

#define RUN_TEST_ALL		0
#define RUN_TEST_CODECS		0
#define RUN_TEST_SESSIONS	0
#define RUN_TEST_QOS		0
#define RUN_TEST_IMAGEATTR	1
#define RUN_TEST_CONTENTS	0


static void test_register_dummy_plugins();
static void test_register_contents_plugins();


#ifdef _WIN32_WCE
int _tmain(int argc, _TCHAR* argv[])
#else
int main()
#endif
{
	/* Register dummy plugins */
	test_register_dummy_plugins();
	/* Register content plugins */
	test_register_contents_plugins();

	do {

#if RUN_TEST_ALL  || RUN_TEST_CODECS
		test_codecs();
#endif

#if RUN_TEST_ALL  || RUN_TEST_SESSIONS
		test_sessions();
#endif

#if RUN_TEST_ALL  || RUN_TEST_QOS
		test_qos();
#endif

#if RUN_TEST_ALL  || RUN_TEST_IMAGEATTR
		test_qos_imageattr();
#endif

#if RUN_TEST_ALL  || RUN_TEST_CONTENTS
		test_contents();
#endif
		
	}
	while(RUN_TEST_LOOP);
	
	return 0;
}


void test_register_contents_plugins()
{
	tmedia_content_plugin_register("text/html", tmedia_content_dummy_plugin_def_t);
	tmedia_content_plugin_register("text/plain", tmedia_content_dummy_plugin_def_t);
	tmedia_content_plugin_register("message/CPIM", tmedia_content_cpim_plugin_def_t);
}

void test_register_dummy_plugins()
{
	int ret;

	/* === Sessions === */
	if((ret = tmedia_session_plugin_register(tmedia_session_daudio_plugin_def_t))){
		TSK_DEBUG_ERROR("Failed to register audio plugin");
	}
	if((ret = tmedia_session_plugin_register(tmedia_session_dvideo_plugin_def_t))){
		TSK_DEBUG_ERROR("Failed to register video plugin");
	}
	if((ret = tmedia_session_plugin_register(tmedia_session_dmsrp_plugin_def_t))){
		TSK_DEBUG_ERROR("Failed to register msrp plugin");
	}
	if((ret = tmedia_session_plugin_register(tmedia_session_ghost_plugin_def_t))){
		TSK_DEBUG_ERROR("Failed to register ghost plugin");
	}

	/* === Codecs === */
	if((ret = tmedia_codec_plugin_register(tmedia_codec_dpcma_plugin_def_t))){
		TSK_DEBUG_ERROR("Failed to register G.711a plugin");
	}
	if((ret = tmedia_codec_plugin_register(tmedia_codec_dpcmu_plugin_def_t))){
		TSK_DEBUG_ERROR("Failed to register G.711u plugin");
	}
	if((ret = tmedia_codec_plugin_register(tmedia_codec_dh263_plugin_def_t))){
		TSK_DEBUG_ERROR("Failed to register H.263-1996 plugin");
	}
	if((ret = tmedia_codec_plugin_register(tmedia_codec_dh264_plugin_def_t))){
		TSK_DEBUG_ERROR("Failed to register H.264 (Base profile 10) plugin");
	}
}

//#ifdef _WIN32_WCE
//int _tmain(int argc, _TCHAR* argv[])
//#else
//int main()
//#endif
//{
//	while(1)
//	{
//		tmedia_t* dummy = tsk_null;
//		
//		// Register dummy media
//		tmedia_plugin_register(dummy_plugin_def_t);
//		// ...if you have another one to register
//		// ...and another
//		// ...again and again
//		
//		// Create dummy media
//		if((dummy = tmedia_factory_create("dummy plugin", "127.0.0.1", tnet_socket_type_udp_ipv4))){
//
//			tmedia_get_local_offer(dummy,
//				TSDP_HEADER_A_VA_ARGS("file-disposition", "attachment"),
//				
//				tsk_null
//				);
//			tmedia_get_negotiated_offer(dummy);
//			tmedia_set_remote_offer(dummy, tsk_null);		
//
//			tmedia_start(dummy);
//			tmedia_pause(dummy);
//
//			tmedia_perform(dummy, tma_dummy_say_hello,
//				TSK_PARAM_VA_ARGS("to", "doubango"),
//
//				tsk_null);
//
//			tmedia_stop(dummy);
//			
//			TSK_OBJECT_SAFE_FREE(dummy);
//		}
//	}
//	
//	return 0;
//}

OpenPOWER on IntegriCloud