Commit 525dc702 authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

Codec details in GTk client -

Seg fault on opening the config window
parent 6e99f20e
......@@ -590,79 +590,18 @@ sflphone_fill_codec_list()
{
codec_t * c = g_new0(codec_t, 1);
c->_payload = atoi(*codecs);
//codec_set_active(*codecs); // active by default
codec_list_add(c);
details = (gchar **)dbus_codec_details(c->_payload);
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->sample_rate = atoi(details[1]);
printf("sample rate = %i\n", atoi(details[1]));
c->_bitrate = (gdouble)(atoi(details[2]));
printf("bitrate = %d\n", (double)atoi(details[2]));
c->_bandwidth = (gdouble)(atoi(details[3]));
printf("bandwidth = %d\n", (double)atoi(details[3]));
c->_bitrate = atof(details[2]);
c->_bandwidth = atof(details[3]);
codec_list_add(c);
}
//g_strfreev(codecs);
/*
int i;
gchar ** details;
for( i = 0 ; i < codec_list_get_size() ; i++)
{
codec_t * c = codec_list_get_nth(i);
details = (gchar **)dbus_codec_details(c->_payload);
printf("%s\n", details[0]);
c->name = details[0];
c->sample_rate = (guint)details[1];
//c->_bitrate = (gdouble)details[2];
//c->_bandwidth = (gdouble)details[3];
}*/
}
/*
account_list_clear ( );
gchar ** array = (gchar **)dbus_account_list();
gchar ** accountID;
for (accountID = array; *accountID; accountID++)
{
account_t * a = g_new0(account_t,1);
a->accountID = g_strdup(*accountID);
account_list_add(a);
}
g_strfreev (array);
int i;
for( i = 0; i < account_list_get_size(); i++)
{
account_t * a = account_list_get_nth (i);
GHashTable * details = (GHashTable *) dbus_account_details(a->accountID);
a->properties = details;
gchar * status = g_hash_table_lookup(details, "Status");
if(strcmp(status, "REGISTERED") == 0)
{
a->state = ACCOUNT_STATE_REGISTERED;
}
else if(strcmp(status, "UNREGISTERED") == 0)
{
a->state = ACCOUNT_STATE_UNREGISTERED;
}
else if(strcmp(status, "TRYING") == 0)
{
a->state = ACCOUNT_STATE_TRYING;
}
else if(strcmp(status, "ERROR") == 0)
{
a->state = ACCOUNT_STATE_ERROR;
}
*/
......
......@@ -20,6 +20,7 @@
#include <codeclist.h>
#include <string.h>
#include <stdlib.h>
GQueue * codecQueue = NULL;
......@@ -33,6 +34,16 @@ is_name_codecstruct (gconstpointer a, gconstpointer b)
return 1;
}
gint
is_payload_codecstruct (gconstpointer a, gconstpointer b)
{
codec_t * c = (codec_t *)a;
if(c->_payload == (int)b)
return 0;
else
return 1;
}
void
codec_list_init()
{
......@@ -54,17 +65,21 @@ codec_list_add(codec_t * c)
void
codec_set_active(gchar * codec_name)
codec_set_active(gchar* name)
{
codec_t * c = codec_list_get(codec_name);
if(c)
printf("entry point set active");
codec_t * c = codec_list_get(name);
if(c){
printf("blablabla");
c->is_active = TRUE;
}
printf("exit point set active");
}
void
codec_set_inactive(gchar * codec_name)
codec_set_inactive(gchar* name)
{
codec_t * c = codec_list_get(codec_name);
codec_t * c = codec_list_get(name);
if(c)
c->is_active = FALSE;
}
......@@ -74,7 +89,7 @@ codec_list_get_size()
{
return g_queue_get_length(codecQueue);
}
/*
codec_t*
codec_list_get( const gchar * name)
{
......@@ -84,6 +99,16 @@ codec_list_get( const gchar * name)
else
return NULL;
}
*/
codec_t*
codec_list_get( const gchar* name)
{
GList * c = g_queue_find_custom(codecQueue, name, is_name_codecstruct);
if(c)
return (codec_t *)c->data;
else
return NULL;
}
codec_t*
codec_list_get_nth(guint index)
......
......@@ -37,10 +37,11 @@ typedef struct {
void codec_list_init();
void codec_list_clear();
void codec_list_add(codec_t * c);
void codec_set_active(gchar * codec_name);
void codec_set_inactive(gchar * codec_name);
//void codec_set_active(gchar* name);
//void codec_set_inactive(gchar* name);
guint codec_list_get_size();
codec_t * codec_list_get(const gchar * codec_name);
codec_t * codec_list_get(const gchar * name);
//codec_t * codec_list_get(const int payload);
codec_t* codec_list_get_nth(guint index);
/**
......
......@@ -109,9 +109,9 @@ config_window_fill_codec_list()
{
gtk_list_store_append(codecStore, &iter);
gtk_list_store_set(codecStore, &iter,
0, c->is_active, // Active
0, TRUE,//c->is_active, // Active
1, c->name, // Name
2, c->sample_rate, // Frequency
2, "sample rate",//c->sample_rate, // Frequency
3, "bit rate", // Bit rate
4, "bandwith", // Bandwith
-1);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment