michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef DOM_CAMERA_GONK_RECORDER_PROFILES_H michael@0: #define DOM_CAMERA_GONK_RECORDER_PROFILES_H michael@0: michael@0: #include michael@0: #include "CameraRecorderProfiles.h" michael@0: #include "ICameraControl.h" michael@0: michael@0: #ifndef CHECK_SETARG michael@0: #define CHECK_SETARG(x) \ michael@0: do { \ michael@0: if (x) { \ michael@0: DOM_CAMERA_LOGE(#x " failed\n"); \ michael@0: return NS_ERROR_INVALID_ARG; \ michael@0: } \ michael@0: } while(0) michael@0: #endif michael@0: michael@0: michael@0: namespace android { michael@0: class GonkRecorder; michael@0: }; michael@0: michael@0: namespace mozilla { michael@0: michael@0: /** michael@0: * Gonk-specific video profile. michael@0: */ michael@0: class GonkRecorderVideoProfile : public RecorderVideoProfile michael@0: { michael@0: public: michael@0: GonkRecorderVideoProfile(uint32_t aCameraId, uint32_t aQualityIndex); michael@0: ~GonkRecorderVideoProfile(); michael@0: android::video_encoder GetPlatformCodec() const { return mPlatformCodec; } michael@0: michael@0: protected: michael@0: android::video_encoder mPlatformCodec; michael@0: }; michael@0: michael@0: /** michael@0: * Gonk-specific audio profile. michael@0: */ michael@0: class GonkRecorderAudioProfile : public RecorderAudioProfile michael@0: { michael@0: public: michael@0: GonkRecorderAudioProfile(uint32_t aCameraId, uint32_t aQualityIndex); michael@0: ~GonkRecorderAudioProfile(); michael@0: android::audio_encoder GetPlatformCodec() const { return mPlatformCodec; } michael@0: michael@0: protected: michael@0: android::audio_encoder mPlatformCodec; michael@0: }; michael@0: michael@0: /** michael@0: * Gonk-specific recorder profile. michael@0: */ michael@0: class GonkRecorderProfile : public RecorderProfileBase michael@0: { michael@0: public: michael@0: GonkRecorderProfile(uint32_t aCameraId, uint32_t aQualityIndex); michael@0: michael@0: GonkRecorderAudioProfile* GetGonkAudioProfile() { return &mAudio; } michael@0: GonkRecorderVideoProfile* GetGonkVideoProfile() { return &mVideo; } michael@0: michael@0: android::output_format GetOutputFormat() const { return mPlatformOutputFormat; } michael@0: nsresult ConfigureRecorder(android::GonkRecorder* aRecorder); michael@0: michael@0: protected: michael@0: virtual ~GonkRecorderProfile(); michael@0: michael@0: android::output_format mPlatformOutputFormat; michael@0: }; michael@0: michael@0: /** michael@0: * Gonk-specific profile manager. michael@0: */ michael@0: class GonkRecorderProfileManager : public RecorderProfileManager michael@0: { michael@0: public: michael@0: GonkRecorderProfileManager(uint32_t aCameraId); michael@0: michael@0: /** michael@0: * Call this function to indicate that the specified resolutions are in fact michael@0: * supported by the camera hardware. (Just because it appears in a recorder michael@0: * profile doesn't mean the hardware can handle it.) michael@0: */ michael@0: void SetSupportedResolutions(const nsTArray& aSizes) michael@0: { mSupportedSizes = aSizes; } michael@0: michael@0: /** michael@0: * Call this function to remove all resolutions set by calling michael@0: * SetSupportedResolutions(). michael@0: */ michael@0: void ClearSupportedResolutions() { mSupportedSizes.Clear(); } michael@0: michael@0: bool IsSupported(uint32_t aQualityIndex) const; michael@0: michael@0: already_AddRefed Get(uint32_t aQualityIndex) const; michael@0: already_AddRefed Get(const char* aProfileName) const; michael@0: nsresult ConfigureRecorder(android::GonkRecorder* aRecorder); michael@0: michael@0: protected: michael@0: virtual ~GonkRecorderProfileManager(); michael@0: michael@0: nsTArray mSupportedSizes; michael@0: }; michael@0: michael@0: }; // namespace mozilla michael@0: michael@0: #endif // DOM_CAMERA_GONK_RECORDER_PROFILES_H