From: Wim Taymans Date: Thu, 27 Sep 2012 12:42:07 +0000 (+0200) Subject: pwg: more updates for 1.0 X-Git-Tag: 1.0.1~51 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bc76088811a03ec798f154f19885f07bc61d966c;p=platform%2Fupstream%2Fgstreamer.git pwg: more updates for 1.0 --- diff --git a/docs/pwg/building-props.xml b/docs/pwg/building-props.xml index 9907b88..1f50708 100644 --- a/docs/pwg/building-props.xml +++ b/docs/pwg/building-props.xml @@ -1,7 +1,7 @@ - - Adding Arguments + + Adding Properties The primary and most important way of controlling how an element behaves, is through GObject properties. GObject properties are defined in the @@ -12,6 +12,14 @@ and can then fill in the value or take action required for that property to change value internally. + + You probably also want to keep an instance variable around + with the currently configured value of the property that you use in the + get and set functions. + Note that GObject will not automatically set your + instance variable to the default value, you will have to do that in the + _init () function of your element. + /* properties */ enum { - ARG_0, - ARG_SILENT + PROP_0, + PROP_SILENT /* FILL ME */ }; @@ -46,15 +54,15 @@ gst_my_filter_class_init (GstMyFilterClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + /* define virtual function pointers */ + object_class->set_property = gst_my_filter_set_property; + object_class->get_property = gst_my_filter_get_property; + /* define properties */ - g_object_class_install_property (object_class, ARG_SILENT, + g_object_class_install_property (object_class, PROP_SILENT, g_param_spec_boolean ("silent", "Silent", "Whether to be very verbose or not", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - /* define virtual function pointers */ - object_class->set_property = gst_my_filter_set_property; - object_class->get_property = gst_my_filter_get_property; } static void @@ -66,7 +74,7 @@ gst_my_filter_set_property (GObject *object, GstMyFilter *filter = GST_MY_FILTER (object); switch (prop_id) { - case ARG_SILENT: + case PROP_SILENT: filter->silent = g_value_get_boolean (value); g_print ("Silent argument was changed to %s\n", filter->silent ? "true" : "false"); @@ -86,7 +94,7 @@ gst_my_filter_get_property (GObject *object, GstMyFilter *filter = GST_MY_FILTER (object); switch (prop_id) { - case ARG_SILENT: + case PROP_SILENT: g_value_set_boolean (value, filter->silent); break; default: @@ -99,10 +107,10 @@ gst_my_filter_get_property (GObject *object, #include "register.func" --> - The above is a very simple example of how arguments are used. Graphical - applications - for example GStreamer Editor - will use these properties - and will display a user-controllable widget with which these properties - can be changed. This means that - for the property to be as user-friendly + The above is a very simple example of how properties are used. Graphical + applications will use these properties and will display a + user-controllable widget with which these properties can be changed. + This means that - for the property to be as user-friendly as possible - you should be as exact as possible in the definition of the property. Not only in defining ranges in between which valid properties can be located (for integers, floats, etc.), but also in using very @@ -150,11 +158,11 @@ static void gst_videotestsrc_class_init (GstvideotestsrcClass *klass) { [..] - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TYPE, + g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PATTERN, g_param_spec_enum ("pattern", "Pattern", "Type of test pattern to generate", - GST_TYPE_VIDEOTESTSRC_PATTERN, 1, G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); + GST_TYPE_VIDEOTESTSRC_PATTERN, GST_VIDEOTESTSRC_SMPTE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); [..] } diff --git a/docs/pwg/building-state.xml b/docs/pwg/building-state.xml index b5011f5..f07ccef 100644 --- a/docs/pwg/building-state.xml +++ b/docs/pwg/building-state.xml @@ -86,8 +86,8 @@ GstElement or some other class not built on top of a base class, you will most likely have to implement your own state change function to be notified of state changes. This is definitively necessary if your - plugin is a decoder or an encoder, as there are no base classes for - decoders or encoders yet. + plugin is a demuxer or a muxer, as there are no base classes for + muxers or demuxers yet. An element can be notified of state changes through a virtual function diff --git a/docs/pwg/building-testapp.xml b/docs/pwg/building-testapp.xml index 2172a19..43a16f9 100644 --- a/docs/pwg/building-testapp.xml +++ b/docs/pwg/building-testapp.xml @@ -4,7 +4,7 @@ Building a Test Application Often, you will want to test your newly written plugin in an as small - setting as possible. Usually, gst-launch is a + setting as possible. Usually, gst-launch-1.0 is a good first step at testing a plugin. If you have not installed your plugin in a directory that GStreamer searches, then you will need to set the plugin path. Either set GST_PLUGIN_PATH to the directory @@ -12,10 +12,10 @@ If you based your plugin off of the gst-plugin template, then this will look something like - gst-launch --gst-plugin-path=$HOME/gst-template/gst-plugin/src/.libs TESTPIPELINE + gst-launch-1.0 --gst-plugin-path=$HOME/gst-template/gst-plugin/src/.libs TESTPIPELINE However, you will often need more - testing features than gst-launch can provide, such as seeking, events, + testing features than gst-launch-1.0 can provide, such as seeking, events, interactivity and more. Writing your own small testing program is the easiest way to accomplish this. This section explains - in a few words - how to do that. For a complete application development guide, see the @@ -26,9 +26,9 @@ At the start, you need to initialize the &GStreamer; core library by calling gst_init (). You can alternatively call - gst_init_with_popt_tables (), which will return - a pointer to popt tables. You can then use libpopt to handle the - given argument table, and this will finish the &GStreamer; initialization. + gst_init_get_option_group (), which will return + a pointer to GOptionGroup. You can then use GOption to handle the + initialization, and this will finish the &GStreamer; initialization. @@ -43,22 +43,19 @@ application. Also, you can use a fakesink element at the end of the pipeline to dump your data to the stdout (in order to do this, set the dump property to - TRUE). Lastly, you can use the efence element - (indeed, an eletric fence memory debugger wrapper element) to check - for memory errors. + TRUE). Lastly, you can use valgrind to check for memory errors. - During linking, your test application can use fixation or filtered caps + During linking, your test application can use filtered caps as a way to drive a specific type of data to or from your element. This is a very simple and effective way of checking multiple types of input and output in your element. - Running the pipeline happens through the gst_bin_iterate () - function. Note that during running, you should connect to at least the - error and eos signals on the pipeline + Note that during running, you should listen for at least the + error and eos messages on the bus and/or your plugin/element to check for correct handling of this. Also, you should add events into the pipeline and make sure your plugin handles these correctly (with respect to clocking, internal caching, etc.). @@ -120,6 +117,7 @@ main (gint argc, GstElement *convert1, *convert2, *resample; GMainLoop *loop; GstBus *bus; + guint watch_id; /* initialization */ gst_init (&argc, &argv); @@ -135,7 +133,7 @@ main (gint argc, /* watch for messages on the pipeline's bus (note that this will only * work like this when a GLib main loop is running) */ bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); - gst_bus_add_watch (bus, bus_call, loop); + watch_id = gst_bus_add_watch (bus, bus_call, loop); gst_object_unref (bus); filesrc = gst_element_factory_make ("filesrc", "my_filesource"); @@ -154,7 +152,7 @@ main (gint argc, * depending on the environment (output used, sound card, driver etc.) */ convert2 = gst_element_factory_make ("audioconvert", "audioconvert2"); resample = gst_element_factory_make ("audioresample", "audioresample"); - sink = gst_element_factory_make ("osssink", "audiosink"); + sink = gst_element_factory_make ("pulsesink", "audiosink"); if (!sink || !decoder) { g_print ("Decoder or output could not be found - check your install\n"); @@ -165,9 +163,9 @@ main (gint argc, return -1; } else if (!filter) { g_print ("Your self-written filter could not be found. Make sure it " - "is installed correctly in $(libdir)/gstreamer-0.10/ or " - "~/.gstreamer-0.10/plugins/ and that gst-inspect-0.10 lists it. " - "If it doesn't, check with 'GST_DEBUG=*:2 gst-inspect-0.10' for " + "is installed correctly in $(libdir)/gstreamer-1.0/ or " + "~/.gstreamer-1.0/plugins/ and that gst-inspect-1.0 lists it. " + "If it doesn't, check with 'GST_DEBUG=*:2 gst-inspect-1.0' for " "the reason why it is not being loaded."); return -1; } @@ -209,6 +207,8 @@ main (gint argc, /* clean up */ gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (pipeline); + g_source_remove (watch_id); + g_main_loop_unref (loop); return 0; }