Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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)
Esempio n. 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)
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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