2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file FMedia_UlawDecoder.h
20 * @brief This is the header file for the Tizen::Media::_UlawDecoder.
22 * This header file contains the declarations of the Tizen::Media::_UlawDecoder.
24 #ifndef _FMEDIA_INTERNAL_UlawDecoder_H_
25 #define _FMEDIA_INTERNAL_UlawDecoder_H_
28 namespace Tizen { namespace Media
31 // Generally fiel header + format sub chunk is 36 byte + data chunk header 8 bytes;
32 static const int _MIN_WAVE_HEADER_SIZE = 44;
33 static const unsigned int _RIFF_CHUNK_ID = 0x46464952; // 'RIFF'
34 static const unsigned int _RIFF_FORMAT_WAVE = 0x45564157; // 'WAVE'
35 static const unsigned int _WAVE_FORMAT_CHUNK_ID = 0x20746d66; // 'fmt '
36 static const unsigned int _WAVE_DATA_CHUNK_ID = 0x61746164; // 'data'
40 unsigned short formatTag;
41 unsigned short channels;
42 unsigned int samplesPerSec;
43 unsigned int avgBytesPerSec;
44 unsigned short blockAlign;
45 unsigned short bitsPerSample;
48 struct _RiffFileHeader
55 struct _RiffChunkHeader
62 : public _IAudioDecoder
67 virtual ~_UlawDecoder(void);
70 virtual result Construct(const Tizen::Base::Collection::HashMap* pOption = null);
72 virtual result Probe(const byte* srcBuf, const int length,
73 AudioSampleType& sampleType, AudioChannelType& channelType, int& sampleRate);
75 virtual result Decode(const byte* srcBuf, int srcBufSize, int &srcBufUsed,
76 byte* dstBuf, int dstBufSize, int &dstBufUsed);
78 virtual result Reset(void);
80 virtual result GetValue(MediaPropertyType type, int& value) const;
82 virtual result GetValue(MediaPropertyType type, float& value) const;
84 virtual Tizen::Base::Collection::IListT<MediaPropertyType>* GetSupportedPropertyListN(void) const;
86 virtual bool IsPropertySupported(MediaPropertyType type) const;
89 _UlawDecoder(const _UlawDecoder&);
91 _UlawDecoder& operator =(const _UlawDecoder&);
94 static const int OUT_BUFFER_SIZE = AVCODEC_MAX_AUDIO_FRAME_SIZE; // ffmpeg mandates this size as it checks with this size
95 static const int INPUT_BUFFER_PADDING_SIZE = 8;
96 static const int MONO_CHANNEL = 1;
97 static const int STEREO_CHANNEL = 2;
99 AVCodecContext* __pCodecCtx;
103 bool __decoderConfigured;
108 #endif // _FMEDIA_INTERNAL_UlawDecoder_H_