netwerk/protocol/device/AndroidCaptureProvider.h

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef AndroidDeviceCaptureProvide_h_
     7 #define AndroidDeviceCaptureProvide_h_
     9 #include "nsDeviceCaptureProvider.h"
    10 #include "nsIAsyncInputStream.h"
    11 #include "nsCOMPtr.h"
    12 #include "nsAutoPtr.h"
    13 #include "nsString.h"
    14 #include "mozilla/net/CameraStreamImpl.h"
    15 #include "nsIEventTarget.h"
    16 #include "nsDeque.h"
    17 #include "mozilla/ReentrantMonitor.h"
    19 class AndroidCaptureProvider MOZ_FINAL : public nsDeviceCaptureProvider {
    20   public:
    21     AndroidCaptureProvider();
    22     ~AndroidCaptureProvider();
    24     NS_DECL_THREADSAFE_ISUPPORTS
    26     nsresult Init(nsACString& aContentType, nsCaptureParams* aParams, nsIInputStream** aStream);
    27     static AndroidCaptureProvider* sInstance;
    28 };
    30 class AndroidCameraInputStream MOZ_FINAL : public nsIAsyncInputStream, mozilla::net::CameraStreamImpl::FrameCallback {
    31   public:
    32     AndroidCameraInputStream();
    33     ~AndroidCameraInputStream();
    35     NS_IMETHODIMP Init(nsACString& aContentType, nsCaptureParams* aParams);
    37     NS_DECL_THREADSAFE_ISUPPORTS
    38     NS_DECL_NSIINPUTSTREAM
    39     NS_DECL_NSIASYNCINPUTSTREAM
    41     void ReceiveFrame(char* frame, uint32_t length);
    43   protected:
    44     void NotifyListeners();
    45     void doClose();
    47     uint32_t mAvailable;
    48     nsCString mContentType;
    49     uint32_t mWidth;
    50     uint32_t mHeight;
    51     uint32_t mCamera;
    52     bool mHeaderSent;
    53     bool mClosed;
    54     nsDeque *mFrameQueue;
    55     uint32_t mFrameSize;
    56     mozilla::ReentrantMonitor mMonitor;
    58     nsCOMPtr<nsIInputStreamCallback> mCallback;
    59     nsCOMPtr<nsIEventTarget> mCallbackTarget;
    60 };
    62 already_AddRefed<AndroidCaptureProvider> GetAndroidCaptureProvider();
    64 #endif

mercurial