Why can't I replay the same video twice with python?

whoman at gmail.com whoman at gmail.com
Tue Jan 10 18:27:59 UTC 2017


Hello,
I want to play 3 video files, like a piano.

I have it working, however it will only play each video one time...
2nd time I press any of the 3 keys, the video does not start playing
again.
No error messages returned.  GST acts as if it's doing everything as expected.

I'm using python....  Here's the pertinent parts of my code:

p1 = Gst.parse_launch ("filesrc location=file1.mp4 ! qtdemux !
h264parse ! vaapidecodebin ! videoconvert ! vaapisink
fullscreen=true")
p2 = Gst.parse_launch ("filesrc location=file2.mp4 ! qtdemux !
h264parse ! vaapidecodebin ! videoconvert ! vaapisink
fullscreen=true")
p3 = Gst.parse_launch ("filesrc location=file3.mp4 ! qtdemux !
h264parse ! vaapidecodebin ! videoconvert ! vaapisink
fullscreen=true")

def StopAllPipelines():
    #Stop all other pipelines
    p1.set_state(Gst.State.NULL)
    p2.set_state(Gst.State.NULL)
    p3.set_state(Gst.State.NULL)

def PlayVideo1():
    StopAllPipelines()
    p1.set_state(Gst.State.PLAYING)

def PlayVideo2():
    StopAllPipelines()
    p1.set_state(Gst.State.PLAYING)

def PlayVideo3():
    StopAllPipelines()
    p1.set_state(Gst.State.PLAYING)

I've tried deleting the pipeline variable references (p1 p2 and p3)
and then recreating them, same result.
I've tried setting p1 p2 and p3 to "None" and then recreating them, same result.

The only thing I can think is that there's some kind of async issue,
where my PlayVideo1() functions aren't waiting for StopAllPipelines()
to finish, before trying to set the p1 state to PLAYING?
I tried inserting a "p1.get_state(1)" in between, same result.
Perhaps there's more that needs to be done between setting the states
to NULL, then back to PLAYING

Any ideas?


More information about the gstreamer-devel mailing list