Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @staticmethod
- def _probe_drop(pad, probe_info):
- return Gst.PadProbeReturn.DROP
- def change_window_handle(self, new_handle):
- videoconvert = self._pipeline.get_by_name('videoconvert')
- autovideosink = self._pipeline.get_by_name('autovideosink')
- # Install a blocking probe on the videoconvert so that it can't
- # feed any more data into the autovideosink
- source_pad = videoconvert.get_static_pad('src')
- probe_id = source_pad.add_probe(
- Gst.PadProbeType.BLOCK,
- self._probe_drop,
- )
- # Unlink the autovideosink, stop it, and remove it
- source_pad.unlink(source_pad.get_peer())
- autovideosink.set_state(Gst.State.NULL)
- self._pipeline.remove(autovideosink)
- # Make a new autovideosink and link it
- new_sink = Gst.ElementFactory.make('autovideosink', 'autovideosink')
- self._pipeline.add(new_sink)
- source_pad.link(new_sink.get_static_pad('sink'))
- # Remove the probe and set the new sink to PLAYING
- source_pad.remove_probe(probe_id)
- new_sink.sync_state_with_parent()
- # For some reason, the new sink gets stuck in READY state. Even
- # the pipeline goes back into PAUSED state for some reason.
- print('State of the new sink:', new_sink.get_state(0.1))
- print('State of the pipeline:', self._pipeline.get_state(0.1))
Advertisement
Add Comment
Please, Sign In to add comment