Changed audio/video/text check routine according to enum change 82/108182/1 accepted/tizen_3.0.m2_mobile accepted/tizen_3.0.m2_tv accepted/tizen_3.0.m2_wearable tizen_3.0.m2 accepted/tizen/3.0.m2/mobile/20170104.121925 accepted/tizen/3.0.m2/tv/20170104.122421 accepted/tizen/3.0.m2/wearable/20170104.122810 accepted/tizen/3.0/common/20170103.172857 accepted/tizen/3.0/ivi/20170103.155317 accepted/tizen/3.0/mobile/20170103.155222 accepted/tizen/3.0/tv/20170103.155241 accepted/tizen/3.0/wearable/20170103.155259 submit/tizen_3.0.m2/20170104.093749 submit/tizen_3.0/20170103.084553
authorSejun Park <sejun79.park@samsung.com>
Tue, 3 Jan 2017 08:32:15 +0000 (17:32 +0900)
committerSejun Park <sejun79.park@samsung.com>
Tue, 3 Jan 2017 08:32:15 +0000 (17:32 +0900)
Change-Id: I64fcd08b3d09a628a8a9ac435a9ca96659b2e8a7

include/media_format_private.h
packaging/capi-media-tool.spec
src/media_format.c

index ed824e347f775ad0ffee86fb4ceccdb10e3a932c..4314c7b7965f3474cff3b7dee48f3b5b5b2b1290 100755 (executable)
@@ -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
index b017e27621690c20f8982da8187c1fc8cc5d2c28..70750f112cda834569ee4e860397d7610a274ae8 100755 (executable)
@@ -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
index 35b01ee16a4765f342567ba25d76d6bebdcdea90..4e9f7c0c122a30425d0b4826d8cafdb9678d0cad 100755 (executable)
@@ -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;
        }