Architecture help - simultaneously play 2 audio files with independent seek

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Architecture help - simultaneously play 2 audio files with independent seek

GStreamer-devel mailing list
I am trying to develop a sound system for a car. The most basic requirements
are as follows:
1. music playback (.mp3 files)
2. alert sounds (.mp3 files) - short 3 second beeps or warning noises

I have the following:

uridecodebin1 --->
                                audiomixer ---> audioconvert --->
autoaudiosink
uridecodebin2 --->


On app initialization I set the "uri" property of each uridecodebin to a
default .mp3 file and I set the "mute" property of both the audiomixer sink
pads to true. When the app receives a signal to either play a music track or
an alert sound I set the "uri" property again now to the correct .mp3 file,
unmute the appropriate mixer sink pad, and set the pipeline to PLAYING.

I run into problems when trying to play an alert sound during music playback
after the pipeline has been set to PLAYING for more than 3 seconds:
- music: set to correct "uri"
- mixer pad1: "mute" = false
- pipeline: set to PLAYING
*(.... pipeline runs for a few seconds playing the music track, then app
receives signal to play default alert sound)*
- mixer pad2: "mute" = false
- gst_element_seek_simple(alerts, GST_FORMAT_TIME, GST_SEEK_FLAG_ACCURATE |
GST_SEEK_FLAG_SEGMENT, 0)
*(problem: I don't hear the alert sound)*

If I do the above before the Pipeline has been playing for 3 seconds I can
hear the alert sound. If I do a gst_element_seek_simple() on the music
uridecodebin it also works. It seems that the only problem I have is trying
to seek the alert sound uridecodebin after it has run past the end of its
duration (3 seconds).

I tried to follow this  suggestion
<http://gstreamer-devel.966125.n4.nabble.com/seek-event-in-a-pipeline-with-multiple-source-bins-tp4678239p4678515.html>  
by Sebastian Dröge but wasn't able to get it to work.


Is there a better architecture that I should be using like dynamically
adding the uridecodebin's to the pipeline when needed and remove them later?
Any advice is greatly appreciated.

Tim




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel