dom/camera/GonkRecorderProfiles.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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 file,
     3  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef DOM_CAMERA_GONK_RECORDER_PROFILES_H
     6 #define DOM_CAMERA_GONK_RECORDER_PROFILES_H
     8 #include <media/MediaProfiles.h>
     9 #include "CameraRecorderProfiles.h"
    10 #include "ICameraControl.h"
    12 #ifndef CHECK_SETARG
    13 #define CHECK_SETARG(x)                 \
    14   do {                                  \
    15     if (x) {                            \
    16       DOM_CAMERA_LOGE(#x " failed\n");  \
    17       return NS_ERROR_INVALID_ARG;      \
    18     }                                   \
    19   } while(0)
    20 #endif
    23 namespace android {
    24 class GonkRecorder;
    25 };
    27 namespace mozilla {
    29 /**
    30  * Gonk-specific video profile.
    31  */
    32 class GonkRecorderVideoProfile : public RecorderVideoProfile
    33 {
    34 public:
    35   GonkRecorderVideoProfile(uint32_t aCameraId, uint32_t aQualityIndex);
    36   ~GonkRecorderVideoProfile();
    37   android::video_encoder GetPlatformCodec() const { return mPlatformCodec; }
    39 protected:
    40   android::video_encoder mPlatformCodec;
    41 };
    43 /**
    44  * Gonk-specific audio profile.
    45  */
    46 class GonkRecorderAudioProfile : public RecorderAudioProfile
    47 {
    48 public:
    49   GonkRecorderAudioProfile(uint32_t aCameraId, uint32_t aQualityIndex);
    50   ~GonkRecorderAudioProfile();
    51   android::audio_encoder GetPlatformCodec() const { return mPlatformCodec; }
    53 protected:
    54   android::audio_encoder mPlatformCodec;
    55 };
    57 /**
    58  * Gonk-specific recorder profile.
    59  */
    60 class GonkRecorderProfile : public RecorderProfileBase<GonkRecorderAudioProfile, GonkRecorderVideoProfile>
    61 {
    62 public:
    63   GonkRecorderProfile(uint32_t aCameraId, uint32_t aQualityIndex);
    65   GonkRecorderAudioProfile* GetGonkAudioProfile() { return &mAudio; }
    66   GonkRecorderVideoProfile* GetGonkVideoProfile() { return &mVideo; }
    68   android::output_format GetOutputFormat() const { return mPlatformOutputFormat; }
    69   nsresult ConfigureRecorder(android::GonkRecorder* aRecorder);
    71 protected:
    72   virtual ~GonkRecorderProfile();
    74   android::output_format mPlatformOutputFormat;
    75 };
    77 /**
    78  * Gonk-specific profile manager.
    79  */
    80 class GonkRecorderProfileManager : public RecorderProfileManager
    81 {
    82 public:
    83   GonkRecorderProfileManager(uint32_t aCameraId);
    85   /**
    86    * Call this function to indicate that the specified resolutions are in fact
    87    * supported by the camera hardware.  (Just because it appears in a recorder
    88    * profile doesn't mean the hardware can handle it.)
    89    */
    90   void SetSupportedResolutions(const nsTArray<ICameraControl::Size>& aSizes)
    91     { mSupportedSizes = aSizes; }
    93   /**
    94    * Call this function to remove all resolutions set by calling
    95    * SetSupportedResolutions().
    96    */
    97   void ClearSupportedResolutions() { mSupportedSizes.Clear(); }
    99   bool IsSupported(uint32_t aQualityIndex) const;
   101   already_AddRefed<RecorderProfile> Get(uint32_t aQualityIndex) const;
   102   already_AddRefed<GonkRecorderProfile> Get(const char* aProfileName) const;
   103   nsresult ConfigureRecorder(android::GonkRecorder* aRecorder);
   105 protected:
   106   virtual ~GonkRecorderProfileManager();
   108   nsTArray<ICameraControl::Size> mSupportedSizes;
   109 };
   111 }; // namespace mozilla
   113 #endif // DOM_CAMERA_GONK_RECORDER_PROFILES_H

mercurial