From: Sejun Park Date: Tue, 3 Jan 2017 08:32:15 +0000 (+0900) Subject: Changed audio/video/text check routine according to enum change X-Git-Tag: submit/tizen_3.0/20170103.084553^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b9140235a23e9fa284393e511fad17a8a34a765c;p=platform%2Fcore%2Fapi%2Fmediatool.git Changed audio/video/text check routine according to enum change Change-Id: I64fcd08b3d09a628a8a9ac435a9ca96659b2e8a7 --- diff --git a/include/media_format_private.h b/include/media_format_private.h index ed824e3..4314c7b 100755 --- a/include/media_format_private.h +++ b/include/media_format_private.h @@ -103,6 +103,18 @@ extern "C" { */ #define MEDIA_FORMAT_DEC_REFCOUNT_TEST(x_fmt) (g_atomic_int_dec_and_test(&(MEDIA_FORMAT_CAST(x_fmt))->ref_count)) +#define CHECK_BIT(x, y) (((x) >> (y)) & 0x01) + +#define CHECK_IS_AUDIO(x) \ + (CHECK_BIT(x, 24) == 1 && CHECK_BIT(x, 25) == 0) + +#define CHECK_IS_VIDEO(x) \ + (CHECK_BIT(x, 25) == 1 && CHECK_BIT(x, 24) == 0) + +#define CHECK_IS_TEXT(x) \ + (CHECK_BIT(x, 25) == 1 && CHECK_BIT(x, 24) == 1) + +#define CHECK_IS_CONTAINER(x) CHECK_BIT(x, 26) /** * @brief Media format for configuring video codec. * @since_tizen 2.3 diff --git a/packaging/capi-media-tool.spec b/packaging/capi-media-tool.spec index b017e27..70750f1 100755 --- a/packaging/capi-media-tool.spec +++ b/packaging/capi-media-tool.spec @@ -1,6 +1,6 @@ Name: capi-media-tool Summary: A Core API media tool library in Tizen Native API -Version: 0.1.4 +Version: 0.1.5 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/media_format.c b/src/media_format.c index 35b01ee..4e9f7c0 100755 --- a/src/media_format.c +++ b/src/media_format.c @@ -106,7 +106,7 @@ int media_format_get_text_info(media_format_h fmt, media_format_mimetype_e *mime media_format_s *fmt_handle; fmt_handle = (media_format_s *)fmt; - if (!(fmt_handle->mimetype & MEDIA_FORMAT_TEXT)) { + if (!CHECK_IS_TEXT(fmt_handle->mimetype)) { LOGE("The format handle is not for MEDIA_FORMAT_TEXT..\n"); return MEDIA_FORMAT_ERROR_INVALID_OPERATION; } @@ -127,7 +127,7 @@ int media_format_get_video_info(media_format_h fmt, media_format_mimetype_e *mim media_format_s *fmt_handle; fmt_handle = (media_format_s *)fmt; - if (!(fmt_handle->mimetype & MEDIA_FORMAT_VIDEO)) { + if (!CHECK_IS_VIDEO(fmt_handle->mimetype)) { LOGE("The format handle is not for MEDIA_FORMAT_VIDEO..\n"); return MEDIA_FORMAT_ERROR_INVALID_OPERATION; } @@ -154,7 +154,7 @@ int media_format_get_audio_info(media_format_h fmt, media_format_mimetype_e *mim media_format_s *fmt_handle; fmt_handle = (media_format_s *)fmt; - if (!(fmt_handle->mimetype & MEDIA_FORMAT_AUDIO)) { + if (!CHECK_IS_AUDIO(fmt_handle->mimetype)) { LOGE("The format handle is not for MEDIA_FORMAT_AUDIO..\n"); return MEDIA_FORMAT_ERROR_INVALID_OPERATION; } @@ -219,7 +219,7 @@ int media_format_get_video_frame_rate(media_format_h fmt, int *frame_rate) media_format_s *fmt_handle; fmt_handle = (media_format_s *)fmt; - if (!(fmt_handle->mimetype & MEDIA_FORMAT_VIDEO)) { + if (!CHECK_IS_VIDEO(fmt_handle->mimetype)) { LOGE("The format handle is not for MEDIA_FORMAT_VIDEO..\n"); return MEDIA_FORMAT_ERROR_INVALID_OPERATION; } @@ -243,7 +243,7 @@ int media_format_set_container_mime(media_format_h fmt, media_format_mimetype_e media_format_s *fmt_handle; fmt_handle = (media_format_s *)fmt; - if (!(mimetype & MEDIA_FORMAT_CONTAINER)) + if (!CHECK_IS_CONTAINER(mimetype)) return MEDIA_FORMAT_ERROR_INVALID_PARAMETER; fmt_handle->mimetype = mimetype; @@ -264,7 +264,7 @@ int media_format_set_text_mime(media_format_h fmt, media_format_mimetype_e mimet media_format_s *fmt_handle; fmt_handle = (media_format_s *)fmt; - if (!(mimetype & MEDIA_FORMAT_TEXT)) + if (!CHECK_IS_TEXT(mimetype)) return MEDIA_FORMAT_ERROR_INVALID_PARAMETER; fmt_handle->mimetype = mimetype; @@ -285,7 +285,7 @@ int media_format_set_text_type(media_format_h fmt, media_format_text_type_e type media_format_s *fmt_handle; fmt_handle = (media_format_s *)fmt; - if (!(fmt_handle->mimetype & MEDIA_FORMAT_TEXT)) + if (!CHECK_IS_TEXT(fmt_handle->mimetype)) return MEDIA_FORMAT_ERROR_INVALID_PARAMETER; fmt_handle->detail.text.type = type; @@ -306,7 +306,7 @@ int media_format_set_video_mime(media_format_h fmt, media_format_mimetype_e mime media_format_s *fmt_handle; fmt_handle = (media_format_s *)fmt; - if (!(mimetype & MEDIA_FORMAT_VIDEO)) + if (!CHECK_IS_VIDEO(mimetype)) return MEDIA_FORMAT_ERROR_INVALID_PARAMETER; fmt_handle->mimetype = mimetype; @@ -327,7 +327,7 @@ int media_format_set_video_width(media_format_h fmt, int width) media_format_s *fmt_handle; fmt_handle = (media_format_s *)fmt; - if (!(fmt_handle->mimetype & MEDIA_FORMAT_VIDEO)) { + if (!CHECK_IS_VIDEO(fmt_handle->mimetype)) { LOGE("The format handle is not for MEDIA_FORMAT_VIDEO..\n"); return MEDIA_FORMAT_ERROR_INVALID_PARAMETER; } @@ -350,7 +350,7 @@ int media_format_set_video_height(media_format_h fmt, int height) media_format_s *fmt_handle; fmt_handle = (media_format_s *)fmt; - if (!(fmt_handle->mimetype & MEDIA_FORMAT_VIDEO)) { + if (!CHECK_IS_VIDEO(fmt_handle->mimetype)) { LOGE("The format handle is not for MEDIA_FORMAT_VIDEO..\n"); return MEDIA_FORMAT_ERROR_INVALID_PARAMETER; } @@ -373,7 +373,7 @@ int media_format_set_video_avg_bps(media_format_h fmt, int avg_bps) media_format_s *fmt_handle; fmt_handle = (media_format_s *)fmt; - if (!(fmt_handle->mimetype & MEDIA_FORMAT_VIDEO)) { + if (!CHECK_IS_VIDEO(fmt_handle->mimetype)) { LOGE("The format handle is not for MEDIA_FORMAT_VIDEO..\n"); return MEDIA_FORMAT_ERROR_INVALID_PARAMETER; } @@ -396,7 +396,7 @@ int media_format_set_video_max_bps(media_format_h fmt, int max_bps) media_format_s *fmt_handle; fmt_handle = (media_format_s *)fmt; - if (!(fmt_handle->mimetype & MEDIA_FORMAT_VIDEO)) { + if (!CHECK_IS_VIDEO(fmt_handle->mimetype)) { LOGE("The format handle is not for MEDIA_FORMAT_VIDEO..\n"); return MEDIA_FORMAT_ERROR_INVALID_PARAMETER; } @@ -419,7 +419,7 @@ int media_format_set_video_frame_rate(media_format_h fmt, int frame_rate) media_format_s *fmt_handle; fmt_handle = (media_format_s *)fmt; - if (!(fmt_handle->mimetype & MEDIA_FORMAT_VIDEO)) { + if (!CHECK_IS_VIDEO(fmt_handle->mimetype)) { LOGE("The format handle is not for MEDIA_FORMAT_VIDEO..\n"); return MEDIA_FORMAT_ERROR_INVALID_PARAMETER; } @@ -443,7 +443,7 @@ int media_format_set_audio_mime(media_format_h fmt, media_format_mimetype_e mime media_format_s *fmt_handle; fmt_handle = (media_format_s *)fmt; - if (!(mimetype & MEDIA_FORMAT_AUDIO)) { + if (!CHECK_IS_AUDIO(mimetype)) { LOGE("The format handle is not for MEDIA_FORMAT_AUDIO..\n"); return MEDIA_FORMAT_ERROR_INVALID_PARAMETER; } @@ -467,7 +467,7 @@ int media_format_set_audio_channel(media_format_h fmt, int channel) media_format_s *fmt_handle; fmt_handle = (media_format_s *)fmt; - if (!(fmt_handle->mimetype & MEDIA_FORMAT_AUDIO)) { + if (!CHECK_IS_AUDIO(fmt_handle->mimetype)) { LOGE("The format handle is not for MEDIA_FORMAT_AUDIO..\n"); return MEDIA_FORMAT_ERROR_INVALID_PARAMETER; } @@ -491,7 +491,7 @@ int media_format_set_audio_samplerate(media_format_h fmt, int samplerate) media_format_s *fmt_handle; fmt_handle = (media_format_s *)fmt; - if (!(fmt_handle->mimetype & MEDIA_FORMAT_AUDIO)) { + if (!CHECK_IS_AUDIO(fmt_handle->mimetype)) { LOGE("The format handle is not for MEDIA_FORMAT_AUDIO..\n"); return MEDIA_FORMAT_ERROR_INVALID_PARAMETER; } @@ -515,7 +515,7 @@ int media_format_set_audio_bit(media_format_h fmt, int bit) media_format_s *fmt_handle; fmt_handle = (media_format_s *)fmt; - if (!(fmt_handle->mimetype & MEDIA_FORMAT_AUDIO)) { + if (!CHECK_IS_AUDIO(fmt_handle->mimetype)) { LOGE("The format handle is not for MEDIA_FORMAT_AUDIO..\n"); return MEDIA_FORMAT_ERROR_INVALID_PARAMETER; } @@ -539,7 +539,7 @@ int media_format_set_audio_avg_bps(media_format_h fmt, int avg_bps) media_format_s *fmt_handle; fmt_handle = (media_format_s *)fmt; - if (!(fmt_handle->mimetype & MEDIA_FORMAT_AUDIO)) { + if (!CHECK_IS_AUDIO(fmt_handle->mimetype)) { LOGE("The format handle is not for MEDIA_FORMAT_AUDIO..\n"); return MEDIA_FORMAT_ERROR_INVALID_PARAMETER; } @@ -563,7 +563,7 @@ int media_format_set_audio_aac_type(media_format_h fmt, bool is_adts) media_format_s *fmt_handle; fmt_handle = (media_format_s *)fmt; - if (!(fmt_handle->mimetype & MEDIA_FORMAT_AUDIO)) { + if (!CHECK_IS_AUDIO(fmt_handle->mimetype)) { LOGE("The format handle is not for MEDIA_FORMAT_AUDIO..\n"); return MEDIA_FORMAT_ERROR_INVALID_PARAMETER; } @@ -587,7 +587,7 @@ int media_format_set_audio_aac_header_type(media_format_h fmt, media_format_aac_ media_format_s *fmt_handle; fmt_handle = (media_format_s *)fmt; - if (!(fmt_handle->mimetype & MEDIA_FORMAT_AUDIO)) { + if (!CHECK_IS_AUDIO(fmt_handle->mimetype)) { LOGE("The format handle is not for MEDIA_FORMAT_AUDIO..\n"); return MEDIA_FORMAT_ERROR_INVALID_PARAMETER; }