Esempio n. 1
0
    def _send_reset_event(self):
        event = gst.event_new_custom(gst.EVENT_CUSTOM_DOWNSTREAM,
                                     gst.Structure('flumotion-reset'))

        for elem in self.get_output_elements():
            pad = elem.get_pad('sink')
            pad.send_event(event)
Esempio n. 2
0
 def stop_record(self):
     a = gst.structure_from_string("letpass")
     event = gst.event_new_custom(gst.EVENT_EOS, a)
     for bin_name, bin in self.bins.iteritems():
         resultado = bin.send_event_to_src(event)
         # if resultado:
         #    print "EOS sended to src of: " + bin_name
     return True
Esempio n. 3
0
 def stop_record(self):
     a = gst.structure_from_string('letpass')
     event = gst.event_new_custom(gst.EVENT_EOS, a)
     for bin_name, bin in self.bins.iteritems():
         resultado = bin.send_event_to_src(event)
         #if resultado:
         #    print "EOS sended to src of: " + bin_name
     return True
Esempio n. 4
0
 def start_recording(self):
     structure = gst.Structure ("shifter-start-recording")
     event = gst.event_new_custom (gst.EVENT_CUSTOM_UPSTREAM, structure)
     res = self.pipeline.send_event(event)
     if res:
         print "start recording"
     else:
         gst.error("start recording failed")
Esempio n. 5
0
 def start_recording(self):
     structure = gst.Structure("shifter-start-recording")
     event = gst.event_new_custom(gst.EVENT_CUSTOM_UPSTREAM, structure)
     res = self.pipeline.send_event(event)
     if res:
         print "start recording"
     else:
         gst.error("start recording failed")
Esempio n. 6
0
 def stop_record(self):
     self.__duration = self.__query_position() - self.__start_record_time
     a = gst.structure_from_string('letpass')
     event = gst.event_new_custom(gst.EVENT_EOS, a)
     for bin_name, bin in self.bins.iteritems():
         resultado = bin.send_event_to_src(event)
         #if resultado: 
         #    print "EOS sended to src of: " + bin_name
     return True
Esempio n. 7
0
    def handle(self, uris):
        struct = gst.Structure('urilist-played')
        event = gst.event_new_custom(gst.EVENT_CUSTOM_UPSTREAM, struct)
        self.sinkpad.push_event(event)

        # TODO: hookup about to finish and errors to rest of URIs so we
        # round robin, only giving up once all have been tried.
        # TODO: uris could be empty.
        self.add(self.uridecodebin)
        self.uridecodebin.set_state(gst.STATE_READY)
        self.uridecodebin.set_property('uri', uris[0])
        self.uridecodebin.sync_state_with_parent()
        return True  # Make sure we consume the EOS that triggered us.
Esempio n. 8
0
 def stop_record_and_restart_preview(self):
     logger.debug("Stopping Recording and Restarting Preview")
     a = gst.structure_from_string('letpass')
     event = gst.event_new_custom(gst.EVENT_EOS, a)
     for bin_name, bin in self.bins.iteritems():
         resultado = bin.send_event_to_src(event)
         #if resultado: 
         #    print "EOS sended to src of: " + bin_name
     self.restart = True  # FIXME send user_data on the EOS to force restart
     if self.pipeline.get_state()[1] == gst.STATE_PAUSED: 
         # If paused ensure sending EOS
         self.pipeline.set_state(gst.STATE_PLAYING)
     return True
Esempio n. 9
0
 def stop_record_and_restart_preview(self):
     log.debug("Stopping Recording and Restarting Preview")
     a = gst.structure_from_string('letpass')
     event = gst.event_new_custom(gst.EVENT_EOS, a)
     for bin_name, bin in self.bins.iteritems():
         resultado = bin.send_event_to_src(event)
         #if resultado:
         #    print "EOS sended to src of: " + bin_name
     self.restart = True  # FIXME send user_data on the EOS to force restart
     if self.pipeline.get_state()[1] == gst.STATE_PAUSED:
         # If paused ensure sending EOS
         self.pipeline.set_state(gst.STATE_PLAYING)
     return True
Esempio n. 10
0
    def handle(self, uris):
        struct = gst.Structure('urilist-played')
        event = gst.event_new_custom(gst.EVENT_CUSTOM_UPSTREAM, struct)
        self.sinkpad.push_event(event)

        # TODO: hookup about to finish and errors to rest of URIs so we
        # round robin, only giving up once all have been tried.
        # TODO: uris could be empty.
        self.add(self.uridecodebin)
        self.uridecodebin.set_state(gst.STATE_READY)
        self.uridecodebin.set_property('uri', uris[0])
        self.uridecodebin.sync_state_with_parent()
        return True  # Make sure we consume the EOS that triggered us.
Esempio n. 11
0
 def _send_event(self, timestamp):
     clock = self.get_clock()
     if clock is not None:
         running_time = clock.get_time() - self.get_base_time()
     else:
         running_time = 0
     s = gst.Structure("GstForceKeyUnit")
     s.set_value('timestamp', timestamp, 'uint64')
     s.set_value('stream-time', timestamp, 'uint64')
     s.set_value('running-time', running_time, 'uint64')
     s.set_value('all-headers', True)
     s.set_value('count', self._count)
     return self.srcpad.push_event(
         gst.event_new_custom(gst.EVENT_CUSTOM_DOWNSTREAM, s))
Esempio n. 12
0
 def _send_event(self, timestamp):
     clock = self.get_clock()
     if clock is not None:
         running_time = clock.get_time() - self.get_base_time()
     else:
         running_time = 0
     s = gst.Structure("GstForceKeyUnit")
     s.set_value('timestamp', timestamp, 'uint64')
     s.set_value('stream-time', timestamp, 'uint64')
     s.set_value('running-time', running_time, 'uint64')
     s.set_value('all-headers', True)
     s.set_value('count', self._count)
     return self.srcpad.push_event(
         gst.event_new_custom(gst.EVENT_CUSTOM_DOWNSTREAM, s))
Esempio n. 13
0
    def remove_output(self, output):
        """
        Remove output from our pipeline.

        :param output: output to remove from the pipeline
        :type output: :class:`gst.Bin`
        """
        if output not in self._outputs:
            raise LookupError('Ouput %s not present in pipeline'
                % output.get_name)
        teesrc = output.get_pad('sink').get_peer()
        handler = teesrc.add_event_probe(self._handle_event_probe)

        struct = gst.Structure('mopidy-unlink-tee')
        struct.set_value('handler', handler)

        event = gst.event_new_custom(gst.EVENT_CUSTOM_DOWNSTREAM, struct)
        self._tee.send_event(event)
Esempio n. 14
0
def flumotion_reset_event():
    ''' Helper method to create a 'flumotion-reset' event '''
    return gst.event_new_custom(gst.EVENT_CUSTOM_DOWNSTREAM,
                                gst.Structure('flumotion-reset'))
Esempio n. 15
0
    exit(-1)

# Start the pipeline
ret = pipeline.set_state(gst.STATE_PLAYING)
if ret ==  gst.STATE_CHANGE_FAILURE:
    print "Unable to set the pipeline to the playing state."
    exit(-1)

# Wait until error or EOS
bus = pipeline.get_bus()
bus.add_signal_watch()

# Gracefully break on ctrl+c
def sigint_handler(signum, frame):
    pipeline.set_state(gst.STATE_NULL)
    print "Ending video stream..."
    sys.exit()
 
signal.signal(signal.SIGINT, sigint_handler)

# Create keyframe event 
struct = gst.structure_from_string('GstForceKeyUnit')
event = gst.event_new_custom (gst.EVENT_CUSTOM_DOWNSTREAM, struct)

while True:
    # Send a force keyframe event every second to allow syncing
    pipeline.send_event(event)
    sleep(1)

# Free resources
pipeline.set_state(gst.STATE_NULL)
 def jump_key(self, direction):
     event = gst.event_new_custom(gst.EVENT_CUSTOM_UPSTREAM,
                                  gst.Structure(direction))
     self.audiosink.send_event(event)
 def _sendEvent(self, struc):
     encoder = self.prod.comp.pipeline.get_by_name('encoder')
     pad = encoder.get_pad('src')
     event = gst.event_new_custom(gst.EVENT_TAG, struc)
     res = pad.push_event(event)
     self.debug("Pushed event: %r with result: %r", event, res)
Esempio n. 18
0
 def jump_key(self, direction):
     event = gst.event_new_custom(gst.EVENT_CUSTOM_UPSTREAM, gst.Structure(direction))
     self.audiosink.send_event(event)
 def _sendEvent(self, struc):
     encoder = self.prod.comp.pipeline.get_by_name('encoder')
     pad = encoder.get_pad('src')
     event = gst.event_new_custom(gst.EVENT_TAG, struc)
     res = pad.push_event(event)
     self.debug("Pushed event: %r with result: %r", event, res)
Esempio n. 20
0
	def send_keyframe_event(self):
		struct = gst.Structure("GstForceKeyUnit")
		event = gst.event_new_custom(gst.EVENT_CUSTOM_UPSTREAM, struct)
		self.pipeline.send_event(event)
		return True