28 #include <nsIClassInfoImpl.h>
29 #include <nsIDOMWindow.h>
30 #include <nsIDOMXULElement.h>
31 #include <nsIPrefBranch.h>
32 #include <nsIPrefService.h>
33 #include <nsIProgrammingLanguage.h>
34 #include <nsIPropertyBag2.h>
35 #include <nsISupportsPrimitives.h>
37 #include <nsIVariant.h>
38 #include <nsIWeakReferenceUtils.h>
39 #include <nsIWindowWatcher.h>
41 #include <nsAutoLock.h>
42 #include <nsAutoPtr.h>
43 #include <nsArrayUtils.h>
44 #include <nsComponentManagerUtils.h>
47 #include <nsServiceManagerUtils.h>
48 #include <nsStringGlue.h>
53 #include <sbICascadeFilterSet.h>
54 #include <sbIFilterableMediaListView.h>
55 #include <sbILibrary.h>
56 #include <sbILibraryConstraints.h>
57 #include <sbIMediacore.h>
58 #include <sbIMediacoreEvent.h>
59 #include <sbIMediacoreEventTarget.h>
60 #include <sbIMediacorePlaybackControl.h>
61 #include <sbIMediacoreStatus.h>
62 #include <sbIMediacoreVideoWindow.h>
63 #include <sbIMediacoreVoting.h>
64 #include <sbIMediacoreVotingChain.h>
65 #include <sbIMediaItem.h>
66 #include <sbIMediaItemController.h>
67 #include <sbIMediaList.h>
68 #include <sbIPrompter.h>
69 #include <sbIPropertyArray.h>
70 #include <sbIPropertyInfo.h>
71 #include <sbISortableMediaListView.h>
72 #include <sbIWindowWatcher.h>
73 #include <sbIMediacoreErrorHandler.h>
91 #define MEDIACORE_UPDATE_NOTIFICATION_DELAY 500
94 #define MEDIACORE_CHECK_DELAY 100
97 #define MEDIACORE_MAX_SUBSEQUENT_ERRORS 20
104 static PRLogModuleInfo* gMediacoreSequencerLog = nsnull;
105 #define TRACE(args) PR_LOG(gMediacoreSequencerLog, PR_LOG_DEBUG, args)
106 #define LOG(args) PR_LOG(gMediacoreSequencerLog, PR_LOG_WARN, args)
115 PRBool aRemainingTime = PR_FALSE)
117 PRUint64 seconds = aValue / 1000;
118 PRUint64 minutes = seconds / 60;
119 PRUint64 hours = minutes / 60;
121 seconds = seconds %60;
122 minutes = minutes % 60;
124 NS_NAMED_LITERAL_STRING(strZero,
"0");
125 NS_NAMED_LITERAL_STRING(strCol,
":");
126 nsString stringValue;
130 stringValue += strCol;
133 if(hours > 0 && minutes < 10) {
134 stringValue += strZero;
138 stringValue += strCol;
141 stringValue += strZero;
149 aString.Assign(NS_LITERAL_STRING(
"-"));
152 aString.Append(stringValue);
174 sbIMediacoreSequencer,
180 sbMediacoreSequencer::sbMediacoreSequencer()
182 , mStatus(sbIMediacoreStatus::STATUS_STOPPED)
183 , mIsWaitingForPlayback(PR_FALSE)
184 , mSeenPlaying(PR_FALSE)
185 , mNextTriggeredByStreamEnd(PR_FALSE)
186 , mStopTriggeredBySequencer(PR_FALSE)
187 , mCoreWillHandleNext(PR_FALSE)
188 , mPositionInvalidated(PR_FALSE)
190 , mCanAbort(PR_FALSE)
191 , mShouldAbort(PR_FALSE)
192 , mMode(sbIMediacoreSequencer::MODE_FORWARD)
193 , mRepeatMode(sbIMediacoreSequencer::MODE_REPEAT_NONE)
196 , mCurrentItemIndex(0)
198 , mLibraryBatchCount(0)
199 , mSmartRebuildDetectBatchCount(0)
200 , mResetPosition(PR_FALSE)
201 , mNoRecalculate(PR_FALSE)
202 , mViewIsLibrary(PR_FALSE)
203 , mNeedSearchPlayingItem(PR_FALSE)
204 , mNeedsRecalculate(PR_FALSE)
205 , mWatchingView(PR_FALSE)
206 , mResumePlaybackPosition(PR_TRUE)
207 , mValidationComplete(PR_FALSE)
208 , mOnHoldStatus(ONHOLD_NOTONHOLD)
209 , mValidationFromUserAction(PR_FALSE)
213 if (!gMediacoreSequencerLog)
214 gMediacoreSequencerLog = PR_NewLogModule(
"sbMediacoreSequencer");
221 nsAutoMonitor::DestroyMonitor(
mMonitor);
230 NS_ASSERTION(NS_IsMainThread(),
231 "sbMediacoreSequencer::Init expected to be on the main thread");
232 mMonitor = nsAutoMonitor::NewMonitor(
"sbMediacoreSequencer::mMonitor");
233 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_OUT_OF_MEMORY);
235 nsresult rv = NS_ERROR_UNEXPECTED;
237 nsCOMPtr<nsISupportsWeakReference> weakRef =
239 NS_ENSURE_SUCCESS(rv, rv);
242 NS_ENSURE_SUCCESS(rv, rv);
245 do_CreateInstance(NS_TIMER_CONTRACTID, &rv);
246 NS_ENSURE_SUCCESS(rv, rv);
249 NS_ENSURE_SUCCESS(rv, rv);
251 nsRefPtr<sbMediacoreShuffleSequenceGenerator> generator;
253 NS_ENSURE_TRUE(generator, NS_ERROR_OUT_OF_MEMORY);
255 rv = generator->Init();
256 NS_ENSURE_SUCCESS(rv, rv);
259 NS_ENSURE_SUCCESS(rv, rv);
261 PRBool shuffle = PR_FALSE;
263 NS_ENSURE_SUCCESS(rv, rv);
271 NS_ENSURE_SUCCESS(rv, rv);
272 NS_ENSURE_ARG_RANGE(repeatMode, 0, 2);
277 NS_ENSURE_SUCCESS(rv, rv);
279 rv = prefs->GetBoolPref(
"songbird.mediacore.resumePlaybackPosition",
281 if (NS_SUCCEEDED(rv)) {
292 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
298 nsITimer::TYPE_REPEATING_SLACK);
299 NS_ENSURE_SUCCESS(rv, rv);
302 NS_ENSURE_SUCCESS(rv, rv);
310 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
314 NS_ENSURE_SUCCESS(rv, rv);
317 NS_ENSURE_SUCCESS(rv, rv);
320 NS_ENSURE_SUCCESS(rv, rv);
323 NS_ENSURE_SUCCESS(rv, rv);
331 nsresult rv = NS_ERROR_UNEXPECTED;
338 nullString.SetIsVoid(PR_TRUE);
342 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
343 NS_ENSURE_SUCCESS(rv, rv);
348 NS_ENSURE_SUCCESS(rv, rv);
351 NS_ENSURE_SUCCESS(rv, rv);
355 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
356 NS_ENSURE_SUCCESS(rv, rv);
361 NS_ENSURE_SUCCESS(rv, rv);
364 NS_ENSURE_SUCCESS(rv, rv);
368 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
369 NS_ENSURE_SUCCESS(rv, rv);
374 NS_ENSURE_SUCCESS(rv, rv);
377 NS_ENSURE_SUCCESS(rv, rv);
381 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
382 NS_ENSURE_SUCCESS(rv, rv);
387 NS_ENSURE_SUCCESS(rv, rv);
390 NS_ENSURE_SUCCESS(rv, rv);
394 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
395 NS_ENSURE_SUCCESS(rv, rv);
400 NS_ENSURE_SUCCESS(rv, rv);
403 NS_ENSURE_SUCCESS(rv, rv);
407 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
408 NS_ENSURE_SUCCESS(rv, rv);
413 NS_ENSURE_SUCCESS(rv, rv);
416 NS_ENSURE_SUCCESS(rv, rv);
420 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
421 NS_ENSURE_SUCCESS(rv, rv);
429 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
430 NS_ENSURE_SUCCESS(rv, rv);
435 NS_ENSURE_SUCCESS(rv, rv);
443 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
444 NS_ENSURE_SUCCESS(rv, rv);
449 NS_ENSURE_SUCCESS(rv, rv);
452 NS_ENSURE_SUCCESS(rv, rv);
456 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
457 NS_ENSURE_SUCCESS(rv, rv);
462 NS_ENSURE_SUCCESS(rv, rv);
465 NS_ENSURE_SUCCESS(rv, rv);
469 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
470 NS_ENSURE_SUCCESS(rv, rv);
475 NS_ENSURE_SUCCESS(rv, rv);
479 NS_ENSURE_SUCCESS(rv, rv);
483 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
484 NS_ENSURE_SUCCESS(rv, rv);
489 NS_ENSURE_SUCCESS(rv, rv);
492 NS_ENSURE_SUCCESS(rv, rv);
496 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
497 NS_ENSURE_SUCCESS(rv, rv);
502 NS_ENSURE_SUCCESS(rv, rv);
505 NS_ENSURE_SUCCESS(rv, rv);
509 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
510 NS_ENSURE_SUCCESS(rv, rv);
515 NS_ENSURE_SUCCESS(rv, rv);
518 NS_ENSURE_SUCCESS(rv, rv);
522 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
523 NS_ENSURE_SUCCESS(rv, rv);
528 NS_ENSURE_SUCCESS(rv, rv);
531 NS_ENSURE_SUCCESS(rv, rv);
535 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
536 NS_ENSURE_SUCCESS(rv, rv);
541 NS_ENSURE_SUCCESS(rv, rv);
545 NS_ENSURE_SUCCESS(rv, rv);
549 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
550 NS_ENSURE_SUCCESS(rv, rv);
555 NS_ENSURE_SUCCESS(rv, rv);
559 NS_ENSURE_SUCCESS(rv, rv);
563 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
564 NS_ENSURE_SUCCESS(rv, rv);
569 NS_ENSURE_SUCCESS(rv, rv);
572 NS_ENSURE_SUCCESS(rv, rv);
576 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
577 NS_ENSURE_SUCCESS(rv, rv);
582 NS_ENSURE_SUCCESS(rv, rv);
585 NS_ENSURE_SUCCESS(rv, rv);
589 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
590 NS_ENSURE_SUCCESS(rv, rv);
595 NS_ENSURE_SUCCESS(rv, rv);
599 NS_ENSURE_SUCCESS(rv, rv);
601 if(shuffle.IsEmpty()) {
603 NS_ENSURE_SUCCESS(rv, rv);
608 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
609 NS_ENSURE_SUCCESS(rv, rv);
614 NS_ENSURE_SUCCESS(rv, rv);
618 NS_ENSURE_SUCCESS(rv, rv);
620 if(repeat.IsEmpty()) {
623 NS_ENSURE_SUCCESS(rv, rv);
628 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
629 NS_ENSURE_SUCCESS(rv, rv);
633 NS_ENSURE_SUCCESS(rv, rv);
635 NS_ENSURE_SUCCESS(rv, rv);
639 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
640 NS_ENSURE_SUCCESS(rv, rv);
644 NS_ENSURE_SUCCESS(rv, rv);
646 NS_ENSURE_SUCCESS(rv, rv);
650 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
651 NS_ENSURE_SUCCESS(rv, rv);
655 NS_ENSURE_SUCCESS(rv, rv);
657 NS_ENSURE_SUCCESS(rv, rv);
661 do_CreateInstance(
"@songbirdnest.com/Songbird/DataRemote;1", &rv);
662 NS_ENSURE_SUCCESS(rv, rv);
666 NS_ENSURE_SUCCESS(rv, rv);
668 NS_ENSURE_SUCCESS(rv, rv);
683 NS_ENSURE_SUCCESS(rv, rv);
688 NS_ENSURE_SUCCESS(rv, rv);
693 NS_ENSURE_SUCCESS(rv, rv);
698 NS_ENSURE_SUCCESS(rv, rv);
703 NS_ENSURE_SUCCESS(rv, rv);
708 NS_ENSURE_SUCCESS(rv, rv);
713 NS_ENSURE_SUCCESS(rv, rv);
722 NS_ENSURE_SUCCESS(rv, rv);
727 NS_ENSURE_SUCCESS(rv, rv);
732 NS_ENSURE_SUCCESS(rv, rv);
737 NS_ENSURE_SUCCESS(rv, rv);
742 NS_ENSURE_SUCCESS(rv, rv);
747 NS_ENSURE_SUCCESS(rv, rv);
752 NS_ENSURE_SUCCESS(rv, rv);
757 NS_ENSURE_SUCCESS(rv, rv);
762 NS_ENSURE_SUCCESS(rv, rv);
767 NS_ENSURE_SUCCESS(rv, rv);
772 NS_ENSURE_SUCCESS(rv, rv);
781 NS_ENSURE_SUCCESS(rv, rv);
786 NS_ENSURE_SUCCESS(rv, rv);
791 NS_ENSURE_SUCCESS(rv, rv);
796 NS_ENSURE_SUCCESS(rv, rv);
801 NS_ENSURE_SUCCESS(rv, rv);
806 NS_ENSURE_SUCCESS(rv, rv);
815 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
819 PRBool paused = PR_FALSE;
820 PRBool playing = PR_FALSE;
831 NS_ENSURE_SUCCESS(rv, rv);
834 NS_ENSURE_SUCCESS(rv, rv);
842 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
846 nsString positionStr;
848 NS_ENSURE_SUCCESS(rv, rv);
853 NS_ENSURE_SUCCESS(rv, rv);
856 NS_ENSURE_SUCCESS(rv, rv);
860 NS_ENSURE_SUCCESS(rv, rv);
862 nsString remainingStr;
863 PRInt64 remaining = 0;
865 if(duration > aPosition)
866 remaining = duration - aPosition;
869 NS_ENSURE_SUCCESS(rv, rv);
872 NS_ENSURE_SUCCESS(rv, rv);
880 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
888 NS_ENSURE_SUCCESS(rv, rv);
892 NS_ENSURE_SUCCESS(rv, rv);
897 NS_ENSURE_SUCCESS(rv, rv);
905 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
906 NS_ENSURE_ARG_POINTER(aURI);
909 nsresult rv = aURI->GetSpec(spec);
910 NS_ENSURE_SUCCESS(rv, rv);
914 NS_ConvertUTF8toUTF16 wideSpec(spec);
916 NS_ENSURE_SUCCESS(rv, rv);
919 NS_ENSURE_SUCCESS(rv, rv);
927 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
929 PRBool shuffle = PR_FALSE;
937 NS_ENSURE_SUCCESS(rv, rv);
945 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
950 NS_ENSURE_SUCCESS(rv, rv);
959 PRBool isPlayingVideo;
961 NS_ENSURE_SUCCESS(rv, rv);
963 if (isPlayingVideo) {
965 NS_ENSURE_SUCCESS(rv, rv);
968 NS_ENSURE_SUCCESS(rv, rv);
977 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
978 NS_ENSURE_ARG_POINTER(aEvent);
980 nsCOMPtr<nsIVariant> variant;
981 nsresult rv = aEvent->GetData(getter_AddRefs(variant));
982 NS_ENSURE_SUCCESS(rv, rv);
985 rv = variant->GetAsDouble(&volume);
986 NS_ENSURE_SUCCESS(rv, rv);
989 NS_ENSURE_SUCCESS(rv, rv);
997 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
1004 NS_ConvertUTF8toUTF16 volumeStr(volume);
1006 NS_ENSURE_SUCCESS(rv, rv);
1014 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
1015 NS_ENSURE_ARG_POINTER(aEvent);
1017 nsCOMPtr<nsIVariant> variant;
1018 nsresult rv = aEvent->GetData(getter_AddRefs(variant));
1019 NS_ENSURE_SUCCESS(rv, rv);
1021 PRBool muted = PR_FALSE;
1022 rv = variant->GetAsBool(&muted);
1023 NS_ENSURE_SUCCESS(rv, rv);
1026 NS_ENSURE_SUCCESS(rv, rv);
1034 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
1039 NS_ENSURE_SUCCESS(rv, rv);
1047 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
1048 NS_ENSURE_ARG_POINTER(aEvent);
1050 nsCOMPtr<nsIVariant> variant;
1051 nsresult rv = aEvent->GetData(getter_AddRefs(variant));
1052 NS_ENSURE_SUCCESS(rv, rv);
1054 nsCOMPtr<nsISupports> supports;
1055 rv = variant->GetAsISupports(getter_AddRefs(supports));
1056 NS_ENSURE_SUCCESS(rv, rv);
1058 nsCOMPtr<sbIPropertyArray> propertyArray =
1059 do_QueryInterface(supports, &rv);
1060 NS_ENSURE_SUCCESS(rv, rv);
1062 PRUint32 length = 0;
1063 rv = propertyArray->GetLength(&length);
1064 NS_ENSURE_SUCCESS(rv, rv);
1066 nsCOMPtr<sbIProperty> property;
1067 for(PRUint32 current = 0; current < length; ++current) {
1068 rv = propertyArray->GetPropertyAt(current, getter_AddRefs(property));
1069 NS_ENSURE_SUCCESS(rv, rv);
1072 rv =
property->GetId(
id);
1073 NS_ENSURE_SUCCESS(rv, rv);
1075 rv =
property->GetValue(value);
1076 NS_ENSURE_SUCCESS(rv, rv);
1079 NS_ENSURE_SUCCESS(rv, rv);
1089 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
1091 LOG((
"[sbMediacoreSequencer] - SetMetadataDataRemote: Id '%s', Value '%s'",
1092 NS_ConvertUTF16toUTF8(aId).BeginReading(),
1093 NS_ConvertUTF16toUTF8(aValue).BeginReading()));
1108 nsString artistName;
1111 NS_ENSURE_SUCCESS(rv, rv);
1113 nsCOMPtr<nsIURI>
uri;
1115 NS_ENSURE_SUCCESS(rv, rv);
1118 rv = uri->GetScheme(scheme);
1119 NS_ENSURE_SUCCESS(rv, rv);
1121 if (scheme.EqualsLiteral(
"file") && !artistName.IsEmpty())
1124 nsCOMPtr<sbIDataRemote> remote;
1142 nsresult rv = remote->SetStringValue(aValue);
1143 NS_ENSURE_SUCCESS(rv, rv);
1151 const nsAString &aPropName)
1153 PRUint32 length = 0;
1154 nsresult rv = aPropArray->GetLength(&length);
1155 NS_ENSURE_SUCCESS(rv, PR_FALSE);
1157 nsCOMPtr<sbIProperty> property;
1158 for(PRUint32 current = 0; current < length; ++current) {
1159 rv = aPropArray->GetPropertyAt(current, getter_AddRefs(property));
1160 NS_ENSURE_SUCCESS(rv, PR_FALSE);
1163 rv =
property->GetId(
id);
1164 NS_ENSURE_SUCCESS(rv, PR_FALSE);
1166 if(
id.Equals(aPropName)) {
1183 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
1184 NS_ENSURE_ARG_POINTER(aItem);
1186 nsString albumName, artistName, genre, trackName, imageURL;
1189 if(!aPropertiesChanged ||
1195 NS_ENSURE_SUCCESS(rv, rv);
1198 NS_ENSURE_SUCCESS(rv, rv);
1201 if(!aPropertiesChanged ||
1207 NS_ENSURE_SUCCESS(rv, rv);
1210 NS_ENSURE_SUCCESS(rv, rv);
1213 if(!aPropertiesChanged ||
1218 NS_ENSURE_SUCCESS(rv, rv);
1221 NS_ENSURE_SUCCESS(rv, rv);
1224 if(!aPropertiesChanged ||
1230 NS_ENSURE_SUCCESS(rv, rv);
1233 NS_ENSURE_SUCCESS(rv, rv);
1236 if(!aPropertiesChanged ||
1242 NS_ENSURE_SUCCESS(rv, rv);
1245 NS_ENSURE_SUCCESS(rv, rv);
1253 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
1256 NS_ENSURE_SUCCESS(rv, rv);
1259 NS_ENSURE_SUCCESS(rv, rv);
1262 NS_ENSURE_SUCCESS(rv, rv);
1265 NS_ENSURE_SUCCESS(rv, rv);
1268 NS_ENSURE_SUCCESS(rv, rv);
1271 NS_ENSURE_SUCCESS(rv, rv);
1274 NS_ENSURE_SUCCESS(rv, rv);
1284 nsString strDuration;
1285 nsresult rv =
mCurrentItem->GetProperty(PROPERTY_DURATION,
1287 NS_ENSURE_SUCCESS(rv, rv);
1289 PRUint64 itemDuration = 0;
1292 if (!strDuration.IsEmpty()) {
1294 NS_ENSURE_SUCCESS(rv, rv);
1297 itemDuration /= PR_USEC_PER_MSEC;
1299 if(aDuration && itemDuration != aDuration) {
1301 sbAutoString strNewDuration(aDuration * PR_USEC_PER_MSEC);
1302 rv =
mCurrentItem->SetProperty(PROPERTY_DURATION, strNewDuration);
1303 NS_ENSURE_SUCCESS(rv, rv);
1312 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
1322 rv = playbackControl->Stop();
1323 NS_ASSERTION(NS_SUCCEEDED(rv),
"Stop failed at end of sequence.");
1330 NS_ENSURE_SUCCESS(rv, rv);
1333 NS_ENSURE_SUCCESS(rv, rv);
1339 NS_ENSURE_SUCCESS(rv, rv);
1348 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
1349 NS_ENSURE_ARG_POINTER(aEvent);
1362 NS_ENSURE_SUCCESS(rv, rv);
1373 NS_ENSURE_SUCCESS(rv, rv);
1378 nsCOMPtr<sbIMediaItem> mediaItem;
1379 rv = GetCurrentItem(getter_AddRefs(mediaItem));
1380 NS_ENSURE_SUCCESS(rv, rv);
1382 nsString contentType;
1386 rv = mediaItem->GetContentType(contentType);
1387 NS_ENSURE_SUCCESS(rv, rv);
1392 if (!contentType.Equals(NS_LITERAL_STRING(
"video"))) {
1394 NS_ENSURE_SUCCESS(rv, rv);
1398 NS_ENSURE_SUCCESS(rv, rv);
1403 nsCOMPtr<sbIMediacoreError> error;
1404 rv = aEvent->GetError(getter_AddRefs(error));
1405 NS_ENSURE_SUCCESS(rv, rv);
1409 nsCOMPtr<sbIMediacoreErrorHandler> errorHandler =
1410 do_GetService(
"@songbirdnest.com/Songbird/MediacoreErrorHandler;1", &rv);
1411 NS_ENSURE_SUCCESS(rv, rv);
1413 rv = errorHandler->ProcessError(error);
1414 NS_ENSURE_SUCCESS(rv, rv);
1423 LOG((
"[%s] Recalculating Sequence", __FUNCTION__));
1434 PRUint32 length = 0;
1435 nsresult rv =
mView->GetLength(&length);
1436 NS_ENSURE_SUCCESS(rv, rv);
1443 ((*aViewPosition >= length) ||
1452 for(PRUint32
i = 0;
i < length; ++
i) {
1467 for(PRUint32
i = length - 1;
i >= 0; --
i, ++j) {
1474 mPosition = (PRUint32)(length - *aViewPosition);
1482 PRUint32 sequenceLength = 0;
1483 PRUint32 *sequence = nsnull;
1488 NS_ENSURE_SUCCESS(rv, rv);
1490 for(PRUint32
i = 0;
i < sequenceLength; ++
i) {
1496 *aViewPosition == sequence[i]) {
1516 PRUint32 sequenceLength = 0;
1517 PRUint32 *sequence = nsnull;
1522 NS_ENSURE_SUCCESS(rv, rv);
1524 for(PRUint32
i = 0;
i < sequenceLength; ++
i) {
1530 *aViewPosition == sequence[i]) {
1549 nsCOMPtr<nsIArray> newSequence;
1550 rv = GetCurrentSequence(getter_AddRefs(newSequence));
1551 NS_ENSURE_SUCCESS(rv, rv);
1554 NS_ENSURE_TRUE(variant, NS_ERROR_OUT_OF_MEMORY);
1556 nsCOMPtr<sbIMediacoreEvent>
event;
1561 getter_AddRefs(event));
1562 NS_ENSURE_SUCCESS(rv, rv);
1565 NS_ENSURE_SUCCESS(rv, rv);
1575 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
1576 NS_ENSURE_ARG_POINTER(aItem);
1581 NS_ENSURE_TRUE(aPosition < length, NS_ERROR_INVALID_ARG);
1583 nsCOMPtr<sbIMediaItem> item;
1584 nsresult rv =
mView->GetItemByIndex(aSequence[aPosition],
1585 getter_AddRefs(item));
1586 NS_ENSURE_SUCCESS(rv, rv);
1599 NS_ENSURE_SUCCESS(rv, rv);
1608 NS_WARNING(
"Someone aborted playback of the next track.");
1611 NS_ENSURE_SUCCESS(rv, rv);
1620 NS_WARNING(
"Someone aborted playback of the next track.");
1623 NS_ENSURE_SUCCESS(rv, rv);
1634 NS_ENSURE_SUCCESS(rv, rv);
1651 NS_ENSURE_SUCCESS(rv, rv);
1664 nsCOMPtr<nsIURI>
uri;
1665 nsCOMPtr<sbIMediaItem> item;
1668 nsresult rv = NS_ERROR_UNEXPECTED;
1672 NS_ENSURE_SUCCESS(rv, rv);
1677 NS_ENSURE_SUCCESS(rv, rv);
1681 rv = item->GetContentSrc(getter_AddRefs(uri));
1682 NS_ENSURE_SUCCESS(rv, rv);
1691 nsCOMPtr<sbIMediacoreVoting> voting =
1693 NS_ENSURE_SUCCESS(rv, rv);
1695 NS_ENSURE_TRUE(voting, NS_ERROR_UNEXPECTED);
1701 nsCOMPtr<sbIMediacoreVotingChain> votingChain;
1702 rv = voting->VoteWithURI(uri, getter_AddRefs(votingChain));
1703 NS_ENSURE_SUCCESS(rv, rv);
1705 PRBool validChain = PR_FALSE;
1706 rv = votingChain->GetValid(&validChain);
1707 NS_ENSURE_SUCCESS(rv, rv);
1712 return NS_ERROR_UNEXPECTED;
1715 nsCOMPtr<nsIArray> chain;
1716 rv = votingChain->GetMediacoreChain(getter_AddRefs(chain));
1717 NS_ENSURE_SUCCESS(rv, rv);
1729 nsCOMPtr<sbIMediacore> nextCore =
1731 NS_ENSURE_SUCCESS(rv, rv);
1733 if(
mCore != nextCore) {
1735 do_QueryInterface(
mCore, &rv);
1737 rv = eventTarget->RemoveListener(
this);
1738 NS_ENSURE_SUCCESS(rv, rv);
1745 if(
mCore == nextCore) {
1758 NS_ENSURE_SUCCESS(rv, rv);
1761 rv = playbackControl->Stop();
1762 NS_ASSERTION(NS_SUCCEEDED(rv),
1763 "Stop returned failure. Attempting to recover.");
1769 nsCOMPtr<sbIMediacorePlaybackControl> playbackControl =
1771 NS_ENSURE_SUCCESS(rv, rv);
1775 NS_ENSURE_SUCCESS(rv, rv);
1780 NS_ENSURE_TRUE(variant, NS_ERROR_OUT_OF_MEMORY);
1782 nsCOMPtr<sbIMediacoreEvent>
event;
1787 getter_AddRefs(event));
1788 NS_ENSURE_SUCCESS(rv, rv);
1793 NS_ENSURE_SUCCESS(rv, rv);
1807 do_QueryInterface(
mCore, &rv);
1808 NS_ENSURE_SUCCESS(rv, rv);
1810 rv = eventTarget->AddListener(
this);
1811 NS_ENSURE_SUCCESS(rv, rv);
1814 NS_ENSURE_SUCCESS(rv, rv);
1819 rv = uri->GetSpec(spec);
1820 LOG((
"[sbMediacoreSequencer] -- Attempting to play %s",
1821 spec.BeginReading()));
1825 nsCOMPtr<sbPIMediacoreManager> privateMediacoreManager =
1827 NS_ENSURE_SUCCESS(rv, rv);
1829 rv = privateMediacoreManager->SetPrimaryCore(
mCore);
1830 NS_ENSURE_SUCCESS(rv, rv);
1832 rv =
mCore->SetSequencer(
this);
1833 NS_ENSURE_SUCCESS(rv, rv);
1836 NS_ENSURE_SUCCESS(rv, rv);
1839 NS_ENSURE_SUCCESS(rv, rv);
1843 NS_ENSURE_SUCCESS(rv, rv);
1847 NS_ENSURE_TRUE(variant, NS_ERROR_OUT_OF_MEMORY);
1849 nsCOMPtr<sbIMediacoreEvent>
event;
1854 getter_AddRefs(event));
1855 NS_ENSURE_SUCCESS(rv, rv);
1858 NS_ENSURE_SUCCESS(rv, rv);
1874 nsCOMPtr<sbIMediaItem> item;
1877 NS_ENSURE_SUCCESS(rv, rv);
1882 NS_ENSURE_SUCCESS(rv, rv);
1889 nsCOMPtr<nsIURI>
uri;
1890 rv = item->GetContentSrc(getter_AddRefs(uri));
1891 NS_ENSURE_SUCCESS(rv, rv);
1894 NS_ENSURE_TRUE(variant, NS_ERROR_OUT_OF_MEMORY);
1896 nsCOMPtr<sbIMediacoreEvent>
event;
1901 getter_AddRefs(event));
1902 NS_ENSURE_SUCCESS(rv, rv);
1909 NS_ENSURE_SUCCESS(rv, rv);
1922 NS_ENSURE_SUCCESS(rv, rv);
1925 NS_ENSURE_SUCCESS(rv, rv);
1933 getter_AddRefs(event));
1934 NS_ENSURE_SUCCESS(rv, rv);
1937 NS_ENSURE_SUCCESS(rv, rv);
1952 nsresult rv = Stop(PR_TRUE);
1953 NS_ENSURE_SUCCESS(rv, PR_FALSE);
1967 NS_ENSURE_SUCCESS(rv, rv);
1970 NS_ENSURE_SUCCESS(rv, rv);
1973 NS_ENSURE_SUCCESS(rv, rv);
1976 NS_ENSURE_SUCCESS(rv, rv);
1983 PRInt64 *aViewPosition )
1985 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
1986 NS_ENSURE_ARG_POINTER(aView);
1994 PRUint32 viewLength = 0;
1995 nsresult rv = aView->GetLength(&viewLength);
1996 NS_ENSURE_SUCCESS(rv, rv);
1998 if(
mView != aView ||
2003 NS_ENSURE_TRUE(variant, NS_ERROR_OUT_OF_MEMORY);
2005 nsCOMPtr<sbIMediacoreEvent>
event;
2011 getter_AddRefs(event));
2012 NS_ENSURE_SUCCESS(rv, rv);
2015 NS_ENSURE_SUCCESS(rv, rv);
2018 NS_ENSURE_SUCCESS(rv, rv);
2023 NS_ENSURE_SUCCESS(rv, rv);
2026 NS_ENSURE_SUCCESS(rv, rv);
2029 NS_ENSURE_SUCCESS(rv, rv);
2036 getter_AddRefs(event));
2037 NS_ENSURE_SUCCESS(rv, rv);
2040 NS_ENSURE_SUCCESS(rv, rv);
2042 else if(aViewPosition &&
2043 *aViewPosition >= 0 &&
2058 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
2071 nsresult rv =
mView->AddListener(
this, PR_FALSE);
2072 NS_ENSURE_SUCCESS(rv, rv);
2075 NS_ENSURE_SUCCESS(rv, rv);
2077 nsCOMPtr<sbILibrary> library = do_QueryInterface(
mViewList, &rv);
2090 NS_ENSURE_SUCCESS(rv, rv);
2093 nsCOMPtr<sbIMediaItem> item = do_QueryInterface(
mViewList, &rv);
2094 NS_ENSURE_SUCCESS(rv, rv);
2096 rv = item->GetLibrary(getter_AddRefs(library));
2097 NS_ENSURE_SUCCESS(rv, rv);
2099 nsCOMPtr<sbIMediaList> list = do_QueryInterface(library, &rv);
2100 NS_ENSURE_SUCCESS(rv, rv);
2102 rv = list->AddListener(
this,
2110 NS_ENSURE_SUCCESS(rv, rv);
2121 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
2134 nsresult rv = NS_ERROR_UNEXPECTED;
2138 NS_ENSURE_SUCCESS(rv, rv);
2142 NS_ENSURE_SUCCESS(rv, rv);
2149 NS_ENSURE_SUCCESS(rv, rv);
2151 rv =
mView->RemoveListener(
this);
2152 NS_ENSURE_SUCCESS(rv, rv);
2155 nsCOMPtr<sbIMediaItem> item = do_QueryInterface(
mViewList, &rv);
2156 NS_ENSURE_SUCCESS(rv, rv);
2158 nsCOMPtr<sbILibrary> library;
2159 rv = item->GetLibrary(getter_AddRefs(library));
2160 NS_ENSURE_SUCCESS(rv, rv);
2162 nsCOMPtr<sbIMediaList> list = do_QueryInterface(library, &rv);
2163 NS_ENSURE_SUCCESS(rv, rv);
2165 rv = list->RemoveListener(
this);
2166 NS_ENSURE_SUCCESS(rv, rv);
2185 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
2189 nsresult rv = NS_ERROR_UNEXPECTED;
2192 NS_ENSURE_SUCCESS(rv, rv);
2196 NS_ENSURE_SUCCESS(rv, rv);
2201 NS_ENSURE_SUCCESS(rv, rv);
2209 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
2210 NS_ENSURE_STATE(
mView);
2223 nsresult rv = NS_ERROR_UNEXPECTED;
2235 if(NS_SUCCEEDED(rv)) {
2238 NS_ENSURE_SUCCESS(rv, rv);
2263 NS_ENSURE_SUCCESS(rv, rv);
2267 NS_ENSURE_TRUE(variant, NS_ERROR_OUT_OF_MEMORY);
2269 nsCOMPtr<sbIMediacoreEvent>
event;
2274 getter_AddRefs(event));
2275 NS_ENSURE_SUCCESS(rv, rv);
2278 NS_ENSURE_SUCCESS(rv, rv);
2290 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
2291 NS_ENSURE_ARG_POINTER(aEvent);
2293 nsresult rv = NS_ERROR_UNEXPECTED;
2294 nsCOMPtr<sbIMediacoreEventTarget>
target =
2296 NS_ENSURE_SUCCESS(rv, rv);
2298 PRBool dispatched = PR_FALSE;
2299 rv = target->DispatchEvent(aEvent, aAsync, &dispatched);
2300 NS_ENSURE_SUCCESS(rv, rv);
2312 nsCOMPtr<nsIURI>
uri;
2314 NS_ENSURE_SUCCESS(rv, rv);
2315 nsCAutoString scheme;
2316 rv = uri->GetScheme(scheme);
2317 NS_ENSURE_SUCCESS(rv, rv);
2321 if (scheme.Equals(
"x-mtp"))
2324 nsCOMPtr<sbMediacoreError> error;
2326 NS_ENSURE_TRUE(error, NS_ERROR_OUT_OF_MEMORY);
2333 nsCOMPtr<sbIMediacoreEvent>
event;
2338 getter_AddRefs(event));
2339 NS_ENSURE_SUCCESS(rv, rv);
2342 nsCOMPtr<sbIMediacoreEventTarget>
target = do_QueryInterface(
mCore, &rv);
2343 NS_ENSURE_SUCCESS(rv, rv);
2345 rv = target->DispatchEvent(event, PR_TRUE, &dispatched);
2346 NS_ENSURE_SUCCESS(rv, rv);
2353 NS_ENSURE_SUCCESS(rv, rv);
2362 TRACE((
"%s: item(%p)", __FUNCTION__, aItem));
2363 NS_ENSURE_ARG_POINTER(aItem);
2369 if (NS_FAILED(rv) || !hasVideo) {
2377 nsCOMPtr<nsISupports> supports;
2378 nsIID *iid = nsnull;
2379 rv = aData->GetAsInterface(&iid, getter_AddRefs(supports));
2380 NS_ENSURE_SUCCESS(rv, rv);
2381 nsCOMPtr<nsIPropertyBag2> bag = do_QueryInterface(supports, &rv);
2382 NS_ENSURE_SUCCESS(rv, rv);
2383 rv = bag->GetPropertyAsUint64(NS_LITERAL_STRING(
"position"), &position);
2384 NS_ENSURE_SUCCESS(rv, rv);
2385 rv = bag->GetPropertyAsUint64(NS_LITERAL_STRING(
"duration"), &duration);
2386 NS_ENSURE_SUCCESS(rv, rv);
2387 nsCOMPtr<nsIURI> expectedURI;
2388 rv = bag->GetPropertyAsInterface(NS_LITERAL_STRING(
"uri"),
2390 getter_AddRefs(expectedURI));
2391 NS_ENSURE_SUCCESS(rv, rv);
2392 nsCString expectedSpec;
2393 nsString actualSpec;
2394 rv = expectedURI->GetSpec(expectedSpec);
2395 NS_ENSURE_SUCCESS(rv, rv);
2397 NS_ENSURE_SUCCESS(rv, rv);
2398 if (!expectedSpec.Equals(NS_ConvertUTF16toUTF8(actualSpec))) {
2407 NS_ENSURE_SUCCESS(rv, rv);
2409 NS_ENSURE_SUCCESS(rv, rv);
2412 TRACE((
"%s: position = %llu / %llu status %08x",
2413 __FUNCTION__, position, duration,
mStatus));
2417 nsString actualSpec;
2419 if (NS_FAILED(rv))
break;
2420 TRACE((
"%s[%p]: actual uri %s",
2422 NS_ConvertUTF16toUTF8(actualSpec).
get()));
2426 if (position == 0 || duration == 0) {
2435 const PRUint64 TIME_BEFORE_END = 10 * PR_MSEC_PER_SEC;
2438 if (position + TIME_BEFORE_END >= duration) {
2440 rv = aItem->SetProperty(PROPERTY_LAST_POSITION,
SBVoidString());
2441 NS_ENSURE_SUCCESS(rv, rv);
2445 rv = aItem->SetProperty(PROPERTY_LAST_POSITION, strPosition);
2446 NS_ENSURE_SUCCESS(rv, rv);
2457 sbMediacoreSequencer::GetMode(PRUint32 *aMode)
2459 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
2460 NS_ENSURE_ARG_POINTER(aMode);
2469 sbMediacoreSequencer::SetMode(PRUint32 aMode)
2471 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
2474 PRBool validMode = PR_FALSE;
2477 PRBool disableShuffle;
2479 NS_ENSURE_SUCCESS(rv, rv);
2480 if (disableShuffle) {
2481 return NS_ERROR_FAILURE;
2486 validMode = PR_TRUE;
2489 NS_ENSURE_TRUE(validMode, NS_ERROR_INVALID_ARG);
2493 if(
mMode != aMode) {
2498 NS_ENSURE_SUCCESS(rv, rv);
2501 NS_ENSURE_SUCCESS(rv, rv);
2508 sbMediacoreSequencer::GetRepeatMode(PRUint32 *aRepeatMode)
2510 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
2511 NS_ENSURE_ARG_POINTER(aRepeatMode);
2520 sbMediacoreSequencer::SetRepeatMode(PRUint32 aRepeatMode)
2522 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
2525 PRBool validMode = PR_FALSE;
2526 switch(aRepeatMode) {
2529 PRBool disableRepeat;
2531 NS_ENSURE_SUCCESS(rv, rv);
2532 if (disableRepeat) {
2533 return NS_ERROR_FAILURE;
2536 validMode = PR_TRUE;
2539 NS_ENSURE_TRUE(validMode, NS_ERROR_INVALID_ARG);
2545 NS_ENSURE_SUCCESS(rv, rv);
2553 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
2554 NS_ENSURE_ARG_POINTER(aView);
2557 NS_IF_ADDREF(*aView =
mView);
2565 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
2566 NS_ENSURE_ARG_POINTER(aView);
2572 sbMediacoreSequencer::GetViewPosition(PRUint32 *aViewPosition)
2574 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
2575 NS_ENSURE_ARG_POINTER(aViewPosition);
2581 return NS_ERROR_NOT_AVAILABLE;
2590 sbMediacoreSequencer::GetCurrentItem(
sbIMediaItem **aItem)
2592 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
2593 NS_ENSURE_ARG_POINTER(aItem);
2595 if (!NS_IsMainThread()) {
2599 nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
2600 nsCOMPtr<sbIMediacoreSequencer> proxiedSeq;
2604 NS_PROXY_SYNC | NS_PROXY_ALWAYS,
2605 getter_AddRefs(proxiedSeq));
2606 NS_ENSURE_SUCCESS(rv, rv);
2607 rv = proxiedSeq->GetCurrentItem(aItem);
2608 NS_ENSURE_SUCCESS(rv, rv);
2621 NS_ENSURE_SUCCESS(rv,
NS_OK);
2623 rv =
mView->GetItemByIndex(index, aItem);
2624 NS_ENSURE_SUCCESS(rv,
NS_OK);
2630 sbMediacoreSequencer::GetNextItem(
sbIMediaItem **aItem)
2632 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
2633 NS_ENSURE_ARG_POINTER(aItem);
2653 nsresult rv =
mView->GetItemByIndex(
mSequence[nextPosition], aItem);
2654 NS_ENSURE_SUCCESS(rv, rv);
2660 sbMediacoreSequencer::GetCurrentSequence(nsIArray * *aCurrentSequence)
2662 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
2663 NS_ENSURE_ARG_POINTER(aCurrentSequence);
2665 nsresult rv = NS_ERROR_UNEXPECTED;
2666 nsCOMPtr<nsIMutableArray>
array =
2667 do_CreateInstance(
"@songbirdnest.com/moz/xpcom/threadsafe-array;1", &rv);
2668 NS_ENSURE_SUCCESS(rv, rv);
2670 sequence_t::const_iterator it =
mSequence.begin();
2672 nsCOMPtr<nsISupportsPRUint32> index =
2673 do_CreateInstance(
"@mozilla.org/supports-PRUint32;1", &rv);
2674 NS_ENSURE_SUCCESS(rv, rv);
2676 rv = index->SetData((*it));
2677 NS_ENSURE_SUCCESS(rv, rv);
2679 rv = array->AppendElement(index, PR_FALSE);
2680 NS_ENSURE_SUCCESS(rv, rv);
2683 NS_ADDREF(*aCurrentSequence = array);
2689 sbMediacoreSequencer::GetSequencePosition(PRUint32 *aSequencePosition)
2691 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
2692 NS_ENSURE_ARG_POINTER(aSequencePosition);
2698 return NS_ERROR_NOT_AVAILABLE;
2707 sbMediacoreSequencer::SetSequencePosition(PRUint32 aSequencePosition)
2709 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
2710 return NS_ERROR_NOT_IMPLEMENTED;
2716 PRBool aNotFromUserAction)
2718 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
2719 NS_ENSURE_ARG_POINTER(aView);
2722 NS_ENSURE_SUCCESS(rv, rv);
2728 NS_ENSURE_SUCCESS(rv, rv);
2735 NS_ENSURE_SUCCESS(rv, rv);
2737 if (!aNotFromUserAction) {
2739 nsCOMPtr<sbIMediacoreEvent>
event;
2744 getter_AddRefs(event));
2745 NS_ENSURE_SUCCESS(rv, rv);
2748 NS_ENSURE_SUCCESS(rv, rv);
2755 sbMediacoreSequencer::PlayURL(nsIURI *aURI)
2757 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
2758 NS_ENSURE_ARG_POINTER(aURI);
2767 NS_ENSURE_SUCCESS(rv, rv);
2772 NS_ENSURE_SUCCESS(rv, rv);
2780 NS_WARNING(
"Someone aborted playback of the next track.");
2783 NS_ENSURE_SUCCESS(rv, rv);
2786 NS_ENSURE_SUCCESS(rv, rv);
2797 NS_ENSURE_SUCCESS(rv, rv);
2806 sbMediacoreSequencer::Play()
2808 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
2824 NS_ENSURE_SUCCESS(rv, rv);
2827 NS_ENSURE_SUCCESS(rv, rv);
2834 NS_WARNING(
"Someone aborted playback of the next track.");
2837 NS_ENSURE_SUCCESS(rv, rv);
2842 NS_ENSURE_SUCCESS(rv, rv);
2855 NS_ENSURE_SUCCESS(rv, rv);
2864 sbMediacoreSequencer::Stop(PRBool aNotFromUserAction) {
2865 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
2872 NS_ENSURE_SUCCESS(rv, rv);
2875 NS_ENSURE_SUCCESS(rv, rv);
2882 rv = playbackControl->Stop();
2883 NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"Couldn't stop core.");
2890 NS_ENSURE_SUCCESS(rv, rv);
2895 nsCOMPtr<sbIMediacoreEvent>
event;
2896 if (!aNotFromUserAction) {
2901 getter_AddRefs(event));
2902 NS_ENSURE_SUCCESS(rv, rv);
2905 NS_ENSURE_SUCCESS(rv, rv);
2912 getter_AddRefs(event));
2913 NS_ENSURE_SUCCESS(rv, rv);
2916 NS_ENSURE_SUCCESS(rv, rv);
2922 sbMediacoreSequencer::OnValidatePlaybackComplete(
sbIMediaItem *aItem,
2924 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
2926 nsresult rv = NS_ERROR_UNEXPECTED;
2940 NS_ENSURE_SUCCESS(rv, rv);
2944 nsCOMPtr<sbIMediacoreEvent>
event;
2950 getter_AddRefs(event));
2951 NS_ENSURE_SUCCESS(rv, rv);
2954 NS_ENSURE_SUCCESS(rv, rv);
2962 NS_ENSURE_SUCCESS(rv, rv);
2974 return Previous(PR_TRUE);
2975 return Next(PR_TRUE);
2988 PRInt32 aOnHoldStatus,
2991 NS_ENSURE_TRUE(NS_IsMainThread(), NS_ERROR_UNEXPECTED);
2992 NS_ENSURE_ARG_POINTER(_proceed);
2994 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
3003 nsCOMPtr<sbIMediaItem> mediaItem;
3005 getter_AddRefs(mediaItem));
3006 NS_ENSURE_SUCCESS(rv, rv);
3008 nsCOMPtr<sbIMediaItemController> mediaItemController;
3009 rv = mediaItem->GetItemController(getter_AddRefs(mediaItemController));
3010 NS_ENSURE_SUCCESS(rv, rv);
3012 if (mediaItemController) {
3021 rv = mediaItemController->ValidatePlayback(mediaItem,
3024 *_proceed = PR_FALSE;
3029 *_proceed = PR_TRUE;
3034 sbMediacoreSequencer::Next(PRBool aNotFromUserAction)
3036 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
3038 nsresult rv = NS_ERROR_UNEXPECTED;
3042 NS_ENSURE_SUCCESS(rv, rv);
3044 return NS_ERROR_FAILURE;
3054 PRBool hasNext = PR_FALSE;
3082 NS_ENSURE_SUCCESS(rv, rv);
3113 if (playbackControl) {
3114 rv = playbackControl->Stop();
3115 NS_ASSERTION(NS_SUCCEEDED(rv),
"Stop failed at end of sequence.");
3123 NS_ENSURE_SUCCESS(rv, rv);
3126 NS_ENSURE_SUCCESS(rv, rv);
3132 NS_ENSURE_SUCCESS(rv, rv);
3135 nsCOMPtr<sbIMediacoreEvent>
event;
3140 getter_AddRefs(event));
3141 NS_ENSURE_SUCCESS(rv, rv);
3144 NS_ENSURE_SUCCESS(rv, rv);
3151 NS_ENSURE_SUCCESS(rv, rv);
3160 !aNotFromUserAction) {
3161 nsCOMPtr<sbIMediacoreEvent>
event;
3167 getter_AddRefs(event));
3168 NS_ENSURE_SUCCESS(rv, rv);
3171 NS_ENSURE_SUCCESS(rv, rv);
3177 NS_ENSURE_SUCCESS(rv, rv);
3183 sbMediacoreSequencer::Previous(PRBool aNotFromUserAction)
3185 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
3187 nsresult rv = NS_ERROR_UNEXPECTED;
3189 PRBool disablePrevious;
3191 NS_ENSURE_SUCCESS(rv, rv);
3192 if (disablePrevious) {
3193 return NS_ERROR_FAILURE;
3203 PRBool hasNext = PR_FALSE;
3216 NS_ENSURE_SUCCESS(rv, rv);
3223 if(position - 1 < 0) {
3226 else if(position - 1 >= 0) {
3232 else if(position - 1 >= 0) {
3247 rv = playbackControl->Stop();
3248 NS_ASSERTION(NS_SUCCEEDED(rv),
"Stop failed at end of sequence.");
3255 NS_ENSURE_SUCCESS(rv, rv);
3258 NS_ENSURE_SUCCESS(rv, rv);
3264 NS_ENSURE_SUCCESS(rv, rv);
3267 nsCOMPtr<sbIMediacoreEvent>
event;
3272 getter_AddRefs(event));
3273 NS_ENSURE_SUCCESS(rv, rv);
3276 NS_ENSURE_SUCCESS(rv, rv);
3283 NS_ENSURE_SUCCESS(rv, rv);
3292 !aNotFromUserAction) {
3293 nsCOMPtr<sbIMediacoreEvent>
event;
3299 getter_AddRefs(event));
3300 NS_ENSURE_SUCCESS(rv, rv);
3303 NS_ENSURE_SUCCESS(rv, rv);
3309 NS_ENSURE_SUCCESS(rv, rv);
3315 sbMediacoreSequencer::RequestHandleNextItem(
sbIMediacore *aMediacore)
3331 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
3332 NS_ENSURE_ARG_POINTER(aMediacore);
3334 nsresult rv = NS_ERROR_UNEXPECTED;
3338 return NS_ERROR_NOT_AVAILABLE;
3342 nsCOMPtr<sbIMediaItem> item;
3343 rv = GetNextItem(getter_AddRefs(item));
3344 NS_ENSURE_SUCCESS(rv, rv);
3346 nsCOMPtr<nsIURI>
uri;
3347 rv = item->GetContentSrc(getter_AddRefs(uri));
3348 NS_ENSURE_SUCCESS(rv, rv);
3351 NS_ENSURE_TRUE(
mCore == aMediacore, NS_ERROR_INVALID_ARG);
3353 nsCOMPtr<sbIMediacoreVoting> voting =
3355 NS_ENSURE_SUCCESS(rv, rv);
3357 NS_ENSURE_TRUE(voting, NS_ERROR_UNEXPECTED);
3361 nsCOMPtr<sbIMediacoreVotingChain> votingChain;
3362 rv = voting->VoteWithURI(uri, getter_AddRefs(votingChain));
3363 NS_ENSURE_SUCCESS(rv, rv);
3365 PRBool validChain = PR_FALSE;
3366 rv = votingChain->GetValid(&validChain);
3367 NS_ENSURE_SUCCESS(rv, rv);
3369 NS_ENSURE_TRUE(validChain, NS_ERROR_UNEXPECTED);
3371 nsCOMPtr<nsIArray> chain;
3372 rv = votingChain->GetMediacoreChain(getter_AddRefs(chain));
3373 NS_ENSURE_SUCCESS(rv, rv);
3375 nsCOMPtr<sbIMediacore> core = do_QueryElementAt(chain, 0, &rv);
3376 NS_ENSURE_SUCCESS(rv, rv);
3380 NS_ENSURE_TRUE(core ==
mCore, NS_ERROR_INVALID_ARG);
3387 sbMediacoreSequencer::Abort()
3389 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
3402 sbMediacoreSequencer::GetCustomGenerator(
3405 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
3406 NS_ENSURE_ARG_POINTER(aCustomGenerator);
3415 sbMediacoreSequencer::SetCustomGenerator(
3418 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
3419 NS_ENSURE_ARG_POINTER(aCustomGenerator);
3429 NS_ENSURE_SUCCESS(rv, rv);
3444 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
3445 NS_ENSURE_ARG_POINTER(aEvent);
3447 nsCOMPtr<sbIMediacore> core;
3448 nsresult rv = aEvent->GetOrigin(getter_AddRefs(core));
3449 NS_ENSURE_SUCCESS(rv, rv);
3451 PRUint32 eventType = 0;
3452 rv = aEvent->GetType(&eventType);
3453 NS_ENSURE_SUCCESS(rv, rv);
3457 rv = core->GetInstanceName(coreName);
3458 NS_ENSURE_SUCCESS(rv, rv);
3460 LOG((
"[sbMediacoreSequencer] - Event from core '%s', type %08x",
3461 NS_ConvertUTF16toUTF8(coreName).BeginReading(), eventType));
3471 nsCOMPtr<sbIMediacoreEventTarget>
target =
3473 NS_ENSURE_SUCCESS(rv, rv);
3476 rv = target->DispatchEvent(aEvent, PR_TRUE, &dispatched);
3477 NS_ENSURE_SUCCESS(rv, rv);
3494 LOG((
"[sbMediacoreSequencer] - Was waiting for playback, playback now started."));
3503 nsresult rv = Next(PR_TRUE);
3504 NS_ENSURE_SUCCESS(rv, rv);
3510 NS_ENSURE_SUCCESS(rv, rv);
3513 NS_ENSURE_SUCCESS(rv, rv);
3519 NS_ENSURE_SUCCESS(rv, rv);
3525 NS_NAMED_LITERAL_STRING(PROPERTY_LAST_POSITION,
3527 nsString lastPositionStr;
3528 rv =
mCurrentItem->GetProperty(PROPERTY_LAST_POSITION, lastPositionStr);
3529 NS_ENSURE_SUCCESS(rv, rv);
3531 NS_ENSURE_SUCCESS(rv, rv);
3533 if (lastPosition > 0) {
3534 TRACE((
"%s[%p] - seeking to %llu (%s)",
3535 __FUNCTION__,
this, lastPosition,
3536 NS_LossyConvertUTF16toASCII(lastPositionStr).
get()));
3537 nsRefPtr<sbRunnableMethod1<sbMediacoreSequencer, nsresult, PRUint64> > runnable;
3539 ::New(getter_AddRefs(runnable),
3544 NS_ENSURE_SUCCESS(rv, rv);
3545 rv = NS_DispatchToCurrentThread(runnable);
3546 NS_ENSURE_SUCCESS(rv, rv);
3561 NS_ENSURE_SUCCESS(rv, rv);
3564 NS_ENSURE_SUCCESS(rv, rv);
3570 NS_ENSURE_SUCCESS(rv, rv);
3589 LOG((
"[sbMediacoreSequencer] - Was playing, stream ended, attempting to go to next track in sequence."));
3596 nsCOMPtr<nsIVariant>
data;
3597 rv = aEvent->GetData(getter_AddRefs(data));
3598 NS_ENSURE_SUCCESS(rv, rv);
3599 NS_ENSURE_STATE(data);
3601 NS_ENSURE_SUCCESS(rv, rv);
3609 LOG((
"[sbMediacoreSequencer] - Hard stop requested."));
3616 NS_ENSURE_SUCCESS(rv, rv);
3619 NS_ENSURE_SUCCESS(rv, rv);
3622 NS_ENSURE_SUCCESS(rv, rv);
3625 NS_ENSURE_SUCCESS(rv, rv);
3633 NS_ENSURE_SUCCESS(rv, rv);
3647 NS_ENSURE_SUCCESS(rv, rv);
3652 PRBool buffering = PR_FALSE;
3655 NS_ENSURE_SUCCESS(rv, rv);
3659 NS_ENSURE_SUCCESS(rv, rv);
3666 NS_ENSURE_SUCCESS(rv, rv);
3678 NS_ENSURE_SUCCESS(rv, rv);
3689 NS_ENSURE_SUCCESS(rv, rv);
3695 NS_ENSURE_SUCCESS(rv, rv);
3701 NS_ENSURE_SUCCESS(rv, rv);
3714 TRACE((
"%s[%p](%llu)", __FUNCTION__,
this, aPosition));
3720 TRACE((
"%s[%p] - url is %s", __FUNCTION__,
this,
3721 NS_SUCCEEDED(rv) ? NS_LossyConvertUTF16toASCII(url).
get()
3727 NS_ENSURE_SUCCESS(rv, rv);
3735 sbMediacoreSequencer::GetState(PRUint32 *
aState)
3737 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
3749 sbMediacoreSequencer::OnItemAdded(
sbIMediaList *aMediaList,
3754 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
3755 NS_ENSURE_ARG_POINTER(aMediaList);
3781 NS_ENSURE_SUCCESS(rv, rv);
3788 sbMediacoreSequencer::OnBeforeItemRemoved(
sbIMediaList *aMediaList,
3798 sbMediacoreSequencer::OnAfterItemRemoved(
sbIMediaList *aMediaList,
3803 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
3804 NS_ENSURE_ARG_POINTER(aMediaList);
3808 PRBool listEvent = (aMediaList ==
mViewList);
3810 nsresult rv = NS_ERROR_UNEXPECTED;
3811 nsCOMPtr<sbILibrary> library = do_QueryInterface(aMediaList, &rv);
3813 PRBool libraryEvent = PR_FALSE;
3815 libraryEvent = PR_TRUE;
3823 nsCOMPtr<sbIMediaItem> item = do_QueryInterface(
mViewList, &rv);
3824 NS_ENSURE_SUCCESS(rv, rv);
3826 if (aMediaItem != item) {
3827 *_retval = PR_FALSE;
3836 rv = playbackControl->Stop();
3837 NS_ENSURE_SUCCESS(rv, rv);
3845 NS_ENSURE_SUCCESS(rv, rv);
3848 NS_ENSURE_SUCCESS(rv, rv);
3851 NS_ENSURE_SUCCESS(rv, rv);
3855 *_retval = PR_FALSE;
3874 NS_ENSURE_SUCCESS(rv, rv);
3876 *_retval = PR_FALSE;
3882 sbMediacoreSequencer::OnItemUpdated(
sbIMediaList *aMediaList,
3887 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
3888 NS_ENSURE_ARG_POINTER(aMediaList);
3892 nsCOMPtr<sbIMediaItem> item;
3893 nsresult rv = GetCurrentItem(getter_AddRefs(item));
3894 NS_ENSURE_SUCCESS(rv, rv);
3896 if(aMediaItem == item) {
3898 NS_ENSURE_SUCCESS(rv, rv);
3920 NS_ENSURE_SUCCESS(rv, rv);
3931 sbMediacoreSequencer::OnItemMoved(
sbIMediaList *aMediaList,
3932 PRUint32 aFromIndex,
3936 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
3937 NS_ENSURE_ARG_POINTER(aMediaList);
3953 NS_ENSURE_SUCCESS(rv, rv);
3960 sbMediacoreSequencer::OnBeforeListCleared(
sbIMediaList* aMediaList,
3961 PRBool aExcludeLists,
3962 PRBool* aNoMoreForBatch)
3964 NS_ENSURE_ARG_POINTER(aMediaList);
3965 NS_ENSURE_ARG_POINTER(aNoMoreForBatch);
3968 *aNoMoreForBatch = PR_TRUE;
3973 sbMediacoreSequencer::OnListCleared(
sbIMediaList *aMediaList,
3974 PRBool aExcludeLists,
3977 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
3978 NS_ENSURE_ARG_POINTER(aMediaList);
3986 NS_ENSURE_SUCCESS(rv, rv);
3997 *_retval = PR_FALSE;
4003 sbMediacoreSequencer::OnBatchBegin(
sbIMediaList *aMediaList)
4005 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
4006 NS_ENSURE_ARG_POINTER(aMediaList);
4021 sbMediacoreSequencer::OnBatchEnd(
sbIMediaList *aMediaList)
4023 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
4024 NS_ENSURE_ARG_POINTER(aMediaList);
4026 nsresult rv = NS_ERROR_UNEXPECTED;
4045 NS_ENSURE_SUCCESS(rv, rv);
4049 NS_ENSURE_SUCCESS(rv, rv);
4063 PRUint32 propertyCount = 0;
4064 nsresult rv = aProperties->GetLength(&propertyCount);
4065 NS_ENSURE_SUCCESS(rv, rv);
4069 do_GetService(
"@songbirdnest.com/Songbird/Properties/PropertyManager;1", &rv);
4070 NS_ENSURE_SUCCESS(rv, rv);
4073 nsCOMPtr<sbICascadeFilterSet> cfs;
4074 PRUint16 filterCount = 0;
4075 nsCOMPtr<sbILibraryConstraint> constraint;
4076 PRUint32 constraintGroupCount = 0;
4078 nsCOMPtr<sbIFilterableMediaListView>
4079 filterableView = do_QueryInterface(
mView);
4080 if (filterableView) {
4081 rv = filterableView->GetFilterConstraint(getter_AddRefs(constraint));
4082 NS_ENSURE_SUCCESS(rv, rv);
4084 rv = constraint->GetGroupCount(&constraintGroupCount);
4085 NS_ENSURE_SUCCESS(rv, rv);
4089 rv =
mView->GetCascadeFilterSet(getter_AddRefs(cfs));
4090 NS_ENSURE_SUCCESS(rv, rv);
4091 rv = cfs->GetLength(&filterCount);
4092 NS_ENSURE_SUCCESS(rv, rv);
4095 nsCOMPtr<sbISortableMediaListView> sortableView;
4096 sortableView = do_QueryInterface(
mView, &rv);
4097 NS_ENSURE_SUCCESS(rv, rv);
4099 nsCOMPtr<sbIPropertyArray> primarySortArray;
4100 rv = sortableView->GetCurrentSort(getter_AddRefs(primarySortArray));
4101 NS_ENSURE_SUCCESS(rv, rv);
4103 PRUint32 primarySortCount = 0;
4104 rv = primarySortArray->GetLength(&primarySortCount);
4105 NS_ENSURE_SUCCESS(rv, rv);
4107 nsCOMPtr<sbIProperty> property;
4108 for(PRUint32 propIndex = 0; propIndex < propertyCount; ++propIndex) {
4109 rv = aProperties->GetPropertyAt(propIndex, getter_AddRefs(property));
4110 NS_ENSURE_SUCCESS(rv, rv);
4113 rv =
property->GetId(
id);
4114 NS_ENSURE_SUCCESS(rv, rv);
4118 for (PRUint32 groupIndex = 0;
4119 groupIndex < constraintGroupCount;
4121 nsCOMPtr<sbILibraryConstraintGroup>
group;
4122 rv = constraint->GetGroup(groupIndex, getter_AddRefs(group));
4123 NS_ENSURE_SUCCESS(rv, rv);
4126 rv = group->HasProperty(
id, &hasProperty);
4127 NS_ENSURE_SUCCESS(rv, rv);
4136 for (PRUint16 filterIndex = 0; filterIndex < filterCount; ++filterIndex) {
4138 rv = cfs->GetProperty(filterIndex, filter);
4139 NS_ENSURE_SUCCESS(rv, rv);
4141 if (
id.Equals(filter)) {
4149 nsCOMPtr<sbIProperty> sortProperty;
4150 for (PRUint32 sortIndex = 0; sortIndex < primarySortCount; ++sortIndex) {
4151 rv = primarySortArray->GetPropertyAt(sortIndex, getter_AddRefs(sortProperty));
4152 NS_ENSURE_SUCCESS(rv, rv);
4155 rv = sortProperty->GetId(SortId);
4156 NS_ENSURE_SUCCESS(rv, rv);
4158 if (
id.Equals(SortId)) {
4165 nsCOMPtr<sbIPropertyInfo> propertyInfo;
4167 NS_ENSURE_SUCCESS(rv, rv);
4169 nsCOMPtr<sbIPropertyArray> secondarySortArray;
4170 rv = propertyInfo->GetSecondarySort(getter_AddRefs(secondarySortArray));
4171 NS_ENSURE_SUCCESS(rv, rv);
4173 if (!secondarySortArray) {
4178 PRUint32 secondarySortCount = 0;
4179 rv = secondarySortArray->GetLength(&secondarySortCount);
4180 NS_ENSURE_SUCCESS(rv, rv);
4182 for (PRUint32 sortIndex = 0; sortIndex < secondarySortCount; ++sortIndex) {
4183 rv = secondarySortArray->GetPropertyAt(sortIndex, getter_AddRefs(sortProperty));
4184 NS_ENSURE_SUCCESS(rv, rv);
4187 rv = sortProperty->GetId(SortId);
4188 NS_ENSURE_SUCCESS(rv, rv);
4190 if (
id.Equals(SortId)) {
4209 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
4217 NS_ENSURE_SUCCESS(rv, rv);
4225 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
4233 NS_ENSURE_SUCCESS(rv, rv);
4241 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
4248 NS_ENSURE_SUCCESS(rv, rv);
4259 sbMediacoreSequencer::Notify(nsITimer *timer)
4261 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
4262 NS_ENSURE_ARG_POINTER(timer);
4264 nsresult rv = NS_ERROR_UNEXPECTED;
4269 NS_ENSURE_SUCCESS(rv, rv);
4273 NS_ENSURE_SUCCESS(rv, rv);
4282 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
4283 NS_ENSURE_ARG_POINTER(aTimer);
4285 nsresult rv = NS_ERROR_UNEXPECTED;
4286 PRUint64 position = 0;
4292 if(NS_SUCCEEDED(rv)) {
4294 NS_ENSURE_SUCCESS(rv, rv);
4304 if(NS_SUCCEEDED(rv)) {
4306 NS_ENSURE_SUCCESS(rv, rv);
4311 if((position > 0) && position > ((duration * 5) / 100)) {
4316 NS_ENSURE_SUCCESS(rv, rv);
4327 NS_ENSURE_TRUE(
mMonitor, NS_ERROR_NOT_INITIALIZED);
4333 PRUint32 viewLength = 0;
4334 nsresult rv =
mView->GetLength(&viewLength);
4335 NS_ENSURE_SUCCESS(rv, rv);
4342 NS_ENSURE_SUCCESS(rv, rv);
PRUint64 nsString_ToUint64(const nsAString &str, nsresult *rv)
const NS_PREFSERVICE_CONTRACTID
nsresult do_GetProxyForObject(nsIEventTarget *aTarget, REFNSIID aIID, nsISupports *aObj, PRInt32 aProxyType, void **aProxyObject)
#define SB_PROPERTY_LASTPLAYPOSITION
Songbird Variant Utility Definitions.
NS_IMPL_THREADSAFE_RELEASE(sbRequestItem)
NS_IMPL_THREADSAFE_ADDREF(sbRequestItem)
#define SB_PROPERTY_GENRE
#define SB_PROPERTY_DURATION
Songbird Thread Utilities Definitions.
#define SB_PROPERTY_ARTISTNAME
static nsresult New(SelfType **aRunnable, ClassType *aObject, MethodType aMethod, ReturnType aFailureReturnValue, Arg1Type aArg1Value)
Songbird String Bundle Definitions.
#define SB_PROPERTY_ALBUMNAME
function toggle(toShow, toHide, data, clickedActive, down)
#define SB_PROPERTY_TRACKNAME
NS_IMPL_CI_INTERFACE_GETTER2(sbDataRemoteWrapper, sbIDataRemote, nsIClassInfo) sbDataRemoteWrapper
#define SB_PROPERTY_CONTENTURL
An interface to carry around arrays of nsIProperty instances. Users of this interface should only QI ...
_getSelectedPageStyle s i
#define SB_PROPERTY_PRIMARYIMAGEURL
Array filter(tab.attributes, function(aAttr){return(_this.xulAttributes.indexOf(aAttr.name) >-1);}).forEach(tab.removeAttribute
_updateTextAndScrollDataForFrame aData