Python gi.repository.Gst() Examples

The following are 3 code examples of gi.repository.Gst(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module gi.repository , or try the search function .
Example #1
Source File: helpers.py    From brave with Apache License 2.0 5 votes vote down vote up
def state_string_to_constant(str):
    str = str.upper()
    if (str == 'PLAYING'):
        return Gst.State.PLAYING
    if (str == 'PAUSED'):
        return Gst.State.PAUSED
    if (str == 'READY'):
        return Gst.State.READY
    if (str == 'NULL'):
        return Gst.State.NULL
    return None 
Example #2
Source File: helpers.py    From brave with Apache License 2.0 5 votes vote down vote up
def block_pad(pad):
    '''
    Block an element's pad. (If already blocked, do nothing.)
    '''
    def _callback(*_):
        return Gst.PadProbeReturn.OK

    global block_probes
    if pad not in block_probes:
        block_probes[pad] = pad.add_probe(Gst.PadProbeType.BLOCK_DOWNSTREAM, _callback) 
Example #3
Source File: common.py    From examples-camera with Apache License 2.0 5 votes vote down vote up
def set_input(interpreter, buf):
    """Copies data to input tensor."""
    result, mapinfo = buf.map(Gst.MapFlags.READ)
    if result:
        np_buffer = np.reshape(np.frombuffer(mapinfo.data, dtype=np.uint8), input_image_size(interpreter))
        input_tensor(interpreter)[:, :] = np_buffer
        buf.unmap(mapinfo)