--- /dev/null
+/*
+* Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* 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.
+*/
+
+#ifndef __TIZEN_MEDIA_FORMAT_INTERNAL_H__
+#define __TIZEN_MEDIA_FORMAT_INTERNAL_H__
+
+#include <stdint.h>
+#include <tizen.h>
+#include <media_format.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file media_format_internal.h
+ * @brief This file contains the media format internal API.
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_TOOL_MEDIA_FORMAT_INTERNAL_MODULE
+ * @{
+ */
+
+/**
+ * @brief Get reference count of #media_format_h object.
+ * @since_tizen 7.0
+ * @param[in] fmt exist #media_format_h
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #MEDIA_FORMAT_ERROR_NONE Successful
+ * @retval #MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see media_format_ref()
+ * @see media_format_unref()
+ */
+int media_format_get_refcount(media_format_h fmt, int *ref_count);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_MEDIA_FORMAT_INTERNAL_H__ */
--- /dev/null
+/*
+* Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* 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.
+*/
+// #include <stdio.h>
+// #include <stdlib.h>
+// #include <string.h>
+
+#include <dlog.h>
+#include <media_format.h>
+#include <media_format_private.h>
+
+int media_format_get_refcount(media_format_h fmt, int *ref_count)
+{
+ MEDIA_FORMAT_INSTANCE_CHECK(fmt);
+ MEDIA_FORMAT_NULL_ARG_CHECK(ref_count);
+
+ media_format_s *fmt_handle;
+
+ *ref_count = MEDIA_FORMAT_GET_REFCOUNT(fmt);
+
+ LOGI("format[%p] ref_count[%d]", fmt, *ref_count);
+
+ return MEDIA_FORMAT_ERROR_NONE;
+}
#include "media_tool_gtest.h"
#include "media_format.h"
+#include "media_format_internal.h"
using ::testing::InitGoogleTest;
using ::testing::Test;
media_format_unref(fmt);
}
+TEST(MediaToolTest, media_tool_gtest_refcount_init)
+{
+ media_format_h fmt;
+ int ref_count;
+ int ret = media_format_create(&fmt);
+ ASSERT_EQ(ret, MEDIA_FORMAT_ERROR_NONE);
+
+ media_format_get_refcount(fmt, &ref_count);
+ ASSERT_EQ(ref_count, 1);
+
+ media_format_unref(fmt);
+}
+
int main(int argc, char **argv)
{
InitGoogleTest(&argc, argv);