static GstStructure * collect_stream_information (GstDiscoverer * dc, PrivateStream * ps, guint idx) { GstCaps *caps; GstStructure *st; gchar *stname; stname = g_strdup_printf ("stream-%02d", idx); st = gst_structure_empty_new (stname); g_free (stname); /* Get caps */ caps = gst_pad_get_negotiated_caps (ps->pad); if (!caps) { GST_WARNING ("Couldn't get negotiated caps from %s:%s", GST_DEBUG_PAD_NAME (ps->pad)); caps = gst_pad_get_caps (ps->pad); } if (caps) { GST_DEBUG ("Got caps %" GST_PTR_FORMAT, caps); gst_structure_id_set (st, _CAPS_QUARK, GST_TYPE_CAPS, caps, NULL); gst_caps_unref (caps); } if (ps->tags) gst_structure_id_set (st, _TAGS_QUARK, GST_TYPE_STRUCTURE, ps->tags, NULL); return st; }
/** * gst_query_new_buffering * @format: the default #GstFormat for the new query * * Constructs a new query object for querying the buffering status of * a stream. * * Returns: A #GstQuery * * Since: 0.10.20 */ GstQuery * gst_query_new_buffering (GstFormat format) { GstQuery *query; GstStructure *structure; structure = gst_structure_empty_new ("GstQueryBuffering"); /* by default, we configure the answer as no buffering with a 100% buffering * progress */ gst_structure_id_set (structure, GST_QUARK (BUSY), G_TYPE_BOOLEAN, FALSE, GST_QUARK (BUFFER_PERCENT), G_TYPE_INT, 100, GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, GST_BUFFERING_STREAM, GST_QUARK (AVG_IN_RATE), G_TYPE_INT, -1, GST_QUARK (AVG_OUT_RATE), G_TYPE_INT, -1, GST_QUARK (BUFFERING_LEFT), G_TYPE_INT64, G_GINT64_CONSTANT (0), GST_QUARK (ESTIMATED_TOTAL), G_TYPE_INT64, G_GINT64_CONSTANT (-1), GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, GST_QUARK (START_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1), GST_QUARK (STOP_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL); query = gst_query_new (GST_QUERY_BUFFERING, structure); return query; }
/** * gst_query_set_buffering_percent * @query: A valid #GstQuery of type GST_QUERY_BUFFERING. * @busy: if buffering is busy * @percent: a buffering percent * * Set the percentage of buffered data. This is a value between 0 and 100. * The @busy indicator is %TRUE when the buffering is in progress. * * Since: 0.10.20 */ void gst_query_set_buffering_percent (GstQuery * query, gboolean busy, gint percent) { g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING); g_return_if_fail (percent >= 0 && percent <= 100); gst_structure_id_set (query->structure, GST_QUARK (BUSY), G_TYPE_BOOLEAN, busy, GST_QUARK (BUFFER_PERCENT), G_TYPE_INT, percent, NULL); }
/** * gst_query_set_uri: * @query: a #GstQuery with query type GST_QUERY_URI * @uri: the URI to set * * Answer a URI query by setting the requested URI. * * Since: 0.10.22 */ void gst_query_set_uri (GstQuery * query, const gchar * uri) { GstStructure *structure; g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_URI); g_return_if_fail (gst_uri_is_valid (uri)); structure = gst_query_get_structure (query); gst_structure_id_set (structure, GST_QUARK (URI), G_TYPE_STRING, uri, NULL); }
/** * gst_buffer_pool_config_set_allocator: * @config: a #GstBufferPool configuration * @allocator: a #GstAllocator * @params: #GstAllocationParams * * Set the @allocator and @params on @config. * * One of @allocator and @params can be NULL, but not both. When @allocator * is NULL, the default allocator of the pool will use the values in @param * to perform its allocation. When @param is NULL, the pool will use the * provided allocator with its default #GstAllocationParams. * * A call to gst_buffer_pool_set_config() can update the allocator and params * with the values that it is able to do. Some pools are, for example, not able * to operate with different allocators or cannot allocate with the values * specified in @params. Use gst_buffer_pool_get_config() to get the currently * used values. */ void gst_buffer_pool_config_set_allocator (GstStructure * config, GstAllocator * allocator, const GstAllocationParams * params) { g_return_if_fail (config != NULL); g_return_if_fail (allocator != NULL || params != NULL); gst_structure_id_set (config, GST_QUARK (ALLOCATOR), GST_TYPE_ALLOCATOR, allocator, GST_QUARK (PARAMS), GST_TYPE_ALLOCATION_PARAMS, params, NULL); }
/** * gst_query_set_buffering_stats: * @query: A valid #GstQuery of type GST_QUERY_BUFFERING. * @mode: a buffering mode * @avg_in: the average input rate * @avg_out: the average output rate * @buffering_left: amount of buffering time left * * Configures the buffering stats values in @query. * * Since: 0.10.20 */ void gst_query_set_buffering_stats (GstQuery * query, GstBufferingMode mode, gint avg_in, gint avg_out, gint64 buffering_left) { g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING); gst_structure_id_set (query->structure, GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, mode, GST_QUARK (AVG_IN_RATE), G_TYPE_INT, avg_in, GST_QUARK (AVG_OUT_RATE), G_TYPE_INT, avg_out, GST_QUARK (BUFFERING_LEFT), G_TYPE_INT64, buffering_left, NULL); }
/** * gst_query_set_position: * @query: a #GstQuery with query type GST_QUERY_POSITION * @format: the requested #GstFormat * @cur: the position to set * * Answer a position query by setting the requested value in the given format. */ void gst_query_set_position (GstQuery * query, GstFormat format, gint64 cur) { GstStructure *structure; g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_POSITION); structure = gst_query_get_structure (query); gst_structure_id_set (structure, GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, GST_QUARK (CURRENT), G_TYPE_INT64, cur, NULL); }
/** * gst_query_set_duration: * @query: a #GstQuery * @format: the #GstFormat for the duration * @duration: the duration of the stream * * Answer a duration query by setting the requested value in the given format. */ void gst_query_set_duration (GstQuery * query, GstFormat format, gint64 duration) { GstStructure *structure; g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_DURATION); structure = gst_query_get_structure (query); gst_structure_id_set (structure, GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, GST_QUARK (DURATION), G_TYPE_INT64, duration, NULL); }
/** * gst_buffer_pool_config_set_params: * @config: a #GstBufferPool configuration * @caps: caps for the buffers * @size: the size of each buffer, not including prefix and padding * @min_buffers: the minimum amount of buffers to allocate. * @max_buffers: the maximum amount of buffers to allocate or 0 for unlimited. * * Configure @config with the given parameters. */ void gst_buffer_pool_config_set_params (GstStructure * config, GstCaps * caps, guint size, guint min_buffers, guint max_buffers) { g_return_if_fail (config != NULL); g_return_if_fail (max_buffers == 0 || min_buffers <= max_buffers); g_return_if_fail (caps == NULL || gst_caps_is_fixed (caps)); gst_structure_id_set (config, GST_QUARK (CAPS), GST_TYPE_CAPS, caps, GST_QUARK (SIZE), G_TYPE_UINT, size, GST_QUARK (MIN_BUFFERS), G_TYPE_UINT, min_buffers, GST_QUARK (MAX_BUFFERS), G_TYPE_UINT, max_buffers, NULL); }
/** * gst_query_set_latency: * @query: a #GstQuery * @live: if there is a live element upstream * @min_latency: the minimal latency of the live element * @max_latency: the maximal latency of the live element * * Answer a latency query by setting the requested values in the given format. * * Since: 0.10.12 */ void gst_query_set_latency (GstQuery * query, gboolean live, GstClockTime min_latency, GstClockTime max_latency) { GstStructure *structure; g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_LATENCY); structure = gst_query_get_structure (query); gst_structure_id_set (structure, GST_QUARK (LIVE), G_TYPE_BOOLEAN, live, GST_QUARK (MIN_LATENCY), G_TYPE_UINT64, min_latency, GST_QUARK (MAX_LATENCY), G_TYPE_UINT64, max_latency, NULL); }
/** * gst_query_set_seeking: * @query: a #GstQuery * @format: the format to set for the @segment_start and @segment_end values * @seekable: the seekable flag to set * @segment_start: the segment_start to set * @segment_end: the segment_end to set * * Set the seeking query result fields in @query. */ void gst_query_set_seeking (GstQuery * query, GstFormat format, gboolean seekable, gint64 segment_start, gint64 segment_end) { GstStructure *structure; g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEEKING); structure = gst_query_get_structure (query); gst_structure_id_set (structure, GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, GST_QUARK (SEEKABLE), G_TYPE_BOOLEAN, seekable, GST_QUARK (SEGMENT_START), G_TYPE_INT64, segment_start, GST_QUARK (SEGMENT_END), G_TYPE_INT64, segment_end, NULL); }
/** * gst_query_set_segment: * @query: a #GstQuery * @rate: the rate of the segment * @format: the #GstFormat of the segment values (@start_value and @stop_value) * @start_value: the start value * @stop_value: the stop value * * Answer a segment query by setting the requested values. The normal * playback segment of a pipeline is 0 to duration at the default rate of * 1.0. If a seek was performed on the pipeline to play a different * segment, this query will return the range specified in the last seek. * * @start_value and @stop_value will respectively contain the configured * playback range start and stop values expressed in @format. * The values are always between 0 and the duration of the media and * @start_value <= @stop_value. @rate will contain the playback rate. For * negative rates, playback will actually happen from @stop_value to * @start_value. */ void gst_query_set_segment (GstQuery * query, gdouble rate, GstFormat format, gint64 start_value, gint64 stop_value) { GstStructure *structure; g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEGMENT); structure = gst_query_get_structure (query); gst_structure_id_set (structure, GST_QUARK (RATE), G_TYPE_DOUBLE, rate, GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, GST_QUARK (START_VALUE), G_TYPE_INT64, start_value, GST_QUARK (STOP_VALUE), G_TYPE_INT64, stop_value, NULL); }
/** * gst_query_set_convert: * @query: a #GstQuery * @src_format: the source #GstFormat * @src_value: the source value * @dest_format: the destination #GstFormat * @dest_value: the destination value * * Answer a convert query by setting the requested values. */ void gst_query_set_convert (GstQuery * query, GstFormat src_format, gint64 src_value, GstFormat dest_format, gint64 dest_value) { GstStructure *structure; g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CONVERT); structure = gst_query_get_structure (query); gst_structure_id_set (structure, GST_QUARK (SRC_FORMAT), GST_TYPE_FORMAT, src_format, GST_QUARK (SRC_VALUE), G_TYPE_INT64, src_value, GST_QUARK (DEST_FORMAT), GST_TYPE_FORMAT, dest_format, GST_QUARK (DEST_VALUE), G_TYPE_INT64, dest_value, NULL); }
/** * gst_query_set_buffering_range: * @query: a #GstQuery * @format: the format to set for the @start and @stop values * @start: the start to set * @stop: the stop to set * @estimated_total: estimated total amount of download time * * Set the available query result fields in @query. * * Since: 0.10.20 */ void gst_query_set_buffering_range (GstQuery * query, GstFormat format, gint64 start, gint64 stop, gint64 estimated_total) { GstStructure *structure; g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING); structure = gst_query_get_structure (query); gst_structure_id_set (structure, GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, GST_QUARK (START_VALUE), G_TYPE_INT64, start, GST_QUARK (STOP_VALUE), G_TYPE_INT64, stop, GST_QUARK (ESTIMATED_TOTAL), G_TYPE_INT64, estimated_total, NULL); }
/** * gst_query_new_duration: * @format: the #GstFormat for this duration query * * Constructs a new stream duration query object to query in the given format. * Use gst_query_unref() when done with it. A duration query will give the * total length of the stream. * * Returns: A #GstQuery */ GstQuery * gst_query_new_duration (GstFormat format) { GstQuery *query; GstStructure *structure; structure = gst_structure_empty_new ("GstQueryDuration"); gst_structure_id_set (structure, GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, GST_QUARK (DURATION), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL); query = gst_query_new (GST_QUERY_DURATION, structure); return query; }
/** * gst_query_new_latency: * * Constructs a new latency query object. * Use gst_query_unref() when done with it. A latency query is usually performed * by sinks to compensate for additional latency introduced by elements in the * pipeline. * * Returns: A #GstQuery * * Since: 0.10.12 */ GstQuery * gst_query_new_latency (void) { GstQuery *query; GstStructure *structure; structure = gst_structure_empty_new ("GstQueryLatency"); gst_structure_id_set (structure, GST_QUARK (LIVE), G_TYPE_BOOLEAN, FALSE, GST_QUARK (MIN_LATENCY), G_TYPE_UINT64, G_GUINT64_CONSTANT (0), GST_QUARK (MAX_LATENCY), G_TYPE_UINT64, G_GUINT64_CONSTANT (-1), NULL); query = gst_query_new (GST_QUERY_LATENCY, structure); return query; }
/** * gst_query_new_seeking (GstFormat *format) * @format: the default #GstFormat for the new query * * Constructs a new query object for querying seeking properties of * the stream. * * Returns: A #GstQuery */ GstQuery * gst_query_new_seeking (GstFormat format) { GstQuery *query; GstStructure *structure; structure = gst_structure_empty_new ("GstQuerySeeking"); gst_structure_id_set (structure, GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, GST_QUARK (SEEKABLE), G_TYPE_BOOLEAN, FALSE, GST_QUARK (SEGMENT_START), G_TYPE_INT64, G_GINT64_CONSTANT (-1), GST_QUARK (SEGMENT_END), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL); query = gst_query_new (GST_QUERY_SEEKING, structure); return query; }
/** * gst_query_new_segment: * @format: the #GstFormat for the new query * * Constructs a new segment query object. Use gst_query_unref() * when done with it. A segment query is used to discover information about the * currently configured segment for playback. * * Returns: a #GstQuery */ GstQuery * gst_query_new_segment (GstFormat format) { GstQuery *query; GstStructure *structure; structure = gst_structure_empty_new ("GstQuerySegment"); gst_structure_id_set (structure, GST_QUARK (RATE), G_TYPE_DOUBLE, (gdouble) 0.0, GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, GST_QUARK (START_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1), GST_QUARK (STOP_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL); query = gst_query_new (GST_QUERY_SEGMENT, structure); return query; }
/** * gst_query_new_convert: * @src_format: the source #GstFormat for the new query * @value: the value to convert * @dest_format: the target #GstFormat * * Constructs a new convert query object. Use gst_query_unref() * when done with it. A convert query is used to ask for a conversion between * one format and another. * * Returns: A #GstQuery */ GstQuery * gst_query_new_convert (GstFormat src_format, gint64 value, GstFormat dest_format) { GstQuery *query; GstStructure *structure; structure = gst_structure_empty_new ("GstQueryConvert"); gst_structure_id_set (structure, GST_QUARK (SRC_FORMAT), GST_TYPE_FORMAT, src_format, GST_QUARK (SRC_VALUE), G_TYPE_INT64, value, GST_QUARK (DEST_FORMAT), GST_TYPE_FORMAT, dest_format, GST_QUARK (DEST_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL); query = gst_query_new (GST_QUERY_CONVERT, structure); return query; }