static void codecs_box_set_codecs (CodecsBox *self, const Ekiga::CodecList & list) { GtkTreeSelection *selection = NULL; GtkTreeModel *model = NULL; GtkTreeIter iter; gchar *selected_codec = NULL; unsigned select_rate = 0; bool selected = false; model = gtk_tree_view_get_model (GTK_TREE_VIEW (self->priv->codecs_list)); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (self->priv->codecs_list)); if (gtk_tree_selection_get_selected (selection, &model, &iter)) gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, COLUMN_CODEC_NAME, &selected_codec, COLUMN_CODEC_INFO, &select_rate, -1); gtk_list_store_clear (GTK_LIST_STORE (model)); for (Ekiga::CodecList::const_iterator itr = list.begin (); itr != list.end (); itr++) { if ((self->priv->type == Ekiga::Call::Audio && (*itr).audio) || (self->priv->type == Ekiga::Call::Video && !(*itr).audio)) { gtk_list_store_append (GTK_LIST_STORE (model), &iter); gtk_list_store_set (GTK_LIST_STORE (model), &iter, COLUMN_CODEC_ACTIVE, (*itr).active, COLUMN_CODEC_NAME, (*itr).name.c_str (), COLUMN_CODEC_DISPLAY_NAME, (*itr).display_name.c_str (), COLUMN_CODEC_INFO, (*itr).display_info.c_str (), COLUMN_CODEC_SELECTABLE, "true", -1); if (selected_codec && (*itr).name == selected_codec) { selected = true; gtk_tree_selection_select_iter (selection, &iter); } } } if (!selected && gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter)) gtk_tree_selection_select_iter (selection, &iter); g_free (selected_codec); }
void CallManager::set_codecs (Ekiga::CodecList & _codecs) { PStringArray initial_order; PStringArray initial_mask; OpalMediaFormatList all_media_formats; OpalMediaFormatList media_formats; PStringArray order; PStringArray mask; // What do we support GetAllowedFormats (all_media_formats); Ekiga::CodecList all_codecs = Opal::CodecList (all_media_formats); // // Clean the CodecList given as paramenter : remove unsupported codecs and // add missing codecs at the end of the list // // Build the Ekiga::CodecList taken into account by the CallManager // It contains codecs given as argument to set_codecs, and other codecs // supported by the manager for (Ekiga::CodecList::iterator it = all_codecs.begin (); it != all_codecs.end (); it++) { Ekiga::CodecList::iterator i = search_n (_codecs.begin (), _codecs.end (), 1, *it, same_codec_desc); if (i == _codecs.end ()) { _codecs.append (*it); } } // Remove unsupported codecs for (Ekiga::CodecList::iterator it = _codecs.begin (); it != _codecs.end (); it++) { Ekiga::CodecList::iterator i = search_n (all_codecs.begin (), all_codecs.end (), 1, *it, same_codec_desc); if (i == all_codecs.end ()) { _codecs.remove (it); it = _codecs.begin (); } } codecs = _codecs; // // Update OPAL // Ekiga::CodecList::iterator codecs_it; for (codecs_it = codecs.begin () ; codecs_it != codecs.end () ; codecs_it++) { bool active = (*codecs_it).active; std::string name = (*codecs_it).name; unsigned rate = (*codecs_it).rate; int j = 0; // Find the OpalMediaFormat corresponding to the Ekiga::CodecDescription if (active) { for (j = 0 ; j < all_media_formats.GetSize () ; j++) { if (name == (const char *) all_media_formats [j].GetEncodingName () && (rate == all_media_formats [j].GetClockRate () || name == "G722")) { // Found something order += all_media_formats [j]; } } } } // Add the PCSS codecs all_media_formats = pcssEP->GetMediaFormats (); for (int j = 0 ; j < all_media_formats.GetSize () ; j++) order += all_media_formats [j]; // Build the mask all_media_formats = OpalTranscoder::GetPossibleFormats (pcssEP->GetMediaFormats ()); all_media_formats.Remove (order); for (int i = 0 ; i < all_media_formats.GetSize () ; i++) mask += all_media_formats [i]; // Blacklist IM protocols for now mask += "T.140"; mask += "MSRP"; mask += "SIP-IM"; // Blacklist NSE, since it is unused in ekiga and might create // problems with some registrars (such as Eutelia) mask += "NamedSignalEvent"; // Update the OpalManager SetMediaFormatMask (mask); SetMediaFormatOrder (order); }
void CallManager::set_codecs (Ekiga::CodecList & _codecs) { PStringArray initial_order; PStringArray initial_mask; OpalMediaFormatList all_media_formats; OpalMediaFormatList media_formats; PStringArray order; PStringArray mask; // What do we support GetAllowedFormats (all_media_formats); Ekiga::CodecList all_codecs = Opal::CodecList (all_media_formats); // // Clean the CodecList given as paramenter : remove unsupported codecs and // add missing codecs at the end of the list // // Build the Ekiga::CodecList taken into account by the CallManager // It contains codecs given as argument to set_codecs, and other codecs // supported by the manager for (Ekiga::CodecList::iterator it = all_codecs.begin (); it != all_codecs.end (); it++) { Ekiga::CodecList::iterator i = search_n (_codecs.begin (), _codecs.end (), 1, *it, same_codec_desc); if (i == _codecs.end ()) { _codecs.push_back (*it); } } // Remove unsupported codecs for (Ekiga::CodecList::iterator it = _codecs.begin (); it != _codecs.end (); it++) { Ekiga::CodecList::iterator i = search_n (all_codecs.begin (), all_codecs.end (), 1, *it, same_codec_desc); if (i == all_codecs.end ()) { _codecs.erase (it); it = _codecs.begin (); } } codecs = _codecs; // // Update OPAL // Ekiga::CodecList::iterator codecs_it; for (codecs_it = codecs.begin () ; codecs_it != codecs.end () ; codecs_it++) { bool active = (*codecs_it).active; std::string name = (*codecs_it).name; unsigned rate = (*codecs_it).rate; int j = 0; // Find the OpalMediaFormat corresponding to the Ekiga::CodecDescription if (active) { for (j = 0 ; j < all_media_formats.GetSize () ; j++) { if (name == (const char *) all_media_formats [j].GetEncodingName () && rate == all_media_formats [j].GetClockRate ()) { // Found something order += all_media_formats [j]; } } } } // Build the mask all_media_formats = OpalTranscoder::GetPossibleFormats (pcssEP->GetMediaFormats ()); all_media_formats.Remove (order); for (int i = 0 ; i < all_media_formats.GetSize () ; i++) mask += all_media_formats [i]; // Update the OpalManager SetMediaFormatMask (mask); SetMediaFormatOrder (order); }