TizenRT Public API  v2.0 M2
MediaRecorder.h
Go to the documentation of this file.
1 /* ****************************************************************
2  *
3  * Copyright 2018 Samsung Electronics All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  ******************************************************************/
18 
30 #ifndef __MEDIA_MEDIARECORDER_H
31 #define __MEDIA_MEDIARECORDER_H
32 
33 #include <memory>
34 #include <media/OutputDataSource.h>
36 
37 namespace media {
38 
39 class MediaRecorderImpl;
40 
46 enum recorder_error_e : int {
49  RECORDER_ERROR_INVALID_STATE,
50  RECORDER_ERROR_INVALID_OPERATION,
51  RECORDER_ERROR_INVALID_PARAM,
52  RECORDER_ERROR_INTERNAL_OPERATION_FAILED,
53  RECORDER_ERROR_FILE_OPEN_FAILED,
54  RECORDER_ERROR_OUT_OF_MEMORY,
55  RECORDER_ERROR_DEVICE_NOT_SUPPORTED,
58 };
59 
60 typedef enum recorder_error_e recorder_error_t;
61 const int RECORDER_OK = RECORDER_ERROR_NONE;
62 typedef int recorder_result_t;
63 
71 {
72 public:
78  MediaRecorder();
79 
86 
94  recorder_result_t create();
95 
103  recorder_result_t destroy();
104 
112  recorder_result_t prepare();
113 
121  recorder_result_t unprepare();
122 
131  recorder_result_t start();
132 
141  recorder_result_t pause();
142 
151  recorder_result_t stop();
152 
160  recorder_result_t getVolume(uint8_t *vol);
161 
170  recorder_result_t setVolume(uint8_t vol);
171 
180  recorder_result_t setDataSource(std::unique_ptr<stream::OutputDataSource> dataSource);
181 
191  recorder_result_t setObserver(std::shared_ptr<MediaRecorderObserverInterface> observer);
192 
203  recorder_result_t setDuration(int second);
204 
213  bool operator==(const MediaRecorder& rhs);
214 
215 private:
216  std::shared_ptr<MediaRecorderImpl> mPMrImpl;
217  uint64_t mId;
218 };
219 } // namespace media
220 
221 #endif
222  // end of MEDIA group
recorder_result_t create()
Create MediaRecorder for capturing.
bool operator==(const MediaRecorder &rhs)
MediaRecorder operator==.
recorder_result_t setDuration(int second)
Set limitation of recording time by given value(second), will be stopped when it reaches that...
recorder_result_t setVolume(uint8_t vol)
Sets the volume adjusted.
recorder_result_t setDataSource(std::unique_ptr< stream::OutputDataSource > dataSource)
Sets the DataSource of output data.
recorder_result_t pause()
Pause recording.
recorder_result_t setObserver(std::shared_ptr< MediaRecorderObserverInterface > observer)
Sets the observer of MediaRecorder.
Media OutputDataSource APIs.
recorder_result_t destroy()
Destroy MediaRecorder.
recorder_result_t getVolume(uint8_t *vol)
Gets the current volume.
recorder_result_t prepare()
Allocate and prepare resources related to the recorder, it should be called before start...
recorder_result_t stop()
Stop recording.
MediaRecorder()
Constructs an empty MediaRecorder.
Media MediaRecorderObserverInterface APIs.
recorder_error_e
result of call the apis
Definition: MediaRecorder.h:46
recorder_result_t unprepare()
Releases allocated resources related to the recorder.
~MediaRecorder()
Deconstructs an empty MediaRecorder.
recorder_result_t start()
Start recording.