Tizen 2.0 Release
[framework/osp/media.git] / inc / FMediaIAudioOutEventListener.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                        FMediaIAudioOutEventListener.h
20  * @brief                       This is the header file for the %IAudioOutEventListener interface.
21  *
22  * This header file contains the declarations of the %IAudioOutEventListener interface.
23  */
24
25 #ifndef _FMEDIA_IAUDIO_OUT_EVENT_LISTENER_H_
26 #define _FMEDIA_IAUDIO_OUT_EVENT_LISTENER_H_
27
28 #include <FBaseRtIEventListener.h>
29
30 namespace Tizen { namespace Media
31 {
32 class AudioOut;
33 /**
34  * @interface   IAudioOutEventListener
35  * @brief                       This interface represents a listener that receives the AudioOut related events.
36  *
37  * @since               2.0
38  *
39  *  The %IAudioOutEventListener interface represents a listener that receives the AudioOut related events. The %AudioOut class works in asynchronous mode, and when the application plays audio data with the %AudioOut class,
40  *  the caller must implement this interface to receive an event from %AudioOut.
41  *
42  *  For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/media/playing_pcm_audio.htm">Playing PCM Audio</a>.
43  */
44
45 class _OSP_EXPORT_ IAudioOutEventListener
46         : virtual public Tizen::Base::Runtime::IEventListener
47 {
48
49 public:
50         /**
51         * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor of this interface is called.
52         *
53         * @since                2.0
54         */
55         virtual ~IAudioOutEventListener(void) {}
56
57         /**
58         *       Called when the device has written a buffer completely.
59         *
60         * @since                2.0
61         *
62         *       @param[in]      src     A pointer to the AudioOut instance that fired the event
63         */
64         virtual void OnAudioOutBufferEndReached(Tizen::Media::AudioOut& src) = 0;
65
66         /**
67          *      Called when the output device is interrupted by a task of higher priority than AudioOut.
68          *
69          * @since               2.0
70          *
71          *      @param[in]      src                                                     A pointer to the AudioOut instance that fired the event
72          */
73         virtual void OnAudioOutInterrupted(Tizen::Media::AudioOut& src) = 0;
74
75         /**
76          *      Called when the interrupted output device is released.
77          *
78          * @since               2.0
79          *
80          *      @param[in]      src                                                     A pointer to the AudioOut instance that fired the event
81          */
82         virtual void OnAudioOutReleased(Tizen::Media::AudioOut& src) = 0;
83
84         /**
85         *   Called when an audio playback focus is changed to another application.
86         *
87         *  @since               2.0
88         *
89         *  @param[in]   src             A pointer to the AudioOut instance that fired the event
90         *  @remarks             After the audio focus is being changed, the playback is stopped and the state of this instance is changed to AUDIOOUT_STATE_STOPPED.
91         *  @remarks             An application can start playback again in the state of AUDIOOUT_STATE_STOPPED but the interaction between device and user needs for starting again. Because there is a possibility of a race condition between applications which try to start without the interaction
92         *               @remarks                An application cannot start playback again even in the state of AUDIOOUT_STATE_STOPPED due to other applications which have a higher priority.
93         */
94         virtual void OnAudioOutAudioFocusChanged(Tizen::Media::AudioOut& src) {}
95 protected:
96         //
97         // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
98         //
99         // This method is reserved and may change its name at any time without prior notice.
100         //
101         // @since               2.0
102         //
103         virtual void IAudioOutEventListener_Reserved1(void){}
104
105         //
106         // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
107         //
108         // This method is reserved and may change its name at any time without prior notice.
109         //
110         // @since               2.0
111         //
112         virtual void IAudioOutEventListener_Reserved2(void){}
113
114 };
115
116 }} // Tizen::Media
117
118 #endif