Update file format 62/315562/1 accepted/tizen_9.0_unified accepted/tizen_unified_dev accepted/tizen_unified_toolchain tizen_9.0 accepted/tizen/9.0/unified/20241030.233139 accepted/tizen/unified/20240806.010612 accepted/tizen/unified/20240815.163643 accepted/tizen/unified/dev/20240807.092915 accepted/tizen/unified/toolchain/20240812.130128 accepted/tizen/unified/x/20240806.104702 accepted/tizen/unified/x/asan/20240813.224454 tizen_9.0_m2_release
authorYoungHun Kim <yh8004.kim@samsung.com>
Fri, 2 Aug 2024 09:12:35 +0000 (18:12 +0900)
committerYoungHun Kim <yh8004.kim@samsung.com>
Fri, 2 Aug 2024 09:12:37 +0000 (18:12 +0900)
 - Remove CRLF line terminators

Change-Id: I93ea6c5087db11b2d9fdc371718e27f6a32a5ab4

13 files changed:
LICENSE.APLv2
include/resource_center_internal.h
src/resource_center_internal.cpp
ut/inc/TCApp.h
ut/inc/TCPlayer.h
ut/inc/TCResource.h
ut/inc/tomatoGtest.h
ut/inc/ut_log.h
ut/inc/ut_util.h
ut/src/testcase/TCApp.cpp
ut/src/testcase/TCPlayer.cpp
ut/src/testcase/TCResource.cpp
ut/src/testcase/ut_util.cpp

index bbe9d02f324e5a6bb343e5bc18f86dce1dfb833d..f94008a3a3ecf62c44fa318348e32e36b3e44dfd 100644 (file)
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
-\r
-                                 Apache License\r
-                           Version 2.0, January 2004\r
-                        http://www.apache.org/licenses/\r
-\r
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
-\r
-   1. Definitions.\r
-\r
-      "License" shall mean the terms and conditions for use, reproduction,\r
-      and distribution as defined by Sections 1 through 9 of this document.\r
-\r
-      "Licensor" shall mean the copyright owner or entity authorized by\r
-      the copyright owner that is granting the License.\r
-\r
-      "Legal Entity" shall mean the union of the acting entity and all\r
-      other entities that control, are controlled by, or are under common\r
-      control with that entity. For the purposes of this definition,\r
-      "control" means (i) the power, direct or indirect, to cause the\r
-      direction or management of such entity, whether by contract or\r
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
-      outstanding shares, or (iii) beneficial ownership of such entity.\r
-\r
-      "You" (or "Your") shall mean an individual or Legal Entity\r
-      exercising permissions granted by this License.\r
-\r
-      "Source" form shall mean the preferred form for making modifications,\r
-      including but not limited to software source code, documentation\r
-      source, and configuration files.\r
-\r
-      "Object" form shall mean any form resulting from mechanical\r
-      transformation or translation of a Source form, including but\r
-      not limited to compiled object code, generated documentation,\r
-      and conversions to other media types.\r
-\r
-      "Work" shall mean the work of authorship, whether in Source or\r
-      Object form, made available under the License, as indicated by a\r
-      copyright notice that is included in or attached to the work\r
-      (an example is provided in the Appendix below).\r
-\r
-      "Derivative Works" shall mean any work, whether in Source or Object\r
-      form, that is based on (or derived from) the Work and for which the\r
-      editorial revisions, annotations, elaborations, or other modifications\r
-      represent, as a whole, an original work of authorship. For the purposes\r
-      of this License, Derivative Works shall not include works that remain\r
-      separable from, or merely link (or bind by name) to the interfaces of,\r
-      the Work and Derivative Works thereof.\r
-\r
-      "Contribution" shall mean any work of authorship, including\r
-      the original version of the Work and any modifications or additions\r
-      to that Work or Derivative Works thereof, that is intentionally\r
-      submitted to Licensor for inclusion in the Work by the copyright owner\r
-      or by an individual or Legal Entity authorized to submit on behalf of\r
-      the copyright owner. For the purposes of this definition, "submitted"\r
-      means any form of electronic, verbal, or written communication sent\r
-      to the Licensor or its representatives, including but not limited to\r
-      communication on electronic mailing lists, source code control systems,\r
-      and issue tracking systems that are managed by, or on behalf of, the\r
-      Licensor for the purpose of discussing and improving the Work, but\r
-      excluding communication that is conspicuously marked or otherwise\r
-      designated in writing by the copyright owner as "Not a Contribution."\r
-\r
-      "Contributor" shall mean Licensor and any individual or Legal Entity\r
-      on behalf of whom a Contribution has been received by Licensor and\r
-      subsequently incorporated within the Work.\r
-\r
-   2. Grant of Copyright License. Subject to the terms and conditions of\r
-      this License, each Contributor hereby grants to You a perpetual,\r
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
-      copyright license to reproduce, prepare Derivative Works of,\r
-      publicly display, publicly perform, sublicense, and distribute the\r
-      Work and such Derivative Works in Source or Object form.\r
-\r
-   3. Grant of Patent License. Subject to the terms and conditions of\r
-      this License, each Contributor hereby grants to You a perpetual,\r
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
-      (except as stated in this section) patent license to make, have made,\r
-      use, offer to sell, sell, import, and otherwise transfer the Work,\r
-      where such license applies only to those patent claims licensable\r
-      by such Contributor that are necessarily infringed by their\r
-      Contribution(s) alone or by combination of their Contribution(s)\r
-      with the Work to which such Contribution(s) was submitted. If You\r
-      institute patent litigation against any entity (including a\r
-      cross-claim or counterclaim in a lawsuit) alleging that the Work\r
-      or a Contribution incorporated within the Work constitutes direct\r
-      or contributory patent infringement, then any patent licenses\r
-      granted to You under this License for that Work shall terminate\r
-      as of the date such litigation is filed.\r
-\r
-   4. Redistribution. You may reproduce and distribute copies of the\r
-      Work or Derivative Works thereof in any medium, with or without\r
-      modifications, and in Source or Object form, provided that You\r
-      meet the following conditions:\r
-\r
-      (a) You must give any other recipients of the Work or\r
-          Derivative Works a copy of this License; and\r
-\r
-      (b) You must cause any modified files to carry prominent notices\r
-          stating that You changed the files; and\r
-\r
-      (c) You must retain, in the Source form of any Derivative Works\r
-          that You distribute, all copyright, patent, trademark, and\r
-          attribution notices from the Source form of the Work,\r
-          excluding those notices that do not pertain to any part of\r
-          the Derivative Works; and\r
-\r
-      (d) If the Work includes a "NOTICE" text file as part of its\r
-          distribution, then any Derivative Works that You distribute must\r
-          include a readable copy of the attribution notices contained\r
-          within such NOTICE file, excluding those notices that do not\r
-          pertain to any part of the Derivative Works, in at least one\r
-          of the following places: within a NOTICE text file distributed\r
-          as part of the Derivative Works; within the Source form or\r
-          documentation, if provided along with the Derivative Works; or,\r
-          within a display generated by the Derivative Works, if and\r
-          wherever such third-party notices normally appear. The contents\r
-          of the NOTICE file are for informational purposes only and\r
-          do not modify the License. You may add Your own attribution\r
-          notices within Derivative Works that You distribute, alongside\r
-          or as an addendum to the NOTICE text from the Work, provided\r
-          that such additional attribution notices cannot be construed\r
-          as modifying the License.\r
-\r
-      You may add Your own copyright statement to Your modifications and\r
-      may provide additional or different license terms and conditions\r
-      for use, reproduction, or distribution of Your modifications, or\r
-      for any such Derivative Works as a whole, provided Your use,\r
-      reproduction, and distribution of the Work otherwise complies with\r
-      the conditions stated in this License.\r
-\r
-   5. Submission of Contributions. Unless You explicitly state otherwise,\r
-      any Contribution intentionally submitted for inclusion in the Work\r
-      by You to the Licensor shall be under the terms and conditions of\r
-      this License, without any additional terms or conditions.\r
-      Notwithstanding the above, nothing herein shall supersede or modify\r
-      the terms of any separate license agreement you may have executed\r
-      with Licensor regarding such Contributions.\r
-\r
-   6. Trademarks. This License does not grant permission to use the trade\r
-      names, trademarks, service marks, or product names of the Licensor,\r
-      except as required for reasonable and customary use in describing the\r
-      origin of the Work and reproducing the content of the NOTICE file.\r
-\r
-   7. Disclaimer of Warranty. Unless required by applicable law or\r
-      agreed to in writing, Licensor provides the Work (and each\r
-      Contributor provides its Contributions) on an "AS IS" BASIS,\r
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
-      implied, including, without limitation, any warranties or conditions\r
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
-      PARTICULAR PURPOSE. You are solely responsible for determining the\r
-      appropriateness of using or redistributing the Work and assume any\r
-      risks associated with Your exercise of permissions under this License.\r
-\r
-   8. Limitation of Liability. In no event and under no legal theory,\r
-      whether in tort (including negligence), contract, or otherwise,\r
-      unless required by applicable law (such as deliberate and grossly\r
-      negligent acts) or agreed to in writing, shall any Contributor be\r
-      liable to You for damages, including any direct, indirect, special,\r
-      incidental, or consequential damages of any character arising as a\r
-      result of this License or out of the use or inability to use the\r
-      Work (including but not limited to damages for loss of goodwill,\r
-      work stoppage, computer failure or malfunction, or any and all\r
-      other commercial damages or losses), even if such Contributor\r
-      has been advised of the possibility of such damages.\r
-\r
-   9. Accepting Warranty or Additional Liability. While redistributing\r
-      the Work or Derivative Works thereof, You may choose to offer,\r
-      and charge a fee for, acceptance of support, warranty, indemnity,\r
-      or other liability obligations and/or rights consistent with this\r
-      License. However, in accepting such obligations, You may act only\r
-      on Your own behalf and on Your sole responsibility, not on behalf\r
-      of any other Contributor, and only if You agree to indemnify,\r
-      defend, and hold each Contributor harmless for any liability\r
-      incurred by, or claims asserted against, such Contributor by reason\r
-      of your accepting any such warranty or additional liability.\r
-\r
-   END OF TERMS AND CONDITIONS\r
-\r
-   APPENDIX: How to apply the Apache License to your work.\r
-\r
-      To apply the Apache License to your work, attach the following\r
-      boilerplate notice, with the fields enclosed by brackets "[]"\r
-      replaced with your own identifying information. (Don't include\r
-      the brackets!)  The text should be enclosed in the appropriate\r
-      comment syntax for the file format. We also recommend that a\r
-      file or class name and description of purpose be included on the\r
-      same "printed page" as the copyright notice for easier\r
-      identification within third-party archives.\r
-\r
-   Copyright [yyyy] [name of copyright owner]\r
-\r
-   Licensed under the Apache License, Version 2.0 (the "License");\r
-   you may not use this file except in compliance with the License.\r
-   You may obtain a copy of the License at\r
-\r
-       http://www.apache.org/licenses/LICENSE-2.0\r
-\r
-   Unless required by applicable law or agreed to in writing, software\r
-   distributed under the License is distributed on an "AS IS" BASIS,\r
-   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
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
+
+
+
index c489c4cff9e6d777c5853b9f9921b6c5bd25ab63..f5b210c07630329c471a9e1e27ed1629bb1f2240 100644 (file)
-/*\r
- * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * 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
-#ifndef __TIZEN_RESOURCE_CENTER_INTERNAL_H__\r
-#define __TIZEN_RESOURCE_CENTER_INTERNAL_H__\r
-\r
-#ifdef __cplusplus\r
-extern "C"\r
-{\r
-#endif\r
-\r
-typedef enum {\r
-       RC_AUDIO_OUT_MAIN = 1, /**< audio out main */\r
-       RC_AUDIO_OUT_SUB       /**< audio out sub */\r
-} rc_audio_out_e;\r
-\r
-/**\r
- * @brief Register player\r
- * @param[in] player_id player id\r
- * @param[in] resource_id window resource id\r
- * @return @c 0 on success, otherwise a negative error value\r
- * @pre None\r
- * @post None\r
- * @exception None\r
- */\r
-int rc_player_register(int player_id, int resource_id);\r
-\r
-/**\r
- * @brief Request play\r
- * @param[in] player_id player id\r
- * @param[out] audio_out player's audio out\r
- * @return @c 0 on success, otherwise a negative error value\r
- * @pre None\r
- * @post None\r
- * @exception None\r
- */\r
-int rc_player_request_play(int player_id, rc_audio_out_e* audio_out);\r
-\r
-/**\r
- * @brief Request stop\r
- * @param[in] player_id player id\r
- * @return @c 0 on success, otherwise a negative error value\r
- * @pre None\r
- * @post None\r
- * @exception None\r
- */\r
-int rc_player_request_stop(int player_id);\r
-\r
-/**\r
- * @brief Unregister player\r
- * @param[in] player_id player id\r
- * @return @c 0 on success, otherwise a negative error value\r
- * @pre None\r
- * @post None\r
- * @exception None\r
- */\r
-int rc_player_unregister(int player_id);\r
-\r
-/**\r
- * @brief Register external speaker info\r
- * @param[in] info external speaker info\r
- * @param[in] zone_id zone id\r
- * @return @c 0 on success, otherwise a negative error value\r
- * @pre None\r
- * @post None\r
- * @exception None\r
- */\r
-int rc_extspk_info_register(const char* info, int zone_id);\r
-\r
-/**\r
- * @brief Unegister external speaker info\r
- * @param[in] info external speaker info\r
- * @param[in] zone_id zone id\r
- * @return @c 0 on success, otherwise a negative error value\r
- * @pre None\r
- * @post None\r
- * @exception None\r
- */\r
-int rc_extspk_info_unregister(const char* info, int zone_id);\r
-\r
-/**\r
- * @brief Register external speaker info\r
- * @param[in] info external speaker info\r
- * @param[out] audio_out audio out of external speaker\r
- * @return @c 0 on success, otherwise a negative error value\r
- * @pre None\r
- * @post None\r
- * @exception None\r
- */\r
-int rc_get_extspk_info_audio_out(const char* info, int* audio_out);\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif /* __TIZEN_RESOURCE_CENTER_INTERNAL_H__ */\r
+/*
+ * Copyright (c) 2024 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_RESOURCE_CENTER_INTERNAL_H__
+#define __TIZEN_RESOURCE_CENTER_INTERNAL_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+typedef enum {
+       RC_AUDIO_OUT_MAIN = 1, /**< audio out main */
+       RC_AUDIO_OUT_SUB       /**< audio out sub */
+} rc_audio_out_e;
+
+/**
+ * @brief Register player
+ * @param[in] player_id player id
+ * @param[in] resource_id window resource id
+ * @return @c 0 on success, otherwise a negative error value
+ * @pre None
+ * @post None
+ * @exception None
+ */
+int rc_player_register(int player_id, int resource_id);
+
+/**
+ * @brief Request play
+ * @param[in] player_id player id
+ * @param[out] audio_out player's audio out
+ * @return @c 0 on success, otherwise a negative error value
+ * @pre None
+ * @post None
+ * @exception None
+ */
+int rc_player_request_play(int player_id, rc_audio_out_e* audio_out);
+
+/**
+ * @brief Request stop
+ * @param[in] player_id player id
+ * @return @c 0 on success, otherwise a negative error value
+ * @pre None
+ * @post None
+ * @exception None
+ */
+int rc_player_request_stop(int player_id);
+
+/**
+ * @brief Unregister player
+ * @param[in] player_id player id
+ * @return @c 0 on success, otherwise a negative error value
+ * @pre None
+ * @post None
+ * @exception None
+ */
+int rc_player_unregister(int player_id);
+
+/**
+ * @brief Register external speaker info
+ * @param[in] info external speaker info
+ * @param[in] zone_id zone id
+ * @return @c 0 on success, otherwise a negative error value
+ * @pre None
+ * @post None
+ * @exception None
+ */
+int rc_extspk_info_register(const char* info, int zone_id);
+
+/**
+ * @brief Unegister external speaker info
+ * @param[in] info external speaker info
+ * @param[in] zone_id zone id
+ * @return @c 0 on success, otherwise a negative error value
+ * @pre None
+ * @post None
+ * @exception None
+ */
+int rc_extspk_info_unregister(const char* info, int zone_id);
+
+/**
+ * @brief Register external speaker info
+ * @param[in] info external speaker info
+ * @param[out] audio_out audio out of external speaker
+ * @return @c 0 on success, otherwise a negative error value
+ * @pre None
+ * @post None
+ * @exception None
+ */
+int rc_get_extspk_info_audio_out(const char* info, int* audio_out);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_RESOURCE_CENTER_INTERNAL_H__ */
index 0c9e3bf066d9ea19c545a47eadf1ba9c9fc41b4e..af695b2589bc3463c7fda8fcd866849ea8790567 100644 (file)
@@ -1,75 +1,75 @@
-/*\r
- * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * 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
-#include <stdlib.h>\r
-#include "resource_center_internal.h"\r
-#include "resource_center_private.h"\r
-\r
-int rc_player_register(int player_id, int resource_id)\r
-{\r
-       RC_LOG_INFO(">>");\r
-\r
-       return _rc_player_register(player_id, resource_id);\r
-}\r
-\r
-int rc_player_request_play(int player_id, rc_audio_out_e* audio_out)\r
-{\r
-       RC_LOG_INFO(">>");\r
-\r
-       return _rc_player_request_play(player_id, audio_out);\r
-}\r
-\r
-int rc_player_request_stop(int player_id)\r
-{\r
-       RC_LOG_INFO(">>");\r
-\r
-       return _rc_player_request_stop(player_id);\r
-}\r
-\r
-int rc_player_unregister(int player_id)\r
-{\r
-       RC_LOG_INFO(">>");\r
-\r
-       return _rc_player_unregister(player_id);\r
-}\r
-\r
-int rc_extspk_info_register(const char* info, int zone_id)\r
-{\r
-       RC_LOG_INFO(">>");\r
-\r
-       return _rc_extspk_info_register(info, zone_id);\r
-}\r
-\r
-int rc_extspk_info_unregister(const char* info, int zone_id)\r
-{\r
-       RC_LOG_INFO(">>");\r
-\r
-       return _rc_extspk_info_unregister(info, zone_id);\r
-}\r
-\r
-int rc_get_extspk_info_audio_out(const char* info, int* audio_out)\r
-{\r
-       int ret;\r
-       RC_LOG_INFO(">>");\r
-\r
-       ret = _rc_get_extspk_info_audio_out(info);\r
-\r
-       if (ret < 0)\r
-               return ret;\r
-\r
-       *audio_out = ret;\r
-       return 0;\r
-}
\ No newline at end of file
+/*
+ * Copyright (c) 2024 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 <stdlib.h>
+#include "resource_center_internal.h"
+#include "resource_center_private.h"
+
+int rc_player_register(int player_id, int resource_id)
+{
+       RC_LOG_INFO(">>");
+
+       return _rc_player_register(player_id, resource_id);
+}
+
+int rc_player_request_play(int player_id, rc_audio_out_e* audio_out)
+{
+       RC_LOG_INFO(">>");
+
+       return _rc_player_request_play(player_id, audio_out);
+}
+
+int rc_player_request_stop(int player_id)
+{
+       RC_LOG_INFO(">>");
+
+       return _rc_player_request_stop(player_id);
+}
+
+int rc_player_unregister(int player_id)
+{
+       RC_LOG_INFO(">>");
+
+       return _rc_player_unregister(player_id);
+}
+
+int rc_extspk_info_register(const char* info, int zone_id)
+{
+       RC_LOG_INFO(">>");
+
+       return _rc_extspk_info_register(info, zone_id);
+}
+
+int rc_extspk_info_unregister(const char* info, int zone_id)
+{
+       RC_LOG_INFO(">>");
+
+       return _rc_extspk_info_unregister(info, zone_id);
+}
+
+int rc_get_extspk_info_audio_out(const char* info, int* audio_out)
+{
+       int ret;
+       RC_LOG_INFO(">>");
+
+       ret = _rc_get_extspk_info_audio_out(info);
+
+       if (ret < 0)
+               return ret;
+
+       *audio_out = ret;
+       return 0;
+}
index b0ebbdedb02e0d3f226ecf2179dc7b9b3ffab0a3..ebb08b337897621affb6495fc1980eed91c6018b 100644 (file)
@@ -1,57 +1,57 @@
-/*\r
- * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * 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
-#ifndef __TC_APP_H__\r
-#define __TC_APP_H__\r
-#include <string>\r
-\r
-class TCApp\r
-{\r
-public:\r
-       TCApp(const char* app_id);\r
-       ~TCApp();\r
-\r
-       static void ResourceChangedCb(const char* app_id, rc_resource_h rsc, void *data);\r
-       int RegisterResourceChangeCb(void);\r
-       int UnregisterResourceChangeCb(void);\r
-\r
-       std::string GetAppId(void) { return m_app_id; }\r
-\r
-       void IncreaseCbCount(void) { m_cb_count++; }\r
-       void ResetCbCount(void) { m_cb_count = 0; }\r
-       int GetCbCount(void) { return m_cb_count;}\r
-\r
-       bool IsMaxRszChanged(void) { return m_max_rsz_changed; }\r
-       bool IsAudioRscChanged(void) { return m_audio_rsc_changed; }\r
-\r
-       void SetMaxRszChanged(bool changed) { m_max_rsz_changed = changed; }\r
-       void SetAudioRscChanged(bool changed) { m_audio_rsc_changed = changed; }\r
-       void SetMaxResolution(int w, int h, int f) { m_max_width = w; m_max_height = h; m_max_framerate = f; }\r
-       void GetMaxResolution(int *w, int *h, int *f) { *w = m_max_width, *h = m_max_height, *f = m_max_framerate; }\r
-       void ResetCbData(void) { m_max_width = 0; m_max_height = 0; m_max_framerate = 0; m_max_rsz_changed = false; m_audio_rsc_changed = false; }\r
-\r
-private:\r
-       std::string m_app_id;\r
-       int m_cb_count;\r
-\r
-       int m_max_width = 0;\r
-       int m_max_height = 0;\r
-       int m_max_framerate = 0;\r
-       bool m_max_rsz_changed = false;\r
-       bool m_audio_rsc_changed = false;\r
-};\r
-\r
-#endif //__TC_APP_H__
\ No newline at end of file
+/*
+ * Copyright (c) 2024 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 __TC_APP_H__
+#define __TC_APP_H__
+#include <string>
+
+class TCApp
+{
+public:
+       TCApp(const char* app_id);
+       ~TCApp();
+
+       static void ResourceChangedCb(const char* app_id, rc_resource_h rsc, void *data);
+       int RegisterResourceChangeCb(void);
+       int UnregisterResourceChangeCb(void);
+
+       std::string GetAppId(void) { return m_app_id; }
+
+       void IncreaseCbCount(void) { m_cb_count++; }
+       void ResetCbCount(void) { m_cb_count = 0; }
+       int GetCbCount(void) { return m_cb_count;}
+
+       bool IsMaxRszChanged(void) { return m_max_rsz_changed; }
+       bool IsAudioRscChanged(void) { return m_audio_rsc_changed; }
+
+       void SetMaxRszChanged(bool changed) { m_max_rsz_changed = changed; }
+       void SetAudioRscChanged(bool changed) { m_audio_rsc_changed = changed; }
+       void SetMaxResolution(int w, int h, int f) { m_max_width = w; m_max_height = h; m_max_framerate = f; }
+       void GetMaxResolution(int *w, int *h, int *f) { *w = m_max_width, *h = m_max_height, *f = m_max_framerate; }
+       void ResetCbData(void) { m_max_width = 0; m_max_height = 0; m_max_framerate = 0; m_max_rsz_changed = false; m_audio_rsc_changed = false; }
+
+private:
+       std::string m_app_id;
+       int m_cb_count;
+
+       int m_max_width = 0;
+       int m_max_height = 0;
+       int m_max_framerate = 0;
+       bool m_max_rsz_changed = false;
+       bool m_audio_rsc_changed = false;
+};
+
+#endif //__TC_APP_H__
index d043430b21a3a6cf688ae3aed4315df239f3338f..600c0cd15eb4a50aa9b94069ccc3ec10c1b460a2 100644 (file)
@@ -1,81 +1,81 @@
-/*\r
- * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * 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
-#ifndef __TC_PLAYER_H__\r
-#define __TC_PLAYER_H__\r
-\r
-#include <string>\r
-#include <map>\r
-#include <rm_api.h>\r
-\r
-class TCResource;\r
-class TCPlayer\r
-{\r
-public:\r
-       TCPlayer();\r
-       TCPlayer(std::string app_id) { m_app_id = app_id; }\r
-       ~TCPlayer();\r
-\r
-       static rm_cb_result ConflictCb(int handle, rm_callback_type event, rm_device_request_s *info, void* data);\r
-       int Register(void);\r
-       int Unregister(void);\r
-\r
-       int SetPriority(int priority);\r
-       int SetAppId(std::string app_id);\r
-       void SetCustomHandle(int handle) { m_handle = handle;}\r
-\r
-       int GetHandle(void) { return m_handle; }\r
-       std::string GetAppId(void) { return m_app_id; }\r
-       int AddResource(int category_id, int state);\r
-       int AddResource(int category_id, int category_option, int state);\r
-       void RemoveResources(void);\r
-       int GetAudioCategory(std::string codec_name, int mixing_mode);\r
-       int GetCapableVideoCategory(std::string codec_name, int h_size, int v_size, int color_depth, int sampling_format, int framerate);\r
-       int GetCapableCategoryIdFromRC(int category_id);\r
-\r
-       int AddQuery(int category_id, int category_option, int state);\r
-       void RemoveQueries(void);\r
-       int Query(int query_type, int *ans);\r
-\r
-       void AddAllocatedResource(int device_id);\r
-       int AllocateResources(void);\r
-       int ReleaseResources(void);\r
-       int ReleaseResource(int index);\r
-       int GetAllocatedResourceId(int index);\r
-       int GetAllocatedResourcesNum(void) { return m_allocated_resources.size(); }\r
-\r
-       void IncreaseConflictNum(void) { m_n_conflict++; }\r
-       int GetConflictNum(void) { return m_n_conflict; }\r
-       void SetConflictedResourcesNum(int n) { m_n_conflicted_rsc = n; }\r
-       int GetConflictedResourcesNum(void) { return m_n_conflicted_rsc; }\r
-\r
-       int GetActiveAudioOut(void);\r
-\r
-private:\r
-       std::map<int, int> m_allocated_resources;\r
-       std::map<int, TCResource*> m_requested_resources;\r
-       std::map<int, TCResource*> m_queries;\r
-\r
-       std::string m_app_id;\r
-       int m_handle;\r
-       int m_rsc_index;\r
-       int m_query_index;\r
-       int m_allocated_rsc_index;\r
-       int m_n_conflict;\r
-       int m_n_conflicted_rsc;\r
-};\r
-\r
-#endif //__TC_PLAYER_H__
\ No newline at end of file
+/*
+ * Copyright (c) 2024 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 __TC_PLAYER_H__
+#define __TC_PLAYER_H__
+
+#include <string>
+#include <map>
+#include <rm_api.h>
+
+class TCResource;
+class TCPlayer
+{
+public:
+       TCPlayer();
+       TCPlayer(std::string app_id) { m_app_id = app_id; }
+       ~TCPlayer();
+
+       static rm_cb_result ConflictCb(int handle, rm_callback_type event, rm_device_request_s *info, void* data);
+       int Register(void);
+       int Unregister(void);
+
+       int SetPriority(int priority);
+       int SetAppId(std::string app_id);
+       void SetCustomHandle(int handle) { m_handle = handle;}
+
+       int GetHandle(void) { return m_handle; }
+       std::string GetAppId(void) { return m_app_id; }
+       int AddResource(int category_id, int state);
+       int AddResource(int category_id, int category_option, int state);
+       void RemoveResources(void);
+       int GetAudioCategory(std::string codec_name, int mixing_mode);
+       int GetCapableVideoCategory(std::string codec_name, int h_size, int v_size, int color_depth, int sampling_format, int framerate);
+       int GetCapableCategoryIdFromRC(int category_id);
+
+       int AddQuery(int category_id, int category_option, int state);
+       void RemoveQueries(void);
+       int Query(int query_type, int *ans);
+
+       void AddAllocatedResource(int device_id);
+       int AllocateResources(void);
+       int ReleaseResources(void);
+       int ReleaseResource(int index);
+       int GetAllocatedResourceId(int index);
+       int GetAllocatedResourcesNum(void) { return m_allocated_resources.size(); }
+
+       void IncreaseConflictNum(void) { m_n_conflict++; }
+       int GetConflictNum(void) { return m_n_conflict; }
+       void SetConflictedResourcesNum(int n) { m_n_conflicted_rsc = n; }
+       int GetConflictedResourcesNum(void) { return m_n_conflicted_rsc; }
+
+       int GetActiveAudioOut(void);
+
+private:
+       std::map<int, int> m_allocated_resources;
+       std::map<int, TCResource*> m_requested_resources;
+       std::map<int, TCResource*> m_queries;
+
+       std::string m_app_id;
+       int m_handle;
+       int m_rsc_index;
+       int m_query_index;
+       int m_allocated_rsc_index;
+       int m_n_conflict;
+       int m_n_conflicted_rsc;
+};
+
+#endif //__TC_PLAYER_H__
index 545b5afc253d7842f4fd67b477470c28db808309..c3068b4809eb67ae294aef1403e3184fbeacdbfb 100644 (file)
@@ -1,36 +1,36 @@
-/*\r
- * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * 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
-#ifndef __TC_RESOURCE_H__\r
-#define __TC_RESOURCE_H__\r
-\r
-class TCResource\r
-{\r
-public:\r
-       TCResource(int category_id, int category_option, int state);\r
-       ~TCResource();\r
-\r
-       int GetCategoryId(void) {return m_category_id;}\r
-       int GetCategoryOption(void) {return m_category_option;}\r
-       int GetState(void) {return m_state;}\r
-\r
-private:\r
-       int m_category_id;\r
-       int m_category_option;\r
-       int m_state;\r
-};\r
-\r
-#endif //__TC_RESOURCE_H__
\ No newline at end of file
+/*
+ * Copyright (c) 2024 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 __TC_RESOURCE_H__
+#define __TC_RESOURCE_H__
+
+class TCResource
+{
+public:
+       TCResource(int category_id, int category_option, int state);
+       ~TCResource();
+
+       int GetCategoryId(void) {return m_category_id;}
+       int GetCategoryOption(void) {return m_category_option;}
+       int GetState(void) {return m_state;}
+
+private:
+       int m_category_id;
+       int m_category_option;
+       int m_state;
+};
+
+#endif //__TC_RESOURCE_H__
index 2fda25e1cde4fa244fd854d68b591c87b418eaa4..5d5bc98a4f9eee5f11bbb81c73f9535500cd011f 100644 (file)
@@ -1,99 +1,99 @@
-/*\r
- * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * 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
-//invoke Tomato LIB\r
-#ifndef __TOMATO_GTEST_H__\r
-#define __TOMATO_GTEST_H__\r
-\r
-#include "TomatoAPI.h"\r
-\r
-//Set TC-config to tomato via Gtest macro\r
-#undef GTEST_TEST_\r
-#define GTEST_TEST_(test_case_name, test_name, parent_class, parent_id)\\r
-class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\\r
- public:\\r
-  GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\\r
- private:\\r
-  virtual void TestBody();\\r
-  virtual void TestBody_();\\r
-  static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_;\\r
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(\\r
-      GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\\r
-};\\r
-\\r
-::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_case_name, test_name)\\r
-  ::test_info_ =\\r
-    ::testing::internal::MakeAndRegisterTestInfo(\\r
-        #test_case_name, #test_name, NULL, NULL, \\r
-        (parent_id), \\r
-        parent_class::SetUpTestCase, \\r
-        parent_class::TearDownTestCase, \\r
-        new ::testing::internal::TestFactoryImpl<\\r
-            GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\\r
-void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()\\r
-{\\r
-  CTomatoAPI::BeginTestCase(#test_name);\\r
-  this->TestBody_();\\r
-  CTomatoAPI::EndTestCase();\\r
-}\\r
-void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody_()\r
-\r
-// Re-define Gtest macro for redirecting gtest-report to tomato\r
-/*\r
-       EXPECT_EQ\r
-       ASSERT_EQ\r
-\r
-       @ refer to "gtest_pred_impl.h"\r
-*/\r
-// parvin.kumar\r
-\r
-#undef GTEST_PRED_FORMAT2_\r
-#define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\\r
-               GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), v2, on_failure) \\r
-\r
-#undef GTEST_ASSERT_\r
-#define GTEST_ASSERT_(expression, v2, on_failure) \\r
-  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\r
-  if (const ::testing::AssertionResult gtest_ar = (expression)) {\\r
-    CTomatoAPI::WriteTestResult( #v2, true , "success"); { \\r
-  else \\r
-    { on_failure(gtest_ar.failure_message()); \\r
-           CTomatoAPI::WriteTestResult( #v2, false , gtest_ar.failure_message()); {\r
-\r
-\r
-/*\r
-       EXPECT_TRUE   : return TRUE   -> PASS\r
-       EXPECT_FALSE  : return FALSE -> PASS\r
-       ASSERT_TRUE\r
-       ASSERT_FALSE\r
-*/\r
-\r
-\r
-// Implements Boolean test assertions such as EXPECT_TRUE. expression can be\r
-// either a boolean expression or an AssertionResult. text is a textual\r
-// representation of expression as it was passed into the EXPECT_TRUE.\r
-#undef GTEST_TEST_BOOLEAN_\r
-#define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \\r
-  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\r
-  if (const ::testing::AssertionResult gtest_ar_ = \\r
-      ::testing::AssertionResult(expression)) {\\r
-         CTomatoAPI::WriteTestResult( text, true , "success"); { \\r
-  else {\\r
-    fail(::testing::internal::GetBoolAssertionFailureMessage(gtest_ar_, text, #actual, #expected).c_str());\\r
-         CTomatoAPI::WriteTestResult( test, false , ::testing::internal::GetBoolAssertionFailureMessage(gtest_ar_, text, #actual, #expected).c_str()); {\r
-\r
-\r
-#endif //__TOMATO_GTEST_H__\r
+/*
+ * Copyright (c) 2024 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.
+ */
+
+//invoke Tomato LIB
+#ifndef __TOMATO_GTEST_H__
+#define __TOMATO_GTEST_H__
+
+#include "TomatoAPI.h"
+
+//Set TC-config to tomato via Gtest macro
+#undef GTEST_TEST_
+#define GTEST_TEST_(test_case_name, test_name, parent_class, parent_id)\
+class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
+ public:\
+  GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
+ private:\
+  virtual void TestBody();\
+  virtual void TestBody_();\
+  static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_;\
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(\
+      GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
+};\
+\
+::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_case_name, test_name)\
+  ::test_info_ =\
+    ::testing::internal::MakeAndRegisterTestInfo(\
+        #test_case_name, #test_name, NULL, NULL, \
+        (parent_id), \
+        parent_class::SetUpTestCase, \
+        parent_class::TearDownTestCase, \
+        new ::testing::internal::TestFactoryImpl<\
+            GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\
+void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()\
+{\
+  CTomatoAPI::BeginTestCase(#test_name);\
+  this->TestBody_();\
+  CTomatoAPI::EndTestCase();\
+}\
+void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody_()
+
+// Re-define Gtest macro for redirecting gtest-report to tomato
+/*
+       EXPECT_EQ
+       ASSERT_EQ
+
+       @ refer to "gtest_pred_impl.h"
+*/
+// parvin.kumar
+
+#undef GTEST_PRED_FORMAT2_
+#define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
+               GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), v2, on_failure) \
+
+#undef GTEST_ASSERT_
+#define GTEST_ASSERT_(expression, v2, on_failure) \
+  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
+  if (const ::testing::AssertionResult gtest_ar = (expression)) {\
+    CTomatoAPI::WriteTestResult( #v2, true , "success"); { \
+  else \
+    { on_failure(gtest_ar.failure_message()); \
+           CTomatoAPI::WriteTestResult( #v2, false , gtest_ar.failure_message()); {
+
+
+/*
+       EXPECT_TRUE   : return TRUE   -> PASS
+       EXPECT_FALSE  : return FALSE -> PASS
+       ASSERT_TRUE
+       ASSERT_FALSE
+*/
+
+
+// Implements Boolean test assertions such as EXPECT_TRUE. expression can be
+// either a boolean expression or an AssertionResult. text is a textual
+// representation of expression as it was passed into the EXPECT_TRUE.
+#undef GTEST_TEST_BOOLEAN_
+#define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \
+  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
+  if (const ::testing::AssertionResult gtest_ar_ = \
+      ::testing::AssertionResult(expression)) {\
+         CTomatoAPI::WriteTestResult( text, true , "success"); { \
+  else {\
+    fail(::testing::internal::GetBoolAssertionFailureMessage(gtest_ar_, text, #actual, #expected).c_str());\
+         CTomatoAPI::WriteTestResult( test, false , ::testing::internal::GetBoolAssertionFailureMessage(gtest_ar_, text, #actual, #expected).c_str()); {
+
+
+#endif //__TOMATO_GTEST_H__
index 572fdd4916e93eec117afb851b428942a43016fd..6ee9f4272cec6442f56983b6e6d1d33133b21f99 100644 (file)
@@ -1,31 +1,31 @@
-/*\r
- * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * 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
-#ifndef __UT_LOG_H__\r
-#define __UT_LOG_H__\r
-\r
-#include <dlog.h>\r
-\r
-#ifdef LOG_TAG\r
-#undef LOG_TAG\r
-#endif//LOG_TAG\r
-\r
-#define LOG_TAG "RSC_CENTER_TC"\r
-#define RC_TEST_ERR(fmt, ...) LOGE(fmt, ##__VA_ARGS__)\r
-#define RC_TEST_INFO(fmt, ...) LOGI(fmt, ##__VA_ARGS__)\r
-#define RC_TEST_DBG(fmt, ...) LOGD(fmt, ##__VA_ARGS__)\r
-\r
-#endif //__UT_LOG_H__
\ No newline at end of file
+/*
+ * Copyright (c) 2024 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 __UT_LOG_H__
+#define __UT_LOG_H__
+
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif//LOG_TAG
+
+#define LOG_TAG "RSC_CENTER_TC"
+#define RC_TEST_ERR(fmt, ...) LOGE(fmt, ##__VA_ARGS__)
+#define RC_TEST_INFO(fmt, ...) LOGI(fmt, ##__VA_ARGS__)
+#define RC_TEST_DBG(fmt, ...) LOGD(fmt, ##__VA_ARGS__)
+
+#endif //__UT_LOG_H__
index 40fd3b33781eb04196ed490d4c7f4dec943e370f..3a7ea8f5f0d6e907450a6d8bb1f41d499f82d28b 100644 (file)
-/*\r
- * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * 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
-#ifndef __UT_UTIL_H__\r
-#define __UT_UTIL_H__\r
-#include <glib.h>\r
-#include <rm_api.h>\r
-#include <ri-api.h>\r
-\r
-int AddZoneInfo(int category_id, int zone_id);\r
-\r
-class CResourceManagerAPI\r
-{\r
-public:\r
-\r
-       typedef enum {\r
-               CB_NORMAL = 0,\r
-               CB_COUNT\r
-       } cb_option;\r
-\r
-       static CResourceManagerAPI* GetInstance();\r
-       static gboolean SetAppZoneIdAsync(gpointer data);\r
-       static gboolean SetAudioFocusAsync(gpointer data);\r
-\r
-       void Reset(void);\r
-       int RegisterPlayer(int cb_option, int expected);\r
-       int RegisterPlayer(std::string app_id, int cb_option, int expected);\r
-       int SetAppZoneIdAsync(std::string app_id, int zone_id, int sleep_sec);\r
-       int SetAudioFocusAsync(int zone_id, int sleep_sec);\r
-\r
-private:\r
-       CResourceManagerAPI() = default;\r
-       ~CResourceManagerAPI() = default;\r
-\r
-       rm_resource_cb GetConflictCB(int option);\r
-       static rm_cb_result ConflictCB(int handle, rm_callback_type event, rm_device_request_s *info, void* data);\r
-       static rm_cb_result ConflictCBCount(int handle, rm_callback_type event, rm_device_request_s *info, void* data);\r
-\r
-       static CResourceManagerAPI* m_instance;\r
-       int m_conflict_count;\r
-};\r
-\r
-\r
-class CVideoCategory\r
-{\r
-public:\r
-       CVideoCategory();\r
-       ~CVideoCategory() = default;\r
-\r
-       void SetProperties(std::string name, int width, int height, int framerate, int color_depth, int sampling);\r
-       ri_video_category_option_request_s* Build(void);\r
-       int GetCapableCategoryId(void);\r
-\r
-private:\r
-       void ResetProperties(void);\r
-       ri_video_category_option_request_s m_option;\r
-};\r
-\r
-class CAppInfo{\r
-public:\r
-       CAppInfo() = default;\r
-       ~CAppInfo() = default;\r
-\r
-       void SetAppId(std::string app_id) {m_app_id = app_id;}\r
-       std::string GetAppId(void) {return m_app_id;}\r
-       void SetZoneId(int id) {m_zone_id = id;}\r
-       int GetZoneId(void) {return m_zone_id;}\r
-       void SetSleep(int sec) {m_sleep = sec;}\r
-       int GetSleep(void) {return m_sleep;}\r
-\r
-private:\r
-       std::string m_app_id;\r
-       int m_zone_id;\r
-       int m_sleep;\r
-};\r
-\r
-class CFocusInfo{\r
-public:\r
-       CFocusInfo() = default;\r
-       ~CFocusInfo() = default;\r
-\r
-       void SetZoneId(int id) {m_zone_id = id;}\r
-       int GetZoneId(void) {return m_zone_id;}\r
-       void SetSleep(int sec) {m_sleep = sec;}\r
-       int GetSleep(void) {return m_sleep;}\r
-private:\r
-       int m_sleep;\r
-       int m_zone_id;\r
-};\r
-#endif //__UT_UTIL_H__
\ No newline at end of file
+/*
+ * Copyright (c) 2024 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 __UT_UTIL_H__
+#define __UT_UTIL_H__
+#include <glib.h>
+#include <rm_api.h>
+#include <ri-api.h>
+
+int AddZoneInfo(int category_id, int zone_id);
+
+class CResourceManagerAPI
+{
+public:
+
+       typedef enum {
+               CB_NORMAL = 0,
+               CB_COUNT
+       } cb_option;
+
+       static CResourceManagerAPI* GetInstance();
+       static gboolean SetAppZoneIdAsync(gpointer data);
+       static gboolean SetAudioFocusAsync(gpointer data);
+
+       void Reset(void);
+       int RegisterPlayer(int cb_option, int expected);
+       int RegisterPlayer(std::string app_id, int cb_option, int expected);
+       int SetAppZoneIdAsync(std::string app_id, int zone_id, int sleep_sec);
+       int SetAudioFocusAsync(int zone_id, int sleep_sec);
+
+private:
+       CResourceManagerAPI() = default;
+       ~CResourceManagerAPI() = default;
+
+       rm_resource_cb GetConflictCB(int option);
+       static rm_cb_result ConflictCB(int handle, rm_callback_type event, rm_device_request_s *info, void* data);
+       static rm_cb_result ConflictCBCount(int handle, rm_callback_type event, rm_device_request_s *info, void* data);
+
+       static CResourceManagerAPI* m_instance;
+       int m_conflict_count;
+};
+
+
+class CVideoCategory
+{
+public:
+       CVideoCategory();
+       ~CVideoCategory() = default;
+
+       void SetProperties(std::string name, int width, int height, int framerate, int color_depth, int sampling);
+       ri_video_category_option_request_s* Build(void);
+       int GetCapableCategoryId(void);
+
+private:
+       void ResetProperties(void);
+       ri_video_category_option_request_s m_option;
+};
+
+class CAppInfo{
+public:
+       CAppInfo() = default;
+       ~CAppInfo() = default;
+
+       void SetAppId(std::string app_id) {m_app_id = app_id;}
+       std::string GetAppId(void) {return m_app_id;}
+       void SetZoneId(int id) {m_zone_id = id;}
+       int GetZoneId(void) {return m_zone_id;}
+       void SetSleep(int sec) {m_sleep = sec;}
+       int GetSleep(void) {return m_sleep;}
+
+private:
+       std::string m_app_id;
+       int m_zone_id;
+       int m_sleep;
+};
+
+class CFocusInfo{
+public:
+       CFocusInfo() = default;
+       ~CFocusInfo() = default;
+
+       void SetZoneId(int id) {m_zone_id = id;}
+       int GetZoneId(void) {return m_zone_id;}
+       void SetSleep(int sec) {m_sleep = sec;}
+       int GetSleep(void) {return m_sleep;}
+private:
+       int m_sleep;
+       int m_zone_id;
+};
+#endif //__UT_UTIL_H__
index f00bfd8ca27605c56047c6f57de148a727c732c9..1420446f3979ebc05d4a169bc5bf2dab6d0cba0f 100644 (file)
@@ -1,74 +1,74 @@
-/*\r
- * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * 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
-#include "gtest/gtest.h"\r
-#include <resource_center.h>\r
-#include "TCApp.h"\r
-\r
-TCApp::TCApp(const char* app_id)\r
-{\r
-       if (app_id)\r
-               m_app_id.assign(app_id);\r
-       else\r
-               m_app_id.assign("");\r
-\r
-       m_cb_count = 0;\r
-\r
-       m_max_width = 0;\r
-       m_max_height = 0;\r
-       m_max_framerate = 0;\r
-}\r
-\r
-TCApp::~TCApp()\r
-{\r
-}\r
-\r
-void TCApp::ResourceChangedCb(const char* app_id, rc_resource_h rsc, void *data)\r
-{\r
-       int w;\r
-       int h;\r
-       int f;\r
-\r
-       if (!data)\r
-               return;\r
-\r
-       TCApp* app = (TCApp*) data;\r
-       app->IncreaseCbCount();\r
-\r
-       EXPECT_STREQ(app->GetAppId().c_str(), app_id);\r
-\r
-       if (rc_rsc_max_resolution_changed(rsc))\r
-       {\r
-               EXPECT_EQ(0, rc_rsc_get_video_max_resolution(rsc, &w, &h, &f));\r
-               app->SetMaxResolution(w, h, f);\r
-               app->SetMaxRszChanged(true);\r
-       }\r
-\r
-       if (rc_rsc_audio_out_changed(rsc))\r
-       {\r
-               app->SetAudioRscChanged(true);\r
-       }\r
-}\r
-\r
-int TCApp::RegisterResourceChangeCb(void)\r
-{\r
-       return rc_register_resource_change_callback(m_app_id.c_str(), TCApp::ResourceChangedCb, this);\r
-}\r
-\r
-int TCApp::UnregisterResourceChangeCb(void)\r
-{\r
-       return rc_unregister_resource_change_callback(m_app_id.c_str(), TCApp::ResourceChangedCb);\r
-}
\ No newline at end of file
+/*
+ * Copyright (c) 2024 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 "gtest/gtest.h"
+#include <resource_center.h>
+#include "TCApp.h"
+
+TCApp::TCApp(const char* app_id)
+{
+       if (app_id)
+               m_app_id.assign(app_id);
+       else
+               m_app_id.assign("");
+
+       m_cb_count = 0;
+
+       m_max_width = 0;
+       m_max_height = 0;
+       m_max_framerate = 0;
+}
+
+TCApp::~TCApp()
+{
+}
+
+void TCApp::ResourceChangedCb(const char* app_id, rc_resource_h rsc, void *data)
+{
+       int w;
+       int h;
+       int f;
+
+       if (!data)
+               return;
+
+       TCApp* app = (TCApp*) data;
+       app->IncreaseCbCount();
+
+       EXPECT_STREQ(app->GetAppId().c_str(), app_id);
+
+       if (rc_rsc_max_resolution_changed(rsc))
+       {
+               EXPECT_EQ(0, rc_rsc_get_video_max_resolution(rsc, &w, &h, &f));
+               app->SetMaxResolution(w, h, f);
+               app->SetMaxRszChanged(true);
+       }
+
+       if (rc_rsc_audio_out_changed(rsc))
+       {
+               app->SetAudioRscChanged(true);
+       }
+}
+
+int TCApp::RegisterResourceChangeCb(void)
+{
+       return rc_register_resource_change_callback(m_app_id.c_str(), TCApp::ResourceChangedCb, this);
+}
+
+int TCApp::UnregisterResourceChangeCb(void)
+{
+       return rc_unregister_resource_change_callback(m_app_id.c_str(), TCApp::ResourceChangedCb);
+}
index 3cb81aec3996afb5210ec6e8fb26d1959416e60d..740e7637deb21ec44f49ab75abcb0f81091f5536 100644 (file)
-/*\r
- * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * 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
-#include "gtest/gtest.h"\r
-#include <rm_api.h>\r
-#include <rm_module_api.h>\r
-#include <ut_log.h>\r
-#include <ri-api.h>\r
-#include <ri-module-api.h>\r
-#include <resource_center.h>\r
-#include "TCResource.h"\r
-#include "TCPlayer.h"\r
-\r
-TCPlayer::TCPlayer()\r
-{\r
-       m_handle = 0;\r
-       m_allocated_rsc_index = 0;\r
-       m_rsc_index = 0;\r
-       m_query_index = 0;\r
-       m_n_conflict = 0;\r
-       m_n_conflicted_rsc = 0;\r
-}\r
-\r
-TCPlayer::~TCPlayer()\r
-{\r
-       Unregister();\r
-}\r
-\r
-rm_cb_result TCPlayer::ConflictCb(int handle, rm_callback_type event, rm_device_request_s *info, void* data)\r
-{\r
-       if (!data)\r
-               return RM_CB_RESULT_ERROR;\r
-\r
-       TCPlayer *player = (TCPlayer*) data;\r
-       player->IncreaseConflictNum();\r
-       player->SetConflictedResourcesNum(info->request_num);\r
-\r
-       rm_deallocate_resources(handle, info);\r
-\r
-       return RM_CB_RESULT_OK;\r
-}\r
-\r
-int TCPlayer::Register(void)\r
-{\r
-       if (m_handle != 0)\r
-               return RM_ERROR;\r
-\r
-       return rm_register(TCPlayer::ConflictCb, this, &m_handle, NULL);\r
-}\r
-\r
-int TCPlayer::Unregister(void)\r
-{\r
-       int result = RM_ERROR;;\r
-\r
-       RemoveResources();\r
-       RemoveQueries();\r
-       m_allocated_resources.clear();\r
-\r
-       result = rm_unregister(m_handle);\r
-       m_handle = 0;\r
-\r
-       return result;\r
-}\r
-\r
-int TCPlayer::SetPriority(int priority)\r
-{\r
-       return rm_set_priority(m_handle, priority);\r
-}\r
-\r
-int TCPlayer::SetAppId(std::string app_id)\r
-{\r
-       m_app_id = app_id;\r
-       return rm_set_app_id(m_handle, (char*) app_id.c_str());\r
-}\r
-\r
-int TCPlayer::AddResource(int category_id, int state)\r
-{\r
-       TCResource* rsc = new TCResource(category_id, 0, state);\r
-       m_rsc_index++;\r
-       m_requested_resources.insert(std::pair<int, TCResource*>(m_rsc_index, rsc));\r
-       return 0;\r
-}\r
-\r
-int TCPlayer::AddResource(int category_id, int category_option, int state)\r
-{\r
-       TCResource* rsc = new TCResource(category_id, category_option, state);\r
-       m_rsc_index++;\r
-       m_requested_resources.insert(std::pair<int, TCResource*>(m_rsc_index, rsc));\r
-       return 0;\r
-}\r
-\r
-int TCPlayer::AddQuery(int category_id, int category_option, int state)\r
-{\r
-       TCResource* rsc = new TCResource(category_id, category_option, state);\r
-       m_query_index++;\r
-       m_queries.insert(std::pair<int, TCResource*>(m_query_index, rsc));\r
-       return 0;\r
-}\r
-\r
-void TCPlayer::RemoveResources(void)\r
-{\r
-       TCResource *rsc = nullptr;\r
-\r
-       for (auto &it : m_requested_resources) {\r
-               rsc = it.second;\r
-               if (rsc)\r
-                       delete rsc;\r
-       }\r
-       m_requested_resources.clear();\r
-       m_rsc_index = 0;\r
-}\r
-\r
-int TCPlayer::GetAudioCategory(std::string codec_name, int mixing_mode)\r
-{\r
-       ri_audio_category_option_request_s audio_option;\r
-       memset(&audio_option, 0, sizeof(ri_audio_category_option_request_s));\r
-\r
-       audio_option.codec_name = codec_name.c_str();\r
-       audio_option.mixing_mode = (ri_audio_mixing_mode) mixing_mode;\r
-\r
-       return ri_get_capable_audio_category_id(&audio_option);\r
-}\r
-\r
-int TCPlayer::GetCapableVideoCategory(std::string codec_name, int h_size, int v_size, int color_depth, int sampling_format, int framerate)\r
-{\r
-       ri_video_category_option_request_s opt;\r
-       memset(&opt, 0, sizeof(ri_video_category_option_request_s));\r
-\r
-       opt.codec_name = strndup(codec_name.c_str(), codec_name.length());\r
-       opt.color_depth = color_depth;\r
-       opt.framerate = framerate;\r
-       opt.h_size = h_size;\r
-       opt.v_size = v_size;\r
-       opt.sampling_format = sampling_format;\r
-\r
-       return ri_get_capable_video_category_id(&opt);\r
-}\r
-\r
-int TCPlayer::GetCapableCategoryIdFromRC(int category_id)\r
-{\r
-       return rc_get_capable_category_id(m_handle, m_app_id.c_str(), category_id);\r
-}\r
-\r
-int TCPlayer::Query(int query_type, int *ans)\r
-{\r
-       rm_category_request_s req;\r
-       memset(&req, 0, sizeof(rm_category_request_s));\r
-\r
-       int i = 0;\r
-       int result = RM_ERROR;\r
-       int answer;\r
-\r
-       req.request_num = m_queries.size();\r
-\r
-       for (auto &it : m_queries) {\r
-               TCResource *rsc = it.second;\r
-               req.category_id[i] = (rm_rsc_category_e) rsc->GetCategoryId();\r
-               req.category_option[i] = rsc->GetCategoryOption();\r
-               req.state[i] = (rm_requests_resource_state_e) rsc->GetState();\r
-               i++;\r
-       }\r
-\r
-       result = rm_query(m_handle, (rm_query_type_e) query_type, &req, &answer);\r
-       *ans = answer;\r
-\r
-       return result;\r
-}\r
-\r
-void TCPlayer::RemoveQueries(void)\r
-{\r
-       TCResource *rsc = nullptr;\r
-\r
-       for (auto &it : m_queries) {\r
-               rsc = it.second;\r
-               if (rsc)\r
-                       delete rsc;\r
-       }\r
-       m_queries.clear();\r
-}\r
-\r
-void TCPlayer::AddAllocatedResource(int device_id)\r
-{\r
-       m_allocated_resources.insert(std::pair<int, int>(++m_allocated_rsc_index, device_id));\r
-}\r
-\r
-int TCPlayer::GetAllocatedResourceId(int index)\r
-{\r
-       auto it = m_allocated_resources.find(index);\r
-\r
-       return (it == m_allocated_resources.end()) ? -1 : it->second;\r
-}\r
-\r
-int TCPlayer::AllocateResources(void)\r
-{\r
-       if (m_requested_resources.size() == 0)\r
-               return RM_ERROR;\r
-\r
-       int i = 0;\r
-       int result = RM_ERROR;\r
-\r
-       rm_category_request_s req;\r
-       memset(&req, 0, sizeof(rm_category_request_s));\r
-\r
-       req.request_num = m_requested_resources.size();\r
-\r
-       for (auto &it : m_requested_resources) {\r
-               TCResource *rsc = it.second;\r
-               req.category_id[i] = (rm_rsc_category_e) rsc->GetCategoryId();\r
-               req.category_option[i] = rsc->GetCategoryOption();\r
-               req.state[i] = (rm_requests_resource_state_e) rsc->GetState();\r
-               i++;\r
-       }\r
-\r
-       rm_device_return_s allocated;\r
-       memset(&allocated, 0, sizeof(allocated));\r
-\r
-       result = rm_allocate_resources(m_handle, &req, &allocated);\r
-\r
-       if (result == RM_OK) {\r
-               for (int j = 0; j < allocated.allocated_num; j++)\r
-                       AddAllocatedResource(allocated.device_id[j]);\r
-       }\r
-\r
-       return result;\r
-}\r
-\r
-int TCPlayer::ReleaseResources(void)\r
-{\r
-       if (m_allocated_resources.size() <= 0)\r
-               return RM_ERROR;\r
-\r
-       int i = 0;\r
-       rm_device_request_s req;\r
-       memset(&req, 0, sizeof(req));\r
-\r
-       req.request_num = m_allocated_resources.size();\r
-\r
-       for (auto &it : m_allocated_resources) {\r
-               req.device_id[i] = it.second;\r
-               i++;\r
-       }\r
-\r
-       m_allocated_resources.clear();\r
-       m_allocated_rsc_index = 0;\r
-\r
-       return rm_deallocate_resources(m_handle, &req);\r
-}\r
-\r
-int TCPlayer::ReleaseResource(int index)\r
-{\r
-       if (m_allocated_resources.size() <= 0)\r
-               return RM_ERROR;\r
-\r
-       auto it = m_allocated_resources.find(index);\r
-       int device_id = (it == m_allocated_resources.end()) ? -1 : it->second;\r
-\r
-       rm_device_request_s req;\r
-       memset(&req, 0, sizeof(req));\r
-\r
-       req.request_num = 1;\r
-       req.device_id[0] = device_id;\r
-\r
-       m_allocated_resources.erase(index);\r
-\r
-       return rm_deallocate_resources(m_handle, &req);\r
-}\r
-\r
-int TCPlayer::GetActiveAudioOut(void)\r
-{\r
-       return rm_get_active_audio_out(m_handle);\r
-}\r
+/*
+ * Copyright (c) 2024 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 "gtest/gtest.h"
+#include <rm_api.h>
+#include <rm_module_api.h>
+#include <ut_log.h>
+#include <ri-api.h>
+#include <ri-module-api.h>
+#include <resource_center.h>
+#include "TCResource.h"
+#include "TCPlayer.h"
+
+TCPlayer::TCPlayer()
+{
+       m_handle = 0;
+       m_allocated_rsc_index = 0;
+       m_rsc_index = 0;
+       m_query_index = 0;
+       m_n_conflict = 0;
+       m_n_conflicted_rsc = 0;
+}
+
+TCPlayer::~TCPlayer()
+{
+       Unregister();
+}
+
+rm_cb_result TCPlayer::ConflictCb(int handle, rm_callback_type event, rm_device_request_s *info, void* data)
+{
+       if (!data)
+               return RM_CB_RESULT_ERROR;
+
+       TCPlayer *player = (TCPlayer*) data;
+       player->IncreaseConflictNum();
+       player->SetConflictedResourcesNum(info->request_num);
+
+       rm_deallocate_resources(handle, info);
+
+       return RM_CB_RESULT_OK;
+}
+
+int TCPlayer::Register(void)
+{
+       if (m_handle != 0)
+               return RM_ERROR;
+
+       return rm_register(TCPlayer::ConflictCb, this, &m_handle, NULL);
+}
+
+int TCPlayer::Unregister(void)
+{
+       int result = RM_ERROR;;
+
+       RemoveResources();
+       RemoveQueries();
+       m_allocated_resources.clear();
+
+       result = rm_unregister(m_handle);
+       m_handle = 0;
+
+       return result;
+}
+
+int TCPlayer::SetPriority(int priority)
+{
+       return rm_set_priority(m_handle, priority);
+}
+
+int TCPlayer::SetAppId(std::string app_id)
+{
+       m_app_id = app_id;
+       return rm_set_app_id(m_handle, (char*) app_id.c_str());
+}
+
+int TCPlayer::AddResource(int category_id, int state)
+{
+       TCResource* rsc = new TCResource(category_id, 0, state);
+       m_rsc_index++;
+       m_requested_resources.insert(std::pair<int, TCResource*>(m_rsc_index, rsc));
+       return 0;
+}
+
+int TCPlayer::AddResource(int category_id, int category_option, int state)
+{
+       TCResource* rsc = new TCResource(category_id, category_option, state);
+       m_rsc_index++;
+       m_requested_resources.insert(std::pair<int, TCResource*>(m_rsc_index, rsc));
+       return 0;
+}
+
+int TCPlayer::AddQuery(int category_id, int category_option, int state)
+{
+       TCResource* rsc = new TCResource(category_id, category_option, state);
+       m_query_index++;
+       m_queries.insert(std::pair<int, TCResource*>(m_query_index, rsc));
+       return 0;
+}
+
+void TCPlayer::RemoveResources(void)
+{
+       TCResource *rsc = nullptr;
+
+       for (auto &it : m_requested_resources) {
+               rsc = it.second;
+               if (rsc)
+                       delete rsc;
+       }
+       m_requested_resources.clear();
+       m_rsc_index = 0;
+}
+
+int TCPlayer::GetAudioCategory(std::string codec_name, int mixing_mode)
+{
+       ri_audio_category_option_request_s audio_option;
+       memset(&audio_option, 0, sizeof(ri_audio_category_option_request_s));
+
+       audio_option.codec_name = codec_name.c_str();
+       audio_option.mixing_mode = (ri_audio_mixing_mode) mixing_mode;
+
+       return ri_get_capable_audio_category_id(&audio_option);
+}
+
+int TCPlayer::GetCapableVideoCategory(std::string codec_name, int h_size, int v_size, int color_depth, int sampling_format, int framerate)
+{
+       ri_video_category_option_request_s opt;
+       memset(&opt, 0, sizeof(ri_video_category_option_request_s));
+
+       opt.codec_name = strndup(codec_name.c_str(), codec_name.length());
+       opt.color_depth = color_depth;
+       opt.framerate = framerate;
+       opt.h_size = h_size;
+       opt.v_size = v_size;
+       opt.sampling_format = sampling_format;
+
+       return ri_get_capable_video_category_id(&opt);
+}
+
+int TCPlayer::GetCapableCategoryIdFromRC(int category_id)
+{
+       return rc_get_capable_category_id(m_handle, m_app_id.c_str(), category_id);
+}
+
+int TCPlayer::Query(int query_type, int *ans)
+{
+       rm_category_request_s req;
+       memset(&req, 0, sizeof(rm_category_request_s));
+
+       int i = 0;
+       int result = RM_ERROR;
+       int answer;
+
+       req.request_num = m_queries.size();
+
+       for (auto &it : m_queries) {
+               TCResource *rsc = it.second;
+               req.category_id[i] = (rm_rsc_category_e) rsc->GetCategoryId();
+               req.category_option[i] = rsc->GetCategoryOption();
+               req.state[i] = (rm_requests_resource_state_e) rsc->GetState();
+               i++;
+       }
+
+       result = rm_query(m_handle, (rm_query_type_e) query_type, &req, &answer);
+       *ans = answer;
+
+       return result;
+}
+
+void TCPlayer::RemoveQueries(void)
+{
+       TCResource *rsc = nullptr;
+
+       for (auto &it : m_queries) {
+               rsc = it.second;
+               if (rsc)
+                       delete rsc;
+       }
+       m_queries.clear();
+}
+
+void TCPlayer::AddAllocatedResource(int device_id)
+{
+       m_allocated_resources.insert(std::pair<int, int>(++m_allocated_rsc_index, device_id));
+}
+
+int TCPlayer::GetAllocatedResourceId(int index)
+{
+       auto it = m_allocated_resources.find(index);
+
+       return (it == m_allocated_resources.end()) ? -1 : it->second;
+}
+
+int TCPlayer::AllocateResources(void)
+{
+       if (m_requested_resources.size() == 0)
+               return RM_ERROR;
+
+       int i = 0;
+       int result = RM_ERROR;
+
+       rm_category_request_s req;
+       memset(&req, 0, sizeof(rm_category_request_s));
+
+       req.request_num = m_requested_resources.size();
+
+       for (auto &it : m_requested_resources) {
+               TCResource *rsc = it.second;
+               req.category_id[i] = (rm_rsc_category_e) rsc->GetCategoryId();
+               req.category_option[i] = rsc->GetCategoryOption();
+               req.state[i] = (rm_requests_resource_state_e) rsc->GetState();
+               i++;
+       }
+
+       rm_device_return_s allocated;
+       memset(&allocated, 0, sizeof(allocated));
+
+       result = rm_allocate_resources(m_handle, &req, &allocated);
+
+       if (result == RM_OK) {
+               for (int j = 0; j < allocated.allocated_num; j++)
+                       AddAllocatedResource(allocated.device_id[j]);
+       }
+
+       return result;
+}
+
+int TCPlayer::ReleaseResources(void)
+{
+       if (m_allocated_resources.size() <= 0)
+               return RM_ERROR;
+
+       int i = 0;
+       rm_device_request_s req;
+       memset(&req, 0, sizeof(req));
+
+       req.request_num = m_allocated_resources.size();
+
+       for (auto &it : m_allocated_resources) {
+               req.device_id[i] = it.second;
+               i++;
+       }
+
+       m_allocated_resources.clear();
+       m_allocated_rsc_index = 0;
+
+       return rm_deallocate_resources(m_handle, &req);
+}
+
+int TCPlayer::ReleaseResource(int index)
+{
+       if (m_allocated_resources.size() <= 0)
+               return RM_ERROR;
+
+       auto it = m_allocated_resources.find(index);
+       int device_id = (it == m_allocated_resources.end()) ? -1 : it->second;
+
+       rm_device_request_s req;
+       memset(&req, 0, sizeof(req));
+
+       req.request_num = 1;
+       req.device_id[0] = device_id;
+
+       m_allocated_resources.erase(index);
+
+       return rm_deallocate_resources(m_handle, &req);
+}
+
+int TCPlayer::GetActiveAudioOut(void)
+{
+       return rm_get_active_audio_out(m_handle);
+}
index c14996602c19b0ceeab77985b420cb07adc67846..fc61df0e4709ed8fee3a47a7ba6799d0325709d9 100644 (file)
@@ -1,28 +1,28 @@
-/*\r
- * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * 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
-#include "TCResource.h"\r
-\r
-TCResource::TCResource(int category_id, int category_option, int state)\r
-{\r
-       m_category_id = category_id;\r
-       m_category_option = category_option;\r
-       m_state = state;\r
-}\r
-\r
-TCResource::~TCResource()\r
-{\r
-}\r
+/*
+ * Copyright (c) 2024 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 "TCResource.h"
+
+TCResource::TCResource(int category_id, int category_option, int state)
+{
+       m_category_id = category_id;
+       m_category_option = category_option;
+       m_state = state;
+}
+
+TCResource::~TCResource()
+{
+}
index 4d833dc612d0472b2c35d0da8b83d43a1a7075cc..e5ab4acad9cdcd59739e3bb1200297f2554b4a1a 100644 (file)
-/*\r
- * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * 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
-#include "gtest/gtest.h"\r
-#include <rm_api.h>\r
-#include <resource_center.h>\r
-#include <ut_util.h>\r
-\r
-CResourceManagerAPI* CResourceManagerAPI::m_instance = NULL;\r
-\r
-CResourceManagerAPI* CResourceManagerAPI::GetInstance()\r
-{\r
-       if (!m_instance)\r
-               m_instance = new CResourceManagerAPI();\r
-\r
-       return m_instance;\r
-}\r
-\r
-void CResourceManagerAPI::Reset(void)\r
-{\r
-       m_conflict_count = 0;\r
-}\r
-\r
-rm_resource_cb CResourceManagerAPI::GetConflictCB(int option)\r
-{\r
-       if (option == CB_NORMAL)\r
-               return &CResourceManagerAPI::ConflictCB;\r
-\r
-       if (option == CB_COUNT)\r
-               return &CResourceManagerAPI::ConflictCBCount;\r
-\r
-       return &CResourceManagerAPI::ConflictCB;\r
-}\r
-\r
-\r
-rm_cb_result CResourceManagerAPI::ConflictCB(int handle, rm_callback_type event, rm_device_request_s *info, void* data)\r
-{\r
-       rm_unregister(handle);\r
-       return RM_CB_RESULT_OK;\r
-}\r
-\r
-rm_cb_result CResourceManagerAPI::ConflictCBCount(int handle, rm_callback_type event, rm_device_request_s *info, void* data)\r
-{\r
-       CResourceManagerAPI* api = (CResourceManagerAPI*) data;\r
-       api->m_conflict_count++;\r
-       rm_unregister(handle);\r
-       return RM_CB_RESULT_OK;\r
-}\r
-\r
-int CResourceManagerAPI::RegisterPlayer(int option, int expected)\r
-{\r
-       int handle = 0;\r
-\r
-       EXPECT_EQ(expected, rm_register(GetConflictCB(option), this, &handle, NULL));\r
-\r
-       return handle;\r
-}\r
-\r
-int CResourceManagerAPI::RegisterPlayer(std::string app_id, int option, int expected)\r
-{\r
-       return 0;\r
-}\r
-\r
-gboolean CResourceManagerAPI::SetAppZoneIdAsync(gpointer data)\r
-{\r
-       CAppInfo *app_info = (CAppInfo*) data;\r
-       sleep(app_info->GetSleep());\r
-       EXPECT_EQ(0, rc_set_app_zone_info(app_info->GetAppId().c_str(), app_info->GetZoneId()));\r
-       delete app_info;\r
-       return G_SOURCE_REMOVE;\r
-}\r
-\r
-int CResourceManagerAPI::SetAppZoneIdAsync(std::string app_id, int zone_id, int sleep_sec)\r
-{\r
-       CAppInfo *app_info = new CAppInfo();\r
-       app_info->SetAppId(app_id);\r
-       app_info->SetZoneId(zone_id);\r
-       app_info->SetSleep(sleep_sec);\r
-\r
-       g_idle_add(&CResourceManagerAPI::SetAppZoneIdAsync, app_info);\r
-       return 0;\r
-}\r
-\r
-gboolean CResourceManagerAPI::SetAudioFocusAsync(gpointer data)\r
-{\r
-       CFocusInfo *focus_info = (CFocusInfo*) data;\r
-       sleep(focus_info->GetSleep());\r
-       EXPECT_EQ(0, rc_set_audio_focus(focus_info->GetZoneId()));\r
-       delete focus_info;\r
-       return G_SOURCE_REMOVE;\r
-}\r
-\r
-int CResourceManagerAPI::SetAudioFocusAsync(int zone_id, int sleep_sec)\r
-{\r
-       CFocusInfo *focus_info = new CFocusInfo();\r
-       focus_info->SetZoneId(zone_id);\r
-       focus_info->SetSleep(sleep_sec);\r
-\r
-       g_idle_add(&CResourceManagerAPI::SetAudioFocusAsync, focus_info);\r
-       return 0;\r
-}\r
-\r
-CVideoCategory::CVideoCategory()\r
-{\r
-       m_option.codec_name = NULL;\r
-       m_option.h_size = 0;\r
-       m_option.v_size = 0;\r
-       m_option.framerate = 0;\r
-       m_option.color_depth = 0;\r
-       m_option.sampling_format = 0;\r
-}\r
-\r
-void CVideoCategory::SetProperties(std::string codec, int width, int height, int framerate, int color_depth, int sampling)\r
-{\r
-       ResetProperties();\r
-\r
-       m_option.codec_name = strndup(codec.c_str(), codec.length());\r
-       m_option.h_size = width;\r
-       m_option.v_size = height;\r
-       m_option.framerate = framerate;\r
-       m_option.color_depth = color_depth;\r
-       m_option.sampling_format = sampling;\r
-}\r
-\r
-void CVideoCategory::ResetProperties(void)\r
-{\r
-       if (m_option.codec_name) {\r
-               free((void*) m_option.codec_name);\r
-               m_option.codec_name = NULL;\r
-       }\r
-\r
-       m_option.h_size = 0;\r
-       m_option.v_size = 0;\r
-       m_option.framerate = 0;\r
-       m_option.color_depth = 0;\r
-       m_option.sampling_format = 0;\r
-}\r
-\r
-ri_video_category_option_request_s* CVideoCategory::Build(void)\r
-{\r
-       return &m_option;\r
-}\r
-\r
-int CVideoCategory::GetCapableCategoryId(void)\r
-{\r
-       return ri_get_capable_video_category_id(&m_option);\r
-}\r
-\r
-int AddZoneInfo(int category_id, int zone_id)\r
-{\r
-       const int PM_ZONE_ID_OFFSET = 21;\r
-       int zone_info = (zone_id << PM_ZONE_ID_OFFSET);\r
-\r
-       return (category_id | zone_info);\r
-}\r
-\r
+/*
+ * Copyright (c) 2024 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 "gtest/gtest.h"
+#include <rm_api.h>
+#include <resource_center.h>
+#include <ut_util.h>
+
+CResourceManagerAPI* CResourceManagerAPI::m_instance = NULL;
+
+CResourceManagerAPI* CResourceManagerAPI::GetInstance()
+{
+       if (!m_instance)
+               m_instance = new CResourceManagerAPI();
+
+       return m_instance;
+}
+
+void CResourceManagerAPI::Reset(void)
+{
+       m_conflict_count = 0;
+}
+
+rm_resource_cb CResourceManagerAPI::GetConflictCB(int option)
+{
+       if (option == CB_NORMAL)
+               return &CResourceManagerAPI::ConflictCB;
+
+       if (option == CB_COUNT)
+               return &CResourceManagerAPI::ConflictCBCount;
+
+       return &CResourceManagerAPI::ConflictCB;
+}
+
+
+rm_cb_result CResourceManagerAPI::ConflictCB(int handle, rm_callback_type event, rm_device_request_s *info, void* data)
+{
+       rm_unregister(handle);
+       return RM_CB_RESULT_OK;
+}
+
+rm_cb_result CResourceManagerAPI::ConflictCBCount(int handle, rm_callback_type event, rm_device_request_s *info, void* data)
+{
+       CResourceManagerAPI* api = (CResourceManagerAPI*) data;
+       api->m_conflict_count++;
+       rm_unregister(handle);
+       return RM_CB_RESULT_OK;
+}
+
+int CResourceManagerAPI::RegisterPlayer(int option, int expected)
+{
+       int handle = 0;
+
+       EXPECT_EQ(expected, rm_register(GetConflictCB(option), this, &handle, NULL));
+
+       return handle;
+}
+
+int CResourceManagerAPI::RegisterPlayer(std::string app_id, int option, int expected)
+{
+       return 0;
+}
+
+gboolean CResourceManagerAPI::SetAppZoneIdAsync(gpointer data)
+{
+       CAppInfo *app_info = (CAppInfo*) data;
+       sleep(app_info->GetSleep());
+       EXPECT_EQ(0, rc_set_app_zone_info(app_info->GetAppId().c_str(), app_info->GetZoneId()));
+       delete app_info;
+       return G_SOURCE_REMOVE;
+}
+
+int CResourceManagerAPI::SetAppZoneIdAsync(std::string app_id, int zone_id, int sleep_sec)
+{
+       CAppInfo *app_info = new CAppInfo();
+       app_info->SetAppId(app_id);
+       app_info->SetZoneId(zone_id);
+       app_info->SetSleep(sleep_sec);
+
+       g_idle_add(&CResourceManagerAPI::SetAppZoneIdAsync, app_info);
+       return 0;
+}
+
+gboolean CResourceManagerAPI::SetAudioFocusAsync(gpointer data)
+{
+       CFocusInfo *focus_info = (CFocusInfo*) data;
+       sleep(focus_info->GetSleep());
+       EXPECT_EQ(0, rc_set_audio_focus(focus_info->GetZoneId()));
+       delete focus_info;
+       return G_SOURCE_REMOVE;
+}
+
+int CResourceManagerAPI::SetAudioFocusAsync(int zone_id, int sleep_sec)
+{
+       CFocusInfo *focus_info = new CFocusInfo();
+       focus_info->SetZoneId(zone_id);
+       focus_info->SetSleep(sleep_sec);
+
+       g_idle_add(&CResourceManagerAPI::SetAudioFocusAsync, focus_info);
+       return 0;
+}
+
+CVideoCategory::CVideoCategory()
+{
+       m_option.codec_name = NULL;
+       m_option.h_size = 0;
+       m_option.v_size = 0;
+       m_option.framerate = 0;
+       m_option.color_depth = 0;
+       m_option.sampling_format = 0;
+}
+
+void CVideoCategory::SetProperties(std::string codec, int width, int height, int framerate, int color_depth, int sampling)
+{
+       ResetProperties();
+
+       m_option.codec_name = strndup(codec.c_str(), codec.length());
+       m_option.h_size = width;
+       m_option.v_size = height;
+       m_option.framerate = framerate;
+       m_option.color_depth = color_depth;
+       m_option.sampling_format = sampling;
+}
+
+void CVideoCategory::ResetProperties(void)
+{
+       if (m_option.codec_name) {
+               free((void*) m_option.codec_name);
+               m_option.codec_name = NULL;
+       }
+
+       m_option.h_size = 0;
+       m_option.v_size = 0;
+       m_option.framerate = 0;
+       m_option.color_depth = 0;
+       m_option.sampling_format = 0;
+}
+
+ri_video_category_option_request_s* CVideoCategory::Build(void)
+{
+       return &m_option;
+}
+
+int CVideoCategory::GetCapableCategoryId(void)
+{
+       return ri_get_capable_video_category_id(&m_option);
+}
+
+int AddZoneInfo(int category_id, int zone_id)
+{
+       const int PM_ZONE_ID_OFFSET = 21;
+       int zone_info = (zone_id << PM_ZONE_ID_OFFSET);
+
+       return (category_id | zone_info);
+}
+