void fs_rtp_blueprints_unref (FsMediaType media_type) { codecs_lists_ref[media_type]--; if (!codecs_lists_ref[media_type]) { if (list_codec_blueprints[media_type]) { GList *item; for (item = list_codec_blueprints[media_type]; item; item = g_list_next (item)) { codec_blueprint_destroy (item->data); } g_list_free (list_codec_blueprints[media_type]); list_codec_blueprints[media_type] = NULL; } } }
static CodecBlueprint * load_codec_blueprint (FsMediaType media_type, gchar **in, gsize *size) { CodecBlueprint *codec_blueprint = g_slice_new0 (CodecBlueprint); gchar *tmp; gint tmp_size; int i; gint id; gchar *encoding_name = NULL; guint clock_rate; READ_CHECK (read_codec_blueprint_int (in, size, &(id))); READ_CHECK (read_codec_blueprint_string (in, size, &(encoding_name))); READ_CHECK (read_codec_blueprint_uint (in, size, &(clock_rate))); codec_blueprint->codec = fs_codec_new (id, encoding_name, media_type, clock_rate); g_free (encoding_name); READ_CHECK (read_codec_blueprint_uint (in, size, &(codec_blueprint->codec->channels))); READ_CHECK (read_codec_blueprint_int (in, size, &tmp_size)); for (i = 0; i < tmp_size; i++) { gchar *name, *value; READ_CHECK (read_codec_blueprint_string (in, size, &(name))); READ_CHECK (read_codec_blueprint_string (in, size, &(value))); fs_codec_add_optional_parameter (codec_blueprint->codec, name, value); g_free (name); g_free (value); } READ_CHECK (read_codec_blueprint_string (in, size, &tmp)); codec_blueprint->media_caps = gst_caps_from_string (tmp); g_free (tmp); READ_CHECK (read_codec_blueprint_string (in, size, &tmp)); codec_blueprint->rtp_caps = gst_caps_from_string (tmp); g_free (tmp); READ_CHECK (read_codec_blueprint_int (in, size, &tmp_size)); for (i = 0; i < tmp_size; i++) { int j, tmp_size2; GList *tmplist = NULL; READ_CHECK (read_codec_blueprint_int (in, size, &tmp_size2)); for (j = 0; j < tmp_size2; j++) { GstElementFactory *fact = NULL; READ_CHECK (read_codec_blueprint_string (in, size, &(tmp))); fact = gst_element_factory_find (tmp); g_free (tmp); if (!fact) goto error; tmplist = g_list_append (tmplist, fact); } codec_blueprint->send_pipeline_factory = g_list_append (codec_blueprint->send_pipeline_factory, tmplist); } READ_CHECK (read_codec_blueprint_int (in, size, &tmp_size)); for (i = 0; i < tmp_size; i++) { int j, tmp_size2; GList *tmplist = NULL; READ_CHECK (read_codec_blueprint_int (in, size, &tmp_size2)); for (j = 0; j < tmp_size2; j++) { GstElementFactory *fact = NULL; READ_CHECK (read_codec_blueprint_string (in, size, &(tmp))); fact = gst_element_factory_find (tmp); g_free (tmp); if (!fact) goto error; tmplist = g_list_append (tmplist, fact); } codec_blueprint->receive_pipeline_factory = g_list_append (codec_blueprint->receive_pipeline_factory, tmplist); } GST_DEBUG ("adding codec %s with pt %d, send_pipeline %p, receive_pipeline %p", codec_blueprint->codec->encoding_name, codec_blueprint->codec->id, codec_blueprint->send_pipeline_factory, codec_blueprint->receive_pipeline_factory); return codec_blueprint; error: codec_blueprint_destroy (codec_blueprint); return NULL; }