2b14bdac8f16df5ee45523cf752f4b6d475e16eb
[framework/osp/media.git] / src / FMedia_RecorderUtil.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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 /**
19  * @file                        FMedia_RecorderUtil.h
20  * @brief                       This header file contains the declarations of the utility fuctions of recorder.
21  *
22  */
23
24 #ifndef _FMEDIA_INTERNAL_RECORDER_UTIL_H_
25 #define _FMEDIA_INTERNAL_RECORDER_UTIL_H_
26
27 #include <recorder.h>
28 #include <FMediaTypes.h>
29 #include <FMediaCameraTypes.h>
30 #include <FMediaRecorderTypes.h>
31 #include <FMediaAudioTypes.h>
32 #include "FMedia_CameraTypes.h"
33
34 namespace Tizen { namespace Media
35 {
36 /**
37 * @class        _RecorderUtil
38 * @brief        This class is utility for recorder functionality.
39 *
40 */
41 class _RecorderUtil
42         : public Tizen::Base::Object
43 {
44 public:
45
46         static result GetMmAudioCodec(CodecType value, recorder_audio_codec_e& mmAttr);
47         static result GetOspAudioCodec(recorder_audio_codec_e mmAttr, CodecType& value);
48         static result GetMmVideoCodec(CodecType value, recorder_video_codec_e& mmAttr);
49         static result GetOspVideoCodec(recorder_video_codec_e mmAttr, CodecType& value);
50         static result GetMmFileFormat(MediaContainerType value, recorder_file_format_e& mmAttr);
51         static result GetOspVideoContainer(recorder_file_format_e mmAttr, MediaContainerType& value);
52         static result GetOspAudioContainer(recorder_file_format_e mmAttr, MediaContainerType& value);
53
54         static result GetMmAudioQuality(CodecType audioCodec, RecordingQuality quality, int& mmAttrSamplerate, int& mmAttrChannel, int& mmAttrBitrate);
55         static result GetMmVideoQuality(_ResolutionType resolution, RecordingQuality quality, int& mmAttrBitrate);
56
57         static result GetMmRotation(RecordingRotation value, recorder_rotation_e& mmAttr);
58         static result GetOspRotation(recorder_rotation_e mmAttr, RecordingRotation& value);
59
60         static result GetRecorderRotation(CameraRotation cameraRotation, RecordingRotation& recorderRotation);
61         static result GetCameraRotation(RecordingRotation recorderRotation, CameraRotation& cameraRotation);
62
63         static bool CheckFormat(CodecType audioCodec, CodecType videoCodec, MediaContainerType container);
64         static result PrepareFile(const Tizen::Base::String &path, bool overwrite);
65         static AudioSampleType GetOspSampleType(audio_sample_type_e audioSampleType);
66         static AudioChannelType GetOspChannelType(int audioChannelType);
67         static int ConvertAudioSampleTypeToInt(AudioSampleType sampleType);
68         static int CalculateSampleRate(int size, int channel, int timeStamp, AudioSampleType sampleType);
69
70 private:
71         _RecorderUtil(void);
72         ~_RecorderUtil(void);
73
74         _RecorderUtil(const _RecorderUtil& rhs);
75         _RecorderUtil& operator =(const _RecorderUtil& rhs);
76 };
77
78 }}
79
80 #endif