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 _AUDIO_DECODER_FORM_H_
19 #define _AUDIO_DECODER_FORM_H_
21 namespace MediaAppAudioDecoder
41 CODEC_TYPE_CODEC_UNKNOWN,
44 // const values for buttons
45 const int PREV_INDEX = 0;
46 const int NEXT_INDEX = 1;
47 const int ID_BACK = 100;
48 const int ID_PREV = 101;
49 const int ID_NEXT = 102;
50 const int ID_DECODE = 103;
51 const int ID_PLAY = 104;
52 // Sufficeient buffer size
53 const int SRC_BUF_SIZE = 1024 * 16;
54 const int DST_BUF_SIZE = 1024 * 16 * 15;
55 const int MAX_PERCENT_COUNT = 100;
56 const int MIN_PERCENT_COUNT = 0;
57 const int PROGRESS_TIMER_DURATION = 1000;
58 const int DEFAULT_VOLUME_LEVEL = 50;
59 const int DEFAULT_SAMPLE_RATE = 44100;
60 const int DEFAULT_BIT_RATE = 64000;
61 const int WAIT_FOR_THREAD_EXIT = 150;
62 const int startPosion = 0;
63 const int DEFAULT_STACK_SIZE = 64 * 1024;
65 const int DECODE_UPDATE_TIMEOUT = 50;
66 const int DATA_READ_THREAD_WAIT_PERIOD = 50;
67 const int MINIMUM_MP3_THRESHOLD_SIZE = 100;
71 class AudioDecoderForm
73 , public Osp::Ui::Controls::IFrameEventListener
74 , public Osp::Ui::IKeyEventListener
75 , public Osp::Base::Runtime::ITimerEventListener
80 AudioDecoderForm(void);
81 virtual ~AudioDecoderForm(void);
82 bool Initialize(void);
85 virtual result OnInitializing(void);
86 virtual result OnTerminating(void);
87 virtual result OnActivate(void* activateParam);
88 virtual void OnActionPerformed(const Osp::Ui::Control& source, int actionId);
89 void OnUserEventReceivedN(RequestId requestId, Osp::Base::Collection::IList* pArgs);
90 void EditResultValue(Osp::Base::String& r);
91 result StartAudioDecoding();
92 void GetPathFromConfig(void);
93 void SetFooterText(void);
94 void EditFileName(int samplerate, int channeltype, int curPos, int finalPos);
95 void SetDefault(void);
96 MediaAppAudioDecoder::AudioCodecType GetCodecFromCodecStringName(Osp::Base::String codecName);
97 virtual void OnBackground(void);
98 virtual void OnForeground(void);
99 void OnFormBackRequested(Osp::Ui::Controls::Form& source);
100 void EnableSelectedSoftKey();
101 virtual void OnFrameTerminating(const Osp::Ui::Controls::Frame& source);
102 virtual void OnKeyPressed(const Control& source, Osp::Ui::KeyCode keyCode);
103 virtual void OnKeyReleased(const Control& source, Osp::Ui::KeyCode keyCode);
104 virtual void OnKeyLongPressed(const Control& source, Osp::Ui::KeyCode keyCode);
105 virtual void OnTimerExpired(Osp::Base::Runtime::Timer& timer);
106 void ShowError(result r, const char* pMethod, const char* pSrcfileName, int lineNo);
107 void ContinueAudioDecoding();
118 Osp::Ui::Controls::Progress* __pProgressBar;
119 Osp::Ui::Controls::EditArea* __pEditFileInformations;
120 Osp::Base::String __filename;
121 Osp::Base::String __filePath;
122 int __configFileCount;
123 Osp::Base::String __audioCodecString;
126 bool __stopDecodeTrigger;
127 bool __onBakgroundCalled;
128 volatile bool __appTerminating;
129 PlayState __curState;
130 MediaAppAudioDecoder::AudioCodecType __audioCodecType;
132 bool __showErrorCalled;
133 Osp::Base::ByteBuffer* __pSrcBuf;
134 Osp::Base::ByteBuffer* __pDstBuf;
135 Osp::Media::AudioDecoder* __pDec;
137 Osp::Io::File __destFile;
138 Osp::Base::Runtime::Timer __updateTimer;
140 Osp::Security::Crypto::Md5Hash* __pMD5; /*MD5 Changes*/
141 Osp::Base::ByteBuffer* __pMD5Result;
144 Osp::Base::Collection::HashMapT< MediaAppAudioDecoder::AudioCodecType, CodecType > __codecMap;
149 #endif //_AUDIO_DECODER_FORM_H_