0
votes

I code bellow, does rb_gst_get_encoding_profile does not return a gchar* as rec_settings.profile expects.

typedef struct Recording_Settings recording_settings;
struct Recording_Settings
{
    gchar *profile;
    gchar *destination;
};
recording_settings rec_settings;

typedef struct _GstEncodingProfile GstEncodingProfile;
GstEncodingProfile *rb_gst_get_encoding_profile (const char *media_type);

Warning: assignment from incompatible pointer type:

rec_settings.profile = gconf_client_get_string(client, "/apps/sound/recording/profile", NULL);
if (!rec_settings.profile)
    rec_settings.profile = g_strdup("audio/x-vorbis");

static void profile_combo_change_cb(GtkComboBox *combo, gpointer userdata)
{
    GtkTreeIter iter;
    GtkTreeModel *model;

    /* Grab the encoding profile choosen */
    model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
    if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(combo), &iter)) {
        gchar *media_type;
        gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 0, &media_type, -1);
        rec_settings.profile = rb_gst_get_encoding_profile(media_type); // Warning: assignment from incompatible pointer type
        g_free (media_type);
    }
}

I try to fix them. What is the way to do this?

Thanks

audio_profile_combo = audio_profile_chooser_new();
gchar *media_type;
media_type = rb_gst_encoding_profile_get_media_type(rec_settings.profile); // Warning: assignment from incompatible pointer type
audio_profile_chooser_set_active(audio_profile_combo, media_type);
g_free (media_type);
2

2 Answers

0
votes

Change Recording_Settings struct to this:

struct Recording_Settings
{
    GstEncodingProfile *profile;
    gchar *destination;
};

At least, that's what I garner should be done from the little info available.

0
votes

In this line:

rec_settings.profile = rb_gst_get_encoding_profile(media_type);

media_type is a gchar *, but the function rb_gst_get_encoding_profile expects a const char *. That's the cause of the error.

EDIT: not to mention the function itself returns a GstEncodingProfile *, and you're trying to assign it to rec_settings.profile, which is a gchar *.