Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
24a19ac7
Commit
24a19ac7
authored
Feb 05, 2008
by
Emmanuel Milou
Browse files
DBus communication for codecs handling
parent
22c7a6a2
Changes
15
Hide whitespace changes
Inline
Side-by-side
sflphone-gtk/src/actions.c
View file @
24a19ac7
...
...
@@ -584,22 +584,44 @@ sflphone_fill_codec_list()
codec_list_clear
();
gchar
**
codecs
=
(
gchar
**
)
dbus_codec_list
();
gchar
**
order
=
(
gchar
**
)
dbus_get_active_codec_list
();
gchar
**
details
;
gchar
**
pl
;
for
(
pl
=
codecs
;
*
codecs
;
codecs
++
)
for
(
pl
=
order
;
*
order
;
order
++
)
{
codec_t
*
c
=
g_new0
(
codec_t
,
1
);
c
->
_payload
=
atoi
(
*
codecs
);
c
->
_payload
=
atoi
(
*
order
);
details
=
(
gchar
**
)
dbus_codec_details
(
c
->
_payload
);
printf
(
"Codec details: %s / %s / %s / %s
\n
"
,
details
[
0
],
details
[
1
],
details
[
2
],
details
[
3
]);
//
printf("Codec details: %s / %s / %s / %s\n",details[0],details[1],details[2],details[3]);
c
->
name
=
details
[
0
];
//codec_set_active(details[0])
;
c
->
is_active
=
TRUE
;
c
->
sample_rate
=
atoi
(
details
[
1
]);
c
->
_bitrate
=
atof
(
details
[
2
]);
c
->
_bandwidth
=
atof
(
details
[
3
]);
codec_list_add
(
c
);
}
for
(
pl
=
codecs
;
*
codecs
;
codecs
++
)
{
//codec_t * c = g_new0(codec_t, 1);
//c->_payload = atoi(*codecs);
details
=
(
gchar
**
)
dbus_codec_details
(
atoi
(
*
codecs
));
//c->name = details[0];
if
(
codec_list_get
(
details
[
0
])
!=
NULL
){
// does nothing - the codec is already in the list, so is active.
}
else
{
codec_t
*
c
=
g_new0
(
codec_t
,
1
);
c
->
_payload
=
atoi
(
*
codecs
);
c
->
name
=
details
[
0
];
c
->
is_active
=
FALSE
;
c
->
sample_rate
=
atoi
(
details
[
1
]);
c
->
_bitrate
=
atof
(
details
[
2
]);
c
->
_bandwidth
=
atof
(
details
[
3
]);
codec_list_add
(
c
);
}
}
}
...
...
sflphone-gtk/src/configurationmanager-glue.h
View file @
24a19ac7
...
...
@@ -390,44 +390,6 @@ static
inline
#endif
gboolean
org_sflphone_SFLphone_ConfigurationManager_get_sample_rate_list
(
DBusGProxy
*
proxy
,
char
***
OUT_list
,
GError
**
error
)
{
return
dbus_g_proxy_call
(
proxy
,
"getSampleRateList"
,
error
,
G_TYPE_INVALID
,
G_TYPE_STRV
,
OUT_list
,
G_TYPE_INVALID
);
}
typedef
void
(
*
org_sflphone_SFLphone_ConfigurationManager_get_sample_rate_list_reply
)
(
DBusGProxy
*
proxy
,
char
*
*
OUT_list
,
GError
*
error
,
gpointer
userdata
);
static
void
org_sflphone_SFLphone_ConfigurationManager_get_sample_rate_list_async_callback
(
DBusGProxy
*
proxy
,
DBusGProxyCall
*
call
,
void
*
user_data
)
{
DBusGAsyncData
*
data
=
(
DBusGAsyncData
*
)
user_data
;
GError
*
error
=
NULL
;
char
**
OUT_list
;
dbus_g_proxy_end_call
(
proxy
,
call
,
&
error
,
G_TYPE_STRV
,
&
OUT_list
,
G_TYPE_INVALID
);
(
*
(
org_sflphone_SFLphone_ConfigurationManager_get_sample_rate_list_reply
)
data
->
cb
)
(
proxy
,
OUT_list
,
error
,
data
->
userdata
);
return
;
}
static
#ifdef G_HAVE_INLINE
inline
#endif
DBusGProxyCall
*
org_sflphone_SFLphone_ConfigurationManager_get_sample_rate_list_async
(
DBusGProxy
*
proxy
,
org_sflphone_SFLphone_ConfigurationManager_get_sample_rate_list_reply
callback
,
gpointer
userdata
)
{
DBusGAsyncData
*
stuff
;
stuff
=
g_new
(
DBusGAsyncData
,
1
);
stuff
->
cb
=
G_CALLBACK
(
callback
);
stuff
->
userdata
=
userdata
;
return
dbus_g_proxy_begin_call
(
proxy
,
"getSampleRateList"
,
org_sflphone_SFLphone_ConfigurationManager_get_sample_rate_list_async_callback
,
stuff
,
g_free
,
G_TYPE_INVALID
);
}
static
#ifdef G_HAVE_INLINE
inline
#endif
gboolean
org_sflphone_SFLphone_ConfigurationManager_get_playback_device_list
(
DBusGProxy
*
proxy
,
char
***
OUT_list
,
GError
**
error
)
{
...
...
@@ -580,22 +542,22 @@ static
inline
#endif
gboolean
org_sflphone_SFLphone_ConfigurationManager_get_
default
_codec_list
(
DBusGProxy
*
proxy
,
char
***
OUT_list
,
GError
**
error
)
org_sflphone_SFLphone_ConfigurationManager_get_
active
_codec_list
(
DBusGProxy
*
proxy
,
char
***
OUT_list
,
GError
**
error
)
{
return
dbus_g_proxy_call
(
proxy
,
"get
Default
CodecList"
,
error
,
G_TYPE_INVALID
,
G_TYPE_STRV
,
OUT_list
,
G_TYPE_INVALID
);
return
dbus_g_proxy_call
(
proxy
,
"get
Active
CodecList"
,
error
,
G_TYPE_INVALID
,
G_TYPE_STRV
,
OUT_list
,
G_TYPE_INVALID
);
}
typedef
void
(
*
org_sflphone_SFLphone_ConfigurationManager_get_
default
_codec_list_reply
)
(
DBusGProxy
*
proxy
,
char
*
*
OUT_list
,
GError
*
error
,
gpointer
userdata
);
typedef
void
(
*
org_sflphone_SFLphone_ConfigurationManager_get_
active
_codec_list_reply
)
(
DBusGProxy
*
proxy
,
char
*
*
OUT_list
,
GError
*
error
,
gpointer
userdata
);
static
void
org_sflphone_SFLphone_ConfigurationManager_get_
default
_codec_list_async_callback
(
DBusGProxy
*
proxy
,
DBusGProxyCall
*
call
,
void
*
user_data
)
org_sflphone_SFLphone_ConfigurationManager_get_
active
_codec_list_async_callback
(
DBusGProxy
*
proxy
,
DBusGProxyCall
*
call
,
void
*
user_data
)
{
DBusGAsyncData
*
data
=
(
DBusGAsyncData
*
)
user_data
;
GError
*
error
=
NULL
;
char
**
OUT_list
;
dbus_g_proxy_end_call
(
proxy
,
call
,
&
error
,
G_TYPE_STRV
,
&
OUT_list
,
G_TYPE_INVALID
);
(
*
(
org_sflphone_SFLphone_ConfigurationManager_get_
default
_codec_list_reply
)
data
->
cb
)
(
proxy
,
OUT_list
,
error
,
data
->
userdata
);
(
*
(
org_sflphone_SFLphone_ConfigurationManager_get_
active
_codec_list_reply
)
data
->
cb
)
(
proxy
,
OUT_list
,
error
,
data
->
userdata
);
return
;
}
...
...
@@ -604,187 +566,35 @@ static
inline
#endif
DBusGProxyCall
*
org_sflphone_SFLphone_ConfigurationManager_get_
default
_codec_list_async
(
DBusGProxy
*
proxy
,
org_sflphone_SFLphone_ConfigurationManager_get_
default
_codec_list_reply
callback
,
gpointer
userdata
)
org_sflphone_SFLphone_ConfigurationManager_get_
active
_codec_list_async
(
DBusGProxy
*
proxy
,
org_sflphone_SFLphone_ConfigurationManager_get_
active
_codec_list_reply
callback
,
gpointer
userdata
)
{
DBusGAsyncData
*
stuff
;
stuff
=
g_new
(
DBusGAsyncData
,
1
);
stuff
->
cb
=
G_CALLBACK
(
callback
);
stuff
->
userdata
=
userdata
;
return
dbus_g_proxy_begin_call
(
proxy
,
"get
Default
CodecList"
,
org_sflphone_SFLphone_ConfigurationManager_get_
default
_codec_list_async_callback
,
stuff
,
g_free
,
G_TYPE_INVALID
);
return
dbus_g_proxy_begin_call
(
proxy
,
"get
Active
CodecList"
,
org_sflphone_SFLphone_ConfigurationManager_get_
active
_codec_list_async_callback
,
stuff
,
g_free
,
G_TYPE_INVALID
);
}
static
#ifdef G_HAVE_INLINE
inline
#endif
gboolean
org_sflphone_SFLphone_ConfigurationManager_set_
codec_prefered_order
(
DBusGProxy
*
proxy
,
const
char
*
IN_
codec_name
,
GError
**
error
)
org_sflphone_SFLphone_ConfigurationManager_set_
active_codec_list
(
DBusGProxy
*
proxy
,
const
char
*
*
IN_
list
,
GError
**
error
)
{
return
dbus_g_proxy_call
(
proxy
,
"set
CodecPreferedOrder
"
,
error
,
G_TYPE_STR
ING
,
IN_
codec_name
,
G_TYPE_INVALID
,
G_TYPE_INVALID
);
return
dbus_g_proxy_call
(
proxy
,
"set
ActiveCodecList
"
,
error
,
G_TYPE_STR
V
,
IN_
list
,
G_TYPE_INVALID
,
G_TYPE_INVALID
);
}
typedef
void
(
*
org_sflphone_SFLphone_ConfigurationManager_set_
codec_prefered_order
_reply
)
(
DBusGProxy
*
proxy
,
GError
*
error
,
gpointer
userdata
);
typedef
void
(
*
org_sflphone_SFLphone_ConfigurationManager_set_
active_codec_list
_reply
)
(
DBusGProxy
*
proxy
,
GError
*
error
,
gpointer
userdata
);
static
void
org_sflphone_SFLphone_ConfigurationManager_set_
codec_prefered_order
_async_callback
(
DBusGProxy
*
proxy
,
DBusGProxyCall
*
call
,
void
*
user_data
)
org_sflphone_SFLphone_ConfigurationManager_set_
active_codec_list
_async_callback
(
DBusGProxy
*
proxy
,
DBusGProxyCall
*
call
,
void
*
user_data
)
{
DBusGAsyncData
*
data
=
(
DBusGAsyncData
*
)
user_data
;
GError
*
error
=
NULL
;
dbus_g_proxy_end_call
(
proxy
,
call
,
&
error
,
G_TYPE_INVALID
);
(
*
(
org_sflphone_SFLphone_ConfigurationManager_set_codec_prefered_order_reply
)
data
->
cb
)
(
proxy
,
error
,
data
->
userdata
);
return
;
}
static
#ifdef G_HAVE_INLINE
inline
#endif
DBusGProxyCall
*
org_sflphone_SFLphone_ConfigurationManager_set_codec_prefered_order_async
(
DBusGProxy
*
proxy
,
const
char
*
IN_codec_name
,
org_sflphone_SFLphone_ConfigurationManager_set_codec_prefered_order_reply
callback
,
gpointer
userdata
)
{
DBusGAsyncData
*
stuff
;
stuff
=
g_new
(
DBusGAsyncData
,
1
);
stuff
->
cb
=
G_CALLBACK
(
callback
);
stuff
->
userdata
=
userdata
;
return
dbus_g_proxy_begin_call
(
proxy
,
"setCodecPreferedOrder"
,
org_sflphone_SFLphone_ConfigurationManager_set_codec_prefered_order_async_callback
,
stuff
,
g_free
,
G_TYPE_STRING
,
IN_codec_name
,
G_TYPE_INVALID
);
}
static
#ifdef G_HAVE_INLINE
inline
#endif
gboolean
org_sflphone_SFLphone_ConfigurationManager_get_codec_prefered_order
(
DBusGProxy
*
proxy
,
char
**
OUT_codec_name
,
GError
**
error
)
{
return
dbus_g_proxy_call
(
proxy
,
"getCodecPreferedOrder"
,
error
,
G_TYPE_INVALID
,
G_TYPE_STRING
,
OUT_codec_name
,
G_TYPE_INVALID
);
}
typedef
void
(
*
org_sflphone_SFLphone_ConfigurationManager_get_codec_prefered_order_reply
)
(
DBusGProxy
*
proxy
,
char
*
OUT_codec_name
,
GError
*
error
,
gpointer
userdata
);
static
void
org_sflphone_SFLphone_ConfigurationManager_get_codec_prefered_order_async_callback
(
DBusGProxy
*
proxy
,
DBusGProxyCall
*
call
,
void
*
user_data
)
{
DBusGAsyncData
*
data
=
(
DBusGAsyncData
*
)
user_data
;
GError
*
error
=
NULL
;
char
*
OUT_codec_name
;
dbus_g_proxy_end_call
(
proxy
,
call
,
&
error
,
G_TYPE_STRING
,
&
OUT_codec_name
,
G_TYPE_INVALID
);
(
*
(
org_sflphone_SFLphone_ConfigurationManager_get_codec_prefered_order_reply
)
data
->
cb
)
(
proxy
,
OUT_codec_name
,
error
,
data
->
userdata
);
return
;
}
static
#ifdef G_HAVE_INLINE
inline
#endif
DBusGProxyCall
*
org_sflphone_SFLphone_ConfigurationManager_get_codec_prefered_order_async
(
DBusGProxy
*
proxy
,
org_sflphone_SFLphone_ConfigurationManager_get_codec_prefered_order_reply
callback
,
gpointer
userdata
)
{
DBusGAsyncData
*
stuff
;
stuff
=
g_new
(
DBusGAsyncData
,
1
);
stuff
->
cb
=
G_CALLBACK
(
callback
);
stuff
->
userdata
=
userdata
;
return
dbus_g_proxy_begin_call
(
proxy
,
"getCodecPreferedOrder"
,
org_sflphone_SFLphone_ConfigurationManager_get_codec_prefered_order_async_callback
,
stuff
,
g_free
,
G_TYPE_INVALID
);
}
static
#ifdef G_HAVE_INLINE
inline
#endif
gboolean
org_sflphone_SFLphone_ConfigurationManager_get_codec_bit_rate
(
DBusGProxy
*
proxy
,
const
char
*
IN_codec_name
,
char
**
OUT_bitrate
,
GError
**
error
)
{
return
dbus_g_proxy_call
(
proxy
,
"getCodecBitRate"
,
error
,
G_TYPE_STRING
,
IN_codec_name
,
G_TYPE_INVALID
,
G_TYPE_STRING
,
OUT_bitrate
,
G_TYPE_INVALID
);
}
typedef
void
(
*
org_sflphone_SFLphone_ConfigurationManager_get_codec_bit_rate_reply
)
(
DBusGProxy
*
proxy
,
char
*
OUT_bitrate
,
GError
*
error
,
gpointer
userdata
);
static
void
org_sflphone_SFLphone_ConfigurationManager_get_codec_bit_rate_async_callback
(
DBusGProxy
*
proxy
,
DBusGProxyCall
*
call
,
void
*
user_data
)
{
DBusGAsyncData
*
data
=
(
DBusGAsyncData
*
)
user_data
;
GError
*
error
=
NULL
;
char
*
OUT_bitrate
;
dbus_g_proxy_end_call
(
proxy
,
call
,
&
error
,
G_TYPE_STRING
,
&
OUT_bitrate
,
G_TYPE_INVALID
);
(
*
(
org_sflphone_SFLphone_ConfigurationManager_get_codec_bit_rate_reply
)
data
->
cb
)
(
proxy
,
OUT_bitrate
,
error
,
data
->
userdata
);
return
;
}
static
#ifdef G_HAVE_INLINE
inline
#endif
DBusGProxyCall
*
org_sflphone_SFLphone_ConfigurationManager_get_codec_bit_rate_async
(
DBusGProxy
*
proxy
,
const
char
*
IN_codec_name
,
org_sflphone_SFLphone_ConfigurationManager_get_codec_bit_rate_reply
callback
,
gpointer
userdata
)
{
DBusGAsyncData
*
stuff
;
stuff
=
g_new
(
DBusGAsyncData
,
1
);
stuff
->
cb
=
G_CALLBACK
(
callback
);
stuff
->
userdata
=
userdata
;
return
dbus_g_proxy_begin_call
(
proxy
,
"getCodecBitRate"
,
org_sflphone_SFLphone_ConfigurationManager_get_codec_bit_rate_async_callback
,
stuff
,
g_free
,
G_TYPE_STRING
,
IN_codec_name
,
G_TYPE_INVALID
);
}
static
#ifdef G_HAVE_INLINE
inline
#endif
gboolean
org_sflphone_SFLphone_ConfigurationManager_get_codec_bandwidth
(
DBusGProxy
*
proxy
,
const
char
*
IN_codec_name
,
char
**
OUT_bandwidth
,
GError
**
error
)
{
return
dbus_g_proxy_call
(
proxy
,
"getCodecBandwidth"
,
error
,
G_TYPE_STRING
,
IN_codec_name
,
G_TYPE_INVALID
,
G_TYPE_STRING
,
OUT_bandwidth
,
G_TYPE_INVALID
);
}
typedef
void
(
*
org_sflphone_SFLphone_ConfigurationManager_get_codec_bandwidth_reply
)
(
DBusGProxy
*
proxy
,
char
*
OUT_bandwidth
,
GError
*
error
,
gpointer
userdata
);
static
void
org_sflphone_SFLphone_ConfigurationManager_get_codec_bandwidth_async_callback
(
DBusGProxy
*
proxy
,
DBusGProxyCall
*
call
,
void
*
user_data
)
{
DBusGAsyncData
*
data
=
(
DBusGAsyncData
*
)
user_data
;
GError
*
error
=
NULL
;
char
*
OUT_bandwidth
;
dbus_g_proxy_end_call
(
proxy
,
call
,
&
error
,
G_TYPE_STRING
,
&
OUT_bandwidth
,
G_TYPE_INVALID
);
(
*
(
org_sflphone_SFLphone_ConfigurationManager_get_codec_bandwidth_reply
)
data
->
cb
)
(
proxy
,
OUT_bandwidth
,
error
,
data
->
userdata
);
return
;
}
static
#ifdef G_HAVE_INLINE
inline
#endif
DBusGProxyCall
*
org_sflphone_SFLphone_ConfigurationManager_get_codec_bandwidth_async
(
DBusGProxy
*
proxy
,
const
char
*
IN_codec_name
,
org_sflphone_SFLphone_ConfigurationManager_get_codec_bandwidth_reply
callback
,
gpointer
userdata
)
{
DBusGAsyncData
*
stuff
;
stuff
=
g_new
(
DBusGAsyncData
,
1
);
stuff
->
cb
=
G_CALLBACK
(
callback
);
stuff
->
userdata
=
userdata
;
return
dbus_g_proxy_begin_call
(
proxy
,
"getCodecBandwidth"
,
org_sflphone_SFLphone_ConfigurationManager_get_codec_bandwidth_async_callback
,
stuff
,
g_free
,
G_TYPE_STRING
,
IN_codec_name
,
G_TYPE_INVALID
);
}
static
#ifdef G_HAVE_INLINE
inline
#endif
gboolean
org_sflphone_SFLphone_ConfigurationManager_get_codec_clock_rate
(
DBusGProxy
*
proxy
,
const
char
*
IN_codec_name
,
char
**
OUT_clockrate
,
GError
**
error
)
{
return
dbus_g_proxy_call
(
proxy
,
"getCodecClockRate"
,
error
,
G_TYPE_STRING
,
IN_codec_name
,
G_TYPE_INVALID
,
G_TYPE_STRING
,
OUT_clockrate
,
G_TYPE_INVALID
);
}
typedef
void
(
*
org_sflphone_SFLphone_ConfigurationManager_get_codec_clock_rate_reply
)
(
DBusGProxy
*
proxy
,
char
*
OUT_clockrate
,
GError
*
error
,
gpointer
userdata
);
static
void
org_sflphone_SFLphone_ConfigurationManager_get_codec_clock_rate_async_callback
(
DBusGProxy
*
proxy
,
DBusGProxyCall
*
call
,
void
*
user_data
)
{
DBusGAsyncData
*
data
=
(
DBusGAsyncData
*
)
user_data
;
GError
*
error
=
NULL
;
char
*
OUT_clockrate
;
dbus_g_proxy_end_call
(
proxy
,
call
,
&
error
,
G_TYPE_STRING
,
&
OUT_clockrate
,
G_TYPE_INVALID
);
(
*
(
org_sflphone_SFLphone_ConfigurationManager_get_codec_clock_rate_reply
)
data
->
cb
)
(
proxy
,
OUT_clockrate
,
error
,
data
->
userdata
);
(
*
(
org_sflphone_SFLphone_ConfigurationManager_set_active_codec_list_reply
)
data
->
cb
)
(
proxy
,
error
,
data
->
userdata
);
return
;
}
...
...
@@ -793,14 +603,14 @@ static
inline
#endif
DBusGProxyCall
*
org_sflphone_SFLphone_ConfigurationManager_
g
et_
codec_clock_rate
_async
(
DBusGProxy
*
proxy
,
const
char
*
IN_
codec_name
,
org_sflphone_SFLphone_ConfigurationManager_
g
et_
codec_clock_rate
_reply
callback
,
gpointer
userdata
)
org_sflphone_SFLphone_ConfigurationManager_
s
et_
active_codec_list
_async
(
DBusGProxy
*
proxy
,
const
char
*
*
IN_
list
,
org_sflphone_SFLphone_ConfigurationManager_
s
et_
active_codec_list
_reply
callback
,
gpointer
userdata
)
{
DBusGAsyncData
*
stuff
;
stuff
=
g_new
(
DBusGAsyncData
,
1
);
stuff
->
cb
=
G_CALLBACK
(
callback
);
stuff
->
userdata
=
userdata
;
return
dbus_g_proxy_begin_call
(
proxy
,
"
g
et
CodecClockRate
"
,
org_sflphone_SFLphone_ConfigurationManager_
g
et_
codec_clock_rate
_async_callback
,
stuff
,
g_free
,
G_TYPE_STR
ING
,
IN_
codec_name
,
G_TYPE_INVALID
);
return
dbus_g_proxy_begin_call
(
proxy
,
"
s
et
ActiveCodecList
"
,
org_sflphone_SFLphone_ConfigurationManager_
s
et_
active_codec_list
_async_callback
,
stuff
,
g_free
,
G_TYPE_STR
V
,
IN_
list
,
G_TYPE_INVALID
);
}
#endif
/* defined DBUS_GLIB_CLIENT_WRAPPERS_org_sflphone_SFLphone_ConfigurationManager */
...
...
sflphone-gtk/src/configwindow.c
View file @
24a19ac7
...
...
@@ -388,7 +388,7 @@ bold_if_default_account(GtkTreeViewColumn *col,
/**
* TODO Action when restore default codecs is done
*/
void
default_codecs(GtkWidget* widget, gpointer data)
{
...
...
@@ -427,7 +427,7 @@ default_codecs(GtkWidget* widget, gpointer data)
codecStore = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(codecTreeView)));
gtk_list_store_reorder(codecStore, new_order);
}
*/
/**
* Create table widget for codecs
*/
...
...
sflphone-gtk/src/dbus.c
View file @
24a19ac7
...
...
@@ -717,14 +717,15 @@ dbus_codec_details( int payload )
}
gchar
**
dbus_default_codec_list
()
gchar
**
dbus_get_active_codec_list
()
{
g_print
(
"Before"
);
gchar
**
array
;
GError
*
error
=
NULL
;
char
**
array
;
org_sflphone_SFLphone_ConfigurationManager_get_default_codec_list
(
org_sflphone_SFLphone_ConfigurationManager_get_active_codec_list
(
configurationManagerProxy
,
&
array
,
&
error
);
...
...
@@ -732,67 +733,39 @@ dbus_default_codec_list()
g_print
(
"After"
);
if
(
error
)
{
g_printerr
(
"Failed to call get_
default
_codec_list() on ConfigurationManager: %s
\n
"
,
g_printerr
(
"Failed to call get_
active
_codec_list() on ConfigurationManager: %s
\n
"
,
error
->
message
);
g_error_free
(
error
);
}
else
{
g_print
(
"DBus called get_
default
_codec_list() on ConfigurationManager
\n
"
);
g_print
(
"DBus called get_
active
_codec_list() on ConfigurationManager
\n
"
);
}
return
array
;
}
void
dbus_set_prefered_codec
(
const
gchar
*
codec
)
{
g_print
(
"Before"
);
GError
*
error
=
NULL
;
org_sflphone_SFLphone_ConfigurationManager_set_codec_prefered_order
(
configurationManagerProxy
,
codec
,
&
error
);
g_print
(
"After"
);
if
(
error
)
{
g_printerr
(
"Failed to call set_prefered_codec() on ConfigurationManager: %s
\n
"
,
error
->
message
);
g_error_free
(
error
);
}
else
{
g_print
(
"DBus called set_prefered_codec() on ConfigurationManager
\n
"
);
}
}
gchar
**
dbus_get_sample_rate_list
()
dbus_set_active_codec_list
(
const
gchar
**
list
)
{
g_print
(
"Before"
);
gchar
**
array
;
GError
*
error
=
NULL
;
org_sflphone_SFLphone_ConfigurationManager_
g
et_
sample_rate
_list
(
org_sflphone_SFLphone_ConfigurationManager_
s
et_
active_codec
_list
(
configurationManagerProxy
,
&
array
,
list
,
&
error
);
g_print
(
"After"
);
if
(
error
)
{
g_printerr
(
"Failed to call
g
et_
sample_rate
_list() on ConfigurationManager: %s
\n
"
,
g_printerr
(
"Failed to call
s
et_
active_codec
_list() on ConfigurationManager: %s
\n
"
,
error
->
message
);
g_error_free
(
error
);
}
else
{
g_print
(
"DBus called
g
et_
sample_rate
_list() on ConfigurationManager
\n
"
);
g_print
(
"DBus called
s
et_
active_codec
_list() on ConfigurationManager
\n
"
);
}
return
array
;
}
sflphone-gtk/src/dbus.h
View file @
24a19ac7
...
...
@@ -56,8 +56,7 @@ void dbus_set_default_account(gchar * accountID);
gchar
**
dbus_codec_list
();
gchar
**
dbus_codec_details
(
int
payload
);
gchar
**
dbus_default_codec_list
();
gchar
**
dbus_get_sample_rate_list
();
void
set_active_codec_list
(
const
gchar
**
list
);
/* Instance */
void
dbus_register
(
int
pid
,
gchar
*
name
);
...
...
src/audio/codecDescriptor.cpp
View file @
24a19ac7
...
...
@@ -20,6 +20,7 @@
*/
#include <iostream>
#include <cstdlib>
#include "audiocodec.h"
#include "codecDescriptor.h"
...
...
@@ -29,25 +30,25 @@
CodecDescriptor
::
CodecDescriptor
()
{
// Default codecs
_codecMap
[
PAYLOAD_CODEC_ULAW
]
=
"PCMU"
;
_codecMap
[
PAYLOAD_CODEC_GSM
]
=
"GSM"
;
_codecMap
[
PAYLOAD_CODEC_ALAW
]
=
"PCMA"
;
#ifdef HAVE_SPEEX
_codecMap
[
PAYLOAD_CODEC_SPEEX
]
=
new
CodecSpeex
(
PAYLOAD_CODEC_SPEEX
);
// TODO: this is a variable payload!
#endif
_codecMap
[
PAYLOAD_CODEC_ILBC_20
]
=
"iLBC"
;
init
();
//#ifdef HAVE_SPEEX
//_codecMap[PAYLOAD_CODEC_SPEEX] = new CodecSpeex(PAYLOAD_CODEC_SPEEX); // TODO: this is a variable payload!
//#endif
}
void
CodecDescriptor
::
init
()
{
_codecMap
[
PAYLOAD_CODEC_ULAW
]
=
"PCMU"
;
_codecMap
[
PAYLOAD_CODEC_GSM
]
=
"GSM"
;
_codecMap
[
PAYLOAD_CODEC_ALAW
]
=
"PCMA"
;
_codecMap
[
PAYLOAD_CODEC_ILBC_20
]
=
"iLBC"
;
// init list of all codecs supported codecs
_codecMap
[
PAYLOAD_CODEC_ULAW
]
=
"PCMU"
;
_codecMap
[
PAYLOAD_CODEC_GSM
]
=
"GSM"
;
_codecMap
[
PAYLOAD_CODEC_ALAW
]
=
"PCMA"
;
_codecMap
[
PAYLOAD_CODEC_ILBC_20
]
=
"iLBC"
;
}
std
::
string
&
CodecDescriptor
::
getCodecName
(
CodecType
payload
)
{
...
...
@@ -151,24 +152,22 @@ CodecDescriptor::getSampleRate(CodecType payload)
}
return
-
1
;
}
/*
int
CodecDescriptor::
getSampleRate(CodecType payload
)
void
CodecDescriptor
::
saveActiveCodecs
(
const
std
::
vector
<
std
::
string
>&
list
)
{
std::string name = getCodecName(payload);
switch(name){
case "PCMU":
return 8000;
case "PCMA":
return 8000;
case "GSM":
return 8000;
case "iLBC":
return 8000;
}
_codecOrder
.
clear
();
// list contains the ordered payload of active codecs picked by the user
// we used the CodecOrder vector to save the order.
int
i
=
0
;
int
payload
;
size_t
size
=
list
.
size
();
while
(
i
<
size
)
{
payload
=
std
::
atoi
(
list
[
i
].
data
());
_codecOrder
.
push_back
((
CodecType
)
payload
);
i
++
;
}
}
*/
src/audio/codecDescriptor.h
View file @
24a19ac7
...
...
@@ -62,7 +62,7 @@ public:
CodecDescriptor
();
~
CodecDescriptor
()
{};
CodecMap
&
getCodecMap
()
{
return
_codecMap
;
}
CodecOrder
&
get
CodecOrder
()
{
return
_codecOrder
;
}
CodecOrder
&
get
ActiveCodecs
()
{
return
_codecOrder
;
}
/**
* Get codec with is associated payload
...
...
@@ -117,6 +117,13 @@ public:
* @return int The clock rate of the specified codec
*/
int
getSampleRate
(
CodecType
payload
);
/**
* Set the order of codecs by their payload
* @param list The ordered list sent by DBus
*/
void
saveActiveCodecs
(
const
std
::
vector
<
std
::
string
>&
list
);
private:
CodecMap
_codecMap
;
CodecOrder
_codecOrder
;
...
...
src/dbus/README
View file @
24a19ac7
...
...
@@ -3,3 +3,6 @@ To build a new dbus interface:
1. Define the API with a xml file.
2. Generate the glue.h header by running "dbusxx-xml2cpp file.xml --adaptor=file.h"
3. Inheritate from that glue.h class in your code.
Example with configurationManager:
dbusxx-xml2cpp configurationmanager-introspec.xml --adaptor=configurationmanager-glue.h
src/dbus/configurationmanager-glue.h
View file @
24a19ac7
...
...
@@ -30,17 +30,12 @@ public:
register_method
(
ConfigurationManager
,
getToneLocaleList
,
_getToneLocaleList_stub
);
register_method
(
ConfigurationManager
,
getVersion
,
_getVersion_stub
);
register_method
(
ConfigurationManager
,
getRingtoneList
,
_getRingtoneList_stub
);
register_method
(
ConfigurationManager
,
getSampleRateList
,
_getSampleRateList_stub
);
register_method
(
ConfigurationManager
,
getPlaybackDeviceList
,
_getPlaybackDeviceList_stub
);
register_method
(
ConfigurationManager
,
getRecordDeviceList
,
_getRecordDeviceList_stub
);
register_method
(
ConfigurationManager
,
getCodecList
,
_getCodecList_stub
);
register_method
(
ConfigurationManager
,
getCodecDetails
,
_getCodecDetails_stub
);
register_method
(
ConfigurationManager
,
getDefaultCodecList
,
_getDefaultCodecList_stub
);
register_method
(
ConfigurationManager
,
setCodecPreferedOrder
,
_setCodecPreferedOrder_stub
);
register_method
(
ConfigurationManager
,
getCodecPreferedOrder
,
_getCodecPreferedOrder_stub
);
register_method
(
ConfigurationManager
,
getCodecBitRate
,
_getCodecBitRate_stub
);
register_method
(
ConfigurationManager
,
getCodecBandwidth
,
_getCodecBandwidth_stub
);
register_method
(
ConfigurationManager
,
getCodecClockRate
,
_getCodecClockRate_stub
);
register_method
(
ConfigurationManager
,
getActiveCodecList
,
_getActiveCodecList_stub
);
register_method
(
ConfigurationManager
,
setActiveCodecList
,
_setActiveCodecList_stub
);
}
::
DBus
::
IntrospectedInterface
*
const
introspect
()
const
...
...
@@ -97,11 +92,6 @@ public:
{
"list"
,
"as"
,
false
},
{
0
,
0
,
0
}
};
static
::
DBus
::
IntrospectedArgument
getSampleRateList_args
[]
=