Gstreamer code equivalent for gst-launch command

1k views Asked by At

I use following command to create a pipeline from cmd.

gst-launch -v filesrc location=c:\\song.mp3  ! mad ! audioconvert ! directsoundsink

how to code the above command into a program?

2

There are 2 answers

0
umläute On

by "program" is guess you mean a file that you can run.

you can simply put the gst-launch stanza into a script-file, and run that script-file.

the following example uses bash syntax (save it in a file playmad, make the file executable and run playmad /path/to/song.mp3)

#!/bin/sh
SOURCE=$1
test -e "${SOURCE}" && \
gst-launch -v filesrc location="${SOURCE}" \
              ! mad \
              ! audioconvert \
              ! directsoundsink

on w32, you can create a .bat file that does the same.

0
ensonic On

All gstreamer modules have test/examples directories which you can also look at the git browser. To implement the above gst-launch invocation as a programm you need to pick the languag (e.g. c or python) and implement that using the gst API. Don't expect that someone does that for you here though.