Example #1
0
 def _on_signal(self, element, clocktime, func):
     # This shim is used to ensure we always return true, and also handles
     # that not all the callbacks have a time argument.
     if clocktime is None:
         func()
     else:
         func(utils.clocktime_to_millisecond(clocktime))
     return True
Example #2
0
 def _on_signal(self, element, clocktime, func):
     # This shim is used to ensure we always return true, and also handles
     # that not all the callbacks have a time argument.
     if clocktime is None:
         func()
     else:
         func(utils.clocktime_to_millisecond(clocktime))
     return True
Example #3
0
    def get_position(self):
        """
        Get position in milliseconds.

        :rtype: int
        """
        try:
            gst_position = self._playbin.query_position(gst.FORMAT_TIME)[0]
            return utils.clocktime_to_millisecond(gst_position)
        except gst.QueryError:
            logger.debug('Position query failed')
            return 0
Example #4
0
    def get_position(self):
        """
        Get position in milliseconds.

        :rtype: int
        """
        try:
            gst_position = self._playbin.query_position(gst.FORMAT_TIME)[0]
            return utils.clocktime_to_millisecond(gst_position)
        except gst.QueryError:
            logger.debug('Position query failed')
            return 0
Example #5
0
    def get_position(self):
        """
        Get position in milliseconds.

        :rtype: int
        """
        try:
            gst_position = self._playbin.query_position(gst.FORMAT_TIME)[0]
            return utils.clocktime_to_millisecond(gst_position)
        except gst.QueryError:
            # TODO: take state into account for this and possibly also return
            # None as the unknown value instead of zero?
            logger.debug('Position query failed')
            return 0
Example #6
0
    def get_position(self):
        """
        Get position in milliseconds.

        :rtype: int
        """
        try:
            gst_position = self._playbin.query_position(gst.FORMAT_TIME)[0]
            return utils.clocktime_to_millisecond(gst_position)
        except gst.QueryError:
            # TODO: take state into account for this and possibly also return
            # None as the unknown value instead of zero?
            logger.debug('Position query failed')
            return 0
Example #7
0
    def get_position(self):
        """
        Get position in milliseconds.

        :rtype: int
        """
        success, position = self._playbin.query_position(Gst.Format.TIME)

        if not success:
            # TODO: take state into account for this and possibly also return
            # None as the unknown value instead of zero?
            logger.debug('Position query failed')
            return 0

        return utils.clocktime_to_millisecond(position)
Example #8
0
    def get_position(self):
        """
        Get position in milliseconds.

        :rtype: int
        """
        success, position = self._playbin.query_position(Gst.Format.TIME)

        if not success:
            # TODO: take state into account for this and possibly also return
            # None as the unknown value instead of zero?
            logger.debug('Position query failed')
            return 0

        return utils.clocktime_to_millisecond(position)
Example #9
0
 def _appsrc_on_seek_data(self, appsrc, gst_position):
     position = utils.clocktime_to_millisecond(gst_position)
     if self._appsrc_seek_data_callback is not None:
         self._appsrc_seek_data_callback(position)
     return True
Example #10
0
 def _appsrc_on_need_data(self, appsrc, gst_length_hint):
     length_hint = utils.clocktime_to_millisecond(gst_length_hint)
     if self._appsrc_need_data_callback is not None:
         self._appsrc_need_data_callback(length_hint)
     return True
Example #11
0
 def _appsrc_on_seek_data(self, appsrc, gst_position):
     position = utils.clocktime_to_millisecond(gst_position)
     if self._appsrc_seek_data_callback is not None:
         self._appsrc_seek_data_callback(position)
     return True
Example #12
0
 def _appsrc_on_need_data(self, appsrc, gst_length_hint):
     length_hint = utils.clocktime_to_millisecond(gst_length_hint)
     if self._appsrc_need_data_callback is not None:
         self._appsrc_need_data_callback(length_hint)
     return True