netwerk/protocol/device/AndroidCaptureProvider.h

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

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

mercurial