static void set_camerabin2_caps_from_string (void) { GstCaps *caps = NULL; if (image_capture_caps_str != NULL) { caps = gst_caps_from_string (image_capture_caps_str); if (GST_CAPS_IS_SIMPLE (caps) && image_width > 0 && image_height > 0) { gst_caps_set_simple (caps, "width", G_TYPE_INT, image_width, "height", G_TYPE_INT, image_height, NULL); } GST_DEBUG ("setting image-capture-caps: %" GST_PTR_FORMAT, caps); g_object_set (camerabin, "image-capture-caps", caps, NULL); gst_caps_unref (caps); } if (viewfinder_caps_str != NULL) { caps = gst_caps_from_string (viewfinder_caps_str); if (GST_CAPS_IS_SIMPLE (caps) && view_framerate_num > 0 && view_framerate_den > 0) { gst_caps_set_simple (caps, "framerate", GST_TYPE_FRACTION, view_framerate_num, view_framerate_den, NULL); } GST_DEBUG ("setting viewfinder-caps: %" GST_PTR_FORMAT, caps); g_object_set (camerabin, "viewfinder-caps", caps, NULL); gst_caps_unref (caps); } if (video_capture_caps_str != NULL) { caps = gst_caps_from_string (video_capture_caps_str); GST_DEBUG ("setting video-capture-caps: %" GST_PTR_FORMAT, caps); g_object_set (camerabin, "video-capture-caps", caps, NULL); gst_caps_unref (caps); } }
/** * gst_codec_utils_h265_caps_set_level_tier_and_profile: * @caps: the #GstCaps to which the level, tier and profile are to be added * @profile_tier_level: Pointer to the profile_tier_level struct * @len: Length of the data available in @profile_tier_level. * * Sets the level, tier and profile in @caps if it can be determined from * @profile_tier_level. See gst_codec_utils_h265_get_level(), * gst_codec_utils_h265_get_tier() and gst_codec_utils_h265_get_profile() * for more details on the parameters. * * Returns: %TRUE if the level, tier, profile could be set, %FALSE otherwise. * * Since 1.4 */ gboolean gst_codec_utils_h265_caps_set_level_tier_and_profile (GstCaps * caps, const guint8 * profile_tier_level, guint len) { const gchar *level, *tier, *profile; g_return_val_if_fail (GST_IS_CAPS (caps), FALSE); g_return_val_if_fail (GST_CAPS_IS_SIMPLE (caps), FALSE); g_return_val_if_fail (GST_SIMPLE_CAPS_HAS_NAME (caps, "video/x-h265"), FALSE); g_return_val_if_fail (profile_tier_level != NULL, FALSE); level = gst_codec_utils_h265_get_level (profile_tier_level, len); if (level != NULL) gst_caps_set_simple (caps, "level", G_TYPE_STRING, level, NULL); tier = gst_codec_utils_h265_get_tier (profile_tier_level, len); if (tier != NULL) gst_caps_set_simple (caps, "tier", G_TYPE_STRING, tier, NULL); profile = gst_codec_utils_h265_get_profile (profile_tier_level, len); if (profile != NULL) gst_caps_set_simple (caps, "profile", G_TYPE_STRING, profile, NULL); GST_LOG ("profile : %s", (profile) ? profile : "---"); GST_LOG ("tier : %s", (tier) ? tier : "---"); GST_LOG ("level : %s", (level) ? level : "---"); return (level != NULL && tier != NULL && profile != NULL); }
static GstCaps * gst_video_scale_transform_caps (GstBaseTransform * trans, GstPadDirection direction, GstCaps * caps) { GstCaps *ret; GstStructure *structure; /* this function is always called with a simple caps */ g_return_val_if_fail (GST_CAPS_IS_SIMPLE (caps), NULL); GST_DEBUG_OBJECT (trans, "Transforming caps %" GST_PTR_FORMAT " in direction %s", caps, (direction == GST_PAD_SINK) ? "sink" : "src"); ret = gst_caps_copy (caps); structure = gst_structure_copy (gst_caps_get_structure (ret, 0)); gst_structure_set (structure, "width", GST_TYPE_INT_RANGE, 1, G_MAXINT, "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); /* if pixel aspect ratio, make a range of it */ if (gst_structure_has_field (structure, "pixel-aspect-ratio")) { gst_structure_set (structure, "pixel-aspect-ratio", GST_TYPE_FRACTION_RANGE, 1, G_MAXINT, G_MAXINT, 1, NULL); } gst_caps_append_structure (ret, structure); GST_DEBUG_OBJECT (trans, "returning caps: %" GST_PTR_FORMAT, ret); return ret; }
static GstCaps * gst_caps_setter_transform_caps (GstBaseTransform * trans, GstPadDirection direction, GstCaps * caps) { GstCapsSetter *filter; GstCaps *ret, *filter_caps; GstStructure *structure, *merge; const gchar *name; gint i, j; filter = GST_CAPS_SETTER (trans); GST_DEBUG_OBJECT (trans, "receiving caps: %" GST_PTR_FORMAT, caps); ret = gst_caps_copy (caps); /* this function is always called with a simple caps */ if (!GST_CAPS_IS_SIMPLE (ret) || direction != GST_PAD_SINK) return ret; structure = gst_caps_get_structure (ret, 0); name = gst_structure_get_name (structure); GST_OBJECT_LOCK (filter); filter_caps = gst_caps_ref (filter->caps); GST_OBJECT_UNLOCK (filter); for (i = 0; i < gst_caps_get_size (filter_caps); ++i) { merge = gst_caps_get_structure (filter_caps, i); if (gst_structure_has_name (merge, name) || !filter->join) { if (!filter->join) gst_structure_set_name (structure, gst_structure_get_name (merge)); if (filter->replace) gst_structure_remove_all_fields (structure); for (j = 0; j < gst_structure_n_fields (merge); ++j) { const gchar *fname; fname = gst_structure_nth_field_name (merge, j); gst_structure_set_value (structure, fname, gst_structure_get_value (merge, fname)); } } } GST_DEBUG_OBJECT (trans, "returning caps: %" GST_PTR_FORMAT, ret); gst_caps_unref (filter_caps); return ret; }
static gchar * debug_dump_describe_caps (GstCaps * caps, GstDebugGraphDetails details) { gchar *media = NULL; if (details & GST_DEBUG_GRAPH_SHOW_CAPS_DETAILS) { if (gst_caps_is_any (caps) || gst_caps_is_empty (caps)) { media = gst_caps_to_string (caps); } else { GString *str = NULL; guint i; guint slen = 0; for (i = 0; i < gst_caps_get_size (caps); i++) { slen += 25 + STRUCTURE_ESTIMATED_STRING_LEN (gst_caps_get_structure (caps, i)); } str = g_string_sized_new (slen); for (i = 0; i < gst_caps_get_size (caps); i++) { GstCapsFeatures *features = __gst_caps_get_features_unchecked (caps, i); GstStructure *structure = gst_caps_get_structure (caps, i); g_string_append (str, gst_structure_get_name (structure)); if (features && (gst_caps_features_is_any (features) || !gst_caps_features_is_equal (features, GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY))) { g_string_append_c (str, '('); priv_gst_caps_features_append_to_gstring (features, str); g_string_append_c (str, ')'); } g_string_append (str, "\\l"); gst_structure_foreach (structure, string_append_field, (gpointer) str); } media = g_string_free (str, FALSE); } } else { if (GST_CAPS_IS_SIMPLE (caps)) media = g_strdup (gst_structure_get_name (gst_caps_get_structure (caps, 0))); else media = g_strdup ("*"); } return media; }
/* this is not made atomic because if the buffer were reffed from multiple * threads, it would have a refcount > 2 and thus be immutable. */ void gst_buffer_set_caps (GstBuffer * buffer, GstCaps * caps) { g_return_if_fail (buffer != NULL); g_return_if_fail (caps == NULL || GST_CAPS_IS_SIMPLE (caps)); #if GST_VERSION_NANO == 1 /* we enable this extra debugging in git versions only for now */ g_warn_if_fail (gst_buffer_is_metadata_writable (buffer)); /* FIXME: would be nice to also check if caps are fixed here, but expensive */ #endif gst_caps_replace (&GST_BUFFER_CAPS (buffer), caps); }
static GstCaps * gst_ffmpegscale_transform_caps (GstBaseTransform * trans, GstPadDirection direction, GstCaps * caps, GstCaps * filter) { GstCaps *ret; GstStructure *structure; const GValue *par; /* this function is always called with a simple caps */ g_return_val_if_fail (GST_CAPS_IS_SIMPLE (caps), NULL); structure = gst_caps_get_structure (caps, 0); ret = gst_caps_copy (caps); structure = gst_structure_copy (gst_caps_get_structure (ret, 0)); gst_structure_set (structure, "width", GST_TYPE_INT_RANGE, 1, G_MAXINT, "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); ret = gst_caps_merge_structure (ret, gst_structure_copy (structure)); /* if pixel aspect ratio, make a range of it */ if ((par = gst_structure_get_value (structure, "pixel-aspect-ratio"))) { gst_structure_set (structure, "pixel-aspect-ratio", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); ret = gst_caps_merge_structure (ret, structure); } else { gst_structure_free (structure); } /* now also unfix colour space format */ gst_caps_append (ret, gst_ffmpegscale_caps_remove_format_info (ret)); GST_DEBUG_OBJECT (trans, "returning caps: %" GST_PTR_FORMAT, ret); return ret; }
/* set a list of integer values on the caps, e.g. for sample rates */ static void gst_ffmpeg_mux_simple_caps_set_int_list (GstCaps * caps, const gchar * field, guint num, const gint * values) { GValue list = { 0, }; GValue val = { 0, }; gint i; g_return_if_fail (GST_CAPS_IS_SIMPLE (caps)); g_value_init (&list, GST_TYPE_LIST); g_value_init (&val, G_TYPE_INT); for (i = 0; i < num; ++i) { g_value_set_int (&val, values[i]); gst_value_list_append_value (&list, &val); } gst_structure_set_value (gst_caps_get_structure (caps, 0), field, &list); g_value_unset (&val); g_value_unset (&list); }
/* * bt_wave_load_from_uri: * @self: the wave to load * @uri: the location to load from * * Load the wavedata from the @uri. * * Returns: %TRUE if the wavedata could be loaded */ static gboolean bt_wave_load_from_uri (const BtWave * const self, const gchar * const uri) { gboolean res = TRUE, done = FALSE; GstElement *pipeline; GstElement *src, *dec, *conv, *fmt, *sink; GstBus *bus = NULL; GstCaps *caps; GstMessage *msg; GstBtNote root_note = BT_WAVELEVEL_DEFAULT_ROOT_NOTE; GST_INFO ("about to load sample %s / %s", self->priv->uri, uri); // this leaks! //GST_INFO("current dir is %s", g_get_current_dir()); // check if the url is valid // if(!uri) goto invalid_uri; // create loader pipeline pipeline = gst_pipeline_new ("wave-loader"); src = gst_element_make_from_uri (GST_URI_SRC, uri, NULL, NULL); dec = gst_element_factory_make ("decodebin", NULL); conv = gst_element_factory_make ("audioconvert", NULL); fmt = gst_element_factory_make ("capsfilter", NULL); sink = gst_element_factory_make ("fdsink", NULL); // configure elements caps = gst_caps_new_simple ("audio/x-raw", "format", G_TYPE_STRING, GST_AUDIO_NE (S16), "layout", G_TYPE_STRING, "interleaved", "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT, "channels", GST_TYPE_INT_RANGE, 1, 2, NULL); g_object_set (fmt, "caps", caps, NULL); gst_caps_unref (caps); if ((self->priv->fd = g_file_open_tmp (NULL, NULL, NULL)) == -1) { res = FALSE; GST_WARNING ("Can't create tempfile."); goto Error; } g_object_set (sink, "fd", self->priv->fd, "sync", FALSE, NULL); // add and link gst_bin_add_many (GST_BIN (pipeline), src, dec, conv, fmt, sink, NULL); res = gst_element_link (src, dec); if (!res) { GST_WARNING_OBJECT (pipeline, "Can't link wave loader pipeline (src ! dec ! conv ! fmt ! sink)."); goto Error; } res = gst_element_link_many (conv, fmt, sink, NULL); if (!res) { GST_WARNING_OBJECT (pipeline, "Can't link wave loader pipeline (conf ! fmt ! sink)."); goto Error; } g_signal_connect (dec, "pad-added", G_CALLBACK (on_wave_loader_new_pad), (gpointer) conv); /* TODO(ensonic): during loading wave-data (into wavelevels) * - use statusbar for loader progress ("status" property like in song_io) * - should we do some size checks to avoid unpacking the audio track of a full * video on a machine with low memory * - if so, how to get real/virtual memory sizes? * mallinfo() not enough, sysconf()? */ bus = gst_element_get_bus (pipeline); // play and wait for EOS if (gst_element_set_state (pipeline, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) { GST_WARNING_OBJECT (pipeline, "Can't set wave loader pipeline for %s / %s to playing", self->priv->uri, uri); gst_element_set_state (pipeline, GST_STATE_NULL); res = FALSE; goto Error; } else { GST_INFO_OBJECT (pipeline, "loading sample ..."); } /* load wave in sync mode, loading them async causes troubles in the * persistence code and makes testing complicated */ while (!done) { msg = gst_bus_poll (bus, GST_MESSAGE_EOS | GST_MESSAGE_ERROR | GST_MESSAGE_TAG, GST_CLOCK_TIME_NONE); if (!msg) break; switch (msg->type) { case GST_MESSAGE_EOS: res = done = TRUE; break; case GST_MESSAGE_ERROR: BT_GST_LOG_MESSAGE_ERROR (msg, NULL, NULL); res = FALSE; done = TRUE; break; case GST_MESSAGE_TAG:{ GstTagList *tags; #if GST_CHECK_VERSION(1,3,0) guint base_note; #endif gst_message_parse_tag (msg, &tags); #if GST_CHECK_VERSION(1,3,0) if (gst_tag_list_get_uint (tags, GST_TAG_MIDI_BASE_NOTE, &base_note)) { // map midi note -> BtNote gint octave = base_note / 12; gint tone = base_note - (octave * 12); root_note = GSTBT_NOTE_C_0 + (octave * 16) + tone; GST_INFO_OBJECT (GST_MESSAGE_SRC (msg), "root_note: %d (base_note: %u = oct: %d + tone: %d", root_note, base_note, octave, tone); } #endif gst_tag_list_unref (tags); break; } default: break; } gst_message_unref (msg); } if (res) { GstPad *pad; gint64 duration; guint64 length = 0; gint channels = 1, rate = GST_AUDIO_DEF_RATE; gpointer data = NULL; struct stat buf; res = FALSE; GST_INFO ("sample loaded"); // query length and convert to samples if (!gst_element_query_duration (pipeline, GST_FORMAT_TIME, &duration)) { GST_WARNING ("getting sample duration failed"); } // get caps for sample rate and channels if ((pad = gst_element_get_static_pad (fmt, "src"))) { GstCaps *caps = gst_pad_get_current_caps (pad); if (caps && GST_CAPS_IS_SIMPLE (caps)) { GstStructure *structure = gst_caps_get_structure (caps, 0); gst_structure_get_int (structure, "channels", &channels); gst_structure_get_int (structure, "rate", &rate); length = gst_util_uint64_scale (duration, (guint64) rate, GST_SECOND); } else { GST_WARNING ("No caps or format has not been fixed."); } if (caps) gst_caps_unref (caps); gst_object_unref (pad); } GST_INFO ("sample decoded: channels=%d, rate=%d, length=%" GST_TIME_FORMAT, channels, rate, GST_TIME_ARGS (duration)); if (!(fstat (self->priv->fd, &buf))) { if (lseek (self->priv->fd, 0, SEEK_SET) == 0) { if ((data = g_try_malloc (buf.st_size))) { /* mmap is unsave for removable drives :( * gpointer data=mmap(void *start, buf->st_size, PROT_READ, MAP_SHARED, self->priv->fd, 0); */ BtWavelevel *wavelevel; ssize_t bytes = read (self->priv->fd, data, buf.st_size); self->priv->channels = channels; g_object_notify (G_OBJECT (self), "channels"); wavelevel = bt_wavelevel_new (self->priv->song, self, root_note, (gulong) length, 0, length, rate, (gconstpointer) data); g_object_unref (wavelevel); GST_INFO ("sample loaded (%" G_GSSIZE_FORMAT "/%ld bytes)", bytes, buf.st_size); res = TRUE; } else { GST_WARNING ("sample is too long or empty (%ld bytes), not trying to load", buf.st_size); } } else { GST_WARNING ("can't seek to start of sample data"); } } else { GST_WARNING ("can't stat() sample"); } } Error: if (bus) gst_object_unref (bus); if (pipeline) { gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (pipeline); } if (!res) wave_io_free (self); return res; }
bool Caps::isSimple() const { return GST_CAPS_IS_SIMPLE(object<GstCaps>()); }
static GstCaps * gst_video_rate_transform_caps (GstBaseTransform * trans, GstPadDirection direction, GstCaps * caps) { GstVideoRate *videorate = GST_VIDEO_RATE (trans); GstCaps *ret; GstStructure *s, *s2; GstStructure *s3 = NULL; int maxrate = g_atomic_int_get (&videorate->max_rate); /* Should always be called with simple caps */ g_return_val_if_fail (GST_CAPS_IS_SIMPLE (caps), NULL); ret = gst_caps_copy (caps); s = gst_caps_get_structure (ret, 0); s2 = gst_structure_copy (s); if (videorate->drop_only) { gint min_num = 0, min_denom = 1; gint max_num = G_MAXINT, max_denom = 1; /* Clamp the caps to our maximum rate as the first caps if possible */ if (!gst_video_max_rate_clamp_structure (s, maxrate, &min_num, &min_denom, &max_num, &max_denom)) { min_num = 0; min_denom = 1; max_num = maxrate; max_denom = 1; /* clamp wouldn't be a real subset of 1..maxrate, in this case the sink * caps should become [1..maxrate], [1..maxint] and the src caps just * [1..maxrate]. In case there was a caps incompatibility things will * explode later as appropriate :) * * In case [X..maxrate] == [X..maxint], skip as we'll set it later */ if (direction == GST_PAD_SRC && maxrate != G_MAXINT) gst_structure_set (s, "framerate", GST_TYPE_FRACTION_RANGE, min_num, min_denom, maxrate, 1, NULL); else gst_caps_remove_structure (ret, 0); } if (direction == GST_PAD_SRC) { /* We can accept anything as long as it's at least the minimal framerate * the the sink needs */ gst_structure_set (s2, "framerate", GST_TYPE_FRACTION_RANGE, min_num, min_denom, G_MAXINT, 1, NULL); /* Also allow unknown framerate, if it isn't already */ if (min_num != 0 || min_denom != 1) { s3 = gst_structure_copy (s); gst_structure_set (s3, "framerate", GST_TYPE_FRACTION, 0, 1, NULL); } } else if (max_num != 0 || max_denom != 1) { /* We can provide everything upto the maximum framerate at the src */ gst_structure_set (s2, "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, max_num, max_denom, NULL); } } else if (direction == GST_PAD_SINK) { gint min_num = 0, min_denom = 1; gint max_num = G_MAXINT, max_denom = 1; if (!gst_video_max_rate_clamp_structure (s, maxrate, &min_num, &min_denom, &max_num, &max_denom)) gst_caps_remove_structure (ret, 0); gst_structure_set (s2, "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, maxrate, 1, NULL); } else { /* set the framerate as a range */ gst_structure_set (s2, "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); } gst_caps_merge_structure (ret, s2); if (s3 != NULL) gst_caps_merge_structure (ret, s3); return ret; }
/* * debug_dump_element: * @bin: the bin that should be analyzed * @out: file to write to * @indent: level of graph indentation * * Helper for _gst_debug_bin_to_dot_file() to recursively dump a pipeline. */ static void debug_dump_element (GstBin * bin, GstDebugGraphDetails details, FILE * out, const gint indent) { GstIterator *element_iter, *pad_iter; gboolean elements_done, pads_done; GstElement *element, *peer_element, *target_element; GstPad *pad, *peer_pad, *target_pad; GstPadDirection dir; GstCaps *caps; GstStructure *structure; gboolean free_caps, free_media; guint src_pads, sink_pads; gchar *media = NULL; gchar *pad_name, *element_name; gchar *peer_pad_name, *peer_element_name; gchar *target_pad_name, *target_element_name; gchar *color_name; gchar *state_name = NULL; gchar *param_name = NULL; gchar *spc = NULL; spc = g_malloc (1 + indent * 2); memset (spc, 32, indent * 2); spc[indent * 2] = '\0'; element_iter = gst_bin_iterate_elements (bin); elements_done = FALSE; while (!elements_done) { switch (gst_iterator_next (element_iter, (gpointer) & element)) { case GST_ITERATOR_OK: element_name = debug_dump_make_object_name (GST_OBJECT (element)); if (details & GST_DEBUG_GRAPH_SHOW_STATES) { state_name = debug_dump_get_element_state (GST_ELEMENT (element)); } if (details & GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS) { param_name = debug_dump_get_element_params (GST_ELEMENT (element)); } /* elements */ fprintf (out, "%ssubgraph cluster_%s {\n", spc, element_name); fprintf (out, "%s fontname=\"Bitstream Vera Sans\";\n", spc); fprintf (out, "%s fontsize=\"8\";\n", spc); fprintf (out, "%s style=filled;\n", spc); fprintf (out, "%s color=black;\n\n", spc); fprintf (out, "%s label=\"<%s>\\n%s%s%s\";\n", spc, G_OBJECT_TYPE_NAME (element), GST_OBJECT_NAME (element), (state_name ? state_name : ""), (param_name ? param_name : "") ); if (state_name) { g_free (state_name); state_name = NULL; } if (param_name) { g_free (param_name); param_name = NULL; } g_free (element_name); src_pads = sink_pads = 0; if ((pad_iter = gst_element_iterate_pads (element))) { pads_done = FALSE; while (!pads_done) { switch (gst_iterator_next (pad_iter, (gpointer) & pad)) { case GST_ITERATOR_OK: dir = gst_pad_get_direction (pad); pad_name = debug_dump_make_object_name (GST_OBJECT (pad)); element_name = debug_dump_make_object_name (GST_OBJECT (element)); if (GST_IS_GHOST_PAD (pad)) { color_name = (dir == GST_PAD_SRC) ? "#ffdddd" : ((dir == GST_PAD_SINK) ? "#ddddff" : "#ffffff"); } else { color_name = (dir == GST_PAD_SRC) ? "#ffaaaa" : ((dir == GST_PAD_SINK) ? "#aaaaff" : "#cccccc"); } /* pads */ fprintf (out, "%s %s_%s [color=black, fillcolor=\"%s\", label=\"%s\"];\n", spc, element_name, pad_name, color_name, GST_OBJECT_NAME (pad)); if (dir == GST_PAD_SRC) src_pads++; else if (dir == GST_PAD_SINK) sink_pads++; g_free (pad_name); g_free (element_name); gst_object_unref (pad); break; case GST_ITERATOR_RESYNC: gst_iterator_resync (pad_iter); break; case GST_ITERATOR_ERROR: case GST_ITERATOR_DONE: pads_done = TRUE; break; } } gst_iterator_free (pad_iter); } if (GST_IS_BIN (element)) { fprintf (out, "%s fillcolor=\"#ffffff\";\n", spc); /* recurse */ debug_dump_element (GST_BIN (element), details, out, indent + 1); } else { if (src_pads && !sink_pads) fprintf (out, "%s fillcolor=\"#ffaaaa\";\n", spc); else if (!src_pads && sink_pads) fprintf (out, "%s fillcolor=\"#aaaaff\";\n", spc); else if (src_pads && sink_pads) fprintf (out, "%s fillcolor=\"#aaffaa\";\n", spc); else fprintf (out, "%s fillcolor=\"#ffffff\";\n", spc); } fprintf (out, "%s}\n\n", spc); if ((pad_iter = gst_element_iterate_pads (element))) { pads_done = FALSE; while (!pads_done) { switch (gst_iterator_next (pad_iter, (gpointer) & pad)) { case GST_ITERATOR_OK: if (gst_pad_is_linked (pad) && gst_pad_get_direction (pad) == GST_PAD_SRC) { if ((peer_pad = gst_pad_get_peer (pad))) { free_media = FALSE; if ((details & GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE) || (details & GST_DEBUG_GRAPH_SHOW_CAPS_DETAILS) ) { if ((caps = gst_pad_get_negotiated_caps (pad))) { free_caps = TRUE; } else { free_caps = FALSE; if (!(caps = (GstCaps *) gst_pad_get_pad_template_caps (pad))) { /* this should not happen */ media = "?"; } } if (caps) { if (details & GST_DEBUG_GRAPH_SHOW_CAPS_DETAILS) { gchar *tmp = g_strdelimit (gst_caps_to_string (caps), ",", '\n'); media = g_strescape (tmp, NULL); free_media = TRUE; g_free (tmp); } else { if (GST_CAPS_IS_SIMPLE (caps)) { structure = gst_caps_get_structure (caps, 0); media = (gchar *) gst_structure_get_name (structure); } else media = "*"; } if (free_caps) { gst_caps_unref (caps); } } } pad_name = debug_dump_make_object_name (GST_OBJECT (pad)); element_name = debug_dump_make_object_name (GST_OBJECT (element)); peer_pad_name = debug_dump_make_object_name (GST_OBJECT (peer_pad)); if ((peer_element = gst_pad_get_parent_element (peer_pad))) { peer_element_name = debug_dump_make_object_name (GST_OBJECT (peer_element)); } else { peer_element_name = ""; } /* pad link */ if (media) { fprintf (out, "%s%s_%s -> %s_%s [label=\"%s\"]\n", spc, element_name, pad_name, peer_element_name, peer_pad_name, media); if (free_media) { g_free (media); } } else { fprintf (out, "%s%s_%s -> %s_%s\n", spc, element_name, pad_name, peer_element_name, peer_pad_name); } if (GST_IS_GHOST_PAD (pad)) { if ((target_pad = gst_ghost_pad_get_target (GST_GHOST_PAD (pad)))) { target_pad_name = debug_dump_make_object_name (GST_OBJECT (target_pad)); if ((target_element = gst_pad_get_parent_element (target_pad))) { target_element_name = debug_dump_make_object_name (GST_OBJECT (target_element)); } else { target_element_name = ""; } /* src ghostpad relationship */ fprintf (out, "%s%s_%s -> %s_%s [style=dashed]\n", spc, target_element_name, target_pad_name, element_name, pad_name); g_free (target_pad_name); if (target_element) { g_free (target_element_name); gst_object_unref (target_element); } gst_object_unref (target_pad); } } if (GST_IS_GHOST_PAD (peer_pad)) { if ((target_pad = gst_ghost_pad_get_target (GST_GHOST_PAD (peer_pad)))) { target_pad_name = debug_dump_make_object_name (GST_OBJECT (target_pad)); if ((target_element = gst_pad_get_parent_element (target_pad))) { target_element_name = debug_dump_make_object_name (GST_OBJECT (target_element)); } else { target_element_name = ""; } /* sink ghostpad relationship */ fprintf (out, "%s%s_%s -> %s_%s [style=dashed]\n", spc, peer_element_name, peer_pad_name, target_element_name, target_pad_name); g_free (target_pad_name); if (target_element) { g_free (target_element_name); gst_object_unref (target_element); } gst_object_unref (target_pad); } } g_free (pad_name); g_free (element_name); g_free (peer_pad_name); if (peer_element) { g_free (peer_element_name); gst_object_unref (peer_element); } gst_object_unref (peer_pad); } } gst_object_unref (pad); break; case GST_ITERATOR_RESYNC: gst_iterator_resync (pad_iter); break; case GST_ITERATOR_ERROR: case GST_ITERATOR_DONE: pads_done = TRUE; break; } } gst_iterator_free (pad_iter); } gst_object_unref (element); break; case GST_ITERATOR_RESYNC: gst_iterator_resync (element_iter); break; case GST_ITERATOR_ERROR: case GST_ITERATOR_DONE: elements_done = TRUE; break; } } gst_iterator_free (element_iter); g_free (spc); }
/* Method: simple? * Returns: whether the caps contains multiple structure. */ static VALUE rg_simple_p (VALUE self) { return CBOOL2RVAL(GST_CAPS_IS_SIMPLE(RGST_CAPS (self))); }