Exemplo n.º 1
0
def add_recorder():
	global g_rec_file
	global g_rec_id
	global g_rec_port
	
	file_name = ""
	status = -1
	rec_id = 0
	
	print "Enter the path of the file recorder(e.g. /tmp/audio.wav): ",
	file_name = sys.stdin.readline()
	if file_name == "\n": 
		return
	file_name = file_name.replace("\n", "")
	status, rec_id = py_pjsua.recorder_create(file_name, 0, None, 0, 0)
	if status != 0:
		py_pjsua.perror(THIS_FILE, "Error adding file recorder ", status)
	else:
		g_rec_file = file_name
		g_rec_id = rec_id
		g_rec_port = py_pjsua.recorder_get_conf_port(rec_id)
		write_log(3, "File recorder " + file_name + " added")
Exemplo n.º 2
0
print "py media player create status " + `status` + " id " + `id`
if status != 0 :
	py_pjsua.perror("py_pjsua","player create",status)
c_id = py_pjsua.player_get_conf_port(id)
print "py media player get conf port id " + `c_id`
status = py_pjsua.player_set_pos(id, 10)
if status != 0 :
	py_pjsua.perror("py_pjsua","player set pos",status)
status = py_pjsua.player_destroy(id)
if status != 0 :
	py_pjsua.perror("py_pjsua","player destroy",status)
status, id = py_pjsua.recorder_create("rec.wav", 0, "None", 1000, 0)
print "py media recorder create status " + `status` + " id " + `id`
if status != 0 :
	py_pjsua.perror("py_pjsua","recorder create",status)
status = py_pjsua.recorder_get_conf_port(id)
print "py media recorder get conf port status " + `status`
if status != 0 :
	py_pjsua.perror("py_pjsua","recorder get conf port",status)
status = py_pjsua.recorder_destroy(id)
print "py media recorder destroy status " + `status`
if status != 0 :
	py_pjsua.perror("py_pjsua","recorder destroy",status)
#cdev, pdev = py_pjsua.get_snd_dev()
#print "py media get snd dev capture dev " + `cdev` + " playback dev " + `pdev`
status = py_pjsua.set_snd_dev(0,1)
print "py media set snd dev status " + `status`
if status != 0 :
	py_pjsua.perror("py_pjsua","set snd dev",status)
status = py_pjsua.set_null_snd_dev()
print "py media set null snd dev status " + `status`