tizen 2.3.1 release
[framework/api/wav-player.git] / test / multimedia_wav_player_test.c
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License. 
15 */
16
17
18
19 #include <stdio.h>
20 #include <wav_player.h>
21 #include <glib.h>
22 #include <unistd.h>
23 #include <string.h>
24 #include <stdlib.h>
25
26 static GMainLoop *g_mainloop = NULL;
27 static GThread *event_thread;
28
29 gpointer GmainThread(gpointer data){
30         g_mainloop = g_main_loop_new (NULL, 0);
31         g_main_loop_run (g_mainloop);
32
33         return NULL;
34 }
35
36 void _player_stop_cb(int id, void *user_data){
37         printf("complete id = %d,%d\n", id, (int)user_data);
38 }
39
40
41
42 void wav_play_test(){
43         int ret=0;
44         int id;
45         int i;
46         for(i =0 ; i < 100; i++){       
47                 ret = wav_player_start("test.wav", SOUND_TYPE_MEDIA, _player_stop_cb,(void*)i, &id);
48                 printf("wav_player_start(%d)(id=%d) ret = %d\n",i,id, ret);
49
50         }
51 }
52
53 void audio_io_test(){
54         
55 }
56
57 int main(int argc, char**argv)
58 {
59         if( !g_thread_supported() )
60         {
61                 g_thread_init(NULL);
62         }
63
64         GError *gerr = NULL;
65         event_thread = g_thread_create(GmainThread, NULL, 1, &gerr);
66
67         wav_play_test();
68         return 0;
69 }