Thursday, March 14, 2013

Xoverlay

Last time I wanted to fix some issues with the conversion from a gst_buffer video frame into a QImage. I fixed one of three issues. But before fixing the other two:
  • The mutex might be not optimally designed since it's a producer newSample() and a consumer getFrame()
  • A serious problem is that the data of the QImage must remain valid also if the image is used from the Display class. This is not given here since the lifetime of the GstBuffer is unknown
I will try another approach: To use the xvimagesink directly. Here is the working source code:

xoverlay.pro


For the video player I will use a gst_video_overlay element which is part of the gstreamer base plugins (http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideooverlay.html).
Nevertheless pkg-config gave following insight:
shows:
-pthread -lgstreamer-1.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0
shows:
-pthread -lgstvideo-1.0 -lgstbase-1.0 -lgstreamer-1.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0

Thus it seems they mixed some things up and in order to use gst_video_overlay one has to include gstreamer-video-1.0 instead of gstreamer-plugins-base-1.0

main.cpp


videoplayer.h


videoplayer.cpp


I remember I got that idea from somewhere in the Internet, but i don't remember where. But it looks easy to use. This does however not work in Windows and I will avoid that solution in the future.
Note that the size of the widget is hard coded to 320x240. This results from the default caps negotiation between the videotestsrc and the xvimagesink.

No comments:

Post a Comment