Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switching between sources not working with Python. #129

Open
Jpac14 opened this issue Jul 10, 2022 · 0 comments
Open

Switching between sources not working with Python. #129

Jpac14 opened this issue Jul 10, 2022 · 0 comments

Comments

@Jpac14
Copy link

Jpac14 commented Jul 10, 2022

I have this test code.

import gi
gi.require_version("Gst", "1.0")

from gi.repository import Gst, GLib
from threading import Thread

Gst.init(None)

main_loop = GLib.MainLoop()
thread = Thread(target=main_loop.run)
pipeline = Gst.Pipeline()

image1 = Gst.parse_launch("videotestsrc ! interpipesink name=src1")
image2 = Gst.parse_launch("videotestsrc pattern=snow ! interpipesink name=src2")

source = Gst.ElementFactory.make("interpipesrc", "source")
source.set_property("listen-to", "src1")

play = Gst.ElementFactory.make("autovideosink", "play")

pipeline.add(source, play)
source.link(play)

image1.set_state(Gst.State.PLAYING)
image2.set_state(Gst.State.PLAYING)
pipeline.set_state(Gst.State.PLAYING)

print(source.get_property("listen-to"))
input()
source.set_property("listen-to", "src2")
input()

image1.set_state(Gst.State.NULL)
image2.set_state(Gst.State.NULL)
pipeline.set_state(Gst.State.NULL)
main_loop.quit()

But when running it, the frame doesn't change when I enter input. But if I change the state to READY then back to PLAYING, it works, but I don't want to this because it doesn't have the intended behavior for my program. Is there a way to fix this? Is python not support? Is autovideosink not the right way to play the video?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant