netwerk/protocol/device/CameraStreamImpl.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 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef __CAMERASTREAMIMPL_H__
     6 #define __CAMERASTREAMIMPL_H__
     8 #include "nsString.h"
     9 #include "AndroidBridge.h"
    11 /**
    12  * This singleton class handles communication with the Android camera
    13  * through JNI. It is used by the IPDL parent or directly from the chrome process
    14  */
    16 namespace mozilla {
    17 namespace net {
    19 class CameraStreamImpl {
    20 public:
    21     class FrameCallback {
    22     public:
    23         virtual void ReceiveFrame(char* frame, uint32_t length) = 0;
    24     };
    26     /**
    27      * instance bound to a given camera
    28      */
    29     static CameraStreamImpl* GetInstance(uint32_t aCamera);
    31     bool initNeeded() {
    32         return !mInit;
    33     }
    35     FrameCallback* GetFrameCallback() {
    36         return mCallback;
    37     }
    39     bool Init(const nsCString& contentType, const uint32_t& camera, const uint32_t& width, const uint32_t& height, FrameCallback* callback);
    40     void Close();
    42     uint32_t GetWidth() { return mWidth; }
    43     uint32_t GetHeight() { return mHeight; }
    44     uint32_t GetFps() { return mFps; }
    46     void takePicture(const nsAString& aFileName);
    48     void transmitFrame(JNIEnv *env, jbyteArray *data);
    50 private:
    51     CameraStreamImpl(uint32_t aCamera);
    52     CameraStreamImpl(const CameraStreamImpl&);
    53     CameraStreamImpl& operator=(const CameraStreamImpl&);
    55     ~CameraStreamImpl();
    57     bool mInit;
    58     uint32_t mCamera;
    59     uint32_t mWidth;
    60     uint32_t mHeight;
    61     uint32_t mFps;
    62     FrameCallback* mCallback;
    63 };
    65 } // namespace net
    66 } // namespace mozilla
    68 #endif

mercurial