Title: [159971] trunk/Source/Platform
Revision
159971
Author
commit-qu...@webkit.org
Date
2013-12-02 14:59:05 -0800 (Mon, 02 Dec 2013)

Log Message

Nix Upstream: Updating Platform files
https://bugs.webkit.org/show_bug.cgi?id=124982

Patch by Thiago de Barros Lacerda <thiago.lace...@openbossa.org> on 2013-12-02
Reviewed by Benjamin Poulain.

Adding new Platform files that are missing in the trunk.

* PlatformNix.cmake:
* nix/public/AudioDestinationConsumer.h: Added.
(Nix::AudioDestinationConsumer::~AudioDestinationConsumer):
* nix/public/MediaConstraints.h: Added.
* nix/public/MediaStream.h: Added.
* nix/public/MediaStreamAudioSource.h: Added.
* nix/public/MediaStreamCenter.h: Added.
* nix/public/MediaStreamSource.h: Added.
* nix/public/PrivatePtr.h: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/Platform/ChangeLog (159970 => 159971)


--- trunk/Source/Platform/ChangeLog	2013-12-02 22:56:01 UTC (rev 159970)
+++ trunk/Source/Platform/ChangeLog	2013-12-02 22:59:05 UTC (rev 159971)
@@ -1,3 +1,22 @@
+2013-12-02  Thiago de Barros Lacerda  <thiago.lace...@openbossa.org>
+
+        Nix Upstream: Updating Platform files
+        https://bugs.webkit.org/show_bug.cgi?id=124982
+
+        Reviewed by Benjamin Poulain.
+
+        Adding new Platform files that are missing in the trunk.
+
+        * PlatformNix.cmake:
+        * nix/public/AudioDestinationConsumer.h: Added.
+        (Nix::AudioDestinationConsumer::~AudioDestinationConsumer):
+        * nix/public/MediaConstraints.h: Added.
+        * nix/public/MediaStream.h: Added.
+        * nix/public/MediaStreamAudioSource.h: Added.
+        * nix/public/MediaStreamCenter.h: Added.
+        * nix/public/MediaStreamSource.h: Added.
+        * nix/public/PrivatePtr.h: Added.
+
 2013-11-26  Marcelo Lira  <marcelo.l...@openbossa.org>
 
         Nix upstreaming - Adding build files and supporting scripts

Modified: trunk/Source/Platform/PlatformNix.cmake (159970 => 159971)


--- trunk/Source/Platform/PlatformNix.cmake	2013-12-02 22:56:01 UTC (rev 159970)
+++ trunk/Source/Platform/PlatformNix.cmake	2013-12-02 22:59:05 UTC (rev 159971)
@@ -6,6 +6,7 @@
 )
 
 set(Platform_HEADERS
+    nix/public/AudioDestinationConsumer.h
     nix/public/AudioDevice.h
     nix/public/Canvas.h
     nix/public/Color.h
@@ -13,9 +14,15 @@
     nix/public/FFTFrame.h
     nix/public/Gamepad.h
     nix/public/Gamepads.h
+    nix/public/MediaConstraints.h
     nix/public/MediaPlayer.h
+    nix/public/MediaStream.h
+    nix/public/MediaStreamAudioSource.h
+    nix/public/MediaStreamCenter.h
+    nix/public/MediaStreamSource.h
     nix/public/MultiChannelPCMData.h
     nix/public/Platform.h
+    nix/public/PrivatePtr.h
     nix/public/Rect.h
     nix/public/Size.h
     nix/public/ThemeEngine.h

Added: trunk/Source/Platform/nix/public/AudioDestinationConsumer.h (0 => 159971)


--- trunk/Source/Platform/nix/public/AudioDestinationConsumer.h	                        (rev 0)
+++ trunk/Source/Platform/nix/public/AudioDestinationConsumer.h	2013-12-02 22:59:05 UTC (rev 159971)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * 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 Nix_AudioDestinationConsumer_h
+#define Nix_AudioDestinationConsumer_h
+
+#include <cstddef>
+#include <vector>
+
+namespace Nix {
+
+class AudioDestinationConsumer {
+public:
+    virtual ~AudioDestinationConsumer() { }
+
+    virtual void setFormat(size_t numberOfChannels, float sampleRate) = 0;
+
+    // The size of the vector is the number of audio channels, and numberOfFrames is the
+    // number of audio frames in the (possibly multi-channel) buffer in a planar format.
+    virtual void consumeAudio(const std::vector<const float*>& pcmData, size_t numberOfFrames) = 0;
+};
+
+} // namespace Nix
+
+#endif // Nix_AudioDestinationConsumer_h
+

Added: trunk/Source/Platform/nix/public/MediaConstraints.h (0 => 159971)


--- trunk/Source/Platform/nix/public/MediaConstraints.h	                        (rev 0)
+++ trunk/Source/Platform/nix/public/MediaConstraints.h	2013-12-02 22:59:05 UTC (rev 159971)
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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 Nix_MediaConstraints_h
+#define Nix_MediaConstraints_h
+
+#include "Common.h"
+#include "PrivatePtr.h"
+
+#include <cstddef>
+#include <string>
+#include <vector>
+
+namespace WebCore {
+struct MediaConstraint;
+class MediaConstraints;
+}
+
+namespace Nix {
+
+struct MediaConstraint {
+    MediaConstraint()
+    {
+    }
+
+    MediaConstraint(std::string name, std::string value)
+        : m_name(name)
+        , m_value(value)
+    {
+    }
+
+    std::string m_name;
+    std::string m_value;
+};
+
+class MediaConstraints {
+public:
+    MediaConstraints() { }
+    ~MediaConstraints() { reset(); }
+
+    void assign(const MediaConstraints&);
+
+    void reset();
+    NIX_EXPORT bool isNull() const { return m_private.isNull(); }
+
+    NIX_EXPORT void getMandatoryConstraints(std::vector<MediaConstraint>&) const;
+    NIX_EXPORT void getOptionalConstraints(std::vector<MediaConstraint>&) const;
+
+    NIX_EXPORT bool getMandatoryConstraintValue(const char* name, std::string& value) const;
+    NIX_EXPORT bool getOptionalConstraintValue(const char* name, std::string& value) const;
+
+#ifdef BUILDING_NIX__
+    MediaConstraints(const WTF::PassRefPtr<WebCore::MediaConstraints>&);
+    MediaConstraints(WebCore::MediaConstraints*);
+#endif
+
+private:
+    PrivatePtr<WebCore::MediaConstraints> m_private;
+};
+
+} // namespace Nix
+
+#endif // Nix_MediaConstraints_h
+

Added: trunk/Source/Platform/nix/public/MediaStream.h (0 => 159971)


--- trunk/Source/Platform/nix/public/MediaStream.h	                        (rev 0)
+++ trunk/Source/Platform/nix/public/MediaStream.h	2013-12-02 22:59:05 UTC (rev 159971)
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * 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 Nix_MediaStream_h
+#define Nix_MediaStream_h
+
+#include "Common.h"
+#include "PrivatePtr.h"
+
+#include <cstddef>
+#include <vector>
+
+namespace WebCore {
+class MediaStreamPrivate;
+}
+
+namespace Nix {
+
+class MediaStreamSource;
+class MediaStreamAudioSource;
+
+class MediaStream {
+public:
+    MediaStream() { }
+    MediaStream(const MediaStream& other) { assign(other); }
+    ~MediaStream() { reset(); }
+
+    MediaStream& operator=(const MediaStream& other)
+    {
+        assign(other);
+        return *this;
+    }
+
+    NIX_EXPORT void assign(const MediaStream&);
+
+    // Takes ownership of the MediaStreamSource* pointers, deleting them.
+    NIX_EXPORT void initialize(std::vector<MediaStreamSource*>& audioTracks, std::vector<MediaStreamSource*>& videoTracks);
+
+    NIX_EXPORT void reset();
+    NIX_EXPORT bool isNull() const;
+
+
+    NIX_EXPORT const char* id() const;
+
+    // Caller must delete the returned MediaStreamSource*
+    NIX_EXPORT std::vector<MediaStreamSource*> audioSources() const;
+    NIX_EXPORT std::vector<MediaStreamSource*> videoSources() const;
+
+    NIX_EXPORT void addSource(const MediaStreamSource&);
+    NIX_EXPORT void removeSource(const MediaStreamSource&);
+
+#if BUILDING_NIX__
+    MediaStream(WebCore::MediaStreamPrivate*);
+    MediaStream(const WTF::PassRefPtr<WebCore::MediaStreamPrivate>&);
+    operator WTF::PassRefPtr<WebCore::MediaStreamPrivate>() const;
+    operator WebCore::MediaStreamPrivate*() const;
+    MediaStream& operator=(const WTF::PassRefPtr<WebCore::MediaStreamPrivate>&);
+#endif
+
+private:
+    PrivatePtr<WebCore::MediaStreamPrivate> m_private;
+};
+
+} // namespace Nix
+
+#endif // Nix_MediaStream_h
+

Added: trunk/Source/Platform/nix/public/MediaStreamAudioSource.h (0 => 159971)


--- trunk/Source/Platform/nix/public/MediaStreamAudioSource.h	                        (rev 0)
+++ trunk/Source/Platform/nix/public/MediaStreamAudioSource.h	2013-12-02 22:59:05 UTC (rev 159971)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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 Nix_MediaStreamAudioSource_h
+#define Nix_MediaStreamAudioSource_h
+
+#include "Common.h"
+#include "MediaStreamSource.h"
+
+namespace WebCore {
+class MediaStreamAudioSource;
+}
+
+namespace Nix {
+class AudioDestinationConsumer;
+
+class MediaStreamAudioSource : public MediaStreamSource {
+public:
+    NIX_EXPORT MediaStreamAudioSource();
+    MediaStreamAudioSource(const MediaStreamAudioSource& other) : MediaStreamSource(other) { assign(other); }
+    ~MediaStreamAudioSource() { reset(); }
+
+    MediaStreamAudioSource& operator=(const MediaStreamAudioSource& other)
+    {
+        assign(other);
+        return *this;
+    }
+
+    NIX_EXPORT void assign(const MediaStreamAudioSource&);
+
+    NIX_EXPORT void reset();
+    bool isNull() const { return m_private.isNull(); }
+
+    NIX_EXPORT const char* deviceId() const;
+    NIX_EXPORT void setDeviceId(const char*);
+
+    // The Nix::AudioDestinationConsumer is not owned, and has to be disposed of separately
+    // after calling removeAudioConsumer.
+    NIX_EXPORT void addAudioConsumer(AudioDestinationConsumer*);
+    NIX_EXPORT bool removeAudioConsumer(AudioDestinationConsumer*);
+
+#if BUILDING_NIX__
+    MediaStreamAudioSource(const WTF::PassRefPtr<WebCore::MediaStreamAudioSource>&);
+    MediaStreamAudioSource& operator=(WebCore::MediaStreamAudioSource*);
+    operator WTF::PassRefPtr<WebCore::MediaStreamAudioSource>() const;
+    operator WebCore::MediaStreamAudioSource*() const;
+private:
+    WebCore::MediaStreamAudioSource* toWebCoreAudioSource() const;
+#endif
+
+};
+
+} // namespace Nix
+
+#endif // Nix_MediaStreamAudioSource_h
+

Added: trunk/Source/Platform/nix/public/MediaStreamCenter.h (0 => 159971)


--- trunk/Source/Platform/nix/public/MediaStreamCenter.h	                        (rev 0)
+++ trunk/Source/Platform/nix/public/MediaStreamCenter.h	2013-12-02 22:59:05 UTC (rev 159971)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * 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 Nix_MediaStreamCenter_h
+#define Nix_MediaStreamCenter_h
+
+#include "Common.h"
+#include "PrivatePtr.h"
+
+namespace WebCore {
+class MediaStreamCenter;
+}
+
+namespace Nix {
+class MediaStream;
+class MediaStreamSource;
+class MediaConstraints;
+
+class NIX_EXPORT MediaStreamCenter {
+public:
+    MediaStreamCenter();
+    void request();
+    // Return the name of the failed constraint. 0 if successful.
+    virtual const char* validateRequestConstraints(MediaConstraints& audioConstraints, MediaConstraints& videoConstraints) = 0;
+    virtual MediaStream createMediaStream(MediaConstraints& audioConstraints, MediaConstraints& videoConstraints) = 0;
+
+};
+
+} // namespace Nix
+
+#endif // Nix_MediaStreamCenter_h
+

Added: trunk/Source/Platform/nix/public/MediaStreamSource.h (0 => 159971)


--- trunk/Source/Platform/nix/public/MediaStreamSource.h	                        (rev 0)
+++ trunk/Source/Platform/nix/public/MediaStreamSource.h	2013-12-02 22:59:05 UTC (rev 159971)
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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 Nix_MediaStreamSource_h
+#define Nix_MediaStreamSource_h
+
+#include "Common.h"
+#include "PrivatePtr.h"
+
+namespace WebCore {
+class MediaStreamSource;
+}
+
+namespace Nix {
+
+class MediaStreamSource {
+public:
+
+    enum Type {
+        Audio,
+        Video
+    };
+
+    enum ReadyState {
+        ReadyStateLive = 0,
+        ReadyStateMuted = 1,
+        ReadyStateEnded = 2
+    };
+
+    MediaStreamSource() { }
+    MediaStreamSource(const MediaStreamSource& other) { assign(other); }
+    virtual ~MediaStreamSource() { reset(); }
+
+    MediaStreamSource& operator=(const MediaStreamSource& other)
+    {
+        assign(other);
+        return *this;
+    }
+
+    NIX_EXPORT void assign(const MediaStreamSource&);
+
+    NIX_EXPORT void reset();
+    bool isNull() const { return m_private.isNull(); }
+
+    NIX_EXPORT const char* id() const;
+    NIX_EXPORT Type type() const;
+    NIX_EXPORT const char* name() const;
+
+    NIX_EXPORT void setReadyState(ReadyState);
+    NIX_EXPORT ReadyState readyState() const;
+
+    NIX_EXPORT bool enabled() const;
+    NIX_EXPORT void setEnabled(bool);
+
+    NIX_EXPORT bool muted() const;
+    NIX_EXPORT void setMuted(bool);
+
+    NIX_EXPORT bool readonly() const;
+    NIX_EXPORT void setReadonly(bool);
+
+    // FIXME Add support for capabilites.
+
+#if BUILDING_NIX__
+    MediaStreamSource(const WTF::PassRefPtr<WebCore::MediaStreamSource>&);
+    MediaStreamSource& operator=(WebCore::MediaStreamSource*);
+    operator WTF::PassRefPtr<WebCore::MediaStreamSource>() const;
+    operator WebCore::MediaStreamSource*() const;
+#endif
+
+protected:
+    PrivatePtr<WebCore::MediaStreamSource> m_private;
+};
+
+} // namespace Nix
+
+#endif // Nix_MediaStreamSource_h
+

Added: trunk/Source/Platform/nix/public/PrivatePtr.h (0 => 159971)


--- trunk/Source/Platform/nix/public/PrivatePtr.h	                        (rev 0)
+++ trunk/Source/Platform/nix/public/PrivatePtr.h	2013-12-02 22:59:05 UTC (rev 159971)
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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 Nix_PrivatePtr_h
+#define Nix_PrivatePtr_h
+
+#include "Common.h"
+
+#if BUILDING_NIX__
+#include <wtf/PassRefPtr.h>
+#endif
+
+#include <cassert>
+
+namespace Nix {
+
+// This class is an implementation detail of the Nix API. It exists
+// to help simplify the implementation of Nix interfaces that merely
+// wrap a reference counted WebCore class.
+template <typename T>
+class PrivatePtr {
+public:
+    PrivatePtr() : m_ptr(0) { }
+    ~PrivatePtr() { assert(!m_ptr); }
+
+    bool isNull() const { return !m_ptr; }
+
+#if BUILDING_NIX__
+    PrivatePtr(const PassRefPtr<T>& prp)
+        : m_ptr(prp.leakRef())
+    {
+    }
+
+    void reset()
+    {
+        assign(0);
+    }
+
+    PrivatePtr<T>& operator=(const PrivatePtr<T>& other)
+    {
+        T* p = other.m_ptr;
+        if (p)
+            p->ref();
+        assign(p);
+        return *this;
+    }
+
+    PrivatePtr<T>& operator=(const PassRefPtr<T>& prp)
+    {
+        assign(prp.leakRef());
+        return *this;
+    }
+
+    T* get() const
+    {
+        return m_ptr;
+    }
+
+    T* operator->() const
+    {
+        assert(m_ptr);
+        return m_ptr;
+    }
+
+private:
+    void assign(T* p)
+    {
+        // p is already ref'd for us by the caller
+        if (m_ptr)
+            m_ptr->deref();
+        m_ptr = p;
+    }
+#endif
+
+private:
+
+    T* m_ptr;
+};
+
+} // namespace Nix
+
+#endif // Nix_PrivatePtr_h
+
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to