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

Michael Yarochkin michael.yarochkin at timetronics.be
Wed Feb 8 14:39:02 UTC 2017


Hello,


Don`t you need to use

p1.set_state(Gst.State.PAUSED)


Just a guess. I can be wrong.


Mikl

________________________________
From: gstreamer-devel <gstreamer-devel-bounces at lists.freedesktop.org> on behalf of whoman at gmail.com <whoman at gmail.com>
Sent: Tuesday, January 10, 2017 7:27:59 PM
To: gstreamer-devel at lists.freedesktop.org
Subject: Why can't I replay the same video twice with python?

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?
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20170208/824df4e8/attachment-0001.html>


More information about the gstreamer-devel mailing list