コード例 #1
0
def newVideoInit(videoIndex):
    if (videoIndex is not 0):
        #--live(did not work) --threshold (s) --video_queue (mb)
        y = OMXPlayer(files[videoIndex],
                      args=[
                          '--no-keys', '--no-osd', '-b', '--layer', '1',
                          '--video_queue', '1', '-n', '-1'
                      ],
                      dbus_name='omxplayer.player' + str(videoIndex),
                      pause=True)
        y.exitEvent = lambda arg1, arg2: playBackground()
        return y
    else:
        #as hack to keep aspect ratio --win and then calculate --aspect-mode letterbox does not work
        return OMXPlayer(files[videoIndex],
                         args=[
                             '--no-keys', '--no-osd', '-b', '--layer', '2',
                             '--video_queue', '1', '-n', '-1', '--loop'
                         ],
                         dbus_name='omxplayer.player' + str(videoIndex),
                         pause=True)
コード例 #2
0
def restart_player(*args):
    global player

    player = OMXPlayer("udp://localhost:1234")
    player.exitEvent = restart_player
コード例 #3
0
def cec_key_press(event, cmd, value, *args):
    global order, player

    print(cmd, value)
    if value > 0:
        if cmd == 1:
            order = order - 1
        if cmd == 2:
            order = order + 1
        t_channel_stopper.set()
        player.quit()


def restart_player(*args):
    global player

    player = OMXPlayer("udp://localhost:1234")
    player.exitEvent = restart_player


cec.init()
cec.add_callback(cec_key_press, cec.EVENT_KEYPRESS)

t_channel_stopper = threading.Event()
t_channel = threading.Thread(target=stream_channel, args=(t_channel_stopper, ))
t_channel.start()

player = OMXPlayer("udp://localhost:1234")
player.exitEvent = restart_player