Simple GStreamer display example
Posted
#1
(In Topic #891)
Trainee
Code
gst-launch-1.0 videotestsrc is-live=true horizontal-speed=1 ! autovideosinkI'd like the media to be rendered to a drawing area element on the Gambas form (not autovideosink popup). From some examples I've looked at this seems like it's possible, but I'm not understanding out to pass the reference to the drawing area to the MediaPipeline control. From examples I see I can make a pipeline maybe with something like:
Code
oPipeline= New MediaPipeline
oMC = New MediaControl(oPipeline, "videotestsrc is-live=true horizontal-speed=1")But how to link the output to a form element isn't clear to me.
Any advice/guidance welcomed! Thank you.
Posted
Regular

if you want to use in Gambas the external functions of the GStreamer library directly, then I suggest:
https://www.gambas-it.…ioni_esterne_di_GStreamer
If you want to use the resources of <COLOR color="#800000">gb.media</COLOR> Component (based on GStreamer) of Gambas, then I suggest:
https://www.gambas-it.…on_il_Componente_gb.media
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Trainee
Code
Dim oPipeline As MediaPipeline
Dim oMC As MediaControl
Dim oSNK As MediaControl
oPipeline = New MediaPipeline
oMC = New MediaControl(oPipeline, "videotestsrc")
oMC["is-live"] = True
oMC["horizontal-speed"] = 1
oSNK = New MediaControl(oPipeline, "autovideosink")
oMC.LinkTo(oSNK)
oPipeline.Play
Sleep 10
oPipeline.StopBut what I need to have happen is to not display the video in the window that autovideosink opens, but to display the video in a DrawingArea (or similar type component) on a Gambas form. I've read about the 'SetWindow' methods on the MediaPIpeline and MediaControl classes, but I am still not seeing/understanding how to use this so I can display the video content in the Gambas form.
Thanks to anyone who knows and can help!
Posted
Regular

I believe that you must use the "<COLOR color="#800000">Playbin</COLOR>" Element, for example as follows:
Code (gambas)
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Trainee
Unfortunately when I cut/paste the playbin example into a new form, I am getting an error "Cannot set status in FMain:28" at this line:
oPipeline.Play. I made sure to add the gb.media component to the project.
Any idea what is going wrong for me? I did a quick google search of that error + gb.media but didn't see solution.
In case it's helpful, I did try to run the playbin pipeline via gst-launch and got an error:
Code
$gst-launch-1.0 playbin uri="testbin://video,pattern=videotestsrc,is-live=true,horizontal-speed=1"
Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
Missing element: TESTBIN protocol source
ERROR: from element /GstURIDecodeBin:uridecodebin0: No URI handler implemented for "testbin".
Additional debug info:
gsturidecodebin.c(1408): gen_source_element (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0
Setting pipeline to NULL ...
Freeing pipeline ...
I'm using GStreamer 1.16.3 on this machine.
EDIT: Some additional info:
I made a change to the playbin uri to play a file:
Code (gambas)
This plays the sample video, but the video takes the entire width/height of the gambas form, and not just within the location of DrawingArea1.
Posted
Regular

I don't know why it doesn't work for you.Piper984 said
Unfortunately when I cut/paste the playbin example into a new form, I am getting an error "Cannot set status in FMain:28" at this line:
oPipeline.Play.
It works regularly for me.
I tried this command line with "gst-launch-1.0" and it works regularly for me.Piper984 said
I did try to run the playbin pipeline via gst-launch and got an error:Code
$gst-launch-1.0 playbin uri="testbin://video,pattern=videotestsrc,is-live=true,horizontal-speed=1"
I also have 1.16.3 GStreamer version.Piper984 said
I'm using GStreamer 1.16.3 on this machine.
We need to see the code.Piper984 said
This plays the sample video, but the video takes the entire width/height of the gambas form, and not just within the location of DrawingArea1.
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Trainee
I made some progress on my own, and I am closer with my test on what I am looking to do with Gambas, but now quite there yet.
The following code works to display the output of the videotesrc plugin from GStreamer:
Code (gambas)
However, the video takes the entire form area, and not the location of the DrawingArea1. I've also tried to set the X,Y, W, H but this isn't working with the ximagesink.
Here is the form I created:
<IMG src="http://www.pitchpipetuner.com/gambas/screen_gui_editor.jpg">
</IMG>and here is the form when I run the code:
<IMG src="http://www.pitchpipetuner.com/gambas/screen_gui_running.jpg">
</IMG>As you can see, the output of the pipeline takes the entire area of the form. But what I want is for the video to be bound by the X,Y,H,W of DrawingArea1.
Thanks for any help here.
Posted
Trainee
Code (gambas)
- ...
- ...
<IMG src="http://www.pitchpipetuner.com/gambas/screen_gui_working.jpg">
</IMG>I will post back to this thread with any additional learnings. I am hoping to use Gambas for a quick UI for a streaming application rather than using C / GTK3+.
Posted
Regular

Bravo, so you discovered that with "videotestsrc" you need the "ximagesink" plugin.Piper984 said
I made some progress on my ownCode (gambas)
However to me the video is shown within the limits of the "DrawingArea" with both "ximagesink" and "xvimagesink", both with QT and GTK+3Piper984 said
Capuring: Replacing ximagesink with xvimagesink and I now think I am getting what I need:
…using C / GTK3+.
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Regular

Code (gambas)
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
1 guest and 0 members have just viewed this.



