sbIMediaList Interface Reference

A brief description of the contents of this interface. More...

import"sbIMediaList.idl";

Inheritance diagram for sbIMediaList:
[legend]
Collaboration diagram for sbIMediaList:
[legend]

Public Member Functions

sbIMediaItem getItemByGuid (in AString aGuid)
 Get a media item in the list by guid. More...
 
sbIMediaItem getItemByIndex (in unsigned long aIndex)
 Get a media item in the list by index. More...
 
unsigned short getListContentType ()
 Get the content type of the media list. More...
 
void enumerateAllItems (in sbIMediaListEnumerationListener aEnumerationListener, [optional] in unsigned short aEnumerationType)
 Enumerate all items in the list. More...
 
void enumerateItemsByProperty (in AString aPropertyID, in AString aPropertyValue, in sbIMediaListEnumerationListener aEnumerationListener, [optional] in unsigned short aEnumerationType)
 Enumerate the media items in the list that match a given property ID and value. More...
 
void enumerateItemsByProperties (in sbIPropertyArray aProperties, in sbIMediaListEnumerationListener aEnumerationListener, [optional] in unsigned short aEnumerationType)
 Enumerate the media items that match a list of property IDs and values. More...
 
nsIArray getItemsByProperty (in AString aPropertyID, in AString aPropertyValue)
 
PRUint32 getItemCountByProperty (in AString aPropertyID, in AString aPropertyValue)
 
nsIArray getItemsByProperties (in sbIPropertyArray aProperties)
 
unsigned long indexOf (in sbIMediaItem aMediaItem, [optional] in unsigned long aStartFrom)
 Get the first index of a media item in the list. More...
 
unsigned long lastIndexOf (in sbIMediaItem aMediaItem, in unsigned long aStartFrom)
 Get the last index of a media item int he list. More...
 
boolean contains (in sbIMediaItem aMediaItem)
 Check if the list contains a media item. More...
 
void add (in sbIMediaItem aMediaItem)
 Add a media item to this list. More...
 
sbIMediaItem addItem (in sbIMediaItem aMediaItem)
 addItem a media item to this list More...
 
void addAll (in sbIMediaList aMediaList)
 Add the contents of a media list to this list. More...
 
void addSome (in nsISimpleEnumerator aMediaItems)
 Adds media items suppled by the provided enumerator NOTE: This method is now deprecated. More...
 
void addMediaItems (in nsISimpleEnumerator aMediaItems, in sbIAddMediaItemsListener aListener, in boolean aAsync)
 Adds media items suppled by the provided enumerator. More...
 
void remove (in sbIMediaItem aMediaItem)
 Remove the first occurrence of the given media item from the list. More...
 
void removeByIndex (in unsigned long aIndex)
 Remove a media item from the list by index. More...
 
void removeSome (in nsISimpleEnumerator aMediaItems)
 Removed media items suppled by the provided enumerator. More...
 
void clear ()
 Clear the list. More...
 
void addListener (in sbIMediaListListener aListener, [optional] in boolean aOwnsWeak, [optional] in unsigned long aFlags, [optional] in sbIPropertyArray aPropertyFilter)
 Add a listener to this media list. More...
 
void removeListener (in sbIMediaListListener aListener)
 Remove a listener from this media list. More...
 
sbIMediaListView createView ([optional] in sbIMediaListViewState aState)
 Create a new, raw view for this list. This is generally not the function that you want to use for making views as it will create a completely raw view, for example lacking any filterConstraint. Please consider using sbLibraryUtils.createStandardMediaListView and proceed carefully if you use this method instead. More...
 
void runInBatchMode (in sbIMediaListBatchCallback aCallback, [optional] in nsISupports aUserData)
 Runs the given callback with the given user data in batch mode. More...
 
nsIStringEnumerator getDistinctValuesForProperty (in AString aPropertyID)
 
- Public Member Functions inherited from sbIMediaItem
void testIsURIAvailable (in nsIObserver aObserver)
 Test if this media item is available for playback. More...
 
nsIChannel openInputStreamAsync (in nsIStreamListener aListener, in nsISupports aContext)
 Asynchronously get an input stream to the content of the media item. More...
 
nsIInputStream openInputStream ()
 Synchronously get an input stream to the content of the media item. More...
 
nsIOutputStream openOutputStream ()
 Get an output stream to the content of the media item. More...
 
AString toString ()
 Get a string representation of the media item, useful for debugging. More...
 
- Public Member Functions inherited from sbILibraryResource
AString getProperty (in AString aID)
 Get the value of a property of this resource. More...
 
void setProperty (in AString aID, in AString aValue)
 Set the value of a property on this resource. More...
 
sbIPropertyArray getProperties ([optional] in sbIPropertyArray aPropertyIDs)
 Get properties from this resource in a property array. More...
 
void setProperties (in sbIPropertyArray aProperties)
 Sets the properties and values in the supplied property array to this resource. This works as if you called setProperty on each property in the array. More...
 
boolean equals (in sbILibraryResource aOtherLibraryResource)
 Tests the equality of two library resources. More...
 

Public Attributes

const unsigned short ENUMERATIONTYPE_SNAPSHOT = 0
 This flag means that the list being enumerated is a copy that may become out of date. More...
 
const unsigned short ENUMERATIONTYPE_LOCKING = 1
 This flag means that the list is protected from changes by other threads during the enumeration. More...
 
const unsigned short CONTENTTYPE_NONE = 0
 These flags specify the contentType of the media list. More...
 
const unsigned short CONTENTTYPE_AUDIO = 1
 
const unsigned short CONTENTTYPE_VIDEO = 2
 
const unsigned short CONTENTTYPE_MIX = 3
 
attribute AString name
 The name of the media list. More...
 
readonly attribute AString type
 The type of media list (eg "simple") More...
 
readonly attribute unsigned long length
 Returns the length of the list. More...
 
readonly attribute boolean isEmpty
 Is the list empty? More...
 
readonly attribute boolean userEditableContent
 True if the user should be allowed to edit the content of this media list. More...
 
const unsigned long LISTENER_FLAGS_ITEMADDED = 1 << 0
 
const unsigned long LISTENER_FLAGS_BEFOREITEMREMOVED = 1 << 1
 
const unsigned long LISTENER_FLAGS_AFTERITEMREMOVED = 1 << 2
 
const unsigned long LISTENER_FLAGS_ITEMUPDATED = 1 << 3
 
const unsigned long LISTENER_FLAGS_BEFORELISTCLEARED = 1 << 4
 
const unsigned long LISTENER_FLAGS_LISTCLEARED = 1 << 5
 
const unsigned long LISTENER_FLAGS_BATCHBEGIN = 1 << 6
 
const unsigned long LISTENER_FLAGS_BATCHEND = 1 << 7
 
const unsigned long LISTENER_FLAGS_ITEMMOVED = 1 << 8
 
const unsigned long LISTENER_FLAGS_ALL = 0xffffffff
 
- Public Attributes inherited from sbIMediaItem
readonly attribute sbILibrary library
 The library that this media item is contained in. More...
 
readonly attribute boolean isMutable
 Can the media item be changed? More...
 
readonly attribute
sbIMediaItemController 
itemController
 An interface to the media item controller (if any) that determines this item's availability for playback. More...
 
attribute long long mediaCreated
 Creation time of the media item as a unix timestamp. More...
 
attribute long long mediaUpdated
 Last modification time of the media item as a unix timestamp. More...
 
attribute nsIURI contentSrc
 A nsIURI that resolves to the content of the media item. More...
 
attribute long long contentLength
 Size (in bytes) of the content of the media item. More...
 
attribute AString contentType
 Content type of the content of the media item, typically a mime type (should this be renamed?) More...
 
- Public Attributes inherited from sbILibraryResource
readonly attribute AString guid
 The guid of this resource. More...
 
readonly attribute long long created
 The creation time of this resource as a unix timestamp. More...
 
readonly attribute long long updated
 The last update time of this resource as a unix timestamp. More...
 
readonly attribute
nsIStringEnumerator 
propertyIDs
 Returns a string enumerator of the IDs of all the properties set on this resource. More...
 
readonly attribute boolean userEditable
 True if users should be allowed to modify the resource. More...
 

Detailed Description

A brief description of the contents of this interface.

A detailed description of this interface

See Also
List of "see also" interfaces

Definition at line 106 of file sbIMediaList.idl.

Member Function Documentation

void sbIMediaList::add ( in sbIMediaItem  aMediaItem)

Add a media item to this list.

Parameters
aMediaItemThe media item to add to the list
void sbIMediaList::addAll ( in sbIMediaList  aMediaList)

Add the contents of a media list to this list.

Parameters
aMediaListThe media list whose contents are to be added
sbIMediaItem sbIMediaList::addItem ( in sbIMediaItem  aMediaItem)

addItem a media item to this list

Parameters
aMediaItemThe media item to add to the list
Returns
the media item added. This may not be the same item passed in if the item belongs to another library. And it may be null if no item was added.
void sbIMediaList::addListener ( in sbIMediaListListener  aListener,
[optional] in boolean  aOwnsWeak,
[optional] in unsigned long  aFlags,
[optional] in sbIPropertyArray  aPropertyFilter 
)

Add a listener to this media list.

Parameters
aListenerThe listener to add
aOwnsWeakIf set to false, the media list will hold a strong reference to |aListener|. If set to true and |aListener| supports the nsIWeakReference interface, a weak reference will be held. Otherwise an error will be returned.
aFlagsA bit mask made up the LISTENER_FLAGS_ constants above. Use this to filter out unwanted notifications. If not set, this will default to LISTENER_FLAGS_ALL
aPropertyFilterIf this argument is specified, the onItemUpdated notification will only be sent for updates to any of the properties specified in the array. Note that the values of the properties in the array are ignored. If not set or null, no filtering will be applied.

Here is the caller graph for this function:

void sbIMediaList::addMediaItems ( in nsISimpleEnumerator  aMediaItems,
in sbIAddMediaItemsListener  aListener,
in boolean  aAsync 
)

Adds media items suppled by the provided enumerator.

Parameters
aMediaItemsAn enumerator returning sbIMediaItem objects
aListenerA listener that will get called with progress information
aAsyncWhether the work is to be done asynchronously
Note
The Async option is not always implemented (e.g. remote API)
Exceptions
NS_ERROR_NOT_IMPLEMENTEDif not implemented by the underlying object.
Note
aListener will always be called on the main thread.
void sbIMediaList::addSome ( in nsISimpleEnumerator  aMediaItems)

Adds media items suppled by the provided enumerator NOTE: This method is now deprecated.

See Also
addMediaItems
void sbIMediaList::clear ( )

Clear the list.

boolean sbIMediaList::contains ( in sbIMediaItem  aMediaItem)

Check if the list contains a media item.

Parameters
aMediaItemMedia item to search for
Returns
true if the media item was found, false if it was not found

Here is the caller graph for this function:

sbIMediaListView sbIMediaList::createView ( [optional] in sbIMediaListViewState  aState)

Create a new, raw view for this list. This is generally not the function that you want to use for making views as it will create a completely raw view, for example lacking any filterConstraint. Please consider using sbLibraryUtils.createStandardMediaListView and proceed carefully if you use this method instead.

Parameters
aStateOptional initial state for the view
Returns
The new view
void sbIMediaList::enumerateAllItems ( in sbIMediaListEnumerationListener  aEnumerationListener,
[optional] in unsigned short  aEnumerationType 
)

Enumerate all items in the list.

Do not use ENUMERATIONTYPE_LOCKING unless you fit a usage scenario described in the ENUMERATIONTYPE_LOCKING constant documentation.

Do not remove items during enumeration, regardless of enumeration type! This will cause functional issues during enumeration because the property cache will no longer contain associated data for items even though the item instance is still valid!

Parameters
aEnumerationListener- The enumeration listener.
aEnumerationType- One of the ENUMERATIONTYPE values above. Default is ENUMERATIONTYPE_SNAPSHOT.
void sbIMediaList::enumerateItemsByProperties ( in sbIPropertyArray  aProperties,
in sbIMediaListEnumerationListener  aEnumerationListener,
[optional] in unsigned short  aEnumerationType 
)

Enumerate the media items that match a list of property IDs and values.

Parameters
aProperties- A list of property ID/value pairs.
aEnumerationListener- The enumeration listener.
[optional]aEnumerationType - One of the ENUMERATIONTYPE values above.
void sbIMediaList::enumerateItemsByProperty ( in AString  aPropertyID,
in AString  aPropertyValue,
in sbIMediaListEnumerationListener  aEnumerationListener,
[optional] in unsigned short  aEnumerationType 
)

Enumerate the media items in the list that match a given property ID and value.

Do not remove items during enumeration, regardless of enumeration type! This will cause functional issues during enumeration because the property cache will no longer contain associated data for items even though the item instance is still valid!

Parameters
aPropertyID- Property ID to search.
aPropertyValue- Property value to search.
aEnumerationListener- The enumeration listener.
[optional]aEnumerationType - One of the ENUMERATIONTYPE values above. Default is <ENUMERATIONTYPE_SNAPSHOT>.
nsIStringEnumerator sbIMediaList::getDistinctValuesForProperty ( in AString  aPropertyID)
sbIMediaItem sbIMediaList::getItemByGuid ( in AString  aGuid)

Get a media item in the list by guid.

Parameters
aGuidGuid of the media item
Returns
Media item with the requested guid or null if not found
sbIMediaItem sbIMediaList::getItemByIndex ( in unsigned long  aIndex)

Get a media item in the list by index.

Parameters
aIndexIndex of the media item
Returns
Media item with the requested index
PRUint32 sbIMediaList::getItemCountByProperty ( in AString  aPropertyID,
in AString  aPropertyValue 
)

Get item count that have a certain property set to the specified value.

Parameters
aPropertyIDThe property id.
aPropertyValueThe property value.
Returns
the count of sbIMediaItem elements.
Exceptions
NS_ERROR_NOT_AVAILABLEwhen no items match the criteria.
nsIArray sbIMediaList::getItemsByProperties ( in sbIPropertyArray  aProperties)

Get all items that have a all properties set to the values specified.

Parameters
aPropertiesThe property array containing property key/value pairs.
Returns
An array of sbIMediaItem elements.
Exceptions
NS_ERROR_NOT_AVAILABLEwhen no items match the criteria.
nsIArray sbIMediaList::getItemsByProperty ( in AString  aPropertyID,
in AString  aPropertyValue 
)

Get all items that have a certain property set to the specified value.

Parameters
aPropertyIDThe property id.
aPropertyValueThe property value.
Returns
An array of sbIMediaItem elements.
Exceptions
NS_ERROR_NOT_AVAILABLEwhen no items match the criteria.
unsigned short sbIMediaList::getListContentType ( )

Get the content type of the media list.

Returns
Content type for the media list.
unsigned long sbIMediaList::indexOf ( in sbIMediaItem  aMediaItem,
[optional] in unsigned long  aStartFrom 
)

Get the first index of a media item in the list.

Parameters
aMediaItemMedia item to search for
aStartFromIf specified, the index to start the search from.
Returns
The index that the media item was first found at, or throws NS_ERROR_NOT_AVAILABLE if not found
unsigned long sbIMediaList::lastIndexOf ( in sbIMediaItem  aMediaItem,
in unsigned long  aStartFrom 
)

Get the last index of a media item int he list.

Parameters
aMediaItemMedia item to search for
aStartFromben write me
Returns
The index that the media item was last found at, or throws NS_ERROR_NOT_AVAILABLE if not found
void sbIMediaList::remove ( in sbIMediaItem  aMediaItem)

Remove the first occurrence of the given media item from the list.

Parameters
aMediaItemMedia item to remove
void sbIMediaList::removeByIndex ( in unsigned long  aIndex)

Remove a media item from the list by index.

Parameters
aIndexIndex of the item to remove
void sbIMediaList::removeListener ( in sbIMediaListListener  aListener)

Remove a listener from this media list.

Parameters
aListenerThe listener to remove
void sbIMediaList::removeSome ( in nsISimpleEnumerator  aMediaItems)

Removed media items suppled by the provided enumerator.

Parameters
aMediaItemsAn enumerator returning sbIMediaItem objects
void sbIMediaList::runInBatchMode ( in sbIMediaListBatchCallback  aCallback,
[optional] in nsISupports  aUserData 
)

Runs the given callback with the given user data in batch mode.

See Also
sbIMediaListBatchCallback

Member Data Documentation

const unsigned short sbIMediaList::CONTENTTYPE_AUDIO = 1

Definition at line 207 of file sbIMediaList.idl.

const unsigned short sbIMediaList::CONTENTTYPE_MIX = 3

Definition at line 211 of file sbIMediaList.idl.

const unsigned short sbIMediaList::CONTENTTYPE_NONE = 0

These flags specify the contentType of the media list.

Const: CONTENTTYPE_NONE Special list type: Download for example.

Const: CONTENTTYPE_AUDIO Only audio items in the lists or empty lists.

Const: CONTENTTYPE_VIDEO Only video items in the lists.

Const: CONTENTTYPE_MIX Both audio and video items in the lists.

Definition at line 205 of file sbIMediaList.idl.

const unsigned short sbIMediaList::CONTENTTYPE_VIDEO = 2

Definition at line 209 of file sbIMediaList.idl.

const unsigned short sbIMediaList::ENUMERATIONTYPE_LOCKING = 1

This flag means that the list is protected from changes by other threads during the enumeration.

Use this flag if you need to be certain that the contents of the list are not changed during enumeration. Note that all other threads will block until the enumeration is complete. Furthermore, changes made to list from the listener are not permitted until the listener has received the onEnumerationEnd notification.

Definition at line 187 of file sbIMediaList.idl.

const unsigned short sbIMediaList::ENUMERATIONTYPE_SNAPSHOT = 0

This flag means that the list being enumerated is a copy that may become out of date.

Use this flag if you don't care whether or not other threads change the list's contents. The listener may make changes to the list at any time but those changes will not be reflected in the enumeration sequence.

Definition at line 149 of file sbIMediaList.idl.

readonly attribute boolean sbIMediaList::isEmpty

Is the list empty?

Definition at line 341 of file sbIMediaList.idl.

readonly attribute unsigned long sbIMediaList::length

Returns the length of the list.

Definition at line 300 of file sbIMediaList.idl.

const unsigned long sbIMediaList::LISTENER_FLAGS_AFTERITEMREMOVED = 1 << 2

Definition at line 1148 of file sbIMediaList.idl.

const unsigned long sbIMediaList::LISTENER_FLAGS_ALL = 0xffffffff

Definition at line 1155 of file sbIMediaList.idl.

const unsigned long sbIMediaList::LISTENER_FLAGS_BATCHBEGIN = 1 << 6

Definition at line 1152 of file sbIMediaList.idl.

const unsigned long sbIMediaList::LISTENER_FLAGS_BATCHEND = 1 << 7

Definition at line 1153 of file sbIMediaList.idl.

const unsigned long sbIMediaList::LISTENER_FLAGS_BEFOREITEMREMOVED = 1 << 1

Definition at line 1147 of file sbIMediaList.idl.

const unsigned long sbIMediaList::LISTENER_FLAGS_BEFORELISTCLEARED = 1 << 4

Definition at line 1150 of file sbIMediaList.idl.

const unsigned long sbIMediaList::LISTENER_FLAGS_ITEMADDED = 1 << 0

Definition at line 1146 of file sbIMediaList.idl.

const unsigned long sbIMediaList::LISTENER_FLAGS_ITEMMOVED = 1 << 8

Definition at line 1154 of file sbIMediaList.idl.

const unsigned long sbIMediaList::LISTENER_FLAGS_ITEMUPDATED = 1 << 3

Definition at line 1149 of file sbIMediaList.idl.

const unsigned long sbIMediaList::LISTENER_FLAGS_LISTCLEARED = 1 << 5

Definition at line 1151 of file sbIMediaList.idl.

attribute AString sbIMediaList::name

The name of the media list.

Definition at line 241 of file sbIMediaList.idl.

readonly attribute AString sbIMediaList::type

The type of media list (eg "simple")

Definition at line 267 of file sbIMediaList.idl.

readonly attribute boolean sbIMediaList::userEditableContent

True if the user should be allowed to edit the content of this media list.

Definition at line 386 of file sbIMediaList.idl.


The documentation for this interface was generated from the following file: