python3 gstreamer 1.0 uri变为无

时间:2016-08-04 21:51:56

标签: python gstreamer

这是一个错误还是预期的行为?执行None

后,playbin的uri变为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

0 个答案:

没有答案