Пример #1
0
def main():
    if (len(sys.argv) < 2):
        print("Give rtsp stream address, i.e. rtsp://passwd:user@ip")
        return
    else:
        address = sys.argv[1]

    livethread = LiveThread(name="live_thread", verbose=True)

    openglthread = OpenGLThread(name="mythread", n1440p=5, verbose=True)

    # now livethread and openglthread are running

    chain = BasicFilterchain(livethread=livethread,
                             openglthread=openglthread,
                             address=address,
                             slot=1)

    chain.decodingOn()  # tell the decoding thread to start its job

    # let's create some windowses
    win_id1 = openglthread.createWindow()
    win_id2 = openglthread.createWindow()
    win_id3 = openglthread.createWindow()

    # send video to x windowses
    token1 = openglthread.connect(slot=1, window_id=win_id1)
    token2 = openglthread.connect(slot=1, window_id=win_id2)
    token3 = openglthread.connect(slot=1, window_id=win_id3)

    print("sleeping for some secs")
    time.sleep(10)

    openglthread.disconnect(token1)
    openglthread.disconnect(token2)
    openglthread.disconnect(token3)
Пример #2
0
    shmem_image_dimensions=(
        1920 // 4,
        1080 // 4),  # Images passed over shmem are quarter of the full-hd reso
    shmem_image_interval=
    1000,  # YUV => RGB interpolation to the small size is done each 1000 milliseconds and passed on to the shmem ringbuffer
    shmem_ringbuffer_size=10  # Size of the shmem ringbuffer
)

# Let's create some x windows
win_id1 = openglthread.createWindow()
win_id2 = openglthread.createWindow()
win_id3 = openglthread.createWindow()

# Map video stream to three windowses
token1 = openglthread.connect(
    slot=1, window_id=win_id1
)  # map slot 1 to win_id1.  Frames are interpolated from YUV to RGB at the GPU
token2 = openglthread.connect(slot=1, window_id=win_id2)
token3 = openglthread.connect(slot=1, window_id=win_id3)

name, n_buffer, n_bytes = chain.getShmemPars()
print("name, n_buffer, n_bytes", name, n_buffer, n_bytes)

# let's create a shared memory client
client = ShmemClient(
    name=name,  # e.g. "testing"
    n_ringbuffer=n_buffer,  # 10
    n_bytes=n_bytes,  # size of the RGB image
    mstimeout=
    1000,  # client timeouts if nothing has been received in 1000 milliseconds
    verbose=False)