3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.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
9 // http://www.tizenopensource.org/license
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.
18 #ifndef _VIDEO_ENCODER_FORM_H_
19 #define _VIDEO_ENCODER_FORM_H_
21 namespace MediaAppVideoEncoder
27 CODEC_TYPE_CODEC_UNKNOWN
38 //cosnt values for buttons
39 const int PREV_INDEX = 0;
40 const int NEXT_INDEX = 1;
41 const int ID_BACK = 100;
42 const int ID_PREV = 101;
43 const int ID_NEXT = 102;
44 const int ID_ENCODE = 103;
45 const int ID_PLAY = 104;
46 //sufficient buffer size
47 const int SRC_BUF_SIZE = 1024 * 500;
48 const int DST_BUF_SIZE = 1024 * 500;
49 const int MAX_PERCENT_COUNT = 100;
50 const int MIN_PERCENT_COUNT = 0;
51 const int PROGRESS_TIMER_DURATION = 1000;
52 const int DEFAULT_VOLUME_LEVEL = 50;
53 const int WAIT_FOR_EVENT_PROCESSING = 20;
55 const int QUANT_MIN = 1;
56 const int QUANT_MAX = 31;
60 class VideoEncoderForm
62 , public Osp::Ui::IKeyEventListener
63 , public Osp::Base::Runtime::ITimerEventListener
67 VideoEncoderForm(void);
68 virtual ~VideoEncoderForm(void);
69 bool Initialize(void);
72 virtual result OnInitializing(void);
73 virtual result OnTerminating(void);
74 virtual result OnActivate(void* activateParam);
75 virtual void OnActionPerformed(const Osp::Ui::Control& source, int actionId);
76 void OnUserEventReceivedN(RequestId requestId, Osp::Base::Collection::IList* pArgs);
77 void OnFormBackRequested(Osp::Ui::Controls::Form& source);
78 virtual void OnBackground(void);
79 virtual void OnForeground(void);
80 result StartVideoEncoding();
81 void GetPathFromConfFile(void);
82 void EditFileName(int height, int width, int curPos, int finalPos);
83 void SetDefault(void);
84 result DisplayFrame(bool showDisplay, Osp::Base::ByteBuffer* pBuffer = null);
85 void EditResultValue(Osp::Base::String& r);
86 MediaAppVideoEncoder::VideoCodecType GetCodecFromCodecStringName(Osp::Base::String codecName);
87 result FillBufferFromFile(Osp::Io::File* fp, Osp::Base::ByteBuffer* pBuffer);
88 void EnableSelectedSoftKey();
89 result ShowEmptyFrame();
90 virtual void OnKeyPressed(const Control& source, Osp::Ui::KeyCode keyCode);
91 virtual void OnKeyReleased(const Control& source, Osp::Ui::KeyCode keyCode);
92 virtual void OnKeyLongPressed(const Control& source, Osp::Ui::KeyCode keyCode);
93 virtual void OnTimerExpired(Osp::Base::Runtime::Timer& timer);
94 void ShowError(result r, const char* pMethod, const char* pSrcfileName, int lineNo);
95 int ContinueEncoding();
105 Osp::Ui::Controls::Progress* __pProgressBar;
106 Osp::Ui::Controls::OverlayRegion* __pOverlayRegion;
107 Osp::Ui::Controls::EditArea* __pEditFileInformations;
108 Osp::Base::String __filename;
109 Osp::Base::String __codecTypeString;
110 Osp::Base::String __filePath;
111 int __configFileCount;
117 Osp::Base::ByteBuffer* __pSrcBuf;
118 Osp::Base::ByteBuffer* __pDstBuf;
120 bool __stopEncodeTrigger;
122 bool __onBakgroundCalled;
124 bool __showErrorCalled;
125 PlayState __curState;
126 MediaAppVideoEncoder::VideoCodecType __codecType;
128 bool __appTerminating;
129 Osp::Media::VideoEncoder* __pEnc;
130 Osp::Io::File __outputFile;
131 Osp::Io::File* __pSrcFile;
132 Osp::Base::Runtime::Timer __wakeUpTimer;
134 // Encoding Option Parameters
149 #endif //_VIDEO_ENCODER_FORM_H_