gst/videotestsrc/gstvideotestsrc.c: generate the list of supported caps at startup and reuse it instead of always gen...

Original commit message from CVS:
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_get_capslist), (generate_capslist),
(plugin_init):
generate the list of supported caps at startup and reuse it instead
of always generating it
This commit is contained in:
Benjamin Otte 2004-08-04 11:08:13 +00:00
parent c00fdabf0a
commit 242409ad1d
2 changed files with 34 additions and 14 deletions

View file

@ -1,3 +1,11 @@
2004-08-04 Benjamin Otte <otte@gnome.org>
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_get_capslist), (generate_capslist),
(plugin_init):
generate the list of supported caps at startup and reuse it instead
of always generating it
2004-07-30 Benjamin Otte <in7y118@public.uni-hamburg.de>
* gst/multipart/multipartmux.c: (gst_multipart_mux_pad_link):

View file

@ -55,6 +55,8 @@ enum
/* FILL ME */
};
static GstCaps *capslist = NULL;
static void gst_videotestsrc_base_init (gpointer g_class);
static void gst_videotestsrc_class_init (GstVideotestsrcClass * klass);
static void gst_videotestsrc_init (GstVideotestsrc * videotestsrc);
@ -294,6 +296,13 @@ gst_videotestsrc_change_state (GstElement * element)
static GstCaps *
gst_videotestsrc_get_capslist (void)
{
return gst_caps_copy (capslist);
}
static void
generate_capslist (void)
{
if (!capslist) {
GstCaps *caps;
GstStructure *structure;
int i;
@ -309,7 +318,8 @@ gst_videotestsrc_get_capslist (void)
gst_caps_append_structure (caps, structure);
}
return caps;
capslist = caps;
}
}
#if 0
@ -664,6 +674,8 @@ plugin_init (GstPlugin * plugin)
oil_init ();
#endif
generate_capslist ();
return gst_element_register (plugin, "videotestsrc", GST_RANK_NONE,
GST_TYPE_VIDEOTESTSRC);
}