sbMediaItemWatcher.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set sw=2 :miv */
3 /*
4 //
5 // BEGIN SONGBIRD GPL
6 //
7 // This file is part of the Songbird web player.
8 //
9 // Copyright(c) 2005-2008 POTI, Inc.
10 // http://songbirdnest.com
11 //
12 // This file may be licensed under the terms of of the
13 // GNU General Public License Version 2 (the "GPL").
14 //
15 // Software distributed under the License is distributed
16 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
17 // express or implied. See the GPL for the specific language
18 // governing rights and limitations.
19 //
20 // You should have received a copy of the GPL along with this
21 // program. If not, go to http://www.gnu.org/licenses/gpl.html
22 // or write to the Free Software Foundation, Inc.,
23 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 //
25 // END SONGBIRD GPL
26 //
27 */
28 
29 #ifndef __SB_MEDIAITEMWATCHER_H__
30 #define __SB_MEDIAITEMWATCHER_H__
31 
32 //------------------------------------------------------------------------------
33 //------------------------------------------------------------------------------
34 //
35 // Media item watcher service.
36 //
37 //------------------------------------------------------------------------------
38 //------------------------------------------------------------------------------
39 
45 //------------------------------------------------------------------------------
46 //
47 // Media item watcher imported services.
48 //
49 //------------------------------------------------------------------------------
50 
51 // Songbird imports.
52 #include <sbIMediaItemListener.h>
53 #include <sbIMediaItemWatcher.h>
54 #include <sbIMediaListListener.h>
55 
56 // Mozilla imports.
57 #include <nsCOMPtr.h>
58 #include <nsStringGlue.h>
59 
60 
61 //------------------------------------------------------------------------------
62 //
63 // Media item watcher defs.
64 //
65 //------------------------------------------------------------------------------
66 
67 //
68 // Media item watcher component defs.
69 //
70 
71 #define SONGBIRD_MEDIAITEMWATCHER_CLASSNAME "sbMediaItemWatcher"
72 #define SONGBIRD_MEDIAITEMWATCHER_CID \
73  /* {3452f193-9bdc-45d4-a626-d8d7d4605035} */ \
74  { \
75  0x3452f193, \
76  0x9bdc, \
77  0x45d4, \
78  { 0xa6, 0x26, 0xd8, 0xd7, 0xd4, 0x60, 0x50, 0x35 } \
79  }
80 
81 
82 //------------------------------------------------------------------------------
83 //
84 // Songbird album art service classes.
85 //
86 //------------------------------------------------------------------------------
87 
94 {
95  //----------------------------------------------------------------------------
96  //
97  // Public interface.
98  //
99  //----------------------------------------------------------------------------
100 
101 public:
102 
103  //
104  // Inherited interfaces.
105  //
106 
108  NS_DECL_SBIMEDIAITEMWATCHER
109  NS_DECL_SBIMEDIALISTLISTENER
110 
111 
112  //
113  // Public services.
114  //
115 
117 
118  virtual ~sbMediaItemWatcher();
119 
120 
121  //----------------------------------------------------------------------------
122  //
123  // Private interface.
124  //
125  //----------------------------------------------------------------------------
126 
127 private:
128 
129  //
130  // mWatchedMediaItem Media item being watched.
131  // mListener Listener to notify of watched media item events.
132  // mWatchedPropertyIDs List of IDs of media item properties to watch.
133  // mWatchedLibraryML Watched media item's library media list.
134  // mWacthedMediaItemProperties
135  // Current values of watched media item properties.
136  // mBatchLevel Current watched library batch level.
137  //
138 
139  nsCOMPtr<sbIMediaItem> mWatchedMediaItem;
140  nsCOMPtr<sbIMediaItemListener>
141  mListener;
142  nsCOMPtr<sbIPropertyArray> mWatchedPropertyIDs;
143  nsCOMPtr<sbIMediaList> mWatchedLibraryML;
144  nsString mWatchedMediaItemProperties;
145  PRUint32 mBatchLevel;
146 
147 
148  //
149  // Internal services.
150  //
151 
152  nsresult DoItemUpdated();
153 
154  nsresult DoItemUpdated(nsAString& aItemProperties);
155 
156  nsresult GetWatchedMediaItemProperties(nsAString& aProperties);
157 };
158 
159 
160 #endif /* __ SB_MEDIAITEMWATCHER_H__ */
161 
Interface for the media item watcher. The media item watcher may be used to watch for changes to a sp...
NS_DECL_ISUPPORTS NS_DECL_SBIMEDIAITEMWATCHER NS_DECL_SBIMEDIALISTLISTENER sbMediaItemWatcher()
Interface used to listen to changes to a media list.