dom/camera/GonkRecorderProfiles.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:1e7f9d730bf4
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/. */
4
5 #ifndef DOM_CAMERA_GONK_RECORDER_PROFILES_H
6 #define DOM_CAMERA_GONK_RECORDER_PROFILES_H
7
8 #include <media/MediaProfiles.h>
9 #include "CameraRecorderProfiles.h"
10 #include "ICameraControl.h"
11
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
21
22
23 namespace android {
24 class GonkRecorder;
25 };
26
27 namespace mozilla {
28
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; }
38
39 protected:
40 android::video_encoder mPlatformCodec;
41 };
42
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; }
52
53 protected:
54 android::audio_encoder mPlatformCodec;
55 };
56
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);
64
65 GonkRecorderAudioProfile* GetGonkAudioProfile() { return &mAudio; }
66 GonkRecorderVideoProfile* GetGonkVideoProfile() { return &mVideo; }
67
68 android::output_format GetOutputFormat() const { return mPlatformOutputFormat; }
69 nsresult ConfigureRecorder(android::GonkRecorder* aRecorder);
70
71 protected:
72 virtual ~GonkRecorderProfile();
73
74 android::output_format mPlatformOutputFormat;
75 };
76
77 /**
78 * Gonk-specific profile manager.
79 */
80 class GonkRecorderProfileManager : public RecorderProfileManager
81 {
82 public:
83 GonkRecorderProfileManager(uint32_t aCameraId);
84
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; }
92
93 /**
94 * Call this function to remove all resolutions set by calling
95 * SetSupportedResolutions().
96 */
97 void ClearSupportedResolutions() { mSupportedSizes.Clear(); }
98
99 bool IsSupported(uint32_t aQualityIndex) const;
100
101 already_AddRefed<RecorderProfile> Get(uint32_t aQualityIndex) const;
102 already_AddRefed<GonkRecorderProfile> Get(const char* aProfileName) const;
103 nsresult ConfigureRecorder(android::GonkRecorder* aRecorder);
104
105 protected:
106 virtual ~GonkRecorderProfileManager();
107
108 nsTArray<ICameraControl::Size> mSupportedSizes;
109 };
110
111 }; // namespace mozilla
112
113 #endif // DOM_CAMERA_GONK_RECORDER_PROFILES_H

mercurial