[Gambas-user] media component syntax and the gstreamer filesink

Dominique Michel dominique.michel at ...3298...
Sat Feb 15 02:23:47 CET 2014


Le Sat, 15 Feb 2014 00:38:43 +0100,
Dominique Michel <dominique.michel at ...3298...> a écrit :

> Le Fri, 14 Feb 2014 23:42:51 +0100,
> Dominique Michel <dominique.michel at ...3298...> a écrit :
> 
> > Le Fri, 14 Feb 2014 19:37:53 +0100,
> > Fabien Bodard <gambas.fr at ...626...> a écrit :
> > 
> > > and ? it's?
> > 
> > It's to add
> >   $hOutput["location"] = "wavegenerator.flac"
> > 
> > 
> >   $hPlayer = New MediaPipeline
> >   $hAudio = New MediaControl($hPlayer, "audiotestsrc")
> 
> That solve the duration issue with mplayer and alsaplayer:
>     $hAudio["is-live"] = "1"
> but not the 0 length file issue.

That solve it only partly. Both players play it with the wanted
duration, but they display a file length of 0 seconde.

I get the same problem with the following command line:
gst-launch-1.0 audiotestsrc is-live=1 ! flacenc ! filesink
location=generated.flac

But I get the correct duration display with:
gst-launch-1.0 -e audiotestsrc is-live=1 ! flacenc ! filesink
location=generated.flac

Another issue is that ideally, I want to be able to use such a pipeline
with gambas:

gst-launch-1.0 -e audiotestsrc is-live=1 !
audio/x-raw,channels=2,rate=48000 ! flacenc ! filesink
location=generated.flac

and if I try something like:

  $hAudio["is-live"] = "1"
  $hRaw = New MediaControl($hPlayer, "audio/x-raw")
  $hConv = New MediaControl($hPlayer, "flacenc")
  $hOutput["location"] = "wavegenerator.flac"
  $hOutput["append"] = "1"
  $hAudio.LinkTo($hRaw)
  $hRaw.LinkTo($hConv)
  $hConv.LinkTo($hOutput)

it fail at $hRaw = New MediaControl($hPlayer, "audio/x-raw")

How I can get it to work?

If I comment out $hRaw = New MediaControl($hPlayer, "audio/x-raw"),
the line '$hOutput["append"] = "1"' make the content of the generated
file to survive when quitting the program, but as alsaplayer
still display a duration of 0, I am not sure it is the right fix. It
look more like a workaround.

Dominique

> 
> >   $hConv = New MediaControl($hPlayer, "flacenc")
> >   $hOutput = New MediaControl($hPlayer, "filesink"])
> >   $hOutput["location"] = "wavegenerator.flac"
> >   ' Set the pipeline 
> >   $hAudio.LinkTo($hConv)
> >   $hConv.LinkTo($hOutput)
> > 
> > 
> > 
> > But I get another issue now. MediaPipeline have 4 methods: Play,
> > Pause, Stop and Quit. 
> > 
> > Play is used to start the playing, and when I click on
> > the Play button, I get the file. 
> > 
> > When I click on the Play button a second time, GStreamer pause and
> > the file is still here and I can play it with mplayer and
> > alsaplayer. aplay play it but give garbage at the output. mplayer
> > sound is the best, but it never stop the playing. Alsaplayer sound
> > is a little bit choppy and the duration display is lost.
> > 
> > And when I quit the wavegenerator, the file is still here, but its
> > content is erased and give a 0 bit file. I googled a lot, but didn't
> > find nothing that helped.
> > 
> > In the play/pause function, I try to replace
> >   $hPlayer.Pause
> > by
> >   $hPlayer.Stop
> > but the issue remain the same.
> > 
> > When quitting, $hPlayer.Quit is called, and that's what reinitialize
> > the file to a 0 length file. Another issue is it look like to be no
> > duration information in the file before its reinitialization to 0.
> > 
> > I googled a lot, but didn't find nothing that helped.
> > 
> > Dominique
> > 
> >  
> > > 
> > > 2014-02-14 16:33 GMT+01:00 Dominique Michel
> > > <dominique.michel at ...3298...>:
> > > > Le Fri, 14 Feb 2014 11:51:08 +0100,
> > > > Dominique Michel <dominique.michel at ...3298...> a écrit :
> > > >
> > > >> I am adding a preference system to the WaveGenerator for the
> > > >> audio sink. It work for all sinks I try but one, the filesink.
> > > >>
> > > >> It is something like
> > > >>
> > > >>   $hPlayer = New MediaPipeline
> > > >>   $hAudio = New MediaControl($hPlayer, "audiotestsrc")
> > > >>   $hConv = New MediaControl($hPlayer, "audioconvert")
> > > >>   ' Set the output sink
> > > >>   $hOutput = New MediaControl($hPlayer, Settings["OutputSink",
> > > >>   "autoaudiosink"])
> > > >>   ' Set the pipeline
> > > >>   $hAudio.LinkTo($hConv)
> > > >>   $hConv.LinkTo($hOutput)
> > > >>
> > > >> When the output sink is filesink, the preference key look like
> > > >>   OutputSink="filesink location=/home/dom/wavegenerator.ogg"
> > > >>
> > > >> And when running it, it fail with
> > > >>   Unable to create mediacontrol dans FMain:50
> > > >>
> > > >> which is
> > > >>   $hOutput = New MediaControl($hPlayer, Settings["OutputSink",
> > > >>   "autoaudiosink"])
> > > >>
> > > >> I try without the location=.., or without the path with just
> > > >> location=wavegenerator.ogg, and get the same result.
> > > >>
> > > >> Is it something I can do to get this to work?
> > > >
> > > > Never mind, I find it.
> > > >
> > > >>
> > > >> Dominique
> > > >>
> > > >> ------------------------------------------------------------------------------
> > > >> Android apps run on BlackBerry 10
> > > >> Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
> > > >> Now with support for Jelly Bean, Bluetooth, Mapview and more.
> > > >> Get your Android app in front of a whole new audience.  Start
> > > >> now.
> > > >> http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
> > > >> _______________________________________________ Gambas-user
> > > >> mailing list Gambas-user at lists.sourceforge.net
> > > >> https://lists.sourceforge.net/lists/listinfo/gambas-user
> > > >
> > > > ------------------------------------------------------------------------------
> > > > Android apps run on BlackBerry 10
> > > > Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
> > > > Now with support for Jelly Bean, Bluetooth, Mapview and more.
> > > > Get your Android app in front of a whole new audience.  Start
> > > > now.
> > > > http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
> > > > _______________________________________________ Gambas-user
> > > > mailing list Gambas-user at lists.sourceforge.net
> > > > https://lists.sourceforge.net/lists/listinfo/gambas-user
> > > 
> > > 
> > > 
> > 
> > ------------------------------------------------------------------------------
> > Android apps run on BlackBerry 10
> > Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
> > Now with support for Jelly Bean, Bluetooth, Mapview and more.
> > Get your Android app in front of a whole new audience.  Start now.
> > http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> 
> ------------------------------------------------------------------------------
> Android apps run on BlackBerry 10
> Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
> Now with support for Jelly Bean, Bluetooth, Mapview and more.
> Get your Android app in front of a whole new audience.  Start now.
> http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user




More information about the User mailing list