merge commits of 2.2.1 to public
[platform/framework/native/media.git] / inc / FMediaIAudioInEventListener.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        FMediaIAudioInEventListener.h
20  * @brief       This is the header file for the %IAudioInEventListener interface.
21  *
22  * This header file contains the declarations of the %IAudioInEventListener interface.
23  */
24
25 #ifndef _FMEDIA_IAUDIO_IN_EVENT_LISTENER_H_
26 #define _FMEDIA_IAUDIO_IN_EVENT_LISTENER_H_
27
28 #include <FBaseRtIEventListener.h>
29 #include <FBaseByteBuffer.h>
30
31 namespace Tizen { namespace Media
32 {
33
34 /**
35  * @interface   IAudioInEventListener
36  * @brief               This interface represents a listener that receives the %AudioIn related events.
37  *
38  * @since               2.0
39  *
40  * @remarks             The OnAudioInInterrupted() method is called when an application is interrupted by another application, and the OnAudioInReleased() method is called at the end of this interruption.
41  *                              The OnAudioInAudioFocusChanged() method is called when an application is interrupted by another application, but the end of this interruption is not notified.
42  *                              So, an application must handle both the events accordingly when audio switching occurs between various applications.
43  *
44  *
45  * The %IAudioInEventListener interface provides various methods that are called during the operations of AudioIn.
46  * %AudioIn captures audio data from a device in the asynchronous mode,
47  * and calls the listener's methods to pass the captured audio data.
48  *
49  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/media/recording_pcm_audio.htm">Recording PCM Audio</a>.
50  *
51  */
52
53 class _OSP_EXPORT_ IAudioInEventListener
54         : virtual public Tizen::Base::Runtime::IEventListener
55 {
56
57 public:
58    /**
59         * This polymorphic destructor should be overridden if required. @n
60         * This way, the destructors of the derived classes are called when the destructor of this interface is called.
61         *
62         * @since                2.0
63         */
64         virtual ~IAudioInEventListener(void) {}
65
66    /**
67         * Called when the device has filled up a buffer with PCM data completely.
68         *
69         * @since                2.0
70         *
71         * @param[in]  pData             A pointer to the buffer that contains the filled data @n
72         *                                               The data address is same as the address added by AudioIn::AddBuffer().
73         */
74         virtual void OnAudioInBufferIsFilled(Tizen::Base::ByteBuffer* pData) = 0;
75
76    /**
77         * Called when an input device is interrupted by a task of higher priority than AudioIn.
78         *
79         * @since                2.0
80         */
81         virtual void OnAudioInInterrupted(void) = 0;
82
83    /**
84         * Called when an interrupted input device is released.
85         *
86         * @since                2.0
87         */
88         virtual void OnAudioInReleased(void) = 0;
89
90    /**
91         * Called when the audio recording focus is changed to another application.
92         *
93         * @since                2.0
94         * @remarks              
95         *                               - After the audio focus is changed, the recording is stopped and the state of this instance is changed to ::AUDIOIN_STATE_STOPPED.
96         *                               - User interaction with the device is required for an application in the ::AUDIOIN_STATE_STOPPED state to resume recording. 
97         *                                 This is to avoid the occurrence of a race condition among applications that try to resume without user interaction.
98         *                               - An application cannot start recording again even in the ::AUDIOIN_STATE_STOPPED state due to other applications which have a higher priority.
99         */
100
101         virtual void OnAudioInAudioFocusChanged(void) {}
102 protected:
103         //
104         // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
105         //
106         // This method is reserved and may change its name at any time without prior notice.
107         //
108         // @since               2.0
109         //
110         virtual void IAudioInEventListener_Reserved1(void){}
111
112         //
113         // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
114         //
115         // This method is reserved and may change its name at any time without prior notice.
116         //
117         // @since               2.0
118         //
119         virtual void IAudioInEventListener_Reserved2(void){}
120 };
121
122 }} // Tizen::Media
123
124 #endif