这是一个错误还是预期的行为?执行None
pipeline.set_state(gst.State.PLAYING)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
import gi
gi.require_version('Gst', '1.0')
gi.require_version('Gtk', '3.0')
from gi.repository import GObject, Gtk
from gi.repository import Gst as gst
from sys import exit
GObject.threads_init()
gst.init(None)
# Create the pipeline for our elements.
pipeline = gst.Pipeline()
# Create the elements for our project.
playbin = gst.ElementFactory.make('playbin', None)
uri = "file:///home/erm/disk2/acer-home/dwhelper/01%20some%20times.mp3"
playbin.set_property('uri', uri)
print("AFTER SET playbin.props.uri:", playbin.props.uri)
print("AFTER SET playbin.get_property('uri'):", playbin.get_property('uri'))
#
pipeline.add(playbin)
if (not pipeline or not playbin):
print('Not all elements could be created.')
exit(-1)
pipeline.set_state(gst.State.PLAYING)
# Becomes None
print("AFTER SET STATE playbin.props.uri:", playbin.props.uri)
print("AFTER SET STATE playbin.get_property('uri'):", playbin.get_property('uri'))
bus = pipeline.get_bus()
Gtk.main()
AFTER SET playbin.props.uri: file:///home/erm/disk2/acer-home/dwhelper/01%20some%20times.mp3
AFTER SET playbin.get_property('uri'): file:///home/erm/disk2/acer-home/dwhelper/01%20some%20times.mp3
AFTER SET STATE playbin.props.uri: None
AFTER SET STATE playbin.get_property('uri'): None