def test2(): st = """ Test single file stream """ pre = pre_mod + "test2 :" print(pre, st) filethread = FileThread(name="filethread", verbose=True) openglthread = OpenGLThread(name="mythread", n_1440p=5, verbose=True) # now livethread and openglthread are running .. chain = BasicFilterchain1(openglthread=openglthread, slot=1) chain.setFileContext("kokkelis.mkv") filethread.openStream(chain.file_ctx) # chain.file_ctx.seektime_=10000 chain.file_ctx.seektime_ = 0 filethread.seekStream(chain.file_ctx) filethread.playStream(chain.file_ctx) filethread.stopStream(chain.file_ctx) print("sleeping for some secs") time.sleep(3) print("bye!")
def test3(): st = """ Test ShmemFilterchain """ pre = pre_mod + "test3 :" print(pre, st) livethread = LiveThread(name="live_thread", verbose=True) openglthread = OpenGLThread(name="mythread", n_1440p=5, verbose=True) # now livethread and openglthread are running .. chain = ShmemFilterchain1( openglthread=openglthread, slot=1, shmem_image_dimensions=( 1920 // 4, 1080 // 4), # images passed over shmem are full-hd/4 reso shmem_image_interval=1000, # .. passed every 1000 milliseconds shmem_ringbuffer_size=10 # size of the ringbuffer ) chain.setLiveContext("rtsp://*****:*****@192.168.1.41") livethread.registerStream(chain.live_ctx) livethread.playStream(chain.live_ctx) print("sleeping for some secs") time.sleep(5) livethread.stopStream(chain.live_ctx) livethread.deregisterStream(chain.live_ctx) print("bye!")
def test2(): st = """ Test ShmemFilterchain """ pre = pre_mod + "test2 :" print(pre, st) livethread = LiveThread( name="live_thread", verbose=True ) openglthread = OpenGLThread( name="mythread", n_1440p=5, verbose=True ) # now livethread and openglthread are running .. chain = ShmemFilterchain( livethread=livethread, openglthread=openglthread, address="rtsp://*****:*****@192.168.1.10", slot=1, # images passed over shmem are full-hd/4 reso shmem_image_dimensions=(1920 // 4, 1080 // 4), shmem_image_interval=1000, # .. passed every 1000 milliseconds shmem_ringbuffer_size=10 # size of the ringbuffer ) print("sleeping for some secs") time.sleep(3) print("bye!")
def test1(): st = """ Test single stream """ pre = pre_mod + "test1 :" print(pre, st) livethread = LiveThread( name="live_thread", verbose=True ) openglthread = OpenGLThread( name="mythread", n_1440p=5, verbose=True ) # now livethread and openglthread are running .. chain = BasicFilterchain( livethread=livethread, openglthread=openglthread, address="rtsp://*****:*****@192.168.1.10", slot=1 ) print("sleeping for some secs") time.sleep(3) print("bye!")
def test1(): st = """Empty test """ pre = pre_mod + "test1 :" print(pre, st) livethread = LiveThread(name="live_thread") openglthread = OpenGLThread(name="mythread", n1440p=5, verbose=True)
def createTestThreads(): openglthread = OpenGLThread( # starts frame presenting services name="opengl_thread", # reserve stacks of YUV video frames for various resolutions n_720p=20, n_1080p=20, n_1440p=20, n_4K=0, verbose=True, # verbose=False, msbuftime=300) return openglthread
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)
def test1(): st = """ Test single live stream """ pre = pre_mod + "test1 :" print(pre, st) livethread = LiveThread(name="live_thread", verbose=True) openglthread = OpenGLThread(name="mythread", n_1440p=5, verbose=True) # now livethread and openglthread are running .. chain = BasicFilterchain1(openglthread=openglthread, slot=1) chain.setLiveContext("rtsp://*****:*****@192.168.1.41") livethread.registerStream(chain.live_ctx) livethread.playStream(chain.live_ctx) print("sleeping for some secs") time.sleep(5) livethread.stopStream(chain.live_ctx) livethread.deregisterStream(chain.live_ctx) print("bye!")
def createTestThreads(): """ valkkafsmanager = ValkkaFSManager( valkkafs, # read = False, # debugging # cache = False, # debugging # write = False # debugging ) """ livethread = LiveThread( # starts live stream services (using live555) name="live_thread", # verbose=True, verbose=False ) usbdevicethread = USBDeviceThread( name="usb_thread", #verbose=True, verbose=False ) openglthread = OpenGLThread( # starts frame presenting services name="opengl_thread", # reserve stacks of YUV video frames for various resolutions n_720p = 20, n_1080p = 20, n_1440p = 20, n_4K = 0, verbose = True, # verbose=False, msbuftime = 300 ) return livethread, usbdevicethread, openglthread
import sys import time import cv2 from valkka.api2.threads import LiveThread, OpenGLThread, ShmemClient from valkka.api2.chains import BasicFilterchain, ShmemFilterchain address = "rtsp://*****:*****@192.168.0.157" livethread = LiveThread( # starts live stream services (using live555) name="live_thread", verbose=False) openglthread = OpenGLThread( # starts frame presenting services name="mythread", n720p=10, # reserve stacks of YUV video frames for various resolutions n1080p=10, n1440p=0, n4K=0, naudio=10, verbose=False) # now livethread and openglthread are running chain = ShmemFilterchain( # decoding and branching the stream happens here livethread=livethread, openglthread=openglthread, address=address, slot=1, # this filterchain creates a shared memory server shmem_name="testing", shmem_image_dimensions=( 1920 // 4,
import time from valkka.api2.threads import LiveThread, OpenGLThread from valkka.api2.chains import BasicFilterchain livethread = LiveThread( # starts live stream services (using live555) name="live_thread", verbose=False, affinity=-1) openglthread = OpenGLThread( name="glthread", n720p=20, # reserve stacks of YUV video frames for various resolutions n1080p=20, n1440p=0, n4K=0, verbose=False, msbuftime=100, affinity=-1) chain = BasicFilterchain( # decoding and branching the stream happens here livethread=livethread, openglthread=openglthread, address=address, slot=1, affinity=-1, verbose=False, msreconnect=10000) print("bye")