SET(submodule "video-util")
# for package file
-SET(dependents "dlog mm-transcode capi-base-common")
-SET(pc_dependents "capi-base-common")
+SET(dependents "dlog mm-transcode capi-base-common capi-system-info")
+SET(pc_dependents "capi-base-common capi-system-info")
SET(fw_name "${project_prefix}-${service}-${submodule}")
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
See the License for the specific language governing permissions and\r
limitations under the License.\r
-\r
-\r
-\r
#endif /* __cplusplus */
/**
+ * @file video_util.h
+ */
+
+/**
* @addtogroup CAPI_MEDIA_VIDEO_UTIL_MODULE
* @{
*/
/**
* @brief Creates a handle to video util.
+ * @since_tizen 2.3
+ *
* @details This function creates a handle to video util.
- * @remarks The @a video util handle must be released with video_util_destroy() by you.
+ *
+ * @remarks You must release the @a video util handle using video_util_destroy().\n
+ * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
+ * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
+ *
* @param[out] handle A handle to video util
- * @return 0 on success, otherwise a negative error value.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
* @retval #VIDEO_UTIL_ERROR_NONE Successful
* @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #VIDEO_UTIL_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
+ *
* @see video_util_destroy()
*
*/
/**
* @brief Destroys a handle to video util.
+ * @since_tizen 2.3
+ *
* @details The function frees all resources related to the video util handle. The video util
- * handle no longer can be used to perform any operation. A new video util handle
- * has to be created before the next usage.
+ * handle no longer can be used to perform any operation. A new video util handle
+ * has to be created before the next usage.
+ *
+ * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
+ * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.\n
*
* @param[in] handle The handle to video util
- * @return 0 on success, otherwise a negative error value.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
* @retval #VIDEO_UTIL_ERROR_NONE Successful
* @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
+ *
* @see video_util_create()
*
*/
/**
* @brief Sets the video util's file path.
- * @details This function sets the @a source path to transcode.
+ * @since_tizen 2.3
+ *
+ * @details This function sets the source @a path to transcode.
+ *
+ * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
+ * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
+ *
* @param[in] handle The handle to video util
* @param[in] path The source file path
- * @return return 0 on success, otherwise a negative error value.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
* @retval #VIDEO_UTIL_ERROR_NONE Successful
* @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #VIDEO_UTIL_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
+ *
* @see video_util_create()
* @see video_util_destroy()
*/
/**
* @brief Sets the video util's accurate mode.
- * @remarks If you do not set, the default value is @c false.
+ * @since_tizen 2.3
+ *
+ * @remarks If you do not set this, the default value is @c false.\n
+ * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
+ * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
+ *
* @param[in] handle The handle to video util
- * @param [in] mode @c true, user can get an accurated frame for given the duration in video_util_start_transcoding()\n
- * @c false, user can only get the nearest i-frame
- * @return return 0 on success, otherwise a negative error value.
+ * @param[in] mode Set @c true if the user can get an accurated frame for given the duration in video_util_start_transcoding(),
+ * otherwise set @c false if user can only get the nearest i-frame
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
* @retval #VIDEO_UTIL_ERROR_NONE Successful
* @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
+ *
* @see video_util_create()
* @see video_util_destroy()
*/
int video_util_set_accurate_mode(video_util_h handle, bool mode);
-
/**
- * @brief Sets the video codec for encoding video stream.
+ * @brief Sets the video codec for encoding video stream.
+ * @since_tizen 2.3
+ *
* @remarks You can get available list of video codec by using video_util_foreach_supported_video_codec().\n
- * If you do not set, the default codec is #VIDEO_UTIL_VIDEO_CODEC_MPEG4.
+ * If you do not set this, the default codec is #VIDEO_UTIL_VIDEO_CODEC_MPEG4.\n
+ * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
+ * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
+ *
* @param[in] handle The handle to video util
* @param[in] codec The video codec
- * @return 0 on success, otherwise a negative error value.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #VIDEO_UTIL_ERROR_NONE Successful
* @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED_FORMAT Not supported format
+ * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
+ *
* @see video_util_create()
* @see video_util_destroy()
- * @see video_util_get_video_codec()
* @see video_util_foreach_supported_video_codec()
*/
int video_util_set_video_codec(video_util_h handle, video_util_video_codec_e codec);
/**
- * @brief Sets the audio codec for encoding audio stream.
+ * @brief Sets the audio codec for encoding audio stream.
+ * @since_tizen 2.3
+ *
* @remarks You can get available list of audio codec by using video_util_foreach_supported_audio_codec().\n
- * If you do not set, the default codec is #VIDEO_UTIL_AUDIO_CODEC_AAC.
+ * If you do not set this, the default codec is #VIDEO_UTIL_AUDIO_CODEC_AAC.\n
+ * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
+ * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
+ *
* @param[in] handle The handle to video util
* @param[in] codec The audio codec
- * @return 0 on success, otherwise a negative error value.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
* @retval #VIDEO_UTIL_ERROR_NONE Successful
* @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED_FORMAT Not supported format
+ * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
+ *
* @see video_util_create()
* @see video_util_destroy()
- * @see video_util_get_audio_codec()
* @see video_util_foreach_supported_audio_codec()
*/
int video_util_set_audio_codec(video_util_h handle, video_util_audio_codec_e codec);
/**
- * @brief Sets the file format for transcoding media stream.
- * @remarks You can get available list of media format by using video_util_foreach_supported_file_format().\n
- * If you do not set, the default file format is #VIDEO_UTIL_FILE_FORMAT_3GP.
+ * @brief Sets the file format for transcoding media stream.
+ * @since_tizen 2.3
+ *
+ * @remarks You can get available list of media formats by using video_util_foreach_supported_file_format().\n
+ * If you do not set this, the default file format is #VIDEO_UTIL_FILE_FORMAT_3GP.\n
+ * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
+ * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
+ *
* @param[in] handle The handle to video util
* @param[in] format The media file format
- * @return 0 on success, otherwise a negative error value.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
* @retval #VIDEO_UTIL_ERROR_NONE Successful
* @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
+ *
* @see video_util_create()
* @see video_util_destroy()
- * @see video_util_get_file_format()
* @see video_util_foreach_supported_file_format()
*/
int video_util_set_file_format(video_util_h handle, video_util_file_format_e format);
/**
* @brief Sets the resolution(width and height).
- * @remarks If you do not set, the default resolution is original size.
+ * @since_tizen 2.3
+ *
+ * @remarks If you do not set, the default resolution is original size.\n
+ * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
+ * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
+ *
* @param[in] handle The handle to video util
- * @param[in] width The media's width, if the width is 0, it set original size.(minimum value is 128)
- * @param[in] height The media's height, if the height is 0, it set original size.(minimum value is 96)
- * @return 0 on success, otherwise a negative error value.
+ * @param[in] width The media's width \n
+ * If the width is 0, it set original size.(minimum value is 128)
+ * @param[in] height The media's height \n
+ * If the height is 0, it set original size.(minimum value is 96)
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
* @retval #VIDEO_UTIL_ERROR_NONE Successful
* @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
+ *
* @see video_util_create()
* @see video_util_destroy()
- * @see video_util_get_resolution()
*/
int video_util_set_resolution(video_util_h handle, int width, int height);
/**
* @brief Sets the frame rate.
- * @remarks If fps is set 0, the default is original fps from source.
+ * @since_tizen 2.3
+ *
+ * @remarks If fps is set @c 0, the default is original fps from source.\n
+ * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
+ * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
+ *
* @param[in] handle The handle to video util
+ *
* @param[in] fps The frame rate(minimum value is 5, maximum value is 30)
- * @return 0 on success, otherwise a negative error value.
- * @retval #VIDEO_UTIL_EROR_NONE Successful
- * @retval #VIDEO_UTIL_EROR_INVALID_PARAMETER Invalid parameter
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #VIDEO_UTIL_ERROR_NONE Successful
+ * @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
+ *
* @see video_util_create()
* @see video_util_destroy()
*/
/**
* @brief Transcodes the video for given video util handle.
+ * @since_tizen 2.3
+ *
* @details This function starts the transcoding from start time and for given duration.\n
-#video_util_transcoding_progress_cb() function is called during the video transcoding regularly after some interval.\n
-#video_util_transcoding_completed_cb() function is called and the transcoded video will be saved at the given output path when transcoding is finished corresponding callback.
- * @remarks If there is already exists same file in file system, then old file will be overwritten.
+ * #video_util_transcoding_progress_cb() function is called during the video transcoding regularly after some interval.\n
+ * #video_util_transcoding_completed_cb() function is called and the transcoded video will be saved at the given output path when transcoding is finished.
+ *
+ * @remarks If there already exists same file in file system, then old file will be overwritten.\n
+ * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
+ * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
+ *
* @param[in] handle The handle to video util
* @param[in] start The start position to transcode
- * @param[in] duration The duration is in seconds.\n
- If duration is 0, transcoding happens until end of the video.
+ * @param[in] duration The duration in seconds \n
+ * if duration is @c 0, transcoding happens until end of the video.
* @param[out] out_path The file path to save
- * @param[in] progress_cb The callback function to invoke
- * @param[in] completed_cb The callback function to invoke
+ * @param[in] progress_cb The callback function to be invoked
+ * @param[in] completed_cb The callback function to be invoked
* @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
* @retval #VIDEO_UTIL_ERROR_NONE Successful
* @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #VIDEO_UTIL_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
+ *
* @see video_util_create()
* @see video_util_destroy()
* @see video_util_transcoding_progress_cb()
int video_util_start_transcoding(video_util_h handle, unsigned long start, unsigned long duration, const char *out_path, video_util_transcoding_progress_cb progress_cb, video_util_transcoding_completed_cb completed_cb,void *user_data);
/**
- * @brief Cancels to transcode the video for given video util handle.
- * @details This function cancels the transcoding for given video util handle.\n
- * @remarks If this function is invoked during transcoding, the data transcoded is discard.
+ * @brief Cancels transcoding the video for given video util handle.
+ * @since_tizen 2.3
+
+ *
+ * @details This function cancels the transcoding for given video util handle.\n.
+ *
+ * @remarks If this function is invoked during transcoding, the data transcoded is discard.\n
+ * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
+ * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
+ *
* @param[in] handle The handle to video util
- * @return 0 on success, otherwise a negative error value.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
* @retval #VIDEO_UTIL_ERROR_NONE Successful
* @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #VIDEO_UTIL_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
+ *
* @see video_util_create()
* @see video_util_destroy()
* @see video_util_start_transcoding()
/**
* @brief Retreives the current position and duration of the video transcoding.
+ * @since_tizen 2.3
+
+ *
+ * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
+ * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.\n
+ *
* @param[in] handle The handle to video util
- * @param[out] current_position The transcoded current position
+ * @param[out] current_position Current position of transcoding
* @param[out] duration The duration is in seconds.\n
- If duration is 0, transcoding happens until end of the video.
- * @return 0 on success, otherwise a negative error value.
+ If duration is 0, transcoding happens until end of the video
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #VIDEO_UTIL_ERROR_NONE Successful
* @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre video_util_start_transcoding()
+ * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre video_util_start_transcoding().
+ *
* @see video_util_create()
* @see video_util_destroy()
*/
int video_util_get_progress_transcoding(video_util_h handle, unsigned long *current_position, unsigned long *duration);
/**
- * @brief Retrieves all supported media format by invoking a specific callback for each supported media format.
- * @remarks The callback invocation depends on the codec.
+ * @brief Retrieves all supported media formats by invoking a specific callback for each supported media format.
+ * @since_tizen 2.3
+ *
+ * @remarks The callback invocation depends on the codec.\n
+ * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
+ * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.\n
+ *
* @param[in] handle The handle to video util
* @param[in] callback The callback function to invoke
* @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
* @retval #VIDEO_UTIL_ERROR_NONE Successful
* @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
- * @post video_util_supported_file_format_cb() will be invoked
- * @see video_util_get_file_format()
+ * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED_FORMAT Not supported format
+ * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
+ * @post video_util_supported_file_format_cb() will be invoked.
+ *
* @see video_util_set_file_format()
* @see video_util_supported_file_format_cb()
*/
int video_util_foreach_supported_file_format(video_util_h handle, video_util_supported_file_format_cb callback, void *user_data);
/**
- * @brief Retrieves all supported video encoder by invoking a specific callback for each supported video encoder.
- * @remarks The callback invocation depends on the file format.
+ * @brief Retrieves all supported video encoders by invoking a specific callback for each supported video encoder.
+ * @since_tizen 2.3
+ *
+ * @remarks The callback invocation depends on the file format.\n
+ * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
+ * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.\n
+ *
* @param[in] handle The handle to video util
- * @param[in] callback The callback function to invoke
+ * @param[in] callback The callback function to be invoked
* @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
* @retval #VIDEO_UTIL_ERROR_NONE Successful
* @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
- * @post video_util_supported_video_encoder_cb() will be invoked
- * @see video_util_get_video_codec()
+ * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED_FORMAT Not supported format
+ * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
+ * @post video_util_supported_video_encoder_cb() will be invoked.
* @see video_util_set_video_codec()
* @see video_util_supported_video_encoder_cb()
*/
int video_util_foreach_supported_video_codec(video_util_h handle, video_util_supported_video_encoder_cb callback, void *user_data);
/**
- * @brief Retrieves all supported audio encoder by invoking a specific callback for each supported audio encoder.
- * @remarks The callback invocation depends on the file format.
+ * @brief Retrieves all supported audio encoders by invoking a specific callback for each supported audio encoder.
+ * @since_tizen 2.3
+ *
+ * @remarks The callback invocation depends on the file format.\n
+ * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
+ * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.\n
+ *
* @param[in] handle The handle to video util
- * @param[in] callback The callback function to invoke
+ * @param[in] callback The callback function to be invoked
* @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
* @retval #VIDEO_UTIL_ERROR_NONE Successful
* @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
- * @post video_util_supported_audio_encoder_cb() will be invoked
- * @see video_util_get_audio_codec()
- * @see video_util_set_audio_codec()
+ * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED_FORMAT Not supported format
+ * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
+ * @post video_util_supported_audio_encoder_cb() will be invoked.
* @see video_util_supported_audio_encoder_cb()
*/
int video_util_foreach_supported_audio_codec(video_util_h handle, video_util_supported_audio_encoder_cb callback, void *user_data);
#define __TIZEN_VIDEO_UTIL_PRIVATE_H__
#include <stdbool.h>
-#include <video_util_type.h>
#include <mm_types.h>
+#include <dlog.h>
+#include <video_util_type.h>
-typedef bool (*video_util_supported_type_cb)(int type, void *user_data);
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
-typedef struct
-{
- char *input_path;
- bool accurate_mode;
- video_util_video_codec_e video_codec;
- video_util_audio_codec_e audio_codec;
- video_util_file_format_e file_format;
- int width;
- int height;
- int fps;
- MMHandleType transcode_h;
-}video_util_s;
+#define LOG_TAG "CAPI_MEDIA_VIDEO_UTIL"
+
+#define video_util_debug(fmt, arg...) do { \
+ LOGD(""fmt"", ##arg); \
+ } while (0)
+
+#define video_util_info(fmt, arg...) do { \
+ LOGI(""fmt"", ##arg); \
+ } while (0)
+
+#define video_util_error(fmt, arg...) do { \
+ LOGE(""fmt"", ##arg); \
+ } while (0)
+
+#define video_util_debug_fenter() do { \
+ LOGD("<Enter>"); \
+ } while (0)
+
+#define video_util_debug_fleave() do { \
+ LOGD("<Leave>"); \
+ } while (0)
+
+#define video_util_secure_info(fmt, arg...) do { \
+ SECURE_LOGI(""fmt"", ##arg); \
+ } while (0)
+
+typedef bool (*video_util_supported_type_cb)(int type, void *user_data);
typedef struct
{
video_util_supported_type_cb supported_type_cb;
}video_util_type_cb_s;
+typedef struct
+{
+ char *input_path;
+ bool accurate_mode;
+ video_util_video_codec_e video_codec;
+ video_util_audio_codec_e audio_codec;
+ video_util_file_format_e file_format;
+ int width;
+ int height;
+ int fps;
+ unsigned long bps;
+ MMHandleType transcode_h;
+ video_util_cb_s *_util_cb;
+}video_util_s;
+
typedef enum
{
VIDEO_UTIL_TYPE_FORMAT = 0,
#define DEPRECATED_API __attribute__ ((deprecated))
#endif
-
-#define VIDEO_UTIL_ERROR_CLASS TIZEN_ERROR_MULTIMEDIA_CLASS | 0x90
+#define VIDEO_UTIL_ERROR_CLASS TIZEN_ERROR_VIDEO_UTIL
+#define TRANSCODER_FEATURE_PATH "http://tizen.org/feature/multimedia.transcoder"
+/**
+ * @file video_util_type.h
+ */
/**
* @addtogroup CAPI_MEDIA_VIDEO_UTIL_MODULE
/**
* @ingroup CAPI_MEDIA_VIDEO_UTIL_MODULE
- * @brief The enumerations of video util error
+ * @brief Enumeration for errors of a video util.
+ * @since_tizen 2.3
*/
typedef enum
{
- VIDEO_UTIL_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
- VIDEO_UTIL_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
- VIDEO_UTIL_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
- VIDEO_UTIL_ERROR_INVALID_OPERATION = VIDEO_UTIL_ERROR_CLASS | 0x01, /**< Invalid operation */
- VIDEO_UTIL_ERROR_BUSY = VIDEO_UTIL_ERROR_CLASS | 0x02, /**< Transcoding is already running */
+ VIDEO_UTIL_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ VIDEO_UTIL_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ VIDEO_UTIL_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ VIDEO_UTIL_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
+ VIDEO_UTIL_ERROR_BUSY = TIZEN_ERROR_RESOURCE_BUSY, /**< Device or resource busy */
+ VIDEO_UTIL_ERROR_NOT_SUPPORTED_FORMAT = TIZEN_ERROR_VIDEO_UTIL | 0x01, /**< Not supported format */
+ VIDEO_UTIL_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
+ VIDEO_UTIL_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED /**< Not supported */
} video_util_error_e;
/**
* @ingroup CAPI_MEDIA_VIDEO_UTIL_MODULE
- * @brief The enumerations of video codec
+ * @brief Enumeration for video codec.
+ * @since_tizen 2.3
*/
typedef enum
{
VIDEO_UTIL_VIDEO_CODEC_MPEG4 = 0, /**< MPEG4 */
VIDEO_UTIL_VIDEO_CODEC_H263, /**< H.263 */
VIDEO_UTIL_VIDEO_CODEC_H264, /**< H.264 */
- VIDEO_UTIL_VIDEO_CODEC_NONE /**< no transcoding for video */
+ VIDEO_UTIL_VIDEO_CODEC_NONE /**< No transcoding for video */
}video_util_video_codec_e;
/**
* @ingroup CAPI_MEDIA_VIDEO_UTIL_MODULE
- * @brief The enumerations of audio codec
+ * @brief Enumeration for audio codec.
+ * @since_tizen 2.3
*/
typedef enum
{
VIDEO_UTIL_AUDIO_CODEC_AAC = 0, /**< AAC */
- VIDEO_UTIL_AUDIO_CODEC_AMRNB, /**< AMRNB */
- VIDEO_UTIL_AUDIO_CODEC_NONE /**< no transcoding for audio */
+ VIDEO_UTIL_AUDIO_CODEC_AMRNB, /**< AMRNB */
+ VIDEO_UTIL_AUDIO_CODEC_NONE /**< No transcoding for audio */
}video_util_audio_codec_e;
/**
* @ingroup CAPI_MEDIA_VIDEO_UTIL_MODULE
- * @brief The enumerations of media format
+ * @brief Enumeration for formats of a media.
+ * @since_tizen 2.3
*/
typedef enum
{
VIDEO_UTIL_FILE_FORMAT_3GP = 0, /**< 3GP */
- VIDEO_UTIL_FILE_FORMAT_MP4, /**< MP4 */
- VIDEO_UTIL_FILE_FORMAT_MAX /**< MAX */
+ VIDEO_UTIL_FILE_FORMAT_MP4, /**< MP4 */
+ VIDEO_UTIL_FILE_FORMAT_MAX /**< MAX */
}video_util_file_format_e;
/**
* @ingroup CAPI_MEDIA_VIDEO_UTIL_MODULE
- * @brief The handle to video util
+ * @brief Video util handle.
+ * @since_tizen 2.3
*/
typedef struct video_util_s *video_util_h;
/**
* @ingroup CAPI_MEDIA_VIDEO_UTIL_MODULE
- * @brief Called during the video transcoding regularly.
- The interval of callback invocation depends on the framework.
+ * @brief Called regularly during the video transcoding.
+ * @since_tizen 2.3
+ *
+ * @details The interval of callback invocation depends on the framework.
*
* @param[in] current_position The current position in milliseconds
* @param[in] duration The duration in seconds
* @param[in] user_data The user data passed from the callback registration function
+ *
* @pre This callback function is invoked if you register this callback using video_util_set_progress_transcoding_cb().
+ *
* @see video_util_start_transcoding()
*/
typedef void (*video_util_transcoding_progress_cb)(unsigned long current_position, unsigned long duration, void *user_data);
/**
* @ingroup CAPI_MEDIA_VIDEO_UTIL_MODULE
* @brief Called when transcoding is finished just before storing in the file.
+ * @since_tizen 2.3
*
* @param[in] error_code The error code of video util
* @param[in] user_data The user data passed from the callback registration function
+ *
* @pre video_util_start_transcoding() will invoke this function.
*/
typedef void (*video_util_transcoding_completed_cb)(video_util_error_e error_code, void *user_data);
/**
- * @brief Gets called iteratively to notify you of supported file formats.
+ * @brief Called iteratively to notify you about the supported file formats.
+ * @since_tizen 2.3
+ *
* @param[in] format The format of media files
* @param[in] user_data The user data passed from the foreach function
- * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
+ *
+ * @return @c true to continue with the next iteration of the loop,
+ * otherwise @c false to break out of the loop
+ *
* @pre video_util_foreach_supported_file_format() will invoke this callback.
*/
typedef bool (*video_util_supported_file_format_cb)(video_util_file_format_e format, void *user_data);
/**
- * @brief Gets called iteratively to notify you of supported video codec.
+ * @brief Called iteratively to notify you of supported video codec.
+ * @since_tizen 2.3
+ *
* @param[in] format The codec of video
* @param[in] user_data The user data passed from the foreach function
- * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
+ *
+ * @return @c true to continue with the next iteration of the loop,
+ * otherwise @c false to break out of the loop
+ *
* @pre video_util_foreach_supported_video_codec() will invoke this callback.
*/
typedef bool (*video_util_supported_video_encoder_cb)(video_util_video_codec_e codec, void *user_data);
-
/**
- * @brief Gets called iteratively to notify you of supported audio codec.
+ * @brief Called iteratively to notify you about the supported audio codec.
+ * @since_tizen 2.3
+ *
* @param[in] format The codec of audio
* @param[in] user_data The user data passed from the foreach function
- * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
+ *
+ * @return @c true to continue with the next iteration of the loop,
+ * otherwise @c false to break out of the loop
+ *
* @pre video_util_foreach_supported_audio_codec() will invoke this callback.
*/
typedef bool (*video_util_supported_audio_encoder_cb)(video_util_audio_codec_e codec, void *user_data);
__attribute__ ((deprecated)) typedef bool (*video_util_progress_transcoding_cb)(video_util_error_e error, unsigned long current_position, unsigned long duration, void *user_data);
-
-
/**
* @}
*/
Name: capi-media-video-util
Summary: A Video Utility library in Tizen Native API
-Version: 0.1.6
-Release: 2
+Version: 0.1.7
+Release: 5
Group: System/Libraries
License: Apache License, Version 2.0
Source0: %{name}-%{version}.tar.gz
BuildRequires: pkgconfig(mm-common)
BuildRequires: pkgconfig(mm-transcode)
BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(capi-system-info)
BuildRequires: cmake
BuildRequires: gettext-devel
#define VIDEO_UTIL_MINIMUM_DURATION 1000 /*1 sec*/
#define VIDEO_UTIL_MINIMUM_FPS 5
#define VIDEO_UTIL_MAXIMUM_FPS 30
+#define VIDEO_UTIL_MAXIMUM_BPS 4294967295UL
static int __video_util_create_transcode_handle(video_util_s *handle);
static int __video_util_destroy_transcode_handle(video_util_s *handle);
ret = mm_transcode_create(&transcode_h);
if(ret != MM_ERROR_NONE)
{
- if(ret == MM_ERROR_INVALID_ARGUMENT)
+ if(ret == MM_ERROR_TRANSCODE_INVALID_VALUE)
{
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
+ video_util_error("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
+ } else if(ret == MM_ERROR_TRANSCODE_NOT_SUPPORT_FORMAT)
+ {
+ video_util_error("NOT_SUPPORTED_FORMAT(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED_FORMAT);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
}
else
{
- LOGE("INVALID_OPERATION(0x%08x)", VIDEO_UTIL_ERROR_INVALID_OPERATION);
+ video_util_error("INVALID_OPERATION(0x%08x)", ret);
return VIDEO_UTIL_ERROR_INVALID_OPERATION;
}
}
ret = mm_transcode_prepare(transcode_h, handle->input_path, handle->file_format, handle->video_codec, handle->audio_codec);
if(ret != MM_ERROR_NONE)
{
- if(ret == MM_ERROR_INVALID_ARGUMENT)
+ if(ret == MM_ERROR_TRANSCODE_INVALID_VALUE)
{
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
- return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
+ video_util_error("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
+ ret = VIDEO_UTIL_ERROR_INVALID_PARAMETER;
+ } else if(ret == MM_ERROR_TRANSCODE_NOT_SUPPORT_FORMAT)
+ {
+ video_util_error("NOT_SUPPORTED_FORMAT(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED_FORMAT);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
}
else
{
- LOGE("INVALID_OPERATION(0x%08x)", VIDEO_UTIL_ERROR_INVALID_OPERATION);
- return VIDEO_UTIL_ERROR_INVALID_OPERATION;
+ video_util_error("INVALID_OPERATION(0x%08x)", ret);
+ ret = VIDEO_UTIL_ERROR_INVALID_OPERATION;
}
}
- handle->transcode_h = transcode_h;
+ if(ret == MM_ERROR_NONE)
+ {
+ handle->transcode_h = transcode_h;
+ }
+ else
+ {
+ __video_util_destroy_transcode_handle(handle);
+ }
return ret;
}
if(handle->transcode_h)
{
ret = mm_transcode_destroy(handle->transcode_h);
- LOGI("mm_transcode_destroy [%d]\n", ret);
if(ret != MM_ERROR_NONE)
{
- LOGE("INVALID_OPERATION(0x%08x)", VIDEO_UTIL_ERROR_INVALID_OPERATION);
+ video_util_error("INVALID_OPERATION (0x%08x)", ret);
return VIDEO_UTIL_ERROR_INVALID_OPERATION;
}
}
ret = mm_transcode_is_busy(handle->transcode_h, is_busy);
if(ret != MM_ERROR_NONE)
{
- LOGE("INVALID_OPERATION(0x%08x)", VIDEO_UTIL_ERROR_INVALID_OPERATION);
+ video_util_error("INVALID_OPERATION(0x%08x)", ret);
return VIDEO_UTIL_ERROR_INVALID_OPERATION;
}
}
{
if((video_codec < 0) || (video_codec > VIDEO_UTIL_VIDEO_CODEC_NONE ))
{
- LOGE("invalid video_codec [%d]", video_codec);
+ video_util_error("invalid video_codec [%d]", video_codec);
return false;
}
{
if((audio_codec < 0) || (audio_codec > VIDEO_UTIL_AUDIO_CODEC_NONE ))
{
- LOGE("invalid audio_codec [%d]", audio_codec);
+ video_util_error("invalid audio_codec [%d]", audio_codec);
return false;
}
{
if((file_format < 0) || (file_format >= VIDEO_UTIL_FILE_FORMAT_MAX ))
{
- LOGE("invalid file_format [%d]", file_format);
+ video_util_error("invalid file_format [%d]", file_format);
return false;
}
{
if(((width > 0) && (width < VIDEO_UTIL_MINIMUM_WIDTH)) || (width < 0))
{
- LOGE("invalid width [%d]", width);
+ video_util_error("invalid width [%d]", width);
return false;
}
if(((height > 0) && (height < VIDEO_UTIL_MINIMUM_HEIGHT)) || (height < 0))
{
- LOGE("invalid height [%d]", height);
+ video_util_error("invalid height [%d]", height);
return false;
}
{
if(((duration > 0) && (duration < VIDEO_UTIL_MINIMUM_DURATION)) || (duration < 0))
{
- LOGE("invalid duration [%d]", duration);
+ video_util_error("invalid duration [%d]", duration);
return false;
}
{
if((fps < 0) || ((fps > 0) && (fps < VIDEO_UTIL_MINIMUM_FPS)) || (fps > VIDEO_UTIL_MAXIMUM_FPS))
{
- LOGE("invalid fps [%d]", fps);
+ video_util_error("invalid fps [%d]", fps);
return false;
}
static video_util_error_e __video_util_error_convert(int error)
{
- LOGI("error [%d]\n", error);
-
if(error == MM_ERROR_NONE)
{
+ video_util_debug("Error None");
return VIDEO_UTIL_ERROR_NONE;
}
- else if(error == MM_ERROR_INVALID_ARGUMENT)
+ else if(error == MM_ERROR_TRANSCODE_INVALID_VALUE)
{
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
+ video_util_error("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
+ } else if(error == MM_ERROR_TRANSCODE_NOT_SUPPORT_FORMAT)
+ {
+ video_util_error("NOT_SUPPORTED_FORMAT(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED_FORMAT);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
}
else
{
- LOGE("INVALID_OPERATION(0x%08x)", VIDEO_UTIL_ERROR_INVALID_OPERATION);
+ video_util_error("INVALID_OPERATION(0x%08x)", error);
return VIDEO_UTIL_ERROR_INVALID_OPERATION;
}
}
static void __video_util_transcode_progress_cb(unsigned long current_position, unsigned long duration, void *user_data)
{
- int error_value = VIDEO_UTIL_ERROR_NONE;
video_util_cb_s *_util_cb = (video_util_cb_s *)user_data;
if((_util_cb != NULL) && (_util_cb->transcode_progress_cb != NULL))
}
else
{
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
- return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
+ video_util_error("Invalid type (%d)", type);
+ ret = VIDEO_UTIL_ERROR_INVALID_PARAMETER;
}
UTIL_SAFE_FREE(codec_cb);
{
int ret = VIDEO_UTIL_ERROR_NONE;
- LOGI("enter \n");
+ bool transcoder_supported = false;
+ if (0 == system_info_get_platform_bool(TRANSCODER_FEATURE_PATH, &transcoder_supported)) {
+ if (false == transcoder_supported) {
+ video_util_error("VIDEO_UTIL_ERROR_NOT_SUPPORTED(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
+ } else {
+ video_util_error("Error - System Info of Platform(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
if(handle == NULL)
{
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
+ video_util_error("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
}
video_util_s *_handle = (video_util_s*)calloc(1,sizeof(video_util_s));
if(_handle == NULL)
{
- LOGE("OUT_OF_MEMORY(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
+ video_util_error("OUT_OF_MEMORY(0x%08x)", VIDEO_UTIL_ERROR_OUT_OF_MEMORY);
return VIDEO_UTIL_ERROR_OUT_OF_MEMORY;
}
_handle->height = 0;
_handle->fps = 0;
_handle->transcode_h = 0;
+ _handle->_util_cb = NULL;
*handle = (video_util_h)_handle;
- LOGI("leave \n");
-
return ret;
}
int video_util_destroy(video_util_h handle)
{
int ret = VIDEO_UTIL_ERROR_NONE;
- video_util_s *_handle = (video_util_s*)handle;
-
- LOGI("enter \n");
+ video_util_s *_handle = NULL;
+ bool transcoder_supported = false;
+ if (0 == system_info_get_platform_bool(TRANSCODER_FEATURE_PATH, &transcoder_supported)) {
+ if (false == transcoder_supported) {
+ video_util_error("VIDEO_UTIL_ERROR_NOT_SUPPORTED(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
+ } else {
+ video_util_error("Error - System Info of Platform(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
- if(!_handle)
+ _handle = (video_util_s*)handle;
+ if(_handle == NULL)
{
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
+ video_util_error("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
}
ret = __video_util_destroy_transcode_handle(_handle);
+ UTIL_SAFE_FREE(_handle->_util_cb);
+ video_util_debug("FREE(_handle->_util_cb)");
UTIL_SAFE_FREE(_handle->input_path);
UTIL_SAFE_FREE(_handle);
- LOGI("leave \n");
-
return ret;
}
int video_util_set_file_path(video_util_h handle, const char *file_path)
{
int ret = VIDEO_UTIL_ERROR_NONE;
- video_util_s *_handle = (video_util_s*)handle;
+ video_util_s *_handle = NULL;
bool is_busy = false;
+ bool transcoder_supported = false;
+ if (0 == system_info_get_platform_bool(TRANSCODER_FEATURE_PATH, &transcoder_supported)) {
+ if (false == transcoder_supported) {
+ video_util_error("VIDEO_UTIL_ERROR_NOT_SUPPORTED(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
+ } else {
+ video_util_error("Error - System Info of Platform(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
+ _handle = (video_util_s*)handle;
if((_handle != NULL) && (UTIL_STRING_VALID(file_path)))
{
- LOGI("file_path [%s]\n", file_path);
+ video_util_secure_info("file_path [%s]\n", file_path);
if(_handle->input_path != NULL)
{
if(is_busy)
{
- LOGE("BUSY!! Transcoding is already running.\n");
+ video_util_error("BUSY!! Transcoding is already running.\n");
return VIDEO_UTIL_ERROR_BUSY;
}
else
_handle->input_path = strdup(file_path);
if(_handle->input_path == NULL)
{
- LOGE("OUT_OF_MEMORY(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
+ video_util_error("OUT_OF_MEMORY(0x%08x)", VIDEO_UTIL_ERROR_OUT_OF_MEMORY);
return VIDEO_UTIL_ERROR_OUT_OF_MEMORY;
}
}
else
{
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
+ video_util_error("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
}
return ret;
}
-int video_util_get_file_path(video_util_h handle, char **file_path)
+int video_util_set_accurate_mode(video_util_h handle, bool accurate_mode)
{
int ret = VIDEO_UTIL_ERROR_NONE;
- video_util_s *_handle = (video_util_s*)handle;
-
- if(_handle && file_path)
- {
- if(UTIL_STRING_VALID(_handle->input_path))
- {
- *file_path = strdup(_handle->input_path);
- if(*file_path == NULL)
- {
- LOGE("OUT_OF_MEMORY(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
- return VIDEO_UTIL_ERROR_OUT_OF_MEMORY;
- }
- }
- else
- {
- *file_path = NULL;
+ video_util_s *_handle = NULL;
+ bool transcoder_supported = false;
+ if (0 == system_info_get_platform_bool(TRANSCODER_FEATURE_PATH, &transcoder_supported)) {
+ if (false == transcoder_supported) {
+ video_util_error("VIDEO_UTIL_ERROR_NOT_SUPPORTED(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
}
- }
- else
- {
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
- return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
+ } else {
+ video_util_error("Error - System Info of Platform(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
}
- return ret;
-}
-
-int video_util_set_accurate_mode(video_util_h handle, bool accurate_mode)
-{
- int ret = VIDEO_UTIL_ERROR_NONE;
- video_util_s *_handle = (video_util_s*)handle;
-
- LOGI("accurate_mode [%d]\n", accurate_mode);
-
+ _handle = (video_util_s*)handle;
if(_handle != NULL)
{
_handle->accurate_mode= accurate_mode;
}
else
{
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
- return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
-}
-
-int video_util_get_accurate_mode(video_util_h handle, bool *accurate_mode)
-{
- int ret = VIDEO_UTIL_ERROR_NONE;
- video_util_s *_handle = (video_util_s*)handle;
-
- if(_handle && accurate_mode)
- {
- *accurate_mode = _handle->accurate_mode;
- }
- else
- {
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
+ video_util_error("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
}
int video_util_set_video_codec(video_util_h handle, video_util_video_codec_e codec)
{
int ret = VIDEO_UTIL_ERROR_NONE;
- video_util_s *_handle = (video_util_s*)handle;
+ video_util_s *_handle = NULL;
bool is_busy = false;
+ bool transcoder_supported = false;
+ if (0 == system_info_get_platform_bool(TRANSCODER_FEATURE_PATH, &transcoder_supported)) {
+ if (false == transcoder_supported) {
+ video_util_error("VIDEO_UTIL_ERROR_NOT_SUPPORTED(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
+ } else {
+ video_util_error("Error - System Info of Platform(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
- LOGI("video_codec [%d]\n", codec);
-
+ _handle = (video_util_s*)handle;
if((_handle != NULL) && (__video_util_check_video_codec(codec)))
{
ret = __video_util_check_transcode_is_busy(_handle, &is_busy);
if(is_busy)
{
- LOGE("BUSY!! Transcoding is already running.\n");
+ video_util_error("BUSY!! Transcoding is already running.\n");
return VIDEO_UTIL_ERROR_BUSY;
}
else
}
else
{
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
- return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
-}
-
-int video_util_get_video_codec(video_util_h handle, video_util_video_codec_e *codec)
-{
- int ret = VIDEO_UTIL_ERROR_NONE;
- video_util_s *_handle = (video_util_s*)handle;
-
- if(_handle && codec)
- {
- *codec = _handle->video_codec;
- }
- else
- {
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
+ video_util_error("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
}
int video_util_set_audio_codec(video_util_h handle, video_util_audio_codec_e codec)
{
int ret = VIDEO_UTIL_ERROR_NONE;
- video_util_s *_handle = (video_util_s*)handle;
+ video_util_s *_handle = NULL;
bool is_busy = false;
+ bool transcoder_supported = false;
+ if (0 == system_info_get_platform_bool(TRANSCODER_FEATURE_PATH, &transcoder_supported)) {
+ if (false == transcoder_supported) {
+ video_util_error("VIDEO_UTIL_ERROR_NOT_SUPPORTED(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
+ } else {
+ video_util_error("Error - System Info of Platform(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
- LOGI("audio_codec [%d]\n", codec);
-
+ _handle = (video_util_s*)handle;
if((_handle != NULL) && (__video_util_check_audio_codec(codec)))
{
ret = __video_util_check_transcode_is_busy(_handle, &is_busy);
if(is_busy)
{
- LOGE("BUSY!! Transcoding is already running.\n");
+ video_util_error("BUSY!! Transcoding is already running.\n");
return VIDEO_UTIL_ERROR_BUSY;
}
else
}
else
{
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
- return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
-}
-
-int video_util_get_audio_codec(video_util_h handle, video_util_audio_codec_e *codec)
-{
- int ret = VIDEO_UTIL_ERROR_NONE;
- video_util_s *_handle = (video_util_s*)handle;
-
- if(_handle && codec)
- {
- *codec = _handle->audio_codec;
- }
- else
- {
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
+ video_util_error("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
}
int video_util_set_file_format(video_util_h handle, video_util_file_format_e format)
{
int ret = VIDEO_UTIL_ERROR_NONE;
- video_util_s *_handle = (video_util_s*)handle;
+ video_util_s *_handle = NULL;
bool is_busy = false;
+ bool transcoder_supported = false;
+ if (0 == system_info_get_platform_bool(TRANSCODER_FEATURE_PATH, &transcoder_supported)) {
+ if (false == transcoder_supported) {
+ video_util_error("VIDEO_UTIL_ERROR_NOT_SUPPORTED(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
+ } else {
+ video_util_error("Error - System Info of Platform(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
- LOGI("file_format [%d]\n", format);
-
+ _handle = (video_util_s*)handle;
if((_handle != NULL) && (__video_util_check_file_format(format)))
{
ret = __video_util_check_transcode_is_busy(_handle, &is_busy);
if(is_busy)
{
- LOGE("BUSY!! Transcoding is already running.\n");
+ video_util_error("BUSY!! Transcoding is already running.\n");
return VIDEO_UTIL_ERROR_BUSY;
}
else
}
else
{
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
- return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
-}
-
-int video_util_get_file_format(video_util_h handle, video_util_file_format_e *format)
-{
- int ret = VIDEO_UTIL_ERROR_NONE;
- video_util_s *_handle = (video_util_s*)handle;
-
- if(_handle && format)
- {
- *format = _handle->file_format;
- }
- else
- {
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
+ video_util_error("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
}
int video_util_set_resolution(video_util_h handle, int width, int height)
{
int ret = VIDEO_UTIL_ERROR_NONE;
- video_util_s *_handle = (video_util_s*)handle;
-
- LOGI("width [%d] height [%d]\n", width, height);
+ video_util_s *_handle = NULL;
+ bool transcoder_supported = false;
+ if (0 == system_info_get_platform_bool(TRANSCODER_FEATURE_PATH, &transcoder_supported)) {
+ if (false == transcoder_supported) {
+ video_util_error("VIDEO_UTIL_ERROR_NOT_SUPPORTED(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
+ } else {
+ video_util_error("Error - System Info of Platform(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
+ _handle = (video_util_s*)handle;
if((_handle != NULL) && (__video_util_check_resolution(width, height)))
{
_handle->width= width;
}
else
{
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
- return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
- }
-
- return ret;
-}
-
-int video_util_get_resolution(video_util_h handle, int *width, int *height)
-{
- int ret = VIDEO_UTIL_ERROR_NONE;
- video_util_s *_handle = (video_util_s*)handle;
-
- if(_handle && width && height)
- {
- *width = _handle->width;
- *height = _handle->height;
- }
- else
- {
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
+ video_util_error("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
}
int video_util_set_fps(video_util_h handle, int fps)
{
int ret = VIDEO_UTIL_ERROR_NONE;
- video_util_s *_handle = (video_util_s*)handle;
+ video_util_s *_handle = NULL;
+ bool transcoder_supported = false;
+ if (0 == system_info_get_platform_bool(TRANSCODER_FEATURE_PATH, &transcoder_supported)) {
+ if (false == transcoder_supported) {
+ video_util_error("VIDEO_UTIL_ERROR_NOT_SUPPORTED(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
+ } else {
+ video_util_error("Error - System Info of Platform(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
+ _handle = (video_util_s*)handle;
if(_handle && __video_util_check_fps(fps))
{
_handle->fps= fps;
}
else
{
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
+ video_util_error("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
}
int video_util_start_transcoding(video_util_h handle, unsigned long start, unsigned long duration, const char *out_path, video_util_transcoding_progress_cb progress_cb, video_util_transcoding_completed_cb completed_cb,void *user_data)
{
int ret = VIDEO_UTIL_ERROR_NONE;
- video_util_s *_handle = (video_util_s*)handle;
+ video_util_s *_handle = NULL;
mm_seek_mode_e accurate_mode = MM_SEEK_NUM;
bool is_busy = false;
+ bool transcoder_supported = false;
+ if (0 == system_info_get_platform_bool(TRANSCODER_FEATURE_PATH, &transcoder_supported)) {
+ if (false == transcoder_supported) {
+ video_util_error("VIDEO_UTIL_ERROR_NOT_SUPPORTED(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
+ } else {
+ video_util_error("Error - System Info of Platform(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
- LOGI("start [%d] duration [%d]\n", start, duration);
+ _handle = (video_util_s*)handle;
+ video_util_debug("start [%d] duration [%d]\n", start, duration);
if(_handle && (__video_util_check_duration(duration)) && (UTIL_STRING_VALID(_handle->input_path)) && (UTIL_STRING_VALID(out_path)) && completed_cb)
{
if(!_handle->transcode_h)
{
- LOGE("INVALID_OPERATION(0x%08x)", VIDEO_UTIL_ERROR_INVALID_OPERATION);
+ video_util_error("INVALID_OPERATION(0x%08x)", VIDEO_UTIL_ERROR_INVALID_OPERATION);
return VIDEO_UTIL_ERROR_INVALID_OPERATION;
}
}
if(is_busy)
{
- LOGE("BUSY!! Transcoding is already running.\n");
+ video_util_error("BUSY!! Transcoding is already running.\n");
return VIDEO_UTIL_ERROR_BUSY;
}
}
- LOGI("width [%d] height [%d] fps [%d]v_codec [%d] a_codec [%d] file_format [%d] accurate [%d]\n",
+ video_util_debug("width [%d] height [%d] fps [%d]v_codec [%d] a_codec [%d] file_format [%d] accurate [%d]\n",
_handle->width, _handle->height, _handle->fps, _handle->video_codec, _handle->audio_codec, _handle->file_format, _handle->accurate_mode);
- video_util_cb_s *_util_cb = (video_util_cb_s*)calloc(1, sizeof(video_util_cb_s));
- _util_cb->user_data = user_data;
- _util_cb->transcode_completed_cb = completed_cb;
- _util_cb->transcode_progress_cb = progress_cb;
+ _handle->_util_cb = (video_util_cb_s*)calloc(1, sizeof(video_util_cb_s));
+ if(!_handle->_util_cb) {
+ video_util_error("Error _util_cb");
+ return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
+ }
+ _handle->_util_cb->user_data = user_data;
+ _handle->_util_cb->transcode_completed_cb = completed_cb;
+ _handle->_util_cb->transcode_progress_cb = progress_cb;
if(_handle->accurate_mode)
accurate_mode = MM_SEEK_ACCURATE;
else
accurate_mode = MM_SEEK_INACCURATE;
- ret = mm_transcode(_handle->transcode_h, _handle->width, _handle->height, _handle->fps, start, duration, accurate_mode, out_path, (mm_transcode_progress_callback)__video_util_transcode_progress_cb, (mm_transcode_completed_callback)__video_util_transcode_completed_cb, (void *)_util_cb);
+ ret = mm_transcode(_handle->transcode_h, _handle->width, _handle->height, _handle->fps, start, duration, accurate_mode, out_path, (mm_transcode_progress_callback)__video_util_transcode_progress_cb, (mm_transcode_completed_callback)__video_util_transcode_completed_cb, (void *)_handle->_util_cb);
if(ret != MM_ERROR_NONE)
{
- if(ret == MM_ERROR_INVALID_ARGUMENT)
+ UTIL_SAFE_FREE(_handle->_util_cb);
+
+ if(ret == MM_ERROR_TRANSCODE_INVALID_VALUE)
{
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
+ video_util_error("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
+ } else if(ret == MM_ERROR_TRANSCODE_NOT_SUPPORT_FORMAT)
+ {
+ video_util_error("NOT_SUPPORTED_FORMAT(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED_FORMAT);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
}
else
{
- LOGE("INVALID_OPERATION(0x%08x)", VIDEO_UTIL_ERROR_INVALID_OPERATION);
+ video_util_error("INVALID_OPERATION(0x%08x)", ret);
return VIDEO_UTIL_ERROR_INVALID_OPERATION;
}
}
}
else
{
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
+ video_util_error("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
}
int video_util_cancel_transcoding(video_util_h handle)
{
int ret = VIDEO_UTIL_ERROR_NONE;
- video_util_s *_handle = (video_util_s*)handle;
+ video_util_s *_handle = NULL;
+ bool transcoder_supported = false;
+ if (0 == system_info_get_platform_bool(TRANSCODER_FEATURE_PATH, &transcoder_supported)) {
+ if (false == transcoder_supported) {
+ video_util_error("VIDEO_UTIL_ERROR_NOT_SUPPORTED(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
+ } else {
+ video_util_error("Error - System Info of Platform(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
+ _handle = (video_util_s*)handle;
if(_handle && (_handle->transcode_h))
{
ret = mm_transcode_cancel(_handle->transcode_h);
if(ret != MM_ERROR_NONE)
{
- LOGE("INVALID_OPERATION(0x%08x)", VIDEO_UTIL_ERROR_INVALID_OPERATION);
+ video_util_error("INVALID_OPERATION(0x%08x)", ret);
return VIDEO_UTIL_ERROR_INVALID_OPERATION;
}
}
else
{
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
+ video_util_error("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
}
+ UTIL_SAFE_FREE(_handle->_util_cb);
+ video_util_debug("FREE(_handle->_util_cb)");
+
return ret;
}
int video_util_get_progress_transcoding(video_util_h handle, unsigned long *current_position, unsigned long *duration)
{
int ret = VIDEO_UTIL_ERROR_NONE;
- video_util_s *_handle = (video_util_s*)handle;
+ video_util_s *_handle = NULL;
int value = 0;
+ bool transcoder_supported = false;
+ if (0 == system_info_get_platform_bool(TRANSCODER_FEATURE_PATH, &transcoder_supported)) {
+ if (false == transcoder_supported) {
+ video_util_error("VIDEO_UTIL_ERROR_NOT_SUPPORTED(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
+ } else {
+ video_util_error("Error - System Info of Platform(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
+ _handle = (video_util_s*)handle;
if(_handle && current_position && duration)
{
if(_handle->transcode_h)
current_position, duration, (unsigned int *)&value, (unsigned int *)&value);
if(ret != MM_ERROR_NONE)
{
- LOGE("INVALID_OPERATION(0x%08x)", VIDEO_UTIL_ERROR_INVALID_OPERATION);
+ video_util_error("INVALID_OPERATION(0x%08x)", ret);
return VIDEO_UTIL_ERROR_INVALID_OPERATION;
}
}
else
{
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
+ video_util_error("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
}
}
else
{
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
+ video_util_error("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
}
int video_util_foreach_supported_file_format(video_util_h handle, video_util_supported_file_format_cb callback, void *user_data)
{
int ret = VIDEO_UTIL_ERROR_NONE;
- video_util_s *_handle = (video_util_s*)handle;
+ video_util_s *_handle = NULL;
+ bool transcoder_supported = false;
+ if (0 == system_info_get_platform_bool(TRANSCODER_FEATURE_PATH, &transcoder_supported)) {
+ if (false == transcoder_supported) {
+ video_util_error("VIDEO_UTIL_ERROR_NOT_SUPPORTED(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
+ } else {
+ video_util_error("Error - System Info of Platform(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
+ _handle = (video_util_s*)handle;
if(_handle && callback)
{
ret = __video_util_foreach_supported_type(VIDEO_UTIL_TYPE_FORMAT, (video_util_supported_type_cb)callback, user_data);
}
else
{
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
+ video_util_error("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
}
int video_util_foreach_supported_video_codec(video_util_h handle, video_util_supported_video_encoder_cb callback, void *user_data)
{
int ret = VIDEO_UTIL_ERROR_NONE;
- video_util_s *_handle = (video_util_s*)handle;
-
+ video_util_s *_handle = NULL;
+ bool transcoder_supported = false;
+ if (0 == system_info_get_platform_bool(TRANSCODER_FEATURE_PATH, &transcoder_supported)) {
+ if (false == transcoder_supported) {
+ video_util_error("VIDEO_UTIL_ERROR_NOT_SUPPORTED(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
+ }
+ _handle = (video_util_s*)handle;
if(_handle && callback)
{
ret = __video_util_foreach_supported_type(VIDEO_UTIL_TYPE_VIDEO_ENC, (video_util_supported_type_cb)callback, user_data);
}
else
{
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
+ video_util_error("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
}
int video_util_foreach_supported_audio_codec(video_util_h handle, video_util_supported_audio_encoder_cb callback, void *user_data)
{
int ret = VIDEO_UTIL_ERROR_NONE;
- video_util_s *_handle = (video_util_s*)handle;
+ video_util_s *_handle = NULL;
+ bool transcoder_supported = false;
+ if (0 == system_info_get_platform_bool(TRANSCODER_FEATURE_PATH, &transcoder_supported)) {
+ if (false == transcoder_supported) {
+ video_util_error("VIDEO_UTIL_ERROR_NOT_SUPPORTED(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
+ } else {
+ video_util_error("Error - System Info of Platform(0x%08x)", VIDEO_UTIL_ERROR_NOT_SUPPORTED);
+ return VIDEO_UTIL_ERROR_NOT_SUPPORTED;
+ }
+ _handle = (video_util_s*)handle;
if(_handle && callback)
{
ret = __video_util_foreach_supported_type(VIDEO_UTIL_TYPE_AUDIO_ENC, (video_util_supported_type_cb)callback, user_data);
}
else
{
- LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
+ video_util_error("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
}
SET(fw_test "${fw_name}-test")
INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_test} REQUIRED glib-2.0 dlog capi-base-common mm-transcode)
+pkg_check_modules(${fw_test} REQUIRED glib-2.0 dlog capi-base-common capi-system-info mm-transcode)
FOREACH(flag ${${fw_test}_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
MESSAGE(${flag})
if(_util_s->idx == (g_make_video_cnt-1))
{
- g_main_loop_quit(g_loop);
+ if(g_loop)
+ g_main_loop_quit(g_loop);
return;
}
if(ret != VIDEO_UTIL_ERROR_NONE)
{
printf("[%d]error video_util_cancel_transcoding [%d]\n", __LINE__, ret);
- g_main_loop_quit(g_loop);
+ if(g_loop)
+ g_main_loop_quit(g_loop);
return;
}
{
int ret = 0;
ret = video_util_foreach_supported_file_format(handle, (video_util_supported_file_format_cb)test_transcode_spec_cb, "format_check");
- printf("[%d] video_util_foreach_supported_file_format [%d]\n", __LINE__, ret);
+ printf("video_util_foreach_supported_file_format [%d]\n", ret);
ret = video_util_foreach_supported_video_codec(handle, (video_util_supported_video_encoder_cb)test_transcode_spec_cb, "video_codec_check");
- printf("[%d] video_util_foreach_supported_video_codec [%d]\n", __LINE__, ret);
+ printf("video_util_foreach_supported_video_codec [%d]\n", ret);
ret = video_util_foreach_supported_audio_codec(handle, (video_util_supported_audio_encoder_cb)test_transcode_spec_cb, "audio_codec_check");
- printf("[%d] video_util_foreach_supported_audio_codec [%d]\n", __LINE__, ret);
+ printf("video_util_foreach_supported_audio_codec [%d]\n", ret);
return true;
}
static int test_transcode_do(test_util_s *util_s)
{
- int ret = 0;
+ int ret = VIDEO_UTIL_ERROR_NONE;
char test_output_file_path[128] = {0, };
memset(test_output_file_path, 0x00, sizeof(test_output_file_path));
if(ret != VIDEO_UTIL_ERROR_NONE)
{
printf("[%d]error video_util_start_transcoding [%d]\n", __LINE__, ret);
- g_main_loop_quit(g_loop);
+ if(g_loop)
+ g_main_loop_quit(g_loop);
return ret;
}
_util_s->start_time = 0;
_util_s->duration = g_duration;
- test_transcode_do(_util_s);
+ ret = test_transcode_do(_util_s);
+ if(ret != VIDEO_UTIL_ERROR_NONE)
+ goto Exit;
g_loop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(g_loop);
g_main_loop_unref(g_loop);
+Exit:
ret = video_util_destroy(video_h); //destory handle in cb
if(ret != VIDEO_UTIL_ERROR_NONE)
{