[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

crogers at google.com crogers at google.com
Wed Dec 22 16:03:53 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit cffbad0bbd5db61f9553fca54f5fc45ff1328589
Author: crogers at google.com <crogers at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Nov 18 11:47:16 2010 +0000

    2010-11-18  Chris Rogers  <crogers at google.com>
    
            Reviewed by Dimitri Glazkov.
    
            Add loadPlatformAudioResource() and decodeAudioFileData() to ChromiumBridge
            https://bugs.webkit.org/show_bug.cgi?id=49557
    
            No new tests since audio API is not yet implemented.
    
            * platform/chromium/ChromiumBridge.h:
    2010-11-18  Chris Rogers  <crogers at google.com>
    
            Reviewed by Dimitri Glazkov.
    
            Add loadPlatformAudioResource() and decodeAudioFileData() to ChromiumBridge
            https://bugs.webkit.org/show_bug.cgi?id=49557
    
            * WebKit.gyp:
            * public/WebAudioBus.h: Added.
            (WebKit::WebAudioBus::WebAudioBus):
            * public/WebKitClient.h:
            (WebKit::WebKitClient::decodeAudioFileData):
            * src/ChromiumBridge.cpp:
            (WebCore::ChromiumBridge::loadPlatformAudioResource):
            (WebCore::ChromiumBridge::decodeAudioFileData):
            * src/WebAudioBus.cpp: Added.
            (WebKit::WebAudioBus::~WebAudioBus):
            (WebKit::WebAudioBus::initialize):
            (WebKit::WebAudioBus::numberOfChannels):
            (WebKit::WebAudioBus::length):
            (WebKit::WebAudioBus::sampleRate):
            (WebKit::WebAudioBus::channelData):
            (WebKit::WebAudioBus::release):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72281 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 48756e8..6c077b3 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,14 @@
+2010-11-18  Chris Rogers  <crogers at google.com>
+
+        Reviewed by Dimitri Glazkov.
+
+        Add loadPlatformAudioResource() and decodeAudioFileData() to ChromiumBridge
+        https://bugs.webkit.org/show_bug.cgi?id=49557
+
+        No new tests since audio API is not yet implemented.
+
+        * platform/chromium/ChromiumBridge.h:
+
 2010-11-17  Sheriff Bot  <webkit.review.bot at gmail.com>
 
         Unreviewed, rolling out r72228.
diff --git a/WebCore/platform/chromium/ChromiumBridge.h b/WebCore/platform/chromium/ChromiumBridge.h
index fff7f69..8ca6434 100644
--- a/WebCore/platform/chromium/ChromiumBridge.h
+++ b/WebCore/platform/chromium/ChromiumBridge.h
@@ -31,6 +31,10 @@
 #ifndef ChromiumBridge_h
 #define ChromiumBridge_h
 
+#if ENABLE(WEB_AUDIO)
+#include "AudioBus.h"
+#endif
+
 #include "FileSystem.h"
 #include "ImageSource.h"
 #include "LinkHash.h"
@@ -212,6 +216,11 @@ namespace WebCore {
         // Resources ----------------------------------------------------------
         static PassRefPtr<Image> loadPlatformImageResource(const char* name);
 
+#if ENABLE(WEB_AUDIO)
+        static PassOwnPtr<AudioBus> loadPlatformAudioResource(const char* name, double sampleRate);
+        static PassOwnPtr<AudioBus> decodeAudioFileData(const char* data, size_t size, double sampleRate);
+#endif
+
         // Sandbox ------------------------------------------------------------
         static bool sandboxEnabled();
 
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 2e3ce8e..088725b 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,27 @@
+2010-11-18  Chris Rogers  <crogers at google.com>
+
+        Reviewed by Dimitri Glazkov.
+
+        Add loadPlatformAudioResource() and decodeAudioFileData() to ChromiumBridge
+        https://bugs.webkit.org/show_bug.cgi?id=49557
+
+        * WebKit.gyp:
+        * public/WebAudioBus.h: Added.
+        (WebKit::WebAudioBus::WebAudioBus):
+        * public/WebKitClient.h:
+        (WebKit::WebKitClient::decodeAudioFileData):
+        * src/ChromiumBridge.cpp:
+        (WebCore::ChromiumBridge::loadPlatformAudioResource):
+        (WebCore::ChromiumBridge::decodeAudioFileData):
+        * src/WebAudioBus.cpp: Added.
+        (WebKit::WebAudioBus::~WebAudioBus):
+        (WebKit::WebAudioBus::initialize):
+        (WebKit::WebAudioBus::numberOfChannels):
+        (WebKit::WebAudioBus::length):
+        (WebKit::WebAudioBus::sampleRate):
+        (WebKit::WebAudioBus::channelData):
+        (WebKit::WebAudioBus::release):
+
 2010-11-17  Sheriff Bot  <webkit.review.bot at gmail.com>
 
         Unreviewed, rolling out r72228.
diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp
index a95b88f..71cac22 100644
--- a/WebKit/chromium/WebKit.gyp
+++ b/WebKit/chromium/WebKit.gyp
@@ -109,6 +109,7 @@
                 'public/WebApplicationCacheHost.h',
                 'public/WebApplicationCacheHostClient.h',
                 'public/WebAttribute.h',
+                'public/WebAudioBus.h',
                 'public/WebBindings.h',
                 'public/WebBlobData.h',
                 'public/WebBlobRegistry.h',
@@ -394,6 +395,7 @@
                 'src/WebAnimationControllerImpl.cpp',
                 'src/WebAnimationControllerImpl.h',
                 'src/WebAttribute.cpp',
+                'src/WebAudioBus.cpp',
                 'src/WebBindings.cpp',
                 'src/WebBlobData.cpp',
                 'src/WebCache.cpp',
diff --git a/WebKit/chromium/public/WebAudioBus.h b/WebKit/chromium/public/WebAudioBus.h
new file mode 100644
index 0000000..94ef74d
--- /dev/null
+++ b/WebKit/chromium/public/WebAudioBus.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2010, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebAudioBus_h
+#define WebAudioBus_h
+
+#include "WebCommon.h"
+
+#if WEBKIT_IMPLEMENTATION
+namespace WebCore { class AudioBus; }
+namespace WTF { template <typename T> class PassOwnPtr; }
+#endif
+
+namespace WebKit {
+
+class WebAudioBusPrivate;
+
+// A container for multi-channel linear PCM audio data.
+//
+// WARNING: It is not safe to pass a WebAudioBus across threads!!!
+//
+class WebAudioBus {
+public:
+    WebAudioBus() : m_private(0) { }
+    ~WebAudioBus();
+    
+    // initialize() allocates memory of the given length for the given number of channels.
+    void initialize(unsigned numberOfChannels, size_t length, double sampleRate);
+
+    WEBKIT_API unsigned numberOfChannels() const;
+    WEBKIT_API size_t length() const;
+    WEBKIT_API double sampleRate() const;
+    
+    WEBKIT_API float* channelData(unsigned channelIndex);
+
+#if WEBKIT_IMPLEMENTATION
+    WTF::PassOwnPtr<WebCore::AudioBus> release();    
+#endif
+
+private:
+    // Noncopyable
+    WebAudioBus(const WebAudioBus& d) : m_private(0) { }
+    WebAudioBusPrivate* m_private;
+};
+
+} // namespace WebKit
+
+#endif // WebAudioBus_h
diff --git a/WebKit/chromium/public/WebKitClient.h b/WebKit/chromium/public/WebKitClient.h
index 7ced7ad..8832add 100644
--- a/WebKit/chromium/public/WebKitClient.h
+++ b/WebKit/chromium/public/WebKitClient.h
@@ -31,6 +31,7 @@
 #ifndef WebKitClient_h
 #define WebKitClient_h
 
+#include "WebAudioBus.h"
 #include "WebCommon.h"
 #include "WebData.h"
 #include "WebLocalizedString.h"
@@ -220,6 +221,11 @@ public:
     // Returns a blob of data corresponding to the named resource.
     virtual WebData loadResource(const char* name) { return WebData(); }
 
+    // Decodes the in-memory audio file data and returns the linear PCM audio data in the destinationBus.
+    // A sample-rate conversion to sampleRate will occur if the file data is at a different sample-rate.
+    // Returns true on success.
+    virtual bool decodeAudioFileData(WebAudioBus* destinationBus, const char* audioFileData, size_t dataSize, double sampleRate) { return false; }
+
     // Returns a localized string resource (with an optional numeric
     // parameter value).
     virtual WebString queryLocalizedString(WebLocalizedString::Name) { return WebString(); }
diff --git a/WebKit/chromium/src/ChromiumBridge.cpp b/WebKit/chromium/src/ChromiumBridge.cpp
index 074c982..4ac3f6f 100644
--- a/WebKit/chromium/src/ChromiumBridge.cpp
+++ b/WebKit/chromium/src/ChromiumBridge.cpp
@@ -35,6 +35,7 @@
 
 #include "Chrome.h"
 #include "ChromeClientImpl.h"
+#include "WebAudioBus.h"
 #include "WebClipboard.h"
 #include "WebCookie.h"
 #include "WebCookieJar.h"
@@ -621,6 +622,27 @@ PassRefPtr<Image> ChromiumBridge::loadPlatformImageResource(const char* name)
     return image;
 }
 
+#if ENABLE(WEB_AUDIO)
+
+PassOwnPtr<AudioBus> ChromiumBridge::loadPlatformAudioResource(const char* name, double sampleRate)
+{
+    const WebData& resource = webKitClient()->loadResource(name);
+    if (resource.isEmpty())
+        return 0;
+    
+    return decodeAudioFileData(resource.data(), resource.size(), sampleRate);
+}
+
+PassOwnPtr<AudioBus> ChromiumBridge::decodeAudioFileData(const char* data, size_t size, double sampleRate)
+{
+    WebAudioBus webAudioBus;
+    if (webKitClient()->decodeAudioFileData(&webAudioBus, data, size, sampleRate))
+        return webAudioBus.release();
+    return 0;
+}
+
+#endif // ENABLE(WEB_AUDIO)
+
 // Sandbox --------------------------------------------------------------------
 
 bool ChromiumBridge::sandboxEnabled()
diff --git a/WebKit/chromium/src/WebAudioBus.cpp b/WebKit/chromium/src/WebAudioBus.cpp
new file mode 100644
index 0000000..ceccafc
--- /dev/null
+++ b/WebKit/chromium/src/WebAudioBus.cpp
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2010, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebAudioBus.h"
+
+#if ENABLE(WEB_AUDIO)
+#include "AudioBus.h"
+#else
+namespace WebCore {
+class AudioBus {
+};
+} // namespace WebCore
+#endif
+
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+class WebAudioBusPrivate : public AudioBus {
+};
+
+WebAudioBus::~WebAudioBus()
+{
+#if ENABLE(WEB_AUDIO)
+    delete m_private;
+    m_private = 0;
+#endif
+}
+
+void WebAudioBus::initialize(unsigned numberOfChannels, size_t length, double sampleRate)
+{        
+#if ENABLE(WEB_AUDIO)
+    AudioBus* audioBus = new AudioBus(numberOfChannels, length);
+    audioBus->setSampleRate(sampleRate);
+
+    if (m_private)
+        delete m_private;
+    m_private = static_cast<WebAudioBusPrivate*>(audioBus);
+#else
+    ASSERT_NOT_REACHED();
+#endif
+}
+
+unsigned WebAudioBus::numberOfChannels() const
+{
+#if ENABLE(WEB_AUDIO)
+    if (!m_private)
+        return 0;
+    return m_private->numberOfChannels();
+#else
+    ASSERT_NOT_REACHED();
+    return 0;
+#endif
+}
+
+size_t WebAudioBus::length() const
+{
+#if ENABLE(WEB_AUDIO)
+    if (!m_private)
+        return 0;
+    return m_private->length();
+#else
+    ASSERT_NOT_REACHED();
+    return 0;
+#endif
+}
+
+double WebAudioBus::sampleRate() const
+{
+#if ENABLE(WEB_AUDIO)
+    if (!m_private)
+        return 0;
+    return m_private->sampleRate();
+#else
+    ASSERT_NOT_REACHED();
+    return 0;
+#endif
+}
+
+float* WebAudioBus::channelData(unsigned channelIndex)
+{
+#if ENABLE(WEB_AUDIO)
+    if (!m_private)
+        return 0;
+    ASSERT(channelIndex < numberOfChannels());
+    return m_private->channel(channelIndex)->data();
+#else
+    ASSERT_NOT_REACHED();
+    return 0;
+#endif
+}
+
+PassOwnPtr<AudioBus> WebAudioBus::release()
+{
+#if ENABLE(WEB_AUDIO)
+    OwnPtr<AudioBus> audioBus(adoptPtr(static_cast<AudioBus*>(m_private)));
+    m_private = 0;
+    return audioBus.release();
+#else
+    ASSERT_NOT_REACHED();
+    return 0;
+#endif
+}
+
+} // namespace WebKit

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list