sbTemporaryMediaItem.cpp
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  *=BEGIN SONGBIRD GPL
5  *
6  * This file is part of the Songbird web player.
7  *
8  * Copyright(c) 2005-2010 POTI, Inc.
9  * http://www.songbirdnest.com
10  *
11  * This file may be licensed under the terms of of the
12  * GNU General Public License Version 2 (the ``GPL'').
13  *
14  * Software distributed under the License is distributed
15  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
16  * express or implied. See the GPL for the specific language
17  * governing rights and limitations.
18  *
19  * You should have received a copy of the GPL along with this
20  * program. If not, go to http://www.gnu.org/licenses/gpl.html
21  * or write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23  *
24  *=END SONGBIRD GPL
25  */
26 
27 //------------------------------------------------------------------------------
28 //------------------------------------------------------------------------------
29 //
30 // Temporary media item.
31 //
32 //------------------------------------------------------------------------------
33 //------------------------------------------------------------------------------
34 
40 //------------------------------------------------------------------------------
41 //
42 // Temporary media item imported services.
43 //
44 //------------------------------------------------------------------------------
45 
46 // Self imports.
47 #include "sbTemporaryMediaItem.h"
48 
49 // Mozilla imports.
50 #include <nsEnumeratorUtils.h>
51 #include <nsISimpleEnumerator.h>
52 #include <nsIStringEnumerator.h>
53 #include <nsIURI.h>
54 
55 
56 //------------------------------------------------------------------------------
57 //
58 // nsISupports implementation.
59 //
60 //------------------------------------------------------------------------------
61 
65 
66 
67 //------------------------------------------------------------------------------
68 //
69 // sbILibraryResource implementation.
70 //
71 //------------------------------------------------------------------------------
72 
73 //-------------------------------------
74 //
75 // GetProperty
76 //
77 
78 NS_IMETHODIMP
79 sbTemporaryMediaItem::GetProperty(const nsAString& aID,
80  nsAString& _retval)
81 {
82  _retval.SetIsVoid(PR_TRUE);
83  return NS_OK;
84 }
85 
86 
87 //-------------------------------------
88 //
89 // SetProperty
90 //
91 
92 NS_IMETHODIMP
93 sbTemporaryMediaItem::SetProperty(const nsAString& aID,
94  const nsAString& aValue)
95 {
96  return NS_OK;
97 }
98 
99 
100 //-------------------------------------
101 //
102 // GetProperties
103 //
104 
105 NS_IMETHODIMP
106 sbTemporaryMediaItem::GetProperties(sbIPropertyArray* aPropertyIDs,
107  sbIPropertyArray** _retval)
108 {
109  return NS_ERROR_NOT_IMPLEMENTED;
110 }
111 
112 
113 //-------------------------------------
114 //
115 // SetProperties
116 //
117 
118 NS_IMETHODIMP
120 {
121  return NS_OK;
122 }
123 
124 
125 //-------------------------------------
126 //
127 // Equals
128 //
129 
130 NS_IMETHODIMP
131 sbTemporaryMediaItem::Equals(sbILibraryResource* aOtherLibraryResource,
132  PRBool* _retval)
133 {
134  NS_ENSURE_ARG_POINTER(aOtherLibraryResource);
135  NS_ENSURE_ARG_POINTER(_retval);
136  *_retval = aOtherLibraryResource == this;
137  return NS_OK;
138 }
139 
140 
141 //
142 // Getters/setters.
143 //
144 
145 //-------------------------------------
146 //
147 // guid
148 //
149 
150 NS_IMETHODIMP
151 sbTemporaryMediaItem::GetGuid(nsAString& aGuid)
152 {
153  aGuid.Truncate();
154  return NS_OK;
155 }
156 
157 
158 //-------------------------------------
159 //
160 // created
161 //
162 
163 NS_IMETHODIMP
164 sbTemporaryMediaItem::GetCreated(PRInt64* aCreated)
165 {
166  NS_ENSURE_ARG_POINTER(aCreated);
167  *aCreated = 0;
168  return NS_OK;
169 }
170 
171 
172 //-------------------------------------
173 //
174 // updated
175 //
176 
177 NS_IMETHODIMP
178 sbTemporaryMediaItem::GetUpdated(PRInt64* aUpdated)
179 {
180  NS_ENSURE_ARG_POINTER(aUpdated);
181  *aUpdated = 0;
182  return NS_OK;
183 }
184 
185 
186 //-------------------------------------
187 //
188 // propertyIDs
189 //
190 
191 NS_IMETHODIMP
192 sbTemporaryMediaItem::GetPropertyIDs(nsIStringEnumerator** aPropertyIDs)
193 {
194  // Validate arguments.
195  NS_ENSURE_ARG_POINTER(aPropertyIDs);
196 
197  // Function variables.
198  nsresult rv;
199 
200  // Create an empty property ID enumerator.
201  nsCOMPtr<nsISimpleEnumerator> propertyIDs;
202  rv = NS_NewEmptyEnumerator(getter_AddRefs(propertyIDs));
203  NS_ENSURE_SUCCESS(rv, rv);
204  rv = CallQueryInterface(propertyIDs, aPropertyIDs);
205  NS_ENSURE_SUCCESS(rv, rv);
206 
207  return NS_OK;
208 }
209 
210 
211 //-------------------------------------
212 //
213 // userEditableContent
214 //
215 
216 NS_IMETHODIMP
217 sbTemporaryMediaItem::GetUserEditable(PRBool* aUserEditable)
218 {
219  NS_ENSURE_ARG_POINTER(aUserEditable);
220  *aUserEditable = PR_FALSE;
221  return NS_OK;
222 }
223 
224 
225 //------------------------------------------------------------------------------
226 //
227 // sbIMediaItem implementation.
228 //
229 //------------------------------------------------------------------------------
230 
231 //-------------------------------------
232 //
233 // TestIsURIAvailable
234 //
235 
236 NS_IMETHODIMP
237 sbTemporaryMediaItem::TestIsURIAvailable(nsIObserver* aObserver)
238 {
239  return NS_ERROR_NOT_IMPLEMENTED;
240 }
241 
242 
243 //-------------------------------------
244 //
245 // OpenInputStreamAsync
246 //
247 
248 NS_IMETHODIMP
249 sbTemporaryMediaItem::OpenInputStreamAsync(nsIStreamListener* aListener,
250  nsISupports* aContext,
251  nsIChannel** _retval)
252 {
253  return NS_ERROR_NOT_IMPLEMENTED;
254 }
255 
256 
257 //-------------------------------------
258 //
259 // OpenInputStream
260 //
261 
262 NS_IMETHODIMP
263 sbTemporaryMediaItem::OpenInputStream(nsIInputStream** _retval)
264 {
265  return NS_ERROR_NOT_IMPLEMENTED;
266 }
267 
268 
269 //-------------------------------------
270 //
271 // OpenOutputStream
272 //
273 
274 NS_IMETHODIMP
275 sbTemporaryMediaItem::OpenOutputStream(nsIOutputStream** _retval)
276 {
277  return NS_ERROR_NOT_IMPLEMENTED;
278 }
279 
280 
281 //-------------------------------------
282 //
283 // ToString
284 //
285 
286 NS_IMETHODIMP
287 sbTemporaryMediaItem::ToString(nsAString& _retval)
288 {
289  _retval.Assign(NS_LITERAL_STRING("sbTemporaryMediaItem"));
290  return NS_OK;
291 }
292 
293 
294 //
295 // Getters/setters.
296 //
297 
298 //-------------------------------------
299 //
300 // library
301 //
302 
303 NS_IMETHODIMP
304 sbTemporaryMediaItem::GetLibrary(sbILibrary** aLibrary)
305 {
306  return NS_ERROR_NOT_AVAILABLE;
307 }
308 
309 
310 //-------------------------------------
311 //
312 // isMutable
313 //
314 
315 NS_IMETHODIMP
316 sbTemporaryMediaItem::GetIsMutable(PRBool* aIsMutable)
317 {
318  NS_ENSURE_ARG_POINTER(aIsMutable);
319  *aIsMutable = PR_FALSE;
320  return NS_OK;
321 }
322 
323 //-------------------------------------
324 //
325 // itemController
326 //
327 
328 NS_IMETHODIMP
329 sbTemporaryMediaItem::GetItemController(sbIMediaItemController **aMediaItemController)
330 {
331  NS_ENSURE_ARG_POINTER(aMediaItemController);
332  *aMediaItemController = nsnull;
333  return NS_OK;
334 }
335 
336 
337 //-------------------------------------
338 //
339 // mediaCreated
340 //
341 
342 NS_IMETHODIMP
343 sbTemporaryMediaItem::GetMediaCreated(PRInt64* aMediaCreated)
344 {
345  NS_ENSURE_ARG_POINTER(aMediaCreated);
346  *aMediaCreated = 0;
347  return NS_OK;
348 }
349 
350 NS_IMETHODIMP
351 sbTemporaryMediaItem::SetMediaCreated(PRInt64 aMediaCreated)
352 {
353  return NS_OK;
354 }
355 
356 
357 //-------------------------------------
358 //
359 // mediaUpdated
360 //
361 
362 NS_IMETHODIMP
363 sbTemporaryMediaItem::GetMediaUpdated(PRInt64* aMediaUpdated)
364 {
365  NS_ENSURE_ARG_POINTER(aMediaUpdated);
366  *aMediaUpdated = 0;
367  return NS_OK;
368 }
369 
370 NS_IMETHODIMP
371 sbTemporaryMediaItem::SetMediaUpdated(PRInt64 aMediaUpdated)
372 {
373  return NS_OK;
374 }
375 
376 
377 //-------------------------------------
378 //
379 // contentSrc
380 //
381 
382 NS_IMETHODIMP
383 sbTemporaryMediaItem::GetContentSrc(nsIURI** aContentSrc)
384 {
385  NS_ENSURE_ARG_POINTER(aContentSrc);
386  NS_IF_ADDREF(*aContentSrc = mContentSrc);
387  return NS_OK;
388 }
389 
390 NS_IMETHODIMP
391 sbTemporaryMediaItem::SetContentSrc(nsIURI* aContentSrc)
392 {
393  mContentSrc = aContentSrc;
394  return NS_OK;
395 }
396 
397 
398 //-------------------------------------
399 //
400 // contentLength
401 //
402 
403 NS_IMETHODIMP
404 sbTemporaryMediaItem::GetContentLength(PRInt64* aContentLength)
405 {
406  NS_ENSURE_ARG_POINTER(aContentLength);
407  *aContentLength = 0;
408  return NS_OK;
409 }
410 
411 NS_IMETHODIMP
412 sbTemporaryMediaItem::SetContentLength(PRInt64 aContentLength)
413 {
414  return NS_OK;
415 }
416 
417 
418 //-------------------------------------
419 //
420 // contentType
421 //
422 
423 NS_IMETHODIMP
424 sbTemporaryMediaItem::GetContentType(nsAString& aContentType)
425 {
426  aContentType.Assign(mContentType);
427  return NS_OK;
428 }
429 
430 NS_IMETHODIMP
431 sbTemporaryMediaItem::SetContentType(const nsAString& aContentType)
432 {
433  mContentType.Assign(aContentType);
434  return NS_OK;
435 }
436 
437 
438 //------------------------------------------------------------------------------
439 //
440 // Public services.
441 //
442 //------------------------------------------------------------------------------
443 
444 //-------------------------------------
445 //
446 // sbTemporaryMediaItem
447 //
448 
450 {
451 }
452 
453 
454 //-------------------------------------
455 //
456 // ~sbTemporaryMediaItem
457 //
458 
460 {
461 }
462 
463 
return NS_OK
onPageChanged aValue
Definition: FeedWriter.js:1395
readonly attribute nsIStringEnumerator propertyIDs
Returns a string enumerator of the IDs of all the properties set on this resource.
static nsresult ToString(const nsDiscriminatedUnion &data, nsACString &outString)
Definition: sbVariant.cpp:861
Songbird Temporary Media Item Definitions.
const nsIChannel
General interface to data resources.
static nsresult GetProperty(nsIPropertyBag2 *aProperties, nsAString const &aProp, nsAString &aValue)
Media library abstraction.
Definition: sbILibrary.idl:82
NS_IMPL_THREADSAFE_ISUPPORTS2(sbTemporaryMediaItem, sbILibraryResource, sbIMediaItem) NS_IMETHODIMP sbTemporaryMediaItem
NS_DECL_ISUPPORTS NS_DECL_SBILIBRARYRESOURCE NS_DECL_SBIMEDIAITEM sbTemporaryMediaItem()
Interface that defines a single item of media in the system.
nsresult SetProperties(nsIArray *aProperties)
An interface to carry around arrays of nsIProperty instances. Users of this interface should only QI ...
Interface that defines a mediaitem controller.