[Gambas-user] Problem with gb.media
vuott at tutanota.com
vuott at tutanota.com
Fri Aug 26 08:03:21 CEST 2022
Hello Benoît,
I have this Pipeline that uses the "Decodebin" plugin:
"filesrc location=/path/of/file/video ! decodebin name=decoder decoder. ! queue ! audioconvert ! audioresample ! autoaudiosink decoder.! xvimagesink"
for me it works on Terminal and it also works on Gambas with "Extern", by using the external functions of Gstreamer:
Library "libgstreamer-1.0"
Private Enum GST_STATE_VOID_PENDING = 0, GST_STATE_NULL, GST_STATE_READY, GST_STATE_PAUSED, GST_STATE_PLAYING
' gst_init (int *argc, char **argv[])
' Initializes the GStreamer library, setting up internal path lists, registering built-in elements, and loading standard plugins.
Private Extern gst_init(argc As Pointer, argv As Pointer)
' GstElement * gst_parse_launch (const gchar *pipeline_description, GError **error)
' Create a new pipeline based on command line syntax.
Private Extern gst_parse_launch(description As String, GError As Pointer) As Pointer
' GstStateChangeReturn gst_element_set_state(GstElement *element, GstState state)
' Sets the state of the element.
Private Extern gst_element_set_state(element As Pointer, state As Integer) As Integer
' void gst_object_unref(gpointer object)
' Decrements the reference count on object.
Private Extern gst_object_unref(gobject As Pointer)
Public Sub Main()
Dim video As Pointer
gst_init(0, 0)
video = gst_parse_launch("filesrc location=/path/of/file/video ! decodebin name=decoder decoder. ! queue ! " & "audioconvert ! audioresample ! autoaudiosink decoder.! xvimagesink", 0)
gst_element_set_state(video, GST_STATE_PLAYING)
Wait 30
gst_object_unref(video)
End
-----------------
But... I don't know how to manage the following parts of that Pipeline with the resources of the gb.media Component:
name = decoder decoder.
autoaudiosink decoder.
25 ago 2022, 23:08 da benoit.minisini at gambas-basic.org:
> Le 25/08/2022 à 22:37, vuott--- via User a écrit :
>
>> Hello,
>> I have found the following problem with gb.media.
>>
>> If I start this very simple code to listen only to the audio of a video (with audio) file, it works regularly:
>>
>> Public Sub Main()
>>
>> Dim pl As New MediaPipeline
>> Dim src As MediaControl
>> Dim bin, con, res, ask As MediaControl
>> Dim vsk As MediaControl
>> Dim filevideo As String
>>
>> filevideo = "/path/of/file/Video-audio"
>>
>> src = New MediaControl(pl, "filesrc")
>> src["location"] = filevideo
>> bin = New MediaControl(pl, "decodebin")
>> con = New MediaControl(pl, "audioconvert")
>> res = New MediaControl(pl, "audioresample")
>> ask = New MediaControl(pl, "autoaudiosink")
>>
>> src.LinkTo(bin)
>> bin.LinkLaterTo(con)
>> con.LinkTo(res)
>> res.LinkTo(ask)
>>
>> ' vsk = New MediaControl(pl, "xvimagesink")
>>
>> pl.Play
>>
>> Wait 0
>>
>> pl.Close
>>
>> End
>> -----------------------
>>
>> BUT, if I activate this command line:
>>
>> vsk = New MediaControl(pl, "xvimagesink")
>>
>> the audio of the video file is no longer audible.
>> I point out that that MediaControl element ("autoaudiosink") is NOT connected to others with the .Linkto () method !!!
>> It seems that, the mere creation of an instance of MediaControl element ("autoaudiosink"), interferes with the audio part of the pipeline.
>>
>> Regards
>> vuott
>>
>>
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>
>
> I think it's only the GStreamer behaviour. Did you test the same pipeline with GStreamer directly?
>
> --
> Benoît Minisini.
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220826/c89ae1b2/attachment.htm>
More information about the User
mailing list