Skip drain when stream is not started yet
[platform/core/api/audio-io.git] / include / CPulseAudioClient.h
index 86ae2ed..13b4a1a 100644 (file)
@@ -22,7 +22,6 @@
 
 
 #include <pulse/pulseaudio.h>
-#include <pulse/ext-policy.h>
 
 
 namespace tizen_media_audio {
@@ -51,30 +50,31 @@ namespace tizen_media_audio {
         ~CPulseAudioClient();
 
         /* Implemented Methods */
-        void initialize() throw (CAudioError);
+        void initialize();
         void finalize();
 
         /* Methods */
-        int  peek(const void** data, size_t* length) throw (CAudioError);
-        int  drop() throw (CAudioError);
-        int  write(const void* data, size_t length) throw (CAudioError);
+        int read(void* buffer, size_t length);
+        int peek(const void** buffer, size_t* length);
+        int drop();
+        int write(const void* buffer, size_t length);
 
-        void cork(bool cork) throw (CAudioError);
-        bool isCorked() throw (CAudioError);
+        void cork(bool cork);
+        bool isCorked();
 
-        bool drain() throw (CAudioError);
-        bool flush() throw (CAudioError);
+        bool drain();
+        bool flush();
 
-        void checkRunningState() throw (CAudioError);
-        bool isInThread() throw (CAudioError);
+        void checkRunningState();
+        bool isInThread();
 
-        size_t getWritableSize() throw (CAudioError);
-        size_t getReadableSize() throw (CAudioError);
+        size_t getWritableSize();
+        size_t getReadableSize();
 
-        size_t getBufferSize() throw (CAudioError);
+        size_t getBufferSize();
 
-        pa_usec_t getLatency() throw (CAudioError);
-        pa_usec_t getFinalLatency() throw (CAudioError);
+        pa_usec_t getLatency();
+        pa_usec_t getFinalLatency();
 
         /* Setter & Getter */
         EStreamDirection getStreamDirection();
@@ -94,6 +94,14 @@ namespace tizen_media_audio {
         bool                  __mIsInit;
         bool                  __mIsOperationSuccess;
 
+        const void*           __mpSyncReadDataPtr;
+        size_t                __mSyncReadIndex;
+        size_t                __mSyncReadLength;
+        bool                  __mIsUsedSyncRead;
+        bool                  __mIsFirstStream;
+        bool                  __mIsDraining;
+        bool                  __mIsStarted;
+
         /* Static Methods */
 
         /* Private Method */
@@ -106,7 +114,12 @@ namespace tizen_media_audio {
         static void __streamCaptureCb(pa_stream* s, size_t length, void* user_data);
         static void __streamPlaybackCb(pa_stream* s, size_t length, void* user_data);
         static void __streamLatencyUpdateCb(pa_stream* s, void* user_data);
+        static void __streamStartedCb(pa_stream* s, void* user_data);
+        static void __streamUnderflowCb(pa_stream* s, void* user_data);
+        static void __streamEventCb(pa_stream* s, const char *name, pa_proplist *pl, void *user_data);
         static void __successStreamCb(pa_stream* s, int success, void* user_data);
+        static void __successDrainCb(pa_stream* s, int success, void* user_data);
+        static void __successDrainCbInThread(pa_stream* s, int success, void* user_data);
     };