Fix bug 36112 -- check for QuickTime being installed before using it.

This commit is contained in:
sfraser%netscape.com 2000-05-02 00:30:35 +00:00
Родитель f32e1a9481
Коммит e669f27041
2 изменённых файлов: 15 добавлений и 2 удалений

Просмотреть файл

@ -30,6 +30,8 @@
#include "nsNetUtil.h"
#include "prmem.h"
#include <Gestalt.h>
#include <Sound.h>
#include <QuickTimeComponents.h>
NS_IMPL_ISUPPORTS(nsSound, NS_GET_IID(nsISound));
@ -76,6 +78,10 @@ NS_METHOD nsSound::Beep()
// this currently does no cacheing of the sound buffer. It should
NS_METHOD nsSound::Play(nsIURI *aURI)
{
// if quicktime is not installed, we can't do anything
if (!HaveQuickTime())
return NS_ERROR_NOT_IMPLEMENTED;
#if !TARGET_CARBON
nsresult rv;
nsCOMPtr<nsIInputStream> inputStream;
@ -201,3 +207,11 @@ bail: // gasp, a goto label
return NS_OK;
#endif
}
PRBool nsSound::HaveQuickTime()
{
long gestResult;
OSErr err = Gestalt (gestaltQuickTime, &gestResult);
return (err == noErr) && ((long)EnterMovies != kUnresolvedCFragSymbolAddress);
}

Просмотреть файл

@ -25,8 +25,6 @@
#include "nsISound.h"
#include <Sound.h>
class nsSound : public nsISound
{
public:
@ -41,6 +39,7 @@ public:
protected:
nsresult PlaySound(Handle waveDataHandle, long waveDataSize);
PRBool HaveQuickTime();
};