30 #include <nsArrayUtils.h>
31 #include <nsComponentManagerUtils.h>
32 #include <nsIClassInfoImpl.h>
33 #include <nsIMutableArray.h>
34 #include <nsIProgrammingLanguage.h>
35 #include <nsServiceManagerUtils.h>
60 static PRLogModuleInfo* gDeviceCapabilitiesLog = nsnull;
61 #define TRACE(args) PR_LOG(gDeviceCapabilitiesLog, PR_LOG_DEBUG, args)
62 #define LOG(args) PR_LOG(gDeviceCapabilitiesLog, PR_LOG_WARN, args)
73 if (!gDeviceCapabilitiesLog) {
74 gDeviceCapabilitiesLog = PR_NewLogModule(
"sbDeviceCapabilities");
77 TRACE((
"sbDeviceCapabilities[0x%.8x] - Constructed",
this));
80 sbDeviceCapabilities::~sbDeviceCapabilities()
82 TRACE((
"sbDeviceCapabilities[0x%.8x] - Destructed",
this));
104 NS_ENSURE_TRUE(!
isInitialized, NS_ERROR_ALREADY_INITIALIZED);
107 NS_ENSURE_SUCCESS(rv, rv);
110 NS_ENSURE_SUCCESS(rv, rv);
118 NS_ENSURE_SUCCESS(rv, NS_ERROR_OUT_OF_MEMORY);
119 rv = newFormatTypes->Init();
120 NS_ENSURE_SUCCESS(rv, rv);
122 NS_OK : NS_ERROR_FAILURE;
123 NS_ENSURE_SUCCESS(rv, rv);
126 if (!newPreferredFormatTypes)
127 NS_ENSURE_SUCCESS(rv, NS_ERROR_OUT_OF_MEMORY);
128 rv = newPreferredFormatTypes->Init();
129 NS_ENSURE_SUCCESS(rv, rv);
131 NS_OK : NS_ERROR_FAILURE;
132 NS_ENSURE_SUCCESS(rv, rv);
142 sbDeviceCapabilities::ConfigureDone()
145 NS_ENSURE_TRUE(!
isConfigured, NS_ERROR_ALREADY_INITIALIZED);
153 sbDeviceCapabilities::SetFunctionTypes(PRUint32 *aFunctionTypes,
154 PRUint32 aFunctionTypesCount)
157 NS_ENSURE_TRUE(!
isConfigured, NS_ERROR_ALREADY_INITIALIZED);
159 for (PRUint32 arrayCounter = 0; arrayCounter < aFunctionTypesCount; ++arrayCounter) {
170 sbDeviceCapabilities::SetEventTypes(PRUint32 *aEventTypes,
171 PRUint32 aEventTypesCount)
174 NS_ENSURE_TRUE(!
isConfigured, NS_ERROR_ALREADY_INITIALIZED);
176 for (PRUint32 arrayCounter = 0; arrayCounter < aEventTypesCount; ++arrayCounter) {
188 sbDeviceCapabilities::AddContentTypes(PRUint32 aFunctionType,
189 PRUint32 *aContentTypes,
190 PRUint32 aContentTypesCount)
192 NS_ENSURE_ARG_POINTER(aContentTypes);
194 NS_ENSURE_TRUE(!
isConfigured, NS_ERROR_ALREADY_INITIALIZED);
196 nsTArray<PRUint32> * nContentTypes = nsnull;
197 PRBool
const found =
mContentTypes.Get(aFunctionType, &nContentTypes);
199 nContentTypes =
new nsTArray<PRUint32>(aContentTypesCount);
201 NS_ASSERTION(nContentTypes,
"nContentTypes should not be null");
202 for (PRUint32 arrayCounter = 0; arrayCounter < aContentTypesCount; ++arrayCounter) {
203 if (nContentTypes->IndexOf(aContentTypes[arrayCounter]) ==
204 nContentTypes->NoIndex) {
205 nContentTypes->AppendElement(aContentTypes[arrayCounter]);
217 sbDeviceCapabilities::AddMimeTypes(PRUint32 aContentType,
218 const char * *aMimeTypes,
219 PRUint32 aMimeTypesCount)
221 NS_ENSURE_ARG_POINTER(aMimeTypes);
223 NS_ENSURE_TRUE(!
isConfigured, NS_ERROR_ALREADY_INITIALIZED);
225 nsTArray<nsCString> * nMimeTypes = nsnull;
228 nMimeTypes =
new nsTArray<nsCString>(aMimeTypesCount);
230 NS_ASSERTION(nMimeTypes,
"nMimeTypes should not be null");
231 for (PRUint32 arrayCounter = 0; arrayCounter < aMimeTypesCount; ++arrayCounter) {
232 nsCString mimeType(aMimeTypes[arrayCounter]);
233 if (nMimeTypes->IndexOf(mimeType) == nMimeTypes->NoIndex) {
234 nMimeTypes->AppendElement(aMimeTypes[arrayCounter]);
247 nsAString
const & aMimeType,
250 NS_ENSURE_ARG_POINTER(aFormatType);
251 NS_ENSURE_ARG_RANGE(aContentType,
253 sbIDeviceCapabilities::CONTENT_MAX_TYPES - 1);
258 return NS_ERROR_NULL_POINTER;
260 nsTArray<nsCOMPtr<nsISupports> > * formatTypes;
261 PRBool
const found = formatType->Get(aMimeType, &formatTypes);
263 formatTypes =
new nsTArray<nsCOMPtr<nsISupports> >(1);
266 formatTypes->AppendElement(aFormatType);
269 PRBool
const added = formatType->Put(aMimeType, formatTypes);
270 NS_ENSURE_TRUE(added, NS_ERROR_OUT_OF_MEMORY);
278 nsAString
const & aMimeType,
281 NS_ENSURE_ARG_POINTER(aFormatType);
282 NS_ENSURE_ARG_RANGE(aContentType,
284 sbIDeviceCapabilities::CONTENT_MAX_TYPES - 1);
290 return NS_ERROR_NULL_POINTER;
292 nsTArray<nsCOMPtr<nsISupports> > * formatTypes;
293 PRBool
const found = formatType->Get(aMimeType, &formatTypes);
295 formatTypes =
new nsTArray<nsCOMPtr<nsISupports> >(1);
298 formatTypes->AppendElement(aFormatType);
301 PRBool
const added = formatType->Put(aMimeType, formatTypes);
302 NS_ENSURE_TRUE(added, NS_ERROR_OUT_OF_MEMORY);
311 NS_ENSURE_ARG_POINTER(aCapabilities);
313 NS_ENSURE_TRUE(!
isConfigured, NS_ERROR_ALREADY_INITIALIZED);
317 PRUint32* functionTypes;
318 PRUint32 functionTypesCount;
319 rv = aCapabilities->GetSupportedFunctionTypes(&functionTypesCount,
321 NS_ENSURE_SUCCESS(rv, rv);
324 rv = SetFunctionTypes(functionTypes, functionTypesCount);
325 NS_ENSURE_SUCCESS(rv, rv);
327 for (PRUint32 functionTypeIndex = 0;
328 functionTypeIndex < functionTypesCount;
329 ++functionTypeIndex) {
330 PRUint32 functionType = functionTypes[functionTypeIndex];
332 PRUint32* contentTypes;
333 PRUint32 contentTypesCount;
334 rv = aCapabilities->GetSupportedContentTypes(functionType,
337 NS_ENSURE_SUCCESS(rv, rv);
340 rv = AddContentTypes(functionType, contentTypes, contentTypesCount);
341 NS_ENSURE_SUCCESS(rv, rv);
343 for (PRUint32 contentTypeIndex = 0;
344 contentTypeIndex < contentTypesCount;
345 ++contentTypeIndex) {
346 PRUint32 contentType = contentTypes[contentTypeIndex];
349 PRUint32 mimeTypesCount;
350 rv = aCapabilities->GetSupportedMimeTypes(contentType,
353 if (rv == NS_ERROR_NOT_AVAILABLE) {
356 NS_ENSURE_SUCCESS(rv, rv);
359 rv = AddMimeTypes(contentType,
360 const_cast<const char**>(mimeTypes),
362 NS_ENSURE_SUCCESS(rv, rv);
364 for (PRUint32 mimeTypeIndex = 0;
365 mimeTypeIndex < mimeTypesCount;
367 nsAutoString mimeType;
368 mimeType.AssignLiteral(mimeTypes[mimeTypeIndex]);
371 PRUint32 formatTypeCount;
372 rv = aCapabilities->GetFormatTypes(contentType,
376 NS_ENSURE_SUCCESS(rv, rv);
379 for (PRUint32 formatIndex = 0;
380 formatIndex < formatTypeCount;
383 nsCOMPtr<nsISupports> formatType = formatTypes[formatIndex];
385 NS_ENSURE_SUCCESS(rv, rv);
391 PRUint32* supportedEvents;
392 PRUint32 supportedEventsCount;
393 rv = aCapabilities->GetSupportedEvents(&supportedEventsCount,
395 NS_ENSURE_SUCCESS(rv, rv);
396 SetEventTypes(supportedEvents, supportedEventsCount);
397 NS_ENSURE_SUCCESS(rv, rv);
403 sbDeviceCapabilities::GetSupportedFunctionTypes(PRUint32 *aArrayCount,
404 PRUint32 **aFunctionTypes)
406 NS_ENSURE_ARG_POINTER(aArrayCount);
407 NS_ENSURE_ARG_POINTER(aFunctionTypes);
412 PRUint32* outArray = (PRUint32*)NS_Alloc(arrayLen *
sizeof(PRUint32));
413 NS_ENSURE_TRUE(outArray, NS_ERROR_OUT_OF_MEMORY);
415 for (PRUint32 arrayCounter = 0; arrayCounter < arrayLen; arrayCounter++) {
419 *aArrayCount = arrayLen;
420 *aFunctionTypes = outArray;
425 sbDeviceCapabilities::GetSupportedContentTypes(PRUint32 aFunctionType,
426 PRUint32 *aArrayCount,
427 PRUint32 **aContentTypes)
429 NS_ENSURE_ARG_POINTER(aArrayCount);
430 NS_ENSURE_ARG_POINTER(aContentTypes);
434 nsTArray<PRUint32>* contentTypes;
437 NS_WARNING(
"There are no content types for the requested function type.");
438 return NS_ERROR_NOT_AVAILABLE;
441 PRUint32 arrayLen = contentTypes->Length();
442 PRUint32* outArray = (PRUint32*)NS_Alloc(arrayLen *
sizeof(PRUint32));
444 return NS_ERROR_OUT_OF_MEMORY;
447 for (PRUint32 arrayCounter = 0; arrayCounter < arrayLen; arrayCounter++) {
448 outArray[arrayCounter] = contentTypes->ElementAt(arrayCounter);
451 *aArrayCount = arrayLen;
452 *aContentTypes = outArray;
457 sbDeviceCapabilities::GetSupportedMimeTypes(PRUint32 aContentType,
458 PRUint32 *aArrayCount,
459 char ***aSupportedMimeTypes)
461 NS_ENSURE_ARG_POINTER(aArrayCount);
462 NS_ENSURE_ARG_POINTER(aSupportedMimeTypes);
466 nsTArray<nsCString>* supportedMimeTypes;
469 NS_WARNING(
"Requseted content type is not available for this device.");
470 return NS_ERROR_NOT_AVAILABLE;
473 PRUint32 arrayLen = supportedMimeTypes->Length();
474 char** outArray =
reinterpret_cast<char**
>(NS_Alloc(arrayLen *
sizeof(
char*)));
476 return NS_ERROR_OUT_OF_MEMORY;
479 for (PRUint32 arrayCounter = 0; arrayCounter < arrayLen; arrayCounter++) {
480 nsCString
const & mimeType = supportedMimeTypes->ElementAt(arrayCounter);
481 outArray[arrayCounter] = ToNewCString(mimeType);
484 *aArrayCount = arrayLen;
485 *aSupportedMimeTypes = outArray;
490 sbDeviceCapabilities::GetSupportedEvents(PRUint32 *aArrayCount,
491 PRUint32 **aSupportedEvents)
493 NS_ENSURE_ARG_POINTER(aArrayCount);
494 NS_ENSURE_ARG_POINTER(aSupportedEvents);
499 PRUint32* outArray = (PRUint32*)NS_Alloc(arrayLen *
sizeof(PRUint32));
501 return NS_ERROR_OUT_OF_MEMORY;
504 for (PRUint32 arrayCounter = 0; arrayCounter < arrayLen; arrayCounter++) {
508 *aArrayCount = arrayLen;
509 *aSupportedEvents = outArray;
514 sbDeviceCapabilities::SupportsContent(PRUint32 aFunctionType,
515 PRUint32 aContentType,
518 NS_ENSURE_ARG_POINTER(aSupported);
522 *aSupported = PR_FALSE;
525 PRUint32 *functionTypes;
526 PRUint32 functionTypesLength;
527 rv = GetSupportedFunctionTypes(&functionTypesLength,
529 NS_ENSURE_SUCCESS(rv, rv);
531 PRUint32 *end = functionTypes + functionTypesLength;
533 if (std::find(functionTypes, end, aFunctionType) == end)
536 PRUint32 *contentTypes;
537 PRUint32 contentTypesLength;
538 rv = GetSupportedContentTypes(aFunctionType,
541 NS_ENSURE_SUCCESS(rv, rv);
543 end = contentTypes + contentTypesLength;
544 *aSupported = std::find(contentTypes, end, aContentType) != end;
550 sbDeviceCapabilities::GetSupportedFileExtensions(
sbIDevice *aDevice,
551 PRUint32 aContentType,
555 NS_ENSURE_ARG_POINTER(aDevice);
560 nsTArray<nsString> allExtensions;
564 NS_ENSURE_SUCCESS(rv, rv);
566 nsCOMPtr<nsIStringEnumerator> allExtensionsEnum =
569 NS_ENSURE_TRUE(allExtensionsEnum, NS_ERROR_OUT_OF_MEMORY);
571 allExtensionsEnum.forget(_retval);
580 sbDeviceCapabilities::GetFormatTypes(PRUint32 aContentType,
581 nsAString
const & aMimeType,
582 PRUint32 *aArrayCount,
585 NS_ENSURE_ARG_POINTER(aArrayCount);
586 NS_ENSURE_ARG_POINTER(aSupportedFormats);
587 NS_ENSURE_ARG_RANGE(aContentType,
589 sbIDeviceCapabilities::CONTENT_MAX_TYPES - 1);
594 return NS_ERROR_NULL_POINTER;
596 nsTArray<nsCOMPtr<nsISupports> > * formats;
597 PRBool
const found = formatType->Get(aMimeType, &formats);
600 count = formats->Length();
605 NS_ENSURE_TRUE(formatsArray, NS_ERROR_OUT_OF_MEMORY);
607 for (PRUint32
i = 0;
i <
count;
i++) {
608 formatsArray[
i] = formats->ElementAt(
i);
609 NS_ADDREF(formatsArray[
i]);
612 *aArrayCount =
count;
613 *aSupportedFormats = formatsArray;
622 sbDeviceCapabilities::GetPreferredFormatTypes(PRUint32 aContentType,
623 nsAString
const & aMimeType,
624 PRUint32 *aArrayCount,
627 NS_ENSURE_ARG_POINTER(aArrayCount);
628 NS_ENSURE_ARG_POINTER(aPreferredFormats);
629 NS_ENSURE_ARG_RANGE(aContentType,
631 sbIDeviceCapabilities::CONTENT_MAX_TYPES - 1);
637 return NS_ERROR_NULL_POINTER;
639 nsTArray<nsCOMPtr<nsISupports> > * formats;
640 PRBool
const found = formatType->Get(aMimeType, &formats);
645 return GetFormatTypes(aContentType, aMimeType, aArrayCount,
649 PRUint32 count = formats->Length();
653 NS_ENSURE_TRUE(formatsArray, NS_ERROR_OUT_OF_MEMORY);
655 for (PRUint32
i = 0;
i <
count;
i++) {
656 formatsArray[
i] = formats->ElementAt(
i);
657 NS_ADDREF(formatsArray[
i]);
660 *aArrayCount =
count;
661 *aPreferredFormats = formatsArray;
678 sbImageSize::~sbImageSize()
694 sbImageSize::GetWidth(PRInt32 *
aWidth)
696 NS_ENSURE_ARG_POINTER(aWidth);
704 sbImageSize::GetHeight(PRInt32 *
aHeight)
706 NS_ENSURE_ARG_POINTER(aHeight);
724 sbDevCapRange::~sbDevCapRange()
743 NS_ENSURE_ARG_POINTER(aValue);
745 *aValue = mValues[aIndex];
752 if (mValues.IsEmpty()) {
761 NS_ENSURE_TRUE(mValues.AppendElement(aValue), NS_ERROR_OUT_OF_MEMORY);
767 sbDevCapRange::GetValueCount(PRUint32 *
aCount)
769 NS_ENSURE_ARG_POINTER(aCount);
771 *aCount = mValues.Length();
777 sbDevCapRange::GetMin(PRInt32 *aMin)
779 NS_ENSURE_ARG_POINTER(aMin);
787 sbDevCapRange::GetMax(PRInt32 *aMax)
789 NS_ENSURE_ARG_POINTER(aMax);
797 sbDevCapRange::GetStep(PRInt32 *aStep)
799 NS_ENSURE_ARG_POINTER(aStep);
807 NS_ENSURE_ARG_POINTER(aInRange);
809 if (mValues.Length() > 0) {
810 *aInRange = mValues.Contains(aValue);
813 *aInRange = aValue <= mMax && aValue >= mMin &&
814 (mStep == 0 || ((aValue - mMin) % mStep == 0));
833 sbDevCapFraction::~sbDevCapFraction()
838 sbDevCapFraction::GetNumerator(PRUint32 *aNumerator)
840 NS_ENSURE_ARG_POINTER(aNumerator);
841 *aNumerator = mNumerator;
846 sbDevCapFraction::GetDenominator(PRUint32 *aDenominator)
848 NS_ENSURE_ARG_POINTER(aDenominator);
849 *aDenominator = mDenominator;
854 sbDevCapFraction::Initialize(PRUint32 aNumerator, PRUint32 aDenominator)
856 mNumerator = aNumerator;
857 mDenominator = aDenominator;
875 sbFormatTypeConstraint::~sbFormatTypeConstraint()
882 nsIVariant * aMinValue,
883 nsIVariant * aMaxValue) {
884 NS_ENSURE_ARG_POINTER(aMinValue);
885 NS_ENSURE_ARG_POINTER(aMaxValue);
887 mConstraintName = aConstraintName;
888 mMinValue = aMinValue;
889 mMaxValue = aMaxValue;
895 sbFormatTypeConstraint::GetConstraintName(nsAString & aConstraintName)
897 aConstraintName = mConstraintName;
903 sbFormatTypeConstraint::GetConstraintMinValue(nsIVariant * *aConstraintMinValue)
905 NS_ENSURE_ARG_POINTER(aConstraintMinValue);
907 *aConstraintMinValue = mMinValue.get();
908 NS_IF_ADDREF(*aConstraintMinValue);
914 sbFormatTypeConstraint::GetConstraintMaxValue(nsIVariant * *aConstraintMaxValue)
916 NS_ENSURE_ARG_POINTER(aConstraintMaxValue);
918 *aConstraintMaxValue = mMaxValue.get();
919 NS_IF_ADDREF(*aConstraintMaxValue);
938 sbImageFormatType::~sbImageFormatType()
945 nsIArray * aSupportedExplicitSizes,
948 NS_ENSURE_ARG_POINTER(aSupportedExplicitSizes);
950 mImageFormat = aImageFormat;
951 mSupportedExplicitSizes = aSupportedExplicitSizes;
952 mSupportedWidths = aSupportedWidths;
953 mSupportedHeights = aSupportedHeights;
959 sbImageFormatType::GetImageFormat(nsACString & aImageFormat)
961 aImageFormat = mImageFormat;
967 sbImageFormatType::GetSupportedExplicitSizes(nsIArray * *aSupportedExplicitSizes)
969 NS_ENSURE_ARG_POINTER(aSupportedExplicitSizes);
971 *aSupportedExplicitSizes = mSupportedExplicitSizes;
972 NS_IF_ADDREF(*aSupportedExplicitSizes);
978 sbImageFormatType::GetSupportedWidths(
sbIDevCapRange * *aSupportedWidths)
980 NS_ENSURE_ARG_POINTER(aSupportedWidths);
982 *aSupportedWidths = mSupportedWidths;
983 NS_IF_ADDREF(*aSupportedWidths);
989 sbImageFormatType::GetSupportedHeights(
sbIDevCapRange * *aSupportedHeights)
991 NS_ENSURE_ARG_POINTER(aSupportedHeights);
993 *aSupportedHeights = mSupportedHeights;
994 NS_IF_ADDREF(*aSupportedHeights);
1013 sbAudioFormatType::~sbAudioFormatType()
1020 nsACString
const & aAudioCodec,
1024 nsIArray * aFormatSpecificConstraints) {
1025 mContainerFormat = aContainerFormat;
1026 mAudioCodec = aAudioCodec;
1027 mSupportedBitrates = aSupportedBitrates;
1028 mSupportedSampleRates = aSupportedSampleRates;
1029 mSupportedChannels = aSupportedChannels;
1030 mFormatSpecificConstraints = aFormatSpecificConstraints;
1037 sbAudioFormatType::GetContainerFormat(nsACString & aContainerFormat)
1039 aContainerFormat = mContainerFormat;
1045 sbAudioFormatType::GetAudioCodec(nsACString & aAudioCodec)
1047 aAudioCodec = mAudioCodec;
1053 sbAudioFormatType::GetSupportedBitrates(
sbIDevCapRange * *aSupportedBitrates)
1055 NS_ENSURE_ARG_POINTER(aSupportedBitrates);
1056 *aSupportedBitrates = mSupportedBitrates;
1057 NS_IF_ADDREF(*aSupportedBitrates);
1063 sbAudioFormatType::GetSupportedSampleRates(
sbIDevCapRange * *aSupportedSampleRates)
1065 NS_ENSURE_ARG_POINTER(aSupportedSampleRates);
1066 *aSupportedSampleRates = mSupportedSampleRates;
1067 NS_IF_ADDREF(*aSupportedSampleRates);
1073 sbAudioFormatType::GetSupportedChannels(
sbIDevCapRange * *aSupportedChannels)
1075 NS_ENSURE_ARG_POINTER(aSupportedChannels);
1076 *aSupportedChannels = mSupportedChannels;
1077 NS_IF_ADDREF(*aSupportedChannels);
1083 sbAudioFormatType::GetFormatSpecificConstraints(nsIArray * *aFormatSpecificConstraints)
1085 NS_ENSURE_ARG_POINTER(aFormatSpecificConstraints);
1086 *aFormatSpecificConstraints = mFormatSpecificConstraints;
1087 NS_IF_ADDREF(*aFormatSpecificConstraints);
1105 sbDevCapVideoStream::sbDevCapVideoStream()
1109 sbDevCapVideoStream::~sbDevCapVideoStream()
1113 NS_IMETHODIMP sbDevCapVideoStream::Initialize(
const nsACString & aType,
1114 nsIArray *aExplicitSizes,
1117 nsIArray *aSupportPARs,
1118 PRBool aIsSupportedPARsRange,
1119 nsIArray *aSupportedFrameRates,
1120 PRBool aIsSupportedFrameratesRange,
1123 NS_ENSURE_ARG_POINTER(aExplicitSizes);
1124 NS_ENSURE_ARG_POINTER(aSupportedFrameRates);
1125 NS_ENSURE_ARG_POINTER(aBitRates);
1128 mExplicitSizes = aExplicitSizes;
1130 mHeights = aHeights;
1131 mIsPARRange = aIsSupportedPARsRange;
1132 mVideoPARs = aSupportPARs;
1133 mIsFrameRatesRange = aIsSupportedFrameratesRange;
1134 mVideoFrameRates = aSupportedFrameRates;
1135 mBitRates = aBitRates;
1141 NS_ENSURE_ARG_POINTER(mVideoPARs);
1142 rv = mVideoPARs->GetLength(&length);
1143 NS_ENSURE_SUCCESS(rv, rv);
1144 NS_ENSURE_TRUE(length == 2, NS_ERROR_UNEXPECTED);
1147 if (!aSupportPARs) {
1149 nsCOMPtr<sbIDevCapFraction> parFraction =
1150 do_CreateInstance(
"@songbirdnest.com/Songbird/Device/sbfraction;1", &rv);
1151 NS_ENSURE_SUCCESS(rv, rv);
1153 nsCOMPtr<nsIMutableArray> parArray =
1154 do_CreateInstance(
"@songbirdnest.com/moz/xpcom/threadsafe-array;1", &rv);
1155 NS_ENSURE_SUCCESS(rv, rv);
1157 rv = parFraction->Initialize(1, 1);
1158 NS_ENSURE_SUCCESS(rv, rv);
1159 rv = parArray->AppendElement(parFraction, PR_FALSE);
1160 NS_ENSURE_SUCCESS(rv, rv);
1161 mVideoPARs = do_QueryInterface(parArray, &rv);
1162 NS_ENSURE_SUCCESS(rv, rv);
1165 if (mIsFrameRatesRange) {
1166 rv = mVideoFrameRates->GetLength(&length);
1167 NS_ENSURE_SUCCESS(rv, rv);
1168 NS_ENSURE_TRUE(length == 2, NS_ERROR_UNEXPECTED);
1171 rv = mVideoFrameRates->GetLength(&length);
1172 NS_ENSURE_SUCCESS(rv, rv);
1173 NS_ENSURE_TRUE(length > 0, NS_ERROR_UNEXPECTED);
1179 NS_IMETHODIMP sbDevCapVideoStream::GetType(nsACString & aType)
1186 NS_IMETHODIMP sbDevCapVideoStream::GetSupportedExplicitSizes(nsIArray * *aSupportedExplicitSizes)
1188 NS_IF_ADDREF(*aSupportedExplicitSizes = mExplicitSizes);
1193 NS_IMETHODIMP sbDevCapVideoStream::GetSupportedWidths(
sbIDevCapRange * *aSupportedWidths)
1195 NS_IF_ADDREF(*aSupportedWidths = mWidths);
1200 NS_IMETHODIMP sbDevCapVideoStream::GetSupportedHeights(
sbIDevCapRange * *aSupportedHeights)
1202 NS_IF_ADDREF(*aSupportedHeights = mHeights);
1208 sbDevCapVideoStream::GetDoesSupportPARRange(PRBool *aDoesSupportPARRange)
1210 NS_ENSURE_ARG_POINTER(aDoesSupportPARRange);
1211 *aDoesSupportPARRange = mIsPARRange;
1217 sbDevCapVideoStream::GetSupportedPARs(nsIArray **aSupportedPARs)
1219 NS_ENSURE_ARG_POINTER(aSupportedPARs);
1220 NS_IF_ADDREF(*aSupportedPARs = mVideoPARs);
1226 sbDevCapVideoStream::GetMinimumSupportedPAR(
1229 NS_ENSURE_ARG_POINTER(aMinimumSupportedPAR);
1230 NS_ENSURE_TRUE(mIsPARRange, NS_ERROR_NOT_AVAILABLE);
1235 nsCOMPtr<sbIDevCapFraction> minPARFraction =
1236 do_QueryElementAt(mVideoPARs, 0, &rv);
1237 NS_ENSURE_SUCCESS(rv, rv);
1239 minPARFraction.forget(aMinimumSupportedPAR);
1245 sbDevCapVideoStream::GetMaximumSupportedPAR(
1248 NS_ENSURE_ARG_POINTER(aMaximumSupportedPAR);
1249 NS_ENSURE_TRUE(mIsPARRange, NS_ERROR_NOT_AVAILABLE);
1254 nsCOMPtr<sbIDevCapFraction> maxPARFraction =
1255 do_QueryElementAt(mVideoPARs, 1, &rv);
1256 NS_ENSURE_SUCCESS(rv, rv);
1258 maxPARFraction.forget(aMaximumSupportedPAR);
1264 sbDevCapVideoStream::GetDoesSupportFrameRateRange(
1265 PRBool *aDoesSupportFrameRateRange)
1267 NS_ENSURE_ARG_POINTER(aDoesSupportFrameRateRange);
1268 *aDoesSupportFrameRateRange = mIsFrameRatesRange;
1274 sbDevCapVideoStream::GetSupportedFrameRates(nsIArray **aSupportedFrameRates)
1276 NS_ENSURE_ARG_POINTER(aSupportedFrameRates);
1277 NS_IF_ADDREF(*aSupportedFrameRates = mVideoFrameRates);
1283 sbDevCapVideoStream::GetMinimumSupportedFrameRate(
1286 NS_ENSURE_ARG_POINTER(aMinimumSupportedFrameRate);
1287 NS_ENSURE_TRUE(mIsFrameRatesRange, NS_ERROR_NOT_AVAILABLE);
1292 nsCOMPtr<sbIDevCapFraction> minFrameRateFraction =
1293 do_QueryElementAt(mVideoFrameRates, 0, &rv);
1294 NS_ENSURE_SUCCESS(rv, rv);
1296 minFrameRateFraction.forget(aMinimumSupportedFrameRate);
1302 sbDevCapVideoStream::GetMaximumSupportedFrameRate(
1305 NS_ENSURE_ARG_POINTER(aMaximumSupportedFrameRate);
1306 NS_ENSURE_TRUE(mIsFrameRatesRange, NS_ERROR_NOT_AVAILABLE);
1311 nsCOMPtr<sbIDevCapFraction> maxFrameRateFraction =
1312 do_QueryElementAt(mVideoFrameRates, 1, &rv);
1313 NS_ENSURE_SUCCESS(rv, rv);
1315 maxFrameRateFraction.forget(aMaximumSupportedFrameRate);
1320 NS_IMETHODIMP sbDevCapVideoStream::GetSupportedBitRates(
sbIDevCapRange * *aSupportedBitRates)
1322 NS_IF_ADDREF(*aSupportedBitRates = mBitRates);
1340 sbDevCapAudioStream::sbDevCapAudioStream()
1344 sbDevCapAudioStream::~sbDevCapAudioStream()
1349 sbDevCapAudioStream::Initialize(
const nsACString & aType,
1355 mBitRates = aBitRates;
1356 mSampleRates = aSampleRates;
1357 mChannels = aChannels;
1362 NS_IMETHODIMP sbDevCapAudioStream::GetType(nsACString & aType)
1369 sbDevCapAudioStream::GetSupportedBitRates(
sbIDevCapRange * *aBitRates)
1376 sbDevCapAudioStream::GetSupportedSampleRates(
sbIDevCapRange * *aSampleRates)
1383 sbDevCapAudioStream::GetSupportedChannels(
sbIDevCapRange * *aChannels)
1402 sbVideoFormatType::sbVideoFormatType()
1407 sbVideoFormatType::~sbVideoFormatType()
1413 sbVideoFormatType::Initialize(
const nsACString & aContainerType,
1417 mContainerType = aContainerType;
1418 mVideoStream = aVideoStream;
1419 mAudioStream = aAudioStream;
1425 sbVideoFormatType::GetContainerType(nsACString & aContainerType)
1427 aContainerType = mContainerType;
1457 sbPlaylistFormatType::sbPlaylistFormatType()
1461 sbPlaylistFormatType::~sbPlaylistFormatType()
1466 sbPlaylistFormatType::Initialize(
const nsACString & aPathSeparator)
1468 mPathSeparator = aPathSeparator;
1473 sbPlaylistFormatType::GetPathSeparator(nsACString & aPathSeparator)
1475 aPathSeparator = mPathSeparator;
nsTArray< PRUint32 > mSupportedEvents
[UNIMPLEMENTED UNTIL AFTER 0.3]
nsresult sbReturnCOMPtr(COMPtr &aPtr, ReturnType **aReturn)
void Initialize(in long aMin, in long aMax, in long aStep)
NS_DECL_ISUPPORTS NS_DECL_SBIDEVICECAPABILITIES NS_DECL_NSICLASSINFO sbDeviceCapabilities()
const PRUint32 CONTENT_UNKNOWN
void AddPreferredFormatType(in PRUint32 aContentType, in AString aMimeType, in nsISupports aFormatType)
Add a preferred constraint to a mime type (these are used for target formats when transcoding...
void Initialize(in long width, in long height)
void AddFormatType(in PRUint32 aContentType, in AString aMimeType, in nsISupports aFormatType)
Add a constraint to a mime type.
restoreDimensions aHeight
nsVoidArray mContentPreferredFormatTypes
const PRUint32 CONTENT_MAX_TYPES
NS_IMPL_THREADSAFE_ISUPPORTS2(sbDeviceCapabilities, sbIDeviceCapabilities, nsIClassInfo) NS_IMPL_CI_INTERFACE_GETTER2(sbDeviceCapabilities
NS_IMPL_CI_INTERFACE_GETTER2(sbImageSize, sbIImageSize, nsIClassInfo) sbImageSize
nsVoidArray mContentFormatTypes
nsClassHashtable< nsStringHashKey, nsTArray< nsCOMPtr< nsISupports > > > FormatTypes
boolean IsValueInRange(in long aValue)
void AddValue(in long aValue)
long GetValue(in unsigned long aIndex)
restoreHistoryPrecursor aCount
SupportedMimeTypes mSupportedMimeTypes
ContentTypes mContentTypes
_getSelectedPageStyle s i
nsTArray< PRUint32 > mFunctionTypes
static nsresult AddSupportedFileExtensions(sbIDevice *aDevice, PRUint32 aContentType, nsTArray< nsString > &aFileExtensionList)
Interface for storing a fractional value.