Home | Trees | Indices | Help |
---|
|
1 # -*- coding: utf-8 -*- 2 # Elisa - Home multimedia server 3 # Copyright (C) 2006-2008 Fluendo Embedded S.L. (www.fluendo.com). 4 # All rights reserved. 5 # 6 # This file is available under one of two license agreements. 7 # 8 # This file is licensed under the GPL version 3. 9 # See "LICENSE.GPL" in the root of this distribution including a special 10 # exception to use Elisa with Fluendo's plugins. 11 # 12 # The GPL part of Elisa is also available under a commercial licensing 13 # agreement from Fluendo. 14 # See "LICENSE.Elisa" in the root directory of this distribution package 15 # for details on that license. 16 17 18 __maintainer__ = 'Lionel Martin <lionel@fluendo.com>' 19 20 from pgm.graph.image import Image 21 from pgm.graph.group import Group 22 23 from twisted.internet import reactor 24 from elisa.core import player, common 25 26 from poblenou_widgets.volume_osd import VolumeOsd 27 from poblenou_widgets.player_osd import * 28 29 from elisa.extern.translation import gettexter, N_ 30 T_ = gettexter('elisa-poblenou-frontend') 31 32 33 import pygst 34 pygst.require('0.10') 35 import gst, pgm 36 37 from elisa.core import plugin_registry 38 DvdPlayerViewClass = plugin_registry.get_component_class('dvd:dvd_player_view') 39 from elisa.plugins.bad.dvd.dvd_player_view import FLUENDO_DVD_INSTALLED 4042 supported_controllers = ('dvd:dvd_player_controller',) 4316945 DvdPlayerViewClass.initialize(self) 46 self.context_path = "pigment:pigment_context" 47 self.background = Image() 48 self.background.position = (0.0, 0.0, 0.0) 49 self.background.size = (4.0, 3.0) 50 self.background.bg_color = (0, 0, 0, 0) 51 self.background.opacity = 255 52 self.background.visible = True 53 self.player_dock = None 54 self.group = None55 56 #FIXME you can't put _create_player here because 57 #drawable have to be added to the canvas before using it 58 #in a pipeline 59 #self._create_player() 60 6163 64 if FLUENDO_DVD_INSTALLED: 65 vsink = gst.parse_bin_from_description ( \ 66 "ffmpegcolorspace ! pgmimagesink name=pgm_sink qos=false max-lateness=-1", True) 67 68 pgm_sink = vsink.get_by_name('pgm_sink') 69 pgm_sink.set_property('image', self.background) 70 self.player.video_sink = vsink 71 else: 72 video_sink = gst.element_factory_make('pgmimagesink') 73 video_sink.set_property('image', self.background) 74 self.player.video_sink = video_sink75 7678 if new_frontend == None: 79 return 80 81 DvdPlayerViewClass.frontend_changed(self, previous_frontend, new_frontend) 82 83 if self.group == None: 84 # create the group 85 canvas = self.frontend.context.viewport_handle.get_canvas() 86 self.group = Group(canvas, pgm.DRAWABLE_MIDDLE) 87 self.context_handle = self.group 88 89 dock_bg_path = self.frontend.theme.get_media("dock_background") 90 dock_bar_bg_path = self.frontend.theme.get_media("dock_bar_bg") 91 dock_bar_fg_path = self.frontend.theme.get_media("dock_bar_fg") 92 93 px, py = 0.7, 0.8 94 iw, ih = 4.0, 3.0 95 96 self.player_dock = PlayerOsd(canvas, 97 pgm.DRAWABLE_NEAR, 98 10000, 99 iw*px, ih*0.15, 100 dock_bar_bg_path, 101 dock_bar_fg_path, 102 dock_bg_path) 103 104 self.player_dock.position = ((1-px)*iw/2.0, ih*py, 0.0) 105 106 self.player_dock.opacity = 0 107 self.player_dock.visible = True 108 109 110 # FIXME: not yet working. Anyone knows why? 111 trans = common.application.translator 112 volume_name = trans.translateTranslatable(T_(N_("Volume: %s%%")), 113 self.frontend.languages) 114 115 vol_bg_path = self.frontend.theme.get_media("vol_dock_background") 116 self.volume_dock = VolumeOsd(canvas, 117 pgm.DRAWABLE_NEAR, 118 volume_name, 119 iw*0.3, ih*0.1, 120 vol_bg_path) 121 self.volume_dock.position = (0.15, 0.10, 0) 122 self.volume_dock.opacity = 0 123 self.volume_dock.visible = True 124 125 126 127 self.group.add(self.background) 128 self.group.visible = True 129 130 self._create_player()131 134 135137 self.volume_dock.volume = value * 10. 138 if self.controller.state == player.STATES.PLAYING and \ 139 self.controller.focused: 140 self.volume_dock.show()141 142144 DvdPlayerViewClass.state_changed(self, state) 145 if state == player.STATES.PAUSED: 146 self.player_dock.show() 147 elif state == player.STATES.STOPPED: 148 self.background.clear() 149 150 # FIXME: this whole refresh_dock looks hackish 151 reactor.callLater(0.05, self.refresh_dock)152 153155 DvdPlayerViewClass.seek_to_changed(self, position) 156 self.player.seek_to_location(position) 157 self.player_dock.time = self.player.position / 1000000.00 158 self.player_dock.show()159161 # FIXME: a division in a code called every 50 ms is not good 162 duration = int(self.player.duration / 1000000) 163 self.player_dock.playing_length = duration 164 165 self.player_dock.time = self.player.position / 1000000.0 166 167 if self.controller.state == player.STATES.PLAYING: 168 reactor.callLater(0.05, self.refresh_dock)
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0beta1 on Wed Jan 16 19:10:10 2008 | http://epydoc.sourceforge.net |