~openlp-core/openlp/trunk

« back to all changes in this revision

Viewing changes to openlp/core/lib/mediaplayer.py

  • Committer: Raoul Snyman
  • Author(s): Christian Richter
  • Date: 2011-12-02 06:56:57 UTC
  • mfrom: (1451.2.49 media_rewrite)
  • Revision ID: raoul.snyman@saturnlaboratories.co.za-20111202065657-cp5ovsgmvpl1zdkl
Rewrite of the multimedia stuff.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
 
3
 
 
4
###############################################################################
 
5
# OpenLP - Open Source Lyrics Projection                                      #
 
6
# --------------------------------------------------------------------------- #
 
7
# Copyright (c) 2008-2011 Raoul Snyman                                        #
 
8
# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan      #
 
9
# Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan,      #
 
10
# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias     #
 
11
# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,    #
 
12
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund             #
 
13
# --------------------------------------------------------------------------- #
 
14
# This program is free software; you can redistribute it and/or modify it     #
 
15
# under the terms of the GNU General Public License as published by the Free  #
 
16
# Software Foundation; version 2 of the License.                              #
 
17
#                                                                             #
 
18
# This program is distributed in the hope that it will be useful, but WITHOUT #
 
19
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
 
20
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
 
21
# more details.                                                               #
 
22
#                                                                             #
 
23
# You should have received a copy of the GNU General Public License along     #
 
24
# with this program; if not, write to the Free Software Foundation, Inc., 59  #
 
25
# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
 
26
###############################################################################
 
27
 
 
28
from openlp.core.ui.media import MediaState
 
29
 
 
30
class MediaPlayer(object):
 
31
    """
 
32
    This is the base class media Player class to provide OpenLP with a pluggable media display 
 
33
    framework.
 
34
    """
 
35
 
 
36
    def __init__(self, parent, name=u'media_player'):
 
37
        self.parent = parent
 
38
        self.name = name
 
39
        self.available = self.check_available()
 
40
        self.isActive = False
 
41
        self.canBackground = False
 
42
        self.canFolder = False
 
43
        self.state = MediaState.Off
 
44
        self.hasOwnWidget = False
 
45
        self.audio_extensions_list = []
 
46
        self.video_extensions_list = []
 
47
 
 
48
    def check_available(self):
 
49
        """
 
50
        Player is available on this machine
 
51
        """
 
52
        return False
 
53
 
 
54
    def setup(self, display):
 
55
        """
 
56
        Create the related widgets for the current display
 
57
        """
 
58
        pass
 
59
 
 
60
    def load(self, display):
 
61
        """
 
62
        Load a new media file and check if it is valid
 
63
        """
 
64
        return True
 
65
 
 
66
    def resize(self, display):
 
67
        """
 
68
        If the main display size or position is changed, the media widgets 
 
69
        should also resized
 
70
        """
 
71
        pass
 
72
 
 
73
    def play(self, display):
 
74
        """
 
75
        Starts playing of current Media File
 
76
        """
 
77
        pass
 
78
 
 
79
    def pause(self, display):
 
80
        """
 
81
        Pause of current Media File
 
82
        """
 
83
        pass
 
84
 
 
85
    def stop(self, display):
 
86
        """
 
87
        Stop playing of current Media File
 
88
        """
 
89
        pass
 
90
 
 
91
    def volume(self, display, vol):
 
92
        """
 
93
        Change volume of current Media File
 
94
        """
 
95
        pass
 
96
 
 
97
    def seek(self, display, seekVal):
 
98
        """
 
99
        Change playing position of current Media File
 
100
        """
 
101
        pass
 
102
 
 
103
    def reset(self, display):
 
104
        """
 
105
        Remove the current loaded video
 
106
        """
 
107
        pass
 
108
 
 
109
    def set_visible(self, display, status):
 
110
        """
 
111
        Show/Hide the media widgets
 
112
        """
 
113
        pass
 
114
 
 
115
    def update_ui(self, display):
 
116
        """
 
117
        Do some ui related stuff (e.g. update the seek slider)
 
118
        """
 
119
        pass
 
120
 
 
121
    def get_media_display_css(self):
 
122
        """
 
123
        Add css style sheets to htmlbuilder
 
124
        """
 
125
        return u''
 
126
 
 
127
    def get_media_display_javascript(self):
 
128
        """
 
129
        Add javascript functions to htmlbuilder
 
130
        """
 
131
        return u''
 
132
 
 
133
    def get_media_display_html(self):
 
134
        """
 
135
        Add html code to htmlbuilder
 
136
        """
 
137
        return u''