ring.c 1.53 KB
Newer Older
aymeric's avatar
aymeric committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/*
mediastreamer2 library - modular sound and video processing and streaming
Copyright (C) 2006  Simon MORLAT (simon.morlat@linphone.org)

This program 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 2
of the License, or (at your option) any later version.

This program 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 this program; if not, write to the Free Software
17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
aymeric's avatar
aymeric committed
18 19 20 21 22 23 24 25 26 27
*/


#include "mediastreamer2/mediastream.h"

int main(int argc, char *argv[]){
	RingStream *r;
	const char *file;
	MSSndCard *sc;
	const char * card_id=NULL;
28
	MSFactory *factory;
aymeric's avatar
aymeric committed
29 30

	ortp_init();
31
	ortp_set_log_level_mask(ORTP_LOG_DOMAIN, ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
32 33
	
	
34
	factory = ms_factory_new_with_voip();
35
	
aymeric's avatar
aymeric committed
36 37 38 39 40 41 42
	if (argc>1){
		file=argv[1];
	}else file="/usr/share/sounds/linphone/rings/oldphone.wav";
	if (argc>2){
		card_id=argv[2];
	}

43
	sc=ms_snd_card_manager_get_card(ms_factory_get_snd_card_manager(factory),card_id);
aymeric's avatar
aymeric committed
44 45 46 47 48
#ifdef __linux
	if (sc==NULL)
	  sc = ms_alsa_card_new_custom(card_id, card_id);
#endif

49
	r=ring_start(factory, file,2000,sc);
50
	ms_sleep(10);
aymeric's avatar
aymeric committed
51
	ring_stop(r);
52
	
53
	ms_factory_destroy(factory);
aymeric's avatar
aymeric committed
54 55
	return 0;
}