upload tizen1.0 source
authorKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 07:58:29 +0000 (16:58 +0900)
committerKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 07:58:29 +0000 (16:58 +0900)
.gitignore [deleted file]
CMakeLists.txt [changed mode: 0755->0644]
capi-media-player.pc.in
debian/changelog
debian/control
include/player.h [changed mode: 0755->0644]
include/player_private.h
packaging/capi-media-player.spec
src/player.c [changed mode: 0755->0644]
test/player_test.c

diff --git a/.gitignore b/.gitignore
deleted file mode 100644 (file)
index a6d8f19..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-CMakeCache.txt
-*/CMakeFiles/*
-*.cmake
-CMakeFiles*
-*.a
-*.so
-Testing
-cmake.depends
-cmake.check_depends
-cmake.check_cache
-core
-core.*
-gmon.out
-install_manifest.txt
-*~
-.kdev_include_paths
-src.kdev4
-.cproject
-.project
-tet_captured
-tet_lock
-*.pc
-Makefile
-*-test
-*-test_*
-*tester.c
old mode 100755 (executable)
new mode 100644 (file)
index 8c1b879..354ff5c
@@ -11,6 +11,7 @@ SET(INC_DIR include)
 INCLUDE_DIRECTORIES(${INC_DIR})
 
 SET(dependents "dlog mm-player capi-base-common capi-media-sound-manager")
+SET(pc_dependents "capi-base-common capi-media-sound-manager")
 
 INCLUDE(FindPkgConfig)
 pkg_check_modules(${fw_name} REQUIRED ${dependents})
@@ -51,7 +52,7 @@ INSTALL(
         )
 
 SET(PC_NAME ${fw_name})
-SET(PC_REQUIRED ${dependents})
+SET(PC_REQUIRED ${pc_dependents})
 SET(PC_LDFLAGS -l${fw_name})
 SET(PC_CFLAGS -I\${includedir}/media)
 
index 773d6677f6b38f6b94729b6fdce7465563546818..5d02f8df41731b330865ef6f8930b8651473fff8 100644 (file)
@@ -11,5 +11,5 @@ Description: @PACKAGE_DESCRIPTION@
 Version: @VERSION@
 Requires: @PC_REQUIRED@ 
 Libs: -L${libdir} @PC_LDFLAGS@
-Cflags: -I${includedir} @PC_CFLAGS@
+Cflags: -I${includedir}
 
index 33490b3197d2cf5ba17eb7605c5ff617f35e3458..95a54ed7c8e8c344b14bdc5401ae8f0a0920038f 100644 (file)
@@ -1,3 +1,15 @@
+capi-media-player (0.1.0-12) unstable; urgency=low
+
+  * capture video callback updated 
+
+ -- Kangho Hur <kangho.hur@samsung.com>  Mon, 26 Mar 2012 23:01:54 +0900
+
+capi-media-player (0.1.0-11) unstable; urgency=low
+
+  * Add the new features (playback rate, video/audio frame decoded, audio effects and so on.) 
+
+ -- Kangho Hur <kangho.hur@samsung.com>  Mon, 19 Mar 2012 17:40:35 +0900
+
 capi-media-player (0.1.0-7) unstable; urgency=low
 
   * Use 'static' to local function which is limited to the current source file. 
index dfbb83ebdb7ef85ef63186565357fdaddb22b515..81e4255eddd9051f0e6b2d1a5cc8b0c5fe014258 100644 (file)
@@ -7,12 +7,12 @@ Build-Depends: debhelper (>= 5), dlog-dev, libmm-player-dev, libmm-player-intern
 
 Package: capi-media-player
 Architecture: any
-Depends: ${shilbs:Depends}, ${misc:Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: A Media Player library in Tizen Native API
 
 Package: capi-media-player-dev
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, capi-media-player (= ${Source-Version}), dlog-dev, libmm-player-dev, libmm-player-internal-dev, capi-base-common-dev
+Depends: ${shlibs:Depends}, ${misc:Depends}, capi-media-player (= ${Source-Version}), capi-base-common-dev, capi-media-sound-manager-dev
 Description: A Media Player library in Tizen Native API (DEV)
 
 Package: capi-media-player-dbg
old mode 100755 (executable)
new mode 100644 (file)
index 19f4f95..82c5308
@@ -70,7 +70,8 @@ typedef enum
                PLAYER_ERROR_NOT_SUPPORTED_FILE = PLAYER_ERROR_CLASS | 0x03     ,               /**< Not supported file format */
                PLAYER_ERROR_INVALID_URI            = PLAYER_ERROR_CLASS | 0x04 ,                                       /**< Invalid URI */
                PLAYER_ERROR_SOUND_POLICY           = PLAYER_ERROR_CLASS | 0x05 ,                               /**< Sound policy error */
-               PLAYER_ERROR_CONNECTION_FAILED  = PLAYER_ERROR_CLASS | 0x06    /**< Streaming connection failed */
+               PLAYER_ERROR_CONNECTION_FAILED  = PLAYER_ERROR_CLASS | 0x06,    /**< Streaming connection failed */
+               PLAYER_ERROR_VIDEO_CAPTURE_FAILED = PLAYER_ERROR_CLASS | 0x07    /**< Video capture failure */
 } player_error_e;
 
 /**
@@ -78,13 +79,12 @@ typedef enum
  */
 typedef enum
 {
-       PLAYER_INTERRUPTED_BY_OTHER_APP = 0,                            /**< Interrupted by another application*/
-       PLAYER_INTERRUPTED_BY_CALL_START,                                               /**< Interrupted by incoming call*/
-       PLAYER_INTERRUPTED_BY_CALL_END,                                                 /**< Interrupted by call ending*/
+               PLAYER_INTERRUPTED_COMPLETED = 0,                               /**< Interrupt completed*/
+       PLAYER_INTERRUPTED_BY_OTHER_APP,                                /**< Interrupted by another application*/
+       PLAYER_INTERRUPTED_BY_CALL,                                             /**< Interrupted by incoming call*/
        PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG,                   /**< Interrupted by unplugging headphone*/
        PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT,                /**< Interrupted by resource conflict*/
-       PLAYER_INTERRUPTED_BY_ALARM_START,                                      /**< Interrupted by alarm starting*/
-       PLAYER_INTERRUPTED_BY_ALARM_END,                                                /**< Interrupted by alarm ending*/
+       PLAYER_INTERRUPTED_BY_ALARM,                                    /**< Interrupted by alarm starting*/
 } player_interrupted_code_e;
 
 /**
@@ -129,8 +129,6 @@ typedef enum
        PLAYER_DISPLAY_ROTATION_90,             /**< Display is rotated 90 degrees */
        PLAYER_DISPLAY_ROTATION_180,    /**< Display is rotated 180 degrees */
        PLAYER_DISPLAY_ROTATION_270,    /**< Display is rotated 270 degrees */
-       PLAYER_DISPLAY_ROTATION_FLIP_HORZ,      /**< flip display horizontally */
-       PLAYER_DISPLAY_ROTATION_FLIP_VERT,      /**< flip display vertically */
 } player_display_rotation_e;
 
 /**
@@ -149,6 +147,78 @@ typedef enum
  * @}
  */
 
+/**
+ * @addtogroup CAPI_MEDIA_PLAYER_AUDIO_EFFECT_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumerations of audio output device type.
+ */
+typedef enum{
+       SOUND_DEVICE_OUT_SPEAKER = 0x01<<8, /**< Device builtin speaker */
+       SOUND_DEVICE_OUT_RECEIVER = 0x02<<8, /**< Device builtin receiver */
+       SOUND_DEVICE_OUT_WIRED_ACCESSORY = 0x04<<8,     /**< Wired output devices such as headphone, headset, and so on. */
+       SOUND_DEVICE_OUT_BT_SCO = 0x08<<8, /**< Bluetooth SCO device */
+       SOUND_DEVICE_OUT_BT_A2DP = 0x10<<8,     /**< Bluetooth A2DP device */
+} sound_device_out_e;
+
+/**
+ * @brief  Enumerations of 3D effect
+ */ 
+typedef enum{
+       AUDIO_EFFECT_3D_WIDE =1, /**< Wide mode */
+       AUDIO_EFFECT_3D_DYNAMIC, /**< Dynamic mode */
+       AUDIO_EFFECT_3D_SURROUND, /**< Surround mode */
+} audio_effect_3d_e;
+
+/**
+ * @brief
+ * Enumerations of equalizer effect
+ */ 
+typedef enum{
+       AUDIO_EFFECT_EQ_ROCK =1, /**< Rock mode */
+       AUDIO_EFFECT_EQ_JAZZ,    /**<  Jazz mode*/
+       AUDIO_EFFECT_EQ_LIVE,   /**<  Live mode*/
+       AUDIO_EFFECT_EQ_CLASSIC, /**<  Classic mode*/
+       AUDIO_EFFECT_EQ_FULL_BASS, /**<  Bass mode*/
+       AUDIO_EFFECT_EQ_FULL_BASS_AND_TREBLE, /**<  Bass and Treble mode*/
+       AUDIO_EFFECT_EQ_DANCE,  /**<  Dance mode*/
+       AUDIO_EFFECT_EQ_POP, /**<  Pop mode*/
+       AUDIO_EFFECT_EQ_FULL_TREBLE,    /**<  Treble mode*/
+       AUDIO_EFFECT_EQ_CLUB,    /**<  Club mode*/
+       AUDIO_EFFECT_EQ_PARTY,  /**<  Party mode*/
+       AUDIO_EFFECT_EQ_LARGE_HALL, /**<  Large Hall mode*/
+       AUDIO_EFFECT_EQ_SOFT, /**<  Soft mode*/
+       AUDIO_EFFECT_EQ_SOFT_ROCK,       /**<  Soft Rock mode*/
+} audio_effect_equalizer_e;
+
+/**
+ * @brief
+ * Enumerations of reverberation effect
+ */ 
+typedef enum{
+       AUDIO_EFFECT_REVERB_JAZZ_CLUB =1, /**< Jazz club mode */
+       AUDIO_EFFECT_REVERB_CONCERT_HALL, /**< Concert Hall mode*/
+       AUDIO_EFFECT_REVERB_STADIUM, /**< Stadium mode*/
+} audio_effect_reverb_e;
+
+/**
+ * @brief
+ * Enumerations of extra effect
+ */ 
+typedef enum{
+       AUDIO_EFFECT_EX_BASE =1, /**<  Bass Enhancement effect */
+       AUDIO_EFFECT_EX_MUSIC_CLARITY, /**< Music clarity effect*/
+       AUDIO_EFFECT_EX_SURROUND, /**< 5.1 channel surround sound effect*/
+       AUDIO_EFFECT_EX_SOUND_EXTERNAL, /**< Sound externalization effect*/
+} audio_effect_extra_e;
+
+/**
+ * @}
+ */
+
+
 /**
  * @addtogroup CAPI_MEDIA_PLAYER_MODULE
  * @{
@@ -156,7 +226,9 @@ typedef enum
 
 /**
  * @brief  Called when the media player is started.
+ * @details It will be invoked when player has reached the begin of stream
  * @param[in]   user_data  The user data passed from the callback registration function
+ * @pre The player state should be #PLAYER_STATE_READY
  * @pre player_start() will cause this callback if you register this callback using player_set_started_cb()
  * @see player_start()
  * @see player_set_started_cb()
@@ -166,6 +238,7 @@ typedef void (*player_started_cb)(void *user_data);
 
 /**
  * @brief  Called when the media player is completed.
+ * @details It will be invoked when player has reached to the end of the stream.
  * @param[in]   user_data  The user data passed from the callback registration function
  * @pre It will be invoked when playback completed if you register this callback using player_set_completed_cb()
  * @see player_set_completed_cb()
@@ -227,7 +300,6 @@ typedef void (*player_subtitle_updated_cb)(unsigned long duration, char *text, v
 /**
  * @brief  Called when the video is captured.
  * @remarks The color space format of the captured image is #IMAGE_UTIL_COLORSPACE_RGB888.
- * @remarks @a data must be released with @c free() by you.
  * @param[in]   data   The captured image buffer 
  * @param[in]   width  The width of captured image
  * @param[in]   height The height of captured image
@@ -237,6 +309,28 @@ typedef void (*player_subtitle_updated_cb)(unsigned long duration, char *text, v
  */
 typedef void (*player_video_captured_cb)(unsigned char *data, int width, int height, unsigned int size, void *user_data);
 
+/**
+ * @brief  Called when the video frame is decoded.
+ * @param[in]   data   The decoded video frame data 
+ * @param[in]   width  The width of video frame
+ * @param[in]   height The height of video frame
+ * @param[in]   size   The size of video frame
+ * @param[in]   user_data      The user data passed from the callback registration function
+ * @see player_set_video_frame_decoded_cb()
+ * @see player_unset_video_frame_decoded_cb()
+ */
+typedef void (*player_video_frame_decoded_cb)(unsigned char *data, int width, int height, unsigned int size, void *user_data);
+
+/**
+ * @brief  Called when the audio frame is decoded.
+ * @param[in]   data   The decoded audio frame data 
+ * @param[in]   size   The size of audio frame
+ * @param[in]   user_data      The user data passed from the callback registration function
+ * @see player_set_audio_frame_decoded_cb()
+ * @see player_unset_audio_frame_decoded_cb()
+ */
+typedef void (*player_audio_frame_decoded_cb)(unsigned char *data, unsigned int size, void *user_data);
+
 /**
  * @brief Creates a player handle for playing multimedia content.
  * @remarks @a player must be released player_destroy() by you.
@@ -426,7 +520,7 @@ int player_set_sound_type(player_h player, sound_type_e type);
  * @brief Starts or resumes playback, asynchronously.
  *
  * @details Plays current media content, or resumes play if paused.
- *
+ * 
  * @param[in]   player The handle to media player
  * @return 0 on success, otherwise a negative error value.
  * @retval #PLAYER_ERROR_NONE Successful
@@ -438,7 +532,7 @@ int player_set_sound_type(player_h player, sound_type_e type);
  * @pre Call player_prepare() before calling this function.
  * @pre The player state must be #PLAYER_STATE_READY by player_prepare() or #PLAYER_STATE_PAUSED by player_pause().
  * @post The player state will be #PLAYER_STATE_PLAYING.
- * @post It invokes player_started_cb() when playback starts, if you set a callback with player_set_started_cb().
+ * @post It invokes player_started_cb() when playback starts(not resume), if you set a callback with player_set_started_cb().
  * @post It invokes player_completed_cb() when playback completes, if you set a callback with player_set_completed_cb().
  * @see player_prepare()
  * @see player_stop()
@@ -641,6 +735,7 @@ int player_get_duration(player_h player, int *duration);
 
 /**
  * @brief Sets the video display.
+ * @remaks To get @a display to set, use #GET_DISPLAY().
  * @param[in]   player The handle to media player
  * @param[in]   type The display type
  * @param[in]   display The handle to display
@@ -653,6 +748,23 @@ int player_get_duration(player_h player, int *duration);
  */
 int player_set_display(player_h player, player_display_type_e type, player_display_h display);
 
+/**
+ * @brief Sets the playback rate 
+ * @details The default value is 1.0.
+ * @remarks #PLAYER_ERROR_INVALID_OPERATION occured if streaming playbak.
+ * @remarks No operation is performed, if @a rate is 0. 
+ * @remarks The sound is muted, when playback rate is under 0.0 and over 2.0.
+ * @param[in]   player The handle to media player
+ * @param[in]   rate The playback rate (-5.0x ~ 5.0x)
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be #PLAYER_STATE_PLAYING by player_start().
+ */
+int player_set_playback_rate(player_h player, float rate);
+
 /**
  * @}
  */
@@ -738,6 +850,102 @@ int player_set_x11_display_mode(player_h player, player_display_mode_e mode);
  */
 int player_get_x11_display_mode(player_h player, player_display_mode_e *mode);
 
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_PLAYER_AUDIO_EFFECT_MODULE
+ * @{
+ */
+/**
+ * @brief Sets a audio effect output device.
+ * @remarks Both #SOUND_DEVICE_OUT_RECEIVER and #SOUND_DEVICE_OUT_BT_SCO output devices are not supported. It occurs #PLAYER_ERROR_INVALID_OPERATION.
+ * @param[in]   player The handle to media player
+ * @param[in]   output The output device to apply audio effect
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ */
+int player_set_audio_effect_output(player_h player,  sound_device_out_e output);
+
+/**
+ * @brief Sets a 3D audio effect.
+ * @remarks Equalizer, 3D and reverberation effects can be used together
+ * @param[in]   player The handle to media player
+ * @param[in]   effect The 3D audio effect
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ */
+int player_set_audio_effect_3d(player_h player, audio_effect_3d_e effect);
+
+/**
+ * @brief Sets an equalizer audio effect.
+ * @remarks Equalizer, 3D and reverberation effects can be used together
+ * @param[in]   player The handle to media player
+ * @param[in]   effect The equalizer audio effect
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ */
+int player_set_audio_effect_equalizer(player_h player, audio_effect_equalizer_e effect);
+
+/**
+ * @brief Sets an reverberation audio effect.
+ * @remarks Equalizer, 3D and reverberation effects can be used together
+ * @param[in]   player The handle to media player
+ * @param[in]   effect The reverberation audio effect
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ */
+int player_set_audio_effect_reverb(player_h player, audio_effect_reverb_e effect);
+
+
+/**
+ * @brief Sets an extra(Bass Enhancement, AEQ, Music clarity, 5.1 SRS circle surround, Wow HD, and Sound externalization) audio effect.
+ * @remarks Previous applied other effects(equalizer, 3D, reverberation) should be ignored.
+ * @param[in]   player The handle to media player
+ * @param[in]   effect The extra audio effect
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ */
+int player_set_audio_effect_extra(player_h player, audio_effect_extra_e effect);
+
+/**
+ * @brief Clears all audio effects.
+ * @param[in]   player The handle to media player
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ * @see player_set_audio_effect_3d()
+ * @see player_set_audio_effect_equalizer()
+ * @see player_set_audio_effect_reverb()
+ * @see player_set_audio_effect_extra()
+ */
+int player_clear_audio_effect(player_h player);
+
 /**
  * @}
  */
@@ -789,7 +997,20 @@ int player_set_subtitle_path(player_h player, char* path);
  * @post It invokes player_video_captured_cb() when capture completes, if you set a callback.
  * @see player_video_captured_cb()
  */
-int player_capture_video(player_h player, player_video_captured_cb callback, void *user_data); 
+int player_capture_video(player_h player, player_video_captured_cb callback, void *user_data);
+
+/**
+ * @brief Sets the cookie for streaming playback.
+ * @param[in] player The handle to media player
+ * @param[in] cookie   The cookie to set
+ * @param[in] size     The size of cookie
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ */
+int player_set_streaming_cookie(player_h player, const char *cookie, int size);
 
 /** 
  * @brief Registers a callback function to be invoked when the playback starts.
@@ -874,7 +1095,7 @@ int player_unset_paused_cb(player_h player);
 
 
 /**
- * @brief Registers a callback function to be invoked when the playback is interrupted.
+ * @brief Registers a callback function to be invoked when the playback is interrupted or interrupt completed.
  * @param[in] player   The handle to media player
  * @param[in] callback The callback function to register
  * @param[in] user_data        The user data to be passed to the callback function
@@ -970,7 +1191,7 @@ int player_unset_buffering_cb(player_h player);
  * @see player_subtitle_updated_cb()
  * @see player_set_subtitle_path()
  */
-int player_set_subtilte_updated_cb(player_h player, player_subtitle_updated_cb callback, void *user_data);
+int player_set_subtitle_updated_cb(player_h player, player_subtitle_updated_cb callback, void *user_data);
 
 /**
  * @brief Unregisters the callback function.
@@ -981,8 +1202,63 @@ int player_set_subtilte_updated_cb(player_h player, player_subtitle_updated_cb c
  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
  * @see player_set_subtitle_updated_cb()
  */
-int player_unset_subtilte_updated_cb(player_h player);
+int player_unset_subtitle_updated_cb(player_h player);
+
+/**
+ * @brief Registers a callback function to be invoked when video frame is decoded.
+ * @param[in] player   The handle to media player
+ * @param[in] callback The callback function to register
+ * @param[in] user_data        The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The player state must be either #PLAYER_STATE_IDLE by player_create() or #PLAYER_STATE_READY by player_prepare().
+ * @post  player_video_frame_decoded_cb() will be invoked
+ * @see player_unset_video_frame_decoded_cb()
+ * @see player_video_frame_decoded_cb()
+ */
+int player_set_video_frame_decoded_cb(player_h player, player_video_frame_decoded_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @param[in] player The handle to media player
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @see player_set_video_frame_decoded_cb()
+ */
+int player_unset_video_frame_decoded_cb(player_h player);
+
+/**
+ * @brief Registers a callback function to be invoked when audio frame is decoded.
+ * @param[in] player   The handle to media player
+ * @param[in] start The start position to decode.
+ * @param[in] end      The end position to decode.
+ * @param[in] callback The callback function to register
+ * @param[in] user_data        The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The player state must be either #PLAYER_STATE_IDLE by player_create() or #PLAYER_STATE_READY by player_prepare().
+ * @post  player_audio_frame_decoded_cb() will be invoked
+ * @see player_unset_audio_frame_decoded_cb()
+ * @see player_audio_frame_decoded_cb()
+ */
+int player_set_audio_frame_decoded_cb(player_h player, int start, int end ,player_audio_frame_decoded_cb callback, void *user_data);
 
+/**
+ * @brief Unregisters the callback function.
+ * @param[in] player The handle to media player
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @see player_set_audio_frame_decoded_cb()
+ */
+int player_unset_audio_frame_decoded_cb(player_h player);
 
 /**
  * @}
index 0c1ac05370effcc9ace8c14cbee2dd8ffd763824..0d43372d04c8d0d8e52a95eb7a0d8e17262fd3a1 100644 (file)
@@ -32,6 +32,8 @@ typedef enum {
        _PLAYER_EVENT_TYPE_BUFFERING,
        _PLAYER_EVENT_TYPE_SUBTITLE,
        _PLAYER_EVENT_TYPE_CAPTURE,
+       _PLAYER_EVENT_TYPE_VIDEO_FRAME,
+       _PLAYER_EVENT_TYPE_AUDIO_FRAME,
        _PLAYER_EVENT_TYPE_NUM
 }_player_event_e;
 
index d9fff20cae1038ca662e381e0c44836dd60a0d71..d2e16d5c52910788e7099a1bdd5fae8565d5c235 100644 (file)
@@ -1,7 +1,7 @@
 Name:       capi-media-player
 Summary:    A Media Player library in Tizen Native API
 Version:    0.1.0
-Release:    1
+Release:    12
 Group:      TO_BE/FILLED_IN
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
old mode 100755 (executable)
new mode 100644 (file)
index 40e7ea6..ab66090
@@ -11,7 +11,7 @@
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
-* limitations under the License. 
+* limitations under the License.
 */
 
 #include <stdio.h>
@@ -19,6 +19,7 @@
 #include <string.h>
 #include <mm.h>
 #include <mm_player.h>
+#include <mm_player_sndeffect.h>
 #include <mm_player_internal.h>
 #include <mm_types.h>
 #include <player.h>
@@ -149,7 +150,7 @@ static int __convert_error_code(int code, char* func_name)
                        ret = PLAYER_ERROR_SOUND_POLICY;
                        msg = "PLAYER_ERROR_SOUND_POLICY";
                        break;
-       } 
+       }
        LOGE("[%s] %s(0x%08x) : core fw error(0x%x)",func_name,msg, ret, code);
        return ret;     
 }
@@ -173,21 +174,21 @@ static int __set_callback(_player_event_e type, player_h player, void* callback,
 {
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(callback);
-       player_s * handle = (player_s *) player; 
+       player_s * handle = (player_s *) player;
        handle->user_cb[type] = callback;
        handle->user_data[type] = user_data;
        LOGI("[%s] Event type : %d ",__FUNCTION__, type);
-       return PLAYER_ERROR_NONE; 
+       return PLAYER_ERROR_NONE;
 }
 
 static int __unset_callback(_player_event_e type, player_h player)
 {
        PLAYER_INSTANCE_CHECK(player);
-       player_s * handle = (player_s *) player; 
+       player_s * handle = (player_s *) player;
        handle->user_cb[type] = NULL;
        handle->user_data[type] = NULL;
        LOGI("[%s] Event type : %d ",__FUNCTION__, type);
-       return PLAYER_ERROR_NONE; 
+       return PLAYER_ERROR_NONE;
 }
 
 static int __msg_callback(int message, void *param, void *user_data)
@@ -195,13 +196,11 @@ static int __msg_callback(int message, void *param, void *user_data)
        player_s * handle = (player_s*)user_data;
        MMMessageParamType *msg = (MMMessageParamType*)param;
        LOGI("[%s] Got message type : 0x%x" ,__FUNCTION__, message);
+       player_error_e err_code = PLAYER_ERROR_NONE;
        switch(message)
        {
-               case  MM_MESSAGE_ERROR: //0x01
-                       if( handle->user_cb[_PLAYER_EVENT_TYPE_ERROR] )
-                       {
-                               ((player_error_cb)handle->user_cb[_PLAYER_EVENT_TYPE_ERROR])(__convert_error_code(msg->code,(char*)__FUNCTION__),handle->user_data[_PLAYER_EVENT_TYPE_ERROR]);
-                       }       
+               case MM_MESSAGE_ERROR: //0x01
+                       err_code = __convert_error_code(msg->code,(char*)__FUNCTION__);
                        break;
                case  MM_MESSAGE_STATE_CHANGED: //0x03
                        handle->state = __convert_player_state(msg->state.current);
@@ -210,6 +209,12 @@ static int __msg_callback(int message, void *param, void *user_data)
                                ((player_paused_cb)handle->user_cb[_PLAYER_EVENT_TYPE_PAUSE])(handle->user_data[_PLAYER_EVENT_TYPE_PAUSE]);
                        }       
                        break;
+               case MM_MESSAGE_READY_TO_RESUME: //0x05
+                       if( handle->user_cb[_PLAYER_EVENT_TYPE_INTERRUPT] )
+                       {
+                               ((player_interrupted_cb)handle->user_cb[_PLAYER_EVENT_TYPE_INTERRUPT])(PLAYER_INTERRUPTED_COMPLETED,handle->user_data[_PLAYER_EVENT_TYPE_INTERRUPT]);
+                       }
+                       break;
                case MM_MESSAGE_BEGIN_OF_STREAM: //0x104
                        if( handle->user_cb[_PLAYER_EVENT_TYPE_BEGIN] )
                        {
@@ -231,37 +236,69 @@ static int __msg_callback(int message, void *param, void *user_data)
                case MM_MESSAGE_STATE_INTERRUPTED: //0x04
                        if( handle->user_cb[_PLAYER_EVENT_TYPE_INTERRUPT] )
                        {
+                               MMPlayerStateType currentStat = MM_PLAYER_STATE_PAUSED;
+                               int ret = mm_player_get_state(handle->mm_handle, &currentStat);
+                               handle->state = (ret != MM_ERROR_NONE )? currentStat: __convert_player_state(currentStat);
                                ((player_interrupted_cb)handle->user_cb[_PLAYER_EVENT_TYPE_INTERRUPT])(msg->code,handle->user_data[_PLAYER_EVENT_TYPE_INTERRUPT]);
-                       }       
-                       break;  
+                       }
+                       break;
+               case MM_MESSAGE_CONNECTION_TIMEOUT: //0x102
+                       LOGE("[%s] PLAYER_ERROR_CONNECTION_FAILED (0x%08x) : CONNECTION_TIMEOUT" ,__FUNCTION__, PLAYER_ERROR_CONNECTION_FAILED);
+                       err_code = PLAYER_ERROR_CONNECTION_FAILED;
+                       break;
                case MM_MESSAGE_UPDATE_SUBTITLE: //0x109
                        if( handle->user_cb[_PLAYER_EVENT_TYPE_SUBTITLE] )
                        {
                                ((player_subtitle_updated_cb)handle->user_cb[_PLAYER_EVENT_TYPE_SUBTITLE])(msg->subtitle.duration, (char*)msg->data,handle->user_data[_PLAYER_EVENT_TYPE_SUBTITLE]);
                        }       
-                       break;  
+                       break;
+               case MM_MESSAGE_VIDEO_NOT_CAPTURED: //0x113
+                       LOGE("[%s] PLAYER_ERROR_VIDEO_CAPTURE_FAILED (0x%08x)",__FUNCTION__, PLAYER_ERROR_VIDEO_CAPTURE_FAILED);
+                       if( handle->user_cb[_PLAYER_EVENT_TYPE_ERROR] )
+                       {
+                               ((player_error_cb)handle->user_cb[_PLAYER_EVENT_TYPE_ERROR])(PLAYER_ERROR_VIDEO_CAPTURE_FAILED,handle->user_data[_PLAYER_EVENT_TYPE_ERROR]);
+                       }       
+                       break;
                case MM_MESSAGE_VIDEO_CAPTURED: //0x110
                        if( handle->user_cb[_PLAYER_EVENT_TYPE_CAPTURE] )
                        {
                                int w;
                                int h;
                                int ret = mm_player_get_attribute(handle->mm_handle, NULL,MM_PLAYER_VIDEO_WIDTH ,&w,  MM_PLAYER_VIDEO_HEIGHT, &h, (char*)NULL);
-                               if(ret != MM_ERROR_NONE)
+                               if(ret != MM_ERROR_NONE && handle->user_cb[_PLAYER_EVENT_TYPE_ERROR] )
+                               {
+                                       LOGE("[%s] PLAYER_ERROR_VIDEO_CAPTURE_FAILED (0x%08x) : Failed to get video size on video captured (0x%x)" ,__FUNCTION__, PLAYER_ERROR_VIDEO_CAPTURE_FAILED, ret);
+                                       err_code=PLAYER_ERROR_VIDEO_CAPTURE_FAILED;
+                               }
+                               else
                                {
-                                       w=0;
-                                       h=0;
-                                       LOGI("[%s] Failed to get video size on video captured : 0x%x" ,__FUNCTION__, ret);
+                                       MMPlayerVideoCapture* capture = (MMPlayerVideoCapture *)msg->data;
+                                       ((player_video_captured_cb)handle->user_cb[_PLAYER_EVENT_TYPE_CAPTURE])(capture->data, w, h, capture->size, handle->user_data[_PLAYER_EVENT_TYPE_CAPTURE]);
+
+                                       if (capture->data)
+                                       {
+                                               g_free(capture->data);
+                                               capture->data = NULL;
+                                       }
                                }
-                               MMPlayerVideoCapture* capture = (MMPlayerVideoCapture *)msg->data;
-                               ((player_video_captured_cb)handle->user_cb[_PLAYER_EVENT_TYPE_CAPTURE])(capture->data, w, h, capture->size, handle->user_data[_PLAYER_EVENT_TYPE_CAPTURE]);
                        }       
                        break;  
+               case MM_MESSAGE_FILE_NOT_SUPPORTED: //0x10f
+                       LOGE("[%s] PLAYER_ERROR_NOT_SUPPORTED_FILE (0x%08x) : FILE_NOT_SUPPORTED" ,__FUNCTION__, PLAYER_ERROR_NOT_SUPPORTED_FILE);
+                       err_code = PLAYER_ERROR_NOT_SUPPORTED_FILE;
+                       break;
+               case MM_MESSAGE_FILE_NOT_FOUND: //0x110
+                       LOGE("[%s] PLAYER_ERROR_NOT_SUPPORTED_FILE (0x%08x) : FILE_NOT_FOUND" ,__FUNCTION__, PLAYER_ERROR_NOT_SUPPORTED_FILE);
+                       err_code = PLAYER_ERROR_NOT_SUPPORTED_FILE;
+                       break;
+               case MM_MESSAGE_DRM_NOT_AUTHORIZED: //0x111
+                       LOGE("[%s] PLAYER_ERROR_NOT_SUPPORTED_FILE (0x%08x) : DRM_NOT_AUTHORIZED" ,__FUNCTION__, PLAYER_ERROR_NOT_SUPPORTED_FILE);
+                       err_code = PLAYER_ERROR_NOT_SUPPORTED_FILE;
+                       break;
                case MM_MESSAGE_UNKNOWN: //0x00
                case MM_MESSAGE_WARNING: //0x02
-               case MM_MESSAGE_READY_TO_RESUME: //0x05
                case MM_MESSAGE_CONNECTING: //0x100
                case MM_MESSAGE_CONNECTED: //0x101
-               case MM_MESSAGE_CONNECTION_TIMEOUT: //0x102
                case MM_MESSAGE_BLUETOOTH_ON: //0x106
                case MM_MESSAGE_BLUETOOTH_OFF: //0x107
                case MM_MESSAGE_RESUMED_BY_REW: //0x108
@@ -270,18 +307,39 @@ static int __msg_callback(int message, void *param, void *user_data)
                case MM_MESSAGE_RTP_SESSION_STATUS: //0x10c
                case MM_MESSAGE_SENDER_STATE: //0x10d
                case MM_MESSAGE_RECEIVER_STATE: //0x10e
-               case MM_MESSAGE_FILE_NOT_SUPPORTED: //0x10f
-               case MM_MESSAGE_FILE_NOT_FOUND: //0x110
-               case MM_MESSAGE_DRM_NOT_AUTHORIZED: //0x111
-               case MM_MESSAGE_VIDEO_NOT_CAPTURED: //0x113
                case MM_MESSAGE_SEEK_COMPLETED: //0x114
                default:
                        break;
        }
-       
+
+       if(err_code != PLAYER_ERROR_NONE && handle->user_cb[_PLAYER_EVENT_TYPE_ERROR])
+       {
+               ((player_error_cb)handle->user_cb[_PLAYER_EVENT_TYPE_ERROR])(err_code,handle->user_data[_PLAYER_EVENT_TYPE_ERROR]);
+       }
        return 1;
 }
 
+static bool  __video_stream_callback(void *stream, int stream_size, void *user_data, int width, int height)
+{
+       player_s * handle = (player_s*)user_data;
+       if( handle->user_cb[_PLAYER_EVENT_TYPE_VIDEO_FRAME] )
+       {
+               ((player_video_frame_decoded_cb)handle->user_cb[_PLAYER_EVENT_TYPE_VIDEO_FRAME])((unsigned char *)stream, width, height, stream_size, handle->user_data[_PLAYER_EVENT_TYPE_VIDEO_FRAME]);
+       }       
+       return TRUE;
+}
+
+static bool  __audio_stream_callback(void *stream, int stream_size, void *user_data)
+{
+       player_s * handle = (player_s*)user_data;
+       if( handle->user_cb[_PLAYER_EVENT_TYPE_AUDIO_FRAME] )
+       {
+               ((player_audio_frame_decoded_cb)handle->user_cb[_PLAYER_EVENT_TYPE_AUDIO_FRAME])((unsigned char *)stream, stream_size, handle->user_data[_PLAYER_EVENT_TYPE_AUDIO_FRAME]);
+       }       
+       return TRUE;
+}
+
+
 /*
 * Public Implementation
 */
@@ -339,7 +397,7 @@ int         player_prepare (player_h player)
 {
        PLAYER_INSTANCE_CHECK(player);
        player_s * handle = (player_s *) player;
-       PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);  
+       PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
 
        int ret;
        ret = mm_player_set_message_callback(handle->mm_handle, __msg_callback, (void*)handle);
@@ -386,7 +444,7 @@ int         player_set_uri (player_h player, const char *uri)
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(uri);
        player_s * handle = (player_s *) player;
-       PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE); 
+       PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
        
        int ret = mm_player_set_attribute(handle->mm_handle, NULL,MM_PLAYER_CONTENT_URI , uri, strlen(uri), (char*)NULL);
        if(ret != MM_ERROR_NONE)
@@ -414,7 +472,7 @@ int         player_set_memory_buffer (player_h player, const void *data, int size)
                return __convert_error_code(ret,(char*)__FUNCTION__);
        }
        else
-               return PLAYER_ERROR_NONE; 
+               return PLAYER_ERROR_NONE;
 }
 
 int    player_get_state (player_h player, player_state_e *state)
@@ -549,7 +607,7 @@ int         player_pause (player_h player)
 {
        PLAYER_INSTANCE_CHECK(player);
        player_s * handle = (player_s *) player;
-       PLAYER_STATE_CHECK(handle,PLAYER_STATE_PLAYING); 
+       PLAYER_STATE_CHECK(handle,PLAYER_STATE_PLAYING);
        
        int ret = mm_player_pause(handle->mm_handle);
        if(ret != MM_ERROR_NONE)
@@ -771,7 +829,7 @@ int player_set_display(player_h player, player_display_type_e type, player_displ
 {
        PLAYER_INSTANCE_CHECK(player);
        player_s * handle = (player_s *) player;
-       PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE); 
+       PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
 
        handle->display_handle = display;
        handle->display_type = type;
@@ -784,6 +842,32 @@ int player_set_display(player_h player, player_display_type_e type, player_displ
                return PLAYER_ERROR_NONE;
 }
 
+int player_set_playback_rate(player_h player, float rate)
+{
+       PLAYER_INSTANCE_CHECK(player);
+       PLAYER_CHECK_CONDITION(rate>=-5.0 && rate <= 5.0 ,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER" );
+       player_s * handle = (player_s *) player;
+       PLAYER_STATE_CHECK(handle,PLAYER_STATE_PLAYING);
+
+       int ret = mm_player_set_play_speed(handle->mm_handle, rate);
+
+       switch (ret)
+       {
+       case MM_ERROR_NONE:
+       case MM_ERROR_PLAYER_NO_OP:
+               ret = PLAYER_ERROR_NONE;
+               break;
+       case MM_ERROR_NOT_SUPPORT_API:
+       case MM_ERROR_PLAYER_SEEK:              
+               LOGE("[%s] %s(0x%08x)",__FUNCTION__, PLAYER_ERROR_INVALID_OPERATION,"PLAYER_ERROR_INVALID_OPERATION" );
+               ret = PLAYER_ERROR_INVALID_OPERATION;
+               break;
+       default:
+               return __convert_error_code(ret,(char*)__FUNCTION__);
+       }
+       return ret;
+}
+
 int player_set_x11_display_rotation(player_h player, player_display_rotation_e rotation)
 {
        PLAYER_INSTANCE_CHECK(player);
@@ -891,6 +975,226 @@ int player_get_x11_display_mode(player_h player, player_display_mode_e *mode)
        }
 }
 
+int player_set_audio_effect_output(player_h player,  sound_device_out_e output)
+{
+       PLAYER_INSTANCE_CHECK(player);
+       player_s * handle = (player_s *) player;
+
+       MMAudioFilterOutputMode _mode=MM_AUDIO_FILTER_OUTPUT_SPK;
+       switch(output)
+       {
+       case SOUND_DEVICE_OUT_SPEAKER:
+                _mode = MM_AUDIO_FILTER_OUTPUT_SPK;
+               break;
+       case SOUND_DEVICE_OUT_WIRED_ACCESSORY:
+       case SOUND_DEVICE_OUT_BT_A2DP:
+                _mode = MM_AUDIO_FILTER_OUTPUT_EAR;
+               break;
+       case SOUND_DEVICE_OUT_BT_SCO:
+       case SOUND_DEVICE_OUT_RECEIVER:
+               LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION BT_SCO and RECEIVER doesn't supported( output : %d)" ,__FUNCTION__, output);
+               return PLAYER_ERROR_INVALID_OPERATION;
+       }
+       
+       MMAudioFilterInfo filter;
+       memset(&filter, 0, sizeof(MMAudioFilterInfo));
+       filter.output_mode = _mode;
+       int ret = mm_player_apply_sound_filter(handle->mm_handle, &filter);
+       if(ret != MM_ERROR_NONE)
+       {
+               return __convert_error_code(ret,(char*)__FUNCTION__);
+       }
+       else
+       {
+               return PLAYER_ERROR_NONE;
+       }
+}
+
+int player_set_audio_effect_3d(player_h player, audio_effect_3d_e effect)
+{
+       PLAYER_INSTANCE_CHECK(player);
+       player_s * handle = (player_s *) player;
+
+       MMAudioFilterInfo filter;
+       memset(&filter, 0, sizeof(MMAudioFilterInfo));
+       filter.filter_type = MM_AUDIO_FILTER_3D;
+
+       switch(effect)
+       {
+       case AUDIO_EFFECT_3D_WIDE:
+                filter.sound_3d.mode = MM_3DSOUND_WIDE;
+               break;
+       case AUDIO_EFFECT_3D_DYNAMIC:
+                filter.sound_3d.mode = MM_3DSOUND_DYNAMIC;
+               break;
+       case AUDIO_EFFECT_3D_SURROUND:
+                filter.sound_3d.mode = MM_3DSOUND_SURROUND;
+               break;
+       }
+
+       int ret = mm_player_apply_sound_filter(handle->mm_handle, &filter);
+       if(ret != MM_ERROR_NONE)
+       {
+               return __convert_error_code(ret,(char*)__FUNCTION__);
+       }
+       else
+       {
+               return PLAYER_ERROR_NONE;
+       }
+}
+
+int player_set_audio_effect_equalizer(player_h player, audio_effect_equalizer_e effect)
+{
+       PLAYER_INSTANCE_CHECK(player);
+       player_s * handle = (player_s *) player;
+
+       MMAudioFilterInfo filter;
+       memset(&filter, 0, sizeof(MMAudioFilterInfo));
+       filter.filter_type = MM_AUDIO_FILTER_EQUALIZER;
+       
+       switch(effect)
+       {
+       case AUDIO_EFFECT_EQ_ROCK:
+               filter.equalizer.mode = MM_EQ_ROCK;
+               break;
+       case AUDIO_EFFECT_EQ_JAZZ:
+               filter.equalizer.mode = MM_EQ_JAZZ;
+               break;
+       case AUDIO_EFFECT_EQ_LIVE:
+               filter.equalizer.mode = MM_EQ_LIVE;
+               break;
+       case AUDIO_EFFECT_EQ_CLASSIC:
+                filter.equalizer.mode = MM_EQ_CLASSIC;
+               break;
+       case AUDIO_EFFECT_EQ_FULL_BASS:
+                filter.equalizer.mode = MM_EQ_FULL_BASS;
+               break;
+       case AUDIO_EFFECT_EQ_FULL_BASS_AND_TREBLE:
+                filter.equalizer.mode = MM_EQ_FULL_BASS_AND_TREBLE;
+               break;
+       case AUDIO_EFFECT_EQ_DANCE:
+                filter.equalizer.mode = MM_EQ_DANCE;
+               break;
+       case AUDIO_EFFECT_EQ_POP:
+               filter.equalizer.mode = MM_EQ_POP;
+               break;
+       case AUDIO_EFFECT_EQ_FULL_TREBLE:
+                filter.equalizer.mode = MM_EQ_FULL_TREBLE;
+               break;
+       case AUDIO_EFFECT_EQ_CLUB:
+                filter.equalizer.mode = MM_EQ_CLUB;
+               break;
+       case AUDIO_EFFECT_EQ_PARTY:
+                filter.equalizer.mode = MM_EQ_PARTY;
+               break;
+       case AUDIO_EFFECT_EQ_LARGE_HALL:
+               filter.equalizer.mode = MM_EQ_LARGE_HALL;
+               break;
+       case AUDIO_EFFECT_EQ_SOFT:
+                filter.equalizer.mode = MM_EQ_SOFT;
+               break;
+       case AUDIO_EFFECT_EQ_SOFT_ROCK:
+                filter.equalizer.mode = MM_EQ_SOFT_ROCK;
+               break;
+       }
+
+       int ret = mm_player_apply_sound_filter(handle->mm_handle, &filter);
+       if(ret != MM_ERROR_NONE)
+       {
+               return __convert_error_code(ret,(char*)__FUNCTION__);
+       }
+       else
+       {
+               return PLAYER_ERROR_NONE;
+       }
+}
+
+int player_set_audio_effect_reverb(player_h player, audio_effect_reverb_e effect)
+{
+       PLAYER_INSTANCE_CHECK(player);
+       player_s * handle = (player_s *) player;
+
+       MMAudioFilterInfo filter;
+       memset(&filter, 0, sizeof(MMAudioFilterInfo));
+       filter.filter_type = MM_AUDIO_FILTER_REVERB;
+       
+       switch(effect)
+       {
+       case AUDIO_EFFECT_REVERB_JAZZ_CLUB:
+               filter.reverb.mode = MM_REVERB_JAZZ_CLUB;
+               break;
+       case AUDIO_EFFECT_REVERB_CONCERT_HALL:
+                filter.reverb.mode = MM_REVERB_CONCERT_HALL;
+               break;
+       case AUDIO_EFFECT_REVERB_STADIUM:
+                filter.reverb.mode = MM_REVERB_STADIUM;
+               break;
+       }
+
+       int ret = mm_player_apply_sound_filter(handle->mm_handle, &filter);
+       if(ret != MM_ERROR_NONE)
+       {
+               return __convert_error_code(ret,(char*)__FUNCTION__);
+       }
+       else
+       {
+               return PLAYER_ERROR_NONE;
+       }
+}
+
+int player_set_audio_effect_extra(player_h player, audio_effect_extra_e effect)
+{
+       PLAYER_INSTANCE_CHECK(player);
+       player_s * handle = (player_s *) player;
+
+       MMAudioFilterInfo filter;
+       memset(&filter, 0, sizeof(MMAudioFilterInfo));
+       
+       switch(effect)
+       {
+       case AUDIO_EFFECT_EX_BASE:
+                filter.filter_type = MM_AUDIO_FILTER_BE;
+               break;
+       case AUDIO_EFFECT_EX_MUSIC_CLARITY:
+                filter.filter_type = MM_AUDIO_FILTER_MC;
+               break;
+       case AUDIO_EFFECT_EX_SURROUND:
+                filter.filter_type = MM_AUDIO_FILTER_SRSCSHP;
+               break;
+       case AUDIO_EFFECT_EX_SOUND_EXTERNAL:
+                filter.filter_type = MM_AUDIO_FILTER_SOUND_EX;
+               break;
+       }
+
+       int ret = mm_player_apply_sound_filter(handle->mm_handle, &filter);
+       if(ret != MM_ERROR_NONE)
+       {
+               return __convert_error_code(ret,(char*)__FUNCTION__);
+       }
+       else
+       {
+               return PLAYER_ERROR_NONE;
+       }
+}
+
+int player_clear_audio_effect(player_h player)
+{
+       PLAYER_INSTANCE_CHECK(player);
+       player_s * handle = (player_s *) player;
+       MMAudioFilterInfo filter;
+       memset(&filter, 0, sizeof(MMAudioFilterInfo));
+       filter.filter_type = MM_AUDIO_FILTER_NONE;
+       int ret = mm_player_apply_sound_filter(handle->mm_handle, &filter);
+       if(ret != MM_ERROR_NONE)
+       {
+               return __convert_error_code(ret,(char*)__FUNCTION__);
+       }
+       else
+       {
+               return PLAYER_ERROR_NONE;
+       }
+}
+
 int    player_get_video_size (player_h player, int *width, int *height)
 {
        PLAYER_INSTANCE_CHECK(player);
@@ -922,7 +1226,7 @@ int player_set_subtitle_path(player_h player, char* path)
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(path);
        player_s * handle = (player_s *) player;
-       PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE); 
+       PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
 
        int ret = mm_player_set_attribute(handle->mm_handle, NULL,"subtitle_uri" , path, strlen(path),"subtitle_silent", 0, (char*)NULL);
        if(ret != MM_ERROR_NONE)
@@ -957,6 +1261,23 @@ int player_capture_video(player_h player, player_video_captured_cb callback, voi
        }       
 }
 
+int player_set_streaming_cookie(player_h player, const char *cookie, int size)
+{
+       PLAYER_INSTANCE_CHECK(player);
+       PLAYER_NULL_ARG_CHECK(cookie);
+       PLAYER_CHECK_CONDITION(size>=0,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER" );
+       player_s * handle = (player_s *) player;
+       PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
+       
+       int ret = mm_player_set_attribute(handle->mm_handle, NULL,"streaming_cookie", cookie, size, (char*)NULL);
+       if(ret != MM_ERROR_NONE)
+       {
+               return __convert_error_code(ret,(char*)__FUNCTION__);
+       }
+       else
+               return PLAYER_ERROR_NONE;
+}
+
 int    player_set_started_cb (player_h player, player_started_cb callback, void *user_data)
 {
        return __set_callback(_PLAYER_EVENT_TYPE_BEGIN,player,callback,user_data);
@@ -1017,14 +1338,96 @@ int     player_unset_buffering_cb (player_h player)
        return __unset_callback(_PLAYER_EVENT_TYPE_BUFFERING,player);
 }
 
-
-int    player_set_subtilte_updated_cb(player_h player, player_subtitle_updated_cb callback, void* user_data )
+int    player_set_subtitle_updated_cb(player_h player, player_subtitle_updated_cb callback, void* user_data )
 {
        return __set_callback(_PLAYER_EVENT_TYPE_SUBTITLE,player,callback,user_data);
 }
 
-int    player_unset_subtilte_updated_cb (player_h player)
+int    player_unset_subtitle_updated_cb (player_h player)
 {
        return __unset_callback(_PLAYER_EVENT_TYPE_SUBTITLE,player);
 }
 
+int player_set_video_frame_decoded_cb(player_h player, player_video_frame_decoded_cb callback, void *user_data)
+{
+       PLAYER_INSTANCE_CHECK(player);
+       PLAYER_NULL_ARG_CHECK(callback);
+       player_s * handle = (player_s *) player;
+       if (handle->state != PLAYER_STATE_IDLE  &&  handle->state != PLAYER_STATE_READY)
+       {
+               LOGE("[%s] PLAYER_ERROR_INVALID_STATE (current state : %d)" ,__FUNCTION__, handle->state);
+               return PLAYER_ERROR_INVALID_STATE;
+       }
+       
+       handle->user_cb[_PLAYER_EVENT_TYPE_VIDEO_FRAME] = callback;
+       handle->user_data[_PLAYER_EVENT_TYPE_VIDEO_FRAME] = user_data;
+       LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_VIDEO_FRAME);
+       int ret = mm_player_set_video_stream_callback(handle->mm_handle, __video_stream_callback, (void*)handle);
+       if(ret != MM_ERROR_NONE)
+               return __convert_error_code(ret,(char*)__FUNCTION__);
+       else
+               return PLAYER_ERROR_NONE;
+}
+
+int player_unset_video_frame_decoded_cb(player_h player)
+{
+       PLAYER_INSTANCE_CHECK(player);
+       player_s * handle = (player_s *) player;
+       handle->user_cb[_PLAYER_EVENT_TYPE_VIDEO_FRAME] = NULL;
+       handle->user_data[_PLAYER_EVENT_TYPE_VIDEO_FRAME] = NULL;
+       LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_VIDEO_FRAME);
+       int ret = mm_player_set_video_stream_callback(handle->mm_handle, NULL, NULL);
+       if(ret != MM_ERROR_NONE)
+               return __convert_error_code(ret,(char*)__FUNCTION__);
+       else
+               return PLAYER_ERROR_NONE;
+}
+
+int player_set_audio_frame_decoded_cb(player_h player, int start, int end, player_audio_frame_decoded_cb callback, void *user_data)
+{
+       PLAYER_INSTANCE_CHECK(player);
+       PLAYER_NULL_ARG_CHECK(callback);
+       PLAYER_CHECK_CONDITION(start>=0 ,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER" );
+       PLAYER_CHECK_CONDITION(end>=1 ,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER" );
+       PLAYER_CHECK_CONDITION((end-start)>0 ,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER" );
+       player_s * handle = (player_s *) player;
+       if (handle->state != PLAYER_STATE_IDLE  &&  handle->state != PLAYER_STATE_READY)
+       {
+               LOGE("[%s] PLAYER_ERROR_INVALID_STATE (current state : %d)" ,__FUNCTION__, handle->state);
+               return PLAYER_ERROR_INVALID_STATE;
+       }
+       
+       handle->user_cb[_PLAYER_EVENT_TYPE_AUDIO_FRAME] = callback;
+       handle->user_data[_PLAYER_EVENT_TYPE_AUDIO_FRAME] = user_data;
+       LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_AUDIO_FRAME);
+
+       int ret = mm_player_set_attribute(handle->mm_handle, NULL, "pcm_extraction",TRUE, "pcm_extraction_start_msec", start, "pcm_extraction_end_msec", end, NULL);    
+       if(ret != MM_ERROR_NONE)
+               return __convert_error_code(ret,(char*)__FUNCTION__);
+       
+       ret = mm_player_set_audio_buffer_callback(handle->mm_handle, __audio_stream_callback, (void*)handle);
+       if(ret != MM_ERROR_NONE)
+               return __convert_error_code(ret,(char*)__FUNCTION__);
+       else
+               return PLAYER_ERROR_NONE;
+}
+
+int player_unset_audio_frame_decoded_cb(player_h player)
+{
+       PLAYER_INSTANCE_CHECK(player);
+       player_s * handle = (player_s *) player;
+
+       int ret = mm_player_set_attribute(handle->mm_handle, NULL, "pcm_extraction",FALSE, NULL);
+       if(ret != MM_ERROR_NONE)
+               return __convert_error_code(ret,(char*)__FUNCTION__);
+       
+       handle->user_cb[_PLAYER_EVENT_TYPE_AUDIO_FRAME] = NULL;
+       handle->user_data[_PLAYER_EVENT_TYPE_AUDIO_FRAME] = NULL;
+       LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_AUDIO_FRAME);
+
+       ret = mm_player_set_audio_buffer_callback(handle->mm_handle, NULL, NULL);
+       if(ret != MM_ERROR_NONE)
+               return __convert_error_code(ret,(char*)__FUNCTION__);
+       else
+               return PLAYER_ERROR_NONE;
+}
index 72e3afad3d61d14766c57c351d3c62b78abb3b0b..aa272b6445419cf71016e0ca9c8ba7443f3c352f 100644 (file)
@@ -142,11 +142,6 @@ static void subtitle_updated_cb(unsigned long duration, char *text, void *user_d
 static void video_captured_cb(unsigned char *data, int width, int height,unsigned int size, void *user_data)
 {
        g_print("[Player_Test] video_captured_cb!!!! width: %d, height : %d, size : %d \n",width, height,size);
-       if (data)
-       {
-               g_free(data);
-               data = NULL;
-       }
 }
 
 static void input_filename(char *filename)
@@ -200,7 +195,7 @@ static void input_filename(char *filename)
        {
                g_print("0. set subtile path() - %s \n", g_subtitle_uri);
                player_set_subtitle_path(g_player,g_subtitle_uri);
-               player_set_subtilte_updated_cb(g_player, subtitle_updated_cb, (void*)g_player);
+               player_set_subtitle_updated_cb(g_player, subtitle_updated_cb, (void*)g_player);
        }
        player_set_display(g_player,PLAYER_DISPLAY_TYPE_X11,GET_DISPLAY(ad.xid));