mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 07:15:46 +00:00
cocoa nsSound impl. bug 357307. r=vlad
This commit is contained in:
parent
8312ec86cd
commit
50242832e6
@ -21,6 +21,7 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <stuart@mozilla.com>
|
||||
* Vladimir Vukicevic <vladimir@pobox.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
@ -48,12 +49,12 @@ class nsSound : public nsISound,
|
||||
|
||||
{
|
||||
public:
|
||||
nsSound();
|
||||
virtual ~nsSound();
|
||||
nsSound();
|
||||
virtual ~nsSound();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISOUND
|
||||
NS_DECL_NSISTREAMLOADEROBSERVER
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISOUND
|
||||
NS_DECL_NSISTREAMLOADEROBSERVER
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -21,6 +21,7 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <stuart@mozilla.com>
|
||||
* Vladimir Vukicevic <vladimir@pobox.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
@ -39,6 +40,13 @@
|
||||
|
||||
#include "nsSound.h"
|
||||
|
||||
#include <Foundation/NSData.h>
|
||||
#include <AppKit/NSSound.h>
|
||||
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIURL.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsSound, nsISound)
|
||||
|
||||
nsSound::nsSound()
|
||||
@ -62,13 +70,23 @@ nsSound::OnStreamComplete(nsIStreamLoader *aLoader,
|
||||
PRUint32 dataLen,
|
||||
const PRUint8 *data)
|
||||
{
|
||||
NSData *value = [NSData dataWithBytes:data length:dataLen];
|
||||
|
||||
NSSound *sound = [[NSSound alloc] initWithData:value];
|
||||
|
||||
[sound play];
|
||||
|
||||
[sound autorelease];
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSound::Play(nsIURL *aURL)
|
||||
{
|
||||
return NS_OK;
|
||||
nsCOMPtr<nsIURI> uri(do_QueryInterface(aURL));
|
||||
nsCOMPtr<nsIStreamLoader> loader;
|
||||
return NS_NewStreamLoader(getter_AddRefs(loader), uri, this);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
Loading…
Reference in New Issue
Block a user