mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
gst/gstiterator.h: Add some includes.
Original commit message from CVS: 2005-05-09 Andy Wingo <wingo@pobox.com> * gst/gstiterator.h: Add some includes. * gst/gstqueryutils.h: Include more headers. * gst/gstpad.h: * gst/gstpad.c (gst_pad_query_position): New routine, replaces some uses of gst_pad_query. * gst/gstqueryutils.c: Build fixes. Make parse functions ignore NULL out parameters. (gst_query_new_position): New proc, allocates a new position query. * gst/Makefile.am (libgstreamer_@GST_MAJORMINOR@_la_SOURCES): Add gstqueryutils.c to the build. * gst/gststructure.c (gst_structure_set_valist): Implement with the generic G_VALUE_COLLECT.
This commit is contained in:
parent
01162bee21
commit
328ddd7363
8 changed files with 104 additions and 86 deletions
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,24 @@
|
||||||
|
2005-05-09 Andy Wingo <wingo@pobox.com>
|
||||||
|
|
||||||
|
* gst/gstiterator.h: Add some includes.
|
||||||
|
|
||||||
|
* gst/gstqueryutils.h: Include more headers.
|
||||||
|
|
||||||
|
* gst/gstpad.h:
|
||||||
|
* gst/gstpad.c (gst_pad_query_position): New routine, replaces
|
||||||
|
some uses of gst_pad_query.
|
||||||
|
|
||||||
|
* gst/gstqueryutils.c: Build fixes. Make parse functions ignore
|
||||||
|
NULL out parameters.
|
||||||
|
(gst_query_new_position): New proc, allocates a new position
|
||||||
|
query.
|
||||||
|
|
||||||
|
* gst/Makefile.am (libgstreamer_@GST_MAJORMINOR@_la_SOURCES): Add
|
||||||
|
gstqueryutils.c to the build.
|
||||||
|
|
||||||
|
* gst/gststructure.c (gst_structure_set_valist): Implement with
|
||||||
|
the generic G_VALUE_COLLECT.
|
||||||
|
|
||||||
2005-05-08 Edward Hervey <bilboed@bilboed.com>
|
2005-05-08 Edward Hervey <bilboed@bilboed.com>
|
||||||
|
|
||||||
* gst/Makefile.am: (gst_headers):
|
* gst/Makefile.am: (gst_headers):
|
||||||
|
|
|
@ -101,6 +101,7 @@ libgstreamer_@GST_MAJORMINOR@_la_SOURCES = \
|
||||||
gstpluginfeature.c \
|
gstpluginfeature.c \
|
||||||
gstprobe.c \
|
gstprobe.c \
|
||||||
gstquery.c \
|
gstquery.c \
|
||||||
|
gstqueryutils.c \
|
||||||
gstqueue.c \
|
gstqueue.c \
|
||||||
gstscheduler.c \
|
gstscheduler.c \
|
||||||
gststructure.c \
|
gststructure.c \
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#define __GST_ITERATOR_H__
|
#define __GST_ITERATOR_H__
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <glib-object.h> /* for GValue in the fold */
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
|
33
gst/gstpad.c
33
gst/gstpad.c
|
@ -3863,6 +3863,39 @@ gst_pad_query2_default (GstPad * pad, GstQuery * query)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_pad_query_position:
|
||||||
|
* @pad: a #GstPad to invoke the default query on.
|
||||||
|
* @format: a pointer to the #GstFormat asked for.
|
||||||
|
* On return contains the #GstFormat used.
|
||||||
|
* @cur: A location in which to store the current position, or NULL.
|
||||||
|
* @end: A location in which to store the end position (length), or NULL.
|
||||||
|
*
|
||||||
|
* Queries a pad for the stream position and length.
|
||||||
|
*
|
||||||
|
* Returns: TRUE if the query could be performed.
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gst_pad_query_position (GstPad * pad, GstFormat * format, gint64 * cur,
|
||||||
|
gint64 * end)
|
||||||
|
{
|
||||||
|
GstQuery *query;
|
||||||
|
gboolean ret;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
|
||||||
|
g_return_val_if_fail (format != NULL, FALSE);
|
||||||
|
|
||||||
|
query = gst_query_new_position (*format);
|
||||||
|
ret = gst_pad_query2 (pad, query);
|
||||||
|
|
||||||
|
if (ret)
|
||||||
|
gst_query_parse_position_response (query, format, cur, end);
|
||||||
|
|
||||||
|
gst_query_unref (query);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_pad_get_formats_dispatcher (GstPad * pad, const GstFormat ** data)
|
gst_pad_get_formats_dispatcher (GstPad * pad, const GstFormat ** data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <gst/gstevent.h>
|
#include <gst/gstevent.h>
|
||||||
#include <gst/gstprobe.h>
|
#include <gst/gstprobe.h>
|
||||||
#include <gst/gstquery.h>
|
#include <gst/gstquery.h>
|
||||||
|
#include <gst/gstqueryutils.h>
|
||||||
#include <gst/gsttask.h>
|
#include <gst/gsttask.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -578,6 +579,10 @@ gboolean gst_pad_query2 (GstPad *pad, GstQuery *query);
|
||||||
void gst_pad_set_query2_function (GstPad *pad, GstPadQuery2Function query);
|
void gst_pad_set_query2_function (GstPad *pad, GstPadQuery2Function query);
|
||||||
gboolean gst_pad_query2_default (GstPad *pad, GstQuery *query);
|
gboolean gst_pad_query2_default (GstPad *pad, GstQuery *query);
|
||||||
|
|
||||||
|
/* util query functions */
|
||||||
|
gboolean gst_pad_query_position (GstPad *pad, GstFormat *format,
|
||||||
|
gint64 *cur, gint64 *end);
|
||||||
|
|
||||||
/* misc helper functions */
|
/* misc helper functions */
|
||||||
gboolean gst_pad_dispatcher (GstPad *pad, GstPadDispatcherFunction dispatch,
|
gboolean gst_pad_dispatcher (GstPad *pad, GstPadDispatcherFunction dispatch,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
|
@ -23,10 +23,22 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "gstqueryutils.h"
|
#include "gstqueryutils.h"
|
||||||
|
#include "gstenumtypes.h"
|
||||||
|
#include "gstvalue.h"
|
||||||
|
#include "gst_private.h"
|
||||||
|
|
||||||
/* some macros are just waiting to be defined here */
|
/* some macros are just waiting to be defined here */
|
||||||
|
|
||||||
|
|
||||||
|
GstQuery *
|
||||||
|
gst_query_new_position (GstFormat format)
|
||||||
|
{
|
||||||
|
GstStructure *structure = gst_structure_new ("query",
|
||||||
|
"format", GST_TYPE_FORMAT, format, NULL);
|
||||||
|
|
||||||
|
return gst_query_new_application (GST_QUERY_POSITION, structure);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_query_set_position (GstQuery * query, GstFormat format, gint64 cur,
|
gst_query_set_position (GstQuery * query, GstFormat format, gint64 cur,
|
||||||
gint64 end)
|
gint64 end)
|
||||||
|
@ -49,7 +61,8 @@ gst_query_parse_position_query (GstQuery * query, GstFormat * format)
|
||||||
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_POSITION);
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_POSITION);
|
||||||
|
|
||||||
structure = gst_query_get_structure (query);
|
structure = gst_query_get_structure (query);
|
||||||
*format = g_value_get_enum (gst_structure_get_value (structure, "format"));
|
if (format)
|
||||||
|
*format = g_value_get_enum (gst_structure_get_value (structure, "format"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -61,9 +74,12 @@ gst_query_parse_position_response (GstQuery * query, GstFormat * format,
|
||||||
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_POSITION);
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_POSITION);
|
||||||
|
|
||||||
structure = gst_query_get_structure (query);
|
structure = gst_query_get_structure (query);
|
||||||
*format = g_value_get_enum (gst_structure_get_value (structure, "format"));
|
if (format)
|
||||||
*cur = g_value_get_int64 (gst_structure_get_value (structure, "cur"));
|
*format = g_value_get_enum (gst_structure_get_value (structure, "format"));
|
||||||
*end = g_value_get_int64 (gst_structure_get_value (structure, "end"));
|
if (cur)
|
||||||
|
*cur = g_value_get_int64 (gst_structure_get_value (structure, "cur"));
|
||||||
|
if (end)
|
||||||
|
*end = g_value_get_int64 (gst_structure_get_value (structure, "end"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -74,7 +90,8 @@ gst_query_parse_seeking_query (GstQuery * query, GstFormat * format)
|
||||||
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEEKING);
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEEKING);
|
||||||
|
|
||||||
structure = gst_query_get_structure (query);
|
structure = gst_query_get_structure (query);
|
||||||
*format = g_value_get_enum (gst_structure_get_value (structure, "format"));
|
if (format)
|
||||||
|
*format = g_value_get_enum (gst_structure_get_value (structure, "format"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -102,13 +119,17 @@ gst_query_parse_seeking_response (GstQuery * query, GstFormat * format,
|
||||||
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEEKING);
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEEKING);
|
||||||
|
|
||||||
structure = gst_query_get_structure (query);
|
structure = gst_query_get_structure (query);
|
||||||
*format = g_value_get_enum (gst_structure_get_value (structure, "format"));
|
if (format)
|
||||||
*seekable = g_value_get_boolean (gst_structure_get_value
|
*format = g_value_get_enum (gst_structure_get_value (structure, "format"));
|
||||||
(structure, "seekable"));
|
if (seekable)
|
||||||
*segment_start = g_value_get_int64 (gst_structure_get_value
|
*seekable = g_value_get_boolean (gst_structure_get_value
|
||||||
(structure, "segment-start"));
|
(structure, "seekable"));
|
||||||
*segment_end = g_value_get_int64 (gst_structure_get_value
|
if (segment_start)
|
||||||
(structure, "segment-end"));
|
*segment_start = g_value_get_int64 (gst_structure_get_value
|
||||||
|
(structure, "segment-start"));
|
||||||
|
if (segment_end)
|
||||||
|
*segment_end = g_value_get_int64 (gst_structure_get_value
|
||||||
|
(structure, "segment-end"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -20,9 +20,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
#include <gst/gstformat.h>
|
||||||
#include <gst/gstquery.h>
|
#include <gst/gstquery.h>
|
||||||
|
|
||||||
|
|
||||||
|
GstQuery* gst_query_new_position (GstFormat format);
|
||||||
void gst_query_set_position (GstQuery *query, GstFormat format,
|
void gst_query_set_position (GstQuery *query, GstFormat format,
|
||||||
gint64 cur, gint64 end);
|
gint64 cur, gint64 end);
|
||||||
void gst_query_parse_position_query (GstQuery *query, GstFormat *format);
|
void gst_query_parse_position_query (GstQuery *query, GstFormat *format);
|
||||||
|
|
|
@ -403,11 +403,8 @@ void
|
||||||
gst_structure_set_valist (GstStructure * structure,
|
gst_structure_set_valist (GstStructure * structure,
|
||||||
const gchar * fieldname, va_list varargs)
|
const gchar * fieldname, va_list varargs)
|
||||||
{
|
{
|
||||||
|
gchar *err = NULL;
|
||||||
GType type;
|
GType type;
|
||||||
int i;
|
|
||||||
double d;
|
|
||||||
char *s;
|
|
||||||
gpointer p;
|
|
||||||
|
|
||||||
g_return_if_fail (structure != NULL);
|
g_return_if_fail (structure != NULL);
|
||||||
g_return_if_fail (IS_MUTABLE (structure));
|
g_return_if_fail (IS_MUTABLE (structure));
|
||||||
|
@ -418,77 +415,12 @@ gst_structure_set_valist (GstStructure * structure,
|
||||||
field.name = g_quark_from_string (fieldname);
|
field.name = g_quark_from_string (fieldname);
|
||||||
|
|
||||||
type = va_arg (varargs, GType);
|
type = va_arg (varargs, GType);
|
||||||
|
g_value_init (&field.value, type);
|
||||||
switch (type) {
|
G_VALUE_COLLECT (&field.value, varargs, 0, &err);
|
||||||
case G_TYPE_INT:
|
if (err) {
|
||||||
i = va_arg (varargs, int);
|
g_critical ("%s", err);
|
||||||
|
return;
|
||||||
g_value_init (&field.value, G_TYPE_INT);
|
|
||||||
g_value_set_int (&field.value, i);
|
|
||||||
break;
|
|
||||||
case G_TYPE_DOUBLE:
|
|
||||||
d = va_arg (varargs, double);
|
|
||||||
|
|
||||||
g_value_init (&field.value, G_TYPE_DOUBLE);
|
|
||||||
g_value_set_double (&field.value, d);
|
|
||||||
break;
|
|
||||||
case G_TYPE_BOOLEAN:
|
|
||||||
i = va_arg (varargs, int);
|
|
||||||
|
|
||||||
g_value_init (&field.value, G_TYPE_BOOLEAN);
|
|
||||||
g_value_set_boolean (&field.value, i);
|
|
||||||
break;
|
|
||||||
case G_TYPE_STRING:
|
|
||||||
s = va_arg (varargs, char *);
|
|
||||||
|
|
||||||
g_value_init (&field.value, G_TYPE_STRING);
|
|
||||||
g_value_set_string (&field.value, s);
|
|
||||||
break;
|
|
||||||
case G_TYPE_POINTER:
|
|
||||||
p = va_arg (varargs, gpointer);
|
|
||||||
|
|
||||||
g_value_init (&field.value, G_TYPE_POINTER);
|
|
||||||
g_value_set_pointer (&field.value, p);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (type == GST_TYPE_FOURCC) {
|
|
||||||
i = va_arg (varargs, int);
|
|
||||||
|
|
||||||
g_value_init (&field.value, GST_TYPE_FOURCC);
|
|
||||||
gst_value_set_fourcc (&field.value, i);
|
|
||||||
} else if (type == GST_TYPE_INT_RANGE) {
|
|
||||||
int min, max;
|
|
||||||
min = va_arg (varargs, int);
|
|
||||||
max = va_arg (varargs, int);
|
|
||||||
|
|
||||||
g_value_init (&field.value, GST_TYPE_INT_RANGE);
|
|
||||||
gst_value_set_int_range (&field.value, min, max);
|
|
||||||
} else if (type == GST_TYPE_DOUBLE_RANGE) {
|
|
||||||
double min, max;
|
|
||||||
min = va_arg (varargs, double);
|
|
||||||
max = va_arg (varargs, double);
|
|
||||||
|
|
||||||
g_value_init (&field.value, GST_TYPE_DOUBLE_RANGE);
|
|
||||||
gst_value_set_double_range (&field.value, min, max);
|
|
||||||
} else if (type == GST_TYPE_BUFFER) {
|
|
||||||
GstBuffer *buffer = va_arg (varargs, GstBuffer *);
|
|
||||||
|
|
||||||
g_value_init (&field.value, GST_TYPE_BUFFER);
|
|
||||||
g_value_set_boxed (&field.value, buffer);
|
|
||||||
} else if (type == GST_TYPE_FRACTION) {
|
|
||||||
gint n, d;
|
|
||||||
n = va_arg (varargs, int);
|
|
||||||
d = va_arg (varargs, int);
|
|
||||||
|
|
||||||
g_value_init (&field.value, GST_TYPE_FRACTION);
|
|
||||||
gst_value_set_fraction (&field.value, n, d);
|
|
||||||
} else {
|
|
||||||
g_critical ("unimplemented vararg field type %d\n", (int) type);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_structure_set_field (structure, &field);
|
gst_structure_set_field (structure, &field);
|
||||||
|
|
||||||
fieldname = va_arg (varargs, gchar *);
|
fieldname = va_arg (varargs, gchar *);
|
||||||
|
|
Loading…
Reference in a new issue