CAF state bug fix
[platform/framework/native/media.git] / src / FMedia_AudioStreamCoordinator.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_AudioStreamCoordinator.h
20  * @brief               This header file contains the declaration of the _AudioStreamCoordinator class.
21  */
22
23 #ifndef _FMEDIA_INTERNAL_AUDIO_STREAM_COORDINATOR_H_
24 #define _FMEDIA_INTERNAL_AUDIO_STREAM_COORDINATOR_H_
25
26 #include <FMediaAudioTypes.h>
27 #include "FMedia_CamPtrUtil.h"
28
29 namespace Tizen { namespace Media
30 {
31 class IAudioStreamFilter;
32
33 /**
34  * @class       _AudioStreamCoordinator
35  * @brief       This class coordinates the audio stream data
36  */
37
38 class _AudioStreamCoordinator
39         : public Tizen::Base::Object
40 {
41
42 public:
43         /**
44          * This is the default constructor for this class.
45          *
46          *
47          */
48         _AudioStreamCoordinator(void);
49
50         /**
51          * This is the destructor for this class. @n
52          * All allocated resources are deallocated by this method. This polymorphic destructor should be overridden if required.
53          * This way, the destructors of the derived classes are called when the destructor of this interface is called.
54          *
55          */
56         virtual ~_AudioStreamCoordinator(void);
57
58
59 public:
60         /**
61          * Constructs the instance of this class. @n
62          *
63          *
64          * @return          An error code
65          * @exception   E_SUCCESS       The method is successful.
66          *
67          */
68         result Construct(void);
69
70         /**
71         * Adds the stream filter to process the audio stream data while recording.
72         *
73         *
74         * @return               An error code
75         * @param[in]    filter                  An instance of IAudioStreamFilter
76         * @exception    E_SUCCESS                       The method is successful.
77         * @exception    E_OBJ_ALREADY_EXIST     The filter already exists.
78         * @exception    E_OUT_OF_MEMORY     The memory is insufficient.
79         */
80         result AddAudioStreamFilter(IAudioStreamFilter& filter);
81
82         /**
83         * Removes the stream filter to stop processing the audio stream data.
84         *
85         *
86         * @return               An error code
87         * @param[in]    filter                  An instance of IAudioStreamFilter
88         * @exception    E_SUCCESS                       The method is successful.
89         * @exception    E_OBJ_NOT_FOUND        The filter is not found.
90         */
91         result RemoveAudioStreamFilter(IAudioStreamFilter& filter);
92
93         /**
94         * Process the audio stream data and send to filter
95         *
96         *
97         * @return               An error code
98         * @param[in, out]       pStream         audio stream data
99         * @param[in]    size                            audio stream data size
100         * @param[in]    samplingRate            sampling rate in Hz
101         * @param[in]    channel                 audio channel
102         * @param[in]    sampleType              audio sample
103         * @exception    E_SUCCESS                       The method is successful.
104         */
105         result ProcessAudioStreamData(byte* pStream, int size, int samplingRate, AudioChannelType channel, AudioSampleType sampleType);
106
107         /**
108         * Return the count of the filter handle stored
109         *
110         * @return               count of filter handle
111         */
112         int GetFilterListCount(void) const;
113
114 private:
115
116         std::unique_ptr <Tizen::Base::Collection::ArrayListT< IAudioStreamFilter*>, _ListPtrUtil::Remover> __pStreamFilterList;
117 };
118
119 }}// Tizen::Media
120
121 #endif