27 #include <sbIDevice.h>
28 #include <sbIMediaInspector.h>
29 #include <sbIMediaItem.h>
31 #include <nsNetError.h>
44 sbDeviceSupportsItemHelper::~sbDeviceSupportsItemHelper()
55 sbDeviceSupportsItemHelper::OnJobProgress(
sbIJobProgress *aJobProgress)
59 NS_ENSURE_ARG_POINTER(aJobProgress);
62 PRBool supported = PR_FALSE;
65 rv = aJobProgress->GetStatus(&status);
66 NS_ENSURE_SUCCESS(rv, rv);
70 nsCOMPtr<sbIMediaFormat> mediaFormat;
71 rv =
mInspector->GetMediaFormat(getter_AddRefs(mediaFormat));
72 NS_ENSURE_SUCCESS(rv, rv);
73 bool needsTranscoding;
79 supported = (NS_SUCCEEDED(rv) && !needsTranscoding);
95 (supported == PR_TRUE) ?
100 (supported == PR_TRUE) ?
105 rv = aJobProgress->RemoveJobProgressListener(
this);
106 NS_ENSURE_SUCCESS(rv, rv);
117 NS_ENSURE_ARG_POINTER(aItem);
118 NS_ENSURE_ARG_POINTER(aDevice);
119 NS_ENSURE_ARG_POINTER(aCallback);
131 PRUint32 aTranscodeType)
133 NS_ENSURE_ARG_POINTER(aInspector);
140 nsCOMPtr<sbIJobProgress> progress = do_QueryInterface(aInspector, &rv);
141 NS_ENSURE_SUCCESS(rv, rv);
142 rv = progress->AddJobProgressListener(
this);
143 NS_ENSURE_SUCCESS(rv, rv);
153 if (rv != NS_ERROR_IN_PROGRESS) {
Generic interface for exposing long running jobs to the UI.
nsresult InitJobProgress(sbIMediaInspector *aInspector, PRUint32 aTranscodeType)
void RunSupportsMediaItem()
NS_IMPL_THREADSAFE_ISUPPORTS1(sbDeviceSupportsItemHelper, sbIJobProgressListener) sbDeviceSupportsItemHelper
const unsigned long TRANSCODE_TYPE_AUDIO
PRUint32 mCanTranscodeAudio
const unsigned short STATUS_SUCCEEDED
Constant indicating that the job has completed.
nsCOMPtr< sbIDeviceSupportsItemCallback > mCallback
const unsigned long TRANSCODE_TYPE_AUDIO_VIDEO
NS_IMETHOD SupportsMediaItem(sbIMediaItem *aMediaItem, sbIDeviceSupportsItemCallback *aCallback)
nsCOMPtr< sbIMediaInspector > mInspector
nsCOMPtr< sbIMediaItem > mItem
static nsresult DoesItemNeedTranscoding(sbExtensionToContentFormatEntry_t &aFormatType, PRUint32 &aBitRate, PRUint32 &aSampleRate, sbIDevice *aDevice, bool &aNeedsTranscoding)
Determine if an item needs transcoding.
nsresult Init(sbIMediaItem *aItem, sbBaseDevice *aDevice, sbIDeviceSupportsItemCallback *aCallback)
Implemented to receive notifications from sbIJobProgress interfaces.
const unsigned short STATUS_FAILED
Constant indicating that the job has completed with errors.
PRUint32 mCanTranscodeVideo