[Gambas-user] gb.media - Intended Use of MediaContainer- and MediaLink-Class

Claus Dietrich claus.dietrich at freenet.de
Wed Jan 3 15:19:50 CET 2024


Hi/
/

While preparing a Gambas-Book chapter for gb.media component we 
struggled to understand the purpose of the MediaContainer- and 
MediaLink-Class/.
/

Here as reference a snippet which generates a MediaContainer allowing to 
listen to a radio station:

Private pl As MediaPipeline
Private mRadioListen As MediaContainer
Private src As MediaControl
Private cnv As MediaControl
Private snk As MediaControl

Public Sub Form_Open()

   Dim i As Integer

   pl = New MediaPipeline As "PipeEvents"
   mRadioListen = New MediaContainer(pl)
   src = New MediaControl(mRadioListen, "uridecodebin")
   src["uri"] = 
"http://icecast.ndr.de/ndr/ndrinfo/schleswigholstein/mp3/128/stream.mp3"
   cnv = New MediaControl(mRadioListen, "audioconvert")
   snk = New MediaControl(mRadioListen, "autoaudiosink")
   src.LinkLaterTo(cnv)
   cnv.LinkTo(snk)
   pl.play

End

Public Sub Form_Close()

   pl.Stop
   pl.Close

End

Apparently it works and does, what is described in the documentation as:

"A MediaContainer allows to group several MediaControl together so that 
they act as one sole control."

But is has no input and no output as described in next sentences:

"By default, a MediaContainer has no input, no output. So to make it 
look like a normal control, you must use the AddInput and AddOutput 
methods that will take inputs and outputs from the child controls and 
use them as inputs and outputs for the container."

As this doesn't fit together we would appreciate if someone could 
provide us with some explanation and a snippet which demonstrates the 
intended purpose and correct use of the MediaContainer-Class.

We also struggled with the use of the MediaLink-Class and would be 
pleased if someone can provide some backgrounds and/or has some snippet 
in his drawer for us.

A HAPPY NEW YEAR to all of you

Claus





More information about the User mailing list