mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 17:51:16 +00:00
Merged the float property patch from Steve Baker. This patch doesn't really work yet...
Original commit message from CVS: Merged the float property patch from Steve Baker. This patch doesn't really work yet...
This commit is contained in:
parent
204452cd96
commit
c3a64ce1f6
7 changed files with 113 additions and 4 deletions
|
@ -815,6 +815,7 @@ plugins/filters/smooth/Makefile
|
|||
plugins/filters/median/Makefile
|
||||
plugins/filters/ladspa/Makefile
|
||||
plugins/filters/stereo2mono/Makefile
|
||||
plugins/filters/colorspace/Makefile
|
||||
plugins/icecast/Makefile
|
||||
plugins/icecast/icecastsend/Makefile
|
||||
plugins/effects/Makefile
|
||||
|
|
1
docs/libs/.gitignore
vendored
1
docs/libs/.gitignore
vendored
|
@ -1,6 +1,5 @@
|
|||
Makefile
|
||||
Makefile.in
|
||||
tmpl
|
||||
html
|
||||
sgml
|
||||
gstreamer-libs-unused.txt
|
||||
|
|
|
@ -13,7 +13,7 @@ void eos(GstElement *element)
|
|||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
GstElement *bin, *disksrc, *parse, *decoder, *downmix, *osssink;
|
||||
GstElement *bin, *disksrc, *parse, *decoder, *downmix, *mulaw, *osssink;
|
||||
|
||||
gst_init(&argc,&argv);
|
||||
|
||||
|
@ -35,6 +35,7 @@ int main(int argc,char *argv[])
|
|||
parse = gst_elementfactory_make("mp3parse","parse");
|
||||
decoder = gst_elementfactory_make("mpg123","decoder");
|
||||
downmix = gst_elementfactory_make("stereo2mono","stereo2mono");
|
||||
mulaw = gst_elementfactory_make("mulawencode","mulaw");
|
||||
/* and an audio sink */
|
||||
osssink = gst_elementfactory_make("osssink", "play_audio");
|
||||
|
||||
|
@ -43,6 +44,7 @@ int main(int argc,char *argv[])
|
|||
gst_bin_add(GST_BIN(bin), parse);
|
||||
gst_bin_add(GST_BIN(bin), decoder);
|
||||
gst_bin_add(GST_BIN(bin), downmix);
|
||||
gst_bin_add(GST_BIN(bin), mulaw);
|
||||
gst_bin_add(GST_BIN(bin), osssink);
|
||||
|
||||
/* connect src to sink */
|
||||
|
@ -53,6 +55,8 @@ int main(int argc,char *argv[])
|
|||
gst_pad_connect(gst_element_get_pad(decoder,"src"),
|
||||
gst_element_get_pad(downmix,"sink"));
|
||||
gst_pad_connect(gst_element_get_pad(downmix,"src"),
|
||||
gst_element_get_pad(mulaw,"sink"));
|
||||
gst_pad_connect(gst_element_get_pad(mulaw,"src"),
|
||||
gst_element_get_pad(osssink,"sink"));
|
||||
|
||||
/* start playing */
|
||||
|
@ -71,6 +75,7 @@ int main(int argc,char *argv[])
|
|||
gst_object_destroy(GST_OBJECT(parse));
|
||||
gst_object_destroy(GST_OBJECT(decoder));
|
||||
gst_object_destroy(GST_OBJECT(downmix));
|
||||
gst_object_destroy(GST_OBJECT(mulaw));
|
||||
gst_object_destroy(GST_OBJECT(disksrc));
|
||||
gst_object_destroy(GST_OBJECT(bin));
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@ static guint _arg_len[] = {
|
|||
0, // GST_PROPS_LIST_ID_NUM,
|
||||
1, // GST_PROPS_INT_ID_NUM,
|
||||
2, // GST_PROPS_INT_RANGE_ID_NUM,
|
||||
1, // GST_PROPS_FLOAT_ID_NUM,
|
||||
2, // GST_PROPS_FLOAT_RANGE_ID_NUM,
|
||||
1, // GST_PROPS_FOURCC_ID_NUM,
|
||||
1, // GST_PROPS_BOOL_ID_NUM,
|
||||
1, // GST_PROPS_STRING_ID_NUM,
|
||||
|
@ -105,6 +107,15 @@ gst_props_create_entry (GstPropsFactory factory, gint *skipped)
|
|||
entry->data.int_range_data.min = GPOINTER_TO_INT (factory[i++]);
|
||||
entry->data.int_range_data.max = GPOINTER_TO_INT (factory[i++]);
|
||||
break;
|
||||
case GST_PROPS_FLOAT_ID_NUM:
|
||||
entry->propstype = GST_PROPS_FLOAT_ID_NUM;
|
||||
entry->data.float_data = *(gfloat*)factory[i++];
|
||||
break;
|
||||
case GST_PROPS_FLOAT_RANGE_ID_NUM:
|
||||
entry->propstype = GST_PROPS_FLOAT_RANGE_ID_NUM;
|
||||
entry->data.float_range_data.min = *(gfloat*)factory[i++];
|
||||
entry->data.float_range_data.max = *(gfloat*)factory[i++];
|
||||
break;
|
||||
case GST_PROPS_FOURCC_ID_NUM:
|
||||
entry->propstype = GST_PROPS_FOURCC_ID_NUM;
|
||||
entry->data.fourcc_data = GPOINTER_TO_INT (factory[i++]);
|
||||
|
@ -375,6 +386,11 @@ gst_props_set (GstProps *props, const gchar *name, GstPropsFactoryEntry entry, .
|
|||
value = va_arg (var_args, GstPropsFactoryEntry);
|
||||
thisentry->data.int_data = GPOINTER_TO_INT (value);
|
||||
break;
|
||||
case GST_PROPS_FLOAT_ID:
|
||||
thisentry->propstype = GST_PROPS_FLOAT_ID_NUM;
|
||||
value = va_arg (var_args, GstPropsFactoryEntry);
|
||||
thisentry->data.float_data = *(gfloat*)value;
|
||||
break;
|
||||
case GST_PROPS_FOURCC_ID_NUM:
|
||||
thisentry->propstype = GST_PROPS_FOURCC_ID_NUM;
|
||||
value = va_arg (var_args, GstPropsFactoryEntry);
|
||||
|
@ -735,6 +751,18 @@ gst_props_entry_check_compatibility (GstPropsEntry *entry1, GstPropsEntry *entry
|
|||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case GST_PROPS_FLOAT_RANGE_ID_NUM:
|
||||
switch (entry2->propstype) {
|
||||
// a - b <---> a - c
|
||||
case GST_PROPS_FLOAT_RANGE_ID_NUM:
|
||||
return (entry2->data.float_range_data.min <= entry1->data.float_range_data.min &&
|
||||
entry2->data.float_range_data.max >= entry1->data.float_range_data.max);
|
||||
case GST_PROPS_LIST_ID_NUM:
|
||||
return gst_props_entry_check_list_compatibility (entry1, entry2);
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case GST_PROPS_FOURCC_ID_NUM:
|
||||
switch (entry2->propstype) {
|
||||
// b <---> a
|
||||
|
@ -763,6 +791,22 @@ gst_props_entry_check_compatibility (GstPropsEntry *entry1, GstPropsEntry *entry
|
|||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case GST_PROPS_FLOAT_ID_NUM:
|
||||
switch (entry2->propstype) {
|
||||
// b <---> a - d
|
||||
case GST_PROPS_FLOAT_RANGE_ID_NUM:
|
||||
return (entry2->data.float_range_data.min <= entry1->data.float_data &&
|
||||
entry2->data.float_range_data.max >= entry1->data.float_data);
|
||||
// b <---> a
|
||||
case GST_PROPS_FLOAT_ID_NUM:
|
||||
return (entry2->data.float_data == entry1->data.float_data);
|
||||
// b <---> a,b,c
|
||||
case GST_PROPS_LIST_ID_NUM:
|
||||
return gst_props_entry_check_list_compatibility (entry1, entry2);
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case GST_PROPS_BOOL_ID_NUM:
|
||||
switch (entry2->propstype) {
|
||||
// t <---> t
|
||||
|
@ -886,6 +930,23 @@ gst_props_save_thyself_func (GstPropsEntry *entry, xmlNodePtr parent)
|
|||
xmlNewProp (subtree, "max", str);
|
||||
g_free(str);
|
||||
break;
|
||||
case GST_PROPS_FLOAT_ID_NUM:
|
||||
subtree = xmlNewChild (parent, NULL, "float", NULL);
|
||||
xmlNewProp (subtree, "name", g_quark_to_string (entry->propid));
|
||||
str = g_strdup_printf ("%f", entry->data.float_data);
|
||||
xmlNewProp (subtree, "value", str);
|
||||
g_free(str);
|
||||
break;
|
||||
case GST_PROPS_FLOAT_RANGE_ID_NUM:
|
||||
subtree = xmlNewChild (parent, NULL, "floatrange", NULL);
|
||||
xmlNewProp (subtree, "name", g_quark_to_string (entry->propid));
|
||||
str = g_strdup_printf ("%f", entry->data.float_range_data.min);
|
||||
xmlNewProp (subtree, "min", str);
|
||||
g_free(str);
|
||||
str = g_strdup_printf ("%f", entry->data.float_range_data.max);
|
||||
xmlNewProp (subtree, "max", str);
|
||||
g_free(str);
|
||||
break;
|
||||
case GST_PROPS_FOURCC_ID_NUM:
|
||||
str = g_strdup_printf ("%4.4s", (gchar *)&entry->data.fourcc_data);
|
||||
xmlAddChild (parent, xmlNewComment (str));
|
||||
|
@ -981,6 +1042,27 @@ gst_props_load_thyself_func (xmlNodePtr field)
|
|||
sscanf (prop, "%d", &entry->data.int_range_data.max);
|
||||
g_free (prop);
|
||||
}
|
||||
else if (!strcmp(field->name, "float")) {
|
||||
entry->propstype = GST_PROPS_FLOAT_ID_NUM;
|
||||
prop = xmlGetProp(field, "name");
|
||||
entry->propid = g_quark_from_string (prop);
|
||||
g_free (prop);
|
||||
prop = xmlGetProp(field, "value");
|
||||
sscanf (prop, "%f", &entry->data.float_data);
|
||||
g_free (prop);
|
||||
}
|
||||
else if (!strcmp(field->name, "floatrange")) {
|
||||
entry->propstype = GST_PROPS_FLOAT_RANGE_ID_NUM;
|
||||
prop = xmlGetProp(field, "name");
|
||||
entry->propid = g_quark_from_string (prop);
|
||||
g_free (prop);
|
||||
prop = xmlGetProp (field, "min");
|
||||
sscanf (prop, "%f", &entry->data.float_range_data.min);
|
||||
g_free (prop);
|
||||
prop = xmlGetProp (field, "max");
|
||||
sscanf (prop, "%f", &entry->data.float_range_data.max);
|
||||
g_free (prop);
|
||||
}
|
||||
else if (!strcmp(field->name, "boolean")) {
|
||||
entry->propstype = GST_PROPS_BOOL_ID_NUM;
|
||||
prop = xmlGetProp(field, "name");
|
||||
|
@ -1079,3 +1161,7 @@ gst_props_load_thyself (xmlNodePtr parent)
|
|||
return props;
|
||||
}
|
||||
|
||||
gfloat* _gst_props_floatpointer (gfloat f)
|
||||
{
|
||||
return &f;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,8 @@ typedef enum {
|
|||
GST_PROPS_LIST_ID_NUM,
|
||||
GST_PROPS_INT_ID_NUM,
|
||||
GST_PROPS_INT_RANGE_ID_NUM,
|
||||
GST_PROPS_FLOAT_ID_NUM,
|
||||
GST_PROPS_FLOAT_RANGE_ID_NUM,
|
||||
GST_PROPS_FOURCC_ID_NUM,
|
||||
GST_PROPS_BOOL_ID_NUM,
|
||||
GST_PROPS_STRING_ID_NUM,
|
||||
|
@ -55,6 +57,8 @@ typedef enum {
|
|||
#define GST_PROPS_LIST_ID GINT_TO_POINTER(GST_PROPS_LIST_ID_NUM)
|
||||
#define GST_PROPS_INT_ID GINT_TO_POINTER(GST_PROPS_INT_ID_NUM)
|
||||
#define GST_PROPS_INT_RANGE_ID GINT_TO_POINTER(GST_PROPS_INT_RANGE_ID_NUM)
|
||||
#define GST_PROPS_FLOAT_ID GINT_TO_POINTER(GST_PROPS_FLOAT_ID_NUM)
|
||||
#define GST_PROPS_FLOAT_RANGE_ID GINT_TO_POINTER(GST_PROPS_FLOAT_RANGE_ID_NUM)
|
||||
#define GST_PROPS_FOURCC_ID GINT_TO_POINTER(GST_PROPS_FOURCC_ID_NUM)
|
||||
#define GST_PROPS_BOOL_ID GINT_TO_POINTER(GST_PROPS_BOOL_ID_NUM)
|
||||
#define GST_PROPS_STRING_ID GINT_TO_POINTER(GST_PROPS_STRING_ID_NUM)
|
||||
|
@ -65,6 +69,10 @@ typedef enum {
|
|||
#define GST_PROPS_LIST(a...) GST_PROPS_LIST_ID,##a,NULL
|
||||
#define GST_PROPS_INT(a) GST_PROPS_INT_ID,(GINT_TO_POINTER(a))
|
||||
#define GST_PROPS_INT_RANGE(a,b) GST_PROPS_INT_RANGE_ID,(GINT_TO_POINTER(a)),(GINT_TO_POINTER(b))
|
||||
#define GST_PROPS_FLOAT_STRING(a) GST_PROPS_FLOAT_ID,(a)
|
||||
#define GST_PROPS_FLOAT_RANGE_STRING(a,b) GST_PROPS_FLOAT_RANGE_ID,(a),(b)
|
||||
#define GST_PROPS_FLOAT(a) GST_PROPS_FLOAT_ID,(&(a))
|
||||
#define GST_PROPS_FLOAT_RANGE(a,b) GST_PROPS_FLOAT_RANGE_ID,(&(a)),(&(b))
|
||||
#define GST_PROPS_FOURCC(a) GST_PROPS_FOURCC_ID,(GINT_TO_POINTER(a))
|
||||
#define GST_PROPS_BOOLEAN(a) GST_PROPS_BOOL_ID,(GINT_TO_POINTER(a))
|
||||
#define GST_PROPS_STRING(a) GST_PROPS_STRING_ID,(a)
|
||||
|
|
|
@ -37,6 +37,7 @@ struct _GstPropsEntry {
|
|||
gboolean bool_data;
|
||||
guint32 fourcc_data;
|
||||
gint int_data;
|
||||
gfloat float_data;
|
||||
|
||||
/* structured values */
|
||||
struct {
|
||||
|
@ -49,6 +50,10 @@ struct _GstPropsEntry {
|
|||
gint min;
|
||||
gint max;
|
||||
} int_range_data;
|
||||
struct {
|
||||
gfloat min;
|
||||
gfloat max;
|
||||
} float_range_data;
|
||||
} data;
|
||||
};
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ void eos(GstElement *element)
|
|||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
GstElement *bin, *disksrc, *parse, *decoder, *downmix, *osssink;
|
||||
GstElement *bin, *disksrc, *parse, *decoder, *downmix, *mulaw, *osssink;
|
||||
|
||||
gst_init(&argc,&argv);
|
||||
|
||||
|
@ -35,6 +35,7 @@ int main(int argc,char *argv[])
|
|||
parse = gst_elementfactory_make("mp3parse","parse");
|
||||
decoder = gst_elementfactory_make("mpg123","decoder");
|
||||
downmix = gst_elementfactory_make("stereo2mono","stereo2mono");
|
||||
mulaw = gst_elementfactory_make("mulawencode","mulaw");
|
||||
/* and an audio sink */
|
||||
osssink = gst_elementfactory_make("osssink", "play_audio");
|
||||
|
||||
|
@ -43,6 +44,7 @@ int main(int argc,char *argv[])
|
|||
gst_bin_add(GST_BIN(bin), parse);
|
||||
gst_bin_add(GST_BIN(bin), decoder);
|
||||
gst_bin_add(GST_BIN(bin), downmix);
|
||||
gst_bin_add(GST_BIN(bin), mulaw);
|
||||
gst_bin_add(GST_BIN(bin), osssink);
|
||||
|
||||
/* connect src to sink */
|
||||
|
@ -53,6 +55,8 @@ int main(int argc,char *argv[])
|
|||
gst_pad_connect(gst_element_get_pad(decoder,"src"),
|
||||
gst_element_get_pad(downmix,"sink"));
|
||||
gst_pad_connect(gst_element_get_pad(downmix,"src"),
|
||||
gst_element_get_pad(mulaw,"sink"));
|
||||
gst_pad_connect(gst_element_get_pad(mulaw,"src"),
|
||||
gst_element_get_pad(osssink,"sink"));
|
||||
|
||||
/* start playing */
|
||||
|
@ -71,6 +75,7 @@ int main(int argc,char *argv[])
|
|||
gst_object_destroy(GST_OBJECT(parse));
|
||||
gst_object_destroy(GST_OBJECT(decoder));
|
||||
gst_object_destroy(GST_OBJECT(downmix));
|
||||
gst_object_destroy(GST_OBJECT(mulaw));
|
||||
gst_object_destroy(GST_OBJECT(disksrc));
|
||||
gst_object_destroy(GST_OBJECT(bin));
|
||||
|
||||
|
|
Loading…
Reference in a new issue