コード例 #1
0
    def vlcStartup(self):
        vlcArgs = ''
        displaySize = pydispmanx.getDisplaySize()
        vlcArgs += '--width '+str(displaySize[0])+' --height '+str(displaySize[1])+' '
        if self.config.debug.disableHardwareCodec:
            vlcArgs += '--codec ffmpeg '
#        vlcArgs += '--gain 4 --alsa-audio-device hw:CARD=Headphones,DEV=0 '
        print(vlcArgs)
        self.vlcInstance = vlc.Instance(vlcArgs)

        self.vlcPlayer = self.vlcInstance.media_player_new()
        self.vlcMedia = self.vlcInstance.media_new_fd(self.lmMan.getMediaFd().fileno())
コード例 #2
0
ファイル: player.py プロジェクト: m0vse/rydeplayer
    def __init__(self, configFile=None):
        # load config
        self.config = rydeConfig()
        if configFile != None:
            self.config.loadFile(configFile)
        print(self.config.tuner)

        # setup ui core
        pygame.init()
        self.theme = Theme(pydispmanx.getDisplaySize())
        self.playbackState = rydeplayer.states.playback.StateDisplay(
            self.theme)
        print(pygame.font.get_fonts())

        # setup longmynd
        self.lmMan = longmynd.lmManager(self.config.tuner,
                                        self.config.longmynd.binpath,
                                        self.config.longmynd.mediapath,
                                        self.config.longmynd.statuspath,
                                        self.config.longmynd.tstimeout)
        self.config.tuner.setCallbackFunction(self.lmMan.reconfig)

        self.vlcStartup()

        # start ui
        self.app = guiState(self.theme, self.config.shutdownBehavior)
        self.app.startup(
            self.config, {
                'Restart LongMynd': self.lmMan.restart,
                'Force VLC': self.vlcStop,
                'Abort VLC': self.vlcAbort
            })

        # setup ir
        self.irMan = ir.irManager(self.stepSM, self.config.ir)

        # setup gpio
        self.gpioMan = rydeplayer.gpio.gpioManager(self.stepSM,
                                                   self.config.gpio)

        # start longmynd
        self.lmMan.start()
        print("Ready")
        self.monotonicState = 0
コード例 #3
0
ファイル: player.py プロジェクト: eclispe/rydeplayer
    def vlcStartup(self):
        vlcArgs = ''
        displaySize = pydispmanx.getDisplaySize()
        vlcArgs += '--width '+str(displaySize[0])+' --height '+str(displaySize[1])+' '
        displayPAR = pydispmanx.getPixelAspectRatio()
        vlcArgs += '--monitor-par '+str(displayPAR[0])+':'+str(displayPAR[1])+' '
        # vlc needs manually telling if using the second HDMI
        if self.displayId == 7:
            vlcArgs += '--mmal-display hdmi-2 '
        if self.config.debug.disableHardwareCodec:
            vlcArgs += '--codec ffmpeg '
#        vlcArgs += '--gain 4 --alsa-audio-device hw:CARD=Headphones,DEV=0 '
        print(vlcArgs)
        self.vlcInstance = vlc.Instance(vlcArgs)

        self.vlcPlayer = self.vlcInstance.media_player_new()
        vlcEvents = self.vlcPlayer.event_manager()
        vlcEvents.event_attach(vlc.EventType.MediaPlayerEndReached, self.vlcStopOnEndEvent)
        self.vlcMediaFD = self.sourceMan.getMediaFd()
        self.vlcMedia = self.vlcInstance.media_new_fd(self.vlcMediaFD)
コード例 #4
0
import pydispmanx, time, pygame
print(pydispmanx.getDisplaySize())
testlayer = pydispmanx.dispmanxLayer(3)
pygame_surface = pygame.image.frombuffer(testlayer, testlayer.size, 'RGBA')
trials = 100
start = time.time()
for n in range(int(trials / 2)):
    pygame.draw.circle(
        pygame_surface, (255, 0, 0),
        (int(testlayer.size[0] / 2), int(testlayer.size[1] / 2)),
        int(min(testlayer.size) / 4), 0)
    testlayer.updateLayer()
    pygame.draw.circle(
        pygame_surface, (0, 0, 255),
        (int(testlayer.size[0] / 2), int(testlayer.size[1] / 2)),
        int(min(testlayer.size) / 4), 0)
    testlayer.updateLayer()
end = time.time()
print(trials / (end - start))
time.sleep(2)
del (pygame_surface)
print("no surface")
time.sleep(2)
del (testlayer)
print("no layer")
time.sleep(2)
コード例 #5
0
ファイル: player.py プロジェクト: eclispe/rydeplayer
    def __init__(self, configFile = None):
        # Autodetect output display
        if(len(pydispmanx.getDisplays())<1):
            raise RuntimeError('No displays detected')
        else:
            self.displayId = pydispmanx.getDisplays()[0]

        # setup ui core
        pygame.init()
        self.theme = Theme(pydispmanx.getDisplaySize())
        self.playbackState = rydeplayer.states.playback.StateDisplay(self.theme)
        print(pygame.font.get_fonts())

        # load config
        self.config = rydeConfig(self.theme)
        if configFile != None:
            self.config.loadFile(configFile)
        print(self.config.tuner)

        # mute
        self.mute = self.config.audio.muteOnStartup
        self.muteCallbacks = []

        # volume
        self.volume = self.config.audio.volumeOnStartup
        self.volumeCallbacks = []

        # setup source 
        self.sourceMan = rydeplayer.sources.common.sourceManagerThread(self.config.tuner, self.config.sourceConfigs)
        self.config.tuner.addCallbackFunction(self.sourceMan.reconfig)

        # setup vlc
        self.recvVLCEvent, self.sendVLCEvent = socket.socketpair()
        self.vlcStartup()
        self.config.tuner.addCallbackFunction(self.vlcStopOnRetune)

        # setup on screen display
        self.osd = rydeplayer.osd.display.Controller(self.theme, self.config.osd, self.sourceMan.getStatus(), self, self.config.tuner)

        debugFunctions = {'Restart Source':self.sourceReset, 'Force VLC':self.vlcStop, 'Abort VLC': self.vlcAbort }

        # start ui
        self.app = guiState(self.theme, self.config.shutdownBehavior, self, self.osd)
        self.app.startup(self.config, debugFunctions)

        # start network
        self.netMan = rydeplayer.network.networkManager(self.config, self.stepSM, self.setMute, debugFunctions)

        # setup source watchdog
        self.watchdog = rydeplayer.watchdog.sourceWatchdog(self.config.sourceWatchdog, self.sourceReset)
        self.config.tuner.addCallbackFunction(self.watchdog.reset)

        # setup ir
        self.irMan = ir.irManager(self.stepSM, self.config.ir)

        # setup gpio
        self.gpioMan = rydeplayer.gpio.gpioManager(self.stepSM, self.config.gpio, self.config.tuner)
        self.config.tuner.addCallbackFunction(self.gpioMan.setBandOutFromPreset)

        # start source
        self.sourceMan.start()
        print("Ready")
        self.monotonicState = 0;