Commit 8cd991a9 authored by Benjamin Otte's avatar Benjamin Otte
Browse files

- make all _get_list functions return a const reference to original lists and no copy

Original commit message from CVS:
- make all _get_list functions return a const reference to original lists and no copy
- redo code accordingly
- fix compile issue in dparam stuff
parent f5db7679
......@@ -313,7 +313,7 @@ gst_autoplug_factory_find (const gchar *name)
*
* Returns: GList of type #GstAutoplugFactory
*/
GList*
const GList*
gst_autoplug_factory_get_list (void)
{
return _gst_autoplugfactories;
......
......@@ -114,7 +114,7 @@ GstAutoplugFactory* gst_autoplug_factory_new (const gchar *name, const gchar *
void gst_autoplug_factory_destroy (GstAutoplugFactory *factory);
GstAutoplugFactory* gst_autoplug_factory_find (const gchar *name);
GList* gst_autoplug_factory_get_list (void);
const GList* gst_autoplug_factory_get_list (void);
GstAutoplug* gst_autoplug_factory_create (GstAutoplugFactory *factory);
GstAutoplug* gst_autoplug_factory_make (const gchar *name);
......
......@@ -725,7 +725,7 @@ gst_bin_get_by_name_recurse_up (GstBin * bin, const gchar * name)
*
* Returns: a GList of elements
*/
GList *
const GList *
gst_bin_get_list (GstBin * bin)
{
g_return_val_if_fail (bin != NULL, NULL);
......
......@@ -106,7 +106,7 @@ void gst_bin_remove (GstBin *bin, GstElement *element);
/* retrieve a single element or the list of children */
GstElement* gst_bin_get_by_name (GstBin *bin, const gchar *name);
GstElement* gst_bin_get_by_name_recurse_up (GstBin *bin, const gchar *name);
GList* gst_bin_get_list (GstBin *bin);
const GList* gst_bin_get_list (GstBin *bin);
gboolean gst_bin_set_state_type (GstBin *bin, GstElementState state, GType type);
......
......@@ -777,10 +777,10 @@ gst_plugin_add_feature (GstPlugin *plugin, GstPluginFeature *feature)
*
* Returns; a GList of GstPlugin elements
*/
GList*
const GList*
gst_plugin_get_list (void)
{
return g_list_copy (_gst_plugins);
return _gst_plugins;
}
#ifndef GST_DISABLE_REGISTRY
......
......@@ -108,7 +108,7 @@ gboolean gst_plugin_load_plugin (GstPlugin *plugin);
void gst_plugin_add_feature (GstPlugin *plugin, GstPluginFeature *feature);
GstPlugin* gst_plugin_find (const gchar *name);
GList* gst_plugin_get_list (void);
const GList* gst_plugin_get_list (void);
#ifndef GST_DISABLE_REGISTRY
......
......@@ -723,7 +723,7 @@ gst_scheduler_factory_find (const gchar *name)
*
* Returns: GList of type #GstSchedulerFactory
*/
GList*
const GList*
gst_scheduler_factory_get_list (void)
{
return _gst_schedulerfactories;
......
......@@ -174,7 +174,7 @@ GstSchedulerFactory* gst_scheduler_factory_new (const gchar *name, const gchar
void gst_scheduler_factory_destroy (GstSchedulerFactory *factory);
GstSchedulerFactory* gst_scheduler_factory_find (const gchar *name);
GList* gst_scheduler_factory_get_list (void);
const GList* gst_scheduler_factory_get_list (void);
GstScheduler* gst_scheduler_factory_create (GstSchedulerFactory *factory, GstElement *parent);
GstScheduler* gst_scheduler_factory_make (const gchar *name, GstElement *parent);
......
......@@ -311,7 +311,7 @@ gst_thread_change_state (GstElement * element)
break;
case GST_STATE_PLAYING_TO_PAUSED:
{
GList *elements = gst_bin_get_list (GST_BIN (thread));
GList *elements = (GList *) gst_bin_get_list (GST_BIN (thread));
THR_INFO ("pausing thread");
......
......@@ -284,7 +284,7 @@ gst_type_find_by_id (guint16 id)
*
* Returns: a list of GstTypes
*/
GList*
const GList*
gst_type_get_list (void)
{
return _gst_types;
......@@ -297,7 +297,7 @@ gst_type_get_list (void)
*
* Returns: a list of GstTypeFactories
*/
GList*
const GList*
gst_type_factory_get_list (void)
{
return _gst_typefactories;
......
......@@ -83,7 +83,7 @@ GType gst_type_factory_get_type (void);
GstTypeFactory* gst_type_factory_new (GstTypeDefinition *definition);
GstTypeFactory* gst_type_factory_find (const gchar *name);
GList* gst_type_factory_get_list (void);
const GList* gst_type_factory_get_list (void);
/* create a new type, or find/merge an existing one */
......@@ -97,6 +97,6 @@ guint16 gst_type_find_by_ext (const gchar *ext);
GstType* gst_type_find_by_id (guint16 id);
/* get the list of registered types (returns list of GstType!) */
GList* gst_type_get_list (void);
const GList* gst_type_get_list (void);
#endif /* __GST_TYPE_H__ */
......@@ -168,7 +168,7 @@ gst_type_find_chain (GstPad *pad, GstBuffer *buf)
GST_DEBUG (0,"got buffer of %d bytes in '%s'",
GST_BUFFER_SIZE (buf), GST_OBJECT_NAME (typefind));
type_list = gst_type_get_list ();
type_list = (GList *) gst_type_get_list ();
while (type_list) {
GSList *factories;
......
......@@ -381,19 +381,19 @@ gst_unitconv_time_nanoseconds_to_seconds(GstUnitConvert *unitconv, GValue *nanos
static void
gst_unitconv_time_seconds_to_samples(GstUnitConvert *unitconv, GValue *seconds_val, GValue *samples_val)
{
GValue *samplerate;
/* GValue *samplerate = g_hash_table_lookup(unitconv->currentToUnit->convert_properties, "samplerate"); */
/* GValue *samplerate;
GValue *samplerate = g_hash_table_lookup(unitconv->currentToUnit->convert_properties, "samplerate");
g_value_set_int64(samples_val,
(gint64)(g_value_get_float(seconds_val) * (gfloat)g_value_get_int(samplerate)));
(gint64)(g_value_get_float(seconds_val) * (gfloat)g_value_get_int(samplerate))); */
}
static void
gst_unitconv_time_samples_to_seconds(GstUnitConvert *unitconv, GValue *samples_val, GValue *seconds_val)
{
GValue *samplerate;
/* GValue *samplerate = g_hash_table_lookup(unitconv->currentFromUnit->convert_properties, "samplerate"); */
/* GValue *samplerate;
GValue *samplerate = g_hash_table_lookup(unitconv->currentFromUnit->convert_properties, "samplerate");
g_value_set_float(seconds_val,
((gfloat)g_value_get_int64(samples_val)) / (gfloat)g_value_get_int(samplerate));
((gfloat)g_value_get_int64(samples_val)) / (gfloat)g_value_get_int(samplerate));*/
}
static void
......
......@@ -18,7 +18,7 @@ int main(int argc,char *argv[]) {
doc = xmlNewDoc("1.0");
doc->xmlRootNode = xmlNewDocNode(doc, NULL, "GST-CompletionRegistry", NULL);
plugins = gst_plugin_get_list();
plugins = (GList *) gst_plugin_get_list();
while (plugins) {
GstPlugin *plugin;
......
......@@ -513,7 +513,7 @@ print_element_info (GstElementFactory *factory)
/* for compound elements */
if (GST_IS_BIN(element)) {
printf("\nChildren:\n");
children = gst_bin_get_list(GST_BIN(element));
children = (GList *) gst_bin_get_list(GST_BIN(element));
if (!children)
g_print (" none\n");
else {
......@@ -534,7 +534,7 @@ print_element_list (void)
{
GList *plugins;
plugins = gst_plugin_get_list();
plugins = (GList *) gst_plugin_get_list();
while (plugins) {
GList *features;
GstPlugin *plugin;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment