Merge "seek expection handling bug" into tizen_2.2
[platform/framework/native/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 <FGrpDimension.h>
29 #include <FMediaTypes.h>
30 #include <FMediaCameraTypes.h>
31 #include <FMediaRecorderTypes.h>
32 #include <FMediaAudioTypes.h>
33 #include "FMedia_CameraTypes.h"
34
35 namespace Tizen { namespace Media
36 {
37 /**
38 * @class        _RecorderUtil
39 * @brief        This class is utility for recorder functionality.
40 *
41 */
42 class _RecorderUtil
43         : public Tizen::Base::Object
44 {
45 public:
46
47         static result GetMmAudioCodec(CodecType value, recorder_audio_codec_e& mmAttr);
48         static result GetOspAudioCodec(recorder_audio_codec_e mmAttr, CodecType& value);
49         static result GetMmVideoCodec(CodecType value, recorder_video_codec_e& mmAttr);
50         static result GetOspVideoCodec(recorder_video_codec_e mmAttr, CodecType& value);
51         static result GetMmFileFormat(MediaContainerType value, recorder_file_format_e& mmAttr);
52         static result GetOspVideoContainer(recorder_file_format_e mmAttr, MediaContainerType& value);
53         static result GetOspAudioContainer(recorder_file_format_e mmAttr, MediaContainerType& value);
54
55         static result GetMmAudioQuality(CodecType audioCodec, RecordingQuality quality, int& mmAttrSamplerate, int& mmAttrChannel, int& mmAttrBitrate);
56         static result GetMmVideoQuality(const Tizen::Graphics::Dimension& dim, RecordingQuality quality, int& mmAttrBitrate);
57
58         static result GetMmRotation(RecordingRotation value, recorder_rotation_e& mmAttr);
59         static result GetOspRotation(recorder_rotation_e mmAttr, RecordingRotation& value);
60
61         static result GetRecorderRotation(CameraRotation cameraRotation, RecordingRotation& recorderRotation);
62         static result GetCameraRotation(RecordingRotation recorderRotation, CameraRotation& cameraRotation);
63
64         static bool CheckFormat(CodecType audioCodec, CodecType videoCodec, MediaContainerType container);
65         static result PrepareFile(const Tizen::Base::String &path, bool overwrite);
66         static AudioSampleType GetOspSampleType(audio_sample_type_e audioSampleType);
67         static AudioChannelType GetOspChannelType(int audioChannelType);
68         static int ConvertAudioSampleTypeToInt(AudioSampleType sampleType);
69         static int CalculateSampleRate(int size, int channel, int timeStamp, AudioSampleType sampleType);
70
71 private:
72         _RecorderUtil(void);
73         ~_RecorderUtil(void);
74
75         _RecorderUtil(const _RecorderUtil& rhs);
76         _RecorderUtil& operator =(const _RecorderUtil& rhs);
77 };
78
79 }}
80
81 #endif