#include <sbDeviceUtils.h>
Static Public Member Functions | |
static nsresult | GetOrganizedPath (nsIFile *aParent, sbIMediaItem *aItem, nsIFile **_retval) |
static nsresult | BulkSetProperty (sbIMediaList *aMediaList, const nsAString &aPropertyId, const nsAString &aPropertyValue, sbIPropertyArray *aPropertyFilter=nsnull, PRInt32 *aAbortFlag=nsnull) |
static nsresult | DeleteByProperty (sbIMediaList *aMediaList, nsAString const &aProperty, nsAString const &aValue) |
static nsresult | DeleteUnavailableItems (sbIMediaList *aMediaList) |
static nsresult | GetDeviceLibraryForItem (sbIDevice *aDevice, sbIMediaItem *aItem, sbIDeviceLibrary **_retval) |
static nsresult | NewDeviceLibraryURI (sbIDeviceLibrary *aDeviceLibrary, const nsCString &aSpec, nsIURI **aURI) |
static nsresult | GetDeviceLibraryForLibrary (sbIDevice *aDevice, sbILibrary *aLibrary, sbIDeviceLibrary **_retval) |
static nsresult | GetMediaItemByDevicePersistentId (sbILibrary *aLibrary, const nsAString &aDevicePersistentId, sbIMediaItem **aItem) |
static nsresult | GetOriginMediaItemByDevicePersistentId (sbILibrary *aLibrary, const nsAString &aDevicePersistentId, sbIMediaItem **aItem) |
static nsresult | GetDeviceWriteLength (sbIDeviceLibrary *aDeviceLibrary, sbIMediaItem *aMediaItem, PRUint64 *aWriteLength) |
static nsresult | QueryUserSpaceExceeded (sbIDevice *aDevice, sbIDeviceLibrary *aLibrary, PRInt64 aSpaceNeeded, PRInt64 aSpaceAvailable, PRBool *aAbort) |
static nsresult | QueryUserAbortRip (PRBool *aAbort) |
static nsresult | QueryUserViewErrors (sbIDevice *aDevice) |
static nsresult | ShowDeviceErrors (sbIDevice *aDevice) |
static nsresult | SetLinkedSyncPartner (sbIDevice *aDevice) |
static bool | ArePlaylistsSupported (sbIDevice *aDevice) |
static nsresult | GetFormatTypeForItem (sbIMediaItem *aItem, sbExtensionToContentFormatEntry_t &aFormatType, PRUint32 &aBitRate, PRUint32 &aSampleRate) |
For a media item, get format information describing it (extension, mime type, etc. More... | |
static nsresult | GetFormatTypeForItem (sbIMediaItem *aItem, sbExtensionToContentFormatEntry_t &aFormatType, PRUint32 &aSampleRate, PRUint32 &aChannels, PRUint32 &aBitRate) |
For a media item, get format information describing it (extension, mime type, etc. More... | |
static nsresult | GetFormatTypeForURI (nsIURI *aURI, sbExtensionToContentFormatEntry_t &aFormatType) |
For a URI, get format information describing it (extension, mime type, etc. More... | |
static nsresult | GetFormatTypeForURL (const nsAString &aURL, sbExtensionToContentFormatEntry_t &aFormatType) |
For a URL, get format information describing it (extension, mime type, etc. More... | |
static nsresult | GetFormatTypesForMimeType (const nsAString &aMimeType, const PRUint32 aContentType, nsTArray< sbExtensionToContentFormatEntry_t > &aFormatTypeList) |
For a MIME type, get format information describing it (extension, mime type, etc. More... | |
static nsresult | GetAudioMimeTypeForFormatTypes (const nsAString &aContainer, const nsAString &aCodec, nsAString &aMimeType) |
static nsresult | DoesItemNeedTranscoding (sbExtensionToContentFormatEntry_t &aFormatType, PRUint32 &aBitRate, PRUint32 &aSampleRate, sbIDevice *aDevice, bool &aNeedsTranscoding) |
Determine if an item needs transcoding. More... | |
static nsresult | DoesItemNeedTranscoding (PRUint32 aTranscodeType, sbIMediaFormat *aMediaFormat, sbIDevice *aDevice, bool &aNeedsTranscoding) |
Determine if an item needs transcoding NOTE: This is deprecated, use other overload. More... | |
static nsresult | GetTranscodeProfiles (PRUint32 aType, nsIArray **aProfiles) |
static nsresult | GetSupportedTranscodeProfiles (PRUint32 aType, sbIDevice *aDevice, nsIArray **aProfiles) |
static nsresult | ApplyPropertyPreferencesToProfile (sbIDevice *aDevice, nsIArray *aPropertyArray, nsString aPrefNameBase) |
static nsresult | GetTranscodedFileExtension (sbITranscodeProfile *aProfile, nsCString &aExtension) |
static nsresult | GetCodecAndContainerForMimeType (nsCString aMimeType, nsCString &aContainer, nsCString &aCodec, nsCString &aVideoType, nsCString &aAudioType) |
static nsresult | GetTranscodingConfigurator (PRUint32 aTranscodeType, sbIDeviceTranscodingConfigurator **aConfigurator) |
static bool | IsItemDRMProtected (sbIMediaItem *aMediaItem) |
static nsresult | GetDeviceCapsTypeFromListContentType (PRUint16 aListContentType, PRUint32 *aContentType, PRUint32 *aFunctionType) |
static nsresult | GetDeviceCapsTypeFromMediaItem (sbIMediaItem *aMediaItem, PRUint32 *aContentType, PRUint32 *aFunctionType) |
static PRBool | IsMediaItemSupported (sbIDevice *aDevice, sbIMediaItem *aMediaItem) |
static PRBool | IsMediaListContentTypeSupported (sbIDevice *aDevice, PRUint16 aListContentType) |
static nsresult | AddSupportedFileExtensions (sbIDevice *aDevice, PRUint32 aContentType, nsTArray< nsString > &aFileExtensionList) |
static nsresult | GetMediaSettings (sbIDeviceLibrary *aDevLib, PRUint32 aMediaType, sbIDeviceLibraryMediaSyncSettings **aMediaSettings) |
static nsresult | GetMgmtTypeForMedia (sbIDeviceLibrary *aDevLib, PRUint32 aMediaType, PRUint32 &aMgmtType) |
static nsresult | GetDeviceLibrary (nsAString const &aDeviceLibGuid, sbIDevice *aDevice, sbIDeviceLibrary **aDeviceLibrar) |
static nsresult | GetDeviceLibrary (nsAString const &aDevLibGuid, nsID const *aDeviceID, sbIDeviceLibrary **aDeviceLibrary) |
static nsresult | SetOriginIsInMainLibrary (sbIMediaItem *aMediaItem, sbILibrary *aDevLibrary, PRBool aMark) |
static nsresult | GetSyncItemInLibrary (sbIMediaItem *aMediaItem, sbILibrary *aTargetLibrary, sbIMediaItem **aSyncItem) |
static bool | ShouldLogDeviceInfo () |
static nsCString | GetDeviceIdentifier (sbIDevice *aDevice) |
Utilities to aid in implementing devices
Definition at line 68 of file sbDeviceUtils.h.
|
static |
Add to the file extension list specified by aFileExtensionList the list of file extensions of the content type specified by aContentType supported by the device specified by aDevice.
aDevice | Device for which to add file extensions. |
aContentType | Content type for which to add file extensions. |
aFileExtensionList | List of file extensions to which to add. |
Definition at line 1946 of file sbDeviceUtils.cpp.
|
static |
For each transcoding profile property in aPropertyArray, look up a preference in aDevice starting with aPrefNameBase, and set the property value to the preference value if any.
Definition at line 1697 of file sbDeviceUtils.cpp.
|
static |
Determines if the device given supports playlists
Definition at line 822 of file sbDeviceUtils.cpp.
|
static |
Sets a property on all items that match a filter in a list / library.
aMediaList | [in] The list or library to process. |
aPropertyId | [in] The id of the property to set. |
aPropertyValue | [in] The value of the property to set to. |
aPoprertyFilter | [in] A set of properties to filter on. Pass in null to set on all items. |
For example, to set all items in a library as unavailable, call: sbDeviceUtils::BulkSetProperty(library, NS_LITERAL_STRING(SB_PROPERTY_AVAILABILITY), NS_LITERAL_STRING("0"));
Definition at line 250 of file sbDeviceUtils.cpp.
|
static |
Delete all items that have the property with the given value
aMediaList | the list to remove items from |
aPropertyId | the ID of the property we're interested in |
aValue | The value of the property that if matched will be deleted |
Definition at line 277 of file sbDeviceUtils.cpp.
|
static |
Delete all items that are marked not available (availability == 0) in a medialist / library.
aMediaList | The list or library to prune. |
Definition at line 306 of file sbDeviceUtils.cpp.
|
static |
Determine if an item needs transcoding.
aFormatType | The format type mapping of the item |
aBitRate | the bit rate of the item in bps |
aSampleRate | The sample rate of the item |
aDevice | The device we're transcoding to |
aNeedsTranscoding | where we put our flag denoting it needs or does not need transcoding |
Determine if an item needs transcoding NOTE: This is deprecated and will be replaced by the overloaded version below
aFormatType | The format type mapping of the item |
aBitRate | the bit rate of the item |
aDevice | The device we're transcoding to |
aNeedsTranscoding | where we put our flag denoting it needs or does not need transcoding |
Definition at line 1540 of file sbDeviceUtils.cpp.
|
static |
Determine if an item needs transcoding NOTE: This is deprecated, use other overload.
aTrascodeType | The transcode type to use |
aMediaFormat | The media format to check |
aDevice | The device we're transcoding to |
aNeedsTranscoding | where we put our flag denoting it needs or does not need transcoding |
Definition at line 1643 of file sbDeviceUtils.cpp.
|
static |
Return in aMimeType the audio MIME type for the container specified by aContainer and codec specified by aCodec.
aContainer | Container type. |
aCodec | Codec type. |
aMimeType | Returned MIME type. |
Definition at line 1210 of file sbDeviceUtils.cpp.
|
static |
Get the most-likely container type and codec type for a given mime type. Returns NS_ERROR_NOT_AVAILABLE if not known for this mime type
Definition at line 1775 of file sbDeviceUtils.cpp.
|
static |
Gets the device capabilities type for the list content type.
aListContentType | Map the device capabilities from list content type |
aContentType | Returns the device capabilities content type |
aFunctionType | Returns the device capabilities function type |
Definition at line 1859 of file sbDeviceUtils.cpp.
|
static |
Gets the device capabilities type for an item
aMediaItem | Map the device capabilities from the item content type |
aContentType | Returns the device capabilities content type |
aFunctionType | Returns the device capabilities function type |
Definition at line 1815 of file sbDeviceUtils.cpp.
|
static |
Definition at line 2797 of file sbDeviceUtils.cpp.
|
static |
Returns the device library given a library ID and an optional device ID
aDevLibGuid | The device library's guid |
aDevice | The device to search for the library |
aDeviceLibrary | The library found, or null if none found |
Definition at line 2033 of file sbDeviceUtils.cpp.
|
static |
Returns the device library given a library ID and an optional device ID
aDevLibGuid | The device library's guid |
aDeviceID | An optional device ID pass null if you have none |
aDeviceLibrary | The library found, or null if none found |
Definition at line 2074 of file sbDeviceUtils.cpp.
|
static |
Given a device and a media item, find the sbIDeviceLibrary for it this is necessary because the device library is a wrapper
Definition at line 314 of file sbDeviceUtils.cpp.
|
static |
Given a device and a sbILibrary, find the sbIDeviceLibrary for it this is necessary because the device library is a wrapper
Definition at line 403 of file sbDeviceUtils.cpp.
|
static |
Return in aWriteLength the length of the media item specified by aMediaItem when written to the device library specified by aDeviceLibrary.
aDeviceLibrary | Device library to which media item will be written. |
aMediaItem | Media item to write to device library. |
aWriteLength | Returned write length of media item. |
Definition at line 522 of file sbDeviceUtils.cpp.
|
static |
For a media item, get format information describing it (extension, mime type, etc.
Returns the formatting information for an item
aItem | The item we want the format stuff for |
aFormatType | the formatting map entry for the item |
aBitRate | The bit rate for the item |
aSampleRate | the sample rate for the item |
Definition at line 1010 of file sbDeviceUtils.cpp.
|
static |
For a media item, get format information describing it (extension, mime type, etc.
Returns the formatting information for an item
aItem | The item we want the format stuff for |
aFormatType | the formatting map entry for the item |
aSampleRate | the sample rate for the item |
aChannels | the number of channels for the item |
aBitRate | The bit rate for the item |
Definition at line 1059 of file sbDeviceUtils.cpp.
|
static |
For a URI, get format information describing it (extension, mime type, etc.
Returns the formatting information for a URI
aURI | The URI we want the format stuff for |
aFormatType | the formatting map entry for the URI |
Definition at line 1114 of file sbDeviceUtils.cpp.
|
static |
For a URL, get format information describing it (extension, mime type, etc.
Returns the formatting information for a URL
aURL | The URL we want the format stuff for |
aFormatType | the formatting map entry for the URL |
Definition at line 1138 of file sbDeviceUtils.cpp.
|
static |
For a MIME type, get format information describing it (extension, mime type, etc.
Returns the formatting information for a MIME type
aMimeType | The MIME type we want the format stuff for |
aFormatTypeList | the formatting map entries for the MIME type |
Definition at line 1175 of file sbDeviceUtils.cpp.
|
static |
Search the library specified by aLibrary for an item with a device persisent ID property matching aDevicePersistentId. Return the found item in aItem.
aLibrary | [in] Library in which to search for items. |
aDevicePersistentId | [in] Device persistent ID for which to search. |
aItem | [out] Found item. |
Definition at line 448 of file sbDeviceUtils.cpp.
|
static |
Helper function to return the media settings object for a library for a given type
aDevLib | the device library to retrieve the setttings |
aMediaType | The media type you're interested in |
aMediaSettings | The returned media sync settings |
Definition at line 1995 of file sbDeviceUtils.cpp.
|
static |
Helper function to return the management type for a given device library and media type
aDevLib | the device library to retrieve the setttings |
aMediaType | The media type you're interested in |
aMgmtType | The management type returned |
Definition at line 2014 of file sbDeviceUtils.cpp.
|
static |
Give back a nsIFile pointing to where a file should be transferred to using the media item properties to build a directory structure. Note that the resulting file may reside in a directory that does not yet exist.
aParent | the directory to place the file |
aItem | the media item to be transferred |
Definition at line 120 of file sbDeviceUtils.cpp.
|
static |
Search the library specified by aLibrary for an item with a device persistent ID property matching aDevicePersistentId. Return that item's origin media item in aItem.
aLibrary | [in] Library in which to search for items. |
aDevicePersistentId | [in] Device persistent ID for which to search. |
aItem | [out] Found origin item. |
Definition at line 498 of file sbDeviceUtils.cpp.
|
static |
Returns a list of transcode profiles that the device supports
aType | the type of transcoding profiles to retrieve. |
aDevice | the device to retrieve the profiles for. |
aProfiles | the array of profiles that were found |
Definition at line 1364 of file sbDeviceUtils.cpp.
|
static |
Return in aSyncItem the target sync media item in the target sync library specified by aTargetLibrary corresponding to the source sync media item specified by aMediaItem. If no matching target sync media item can be found, this function returns NS_OK and returns nsnull in aSyncItem.
aMediaItem | Sync source media item. |
aTargetLibrary | Sync target library. |
aSyncItem | Sync target media item. |
Definition at line 2116 of file sbDeviceUtils.cpp.
|
static |
Get the appropriate file extension for files ended with this profile.
Definition at line 1745 of file sbDeviceUtils.cpp.
|
static |
Returns the list or transcode profiles for a particular transcoding type supported by the system
Definition at line 1349 of file sbDeviceUtils.cpp.
|
static |
|
static |
Returns true if the item is DRM protected
aMediaItem | The item to check |
Definition at line 1801 of file sbDeviceUtils.cpp.
|
static |
Returns true if the device supports the media item.
aDevice | The device to look up capabilities with. |
aMediaItem | The media item to check for. |
Definition at line 1890 of file sbDeviceUtils.cpp.
|
static |
Returns true if the device supports the content type of the media list.
aDevice | The device to look up capabilities with. |
aListContentType | The list content type to check for. |
Definition at line 1918 of file sbDeviceUtils.cpp.
|
static |
Return in aURI a URI produced using the URI spec specified by aSpec resolved relative to the base URI for the device library specified by aDeviceLibrary. The device library base URI has the following form: "x-device:///<device-guid>/<library-guid>/".
aDeviceLibrary | Device library for the base URI. |
aSpec | URI spec. |
aURI | Returned URI. |
Definition at line 335 of file sbDeviceUtils.cpp.
|
static |
Ask the user if they wish to abort ripping the cd, this will be called when the user cancels the rip.
aAbort | [out] True if user selected to stop rip. |
Definition at line 595 of file sbDeviceUtils.cpp.
|
static |
Ask the user what action to take in response to an operation space exceeded event for the device specified by aDevice and device library specified by aLibrary. The amount of space needed for the operation is specified by aSpaceNeeded and the amount available by aSpaceAvailable. If the user chooses to abort the operation, true is returned in aAbort.
aDevice | [in] Target device of operation. |
aLibrary | [in] Target device library of operation. |
aSpaceNeeded | [in] Space needed by operation. |
aSpaceAvailable | [in] Space available to operation. |
aAbort | [out] True if user selected to abort operation. |
Definition at line 572 of file sbDeviceUtils.cpp.
|
static |
Ask the user if they wish to see the errors for a device before ejecting if there are any errors.
aDevice | [in] Target device of operation |
Definition at line 643 of file sbDeviceUtils.cpp.
|
static |
Set the sync partener preference to the device if the device is not linked to local sync partner.
aDevice | Device to check. |
Definition at line 777 of file sbDeviceUtils.cpp.
|
static |
Sets the origin is in main library property if the origin item exists
aMediaItem | This is the main library item that is used to find the find the corresponding item in the given device library |
aDevLibrary | The device library of the item |
aMark | Specifies whether to set or clear the mark |
Definition at line 2186 of file sbDeviceUtils.cpp.
|
static |
Returns true if we should log the device info for devices. This is controlled by the songbird.device.log_device_info preference.
Definition at line 2785 of file sbDeviceUtils.cpp.
|
static |
Show the user any errors that occured for a device.
aDevice | [in] Target device of operation |
Definition at line 701 of file sbDeviceUtils.cpp.