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_VorbisDecoder.h
20 * @brief This is the header file for the _VorbisDecoder.
22 * This header file contains the declarations of the Tizen::Media::_VorbisDecoder.
24 #ifndef _FMEDIA_INTERNAL_VORBISDECODER_H_
25 #define _FMEDIA_INTERNAL_VORBISDECODER_H_
27 #include "FMedia_IAudioDecoder.h"
29 namespace Tizen { namespace Media
35 : public Tizen::Media::_IAudioDecoder
40 virtual ~_VorbisDecoder(void);
43 virtual result Construct(const Tizen::Base::Collection::HashMap* pOption = null);
45 virtual result Probe(const byte* srcBuf, const int length, Tizen::Media::AudioSampleType& sampleType, Tizen::Media::AudioChannelType& channelType, int& sampleRate);
47 virtual result Decode(const byte* srcBuf, int srcBufSize, int &srcBufUsed,
48 byte* dstBuf, int dstBufSize, int& dstBufUsed);
50 virtual result Reset(void);
52 virtual result GetValue(MediaPropertyType type, int& value) const;
54 virtual result GetValue(MediaPropertyType type, float& value) const;
56 virtual Tizen::Base::Collection::IListT<MediaPropertyType>* GetSupportedPropertyListN(void) const;
58 virtual bool IsPropertySupported(MediaPropertyType type) const;
61 result ParseOggStream(void);
63 result SetStreamHeader(void);
65 _VorbisDecoder(const _VorbisDecoder&);
67 _VorbisDecoder& operator =(const _VorbisDecoder&);
70 static const int PAGE_SIZE = 4096;
71 static const int DEFAULT_BUFFER_SIZE = 8192 * 2;
72 static const int HEADER_COUNT = 3;
74 vorbis_dsp_state __vorbisState;
75 vorbis_info __vorbisInfo;
76 vorbis_comment __vorbisComment;
77 vorbis_block __vorbisBlock;
79 bool __isHeaderDecoded;
80 ogg_sync_state __state;
81 Tizen::Base::Collection::HashMapT<int, _OggStream*> __streamMap;
82 _OggStream* __pStream;
85 int __maxOffsetLength;
91 #endif // _FMEDIA_INTERNAL_VORBISDECODER_H_