I am writing a simple script to play an audio file with the Gst (gstreamer) library of PyGobject, when executing the script the following error is displayed:
(python3: 31506): GStreamer-CRITICAL **: 00: 55: 27.705: Trying to dispose element pipeline, but it is in READY instead of the NULL state. You need to explicitly set elements to the NULL state before dropping the final reference, to allow them to clean up. This problem may also be caused by a refcounting bug in the application or some element.
(python3: 31506): GStreamer-CRITICAL **: 00: 55: 27.705: Trying to dispose element audio_source, but it is in PAUSED instead of the NULL state. You need to explicitly set elements to the NULL state before dropping the final reference, to allow them to clean up. This problem may also be caused by a refcounting bug in the application or some element.
(python3: 31506): GStreamer-CRITICAL **: 00: 55: 27.705: Trying to dispose element typefind, but it is in PAUSED instead of the NULL state. You need to explicitly set elements to the NULL state before dropping the final reference, to allow them to clean up. This problem may also be caused by a refcounting bug in the application or some element.
(python3: 31506): GStreamer-CRITICAL **: 00: 55: 27.705: Trying to dispose element decode, but it is in PAUSED instead of the NULL state. You need to explicitly set elements to the NULL state before dropping The final reference, to allow them to clean up. This problem may also be caused by a refcounting bug in the application or some element.
(python3: 31506): GStreamer-CRITICAL **: 00: 55: 27.706: Trying to dispose element convert, but it is in PAUSED instead of the NULL state. You need to explicitly set elements to the NULL state before dropping the final reference, to allow them to clean up. This problem may also be caused by a refcounting bug in the application or some element.
(python3: 31506): GStreamer-CRITICAL **: 00: 55: 27.706: Trying to dispose element audio_sink, but it is in PAUSED instead of the NULL state. You need to explicitly set elements to the NULL state before dropping the final reference, to allow them to clean up. This problem may also be caused by a refcounting bug in the application or some element.
I do not get any information about it, here's the Code of my script:
import gi
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst
class SimplePlayer:
def __init__(self, path):
self.path = path
# Init Gst
GObject.threads_init()
Gst.init(None)
#Create Pipeline
self.pipeline = Gst.Pipeline('pipeline')
#Create Elements for Pipeline
self.source = Gst.ElementFactory.make('filesrc', 'audio_source')
self.decode = Gst.ElementFactory.make('decodebin', 'decode')
self.audioconvert = Gst.ElementFactory.make('audioconvert', 'convert')
self.audio_sink = Gst.ElementFactory.make('autoaudiosink', 'audio_sink')
#Configure Elemnts
self.source.set_property('location', path)
#Adding Elements to Pipeline
self.pipeline.add(self.source)
self.pipeline.add(self.decode)
self.pipeline.add(self.audioconvert)
self.pipeline.add(self.audio_sink)
#Linking Elements
self.source.link(self.decode)
self.decode.link(self.audioconvert)
self.audioconvert.link(self.audio_sink)
# Finally Playing =D
self.pipeline.set_state(Gst.State.PLAYING)
#I don't know well from here
bus = self.pipeline.get_bus()
msg = bus.timed_pop_filtered(Gst.CLOCK_TIME_NONE,Gst.MessageType.ERROR | Gst.MessageType.EOS)
print(msg)
player = SimplePlayer('/home/user/Music/audio.mp3')
Also if you can suggest a tutorial for this library, it would be very useful for me. Thanks