get mouse navigation events on application level ?

adrian at tortenboxer.de adrian at tortenboxer.de
Fri Aug 16 07:23:55 PDT 2013


Hello,

Thanks for your comments. Here I go then implementing an element for my needs. This leads to a few more questions:

1) When I use the gst-element-maker script from gst-plugins-bad/tool:

| REAL_NAME='Adrian' EMAIL_ADDRESS=adrian at tortenboxer.de ../tools/gst-element-maker \
| roi_adjuster basetransform

(maybe videofilter would be a better parent than basetransform ?)
and try to run the resulting prototype element in a pipeline:

| GST_PLUGIN_PATH=~/.local/share/gstreamer-1.0 gst-launch-1.0 videotestsrc ! gstroiadjuster ! autovideosink

I get the following error:

| (gst-plugin-scanner:818): GStreamer-WARNING **: Failed to load plugin '/home/misterx/.local/share
| /gstreamer-1.0/gstroiadjuster.so': /home/misterx/.local/share/gstreamer-1.0/gstroiadjuster.so: undefined
| symbol: gst_base_transform_get_type
| WARNING: erroneous pipeline: no element "gstroiadjuster"

Where is the symbol gst_base_transform_get_type defined and how do I tell the gst-plugin-scanner which additional .so to look for ?

2) The purpose of new roiadjuster element is to listen to navigation events and to update a rectangular selection structure accordingly, which is drawn by a cairooverlay element and also read by the main application. 
I am much more used to Java programming than C, so I am quite unclear about how to handle concurrency here: if
* the main application allocates structures describing several selections and
* sends a pointer refering to the currently active selection to the roiadjuster (via an event? setting a property?) every time the active selection changes;
* the roiadjuster element notifies the application asynchronously (via a signal) when the geometry of the current selection has been updated
* the application does stuff with the selection on receiving these update signals,
* the cairooverlay element reads all the selections in its draw callback,
does that sound like it could work ? Do I need to put memory barriers everywhere when accessing the structures ? Is the thread executing roiadjuster's event handlers the same that executes the cairooverlay's draw callback, assuming that the two elements are linked to one another in the same pipeline ? But different from the application thread (which runs the gtk_main loop) ?

Help much appreciated,
Adrian


"Andoni Morales" <ylatuya at gmail.com> wrote:
> Tim-Philipp Müller <t.i.m at zen.co.uk> wrote:
>> adrian at tortenboxer.de[adrian at tortenboxer.de] wrote:
>>> In my application the stream from a live camera (appsrc) is displayed
>>> in a GTK drawarea (autovideosink+gst_video_overlay_set_window_handle).
>>> I would like to be able to interactively draw rectangular selections on
>>> the video. For the drawing I can use a cairooverlay element, but it is
>>> not clear to me how to subscribe to mouse navigation events.
>>>
>>> That is, using GTK (motion-notify-events of the drawing_area etc.) I
>>> can get the widget-relative pointer coordinates, but then I have to
>>> calculate the frame-relative coordinates myself (which might be
>>> inaccurate, considering I force the aspect ratio so that the video
>>> overlay is possibly much smaller than the drawing area widget itself).
>>> I can see how the navigationtest element does the job, looking at its
>>> source code, but I am under the impression that I would have to
>>> implement a gstreamer element in order to subscribe to these upstream
>>> propagating events. Am I wrong ? In any case the application developer
>>> manual does not explain how to connect to these events. Is there
>>> another element which exposes the "mouse-move" etc. events ?
>> Well, it's quite an obscure feature, mostly used for things like DVD
>> menu navigation :)
>> But you're right in that you have to write your own element in order to
>> pick up these events.
>>
>> http://cgit.freedesktop.org/gstreamer/gst-plugins-base/tree/gst-libs/gst/video/navigation.h[http://cgit.freedesktop.org/gstreamer/gst-plugins-base/tree/gst-libs/gst/video/navigation.h]
>>
>> has a few helper functions (which don't seem to be appear in the docs it
>> seems, something to fix).
>
>The navigationtest element is a good example showing how to handle this events and draw the mouse
> movement and clicks.
> 
>Cheers,Andoni
>
>> Cheers
>> -Tim


More information about the gstreamer-devel mailing list