1 /* 2 * Copyright (C) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef I_STANDARD_RECORDER_SERVICE_H 17 #define I_STANDARD_RECORDER_SERVICE_H 18 19 #include "ipc_types.h" 20 #include "iremote_broker.h" 21 #include "iremote_proxy.h" 22 #include "iremote_stub.h" 23 #include "recorder.h" 24 25 namespace OHOS { 26 namespace Media { 27 class IStandardRecorderService : public IRemoteBroker { 28 public: 29 virtual ~IStandardRecorderService() = default; 30 virtual int32_t SetListenerObject(const sptr<IRemoteObject> &object) = 0; 31 virtual int32_t SetVideoSource(VideoSourceType source, int32_t &sourceId) = 0; 32 virtual int32_t SetVideoEncoder(int32_t sourceId, VideoCodecFormat encoder) = 0; 33 virtual int32_t SetVideoSize(int32_t sourceId, int32_t width, int32_t height) = 0; 34 virtual int32_t SetVideoFrameRate(int32_t sourceId, int32_t frameRate) = 0; 35 virtual int32_t SetVideoEncodingBitRate(int32_t sourceId, int32_t rate) = 0; 36 virtual int32_t SetMetaConfigs(int32_t sourceId) = 0; 37 virtual int32_t SetMetaSource(MetaSourceType source, int32_t &sourceId) = 0; 38 virtual int32_t SetMetaMimeType(int32_t sourceId, const std::string_view &type) = 0; 39 virtual int32_t SetMetaTimedKey(int32_t sourceId, const std::string_view &timedKey) = 0; 40 virtual int32_t SetMetaSourceTrackMime(int32_t sourceId, const std::string_view &srcTrackMime) = 0; SetCaptureRate(int32_t sourceId,double fps)41 virtual int32_t SetCaptureRate(int32_t sourceId, double fps) 42 { 43 (void)sourceId; 44 (void)fps; 45 return MSERR_UNSUPPORT; 46 }; 47 virtual sptr<OHOS::Surface> GetSurface(int32_t sourceId) = 0; 48 virtual sptr<OHOS::Surface> GetMetaSurface(int32_t sourceId) = 0; 49 virtual int32_t SetAudioSource(AudioSourceType source, int32_t &sourceId) = 0; 50 virtual int32_t SetAudioEncoder(int32_t sourceId, AudioCodecFormat encoder) = 0; 51 virtual int32_t SetAudioSampleRate(int32_t sourceId, int32_t rate) = 0; 52 virtual int32_t SetAudioChannels(int32_t sourceId, int32_t num) = 0; 53 virtual int32_t SetAudioEncodingBitRate(int32_t sourceId, int32_t bitRate) = 0; 54 virtual int32_t SetDataSource(DataSourceType dataType, int32_t &sourceId) = 0; 55 virtual int32_t SetUserCustomInfo(Meta &userCustomInfo) = 0; 56 virtual int32_t SetGenre(std::string &genre) = 0; 57 virtual int32_t SetMaxDuration(int32_t duration) = 0; 58 virtual int32_t SetOutputFormat(OutputFormatType format) = 0; 59 virtual int32_t SetOutputFile(int32_t fd) = 0; 60 virtual int32_t SetFileGenerationMode(FileGenerationMode mode) = 0; SetNextOutputFile(int32_t fd)61 virtual int32_t SetNextOutputFile(int32_t fd) 62 { 63 (void)fd; 64 return MSERR_UNSUPPORT; 65 }; SetMaxFileSize(int64_t size)66 virtual int32_t SetMaxFileSize(int64_t size) 67 { 68 (void)size; 69 return MSERR_UNSUPPORT; 70 }; 71 virtual int32_t SetLocation(float latitude, float longitude) = 0; 72 virtual int32_t SetOrientationHint(int32_t rotation) = 0; 73 virtual int32_t Prepare() = 0; 74 virtual int32_t Start() = 0; 75 virtual int32_t Pause() = 0; 76 virtual int32_t Resume() = 0; 77 virtual int32_t Stop(bool block) = 0; 78 virtual int32_t Reset() = 0; 79 virtual int32_t Release() = 0; SetFileSplitDuration(FileSplitType type,int64_t timestamp,uint32_t duration)80 virtual int32_t SetFileSplitDuration(FileSplitType type, int64_t timestamp, uint32_t duration) 81 { 82 (void)type; 83 (void)timestamp; 84 (void)duration; 85 return MSERR_UNSUPPORT; 86 }; 87 virtual int32_t DestroyStub() = 0; 88 virtual int32_t GetAVRecorderConfig(ConfigMap &configMap) = 0; 89 virtual int32_t GetLocation(Location &location) = 0; 90 virtual int32_t SetVideoIsHdr(int32_t sourceId, bool isHdr) = 0; 91 virtual int32_t SetVideoEnableTemporalScale(int32_t sourceId, bool enableTemporalScale) = 0; 92 virtual int32_t GetCurrentCapturerChangeInfo(AudioRecorderChangeInfo &changeInfo) = 0; 93 virtual int32_t GetAvailableEncoder(std::vector<EncoderCapabilityData> &encoderInfo) = 0; 94 virtual int32_t GetMaxAmplitude() = 0; 95 virtual int32_t IsWatermarkSupported(bool &isWatermarkSupported) = 0; 96 virtual int32_t SetWatermark(std::shared_ptr<AVBuffer> &waterMarkBuffer) = 0; 97 /** 98 * IPC code ID 99 */ 100 enum RecorderServiceMsg { 101 SET_LISTENER_OBJ = 0, 102 SET_VIDEO_SOURCE, 103 SET_VIDEO_ENCODER, 104 SET_VIDEO_SIZE, 105 SET_VIDEO_FARAME_RATE, 106 SET_VIDEO_ENCODING_BIT_RATE, 107 SET_CAPTURE_RATE, 108 GET_SURFACE, 109 SET_AUDIO_SOURCE, 110 SET_AUDIO_ENCODER, 111 SET_AUDIO_SAMPLE_RATE, 112 SET_AUDIO_CHANNELS, 113 SET_AUDIO_ENCODING_BIT_RATE, 114 SET_DATA_SOURCE, 115 SET_MAX_DURATION, 116 SET_OUTPUT_FORMAT, 117 SET_OUTPUT_FILE, 118 SET_FILE_GENERATION_MODE, 119 SET_NEXT_OUTPUT_FILE, 120 SET_MAX_FILE_SIZE, 121 SET_LOCATION, 122 SET_ORIENTATION_HINT, 123 SET_USER_CUSTOM_INFO, 124 SET_GENRE, 125 PREPARE, 126 START, 127 PAUSE, 128 RESUME, 129 STOP, 130 RESET, 131 RELEASE, 132 SET_FILE_SPLIT_DURATION, 133 DESTROY, 134 GET_AV_RECORDER_CONFIG, 135 GET_LOCATION, 136 SET_VIDEO_IS_HDR, 137 SET_VIDEO_ENABLE_TEMPORAL_SCALE, 138 GET_AUDIO_CAPTURER_CHANGE_INFO, 139 GET_AVAILABLE_ENCODER, 140 GET_MAX_AMPLITUDE, 141 SET_META_CONFIGS, 142 SET_META_SOURCE, 143 SET_META_MIME_TYPE, 144 SET_META_TIMED_KEY, 145 SET_META_TRACK_SRC_MIME_TYPE, 146 GET_META_SURFACE, 147 IS_WATERMARK_SUPPORTED, 148 SET_WATERMARK, 149 }; 150 151 DECLARE_INTERFACE_DESCRIPTOR(u"IStandardRecorderService"); 152 }; 153 } // namespace Media 154 } // namespace OHOS 155 #endif // I_STANDARD_RECORDER_SERVICE_H 156