sbDeviceXMLCapabilities.h
Go to the documentation of this file.
1 /* vim: set sw=2 :miv */
2 /*
3  *=BEGIN SONGBIRD GPL
4  *
5  * This file is part of the Songbird web player.
6  *
7  * Copyright(c) 2005-2010 POTI, Inc.
8  * http://www.songbirdnest.com
9  *
10  * This file may be licensed under the terms of of the
11  * GNU General Public License Version 2 (the ``GPL'').
12  *
13  * Software distributed under the License is distributed
14  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
15  * express or implied. See the GPL for the specific language
16  * governing rights and limitations.
17  *
18  * You should have received a copy of the GPL along with this
19  * program. If not, go to http://www.gnu.org/licenses/gpl.html
20  * or write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22  *
23  *=END SONGBIRD GPL
24  */
25 
26 #ifndef SBDEVICEXMLCAPABILITIES_H_
27 #define SBDEVICEXMLCAPABILITIES_H_
28 
29 #include <nsCOMPtr.h>
30 #include <nsStringAPI.h>
31 #include <sbIDevice.h>
32 
36 class sbIDevCapVideoFormatType;
37 class nsIDOMDocument;
38 class nsIDOMElement;
39 class nsIDOMNode;
40 class nsIMutableArray;
41 
47 {
48 public:
52  sbDeviceXMLCapabilities(nsIDOMElement* aRootElement,
53  sbIDevice* aDevice = nsnull);
62  nsresult Read(sbIDeviceCapabilities * aCapabilities);
67  PRBool HasCapabilities() { return mHasCapabilities; }
76  static nsresult GetCapabilities(sbIDeviceCapabilities** aCapabilities,
77  nsIDOMDocument* aDocument,
78  sbIDevice* aDevice = nsnull);
88  static nsresult GetCapabilities(sbIDeviceCapabilities** aCapabilities,
89  nsIDOMNode* aDeviceCapsRootNode,
90  sbIDevice* aDevice = nsnull);
102  static nsresult AddCapabilities
103  (sbIDeviceCapabilities* aCapabilities,
104  const char* aXMLCapabilitiesSpec,
105  PRBool* aAddedCapabilities = nsnull,
106  sbIDevice* aDevice = nsnull);
118  static nsresult AddCapabilities
119  (sbIDeviceCapabilities* aCapabilities,
120  nsIDOMNode* aDeviceCapsRootNode,
121  PRBool* aAddedCapabilities = nsnull,
122  sbIDevice* aDevice = nsnull);
123 private:
124  sbIDevice* mDevice; // Non-owning reference
125  sbIDeviceCapabilities * mDeviceCaps; // Non-owning reference
126  nsCOMPtr<nsIDOMElement> mRootElement;
127  PRBool mHasCapabilities;
128 
133  nsresult AddFunctionType(PRUint32 aFunctionType);
134 
140  nsresult AddContentType(PRUint32 aFunctionType,
141  PRUint32 aContentType);
142 
148  nsresult AddMimeType(PRUint32 aContentType,
149  nsAString const & aMimeType);
150 
155  nsresult ProcessCapabilities(nsIDOMNode* aRootNode);
156 
161  nsresult ProcessDeviceCaps(nsIDOMNode * aDevCapNode);
162 
167  nsresult ProcessAudio(nsIDOMNode * aAudioNode);
168 
174  nsresult ProcessImageSizes(nsIDOMNode * aImageSizeNode,
175  nsIMutableArray * aImageSizes);
176 
181  nsresult ProcessImage(nsIDOMNode * aImageNode);
182 
187  nsresult ProcessVideo(nsIDOMNode * aVideoNode);
188 
195  nsresult
196  ProcessVideoStream(nsIDOMNode* aVideoStreamNode,
197  sbIDevCapVideoStream** aVideoStream);
198 
205  nsresult
206  ProcessAudioStream(nsIDOMNode* aAudioStreamNode,
207  sbIDevCapAudioStream** aAudioStream);
208 
213  nsresult
214  ProcessVideoFormat(nsIDOMNode* aDOMNode);
215 
220  nsresult ProcessPlaylist(nsIDOMNode * aPlaylistNode);
221 
229  nsresult DeviceMatchesCapabilitiesNode(nsIDOMNode * aCapabilitiesNode,
230  PRBool * aDeviceMatches);
231 
240  nsresult DeviceMatchesDeviceNode(nsIDOMNode * aDeviceNode,
241  nsIPropertyBag2 * aDeviceProperties,
242  PRBool * aDeviceMatches);
243 
252  nsresult GetFirstChildByTagName(nsIDOMNode* aNode,
253  const char* aTagName,
254  nsIDOMNode** aChildNode);
255 };
256 
257 #endif /* SBDEVICEXMLCAPABILITIES_H_ */
258 
[UNIMPLEMENTED UNTIL AFTER 0.3]
nsresult Read(sbIDeviceCapabilities *aCapabilities)
_collectFormDataForFrame aDocument
sbDeviceXMLCapabilities(nsIDOMElement *aRootElement, sbIDevice *aDevice=nsnull)
static nsresult AddCapabilities(sbIDeviceCapabilities *aCapabilities, const char *aXMLCapabilitiesSpec, PRBool *aAddedCapabilities=nsnull, sbIDevice *aDevice=nsnull)
static nsresult GetCapabilities(sbIDeviceCapabilities **aCapabilities, nsIDOMDocument *aDocument, sbIDevice *aDevice=nsnull)