gpt4 book ai didi

python3 gstreamer 1.0 uri 变为无

转载 作者:行者123 更新时间:2023-12-05 06:41:58 24 4
gpt4 key购买 nike

这是错误还是预期行为?在我执行 pipeline.set_state(gst.State.PLAYING)

后,playbin 的 uri 变为 None
#!/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

最佳答案

或者 uri 使用 current-uri。查看current-uri documentation了解更多。

关于python3 gstreamer 1.0 uri 变为无,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38777994/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com