简体   繁体   中英

Playing Audio with pipeline in Gstreamer (C#)

I've been struggling with GStreamer for a while because I can't find any C# examples/tutorials.

As far as I know, Gstreamer uses pipelines in order to decode and then be able to send, for instance a song, to the speakers, but I tried the following, which didn't work:

        Gst.Element pipeline;
        string path = @"some_path.mp3";
        string command = "filesrc location=" + path + " ! oggdemux ! vorbisdec ! audioconvert ! gconfaudiosink";
        pipeline = Gst.Parse.Launch(command);
        pipeline.SetState(Gst.State.Playing);

However, it raises an exception in the Gst.Parse.Launch line

Does anyone know any good application example, and/or can actually post some code, so I can start getting used to the library? Also, if you can tell me what's wrong on the code above, I'd be thankful

Without further ado, Regards

Just change your command string to "filesrc location=" + path + " ! decodebin2 ! gconfaudiosink", that should work.

On a side note you should use the gst-launch tool on the command line to check if your pipeline is working and to debug it. Also use gst-inspect to find which plugins are available on your system and what is their functionality.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM