• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_RECORDER_SERVICE_H
17 #define I_RECORDER_SERVICE_H
18 
19 #include <string>
20 #include "recorder.h"
21 #include "refbase.h"
22 #include "surface.h"
23 #include "media_data_source.h"
24 #include "qos.h"
25 
26 namespace OHOS {
27 namespace Media {
28 class IRecorderService {
29 public:
30     virtual ~IRecorderService() = default;
31 
32     /**
33      * @brief Sets a video source for recording.
34      *
35      * If this function is not called, the output file does not contain the video track.
36      *
37      * @param source Indicates the video source type. For details, see {@link VideoSourceType}.
38      * @param sourceId Indicates the video source ID. The value <b>-1</b> indicates an invalid ID and the setting fails.
39      *
40      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
41      * in {@link media_errors.h} otherwise.
42      * @since 1.0
43      * @version 1.0
44      */
45     virtual int32_t SetVideoSource(VideoSourceType source, int32_t &sourceId) = 0;
46 
47     /**
48      * @brief Sets a meta source for recording.
49      *
50      * If this function is not called, the output file does not contain the meta track.
51      *
52      * @param source Indicates the meta source type. For details, see {@link MetaSourceType}.
53      * @param sourceId Indicates the meta source ID. The value <b>-1</b> indicates an invalid ID and the setting fails.
54      *
55      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
56      * in {@link media_errors.h} otherwise.
57      * @since 1.0
58      * @version 1.0
59      */
60     virtual int32_t SetMetaSource(MetaSourceType source, int32_t &sourceId) = 0;
61 
62     /**
63      * @brief Sets a meta configurations for recording.
64      *
65      * If this function is not called, the output file does not contain the meta track.
66      *
67      * @param source Indicates the meta source type. For details, see {@link MetaSourceType}.
68      * @param sourceId Indicates the meta source ID. The value <b>-1</b> indicates an invalid ID and the setting fails.
69      *
70      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
71      * in {@link media_errors.h} otherwise.
72      * @since 1.0
73      * @version 1.0
74      */
75     virtual int32_t SetMetaConfigs(int32_t sourceId) = 0;
76 
77     /**
78      * @brief Sets the meta mime type.
79      *
80      * This function must be called after {@link SetVideoSource} but before {@link Prepare}.
81      *
82      * @param sourceId Indicates the meta source ID, which can be obtained from {@link SetVideoSource}.
83      * @param type mime type.
84      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
85      * in {@link media_errors.h} otherwise.
86      * @since 1.0
87      * @version 1.0
88      */
89     virtual int32_t SetMetaMimeType(int32_t sourceId, const std::string_view &type) = 0;
90 
91     /**
92      * @brief Sets the meta timed key.
93      *
94      * This function must be called after {@link SetVideoSource} but before {@link Prepare}.
95      *
96      * @param sourceId Indicates the meta source ID, which can be obtained from {@link SetVideoSource}.
97      * @param key meta data timed key.
98      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
99      * in {@link media_errors.h} otherwise.
100      * @since 1.0
101      * @version 1.0
102      */
103     virtual int32_t SetMetaTimedKey(int32_t sourceId, const std::string_view &timedKey) = 0;
104 
105     /**
106      * @brief Sets the meta timed key.
107      *
108      * This function must be called after {@link SetVideoSource} but before {@link Prepare}.
109      *
110      * @param sourceId Indicates the meta source ID, which can be obtained from {@link SetVideoSource}.
111      * @param type meta data source track mime type.
112      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
113      * in {@link media_errors.h} otherwise.
114      * @since 1.0
115      * @version 1.0
116      */
117     virtual int32_t SetMetaSourceTrackMime(int32_t sourceId, const std::string_view &srcTrackMime) = 0;
118 
119     /**
120      * @brief Sets a video encoder for recording.
121      *
122      * If this function is not called, the output file does not contain the video track.
123      * This function must be called after {@link SetVideoSource} but before {@link Prepare}.
124      *
125      * @param sourceId Indicates the video source ID, which can be obtained from {@link SetVideoSource}.
126      * @param encoder Indicates the video encoder to set.
127      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
128      * in {@link media_errors.h} otherwise.
129      * @since 1.0
130      * @version 1.0
131      */
132     virtual int32_t SetVideoEncoder(int32_t sourceId, VideoCodecFormat encoder) = 0;
133 
134     /**
135      * @brief Sets the width and height of the video to record.
136      *
137      * This function must be called after {@link SetVideoSource} but before {@link Prepare}.
138      *
139      * @param sourceId Indicates the video source ID, which can be obtained from {@link SetVideoSource}.
140      * @param width Indicates the video width to set.
141      * @param height Indicates the video height to set.
142      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
143      * in {@link media_errors.h} otherwise.
144      * @since 1.0
145      * @version 1.0
146      */
147     virtual int32_t SetVideoSize(int32_t sourceId, int32_t width, int32_t height) = 0;
148 
149     /**
150      * @brief Sets the frame rate of the video to record.
151      *
152      * This function must be called after {@link SetVideoSource} but before {@link Prepare}.
153      *
154      * @param sourceId Indicates the video source ID, which can be obtained from {@link SetVideoSource}.
155      * @param frameRate Indicates the frame rate to set.
156      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
157      * in {@link media_errors.h} otherwise.
158      * @since 1.0
159      * @version 1.0
160      */
161     virtual int32_t SetVideoFrameRate(int32_t sourceId, int32_t frameRate) = 0;
162 
163     /**
164      * @brief Sets the encoding bit rate of the video to record.
165      *
166      * This function must be called after {@link SetVideoSource} but before {@link Prepare}.
167      *
168      * @param sourceId Indicates the video source ID, which can be obtained from {@link SetVideoSource}.
169      * @param rate Indicates the encoding bit rate to set.
170      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
171      * in {@link media_errors.h} otherwise.
172      * @since 1.0
173      * @version 1.0
174      */
175     virtual int32_t SetVideoEncodingBitRate(int32_t sourceId, int32_t rate) = 0;
176 
177     /**
178      * @brief Sets the status of the video to record.
179      *
180      * This function must be called after {@link SetOutputFormat}
181      *
182      * @param sourceId Indicates the video source ID, which can be obtained from {@link SetVideoSource}.
183      * @param isHdr Indicates the HDR status to set.
184      * @return Returns {@link MSERR_OK} if the setting is successful; returns an error code otherwise.
185      * @since 1.0
186      * @version 1.0
187      */
188     virtual int32_t SetVideoIsHdr(int32_t sourceId, bool isHdr) = 0;
189 
190     /**
191      * @brief Sets the status of the video whether to encode the video in temporal scale mode.
192      *
193      * @param sourceId Indicates the video source ID, which can be obtained from {@link SetVideoSource}.
194      * @param enableTemporalScale Indicates the temporal scale mode to set.
195      * @return Returns {@link MSERR_OK} if the setting is successful; returns an error code otherwise.
196      * @since 1.0
197      * @version 1.0
198      */
199     virtual int32_t SetVideoEnableTemporalScale(int32_t sourceId, bool enableTemporalScale) = 0;
200 
201     /**
202      * @brief Sets the video stable quality encoding mode..
203      *
204      * @param sourceId Indicates the video source ID, which can be obtained from {@link SetVideoSource}.
205      * @param enableStableQualityMode Indicates the stable quality mode to set.
206      * @return Returns {@link MSERR_OK} if the setting is successful; returns an error code otherwise.
207      * @since 1.0
208      * @version 1.0
209      */
210     virtual int32_t SetVideoEnableStableQualityMode(int32_t sourceId, bool enableStableQualityMode) = 0;
211 
212     /**
213      * @brief Sets the video B Frame encoding mode.
214      *
215      * @param sourceId Indicates the video source ID, which can be obtained from {@link SetVideoSource}.
216      * @param enableBFrame Indicates the B Frame to set.
217      * @return Returns {@link MSERR_OK} if the setting is successful; returns an error code otherwise.
218      * @since 1.0
219      * @version 1.0
220      */
221     virtual int32_t SetVideoEnableBFrame(int32_t sourceId, bool enableBFrame) = 0;
222 
223     /**
224      * @brief Sets the video capture rate.
225      *
226      * This function must be called after {@link SetVideoSource} but before {@link Prepare}. It is valid when the
227      * video source is YUV or RGB.
228      *
229      * @param sourceId Indicates the video source ID, which can be obtained from {@link SetVideoSource}.
230      * @param fps Indicates the rate at which frames are captured per second.
231      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
232      * in {@link media_errors.h} otherwise.
233      * @since 1.0
234      * @version 1.0
235      */
236     virtual int32_t SetCaptureRate(int32_t sourceId, double fps) = 0;
237 
238     /**
239      * @brief Obtains the surface of the video source.
240      *
241      * @param sourceId Indicates the video source ID, which can be obtained from {@link SetVideoSource}.
242      * @return Returns the pointer to the surface.
243      * @since 1.0
244      * @version 1.0
245      */
246     virtual sptr<OHOS::Surface> GetSurface(int32_t sourceId) = 0;
247 
248     /**
249      * @brief Obtains the surface of the meta track.
250      *
251      * @param sourceId Indicates the video source ID, which can be obtained from {@link SetMetaSource}.
252      * @return Returns the pointer to the surface.
253      * @since 1.0
254      * @version 1.0
255      */
256     virtual sptr<OHOS::Surface> GetMetaSurface(int32_t sourceId) = 0;
257 
258     /**
259      * @brief Sets the audio source for recording.
260      *
261      * If this function is not called, the output file does not contain the audio track.
262      *
263      * @param source Indicates the audio source type. For details, see {@link AudioSourceType}.
264      * @param sourceId Indicates the audio source ID. The value <b>-1</b> indicates an invalid ID and the setting fails.
265      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
266      * in {@link media_errors.h} otherwise.
267      * @since 1.0
268      * @version 1.0
269      */
270     virtual int32_t SetAudioSource(AudioSourceType source, int32_t &sourceId) = 0;
271 
272     /**
273      * @brief Sets the audio data source for recording.
274      *
275      * If this function is not called, the output file does not contain the audio track.
276      *
277      * @param source Indicates the audio source type. For details, see {@link AudioSourceType}.
278      * @param sourceId Indicates the audio source ID. The value <b>-1</b> indicates an invalid ID and the setting fails.
279      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
280      * in {@link media_errors.h} otherwise.
281      * @since 12.0
282      * @version 12.0
283      */
SetAudioDataSource(const std::shared_ptr<IAudioDataSource> & audioSource,int32_t & sourceId)284     virtual int32_t SetAudioDataSource(const std::shared_ptr<IAudioDataSource>& audioSource, int32_t& sourceId)
285     {
286         (void)audioSource;
287         (void)sourceId;
288         return 0;
289     };
290 
291     /**
292      * @brief Sets an audio encoder for recording.
293      *
294      * If this function is not called, the output file does not contain the audio track.
295      * This function must be called after {@link SetAudioSource} but before {@link Prepare}.
296      *
297      * @param sourceId Indicates the audio source ID, which can be obtained from {@link SetAudioSource}.
298      * @param encoder Indicates the audio encoder to set.
299      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
300      * in {@link media_errors.h} otherwise.
301      * @since 1.0
302      * @version 1.0
303      */
304     virtual int32_t SetAudioEncoder(int32_t sourceId, AudioCodecFormat encoder) = 0;
305 
306     /**
307      * @brief Sets the audio sampling rate for recording.
308      *
309      * This function must be called after {@link SetAudioSource} but before {@link Prepare}.
310      *
311      * @param sourceId Indicates the audio source ID, which can be obtained from {@link SetAudioSource}.
312      * @param rate Indicates the sampling rate of the audio per second.
313      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
314      * in {@link media_errors.h} otherwise.
315      * @since 1.0
316      * @version 1.0
317      */
318     virtual int32_t SetAudioSampleRate(int32_t sourceId, int32_t rate) = 0;
319 
320     /**
321      * @brief Sets the number of audio channels to record.
322      *
323      * This function must be called after {@link SetAudioSource} but before {@link Prepare}.
324      *
325      * @param sourceId Indicates the audio source ID, which can be obtained from {@link SetAudioSource}.
326      * @param num Indicates the number of audio channels to set.
327      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
328      * in {@link media_errors.h} otherwise.
329      * @since 1.0
330      * @version 1.0
331      */
332     virtual int32_t SetAudioChannels(int32_t sourceId, int32_t num) = 0;
333 
334     /**
335      * @brief Sets the encoding bit rate of the audio to record.
336      *
337      * This function must be called after {@link SetAudioSource} but before {@link Prepare}.
338      *
339      * @param sourceId Indicates the audio source ID, which can be obtained from {@link SetAudioSource}.
340      * @param bitRate Indicates the audio encoding bit rate, in bit/s.
341      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
342      * in {@link media_errors.h} otherwise.
343      * @since 1.0
344      * @version 1.0
345      */
346     virtual int32_t SetAudioEncodingBitRate(int32_t sourceId, int32_t bitRate) = 0;
347 
348     /**
349      * @brief Sets a data source for recording.
350      *
351      * If this function is not called, the output file does not contain the data track.
352      *
353      * @param sourceId Indicates the data source ID. The value <b>-1</b> indicates an invalid ID and the setting fails.
354      *
355      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
356      * in {@link media_errors.h} otherwise.
357      * @since 1.0
358      * @version 1.0
359      */
360     virtual int32_t SetDataSource(DataSourceType dataType, int32_t &sourceId) = 0;
361 
362     /**
363      * @brief Sets the maximum duration of a recorded file, in seconds.
364      *
365      * This method must be called before {@link Prepare}. If the setting is valid,
366      * {@link RECORDER_INFO_MAX_DURATION_APPROACHING} is reported through {@link OnInfo} in the {@link RecorderCallback}
367      * class when only one second or 10% is left to reach the allowed duration.
368      * If the recording output file is set by calling {@link SetOutputFile}, call {@link SetNextOutputFile} to set the
369      * next output file. Otherwise, the current file will be overwritten when the allowed duration is reached.
370      *
371      * @param duration Indicates the maximum recording duration to set. If the value is <b>0</b> or a negative number,
372      * a failure message is returned. The default duration is 60s.
373      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
374      * in {@link media_errors.h} otherwise.
375      * @since 1.0
376      * @version 1.0
377      */
378     virtual int32_t SetMaxDuration(int32_t duration) = 0;
379 
380     /**
381      * @brief Sets the output file format.
382      *
383      * This function must be called before {@link Prepare}.
384      *
385      * @param format Indicates the output file format. For details, see {@link OutputFormatType}.
386      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
387      * in {@link media_errors.h} otherwise.
388      * @since 1.0
389      * @version 1.0
390      */
391     virtual int32_t SetOutputFormat(OutputFormatType format) = 0;
392 
393     /**
394      * @brief Sets the file descriptor (FD) of the output file.
395      *
396      * This function must be called before {@link Prepare}.
397      *
398      * @param fd Indicates the FD of the file.
399      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
400      * in {@link media_errors.h} otherwise.
401      * @since 1.0
402      * @version 1.0
403      */
404     virtual int32_t SetOutputFile(int32_t fd) = 0;
405 
406     virtual int32_t SetFileGenerationMode(FileGenerationMode mode) = 0;
407 
408     /**
409      * @brief Sets the FD of the next output file.
410      *
411      * If {@link SetOutputFile} is successful, call this function to set the FD of the next output file after
412      * {@link RECORDER_INFO_MAX_DURATION_APPROACHING} or {@link RECORDER_INFO_MAX_FILESIZE_APPROACHING} is received.
413      *
414      * @param fd Indicates the FD of the next output file.
415      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
416      * in {@link media_errors.h} otherwise.
417      * @since 1.0
418      * @version 1.0
419      */
420     virtual int32_t SetNextOutputFile(int32_t fd) = 0;
421 
422     /**
423      * @brief Sets the maximum size of a recorded file, in bytes.
424      *
425      * This function must be called before {@link Prepare}. If the setting is valid,
426      * {@link RECORDER_INFO_MAX_DURATION_APPROACHING} is reported through {@link OnInfo} in the {@link RecorderCallback}
427      * class when only 100 KB or 10% is left to reach the allowed size.
428      * If the recording output file is set by calling {@link SetOutputFile}, call {@link SetNextOutputFile} to set the
429      * next output file. Otherwise, when the allowed size is reached, the current file will be overwritten. If
430      * <b>MaxDuration</b> is also set by calling {@link SetMaxDuration}, <b>MaxDuration</b> or <b>MaxFileSize</b>
431      * prevails depending on which of them is first satisfied.
432      *
433      * @param size Indicates the maximum file size to set. If the value is <b>0</b> or a negative number, a failure
434      * message is returned.
435      * By default, the maximum size of a single file supported by the current file system is used as the limit.
436      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
437      * in {@link media_errors.h} otherwise.
438      * @since 1.0
439      * @version 1.0
440      */
441     virtual int32_t SetMaxFileSize(int64_t size) = 0;
442 
443     /**
444      * @brief Set and store the geodata (latitude and longitude) in the output file.
445      * This method should be called before prepare(). The geodata is stored in udta box if
446      * the output format is OutputFormat.THREE_GPP or OutputFormat.MPEG_4,
447      * and is ignored for other output formats.
448      *
449      * @param latitude float: latitude in degrees. Its value must be in the range [-90, 90].
450      * @param longitude float: longitude in degrees. Its value must be in the range [-180, 180].
451      * @since openharmony 3.1
452      * @version 1.0
453      */
454     virtual void SetLocation(float latitude, float longitude) = 0;
455 
456     /**
457      * @brief set the orientation hint in output file, and for the file to playback. mp4 support.
458      * the range of orientation should be {0, 90, 180, 270}, default is 0.
459      *
460      * @param rotation int32_t: should be {0, 90, 180, 270}, default is 0.
461      * @since openharmony 3.1
462      * @version 1.0
463      */
464     virtual void SetOrientationHint(int32_t rotation) = 0;
465 
466     /**
467      * @brief Registers a recording listener.
468      *
469      * This function must be called before {@link Prepare}.
470      *
471      * @param callback Indicates the recording listener to register. For details, see {@link RecorderCallback}.
472      * @return Returns {@link SUCCESS} if the listener is registered; returns an error code defined
473      * in {@link media_errors.h} otherwise.
474      * @since 1.0
475      * @version 1.0
476      */
477     virtual int32_t SetRecorderCallback(const std::shared_ptr<RecorderCallback> &callback) = 0;
478 
479     /**
480      * @brief Prepares for recording.
481      *
482      * This function must be called before {@link Start}.
483      *
484      * @return Returns {@link SUCCESS} if the preparation is successful; returns an error code defined
485      * in {@link media_errors.h} otherwise.
486      * @since 1.0
487      * @version 1.0
488      */
489     virtual int32_t Prepare() = 0;
490 
491     /**
492      * @brief Starts recording.
493      *
494      * This function must be called after {@link Prepare}.
495      *
496      * @return Returns {@link SUCCESS} if the recording is started; returns an error code defined
497      * in {@link media_errors.h} otherwise.
498      * @since 1.0
499      * @version 1.0
500      */
501     virtual int32_t Start() = 0;
502 
503     /**
504      * @brief Pauses recording.
505      *
506      * After {@link Start} is called, you can call this function to pause recording.
507      *
508      * @return Returns {@link SUCCESS} if the recording is paused; returns an error code defined
509      * in {@link media_errors.h} otherwise.
510      * @since 1.0
511      * @version 1.0
512      */
513     virtual int32_t Pause() = 0;
514 
515     /**
516     * @brief Resumes recording.
517     *
518     * You can call this function to resume recording after {@link Pause} is called.
519      *
520      * @return Returns {@link SUCCESS} if the recording is resumed; returns an error code defined
521      * in {@link media_errors.h} otherwise.
522      * @since 1.0
523      * @version 1.0
524      */
525     virtual int32_t Resume() = 0;
526 
527     /**
528      * @brief Stops recording.
529      *
530      * @param block Indicates the stop mode. The value <b>true</b> indicates that the processing stops after all caches
531      * are processed, and <b>false</b> indicates that the processing stops immediately and all caches are discarded.
532      * @return Returns {@link SUCCESS} if the recording is stopped; returns an error code defined
533      * in {@link media_errors.h} otherwise.
534      * @since 1.0
535      * @version 1.0
536      */
537     virtual int32_t Stop(bool block) = 0;
538 
539     /**
540      * @brief Resets the recording.
541      *
542      * After the function is called, add a recording source by calling {@link SetVideoSource} or {@link SetAudioSource},
543      * set related parameters, and call {@link Start} to start recording again after {@link Prepare} is called.
544      *
545      * @return Returns {@link SUCCESS} if the recording is reset; returns an error code defined
546      * in {@link media_errors.h} otherwise.
547      * @since 1.0
548      * @version 1.0
549      */
550     virtual int32_t Reset() = 0;
551 
552     /**
553      * @brief Releases recording resources.
554      *
555      * @return Returns {@link SUCCESS} if recording resources are released; returns an error code defined
556      * in {@link media_errors.h} otherwise.
557      * @since 1.0
558      * @version 1.0
559      */
560     virtual int32_t Release() = 0;
561 
562     /**
563      * @brief Manually splits a video.
564      *
565      * This function must be called after {@link Start}. After this function is called, the file is split based on the
566      * manual split type. After the manual split is complete, the initial split type is used. This function can be
567      * called again only after {@link RECORDER_INFO_FILE_SPLIT_FINISHED} is reported.
568      *
569      * @param type Indicates the file split type. For details, see {@link FileSplitType}.
570      * @param timestamp Indicates the file split timestamp. This parameter is not supported currently and can be set to
571      * <b>-1</b>. The recording module splits a file based on the call time.
572      * @param duration Indicates the duration for splitting the file.
573      * @return Returns {@link SUCCESS} if the video is manually split; returns an error code defined
574      * in {@link media_errors.h} otherwise.
575      * @since 1.0
576      * @version 1.0
577      */
578     virtual int32_t SetFileSplitDuration(FileSplitType type, int64_t timestamp, uint32_t duration) = 0;
579 
580     /**
581      * @brief Sets an extended parameter for recording, for example, {@link RECORDER_PRE_CACHE_DURATION}.
582      *
583      * @param sourceId Indicates the data source ID. The value <b>-1</b> indicates all sources.
584      * @param format Indicates the string key and value. For details, see {@link Format} and
585      * {@link RECORDER_PRE_CACHE_DURATION}.
586      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
587      * in {@link media_errors.h} otherwise.
588      * @since 1.0
589      * @version 1.0
590      */
591     virtual int32_t SetParameter(int32_t sourceId, const Format &format) = 0;
592 
593     virtual int32_t GetAVRecorderConfig(ConfigMap &configMap) = 0;
594 
595     virtual int32_t GetLocation(Location &location) = 0;
596 
597     virtual int32_t GetCurrentCapturerChangeInfo(AudioRecorderChangeInfo &changeInfo) = 0;
598 
599     virtual int32_t GetAvailableEncoder(std::vector<EncoderCapabilityData> &encoderInfo) = 0;
600 
601     virtual int32_t GetMaxAmplitude() = 0;
602 
603     /**
604      * @brief Custom parameter
605      *
606      * @param userMeta The user Custom Parameters
607      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
608      * in {@link media_errors.h} otherwise.
609     */
610     virtual int32_t SetUserCustomInfo(Meta &userCustomInfo) = 0;
611 
612     /**
613      * @brief genre
614      *
615      * @param genre genre
616      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
617      * in {@link media_errors.h} otherwise.
618     */
619     virtual int32_t SetGenre(std::string &genre) = 0;
620 
621     /**
622      * @brief Check if the avrecorder has watermark capability.
623      *
624      * @param isWatermarkSupported
625      * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined
626      * in {@link media_errors.h} otherwise.
627     */
628     virtual int32_t IsWatermarkSupported(bool &isWatermarkSupported) = 0;
629 
630     virtual int32_t SetWatermark(std::shared_ptr<AVBuffer> &waterMarkBuffer) = 0;
631 
632     virtual int32_t SetUserMeta(const std::shared_ptr<Meta> &userMeta) = 0;
633     virtual int32_t SetWillMuteWhenInterrupted(bool muteWhenInterrupted) = 0;
634     virtual int32_t TransmitQos(QOS::QosLevel level) = 0;
635 };
636 } // namespace Media
637 } // namespace OHOS
638 #endif // I_RECORDER_SERVICE_H
639