CAF state bug fix
[platform/framework/native/media.git] / src / FMedia_Mpeg4Encoder.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_Mpeg4Encoder.h
20  *  @brief  This is the header file for the _Mpeg4Encoder.
21  *
22  *  This header file contains the declarations of the Tizen::Media::_Mpeg4Encoder.
23  */
24 #ifndef FMEDIA_INTERNAL_MPEG4ENCODER_H_
25 #define FMEDIA_INTERNAL_MPEG4ENCODER_H_
26
27
28 namespace Tizen { namespace Media
29 {
30
31 class _Mpeg4Encoder
32         : public _IVideoEncoder
33 {
34 public:
35         _Mpeg4Encoder(void);
36
37         virtual ~_Mpeg4Encoder(void);
38
39 public:
40         virtual result Construct(const Tizen::Base::Collection::HashMap* pOption = null);
41
42         virtual result Encode(const byte* srcBuf, int& srcBufLength, byte*& dstBuf, int& dstBufLength);
43
44         virtual result Reset(void);
45
46         virtual result SetValue(MediaPropertyType key, int value);
47
48         virtual result SetValue(MediaPropertyType key, bool value);
49
50         virtual Tizen::Base::Collection::IListT<MediaPropertyType>* GetSupportedPropertyListN(void) const;
51
52         virtual bool IsPropertySupported(MediaPropertyType type) const;
53
54 private:
55         _Mpeg4Encoder(const _Mpeg4Encoder&);
56
57         _Mpeg4Encoder& operator =(const _Mpeg4Encoder&);
58
59 private:
60         static const int HEIGHT = 144;
61         static const int WIDTH = 176;
62         static const int MAX_WIDTH = 800;
63         static const int MAX_HEIGHT = 600;
64         static const int MAX_FRAME_RATE = 30;
65         static const int QUANTISATION_PARAMETER = 30;
66         static const int GOP = 10;
67         // (bytes per second = bitrate * 1000 / 8) intermediate bit rate around 320 kbps
68         static const int BITRATE_IN_BITS = 64 * 1000;
69         static const int FRAME_RATE = 20;
70         static const int MIN_QP = 1;
71         static const int MAX_QP = 31;
72         static const int INTERNAL_BUFFER_COUNT = 0;
73
74         AVCodecContext* __pCodecCtx;
75         AVCodec* __pCodec;
76         AVFrame* __pFrame;
77         bool __firstFrame;
78 };
79
80 };
81 };
82
83
84 #endif // FMEDIA_INTERNAL_MPEG4ENCODER_H_