Change set_stream_info API name for consistency with other pkgs
[platform/core/api/audio-io.git] / include / audio_io.h
index 5d586f4..ef82ef6 100644 (file)
@@ -22,8 +22,7 @@
 #include <sound_manager.h>
 
 #ifdef __cplusplus
-extern "C"
-{
+extern "C" {
 #endif
 
 /**
@@ -70,10 +69,9 @@ typedef struct audio_io_s *audio_out_h;
  * @brief Enumeration for audio sample type with bit depth.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
-typedef enum
-{
-    AUDIO_SAMPLE_TYPE_U8 = 0x70,    /**< Unsigned 8-bit audio samples */
-    AUDIO_SAMPLE_TYPE_S16_LE,       /**< Signed 16-bit audio samples */
+typedef enum {
+       AUDIO_SAMPLE_TYPE_U8 = 0x70,    /**< Unsigned 8-bit audio samples */
+       AUDIO_SAMPLE_TYPE_S16_LE,       /**< Signed 16-bit audio samples */
 } audio_sample_type_e;
 
 /**
@@ -81,38 +79,38 @@ typedef enum
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 typedef enum {
-    AUDIO_CHANNEL_MONO = 0x80,                  /**< 1 channel, mono */
-    AUDIO_CHANNEL_STEREO,                       /**< 2 channel, stereo */
+       AUDIO_CHANNEL_MONO = 0x80,                  /**< 1 channel, mono */
+       AUDIO_CHANNEL_STEREO,                       /**< 2 channel, stereo */
 } audio_channel_e;
 
 /**
  * @brief Enumeration for audio input and output state.
  * @since_tizen 3.0
  */
-typedef enum
-{
-    AUDIO_IO_STATE_IDLE,      /**< Audio-io handle is created, but not prepared */
-    AUDIO_IO_STATE_RUNNING,   /**< Audio-io handle is ready and the stream is running */
-    AUDIO_IO_STATE_PAUSED,    /**< Audio-io handle is ready and the stream is paused */
+typedef enum {
+       AUDIO_IO_STATE_IDLE,      /**< Audio-io handle is created, but not prepared */
+       AUDIO_IO_STATE_RUNNING,   /**< Audio-io handle is ready and the stream is running */
+       AUDIO_IO_STATE_PAUSED,    /**< Audio-io handle is ready and the stream is paused */
 } audio_io_state_e;
 
 /**
  * @brief Enumeration for audio input and output error.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
-typedef enum{
-    AUDIO_IO_ERROR_NONE                = TIZEN_ERROR_NONE,              /**< Successful */
-    AUDIO_IO_ERROR_OUT_OF_MEMORY       = TIZEN_ERROR_OUT_OF_MEMORY,     /**< Out of memory */
-    AUDIO_IO_ERROR_INVALID_PARAMETER   = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
-    AUDIO_IO_ERROR_INVALID_OPERATION   = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
-    AUDIO_IO_ERROR_PERMISSION_DENIED   = TIZEN_ERROR_PERMISSION_DENIED, /**< Device open error by security */
-    AUDIO_IO_ERROR_NOT_SUPPORTED       = TIZEN_ERROR_NOT_SUPPORTED,     /**< Not supported */
-    AUDIO_IO_ERROR_DEVICE_NOT_OPENED   = TIZEN_ERROR_AUDIO_IO | 0x01,   /**< Device open error */
-    AUDIO_IO_ERROR_DEVICE_NOT_CLOSED   = TIZEN_ERROR_AUDIO_IO | 0x02,   /**< Device close error */
-    AUDIO_IO_ERROR_INVALID_BUFFER      = TIZEN_ERROR_AUDIO_IO | 0x03,   /**< Invalid buffer pointer */
-    AUDIO_IO_ERROR_SOUND_POLICY        = TIZEN_ERROR_AUDIO_IO | 0x04,   /**< Sound policy error */
-    AUDIO_IO_ERROR_INVALID_STATE       = TIZEN_ERROR_AUDIO_IO | 0x05,   /**< Invalid state (Since 3.0) */
-    AUDIO_IO_ERROR_NOT_SUPPORTED_TYPE  = TIZEN_ERROR_AUDIO_IO | 0x06,   /**< Not supported stream type (Since 3.0) */
+typedef enum {
+       AUDIO_IO_ERROR_NONE                = TIZEN_ERROR_NONE,              /**< Successful */
+       AUDIO_IO_ERROR_OUT_OF_MEMORY       = TIZEN_ERROR_OUT_OF_MEMORY,     /**< Out of memory */
+       AUDIO_IO_ERROR_INVALID_PARAMETER   = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+       AUDIO_IO_ERROR_INVALID_OPERATION   = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
+       AUDIO_IO_ERROR_PERMISSION_DENIED   = TIZEN_ERROR_PERMISSION_DENIED, /**< Device open error by security */
+       AUDIO_IO_ERROR_NOT_SUPPORTED       = TIZEN_ERROR_NOT_SUPPORTED,     /**< Not supported */
+       AUDIO_IO_ERROR_DEVICE_POLICY_RESTRICTION = TIZEN_ERROR_DEVICE_POLICY_RESTRICTION, /**< Device policy restriction (Since 3.0) */
+       AUDIO_IO_ERROR_DEVICE_NOT_OPENED   = TIZEN_ERROR_AUDIO_IO | 0x01,   /**< Device open error */
+       AUDIO_IO_ERROR_DEVICE_NOT_CLOSED   = TIZEN_ERROR_AUDIO_IO | 0x02,   /**< Device close error */
+       AUDIO_IO_ERROR_INVALID_BUFFER      = TIZEN_ERROR_AUDIO_IO | 0x03,   /**< Invalid buffer pointer */
+       AUDIO_IO_ERROR_SOUND_POLICY        = TIZEN_ERROR_AUDIO_IO | 0x04,   /**< Sound policy error */
+       AUDIO_IO_ERROR_INVALID_STATE       = TIZEN_ERROR_AUDIO_IO | 0x05,   /**< Invalid state (Since 3.0) */
+       AUDIO_IO_ERROR_NOT_SUPPORTED_TYPE  = TIZEN_ERROR_AUDIO_IO | 0x06,   /**< Not supported stream type (Since 3.0) */
 } audio_io_error_e;
 
 /**
@@ -120,16 +118,15 @@ typedef enum{
  * @brief Enumeration for audio IO interrupted messages.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
-typedef enum
-{
-    AUDIO_IO_INTERRUPTED_COMPLETED = 0,         /**< Interrupt completed */
-    AUDIO_IO_INTERRUPTED_BY_MEDIA,              /**< Interrupted by a media application */
-    AUDIO_IO_INTERRUPTED_BY_CALL,               /**< Interrupted by an incoming call */
-    AUDIO_IO_INTERRUPTED_BY_EARJACK_UNPLUG,     /**< Interrupted by unplugging headphones */
-    AUDIO_IO_INTERRUPTED_BY_RESOURCE_CONFLICT,  /**< Interrupted by a resource conflict */
-    AUDIO_IO_INTERRUPTED_BY_ALARM,              /**< Interrupted by an alarm */
-    AUDIO_IO_INTERRUPTED_BY_EMERGENCY,          /**< Interrupted by an emergency */
-    AUDIO_IO_INTERRUPTED_BY_NOTIFICATION,       /**< Interrupted by a notification */
+typedef enum {
+       AUDIO_IO_INTERRUPTED_COMPLETED = 0,         /**< Interrupt completed */
+       AUDIO_IO_INTERRUPTED_BY_MEDIA,              /**< Interrupted by a media application */
+       AUDIO_IO_INTERRUPTED_BY_CALL,               /**< Interrupted by an incoming call */
+       AUDIO_IO_INTERRUPTED_BY_EARJACK_UNPLUG,     /**< Interrupted by unplugging headphones */
+       AUDIO_IO_INTERRUPTED_BY_RESOURCE_CONFLICT,  /**< Interrupted by a resource conflict */
+       AUDIO_IO_INTERRUPTED_BY_ALARM,              /**< Interrupted by an alarm */
+       AUDIO_IO_INTERRUPTED_BY_EMERGENCY,          /**< Interrupted by an emergency */
+       AUDIO_IO_INTERRUPTED_BY_NOTIFICATION,       /**< Interrupted by a notification */
 } audio_io_interrupted_code_e;
 
 /**
@@ -156,10 +153,6 @@ typedef void (*audio_io_interrupted_cb)(audio_io_interrupted_code_e code, void *
  * @{
  */
 
-//
-//AUDIO INPUT
-//
-
 /**
  * @brief Called when audio input data is available in asynchronous(event) mode.
  *
@@ -217,7 +210,7 @@ typedef void (*audio_in_state_changed_cb)(audio_in_h handle, audio_io_state_e pr
  * @retval #AUDIO_IO_ERROR_NOT_SUPPORTED Not supported
  *
  * @post The state will be #AUDIO_IO_STATE_IDLE.\n
- *       audio_in_set_stream_info() is recommended to be called after this API.
+ *       audio_in_set_sound_stream_info() is recommended to be called after this API.
  * @see audio_in_destroy()
  */
 int audio_in_create(int sample_rate, audio_channel_e channel, audio_sample_type_e type, audio_in_h *input);
@@ -250,7 +243,7 @@ int audio_in_create(int sample_rate, audio_channel_e channel, audio_sample_type_
  *
  * @see audio_in_destroy()
  */
-int audio_in_create_loopback(int sample_rate, audio_channel_e channel, audio_sample_type_e type , audio_in_h* input);
+int audio_in_create_loopback(int sample_rate, audio_channel_e channel, audio_sample_type_e type , audio_in_h* input) TIZEN_DEPRECATED_API;
 
 /**
  * @brief Releases the audio input handle and all its resources associated with an audio stream.
@@ -294,6 +287,9 @@ int audio_in_destroy(audio_in_h input);
  * @see sound_manager_create_stream_information()
  * @see sound_manager_destroy_stream_information()
  */
+int audio_in_set_sound_stream_info(audio_in_h input, sound_stream_info_h stream_info);
+
+/* Note : Will be removed after migration to audio_in_set_sound_stream_info */
 int audio_in_set_stream_info(audio_in_h input, sound_stream_info_h stream_info);
 
 /**
@@ -307,6 +303,7 @@ int audio_in_set_stream_info(audio_in_h input, sound_stream_info_h stream_info);
  * @retval #AUDIO_IO_ERROR_NONE Successful
  * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #AUDIO_IO_ERROR_NOT_SUPPORTED Not supported
+ * @retval #AUDIO_IO_ERROR_DEVICE_POLICY_RESTRICTION Device policy restriction
  * @retval #AUDIO_IO_ERROR_INVALID_STATE Invalid state
  *
  * @post The state will be #AUDIO_IO_STATE_RUNNING.
@@ -373,7 +370,7 @@ int audio_in_resume(audio_in_h input);
 /**
  * @brief Flushes and discards buffered audio data from the input stream.
  *
- * @since_tizen 2.4
+ * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
  *
  * @param[in] input The handle to the audio input
  * @return @c 0 on success,
@@ -490,7 +487,7 @@ int audio_in_get_sample_type(audio_in_h input, audio_sample_type_e *type);
  * @see audio_in_unset_interrupted_cb()
  * @see audio_io_interrupted_cb()
  */
-int audio_in_set_interrupted_cb(audio_in_h input, audio_io_interrupted_cb callback, void *user_data);
+int audio_in_set_interrupted_cb(audio_in_h input, audio_io_interrupted_cb callback, void *user_data) TIZEN_DEPRECATED_API;
 
 /**
  * @deprecated Deprecated since 3.0
@@ -508,7 +505,7 @@ int audio_in_set_interrupted_cb(audio_in_h input, audio_io_interrupted_cb callba
  *
  * @see audio_in_set_interrupted_cb()
  */
-int audio_in_unset_interrupted_cb(audio_in_h input);
+int audio_in_unset_interrupted_cb(audio_in_h input) TIZEN_DEPRECATED_API;
 
 /**
  * @deprecated Deprecated since 3.0
@@ -524,7 +521,7 @@ int audio_in_unset_interrupted_cb(audio_in_h input);
  * @retval #AUDIO_IO_ERROR_INVALID_OPERATION Invalid operation
  * @retval #AUDIO_IO_ERROR_NOT_SUPPORTED Not supported
  */
-int audio_in_ignore_session(audio_in_h input);
+int audio_in_ignore_session(audio_in_h input) TIZEN_DEPRECATED_API;
 
 /**
  * @brief Sets an asynchronous(event) callback function to handle recording PCM (pulse-code modulation) data.
@@ -659,10 +656,6 @@ int audio_in_unset_state_changed_cb(audio_in_h input);
  * @}
  */
 
-//
-// AUDIO OUTPUT
-//
-
 /**
  * @addtogroup CAPI_MEDIA_AUDIO_OUT_MODULE
  * @{
@@ -723,7 +716,7 @@ typedef void (*audio_out_state_changed_cb)(audio_out_h handle, audio_io_state_e
  *
  * @see audio_out_destroy()
  */
-int audio_out_create(int sample_rate, audio_channel_e channel, audio_sample_type_e type, sound_type_e sound_type, audio_out_h *output);
+int audio_out_create(int sample_rate, audio_channel_e channel, audio_sample_type_e type, sound_type_e sound_type, audio_out_h *output) TIZEN_DEPRECATED_API;
 
 /**
  * @brief Creates an audio device instance and returns an output handle to play PCM (pulse-code modulation) data.
@@ -733,7 +726,7 @@ int audio_out_create(int sample_rate, audio_channel_e channel, audio_sample_type
  * @since_tizen 3.0
  *
  * @remarks @a output must be released by audio_out_destroy().
- *          It is recommended to call audio_out_set_stream_info() after this API.
+ *          It is recommended to call audio_out_set_sound_stream_info() after this API.
  *
  * @param[in] sample_rate The audio sample rate in 8000[Hz] ~ 48000[Hz]
  * @param[in] channel The audio channel type (mono or stereo)
@@ -748,7 +741,7 @@ int audio_out_create(int sample_rate, audio_channel_e channel, audio_sample_type
  * @retval #AUDIO_IO_ERROR_SOUND_POLICY Sound policy error
  *
  * @post The state will be #AUDIO_IO_STATE_IDLE.\n
- *       audio_out_set_stream_info() is recommended to be called after this API.
+ *       audio_out_set_sound_stream_info() is recommended to be called after this API.
  * @see audio_out_destroy()
  */
 int audio_out_create_new(int sample_rate, audio_channel_e channel, audio_sample_type_e type, audio_out_h *output);
@@ -795,6 +788,9 @@ int audio_out_destroy(audio_out_h output);
  * @see sound_manager_create_stream_information()
  * @see sound_manager_destroy_stream_information()
  */
+int audio_out_set_sound_stream_info(audio_out_h output, sound_stream_info_h stream_info);
+
+/* Note : Will be removed after migration to audio_out_set_sound_stream_info */
 int audio_out_set_stream_info(audio_out_h output, sound_stream_info_h stream_info);
 
 /**
@@ -872,7 +868,7 @@ int audio_out_resume(audio_out_h output);
  *
  * @details This function waits until drains stream buffer completely. (e.g end of playback)
  *
- * @since_tizen 2.4
+ * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
  *
  * @param[in] output The handle to the audio output
  * @return @c 0 on success,
@@ -889,7 +885,7 @@ int audio_out_drain(audio_out_h output);
 /**
  * @brief Flushes and discards buffered audio data from the output stream.
  *
- * @since_tizen 2.4
+ * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
  *
  * @param[in] output The handle to the audio output
  * @return @c 0 on success,
@@ -1015,7 +1011,7 @@ int audio_out_get_sound_type(audio_out_h output, sound_type_e *type);
  * @see audio_out_unset_interrupted_cb()
  * @see audio_io_interrupted_cb()
  */
-int audio_out_set_interrupted_cb(audio_out_h output, audio_io_interrupted_cb callback, void *user_data);
+int audio_out_set_interrupted_cb(audio_out_h output, audio_io_interrupted_cb callback, void *user_data) TIZEN_DEPRECATED_API;
 
 /**
  * @deprecated Deprecated since 3.0
@@ -1032,7 +1028,7 @@ int audio_out_set_interrupted_cb(audio_out_h output, audio_io_interrupted_cb cal
  *
  * @see audio_out_set_interrupted_cb()
  */
-int audio_out_unset_interrupted_cb(audio_out_h output);
+int audio_out_unset_interrupted_cb(audio_out_h output) TIZEN_DEPRECATED_API;
 
 /**
  * @deprecated Deprecated since 3.0
@@ -1047,14 +1043,14 @@ int audio_out_unset_interrupted_cb(audio_out_h output);
  * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #AUDIO_IO_ERROR_INVALID_OPERATION Invalid operation
  */
-int audio_out_ignore_session(audio_out_h output);
+int audio_out_ignore_session(audio_out_h output) TIZEN_DEPRECATED_API;
 
 /**
  * @brief Sets an asynchronous(event) callback function to handle playing PCM (pulse-code modulation) data.
  *
  * @details @a callback will be called when you can write a PCM data.
  * It might cause dead lock if change the state of audio handle in callback.
- * (ex: audio_in_destroy, audio_in_prepare, audio_in_unprepare)
+ * (ex: audio_out_destroy, audio_out_prepare, audio_out_unprepare)
  * Recommend to use as a VOIP only.
  * Recommend not to hold callback too long.(it affects latency)
  *
@@ -1072,7 +1068,7 @@ int audio_out_ignore_session(audio_out_h output);
  * @retval #AUDIO_IO_ERROR_DEVICE_NOT_OPENED Device not opened
  * @retval #AUDIO_IO_ERROR_SOUND_POLICY Sound policy error
  *
- * @see audio_in_set_stream_cb()
+ * @see audio_out_unset_stream_cb()
  */
 int audio_out_set_stream_cb(audio_out_h output, audio_out_stream_cb callback, void* user_data);