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_structure_id_set (query->structure,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (CURRENT), G_TYPE_INT64, cur, NULL);
}
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_POSITION);
- structure = gst_query_get_structure (query);
+ structure = query->structure;
if (format)
*format = g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (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_structure_id_set (query->structure,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (DURATION), G_TYPE_INT64, duration, NULL);
}
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_DURATION);
- structure = gst_query_get_structure (query);
+ structure = query->structure;
if (format)
*format = g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (FORMAT)));
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_structure_id_set (query->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);
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_LATENCY);
- structure = gst_query_get_structure (query);
+ structure = query->structure;
if (live)
*live =
g_value_get_boolean (gst_structure_id_get_value (structure,
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_structure_id_set (query->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,
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CONVERT);
- structure = gst_query_get_structure (query);
+ structure = query->structure;
if (src_format)
*src_format = g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (SRC_FORMAT)));
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_structure_id_set (query->structure,
GST_QUARK (RATE), G_TYPE_DOUBLE, rate,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (START_VALUE), G_TYPE_INT64, start_value,
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEGMENT);
- structure = gst_query_get_structure (query);
+ structure = query->structure;
if (rate)
*rate = g_value_get_double (gst_structure_id_get_value (structure,
GST_QUARK (RATE)));
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_structure_id_set (query->structure,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (SEEKABLE), G_TYPE_BOOLEAN, seekable,
GST_QUARK (SEGMENT_START), G_TYPE_INT64, segment_start,
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEEKING);
- structure = gst_query_get_structure (query);
+ structure = query->structure;
if (format)
*format = g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (FORMAT)));
{
va_list ap;
GValue list = { 0, };
- GstStructure *structure;
gint i;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_FORMATS);
}
va_end (ap);
- structure = gst_query_get_structure (query);
- gst_structure_set_value (structure, "formats", &list);
+ gst_structure_set_value (query->structure, "formats", &list);
g_value_unset (&list);
gst_query_set_formatsv (GstQuery * query, gint n_formats, GstFormat * formats)
{
GValue list = { 0, };
- GstStructure *structure;
gint i;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_FORMATS);
for (i = 0; i < n_formats; i++) {
gst_query_list_add_format (&list, formats[i]);
}
- structure = gst_query_get_structure (query);
- gst_structure_set_value (structure, "formats", &list);
+ gst_structure_set_value (query->structure, "formats", &list);
g_value_unset (&list);
}
void
gst_query_parse_formats_length (GstQuery * query, guint * n_formats)
{
- GstStructure *structure;
-
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_FORMATS);
if (n_formats) {
const GValue *list;
- structure = gst_query_get_structure (query);
- list = gst_structure_get_value (structure, "formats");
+ list = gst_structure_get_value (query->structure, "formats");
if (list == NULL)
*n_formats = 0;
else
void
gst_query_parse_formats_nth (GstQuery * query, guint nth, GstFormat * format)
{
- GstStructure *structure;
-
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_FORMATS);
if (format) {
const GValue *list;
- structure = gst_query_get_structure (query);
- list = gst_structure_get_value (structure, "formats");
+ list = gst_structure_get_value (query->structure, "formats");
if (list == NULL) {
*format = GST_FORMAT_UNDEFINED;
} else {
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_structure_id_set (query->structure,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (START_VALUE), G_TYPE_INT64, start,
GST_QUARK (STOP_VALUE), G_TYPE_INT64, stop,
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
- structure = gst_query_get_structure (query);
+ structure = query->structure;
if (format)
*format = g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (FORMAT)));
gboolean
gst_query_add_buffering_range (GstQuery * query, gint64 start, gint64 stop)
{
- GstStructure *structure;
GValueArray *array;
GValue *last_array_value;
const GValue *value;
if (G_UNLIKELY (start >= stop))
return FALSE;
- structure = gst_query_get_structure (query);
- value = gst_structure_id_get_value (structure, GST_QUARK (BUFFERING_RANGES));
+ value =
+ gst_structure_id_get_value (query->structure,
+ GST_QUARK (BUFFERING_RANGES));
if (value) {
array = (GValueArray *) g_value_get_boxed (value);
last_array_value = g_value_array_get_nth (array, array->n_values - 1);
/* set the value array only once, so we then modify (append to) the
* existing value array owned by the GstStructure / the field's GValue */
- gst_structure_id_take_value (structure, GST_QUARK (BUFFERING_RANGES),
+ gst_structure_id_take_value (query->structure, GST_QUARK (BUFFERING_RANGES),
&new_array_val);
}
guint
gst_query_get_n_buffering_ranges (GstQuery * query)
{
- GstStructure *structure;
GValueArray *array;
const GValue *value;
guint size = 0;
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING, 0);
- structure = gst_query_get_structure (query);
- value = gst_structure_id_get_value (structure, GST_QUARK (BUFFERING_RANGES));
+ value =
+ gst_structure_id_get_value (query->structure,
+ GST_QUARK (BUFFERING_RANGES));
if (value) {
array = (GValueArray *) g_value_get_boxed (value);
size = array->n_values;
gst_query_parse_nth_buffering_range (GstQuery * query, guint index,
gint64 * start, gint64 * stop)
{
- GstStructure *structure;
const GValue *value;
GValueArray *ranges;
GValue *range_value;
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING, ret);
- structure = gst_query_get_structure (query);
- value = gst_structure_id_get_value (structure, GST_QUARK (BUFFERING_RANGES));
+ value =
+ gst_structure_id_get_value (query->structure,
+ GST_QUARK (BUFFERING_RANGES));
ranges = (GValueArray *) g_value_get_boxed (value);
range_value = g_value_array_get_nth (ranges, index);
if (range_value) {
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_structure_id_set (query->structure, GST_QUARK (URI), G_TYPE_STRING, uri,
+ NULL);
}
/**
void
gst_query_parse_uri (GstQuery * query, gchar ** uri)
{
- GstStructure *structure;
-
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_URI);
- structure = gst_query_get_structure (query);
if (uri)
- *uri = g_value_dup_string (gst_structure_id_get_value (structure,
+ *uri = g_value_dup_string (gst_structure_id_get_value (query->structure,
GST_QUARK (URI)));
}