Move all files for remove submodule move_espp-service
authorGilbok Lee <gilbok.lee@samsung.com>
Mon, 12 May 2025 06:55:10 +0000 (15:55 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Mon, 12 May 2025 06:55:10 +0000 (15:55 +0900)
Change-Id: Iaff57bd5ef68cc0819851db8b7f55ed10c7fa682

94 files changed:
AUTHOR [deleted file]
LICENSE.APLv2 [deleted file]
README.md [deleted file]
agent/espp-service/AUTHOR [new file with mode: 0644]
agent/espp-service/LICENSE.APLv2 [new file with mode: 0644]
agent/espp-service/README.md [new file with mode: 0644]
agent/espp-service/build_def.prop [new file with mode: 0644]
agent/espp-service/build_def.sh [new file with mode: 0755]
agent/espp-service/get_version.sh [new file with mode: 0755]
agent/espp-service/inc/esplusplayer_capi/buffer.h [new file with mode: 0644]
agent/espp-service/inc/esplusplayer_capi/display.h [new file with mode: 0644]
agent/espp-service/inc/esplusplayer_capi/drm.h [new file with mode: 0644]
agent/espp-service/inc/esplusplayer_capi/error.h [new file with mode: 0644]
agent/espp-service/inc/esplusplayer_capi/espacket.h [new file with mode: 0644]
agent/espp-service/inc/esplusplayer_capi/esplusplayer_capi.h [new file with mode: 0644]
agent/espp-service/inc/esplusplayer_capi/esplusplayer_internal.h [new file with mode: 0644]
agent/espp-service/inc/esplusplayer_capi/event.h [new file with mode: 0644]
agent/espp-service/inc/esplusplayer_capi/matroska_color.h [new file with mode: 0644]
agent/espp-service/inc/esplusplayer_capi/state.h [new file with mode: 0644]
agent/espp-service/inc/esplusplayer_capi/stream.h [new file with mode: 0644]
agent/espp-service/inc/esplusplayer_capi/submitdatatype.h [new file with mode: 0644]
agent/espp-service/inc/esplusplayer_capi/submitstatus.h [new file with mode: 0644]
agent/espp-service/meson.build [new file with mode: 0644]
agent/espp-service/meson_options.txt [new file with mode: 0644]
agent/espp-service/packaging/espp-service.manifest [new file with mode: 0644]
agent/espp-service/packaging/espp-service.service [new file with mode: 0644]
agent/espp-service/packaging/espp-service.spec [new file with mode: 0644]
agent/espp-service/project_def.prop [new file with mode: 0644]
agent/espp-service/src/client/build_def.prop [new file with mode: 0644]
agent/espp-service/src/client/espp_service_client.c [new file with mode: 0644]
agent/espp-service/src/client/espp_service_client.h [new file with mode: 0644]
agent/espp-service/src/client/espp_service_client_event_handler.c [new file with mode: 0644]
agent/espp-service/src/client/espp_service_client_msg.c [new file with mode: 0644]
agent/espp-service/src/client/espp_service_client_priv.h [new file with mode: 0644]
agent/espp-service/src/client/espp_service_client_socket.c [new file with mode: 0644]
agent/espp-service/src/client/meson.build [new file with mode: 0644]
agent/espp-service/src/client/project_def.prop [new file with mode: 0644]
agent/espp-service/src/client/update_version.sh [new file with mode: 0755]
agent/espp-service/src/common/espp_service_common.h [new file with mode: 0644]
agent/espp-service/src/common/espp_service_ipc.c [new file with mode: 0644]
agent/espp-service/src/common/espp_service_ipc.h [new file with mode: 0644]
agent/espp-service/src/daemon/espp_service.c [new file with mode: 0644]
agent/espp-service/src/daemon/espp_service_handler.c [new file with mode: 0644]
agent/espp-service/src/daemon/espp_service_msg.c [new file with mode: 0644]
agent/espp-service/src/daemon/espp_service_priv.h [new file with mode: 0644]
agent/espp-service/src/daemon/espp_service_socket.c [new file with mode: 0644]
agent/espp-service/src/daemon/meson.build [new file with mode: 0644]
agent/espp-service/src/meson.build [new file with mode: 0644]
agent/espp-service/tizen-manifest.xml [new file with mode: 0644]
agent/espp-service/update_version.sh [new file with mode: 0755]
build_def.prop [deleted file]
build_def.sh [deleted file]
get_version.sh [deleted file]
inc/esplusplayer_capi/buffer.h [deleted file]
inc/esplusplayer_capi/display.h [deleted file]
inc/esplusplayer_capi/drm.h [deleted file]
inc/esplusplayer_capi/error.h [deleted file]
inc/esplusplayer_capi/espacket.h [deleted file]
inc/esplusplayer_capi/esplusplayer_capi.h [deleted file]
inc/esplusplayer_capi/esplusplayer_internal.h [deleted file]
inc/esplusplayer_capi/event.h [deleted file]
inc/esplusplayer_capi/matroska_color.h [deleted file]
inc/esplusplayer_capi/state.h [deleted file]
inc/esplusplayer_capi/stream.h [deleted file]
inc/esplusplayer_capi/submitdatatype.h [deleted file]
inc/esplusplayer_capi/submitstatus.h [deleted file]
meson.build [deleted file]
meson_options.txt [deleted file]
packaging/espp-service.manifest [deleted file]
packaging/espp-service.service [deleted file]
packaging/espp-service.spec [deleted file]
project_def.prop [deleted file]
src/client/build_def.prop [deleted file]
src/client/espp_service_client.c [deleted file]
src/client/espp_service_client.h [deleted file]
src/client/espp_service_client_event_handler.c [deleted file]
src/client/espp_service_client_msg.c [deleted file]
src/client/espp_service_client_priv.h [deleted file]
src/client/espp_service_client_socket.c [deleted file]
src/client/meson.build [deleted file]
src/client/project_def.prop [deleted file]
src/client/update_version.sh [deleted file]
src/common/espp_service_common.h [deleted file]
src/common/espp_service_ipc.c [deleted file]
src/common/espp_service_ipc.h [deleted file]
src/daemon/espp_service.c [deleted file]
src/daemon/espp_service_handler.c [deleted file]
src/daemon/espp_service_msg.c [deleted file]
src/daemon/espp_service_priv.h [deleted file]
src/daemon/espp_service_socket.c [deleted file]
src/daemon/meson.build [deleted file]
src/meson.build [deleted file]
tizen-manifest.xml [deleted file]
update_version.sh [deleted file]

diff --git a/AUTHOR b/AUTHOR
deleted file mode 100644 (file)
index 9142ccc..0000000
--- a/AUTHOR
+++ /dev/null
@@ -1,2 +0,0 @@
-Sangchul Lee <sc11.lee@samsung.com>
-Heechul Jeon <heechul.jeon@samsung.com>
diff --git a/LICENSE.APLv2 b/LICENSE.APLv2
deleted file mode 100644 (file)
index 483e1e9..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-Copyright (c) 2000 - 2020 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.
-
diff --git a/README.md b/README.md
deleted file mode 100644 (file)
index 3f44af3..0000000
--- a/README.md
+++ /dev/null
@@ -1,24 +0,0 @@
-# espp-service
-
-**espp-service** provides daemon binary which uses *esplusplayer* library to render audio/video buffers and it's client library. The main purpose of this service is to delegate the rendering tasks to the specific daemon as well as to separate the related dependencies from an application process.
-
-## Getting started
-
-#### Clone this repository
-```sh
-$ git clone git@github.sec.samsung.net:tizen-vault/espp-service.git
-```
-
-#### Build
-**espp-service** uses tizen gbs build to make packages.
-```sh
-$ gbs build -A armv7l -P gbs_profile_name
-```
-
-#### Launch the service
-```sh
-$ systemctl start espp-service
-```
-
-#### Client API
-Please refer to this [link](https://github.sec.samsung.net/tizen-vault/espp-service/blob/main/src/client/espp_service_client.h).
diff --git a/agent/espp-service/AUTHOR b/agent/espp-service/AUTHOR
new file mode 100644 (file)
index 0000000..9142ccc
--- /dev/null
@@ -0,0 +1,2 @@
+Sangchul Lee <sc11.lee@samsung.com>
+Heechul Jeon <heechul.jeon@samsung.com>
diff --git a/agent/espp-service/LICENSE.APLv2 b/agent/espp-service/LICENSE.APLv2
new file mode 100644 (file)
index 0000000..483e1e9
--- /dev/null
@@ -0,0 +1,204 @@
+Copyright (c) 2000 - 2020 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.
+
diff --git a/agent/espp-service/README.md b/agent/espp-service/README.md
new file mode 100644 (file)
index 0000000..3f44af3
--- /dev/null
@@ -0,0 +1,24 @@
+# espp-service
+
+**espp-service** provides daemon binary which uses *esplusplayer* library to render audio/video buffers and it's client library. The main purpose of this service is to delegate the rendering tasks to the specific daemon as well as to separate the related dependencies from an application process.
+
+## Getting started
+
+#### Clone this repository
+```sh
+$ git clone git@github.sec.samsung.net:tizen-vault/espp-service.git
+```
+
+#### Build
+**espp-service** uses tizen gbs build to make packages.
+```sh
+$ gbs build -A armv7l -P gbs_profile_name
+```
+
+#### Launch the service
+```sh
+$ systemctl start espp-service
+```
+
+#### Client API
+Please refer to this [link](https://github.sec.samsung.net/tizen-vault/espp-service/blob/main/src/client/espp_service_client.h).
diff --git a/agent/espp-service/build_def.prop b/agent/espp-service/build_def.prop
new file mode 100644 (file)
index 0000000..85b3545
--- /dev/null
@@ -0,0 +1,4 @@
+PREBUILD_COMMAND =
+PREBUILD_COMMAND = sh update_version.sh
+POSTBUILD_COMMAND =
+POSTBUILD_DESC =
diff --git a/agent/espp-service/build_def.sh b/agent/espp-service/build_def.sh
new file mode 100755 (executable)
index 0000000..6bc573e
--- /dev/null
@@ -0,0 +1,45 @@
+source build_def_common
+
+BUILD_COMMAND=${1}
+BUILD_ARCH=${2}
+BUILD_CONFIG=${3}
+PROJ_PATH=${4}
+TIZEN_VERSION=${5}
+archPath=$BUILD_ARCH
+
+echo "Using build build arch :: $BUILD_ARCH"
+echo "Using build build config :: $BUILD_CONFIG"
+
+echo "Current PWD :: $PROJ_PATH"
+PROJ_ROOT="$(echo $PROJ_PATH|tr '^C' 'c'|tr '\\' '/')"
+echo "Current PWD :: $PROJ_ROOT"
+echo "Using build tizen version :: $TIZEN_VERSION"
+
+PROP_FILE="${PROJ_ROOT}/project_def.prop"
+
+echo "[================= ${1} script =================]"
+if [ "${1}" == "PREBUILD_COMMAND" ]; then
+    echo "Copying Dependent Libraries to Libs Folder"
+
+    # Recover original prop file
+    RecoverProp $PROP_FILE
+
+    # remove so
+    rm -f ${PROJ_ROOT}/libs/*.so
+
+    # copy esplusplayer to build
+    cp -f ${PROJ_ROOT}/../libs/mm-avplayer/$TIZEN_VERSION/lib/fhub_esplusplayer/$BUILD_CONFIG/6.0-$archPath/libesplusplayer.so ${PROJ_ROOT}/libs
+    ls -als ${PROJ_ROOT}/libs
+    printenv
+
+    # Backup original prop file
+    BackupProp $PROP_FILE
+
+    # Add options for coverage
+    if [ "$TIZEN_VERSION" == "tizen7.0" ]; then
+        AddOpts "USER_DEFS =" "ST_AVP_TIZEN_70" $PROP_FILE
+    fi
+elif [ "${1}" == "POSTBUILD_COMMAND" ]; then
+    # Recover original prop file
+    RecoverProp $PROP_FILE
+fi
diff --git a/agent/espp-service/get_version.sh b/agent/espp-service/get_version.sh
new file mode 100755 (executable)
index 0000000..74ab915
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+grep "Version" packaging/espp-service.spec | cut -f2 -d :
diff --git a/agent/espp-service/inc/esplusplayer_capi/buffer.h b/agent/espp-service/inc/esplusplayer_capi/buffer.h
new file mode 100644 (file)
index 0000000..acaf120
--- /dev/null
@@ -0,0 +1,103 @@
+/**
+ * @file
+ * @brief          The buffer for playback.
+ * @interfacetype  Platform
+ * @privlevel      None-privilege
+ * @privilege      None
+ * @product        TV, AV, B2B
+ * @version        2.0
+ * @SDK_Support    N
+ * @remark         This is a group of C style buffer related enum.
+ * @see            N/A
+ *
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ * PROPRIETARY/CONFIDENTIAL
+ * This software is the confidential and proprietary
+ * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
+ * not disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into with
+ * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
+ * suitability of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a
+ * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
+ * damages suffered by licensee as a result of using, modifying or distributing
+ * this software or its derivatives.
+ */
+
+#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_BUFFER_H__
+#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_BUFFER_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+/**
+ * @brief  Enumerations for the buffer status
+ */
+typedef enum {
+  ESPLUSPLAYER_BUFFER_STATUS_UNDERRUN,
+  ESPLUSPLAYER_BUFFER_STATUS_OVERRUN
+} esplusplayer_buffer_status;
+
+/**
+ * @brief  Enumerations for video decoded buffer type
+ * ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_SCALE:
+ * decoded video frame will be croped and scaled, then sent to
+ * user by media_packet_video_decoded_cb, only support hw decoder now
+*/
+typedef enum {
+  ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_NONE,
+  ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_COPY,
+  ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_REFERENCE,
+  ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_SCALE
+} esplusplayer_decoded_video_frame_buffer_type;
+
+/**
+ * @brief  Enumerations for buffer size option
+ * MAX_TIME_SIZE: The maximum amount of data to esplusplayer internally(in ms)
+ * MIN_TIME_THRESHOLD : Emit under-run when queued bytes drops below this
+ * percent of max-time-size(size%)
+ * MAX_BYTE_SIZE: The maximum number of bytes to esplusplayer internally
+ * MIN_BYTE_THRESHOLD : Emit under-run when queued bytes drops below this
+ * percent of  max-byte-size(size%)
+ */
+typedef enum {
+  ESPLUSPLAYER_BUFFER_AUDIO_MAX_TIME_SIZE,
+  ESPLUSPLAYER_BUFFER_VIDEO_MAX_TIME_SIZE,
+  ESPLUSPLAYER_BUFFER_AUDIO_MIN_TIME_THRESHOLD,
+  ESPLUSPLAYER_BUFFER_VIDEO_MIN_TIME_THRESHOLD,
+  ESPLUSPLAYER_BUFFER_AUDIO_MAX_BYTE_SIZE,
+  ESPLUSPLAYER_BUFFER_VIDEO_MAX_BYTE_SIZE,
+  ESPLUSPLAYER_BUFFER_AUDIO_MIN_BYTE_THRESHOLD,
+  ESPLUSPLAYER_BUFFER_VIDEO_MIN_BYTE_THRESHOLD
+} esplusplayer_buffer_option;
+
+/**
+ * @brief  video decoded buffer struct
+ */
+typedef struct {
+  /**
+   * @description   buffer pts, in millisecond
+   */
+  uint64_t pts;
+  /**
+   * @description   buffer duration, in millisecond
+   */
+  uint64_t duration;
+  /**
+   * @description   surface data
+   */
+  void* surface_data;
+  /**
+   * @description   the scaler index,0 1 ...
+   */
+  void* private_data;
+} esplusplayer_decoded_video_packet;
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
+#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_BUFFER_H__
diff --git a/agent/espp-service/inc/esplusplayer_capi/display.h b/agent/espp-service/inc/esplusplayer_capi/display.h
new file mode 100644 (file)
index 0000000..a509f82
--- /dev/null
@@ -0,0 +1,75 @@
+/**
+ * @file
+ * @brief          Display related enums
+ * @interfacetype  Platform
+ * @privlevel      None-privilege
+ * @privilege      None
+ * @product        TV, AV, B2B
+ * @version        2.0
+ * @SDK_Support    N
+ * @remark         This is a group of C style display releted data structures
+ *                 and enums.
+ * @see            The display related enum values and data structures will be
+ *                 converted by this managed C version types to avoid binary
+ *                 compatibility.
+ *
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ * PROPRIETARY/CONFIDENTIAL
+ * This software is the confidential and proprietary
+ * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
+ * not disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into with
+ * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
+ * suitability of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a
+ * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
+ * damages suffered by licensee as a result of using, modifying or distributing
+ * this software or its derivatives.
+ */
+
+#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_DISPLAY_H__
+#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_DISPLAY_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief  Enumerations for the display mode
+ */
+typedef enum {
+  ESPLUSPLAYER_DISPLAY_MODE_LETTER_BOX,
+  ESPLUSPLAYER_DISPLAY_MODE_ORIGIN_SIZE,
+  ESPLUSPLAYER_DISPLAY_MODE_FULL_SCREEN,
+  ESPLUSPLAYER_DISPLAY_MODE_CROPPED_FULL,
+  ESPLUSPLAYER_DISPLAY_MODE_ORIGIN_OR_LETTER,
+  ESPLUSPLAYER_DISPLAY_MODE_DST_ROI,
+  ESPLUSPLAYER_DISPLAY_MODE_MAX
+} esplusplayer_display_mode;
+
+/**
+ * @brief  Enumerations for the display type
+ */
+typedef enum {
+  ESPLUSPLAYER_DISPLAY_TYPE_NONE,
+  ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,
+  ESPLUSPLAYER_DISPLAY_TYPE_EVAS,
+  ESPLUSPLAYER_DISPLAY_TYPE_MIXER,
+  ESPLUSPLAYER_DISPLAY_TYPE_MAX
+} esplusplayer_display_type;
+
+/**
+ * @brief  Enumerations for the display rotation type
+ */
+typedef enum {
+  ESPLUSPLAYER_DISPLAY_ROTATION_TYPE_NONE,
+  ESPLUSPLAYER_DISPLAY_ROTATION_TYPE_90,
+  ESPLUSPLAYER_DISPLAY_ROTATION_TYPE_180,
+  ESPLUSPLAYER_DISPLAY_ROTATION_TYPE_270
+} esplusplayer_display_rotation_type;
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
+#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_DISPLAY_H__
diff --git a/agent/espp-service/inc/esplusplayer_capi/drm.h b/agent/espp-service/inc/esplusplayer_capi/drm.h
new file mode 100644 (file)
index 0000000..a40c213
--- /dev/null
@@ -0,0 +1,183 @@
+/**
+ * @file
+ * @brief          Drm related enums
+ * @interfacetype  Platform
+ * @privlevel      None-privilege
+ * @privilege      None
+ * @product        TV, AV, B2B
+ * @version        2.0
+ * @SDK_Support    N
+ * @remark         This is a group of C style drm releted data structures and
+ *                 enums.
+ * @see            Drm releated event listeners, enum classes, etc.. are
+ *                 converted to this.
+ *
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ * PROPRIETARY/CONFIDENTIAL
+ * This software is the confidential and proprietary
+ * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
+ * not disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into with
+ * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
+ * suitability of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a
+ * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
+ * damages suffered by licensee as a result of using, modifying or distributing
+ * this software or its derivatives.
+ */
+
+#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_DRM_H__
+#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_DRM_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+/**
+ * @brief  Enumerations for the drm type
+ */
+typedef enum {
+  ESPLUSPLAYER_DRM_TYPE_NONE,
+  ESPLUSPLAYER_DRM_TYPE_PLAYREADY,
+  ESPLUSPLAYER_DRM_TYPE_MARLIN,
+  ESPLUSPLAYER_DRM_TYPE_VERIMATRIX,
+  ESPLUSPLAYER_DRM_TYPE_WV_MODULAR
+} esplusplayer_drm_type;
+
+/**
+ * @brief  Enumerations for the algorithm encrypted
+ */
+typedef enum {
+  ESPLUSPLAYER_DRMB_ES_CIPHER_ALGORITHM_UNKNOWN = -1,
+  ESPLUSPLAYER_DRMB_ES_CIPHER_ALGORITHM_RC4 = 0,
+  ESPLUSPLAYER_DRMB_ES_CIPHER_ALGORITHM_AES128_CTR = 1,
+  ESPLUSPLAYER_DRMB_ES_CIPHER_ALGORITHM_AES128_CBC = 2
+} esplusplayer_drmb_es_cipher_algorithm;
+
+/**
+ * @brief  Enumerations for the algorithm encrypted
+ */
+typedef enum {
+  ESPLUSPLAYER_DRMB_ES_MEDIA_FORMAT_NONE = 0,
+  ESPLUSPLAYER_DRMB_ES_MEDIA_FORMAT_FMP4 = 1,
+  ESPLUSPLAYER_DRMB_ES_MEDIA_FORMAT_TS = 2,
+  ESPLUSPLAYER_DRMB_ES_MEDIA_FORMAT_ASF = 3,
+  ESPLUSPLAYER_DRMB_ES_MEDIA_FORMAT_FMP4_AUDIO = 4,
+  ESPLUSPLAYER_DRMB_ES_MEDIA_FORMAT_FMP4_VIDEO = 5,
+  ESPLUSPLAYER_DRMB_ES_MEDIA_FORMAT_CLEAN_AUDIO = 6,
+  ESPLUSPLAYER_DRMB_ES_MEDIA_FORMAT_PES = 7
+} esplusplayer_drmb_es_media_format;
+
+/**
+ * @brief  Enumerations for the phase for cipher
+ */
+typedef enum {
+  ESPLUSPLAYER_DRMB_ES_CIPHER_PHASE_NONE = 0,
+  ESPLUSPLAYER_DRMB_ES_CIPHER_PHASE_INIT = 1,
+  ESPLUSPLAYER_DRMB_ES_CIPHER_PHASE_UPDATE = 2,
+  ESPLUSPLAYER_DRMB_ES_CIPHER_PHASE_FINAL = 3
+} esplusplayer_drmb_es_cipher_phase;
+
+/**
+ * @brief  Subsample information structure for encrypted es
+ */
+typedef struct {
+  /**
+   * @description   The bytes of clear data.
+   */
+  uint32_t bytes_of_clear_data;
+  /**
+   * @description   The bytes of encrypted data.
+   */
+  uint32_t bytes_of_encrypted_data;
+} esplusplayer_drmb_es_subsample_info;
+
+/**
+ * @brief  Fragmented MP4 data structure for encrypted es
+ */
+typedef struct {
+  /**
+   * @description   The count of subsample informations
+   */
+  uint32_t subsample_count;
+  /**
+   * @description   The subsample informations
+   */
+  esplusplayer_drmb_es_subsample_info* subsample_infos;
+} esplusplayer_drmb_es_fmp4_data;
+
+/**
+ * @brief  The information to decrypt es packet
+ */
+typedef struct {
+  /**
+   * @description   The handle to decrypt es packet.
+   */
+  int32_t handle;
+  /**
+   * @description   The algorithm encrypted.
+   */
+  esplusplayer_drmb_es_cipher_algorithm algorithm;
+  /**
+   * @description   The es media format.
+   */
+  esplusplayer_drmb_es_media_format format;
+  /**
+   * @description   The phase to decrypt.
+   */
+  esplusplayer_drmb_es_cipher_phase phase;
+  /**
+   * @description   The KID.
+   */
+  unsigned char* kid;
+  /**
+   * @description   The length of KID.
+   */
+  uint32_t kid_length;
+  /**
+   * @description   The vector for initialization.
+   */
+  unsigned char* iv;
+  /**
+   * @description   The length of IV.
+   */
+  uint32_t iv_length;
+  /**
+   * @description   The sub data.
+   * @see           esplusplayer_drmb_es_fmp4_data
+   */
+  void* sub_data;
+  /**
+   * @description   The offset of sample.
+   *                It can be NULL.
+   *                If used, it have to be -1 terminated.
+   *                Max offset is 15.
+   */
+  int* split_offsets;
+  /**
+   * @description   It should be 0 when it must be protected with trustzone.
+   */
+  bool use_out_buffer;
+  /**
+   * @description   If use 'cbcs' pattern scheme, It should be 1. otherwise 0.
+   */
+  bool use_pattern;
+  /**
+   * @description   In case that use_patter is 1,
+   *                count of the encrypted blocks in the protection pattern.
+   */
+  uint32_t crypt_byte_block;
+  /**
+   * @description   In case that use_patter is 1,
+   *                count of the unencrypted blocks in the protection pattern.
+   */
+  uint32_t skip_byte_block;
+} esplusplayer_drm_info;
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
+#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_DRM_H__
diff --git a/agent/espp-service/inc/esplusplayer_capi/error.h b/agent/espp-service/inc/esplusplayer_capi/error.h
new file mode 100644 (file)
index 0000000..c1f7874
--- /dev/null
@@ -0,0 +1,69 @@
+/**
+ * @file
+ * @brief          Error related enums
+ * @interfacetype  Platform
+ * @privlevel      None-privilege
+ * @privilege      None
+ * @product        TV, AV, B2B
+ * @version        2.0
+ * @SDK_Support    N
+ * @remark         This is a group of C style error releted enum.
+ * @see            All error enum values will be converted to this managed error
+ *                 types.
+ *
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ * PROPRIETARY/CONFIDENTIAL
+ * This software is the confidential and proprietary
+ * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
+ * not disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into with
+ * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
+ * suitability of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a
+ * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
+ * damages suffered by licensee as a result of using, modifying or distributing
+ * this software or its derivatives.
+ */
+
+#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_ERROR_H__
+#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_ERROR_H__
+
+#include "tizen.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ESPLUSPLAYER_ERROR_CLASS TIZEN_ERROR_PLAYER | 0x20
+
+/* This is for custom defined esplusplayer error. */
+#define ESPLUSPLAYER_CUSTOM_ERROR_CLASS TIZEN_ERROR_PLAYER | 0x1000
+
+/**
+ * @brief  Enumerations for the error type
+ */
+typedef enum {
+  ESPLUSPLAYER_ERROR_TYPE_NONE = TIZEN_ERROR_NONE, /**< Successful */
+  ESPLUSPLAYER_ERROR_TYPE_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+  ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+  ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
+  ESPLUSPLAYER_ERROR_TYPE_INVALID_STATE  = ESPLUSPLAYER_ERROR_CLASS | 0x02, /**< Invalid state */
+  ESPLUSPLAYER_ERROR_TYPE_NOT_SUPPORTED_AUDIO_CODEC = ESPLUSPLAYER_ERROR_CLASS | 0x0e, /**< Not supported audio codec but video can be played (Since 4.0)*/
+  ESPLUSPLAYER_ERROR_TYPE_NOT_SUPPORTED_VIDEO_CODEC = ESPLUSPLAYER_ERROR_CLASS | 0x0f, /**< Not supported video codec but audio can be played (Since 4.0)*/
+  ESPLUSPLAYER_ERROR_TYPE_NOT_SUPPORTED_FILE = ESPLUSPLAYER_ERROR_CLASS | 0x03, /**< File format not supported */
+  ESPLUSPLAYER_ERROR_TYPE_CONNECTION_FAILED = ESPLUSPLAYER_ERROR_CLASS | 0x06, /**< Streaming connection failed */
+  ESPLUSPLAYER_ERROR_TYPE_DRM_EXPIRED = ESPLUSPLAYER_ERROR_CLASS | 0x08, /**< Expired license */
+  ESPLUSPLAYER_ERROR_TYPE_DRM_NO_LICENSE = ESPLUSPLAYER_ERROR_CLASS | 0x09, /**< No license */
+  ESPLUSPLAYER_ERROR_TYPE_DRM_FUTURE_USE = ESPLUSPLAYER_ERROR_CLASS | 0x0a, /**< License for future use */
+  ESPLUSPLAYER_ERROR_TYPE_NOT_PERMITTED = ESPLUSPLAYER_ERROR_CLASS | 0x0b, /**< Format not permitted */
+
+  ESPLUSPLAYER_ERROR_TYPE_DRM_DECRYPTION_FAILED = ESPLUSPLAYER_CUSTOM_ERROR_CLASS | 0x05, /**< drm decryption failed */
+  ESPLUSPLAYER_ERROR_TYPE_NOT_SUPPORTED_FORMAT = ESPLUSPLAYER_CUSTOM_ERROR_CLASS | 0x08,/**< format not supported */
+  ESPLUSPLAYER_ERROR_TYPE_UNKNOWN
+} esplusplayer_error_type;
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
+#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_ERROR_H__
diff --git a/agent/espp-service/inc/esplusplayer_capi/espacket.h b/agent/espp-service/inc/esplusplayer_capi/espacket.h
new file mode 100644 (file)
index 0000000..417da2d
--- /dev/null
@@ -0,0 +1,114 @@
+/**
+ * @file
+ * @brief          The packet for elementary stream
+ * @interfacetype  Platform
+ * @privlevel      None-privilege
+ * @privilege      None
+ * @product        TV, AV, B2B
+ * @version        2.0
+ * @SDK_Support    N
+ * @see            plusplayer::EsPlusPlayer class
+ *
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ * PROPRIETARY/CONFIDENTIAL
+ * This software is the confidential and proprietary
+ * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
+ * not disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into with
+ * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
+ * suitability of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a
+ * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
+ * damages suffered by licensee as a result of using, modifying or distributing
+ * this software or its derivatives.
+ */
+
+#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_ESPACKET_H__
+#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_ESPACKET_H__
+
+#include "esplusplayer_capi/matroska_color.h"
+#include "esplusplayer_capi/stream.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+/**
+ * @brief   Es packet structure
+ */
+typedef struct {
+  /**
+   * @description   The stream type.
+   */
+  esplusplayer_stream_type type;
+  /**
+   * @description   The buffer data pointer
+   */
+  char* buffer;
+  /**
+   * @description   The buffer size.
+   */
+  uint32_t buffer_size;
+  /**
+   * @description   The pts value in milisecond.
+   */
+  uint64_t pts;
+  /**
+   * @description   The duration value in milisecond.
+   */
+  uint64_t duration;
+  /**
+   * @description   The matroska color information. this value is only for video
+   * packet. If you set this value on a packet of other type, you can see an
+   * error when you submit the packet.
+   */
+  esplusplayer_matroska_color* matroska_color_info;
+  /**
+   * @description   The hdr10+ metadata size.
+   */
+  uint32_t hdr10p_metadata_size;
+  /**
+   * @description   The hdr10+ metadata.
+   */
+  char* hdr10p_metadata;
+} esplusplayer_es_packet;
+
+/**
+ * @brief   Trust zone es packet structure
+ */
+typedef struct {
+  /**
+   * @description   The Stream type.
+   */
+  esplusplayer_stream_type type;
+  /**
+   * @description   The tz handle.
+   */
+  uint32_t handle;
+  /**
+   * @description   The tz handle size.
+   */
+  uint32_t handle_size;
+  /**
+   * @description   The pts value in milisecond.
+   */
+  uint64_t pts;
+  /**
+   * @description   The duration value in milisecond.
+   */
+  uint64_t duration;
+  /**
+   * @description   The matroska color information. this value is only for video
+   * packet. If you set this value on a packet of other type, you can see an
+   * error when you submit the packet.
+   */
+  esplusplayer_matroska_color* matroska_color_info;
+} esplusplayer_es_tz_packet;
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
+#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_ESPACKET_H__
diff --git a/agent/espp-service/inc/esplusplayer_capi/esplusplayer_capi.h b/agent/espp-service/inc/esplusplayer_capi/esplusplayer_capi.h
new file mode 100644 (file)
index 0000000..9c17146
--- /dev/null
@@ -0,0 +1,2049 @@
+/**
+ * @file           esplusplayer_capi.h
+ * @brief          EsPlusPlayer api c version
+ * @interfacetype  Platform
+ * @privlevel      None-privilege
+ * @privilege      None
+ * @product        TV, AV, B2B
+ * @version        2.0
+ * @SDK_Support    N
+ * @remark         This is esplusplayer api header implemented as C style to
+ *                 avoid binary compatibility issues.
+ *
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ * PROPRIETARY/CONFIDENTIAL
+ * This software is the confidential and proprietary
+ * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
+ * not disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into with
+ * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
+ * suitability of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a
+ * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
+ * damages suffered by licensee as a result of using, modifying or distributing
+ * this software or its derivatives.
+ */
+
+#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_ESPLUSPLAYER_CAPI_H__
+#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_ESPLUSPLAYER_CAPI_H__
+
+#include "esplusplayer_capi/buffer.h"
+#include "esplusplayer_capi/display.h"
+#include "esplusplayer_capi/drm.h"
+#include "esplusplayer_capi/error.h"
+#include "esplusplayer_capi/espacket.h"
+#include "esplusplayer_capi/event.h"
+#include "esplusplayer_capi/state.h"
+#include "esplusplayer_capi/stream.h"
+#include "esplusplayer_capi/submitdatatype.h"
+#include "esplusplayer_capi/submitstatus.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+typedef void (*esplusplayer_error_cb)(const esplusplayer_error_type, void*);
+typedef void (*esplusplayer_buffer_status_cb)(const esplusplayer_stream_type,
+                                              const esplusplayer_buffer_status,
+                                              void*);
+typedef void (*esplusplayer_buffer_byte_status_cb)(
+    const esplusplayer_stream_type, const esplusplayer_buffer_status, uint64_t,
+    void*);
+typedef void (*esplusplayer_buffer_time_status_cb)(
+    const esplusplayer_stream_type, const esplusplayer_buffer_status, uint64_t,
+    void*);
+typedef void (*esplusplayer_resource_conflicted_cb)(void*);
+typedef void (*esplusplayer_eos_cb)(void*);
+typedef void (*esplusplayer_ready_to_prepare_cb)(const esplusplayer_stream_type,
+                                                 void*);
+typedef void (*esplusplayer_prepare_async_done_cb)(bool, void*);
+typedef void (*esplusplayer_seek_done_cb)(void*);
+typedef void (*esplusplayer_ready_to_seek_cb)(const esplusplayer_stream_type,
+                                              const uint64_t, void*);
+typedef void (*esplusplayer_media_packet_video_decoded_cb)(
+    const esplusplayer_decoded_video_packet*, void*);
+typedef void (*esplusplayer_closed_caption_cb)(const char* data, const int size,
+                                               void* userdata);
+typedef void (*esplusplayer_flush_done_cb)(void*);
+typedef void (*esplusplayer_event_cb)(const esplusplayer_event_type,
+                                      const esplusplayer_event_msg, void*);
+
+typedef void* esplusplayer_handle;
+
+/**
+ * @brief  Enumerations for the Adaptive info type
+ */
+typedef enum {
+  ESPLUSPLAYER_ADAPT_INFO_TYPE_NONE,
+  ESPLUSPLAYER_ADAPT_INFO_TYPE_DROPPED_FRAMES,
+  ESPLUSPLAYER_ADAPT_INFO_TYPE_DROPPED_VIDEO_FRAMES_FOR_CATCHUP,
+  ESPLUSPLAYER_ADAPT_INFO_TYPE_DROPPED_AUDIO_FRAMES_FOR_CATCHUP,
+} esplusplayer_adaptive_info_type;
+
+/**
+ * @brief   Enumerations for low latency mode
+ * @remark  Public supports #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_PREROLL only.
+ */
+typedef enum {
+  ESPLUSPLAYER_LOW_LATENCY_MODE_NONE = 0x0000,
+  /**
+   * @description   to support audio fast decoding/rendering
+   */
+  ESPLUSPLAYER_LOW_LATENCY_MODE_AUDIO = 0x0001,
+  /**
+   * @description   to support video fast decoding/rendering
+   *                Video stream should be composed only of P and I frames.
+   *                The mode support seamless resolution change since tizen 6.5
+   */
+  ESPLUSPLAYER_LOW_LATENCY_MODE_VIDEO = 0x0010,
+  /**
+   * @description   to support video fast decoding/rendering and video
+   *                distortion concealment.
+   *                Video stream should be composed only of P and I frames.
+   *                For applications using the UDP protocol, packet loss can
+   *                occur. when video distortion by video packet loss is
+   *                detected, it is a function to conceal distortion by showing
+   *                previous video frame. It is supported only in h.264 codec &
+   *                FHD or lower resolution.
+   */
+  ESPLUSPLAYER_LOW_LATENCY_MODE_VIDEO_DISTORTION_CONCEALMENT =
+      ESPLUSPLAYER_LOW_LATENCY_MODE_VIDEO | 0x0020,
+  /**
+   * @description   to disable clock sync and a/v sync when rendering. it
+   *                includes #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_PREROLL.
+   */
+  ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_SYNC = 0x0100,
+  /**
+   * @description   to disable preroll which means player doesn't wait for
+   *                first buffer when state is changed to
+   *                #ESPLUSPLAYER_STATE_READY from #ESPLUSPLAYER_STATE_IDLE.
+   *                It changes the state immediately.
+   *                It's usually used for sparse stream. (e.g. video packet
+   *                arrives but audio packet doesn't yet.)
+   */
+  ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_PREROLL = 0x0200,
+  /**
+   * @deprecated    Deprecated since tizen 6.5
+   * @description   to set lower video quality
+   *                If set this value, it can use original game_mode.
+   *                This value will be deprecated from 2022TV.
+   *                Please use ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE.
+   */
+  ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_VIDEO_QUALITY = 0x1000,
+  /**
+   * @description   to set game mode for minimum latency
+   *                Video stream should be composed only of P and I frames.
+   *                It must not be used together with
+   *                #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_VIDEO_QUALITY.
+   *                If use this value, It can expect better latency performance
+   *                than #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_VIDEO_QUALITY.
+   *                The mode support seamless resolution change.
+   *                The mode use lower video quality.
+   */
+  ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE =
+      ESPLUSPLAYER_LOW_LATENCY_MODE_AUDIO |
+      ESPLUSPLAYER_LOW_LATENCY_MODE_VIDEO | 0x2000,
+  /**
+   * @description   to set game mode for latency
+   *                Video stream should be composed only of P and I frames.
+   *                Video stream must use fixed resolution.
+   *                It must not be used together with
+   *                #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_VIDEO_QUALITY.
+   *                If use this value, It can expect better latency
+   *                performance than
+   *                #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_VIDEO_QUALITY and
+   *                #ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE
+   *                The mode use lower video quality.
+   */
+  ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE_WITH_FIXED_RESOLUTION =
+      ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE | 0x4000,
+} esplusplayer_low_latency_mode;
+
+/**
+ * @brief   Enumerations for esplusplayer audio codec type
+ */
+typedef enum {
+  /**
+   * @description   hardware codec can only be selected, default type
+   */
+  ESPLUSPLAYER_AUDIO_CODEC_TYPE_HW,
+  /**
+   * @description   software codec can only be selected
+   */
+  ESPLUSPLAYER_AUDIO_CODEC_TYPE_SW,
+  ESPLUSPLAYER_AUDIO_CODEC_TYPE_MAX
+} esplusplayer_audio_codec_type;
+
+/**
+ * @brief   Enumerations for esplusplayer video codec type
+ */
+typedef enum {
+  /**
+   * @description   hardware codec can only be selected, default type
+   */
+  ESPLUSPLAYER_VIDEO_CODEC_TYPE_HW,
+  /**
+   * @description   software codec can only be selected
+   */
+  ESPLUSPLAYER_VIDEO_CODEC_TYPE_SW,
+  /**
+  * @description   hardware codec using n-decoding mode can only be selected.
+                   It must set display type to mixer type by display setting
+  api.
+                   esplusplayer_set_display()
+  */
+  ESPLUSPLAYER_VIDEO_CODEC_TYPE_HW_N_DECODING,
+  ESPLUSPLAYER_VIDEO_CODEC_TYPE_MAX
+
+} esplusplayer_video_codec_type;
+/**
+ * @brief   Enumerations for esplusplayer audio easing type
+ * @version 3.0
+ */
+typedef enum {
+  /**
+   * @description audio easing function type is linear
+   */
+  ESPLUSPLAYER_AUDIO_EASING_LINEAR,
+  /**
+   * @description audio easing function type is incubic
+   */
+  ESPLUSPLAYER_AUDIO_EASING_INCUBIC,
+  /**
+   * @description audio easing function type is outcubic
+   */
+  ESPLUSPLAYER_AUDIO_EASING_OUTCUBIC,
+  /**
+   * @description audio easing function type is none
+   */
+  ESPLUSPLAYER_AUDIO_EASING_NONE
+} esplusplayer_audio_easing_type;
+
+/**
+ * @brief   Enumerations for esplusplayer resource type
+ * @version 3.0
+ */
+typedef enum {
+  /**
+   * @description video renderer type
+   */
+  ESPLUSPLAYER_RSC_TYPE_VIDEO_RENDERER
+} esplusplayer_rsc_type;
+
+/**
+ * @brief   Enumerations for advanced video quality type
+ * @version 3.1
+ */
+typedef enum {
+  /**
+   * @description advanced picture quality for video call
+   */
+  ESPLUSPLAYER_ADVANCED_PICTURE_QUALITY_VIDEO_CALL,
+  /**
+   * @description advanced picture quality for usb camera
+   */
+  ESPLUSPLAYER_ADVANCED_PICTURE_QUALITY_USB_CAMERA
+} esplusplayer_advanced_picture_quality_type;
+
+typedef struct {
+  /**
+   * @description   the minimum frame number in case of mid latency
+   */
+  int mid_latency_threshold;
+  /**
+   * @description   the minimum frame number in case of high latency
+   */
+  int high_latency_threshold;
+} esplusplayer_latency_threshold;
+
+/**
+ * @brief  rational number numerator/denominator
+ */
+typedef struct {
+  /**
+   * @description   the numerator value
+   */
+  int num;
+  /**
+   * @description   the denominator value
+   */
+  int den;
+} esplusplayer_rational;
+
+/**
+ * @brief  resource allocate policy
+ */
+typedef enum {
+  /**
+   * @description exclusive policy, RM will return the requested resources,
+   * default policy
+   */
+  ESPLUSPLAYER_RSC_ALLOC_EXCLUSIVE = 0,
+  /**
+   * @description conditional policy, when trying to allocate resources and
+   * available resources are not left, RM will return fail.
+   */
+  ESPLUSPLAYER_RSC_ALLOC_EXCLUSIVE_CONDITIONAL
+} esplusplayer_rsc_alloc_policy;
+
+/**
+ * @brief Enumerations for the status of getting decoded video frame
+ * @version 4.0
+ */
+typedef enum {
+  /** @brief successfully decoded video frame acquired. */
+  ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_SUCCESS,
+  /** @brief  it means app has to return the video before getting decoded
+   * video frame frame.
+   */
+  ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_NO_REMAINING_BUFFER,
+  /**
+   * @brief  there is no filled video frame yet.
+   */
+  ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_NO_FILLED_BUFFER,
+  /**
+   * @brief  internal error
+   */
+  ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_UNKNOWN
+} esplusplayer_get_decoded_video_frame_status_type;
+
+/**
+ * @brief     Create a esplusplayer handle.
+ * @param     None
+ * @return    return esplusplayer handle pointer.
+ * @code
+ *            esplusplayer_handle esplayer = esplusplayer_create();
+ *            // ... your codes ...
+ *            esplusplayer_destroy(esplayer);
+ * @endcode
+ * @pre       None
+ * @post      The player state will be #ESPLUSPLAYER_STATE_NONE.
+ * @exception None
+ */
+esplusplayer_handle esplusplayer_create();
+
+/**
+ * @brief     Open esplusplayer handle.
+ * @param     [in] handle : esplusplayer handle
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            esplusplayer_handle esplayer = esplusplayer_create();
+ *            esplusplayer_open(esplayer);
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ *            esplusplayer_destroy(esplayer);
+ * @endcode
+ * @pre       The player state must be #ESPLUSPLAYER_STATE_NONE.
+ * @post      The player state will be #ESPLUSPLAYER_STATE_IDLE.
+ * @exception None
+ * @see       esplusplayer_close()
+ */
+int esplusplayer_open(esplusplayer_handle handle);
+
+/**
+ * @brief     Release all the player resources and all setting except callback
+ *            functions.
+ * @param     [in] handle : esplusplayer handle.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @pre       The player state must be all of #esplusplayer_state except
+ *            #ESPLUSPLAYER_STATE_NONE.
+ * @post      The player state will be #ESPLUSPLAYER_STATE_NONE.
+ * @exception None
+ * @see       esplusplayer_open()
+ */
+int esplusplayer_close(esplusplayer_handle handle);
+
+/**
+ * @brief     Release player handle.
+ * @param     [in] handle : esplusplayer handle.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            refer to the sample code of esplusplayer_create()
+ * @endcode
+ * @pre       The player state must be #ESPLUSPLAYER_STATE_NONE
+ * @post      player handle will be removed.
+ * @exception None
+ * @see       esplusplayer_create()
+ */
+int esplusplayer_destroy(esplusplayer_handle handle);
+
+/**
+ * @brief     Flush the specific buffered stream data and release TV resource
+ *            to change stream.
+ * @remark    To activate, the stream must be set again.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] type : stream type which user want to deactivate.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+              refer to the sample code of esplusplayer_activate()
+ * @endcode
+ * @pre       The player state must be at least #ESPLUSPLAYER_STATE_READY
+ * @post      The player state is same as before calling
+ *            esplusplayer_deactivate(). The deactivated stream will stop
+ *            rendering and release the decoder, renderer resources.
+ * @exception None
+ * @see       esplusplayer_activate
+ */
+int esplusplayer_deactivate(esplusplayer_handle handle,
+                            esplusplayer_stream_type type);
+
+/**
+ * @brief     Reprepare for the specific stream playback.
+ * @remark    There must be active stream to prepare playback.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] type : stream type which user want to activate.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            prepare esplayer done
+ *            // ... your codes ...
+ *            esplusplayer_deactivate(esplayer, ESPLUSPLAYER_STREAM_TYPE_VIDEO);
+ *            esplusplayer_video_stream_info stream;
+ *            stream.width = 640;
+ *            stream.height = 352;
+ *            stream.mime_type = ESPLUSPLAYER_VIDEO_MIME_TYPE_H264;
+ *            stream.framerate_num = 30;
+ *            stream.framerate_den = 1;
+ *            esplusplayer_set_video_stream_info(esplayer, &stream);
+ *            esplusplayer_activate(esplayer, ESPLUSPLAYER_STREAM_TYPE_VIDEO);
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ *            esplusplayer_destroy(esplayer);
+ * @endcode
+ * @pre       The player state must be at least #ESPLUSPLAYER_STATE_READY
+ * @post      The player state is same as before calling
+ *            esplusplayer_activate(). Rebuild pipeline to render the stream.
+ * @exception None
+ * @see       esplusplayer_prepare_async()
+ */
+int esplusplayer_activate(esplusplayer_handle handle,
+                          esplusplayer_stream_type type);
+
+/**
+ * @brief     Prepare the player for playback, asynchronously.
+ * @param     [in] handle : esplusplayer handle.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            static void OnPrepareDone(bool ret, void* userdata) {
+ *                //Something you want to do when prepare done, but, we strongly
+ *                //recommend DO NOT CALL PLAYER APIs in this callback
+ *                printf("OnPrepareDone\n");
+ *            }
+ *            esplusplayer_handle esplayer = esplusplayer_create();
+ *            esplusplayer_set_prepare_async_done_cb(esplayer, OnPrepareDone,nullptr);
+ *            esplusplayer_open(esplayer);
+ *            esplusplayer_prepare_async(esplayer);
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ *            esplusplayer_destroy(esplayer);
+ * @endcode
+ * @pre       The player state must be #ESPLUSPLAYER_STATE_IDLE. \n
+ *            Call at least one of esplusplayer_set_video_stream_info() or
+ *            esplusplayer_set_audio_stream_info(). \n
+ * @post      It invokes esplusplayer_prepare_async_done_cb() when prepare is
+ *            finished. \n
+ *            Prepare result can be succeeded or not at this moment. \n
+ *            If the result is succeeded, the player state will be
+ *            #ESPLUSPLAYER_STATE_READY and one frame will be displayed
+ *            unless esplusplayer_set_display_visible() is set to @c false.
+ * @exception None
+ * @remark    esplusplayer_prepare_async_done_cb() can be invoked only when as
+ *            many es packets as at least one decoded frame is submitted. \n
+ *            The player can receive es packets after
+ *            esplusplayer_ready_to_seek_cb() is called.
+ * @see       esplusplayer_open() \n
+ *            esplusplayer_stop() \n
+ *            esplusplayer_submit_packet() \n
+ *            esplusplayer_ready_to_prepare_cb() \n
+ *            esplusplayer_close()
+ */
+int esplusplayer_prepare_async(esplusplayer_handle handle);
+
+/**
+ * @brief     Start playback.
+ * @param     [in] handle : esplusplayer handle.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            prepare esplayer done
+ *            esplusplayer_start(esplayer);
+ *            // ... your codes ...
+ *            esplusplayer_stop(esplayer);
+ * @endcode
+ * @pre       The player state should be #ESPLUSPLAYER_STATE_READY.
+ * @post      The player state will be #ESPLUSPLAYER_STATE_PLAYING.
+ * @exception None
+ * @see       esplusplayer_open() \n
+ *            esplusplayer_prepare_async() \n
+ *            esplusplayer_stop() \n
+ *            esplusplayer_close()
+ */
+int esplusplayer_start(esplusplayer_handle handle);
+
+/**
+ * @brief     Stop playing media content.
+ * @param     [in] handle : esplusplayer handle.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            prepare esplayer done
+ *            // ... your codes ...
+ *            esplusplayer_stop(esplayer);
+ *             // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ * @endcode
+ * @pre       The player state must be all of #esplusplayer_state except
+ *            #ESPLUSPLAYER_STATE_NONE.
+ * @post      The player state will be #ESPLUSPLAYER_STATE_IDLE.
+ * @exception None
+ * @remark    esplusplayer_close() must be called once after player is stopped
+ * @see       esplusplayer_open() \n
+ *            esplusplayer_prepare_async() \n
+ *            esplusplayer_start() \n
+ *            esplusplayer_pause() \n
+ *            esplusplayer_resume() \n
+ *            esplusplayer_close()
+ */
+int esplusplayer_stop(esplusplayer_handle handle);
+
+/**
+ * @brief     Pause playing media content.
+ * @param     [in] handle : esplusplayer handle.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            prepare esplayer done
+ *            // ... your codes ...
+ *            esplusplayer_pause(esplayer);
+ *            // ... your codes ...
+ *            esplusplayer_stop(esplayer);
+ * @endcode
+ * @pre       The player state must be one of #ESPLUSPLAYER_STATE_READY or
+ *            #ESPLUSPLAYER_STATE_PAUSED or #ESPLUSPLAYER_STATE_PLAYING.
+ * @post      The player state will be #ESPLUSPLAYER_STATE_PAUSE.
+ * @exception None
+ * @see       esplusplayer_start() \n
+ *            esplusplayer_resume() \n
+ *            esplusplayer_prepare_async()
+ */
+int esplusplayer_pause(esplusplayer_handle handle);
+
+/**
+ * @brief     Resume playing media content.
+ * @param     [in] handle : esplusplayer handle.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            prepare esplayer done
+ *            // ... your codes ...
+ *            esplusplayer_pause(esplayer);
+ *            // ... your codes ...
+ *            esplusplayer_resume(esplayer);
+ *            // ... your codes ...
+ *            esplusplayer_stop(esplayer);
+ * @endcode
+ * @pre       The player state must be one of #ESPLUSPLAYER_STATE_PAUSED or
+ *            #ESPLUSPLAYER_STATE_PLAYING.
+ * @post      The player state will be #ESPLUSPLAYER_STATE_PLAYING.
+ * @exception None
+ * @see       esplusplayer_start() \n
+ *            esplusplayer_pause() \n
+ *            esplusplayer_prepare_async()
+ */
+int esplusplayer_resume(esplusplayer_handle handle);
+
+/**
+ * @brief     Set playback rate.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] playback_rate :  the playback rate from 0.0 to 2.0.
+ * @param     [in] audio_mute :  the audio is mute on/off, true: mute on, false:
+ * mute off.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            prepare esplayer done
+ *            // ... your codes ...
+ *            esplusplayer_set_playback_rate(esplayer,2,true);
+ *            // ... your codes ...
+ *            esplusplayer_stop(esplayer);
+ * @endcode
+ * @pre       The player state must be one of #ESPLUSPLAYER_STATE_READY or
+ *            #ESPLUSPLAYER_STATE_PAUSED or #ESPLUSPLAYER_STATE_PLAYING. \n
+ *            User has to push the data as fast as playback rate.
+ * @post      None
+ * @exception None
+ * @see       esplusplayer_prepare_async()
+ */
+int esplusplayer_set_playback_rate(esplusplayer_handle handle,
+                                   const double playback_rate,
+                                   const bool audio_mute);
+
+/**
+ * @brief     Seek for playback, asynchronously.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] time_ms : seek time in milliseconds
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            prepare esplayer done
+ *            // ... your codes ...
+ *            const uint64_t ms_to_seek = 0;
+ *            esplusplayer_seek(esplayer,ms_to_seek);
+ *            // ... your codes ...
+ *            esplusplayer_stop(esplayer);
+ * @endcode
+ * @pre       The player state must be one of #ESPLUSPLAYER_STATE_READY or
+ *            #ESPLUSPLAYER_STATE_PAUSED or #ESPLUSPLAYER_STATE_PLAYING.
+ *            In ESPLUSPLAYER_STATE_IDLE, this api can be called exceptionally
+ *            between esplusplayer_open() and esplusplayer_prepare_async().
+ *            the start time of playback can be set explicitly when starting
+ *            first playback. In this case, esplusplayer_set_seek_done_cb is not
+ *            called.
+ * @post      None
+ * @exception None
+ * @remark    esplusplayer_set_seek_done_cb() will be invoked if seek operation
+ *            is finished. \n
+ *            Seek result can be succeeded or not at this moment. \n
+ *            esplusplayer_set_seek_done_cb() can be invoked only when as many
+ *            es packets as at least one decoded frame is submitted. \n
+ *            The player can receive es packets from seek time after
+ *            esplusplayer_ready_to_seek_cb() is invoked.
+ * @see       esplusplayer_ready_to_seek_cb() \n
+ *            esplusplayer_prepare_async()
+ */
+int esplusplayer_seek(esplusplayer_handle handle, uint64_t time_ms);
+
+/**
+ * @brief     Set the video display.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] type : display type.
+ * @param     [in] window : the handle to display window.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            esplusplayer_open(esplayer);
+ *            esplusplayer_set_display(esplayer,ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,window);
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ * @endcode
+ * @pre       The player state must be #ESPLUSPLAYER_STATE_IDLE.
+ * @post      None
+ * @exception None
+ * @remark    Esplusplayer is not supporting changing display. \n
+ *            This API have to be called before calling
+ *            esplusplayer_prepare_async() to reflect the display type.
+ * @see       esplusplayer_open() \n
+ *            esplusplayer_set_display_mode() \n
+ *            esplusplayer_set_display_roi() \n
+ *            esplusplayer_set_display_visible()
+ */
+int esplusplayer_set_display(esplusplayer_handle handle,
+                             esplusplayer_display_type type, void* window);
+
+#ifdef TIZEN_FEATURE_TV
+/**
+ * @brief     Set the video display.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] type : display type.
+ * @param     [in] subsurface : the ecore wayland subsurface handle.
+ * @param     [in] x : the x coordinate of subsurface.
+ * @param     [in] y : the y coordinate of subsurface.
+ * @param     [in] width : the width of subsurface.
+ * @param     [in] height : the height of subsurface.
+ * @return    @c one of esplusplayer_error_type values will be returned.
+ * @pre       The player state must be #ESPLUSPLAYER_STATE_IDLE.
+ * @post      None
+ * @exception   None
+ * @version   3.1
+ * @see       esplusplayer_set_display_mode() \n
+ *            esplusplayer_set_display_roi() \n
+ *            esplusplayer_set_display_visible()
+ */
+int esplusplayer_set_display_ecore_subsurface(esplusplayer_handle handle,
+                                              esplusplayer_display_type type,
+                                              void* subsurface, int x, int y,
+                                              int width, int height);
+#endif
+
+/**
+ * @brief     Set the video display mode.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] mode : display mode.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            esplusplayer_open(esplayer);
+ *            esplusplayer_set_display_mode(esplayer,ESPLUSPLAYER_DISPLAY_MODE_DST_ROI);
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ * @endcode
+ * @pre       The player state can be all of #esplusplayer_state except
+ *            #ESPLUSPLAYER_STATE_NONE.
+ * @post      None
+ * @exception None
+ * @remark    If no display is set, no operation is performed.
+ * @see       esplusplayer_open() \n
+ *            esplusplayer_set_display_mode() \n
+ *            esplusplayer_set_display_roi() \n
+ *            esplusplayer_set_display_visible()
+ */
+int esplusplayer_set_display_mode(esplusplayer_handle handle,
+                                  esplusplayer_display_mode mode);
+
+/**
+ * @brief     Set the ROI(Region Of Interest) area of display.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] x : var startPointX in src video area.
+ * @param     [in] y : var startPointY in src video area.
+ * @param     [in] width : width of display in src video area.
+ * @param     [in] height : height of display in src video area.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            esplusplayer_open(esplayer);
+ *            esplusplayer_set_display(esplayer,ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,window);
+ *            esplusplayer_set_display_mode(esplayer,ESPLUSPLAYER_DISPLAY_MODE_DST_ROI);
+ *            esplusplayer_set_display_roi(esplayer,0,0,600,500);
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ * @endcode
+ * @pre       The player state can be all of #esplusplayer_state except
+ *            #ESPLUSPLAYER_STATE_NONE. \n
+ *            Before set display ROI, #ESPLUSPLAYER_DISPLAY_MODE_DST_ROI
+ *            must be set with esplusplayer_set_display_mode().
+ * @post      None
+ * @exception None
+ * @remark    The minimum value of width and height are 1.
+ * @see       esplusplayer_open() \n
+ *            esplusplayer_set_display() \n
+ *            esplusplayer_set_display_mode() \n
+ *            esplusplayer_set_display_visible()
+ */
+int esplusplayer_set_display_roi(esplusplayer_handle handle, int x, int y,
+                                 int width, int height);
+
+/**
+ * @brief     Set the Crop Area(Region Of Src ratio) area of display.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] scale_x: x label ratio in src video area.
+ * @param     [in] scale_y: y label ratio in src video area.
+ * @param     [in] scale_w: width ratio in src video area.
+ * @param     [in] scale_h: height ratio in src video area.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            esplusplayer_open(esplayer);
+ *            esplusplayer_set_display(esplayer,ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,window);
+ *            esplusplayer_set_video_roi(esplayer,0,0,0.5,0.5);
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ * @endcode
+ * @pre       The player state can be all of #esplusplayer_state except
+ *            #ESPLUSPLAYER_STATE_NONE. \n
+ * @post      None
+ * @exception None
+ * @remark    The minimum value of input are 0,maximum value is 1.
+ * @see       esplusplayer_open() \n
+ *            esplusplayer_set_display() \n
+ *            esplusplayer_set_display_visible()
+ */
+int esplusplayer_set_video_roi(esplusplayer_handle handle, double scale_x,
+                               double scale_y, double scale_w, double scale_h);
+
+/**
+ * @brief     Set the visibility of the video display.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] visible : the visibility of the display.
+ *            (@c true = visible, @c false = non-visible)
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            esplusplayer_open(esplayer);
+ *            esplusplayer_set_display(esplayer,ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,window);
+ *            esplusplayer_set_display_visible(esplayer,false);
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ * @endcode
+ * @pre       The player state can be all of #esplusplayer_state except
+ *            #ESPLUSPLAYER_STATE_NONE.
+ * @post      None
+ * @exception   None
+ * @see       esplusplayer_open() \n
+ *            esplusplayer_set_display()
+ */
+int esplusplayer_set_display_visible(esplusplayer_handle handle, bool visible);
+
+/**
+ * @brief     Set the rotate angle of the video display.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] rotation : the rotate angle of the display.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            esplusplayer_open(esplayer);
+ *            esplusplayer_set_display(esplayer,ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,window);
+ *            esplusplayer_set_display_rotation(esplayer_,ESPLUSPLAYER_DISPLAY_ROTATION_TYPE_90);
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ * @endcode
+ * @pre       The player state can be all of #esplusplayer_state except
+ *            #ESPLUSPLAYER_STATE_NONE.
+ * @post      this API worked only when video sink created.
+ * @exception None
+ * @see       esplusplayer_open() \n
+ *            esplusplayer_set_display()
+ */
+int esplusplayer_set_display_rotation(
+    esplusplayer_handle handle, esplusplayer_display_rotation_type rotation);
+
+/**
+ * @brief     Get the rotate angle of the video display.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [out] rotation : the rotate angle of the display which want to
+ * get.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            esplusplayer_open(esplayer);
+ *            esplusplayer_set_display_rotation(esplayer,ESPLUSPLAYER_DISPLAY_ROTATION_TYPE_90);
+ *            esplusplayer_display_rotation_type rotation_get = ESPLUSPLAYER_DISPLAY_ROTATION_TYPE_NONE;
+ *            // ... your codes ...
+ *            esplusplayer_get_display_rotation(esplayer,&rotation_get);
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ * @endcode
+ * @pre       The player state can be all of #esplusplayer_state except
+ *            #ESPLUSPLAYER_STATE_NONE.
+ * @post      this API worked only when video sink created.
+ * @exception None
+ * @see       esplusplayer_open() \n
+ *            esplusplayer_set_display_rotation()
+ */
+int esplusplayer_get_display_rotation(
+    esplusplayer_handle handle, esplusplayer_display_rotation_type* rotation);
+
+/**
+ * @brief     Set whether to send decrypted es packets in the trust zone or
+ *            encrypted es packets.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] type : whether to use trust zone memory or encrypted data
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            esplusplayer_open(esplayer);
+ *            esplusplayer_set_submit_data_type(esplayer,ESPLUSPLAYER_SUBMIT_DATA_TYPE_CLEAN_DATA);
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_IDLE.
+ * @post      None
+ * @exception None
+ * @remark    This API have to be called before calling
+ *            esplusplayer_prepare_async(). \n
+ *            If type is ESPLUSPLAYER_SUBMIT_DATA_TYPE_CLEAN_DATA use
+ *            esplusplayer_submit_packet() to send clean packets. \n
+ *            If type is ESPLUSPLAYER_SUBMIT_DATA_TYPE_ENCRYPTED_DATA, use
+ *            esplusplayer_submit_encrypted_packet() to send encrypted packets.
+ * @see       esplusplayer_open() \n
+ *            esplusplayer_submit_encrypted_packet() \n
+ *            esplusplayer_submit_data_type
+ */
+int esplusplayer_set_submit_data_type(esplusplayer_handle handle,
+                                      esplusplayer_submit_data_type type);
+
+/**
+ * @brief     Set on mute of the audio sound.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] mute : on mute of the sound.
+ *            (@c true = mute, @c false = non-mute)
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success, otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            esplusplayer_open(esplayer);
+ *            esplusplayer_set_audio_mute(esplayer, true);
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ * @endcode
+ * @pre       The player state can be all of #esplusplayer_state except
+ *            #ESPLUSPLAYER_STATE_NONE.
+ * @post      None
+ * @exception None
+ * @see       esplusplayer_open()
+ */
+int esplusplayer_set_audio_mute(esplusplayer_handle handle, bool mute);
+
+/**
+ * @brief     Get current state of player.
+ * @param     [in] handle : esplusplayer handle.
+ * @return    current #esplusplayer_state of player.
+ * @code
+ *            esplusplayer_handle esplayer = esplusplayer_create();
+ *            // ... your codes ...
+ *            esplusplayer_state ret = esplusplayer_get_state(esplayer);
+ *            // ... your codes ...
+ *            esplusplayer_destroy(esplayer);
+ * @endcode
+ * @pre       None
+ * @post      None
+ * @exception None
+ */
+esplusplayer_state esplusplayer_get_state(esplusplayer_handle handle);
+
+/**
+ * @brief     Submit es packet to decode audio or video.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] packet : es packet pointer.
+ * @return    @c ESPLUSPLAYER_SUBMIT_STATUS_SUCCESS : succeed to submit es
+ *            packet,
+ *            otherwise @c : fail to submit es packet.
+ * @code
+ *            static void OnPrepareDone(bool ret, void* userdata) {
+ *                // ... your codes ...
+ *                printf ("OnPrepareDone\n");
+ *            }
+ *            static void OnReadyToPrepare(const esplusplayer_stream_type type,void* userdata) {
+ *                if (type == ESPLUSPLAYER_STREAM_TYPE_VIDEO) {
+ *                    //Something you want to do when feed es video stream is allowed
+ *                } else {
+ *                    //Something you want to do when feed es audio stream is allowed
+ *                }
+ *                //Something you want to do when OnReadyToPrepare
+ *                printf ("OnReadyToPrepare\n");
+ *            }
+ *            static void OnBufferByteStatus(const esplusplayer_stream_type type,
+ *                                           const esplusplayer_buffer_status status,
+ *                                           uint64_t byte_size, void* userdata) {
+ *                if (type == ESPLUSPLAYER_STREAM_TYPE_VIDEO) {
+ *                    if (status == ESPLUSPLAYER_BUFFER_STATUS_UNDERRUN) {
+ *                        //Something you want to do when es video buffer is enough
+ *                    } else {
+ *                        //Something you want to do when es video buffer is not enough
+ *                    }
+ *                } else {
+ *                    if (status == ESPLUSPLAYER_BUFFER_STATUS_UNDERRUN) {
+ *                        //Something you want to do when es audio buffer is enough
+ *                    } else {
+ *                        //Something you want to do when es audio buffer is not enough
+ *                    }
+ *                }
+ *                //Something you want to do when OnBufferByteStatus
+ *                printf ("OnBufferByteStatus\n");
+ *            }
+ *            static void OnBufferTimeStatus(const esplusplayer_stream_type type,
+ *                                           const esplusplayer_buffer_status status,
+ *                                           uint64_t time_size,void* userdata) {
+ *                if (type == ESPLUSPLAYER_STREAM_TYPE_VIDEO) {
+ *                    if (status == ESPLUSPLAYER_BUFFER_STATUS_UNDERRUN) {
+ *                        //Something you want to do when es video buffer is enough
+ *                    } else {
+ *                        //Something you want to do when es video buffer is not enough
+ *                    }
+ *                } else {
+ *                    if (status == ESPLUSPLAYER_BUFFER_STATUS_UNDERRUN) {
+ *                        //Something you want to do when es audio buffer is enough
+ *                    } else {
+ *                        //Something you want to do when es audio buffer is not enough
+ *                    }
+ *                }
+ *                //Something you want to do when OnBufferTimeStatus
+ *                printf ("OnBufferTimeStatus\n");
+ *            }
+ *            void FeedEsPacket(esplusplayer_handle player,esplusplayer_es_packet pkt) {
+ *               // ... your codes ...
+ *              if(feed is allowed && buffer is enough) {
+ *                   esplusplayer_submit_packet(player, &pkt);
+ *               }
+ *               // ... your codes ...
+ *           )
+ *            esplusplayer_handle esplayer = esplusplayer_create();
+ *            esplusplayer_set_prepare_async_done_cb(esplayer,OnPrepareDone,&esplayer);
+ *            esplusplayer_set_ready_to_prepare_cb(esplayer,OnReadyToPrepare,&esplayer);
+ *            esplusplayer_set_buffer_byte_status_cb(esplayer,OnBufferByteStatus,&esplayer);
+ *            esplusplayer_set_buffer_time_status_cb(esplayer,OnBufferTimeStatus,&esplayer);
+ *            esplusplayer_open(esplayer);
+ *            esplusplayer_prepare_async(esplayer);
+ *            // ... your codes ...
+ *            //FeedEsPacket()(call a new thread to do this)
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ *            esplusplayer_destroy(esplayer);
+ * @endcode
+ * @pre       User can submit es packets after
+ *            esplusplayer_ready_to_prepare_cb() or
+ *            esplusplayer_ready_to_seek_cb() is called.
+ * @post      None
+ * @exception None
+ * @remark    Amount of packets for at least one decoded frame must be submitted
+ *            after calling esplusplayer_prepare_async() or esplusplayer_seek()
+ *            for invoking esplusplayer_prepare_async_done_cb() or
+ *            esplusplayer_seek_done_cb() \n
+ *            This api must be called from a different thread than other apis.
+ * @see       esplusplayer_set_submit_data_type() \n
+ *            esplusplayer_es_packet \n
+ *            esplusplayer_buffer_status_cb() \n
+ *            esplusplayer_ready_to_prepare_cb() \n
+ *            esplusplayer_ready_to_seek_cb()
+ */
+esplusplayer_submit_status esplusplayer_submit_packet(
+    esplusplayer_handle handle, esplusplayer_es_packet* packet);
+
+#ifdef TIZEN_FEATURE_TV
+/**
+ * @brief     Submit encrypted es packet to decode and decrypt audio or video.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] packet : es packet pointer.
+ * @param     [in] drm_info : information to decrypt es packet.
+ *                            esplusplayer doesn't take ownership. user should
+ *                            free it. if you deliver it as (null), this api
+ *                            works as esplusplayer_submit_packet().
+ * @return    @c ESPLUSPLAYER_SUBMIT_STATUS_SUCCESS : succeed to submit es
+ *            packet,
+ *            otherwise @c : fail to submit es packet.
+ * @code
+ *            refer to the sample code of esplusplayer_submit_packet();
+ * @endcode
+ * @pre       User can submit es packets after
+ *            esplusplayer_ready_to_prepare_cb() or
+ *            esplusplayer_ready_to_seek_cb() is called.
+ * @post      None
+ * @exception None
+ * @remark    Amount of packets for at least one decoded frame must be submitted
+ *            after calling esplusplayer_prepare_async() or esplusplayer_seek()
+ *            for invoking esplusplayer_prepare_async_done_cb() or
+ *            esplusplayer_seek_done_cb(). \n
+ *            To use this api, Must set
+ * ESPLUSPLAYER_SUBMIT_DATA_TYPE_ENCRYPTED_DATA using
+ * esplusplayer_set_submit_data_type() \n This api must be called from a
+ * different thread than other apis.
+ * @see       esplusplayer_es_packet \n
+ *            esplusplayer_drm_info \n
+ *            esplusplayer_buffer_status_cb() \n
+ *            esplusplayer_ready_to_prepare_cb() \n
+ *            esplusplayer_ready_to_seek_cb() \n
+ *            esplusplayer_submit_packet()
+ */
+esplusplayer_submit_status esplusplayer_submit_encrypted_packet(
+    esplusplayer_handle handle, esplusplayer_es_packet* packet,
+    esplusplayer_drm_info* drm_info);
+#endif
+
+/**
+ * @brief     Generate EOS(End Of Stream) packet explicitly and submit it to the
+ *            player.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] type : stream type which reaches eos.
+ * @return    @c ESPLUSPLAYER_SUBMIT_STATUS_SUCCESS : succeed to submit EOS
+ * packet,
+ *            otherwise @c : fail to submit EOS packet.
+ * @code
+ *            esplusplayer_handle esplayer = esplusplayer_create();
+ *            // ... your codes ...
+ *            esplusplayer_submit_eos_packet(esplayer,ESPLUSPLAYER_STREAM_TYPE_VIDEO);
+ *            // ... your codes ...
+ * @endcode
+ * @pre       None
+ * @post      None
+ * @exception None
+ */
+esplusplayer_submit_status esplusplayer_submit_eos_packet(
+    esplusplayer_handle handle, esplusplayer_stream_type type);
+
+/**
+ * @brief     Set audio stream to have contents information.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] stream : audio stream pointer.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            esplusplayer_open(esplayer);
+ *            esplusplayer_audio_stream_info audio_stream;
+ *            audio_stream.codec_data = nullptr;
+ *            audio_stream.codec_data_length = 0;
+ *            esplusplayer_set_audio_stream_info(esplayer, &audio_stream);
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_IDLE except
+ *            audio stream is deactivated.
+ * @post      None
+ * @exception None
+ * @remark    This API have to be called before calling the
+ *            esplusplayer_prepare_async().
+ * @see       esplusplayer_open() \n
+ *            esplusplayer_audio_stream_info
+ */
+int esplusplayer_set_audio_stream_info(esplusplayer_handle handle,
+                                       esplusplayer_audio_stream_info* stream);
+
+/**
+ * @brief     Set video stream to have contents information.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] stream : video stream pointer.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_IDLE except
+ *            video stream is deactivated.
+ * @post      None
+ * @exception None
+ * @remark    This API have to be called before calling the
+ *            esplusplayer_prepare_async().
+ * @see       esplusplayer_audio_stream_info
+ *            esplusplayer_activate
+ */
+int esplusplayer_set_video_stream_info(esplusplayer_handle handle,
+                                       esplusplayer_video_stream_info* stream);
+
+/**
+ * @brief     Get the current playing time of the associated media.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [out] ms : current playing time in milliseconds.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            prepare esplayer done
+ *            esplusplayer_start(esplayer);
+ *            // ... your codes ...
+ *            uint64_t cur_time = 0;
+ *            esplusplayer_get_playing_time(esplayer, &cur_time);
+ *            // ... your codes ...
+ *            esplusplayer_stop(esplayer);
+ * @endcode
+ * @pre       The player must be one of #ESPLUSPLAYER_STATE_PAUSE or
+ *            #ESPLUSPLAYER_STATE_PLAYING.
+ * @post      None
+ * @exception None
+ * @see       esplusplayer_prepare_async()
+ */
+int esplusplayer_get_playing_time(esplusplayer_handle handle, uint64_t* ms);
+
+/**
+ * @brief     Get dropped frame counts in videosink.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [out] padaptive_info : dropped frame counts.
+ * @param     [in] adaptive_type : type of adaptive info which APP want to get.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            prepare esplayer done
+ *            // ... your codes ...
+ *            uint64_t count = 0;
+ *            esplusplayer_get_adaptive_info(esplayer,
+ *                static_cast<void*>(&count),ESPLUSPLAYER_ADAPT_INFO_TYPE_DROPPED_FRAMES);
+ *            // ... your codes ...
+ *            esplusplayer_stop(esplayer);
+ * @endcode
+ * @pre       The player must be one of #ESPLUSPLAYER_STATE_READY,
+ *                   #ESPLUSPLAYER_STATE_PAUSE or #ESPLUSPLAYER_STATE_PLAYING.
+ * @post      None
+ * @exception None
+ * @see       esplusplayer_prepare_async()
+ */
+int esplusplayer_get_adaptive_info(
+    esplusplayer_handle handle, void* padaptive_info,
+    esplusplayer_adaptive_info_type adaptive_type);
+
+/**
+ * @brief     Set volume to player
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] volume : volume level(0 ~ 100).
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            esplusplayer_open(esplayer);
+ *            int vol = 80;
+ *            esplusplayer_set_volume(esplayer, vol)
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ * @endcode
+ * @pre       The player state must be not #ESPLUSPLAYER_STATE_NONE.
+ * @post      None
+ * @exception None
+ * @see       esplusplayer_open()
+ */
+int esplusplayer_set_volume(esplusplayer_handle handle, const int volume);
+
+/**
+ * @brief     Get volume from player
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [out] volume : volume ptr.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            esplusplayer_open(esplayer);
+ *            // ... your codes ...
+ *            int vol = 0;
+ *            esplusplayer_get_volume(esplayer, &vol)
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ * @endcode
+ * @pre       The player state must be not #ESPLUSPLAYER_STATE_NONE.
+ * @post      None
+ * @exception None
+ * @see       esplusplayer_open()
+ */
+int esplusplayer_get_volume(esplusplayer_handle handle, int* volume);
+
+/**
+ * @brief     Set decoded video frame buffer type.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] type : one of the video decoded buffer type to set .
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            esplusplayer_open(esplayer);
+ *            esplusplayer_set_video_frame_buffer_type(esplayer,
+ *                ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_NONE);
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_IDLE when type
+              is not equal to be
+ ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_SCALE
+              The player state must be not #ESPLUSPLAYER_STATE_NONE when
+              type is equal to be
+ ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_SCALE
+ * @post      None
+ * @exception None
+ * @remark    reference can't support sw codec type.
+ *            esplusplayer_set_media_packet_video_decoded_cb()
+ *            esplusplayer_set_video_codec_type()
+ *            when type is SCALE, the target scale resolution can be set by
+ *            esplusplayer_set_video_frame_buffer_scale_resolution()
+ * @see       esplusplayer_open()
+ */
+int esplusplayer_set_video_frame_buffer_type(
+    esplusplayer_handle handle,
+    esplusplayer_decoded_video_frame_buffer_type type);
+
+/**
+ * @brief     Flush buffers for a player.
+ * @param     [in] handle : esplusplayer handle ptr.
+ * @param     [in] type : choose which stream data need to be
+ *            flush,audio/video,if need flush all pipeline can call this API
+ * twice.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            prepare esplayer done
+ *            // ... your codes ...
+ *            esplusplayer_flush(esplayer, ESPLUSPLAYER_STREAM_TYPE_VIDEO);
+ *            // ... your codes ...
+ *            esplusplayer_stop(esplayer);
+ * @endcode
+ * @pre       The player state should greater than #ESPLUSPLAYER_STATE_IDLE
+ * @post      None
+ * @exception None
+ * @see       esplusplayer_prepare_async()
+ */
+int esplusplayer_flush(esplusplayer_handle handle,
+                       esplusplayer_stream_type type);
+
+/**
+ * @brief     Convert the esplusplayer error type to a string.
+ * @param     [in] type : esplusplayer error type
+ * @return    @c not nullptr  the converted error string otherwise @c failed to
+ *            convert the error.
+ * @code
+ *            // ... your codes ...
+ *            const char* error;
+ *            error = esplusplayer_get_error_string(ESPLUSPLAYER_ERROR_TYPE_NOT_SUPPORTED_FILE);
+ *            // ... your codes ...
+ * @endcode
+ * @pre       None
+ * @post      None
+ * @exception None
+ */
+const char* esplusplayer_get_error_string(esplusplayer_error_type type);
+
+/**
+ * @brief     Sets a callback function to be invoked when an error occurs.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] error_cb : the error callback function to register.
+ * @param     [in] userdata : userdata of esplusplayer_error_cb()
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            static void OnError(const esplusplayer_error_type err_code, void*
+ *                userdata) {
+ *                //Something you want to do when error occur
+ *                printf ("OnError\n");
+ *            }
+ *            esplusplayer_handle esplayer = esplusplayer_create();
+ *            esplusplayer_set_error_cb(esplayer, OnError, nullptr);
+ *            // ... your codes ...
+ *            esplusplayer_destroy(esplayer);
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
+ *            or #ESPLUSPLAYER_STATE_IDLE.
+ * @post      esplusplayer_error_cb() will be invoked.
+ * @exception None
+ * @remark    esplusplayer_error_cb()
+ *            if error_cb is set to null, esplusplayer_error_cb() will not be
+ *            invoked anymore.
+ */
+int esplusplayer_set_error_cb(esplusplayer_handle handle,
+                              esplusplayer_error_cb error_cb, void* userdata);
+
+/**
+ * @brief     Set a callback function to be invoked when buffer underrun or
+ *            overflow is occurred.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] buffer_status_cb : the buffer status callback function to
+ * register.
+ * @param     [in] userdata : userdata of esplusplayer_buffer_status_cb()
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            refer to the sample code of esplusplayer_set_error_cb();
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
+ *            or #ESPLUSPLAYER_STATE_IDLE.
+ * @post      esplusplayer_buffer_status_cb() will be invoked.
+ * @exception None
+ * @remark    esplusplayer_buffer_status_cb()
+ *            if buffer_status_cb is set to null,
+ *            esplusplayer_buffer_status_cb() will not be invoked anymore.
+ */
+int esplusplayer_set_buffer_status_cb(
+    esplusplayer_handle handle, esplusplayer_buffer_status_cb buffer_status_cb,
+    void* userdata);
+
+/**
+ * @brief     Set a callback function to be invoked when buffer underrun or
+ *            overflow is occurred and buffer size in byte will be passed.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] buffer_status_cb : the buffer byte status callback function
+ *            to register.
+ * @param     [in] userdata : userdata of esplusplayer_buffer_byte_status_cb()
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            refer to the sample code of esplusplayer_submit_packet();
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
+ *            or #ESPLUSPLAYER_STATE_IDLE.
+ * @post      esplusplayer_buffer_byte_status_cb() will be invoked.
+ * @exception None
+ * @remark    esplusplayer_buffer_byte_status_cb()
+ */
+int esplusplayer_set_buffer_byte_status_cb(
+    esplusplayer_handle handle,
+    esplusplayer_buffer_byte_status_cb buffer_status_cb, void* userdata);
+
+/**
+ * @brief     Set a callback function to be invoked when buffer underrun or
+ *            overflow is occurred and buffer size in time will be passed.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] buffer_status_cb : the buffer time status callback function
+ *            to register.
+ * @param     [in] userdata : userdata of esplusplayer_buffer_time_status_cb()
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+              refer to the sample code of esplusplayer_submit_packet();
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
+ *            or #ESPLUSPLAYER_STATE_IDLE.
+ * @post      esplusplayer_buffer_time_status_cb() will be invoked.
+ * @exception None
+ * @remark    esplusplayer_buffer_time_status_cb(),
+ *            esplusplayer_buffer_time_status_cb() will be invoked only
+ *            when the duration value of espacket is set.
+ *            if buffer_status_cb is set to null,
+ *            esplusplayer_buffer_time_status_cb() will not be invoked anymore.
+ */
+int esplusplayer_set_buffer_time_status_cb(
+    esplusplayer_handle handle,
+    esplusplayer_buffer_time_status_cb buffer_status_cb, void* userdata);
+
+/**
+ * @brief     Set buffer size with different option
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] option : the option of buffer size.
+ * @param     [in] size : size of selected buffer option.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            esplusplayer_open(esplayer);
+ *            esplusplayer_set_buffer_size(esplayer,ESPLUSPLAYER_BUFFER_AUDIO_MAX_BYTE_SIZE,10240)
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_IDLE.
+ * @post      None
+ * @exception None
+ * @remark    esplusplayer_buffer_option
+ * @see       esplusplayer_open()
+ */
+int esplusplayer_set_buffer_size(esplusplayer_handle handle,
+                                 esplusplayer_buffer_option option,
+                                 uint64_t size);
+/**
+ * @brief     Set a callback function to be invoked when resource confliction is
+ * occurred.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] resource_conflicted_cb : the resource conflicted callback
+ *            function to register.
+ * @param     [in] userdata : userdata of resource_conflicted_cb()
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            refer to the sample code of esplusplayer_set_error_cb();
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
+ *            or #ESPLUSPLAYER_STATE_IDLE.
+ * @post      esplusplayer_resource_conflicted_cb() will be invoked.
+ * @exception None
+ * @remark    esplusplayer_resource_conflicted_cb()
+ *            if resource_conflicted_cb is set to null,
+ *            esplusplayer_resource_conflicted_cb() will not be invoked
+ *            anymore.
+ */
+int esplusplayer_set_resource_conflicted_cb(
+    esplusplayer_handle handle,
+    esplusplayer_resource_conflicted_cb resource_conflicted_cb, void* userdata);
+
+/**
+ * @brief     Set a callback function to be invoked when player has reached the
+ *            end of stream.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] eos_cb : the eos callback function to register.
+ * @param     [in] userdata : userdata of esplusplayer_eos_cb()
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            refer to the sample code of esplusplayer_set_error_cb();
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
+ *            or #ESPLUSPLAYER_STATE_IDLE.
+ * @post      esplusplayer_eos_cb() will be invoked.
+ * @exception None
+ * @remark    esplusplayer_eos_cb()
+ *            if eos_cb is set to null, esplusplayer_eos_cb() will not be
+ *            invoked anymore.
+ */
+int esplusplayer_set_eos_cb(esplusplayer_handle handle,
+                            esplusplayer_eos_cb eos_cb, void* userdata);
+
+/**
+ * @brief     Set a callback function to be invoked when player is prepared to
+ *            receive es packets after calling esplusplayer_prepare_async().
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] ready_to_prepare_cb : the ready to prepare callback function
+ *            to register.
+ * @param     [in] userdata : userdata of ready_to_prepare_cb()
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            refer to the sample code of esplusplayer_submit_packet();
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
+ *            or #ESPLUSPLAYER_STATE_IDLE.
+ * @post      None
+ * @exception None
+ * @remark    esplusplayer_prepare_async()
+ *            if ready_to_prepare_cb is set to null,
+ *            esplusplayer_ready_to_prepare_cb() will not be invoked anymore.
+ */
+int esplusplayer_set_ready_to_prepare_cb(
+    esplusplayer_handle handle,
+    esplusplayer_ready_to_prepare_cb ready_to_prepare_cb, void* userdata);
+
+/**
+ * @brief     Set a callback function to be invoked when player is prepared to
+ *            be started.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] prepare_async_done_cb : the prepare async done callback
+ * function to register.
+ * @param     [in] userdata : userdata of prepare_async_done_cb()
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            refer to the sample code of plusplayer_prepare_async();
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
+ *            or #ESPLUSPLAYER_STATE_IDLE.
+ * @post      esplusplayer_prepare_async_done_cb() will be invoked.
+ * @exception It is prohibited to call any player APIs at
+ *            esplusplayer_prepare_async_done_cb callback.
+ * @remark    esplusplayer_prepare_async_done_cb()
+ *            if prepare_async_done_cb is set to null,
+ *            esplusplayer_prepare_async_done_cb() will not be
+ *            invoked anymore.
+ * @see       plusplayer_prepare_async
+ */
+int esplusplayer_set_prepare_async_done_cb(
+    esplusplayer_handle handle,
+    esplusplayer_prepare_async_done_cb prepare_async_done_cb, void* userdata);
+
+/**
+ * @brief     Set a callback function to be invoked when player is prepared to
+ *            be started.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] seek_done_cb : the seek done callback function to register.
+ * @param     [in] userdata : userdata of esplusplayer_seek_done_cb()
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            refer to the sample code of esplusplayer_set_error_cb();
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
+ *            or #ESPLUSPLAYER_STATE_IDLE.
+ * @post      esplusplayer_seek_done_cb() will be invoked.
+ *            if seek_done_cb is set to null, esplusplayer_seek_done_cb() will
+ *            not be invoked anymore.
+ * @exception None
+ */
+int esplusplayer_set_seek_done_cb(esplusplayer_handle handle,
+                                  esplusplayer_seek_done_cb seek_done_cb,
+                                  void* userdata);
+
+/**
+ * @brief     Set a callback function to be invoked when player is prepared to
+ *            receive es packets after flushing all submitted es packets for
+ *            seek.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] ready_to_seek_cb : the ready to seek callback function to
+ *            register.
+ * @param     [in] userdata : userdata of esplusplayer_ready_to_seek_cb()
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            refer to the sample code of esplusplayer_set_error_cb();
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
+ *            or #ESPLUSPLAYER_STATE_IDLE.
+ * @post      None
+ * @exception None
+ * @remark    esplusplayer_seek()
+ *            if ready_to_seek_cb is set to null, esplusplayer_ready_to_seek_cb()
+ *            will not be invoked anymore.
+ */
+int esplusplayer_set_ready_to_seek_cb(
+    esplusplayer_handle handle, esplusplayer_ready_to_seek_cb ready_to_seek_cb,
+    void* userdata);
+
+/**
+ * @brief     Set a callback function to be invoked when player decoded video
+ *            frame. A video frame can be retrieved using a registered callback.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] media_packet_video_decoded_cb : the media packet video
+ * decoded callback function to register.
+ * @param     [in] userdata : userdata of
+ * esplusplayer_set_media_packet_video_decoded_cb()
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            refer to the sample code of esplusplayer_set_error_cb();
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
+ *            or #ESPLUSPLAYER_STATE_IDLE.
+ * @post      None
+ * @exception None
+ * @remark    esplusplayer_set_video_frame_buffer_type()
+ *            if media_packet_video_decoded_cb is set to null,
+ *            esplusplayer_error_cb() will not be invoked anymore.
+ *            media packets have to be released by calling
+ *            esplusplayer_decoded_buffer_destroy().
+ * @see       esplusplayer_set_video_frame_buffer_scale_resolution
+ */
+int esplusplayer_set_media_packet_video_decoded_cb(
+    esplusplayer_handle handle,
+    esplusplayer_media_packet_video_decoded_cb media_packet_video_decoded_cb,
+    void* userdata);
+
+/**
+ * @brief     Set closed caption callback function.
+ * @description   In this function set closed caption callback to handle the
+ *            closed caption. If there is closed caption to display,
+ *            esplusplayer_closed_caption_cb will be called to notify there
+ *            is closed caption to display.
+ * @param     [in] handle : esplusplayer handle ptr.
+ * @param     [in] closed_caption_cb :  the closed caption callback  function to
+ * register.
+ * @param     [in] userdata : userdata of esplusplayer_closed_caption_cb
+ *            callback function.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            refer to the sample code of esplusplayer_set_error_cb();
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
+ *            or #ESPLUSPLAYER_STATE_IDLE.
+ * @post      When there is closed caption data, call
+ *            esplusplayer_closed_caption_cb to notify that there is closed
+ *            caption needed to be displayed.
+ * @exception None
+ * @remark    esplusplayer_closed_caption_cb \n
+ *            [in] data : closed caption data \n
+ *            [in] size : length of closed caption data \n
+ *            [in] userdata : userdata of esplusplayer_closed_caption_cb
+ *            callback function.
+ *            if closed_caption_cb is set to null, esplusplayer_closed_caption_cb()
+ *            will not be invoked anymore.
+ */
+int esplusplayer_set_closed_caption_cb(
+    esplusplayer_handle handle,
+    esplusplayer_closed_caption_cb closed_caption_cb, void* userdata);
+
+/**
+ * @brief     Set a callback function to be invoked when the flush operation is
+ *            done.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] flush_done_cb : the flush done callback function to register.
+ * @param     [in] userdata : userdata of esplusplayer_flush_done_cb()
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            refer to the sample code of esplusplayer_set_error_cb();
+ * @endcode
+ * @pre       This api should be called before esplusplayer_flush() is called
+ * @post      esplusplayer_flush_done_cb() will be invoked.
+ * @exception None
+ * @remark    called before esplusplayer_flush().
+ *            if flush_done_cb is set to null, esplusplayer_error_cb() will
+ *            not be invoked anymore.
+ */
+int esplusplayer_set_flush_done_cb(esplusplayer_handle handle,
+                                   esplusplayer_flush_done_cb flush_done_cb,
+                                   void* userdata);
+/**
+ * @brief     Set a callback function to be invoked when a specific event
+ *            occurs.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] event_cb : the callback function to register.
+ * @param     [in] userdata : userdata of esplusplayer_event_cb()
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            refer to the sample code of esplusplayer_set_error_cb();
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
+ *            or #ESPLUSPLAYER_STATE_IDLE.
+ * @post      esplusplayer_event_cb() will be invoked.
+ * @exception None
+ * @remark    esplusplayer_set_event_cb()
+ *            if event_cb is set to null, esplusplayer_event_cb() will not be
+ *            invoked anymore.
+ */
+int esplusplayer_set_event_cb(esplusplayer_handle handle,
+                              esplusplayer_event_cb event_cb, void* userdata);
+/**
+ * @brief     Provided api for destroying decoded buffer.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] packet : the decoded buffer.
+ * @return    @c one of esplusplayer_error_type values will be returned.
+ * @pre       The player state can be greater than #ESPLUSPLAYER_STATE_IDLE.
+ * @post      esplusplayer_decoded_buffer_destroy will be invoked for video
+ *            texturing
+ * @exception None
+ * @remark    esplusplayer_decoded_buffer_destroy().
+ */
+int esplusplayer_decoded_buffer_destroy(
+    esplusplayer_handle handle, esplusplayer_decoded_video_packet* packet);
+
+/**
+ * @brief     Provided api for setting low latency mode, multiple modes can be
+ *            set to duplicate.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] mode : one of the low latency mode to set.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            esplusplayer_open(esplayer);
+ *            esplusplayer_set_low_latency_mode(esplayer, ESPLUSPLAYER_LOW_LATENCY_MODE_NONE);
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_IDLE.
+ * @post      None
+ * @exception None
+ * @remark    Public supports #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_PREROLL only.
+ *            No operation is performed and #ESPLUSPLAYER_ERROR_TYPE_NONE will be returned,
+ *            if @a mode is not #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_PREROLL to make compatible with TV API.
+ * @see       esplusplayer_open()
+ */
+int esplusplayer_set_low_latency_mode(esplusplayer_handle handle,
+                                      esplusplayer_low_latency_mode mode);
+
+/**
+ * @brief     Provided api for setting unlimited max buffer mode, the player
+ *            does not limit es packet transmission although in buffer overrun
+ * status
+ * @param     [in] handle : esplusplayer handle.
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            esplusplayer_open(esplayer);
+ *            esplusplayer_set_unlimited_max_buffer_mode(esplayer);
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_IDLE.
+ * @post      None
+ * @exception None
+ * @remark    esplusplayer_set_unlimited_max_buffer_mode().
+ *            esplusplayer_buffer_status_cb() will be invoked in
+ *            overrun/underrun buffer status. but
+ *            esplusplayer_submit_packet() /
+ *            esplusplayer_submit_encrypted_packet()
+ *            does not return ESPLUSPLAYER_SUBMIT_STATUS_FULL
+ * @see       esplusplayer_open() \n
+ *            esplusplayer_submit_packet() \n
+ *            esplusplayer_submit_encrypted_packet()
+ */
+int esplusplayer_set_unlimited_max_buffer_mode(esplusplayer_handle handle);
+
+/**
+ * @brief     Provided api for setting audio codec type for playback.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] type : codec type(hardware/software).
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            esplusplayer_open(esplayer);
+ *            esplusplayer_set_audio_codec_type(esplayer,ESPLUSPLAYER_AUDIO_CODEC_TYPE_SW);
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_IDLE.
+              When the audio stream is not set or deactivated, it can be set
+              in #ESPLUSPLAYER_STATE_READY, #ESPLUSPLAYER_STATE_PAUSED and
+              #ESPLUSPLAYER_STATE_PLAYING. The set codec type will be
+              applied when esplusplayer_activate() is called.
+ * @post      None
+ * @exception None
+ * @see       esplusplayer_open() \n
+ *            esplusplayer_deactivate() \n
+              esplusplayer_activate() \n
+              esplusplayer_set_audio_stream_info()
+ */
+int esplusplayer_set_audio_codec_type(esplusplayer_handle handle,
+                                      esplusplayer_audio_codec_type type);
+/**
+ * @brief     Provided api for setting video codec type for playback.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] type : codec type(hardware/software).
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            esplusplayer_open(esplayer);
+ *            esplusplayer_set_video_codec_type(esplayer,ESPLUSPLAYER_VIDEO_CODEC_TYPE_SW);
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_IDLE.
+              When the video stream is not set or deactivated, it can be set
+              in #ESPLUSPLAYER_STATE_READY, #ESPLUSPLAYER_STATE_PAUSED and
+              #ESPLUSPLAYER_STATE_PLAYING. The set codec type will be
+              applied when esplusplayer_activate() is called.
+ * @post      None
+ * @exception None
+ * @see       esplusplayer_open() \n
+ *            esplusplayer_deactivate() \n
+              esplusplayer_activate() \n
+              esplusplayer_set_video_stream_info()
+ */
+int esplusplayer_set_video_codec_type(esplusplayer_handle handle,
+                                      esplusplayer_video_codec_type type);
+/**
+ * @brief     Provided api for setting render time offset
+ * @param     [in] handle : esplusplayer handle ptr.
+ * @param     [in] type : stream type
+ * @param     [in] offset : offset (in milliseconds).
+ *                          G_MININT64 <= offset * 1000000 <= G_MAXINT64
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            esplusplayer_open(esplayer);
+ *            esplusplayer_set_low_latency_mode(esplayer,ESPLUSPLAYER_LOW_LATENCY_MODE_NONE);
+ *            prepare esplayer
+ *            // ... your codes ...
+ *            int64_t set_offset = 10;
+ *            esplusplayer_set_render_time_offset(esplayer,ESPLUSPLAYER_STREAM_TYPE_VIDEO,
+ *                                                set_offset);
+ *            int64_t get_offset = 0;
+ *            esplusplayer_get_render_time_offset(esplayer_,ESPLUSPLAYER_STREAM_TYPE_VIDEO,
+ *                                                &get_offset);
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ * @endcode
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_READY,
+ *            #ESPLUSPLAYER_STATE_PAUSED or #ESPLUSPLAYER_STATE_PLAYING.
+ *            It have to be set to low latency mode. (all mode except
+ *            # ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_SYNC)
+ * @remark    esplusplayer_set_low_latency_mode().
+ * @post      None
+ * @exception None
+ * @see       esplusplayer_open()
+ *            esplusplayer_get_render_time_offset()
+ */
+int esplusplayer_set_render_time_offset(esplusplayer_handle handle,
+                                        esplusplayer_stream_type type,
+                                        int64_t offset);
+/**
+ * @brief     Provided api for getting render time offset
+ * @param     [in] handle : esplusplayer handle ptr.
+ * @param     [in] type : stream type
+ * @param     [in] offset : offset ptr (in milliseconds).
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @pre       The player state must be set to #ESPLUSPLAYER_STATE_READY,
+ *            #ESPLUSPLAYER_STATE_PAUSED or #ESPLUSPLAYER_STATE_PLAYING.
+ *            It have to be set to low latency mode.
+ * @remark    esplusplayer_set_low_latency_mode().
+ * @post      None
+ * @exception None
+ * see        esplusplayer_set_render_time_offset()
+ */
+int esplusplayer_get_render_time_offset(esplusplayer_handle handle,
+                                        esplusplayer_stream_type type,
+                                        int64_t* offset);
+/**
+ * @brief     Requests decoded video frame packet to acquire it. it works only
+ *            with #ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_MANUAL_COPY
+ *            mode
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [out] packet : the decoded buffer.
+ * @param     [out] status : (nullable) the result of video frame requested
+ * @pre       The player state must be one of #ESPLUSPLAYER_STATE_READY or
+ *            #ESPLUSPLAYER_STATE_PAUSED or #ESPLUSPLAYER_STATE_PLAYING.
+ * @post      None
+ * @return    #ESPLUSPLAYER_ERROR_TYPE_NONE on success, otherwise one of
+ *            esplusplayer_error_type values will be returned.
+ * @exception None
+ * @version   4.0
+ * @see       esplusplayer_set_video_frame_buffer_type()
+ * @see       esplusplayer_decoded_buffer_destroy()
+ * @see       esplusplayer_decoded_video_frame_buffer_type
+ * @code
+ * ...
+ * esplusplayer_set_video_frame_buffer_type(handle,
+ * ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_MANUAL_COPY);
+ * ...
+ * esplusplayer_prepare_async(handle);
+ * ...
+ * // after prepared
+ * esplusplayer_decoded_video_packet packet;
+ * esplusplayer_get_decoded_video_frame_status_type state;
+ * int retval = esplusplayer_get_decoded_video_packet(handle, &packet, &state);
+ * if (state == ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_SUCCESS) {
+ *   // successful case.
+ *   // in this case, retval will be ESPLUSPLAYER_ERROR_TYPE_NONE
+ *   // you have to call esplusplayer_decoded_buffer_destroy() after using the
+ *   // packet
+ *   ...
+ *   esplusplayer_decoded_buffer_destroy(handle, &packet);
+ * } else if (state ==
+ * ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_NO_REMAINING_BUFFER) {
+ *   // app has to call esplusplayer_decoded_buffer_destroy() with previous
+ *   // video packet.
+ *   // it means player couldn't draw the video frame into a buffer due to no
+ * buffer.
+ *   // in this case ,retval will be ESPLUSPLAYER_ERROR_TYPE_NONE
+ * } else if (state ==
+ * ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_NO_FILLED_BUFFER) {
+ *   // it means app should retry to get decoded video packet.
+ *   // in most case, there were no buffers drawn in the timing you called this
+ *   // api.
+ *   // in this case, retval will be ESPLUSPLAYER_ERROR_TYPE_NONE
+ * } else if (state == ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_UNKNOWN) {
+ *   // internal error happened
+ *   // in this case, retval will be ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION
+ * }
+ * ...
+ * @endcode
+ */
+int esplusplayer_get_decoded_video_packet(
+    esplusplayer_handle handle, esplusplayer_decoded_video_packet* packet,
+    esplusplayer_get_decoded_video_frame_status_type* status);
+
+/**
+ * @brief     Provided api for enabling video hole.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] value : the value of video hole.
+ *            (@c true = video hole enabled, @c false = video hole disabled)
+ * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success, otherwise @c one of esplusplayer_error_type
+ *            values will be returned.
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ *            esplusplayer_open(esplayer);
+ *            esplusplayer_enable_video_hole(esplayer, false);
+ *            // ... your codes ...
+ *            esplusplayer_close(esplayer);
+ * @endcode
+ * @pre       The player state must not be #ESPLUSPLAYER_STATE_NONE.
+ * @remark    To disable video hole, esplusplayer_decoded_video_frame_buffer_type() must
+ *            not be set to #ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_NONE.
+ *            To enable video hole, esplusplayer_set_display() must be set to #ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY
+ * @post      None
+ * @exception None
+ * @see       esplusplayer_set_video_frame_buffer_type()
+ *            esplusplayer_set_media_packet_video_decoded_cb()
+ */
+int esplusplayer_enable_video_hole(esplusplayer_handle handle, const bool value);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_ESPLUSPLAYER_CAPI_H__
diff --git a/agent/espp-service/inc/esplusplayer_capi/esplusplayer_internal.h b/agent/espp-service/inc/esplusplayer_capi/esplusplayer_internal.h
new file mode 100644 (file)
index 0000000..11b398b
--- /dev/null
@@ -0,0 +1,94 @@
+/**
+ * @file           esplusplayer_internal.h
+ * @brief          EsPlusPlayer internally used api c version
+ * @interfacetype  module
+ * @privlevel      None-privilege
+ * @privilege      None
+ * @product        TV, AV, B2B
+ * @version        2.0
+ * @SDK_Support    N
+ * @remark         This is esplusplayer api header implemented as C style to
+ *                 avoid binary compatibility issues.
+ *
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ * PROPRIETARY/CONFIDENTIAL
+ * This software is the confidential and proprietary
+ * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
+ * not disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into with
+ * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
+ * suitability of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a
+ * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
+ * damages suffered by licensee as a result of using, modifying or distributing
+ * this software or its derivatives.
+ */
+
+#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_ESPLUSPLAYER_INTERNAL_H__
+#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_ESPLUSPLAYER_INTERNAL_H__
+
+#include "esplusplayer_capi/display.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+typedef void* esplusplayer_handle;
+typedef void (*esplusplayer_first_video_decoding_done_cb)(void*);
+
+/**
+ * @brief     Set the video display.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] type : display type.
+ * @param     [in] window : the ecore wayland window handle.
+ * @param     [in] x : the x coordinate of window.
+ * @param     [in] y : the ycoordinate of window.
+ * @param     [in] width : the width of window.
+ * @param     [in] height : the height of window.
+ * @return    @c one of esplusplayer_error_type values will be returned.
+ * @pre       The player state can be all of #esplusplayer_state except
+ *            #ESPLUSPLAYER_STATE_NONE.
+ * @post      None
+ * @exception   None
+ * @see       esplusplayer_set_display_mode() \n
+ *            esplusplayer_set_display_roi() \n
+ *            esplusplayer_set_display_visible()
+ */
+int esplusplayer_set_ecore_display(esplusplayer_handle handle,
+                                   esplusplayer_display_type type, void* window,
+                                   int x, int y, int width, int height);
+/**
+ * @brief     Set the video display.
+ * @param     [in] handle : esplusplayer handle.
+ * @param     [in] type : display type.
+ * @param     [in] surface_id : resource id of window.
+ * @param     [in] x : the x coordinate of window.
+ * @param     [in] y : the ycoordinate of window.
+ * @param     [in] width : the width of window.
+ * @param     [in] height : the height of window.
+ * @return    @c one of esplusplayer_error_type values will be returned.
+ * @pre       The player state can be all of #esplusplayer_state except
+ *            #ESPLUSPLAYER_STATE_NONE.
+ * @post      None
+ * @exception   None
+ * @see       esplusplayer_set_display_mode() \n
+ *            esplusplayer_set_display_roi() \n
+ *            esplusplayer_set_display_visible()
+ */
+int esplusplayer_set_surface_display(esplusplayer_handle handle,
+                                     esplusplayer_display_type type,
+                                     unsigned int surface_id, int x, int y,
+                                     int width, int height);
+
+int esplusplayer_set_first_video_decoding_done_cb(
+    esplusplayer_handle handle,
+    esplusplayer_first_video_decoding_done_cb first_video_decoding_done_cb,
+    void* userdata);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_ESPLUSPLAYER_INTERNAL_H__
diff --git a/agent/espp-service/inc/esplusplayer_capi/event.h b/agent/espp-service/inc/esplusplayer_capi/event.h
new file mode 100644 (file)
index 0000000..779ff7b
--- /dev/null
@@ -0,0 +1,63 @@
+/**
+ * @file
+ * @brief          The event for playback.
+ * @interfacetype  Platform
+ * @privlevel      None-privilege
+ * @privilege      None
+ * @product        TV, AV, B2B
+ * @version        2.0
+ * @SDK_Support    N
+ * @remark         This is a group of C style event related enum and structure.
+ * @see            N/A
+ *
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ * PROPRIETARY/CONFIDENTIAL
+ * This software is the confidential and proprietary
+ * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
+ * not disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into with
+ * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
+ * suitability of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a
+ * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
+ * damages suffered by licensee as a result of using, modifying or distributing
+ * this software or its derivatives.
+ */
+
+#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_EVENT_H__
+#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_EVENT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+/**
+ * @brief Event message
+ */
+typedef struct {
+  /**
+   * @description event message data
+   *              eg) ESPLUSPLAYER_EVENT_RESOLUTION_CHANGED : "1920x1080"
+   */
+  char* data;
+  /**
+   * @description the length of event message data
+   */
+  uint64_t len;
+} esplusplayer_event_msg;
+
+/**
+ * @brief Enumerations for event message types
+ */
+typedef enum {
+  ESPLUSPLAYER_EVENT_NONE,
+  ESPLUSPLAYER_EVENT_RESOLUTION_CHANGED,
+} esplusplayer_event_type;
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
+#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_EVENT_H__
diff --git a/agent/espp-service/inc/esplusplayer_capi/matroska_color.h b/agent/espp-service/inc/esplusplayer_capi/matroska_color.h
new file mode 100644 (file)
index 0000000..42d1187
--- /dev/null
@@ -0,0 +1,170 @@
+/**
+ * @file
+ * @brief          The matroska color info
+ * @interfacetype  Platform
+ * @privlevel      None-privilege
+ * @privilege      None
+ * @product        TV, AV, B2B
+ * @version        2.0
+ * @SDK_Support    N
+ * @see            plusplayer::EsPlusPlayer class
+ *
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ * PROPRIETARY/CONFIDENTIAL
+ * This software is the confidential and proprietary
+ * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
+ * not disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into with
+ * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
+ * suitability of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a
+ * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
+ * damages suffered by licensee as a result of using, modifying or distributing
+ * this software or its derivatives.
+ */
+
+#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_MATROSKA_COLOR_H__
+#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_MATROSKA_COLOR_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+/**
+ * @brief   Structure of matroska matering metadata
+ */
+typedef struct {
+  /**
+   * @description    Red X chromaticity coordinate as defined by CIE 1931.
+   */
+  double primary_r_chromaticity_x;
+  /**
+   * @description    Red Y chromaticity coordinate as defined by CIE 1931.
+   */
+  double primary_r_chromaticity_y;
+  /**
+   * @description    Green X chromaticity coordinate as defined by CIE 1931.
+   */
+  double primary_g_chromaticity_x;
+  /**
+   * @description    Green Y chromaticity coordinate as defined by CIE 1931.
+   */
+  double primary_g_chromaticity_y;
+  /**
+   * @description    Blue X chromaticity coordinate as defined by CIE 1931.
+   */
+  double primary_b_chromaticity_x;
+  /**
+   * @description    Blue Y chromaticity coordinate as defined by CIE 1931.
+   */
+  double primary_b_chromaticity_y;
+  /**
+   * @description    White X chromaticity coordinate as defined by CIE 1931.
+   */
+  double white_point_chromaticity_x;
+  /**
+   * @description    White Y chromaticity coordinate as defined by CIE 1931.
+   */
+  double white_point_chromaticity_y;
+  /**
+   * @description    Maximum luminance. Represented in candelas per square meter
+   * (cd/m²).
+   */
+  double luminance_max;
+  /**
+   * @description    Mininum luminance. Represented in candelas per square meter
+   * (cd/m²).
+   */
+  double luminance_min;
+} esplusplayer_matroska_mastering_metadata;
+
+/**
+ * @brief   Structure of matroska color information
+ */
+typedef struct {
+  /**
+   * @description   The Matrix Coefficients of the video used to derive luma and
+   * chroma values from red, green, and blue color primaries. For clarity, the
+   * value and meanings for MatrixCoefficients are adopted from Table 4 of
+   * ISO/IEC 23001-8:2013/DCOR1.
+   */
+  uint32_t matrix_coefficients;
+  /**
+   * @description   Number of decoded bits per channel. A value of 0 indicates
+   * that the BitsPerChannel is unspecified.
+   */
+  uint32_t bits_per_channel;
+  /**
+   * @description   The amount of pixels to remove in the Cr and Cb channels for
+   * every pixel not removed horizontally.
+   */
+  uint32_t chroma_subsampling_horizontal;
+  /**
+   * @description   The amount of pixels to remove in the Cr and Cb channels for
+   * every pixel not removed vertically.
+   */
+  uint32_t chroma_subsampling_vertical;
+  /**
+   * @description    The amount of pixels to remove in the Cb channel for every
+   * pixel not removed horizontally. This is additive with
+   * chroma_subsampling_horizontal.
+   */
+  uint32_t cb_subsampling_horizontal;
+  /**
+   * @description    The amount of pixels to remove in the Cb channel for every
+   * pixel not removed vertically. This is additive with
+   * chroma_subsampling_vertical.
+   */
+  uint32_t cb_subsampling_vertical;
+  /**
+   * @description    How chroma is subsampled horizontally.
+   */
+  uint32_t chroma_siting_horizontal;
+  /**
+   * @description    How chroma is subsampled vertically.
+   */
+  uint32_t chroma_siting_vertical;
+  /**
+   * @description    Clipping of the color ranges.
+   */
+  uint32_t range;
+  /**
+   * @description    The transfer characteristics of the video. For clarity, the
+   * value and meanings for transfer_characteristics 1-15 are adopted from Table
+   * 3 of ISO/IEC 23001-8:2013/DCOR1. transfer_characteristics 16-18 are
+   * proposed values.
+   */
+  uint32_t transfer_characteristics;
+  /**
+   * @description    The colour primaries of the video. For clarity, the value
+   * and meanings for primaries are adopted from Table 2 of ISO/IEC
+   * 23001-8:2013/DCOR1.
+   */
+  uint32_t primaries;
+  /**
+   * @description    Maximum brightness of a single pixel (Maximum Content Light
+   * Level) in candelas per square meter (cd/m²).
+   */
+  uint32_t max_cll;
+  /**
+   * @description    Maximum brightness of a single full frame (Maximum
+   * Frame-Average Light Level) in candelas per square meter (cd/m²).
+   */
+  uint32_t max_fall;
+  /**
+   * @description    SMPTE 2086 mastering data.
+   */
+  esplusplayer_matroska_mastering_metadata metadata;
+  /**
+   * @description    flag to check if this file is hdr10+ (cd/m²).
+   */
+  uint32_t isHDR10p;
+} esplusplayer_matroska_color;
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
+#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_MATROSKA_COLOR_H__
diff --git a/agent/espp-service/inc/esplusplayer_capi/state.h b/agent/espp-service/inc/esplusplayer_capi/state.h
new file mode 100644 (file)
index 0000000..2c2d1c5
--- /dev/null
@@ -0,0 +1,51 @@
+/**
+ * @file
+ * @brief          State enum.
+ * @interfacetype  Platform
+ * @privlevel      None-privilege
+ * @privilege      None
+ * @product        TV, AV, B2B
+ * @version        2.0
+ * @SDK_Support    N
+ * @remark         This is a group of C style state related enum.
+ * @see            State enum convertion.
+ *
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ * PROPRIETARY/CONFIDENTIAL
+ * This software is the confidential and proprietary
+ * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
+ * not disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into with
+ * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
+ * suitability of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a
+ * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
+ * damages suffered by licensee as a result of using, modifying or distributing
+ * this software or its derivatives.
+ */
+
+#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_STATE_H__
+#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_STATE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief  Enumerations for es player state.
+ */
+typedef enum {
+  ESPLUSPLAYER_STATE_NONE,  /**<Player is created, but not opened*/
+  ESPLUSPLAYER_STATE_IDLE,  /**<Player is opened, but not prepared or player is
+                               stopped*/
+  ESPLUSPLAYER_STATE_READY, /**<Player is ready to play(start)*/
+  ESPLUSPLAYER_STATE_PLAYING, /**<Player is playing media*/
+  ESPLUSPLAYER_STATE_PAUSED,    /**<Player is playing media*/
+  ESPLUSPLAYER_STATE_MAX
+} esplusplayer_state;
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
+#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_STATE_H__
diff --git a/agent/espp-service/inc/esplusplayer_capi/stream.h b/agent/espp-service/inc/esplusplayer_capi/stream.h
new file mode 100644 (file)
index 0000000..902632b
--- /dev/null
@@ -0,0 +1,166 @@
+/**
+ * @file
+ * @brief          Stream info related data structures and enums
+ * @interfacetype  Platform
+ * @privlevel      None-privilege
+ * @privilege      None
+ * @product        TV, AV, B2B
+ * @version        2.0
+ * @SDK_Support    N
+ * @remark         This is a group of C style track releted data structures and
+ *                 enums.
+ * @see            All track releated types shared_ptr, boost::any, enum
+ *                 classes, std::string, etc.. are converted to this.
+ *
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ * PROPRIETARY/CONFIDENTIAL
+ * This software is the confidential and proprietary
+ * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
+ * not disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into with
+ * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
+ * suitability of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a
+ * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
+ * damages suffered by licensee as a result of using, modifying or distributing
+ * this software or its derivatives.
+ */
+
+#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_TRACK_H__
+#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_TRACK_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief  Enumerations for the stream type
+ */
+typedef enum {
+  ESPLUSPLAYER_STREAM_TYPE_AUDIO,
+  ESPLUSPLAYER_STREAM_TYPE_VIDEO,
+  ESPLUSPLAYER_STREAM_TYPE_MAX
+} esplusplayer_stream_type;
+
+/**
+ * @brief   Enumerations for audio mime type
+ */
+typedef enum {
+  ESPLUSPLAYER_AUDIO_MIME_TYPE_UNKNOWN,
+  ESPLUSPLAYER_AUDIO_MIME_TYPE_AAC,
+  ESPLUSPLAYER_AUDIO_MIME_TYPE_MP2,
+  ESPLUSPLAYER_AUDIO_MIME_TYPE_MP3,
+  ESPLUSPLAYER_AUDIO_MIME_TYPE_AC3,
+  ESPLUSPLAYER_AUDIO_MIME_TYPE_EAC3,
+  ESPLUSPLAYER_AUDIO_MIME_TYPE_VORBIS,
+  ESPLUSPLAYER_AUDIO_MIME_TYPE_OPUS,
+  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_S16LE,
+  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_S16BE,
+  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_U16LE,
+  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_U16BE,
+  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_S24LE,
+  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_S24BE,
+  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_U24LE,
+  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_U24BE,
+  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_S32LE,
+  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_S32BE,
+  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_U32LE,
+  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_U32BE,
+  ESPLUSPLAYER_AUDIO_MIME_TYPE_G711_MULAW
+} esplusplayer_audio_mime_type;
+
+/**
+ * @brief   Enumerations for video mime type
+ */
+typedef enum {
+  ESPLUSPLAYER_VIDEO_MIME_TYPE_UNKNOWN,
+  ESPLUSPLAYER_VIDEO_MIME_TYPE_H263,
+  ESPLUSPLAYER_VIDEO_MIME_TYPE_H264,
+  ESPLUSPLAYER_VIDEO_MIME_TYPE_HEVC,
+  ESPLUSPLAYER_VIDEO_MIME_TYPE_MPEG1,
+  ESPLUSPLAYER_VIDEO_MIME_TYPE_MPEG2,
+  ESPLUSPLAYER_VIDEO_MIME_TYPE_MPEG4,
+  ESPLUSPLAYER_VIDEO_MIME_TYPE_VP8,
+  ESPLUSPLAYER_VIDEO_MIME_TYPE_VP9,
+  ESPLUSPLAYER_VIDEO_MIME_TYPE_WMV3,
+  ESPLUSPLAYER_VIDEO_MIME_TYPE_AV1,
+  ESPLUSPLAYER_VIDEO_MIME_TYPE_MJPEG
+} esplusplayer_video_mime_type;
+
+/**
+ * @brief   Audio stream information structure
+ */
+typedef struct {
+  /**
+   * @description   The audio codec data pointer.
+   */
+  char* codec_data;
+  /**
+   * @description   The audio codec data length.
+   */
+  uint32_t codec_data_length;
+  /**
+   * @description   The audio mime type.
+   */
+  esplusplayer_audio_mime_type mime_type;
+  /**
+   * @description   The audio bitrate value.
+   */
+  uint32_t bitrate;
+  /**
+   * @description   The audio channel number.
+   */
+  uint32_t channels;
+  /**
+   * @description   The audio sample rate value.
+   */
+  uint32_t sample_rate;
+} esplusplayer_audio_stream_info;
+
+/**
+ * @brief   Video stream information structure
+ */
+typedef struct {
+  /**
+   * @description   The video codec data pointer.
+   */
+  char* codec_data;
+  /**
+   * @description   The video codec data length.
+   */
+  uint32_t codec_data_length;
+  /**
+   * @description   The video mime type.
+   */
+  esplusplayer_video_mime_type mime_type;
+  /**
+   * @description   The width value of the video.
+   */
+  uint32_t width;
+  /**
+   * @description   The height value of the video.
+   */
+  uint32_t height;
+  /**
+   * @description   The max width value of the video.
+   */
+  uint32_t max_width;
+  /**
+   * @description   The max height value of the video.
+   */
+  uint32_t max_height;
+  /**
+   * @description   The numerator value of the video frame rate.
+   */
+  uint32_t framerate_num;
+  /**
+   * @description   The denominator value of the video frame rate.
+   */
+  uint32_t framerate_den;
+} esplusplayer_video_stream_info;
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
+#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_TRACK_H__
diff --git a/agent/espp-service/inc/esplusplayer_capi/submitdatatype.h b/agent/espp-service/inc/esplusplayer_capi/submitdatatype.h
new file mode 100644 (file)
index 0000000..acb80ca
--- /dev/null
@@ -0,0 +1,48 @@
+/**
+ * @file
+ * @brief          For submit data type enum.
+ * @interfacetype  Platform
+ * @privlevel      None-privilege
+ * @privilege      None
+ * @product        TV, AV, B2B
+ * @version        2.0
+ * @SDK_Support    N
+ * @remark         This is a group of C style submitstatus related enum.
+ * @see            SubmitDataType enum conversion.
+ *
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ * PROPRIETARY/CONFIDENTIAL
+ * This software is the confidential and proprietary
+ * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
+ * not disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into with
+ * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
+ * suitability of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a
+ * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
+ * damages suffered by licensee as a result of using, modifying or distributing
+ * this software or its derivatives.
+ */
+
+#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_SUBMITDATATYPE_H__
+#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_SUBMITDATATYPE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief  Enumerations for the type of buffers submitted
+ */
+typedef enum {
+  ESPLUSPLAYER_SUBMIT_DATA_TYPE_CLEAN_DATA,
+  ESPLUSPLAYER_SUBMIT_DATA_TYPE_ENCRYPTED_DATA,
+//  ESPLUSPLAYER_SUBMIT_DATA_TYPE_TRUSTZONE_DATA,
+  ESPLUSPLAYER_SUBMIT_DATA_TYPE_MAX,
+} esplusplayer_submit_data_type;
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
+#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_SUBMITDATATYPE_H__
diff --git a/agent/espp-service/inc/esplusplayer_capi/submitstatus.h b/agent/espp-service/inc/esplusplayer_capi/submitstatus.h
new file mode 100644 (file)
index 0000000..cc28c4c
--- /dev/null
@@ -0,0 +1,49 @@
+/**
+ * @file
+ * @brief          For submitstatus enum.
+ * @interfacetype  Platform
+ * @privlevel      None-privilege
+ * @privilege      None
+ * @product        TV, AV, B2B
+ * @version        2.0
+ * @SDK_Support    N
+ * @remark         This is a group of C style submitstatus related enum.
+ * @see            Submitstatus enum convertion.
+ *
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ * PROPRIETARY/CONFIDENTIAL
+ * This software is the confidential and proprietary
+ * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
+ * not disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into with
+ * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
+ * suitability of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a
+ * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
+ * damages suffered by licensee as a result of using, modifying or distributing
+ * this software or its derivatives.
+ */
+
+#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_SUBMITSTATUS_H__
+#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_SUBMITSTATUS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief  Enumerations for the buffer status
+ */
+typedef enum {
+  ESPLUSPLAYER_SUBMIT_STATUS_NOT_PREPARED,
+  ESPLUSPLAYER_SUBMIT_STATUS_INVALID_PACKET,
+  ESPLUSPLAYER_SUBMIT_STATUS_OUT_OF_MEMORY,
+  ESPLUSPLAYER_SUBMIT_STATUS_FULL,
+  ESPLUSPLAYER_SUBMIT_STATUS_SUCCESS
+} esplusplayer_submit_status;
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
+#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_SUBMITSTATUS_H__
diff --git a/agent/espp-service/meson.build b/agent/espp-service/meson.build
new file mode 100644 (file)
index 0000000..cc81e60
--- /dev/null
@@ -0,0 +1,54 @@
+project('espp-service', 'c',
+  version: run_command('get_version.sh', check: true).stdout().strip(),
+  default_options : ['warning_level=2',
+                     'buildtype=debugoptimized',
+                     'werror=false'])
+
+espp_service_version = meson.project_version()
+version_arr = espp_service_version.split('.')
+version_major = version_arr[0]
+
+pkgconfig = import('pkgconfig')
+
+add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
+add_project_arguments('-Wno-unused-parameter', language: 'c')
+
+conf_data = configuration_data()
+
+configinc = include_directories('.')
+
+common_deps = []
+
+libdir_path = '$ORIGIN/../lib'
+message('libdir_path[' + libdir_path + ']')
+
+message('================ common options ================')
+
+conf_data.set('ESPP_SERVICE_VERSION', espp_service_version)
+conf_data.set('ESPP_SERVICE_SOCK_PATH', get_option('sock-path'))
+
+if get_option('dlog')
+  message('dlog option is enabled, set USE_DLOG')
+  conf_data.set('USE_DLOG', true)
+  dlog_dep = dependency('dlog', required: true)
+  common_deps += [dlog_dep]
+endif
+
+if get_option('service-app')
+  message('service-app option is enabled, set USE_SERVICE_APP')
+  conf_data.set('USE_SERVICE_APP', true)
+  app_common_dep = dependency('capi-appfw-application', required: true)
+  common_deps += [app_common_dep]
+endif
+
+message('================================================')
+
+glib_dep = dependency('glib-2.0', required: true)
+common_deps += [glib_dep]
+
+json_dep = dependency('json-glib-1.0', required: true)
+common_deps += [json_dep]
+
+subdir('src')
+
+configure_file(output: 'config.h', configuration: conf_data)
diff --git a/agent/espp-service/meson_options.txt b/agent/espp-service/meson_options.txt
new file mode 100644 (file)
index 0000000..42c2cc3
--- /dev/null
@@ -0,0 +1,8 @@
+#common
+option('sock-path', type: 'string', value: '/tmp/espp_service.sock', description: 'ESPP service socket path')
+option('dlog', type: 'boolean', value: true, description: 'Use dlog')
+
+#daemon
+option('tizen-60', type: 'boolean', value: false, description: 'For tizen 6.0')
+option('_bindir', type: 'string', value: '/usr/bin', yield: true, description: 'ESPP service daemon install dir')
+option('service-app', type: 'boolean', value: true, yield: true, description: 'ESPP service daemon is launched as Tizen service app')
diff --git a/agent/espp-service/packaging/espp-service.manifest b/agent/espp-service/packaging/espp-service.manifest
new file mode 100644 (file)
index 0000000..2a0cec5
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+  <request>
+    <domain name="_"/>
+  </request>
+</manifest>
diff --git a/agent/espp-service/packaging/espp-service.service b/agent/espp-service/packaging/espp-service.service
new file mode 100644 (file)
index 0000000..e5995d0
--- /dev/null
@@ -0,0 +1,15 @@
+[Unit]
+Description=Start the ESPP service
+
+[Service]
+ExecStart=/usr/bin/espp-service -s
+Restart=always
+RestartSec=0
+MemoryLimit=50M
+User=multimedia_fw
+Group=multimedia_fw
+SmackProcessLabel=System
+SecureBits=keep-caps
+Capabilities=cap_lease=i
+EnvironmentFile=/run/xdg-root-env
+
diff --git a/agent/espp-service/packaging/espp-service.spec b/agent/espp-service/packaging/espp-service.spec
new file mode 100644 (file)
index 0000000..6413036
--- /dev/null
@@ -0,0 +1,113 @@
+%if 0%{?debug:1}
+%define debug_package %{nil}
+%define __debug_install_post %{nil}
+%endif
+
+Name:       espp-service
+Summary:    ESPP service package which contains client lib. and daemon binary
+Version:    0.3.22
+Release:    0
+Group:      Multimedia/Libraries
+License:    Apache-2.0
+Source0:    %{name}-%{version}.tar.gz
+Source1:    %{name}.manifest
+Source2:    %{name}.service
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+BuildRequires: meson
+BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(gio-2.0)
+BuildRequires: pkgconfig(json-glib-1.0)
+BuildRequires: pkgconfig(esplusplayer)
+%if "%{use_tizen_60}" != "1"
+BuildRequires: pkgconfig(libtbm)
+BuildRequires: pkgconfig(capi-media-image-util)
+%endif
+%if "%{use_service_app}" == "1"
+BuildRequires: pkgconfig(capi-appfw-service-application)
+BuildRequires: pkgconfig(capi-appfw-application)
+%endif
+
+%description
+ESPP service package contains daemon binary which uses esplusplayer to render audio/video buffers and it's client library
+
+%package client
+Summary:    ESPP service client library
+Group:      Multimedia/Libraries
+
+%description client
+ESPP service client library used by applications that request to render audio/video buffers to ESPP service daemon
+
+%package client-devel
+Summary:    ESPP service client development header and library
+Group:      Development/Libraries
+Requires:   %{name} = %{version}-%{release}
+
+%description client-devel
+ESPP service client development header and library
+
+%prep
+%setup -q -n %{name}-%{version}
+cp %{SOURCE1} %{SOURCE2} .
+
+%define _bin_dir %{_bindir}
+
+%build
+meson setup --auto-features=disabled \
+  --prefix=/usr \
+  --libdir=%{_libdir} \
+  --datadir=%{_datadir} \
+%if "%{use_tizen_60}" == "1"
+  -Dtizen-60=true \
+%else
+  -Dtizen-60=false \
+%endif
+  -Dsock-path=/tmp/espp_service.sock \
+%if "%{use_service_app}" == "1"
+  -Dservice-app=true \
+%else
+  -Dservice-app=false \
+%endif
+  -D_bindir=%{_bin_dir} \
+%if "%{asan}" != "1"
+%ifnarch x86_64
+  --werror \
+%endif
+%endif
+  build
+
+ninja -C build
+
+%install
+rm -rf %{buildroot}
+export DESTDIR=%{buildroot}
+ninja -C build install
+
+mkdir -p %{buildroot}%{_unitdir}/
+install -m0644 %{SOURCE2} %{buildroot}%{_unitdir}/
+
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
+%files
+%manifest %{name}.manifest
+%defattr(-,root,root,-)
+%{_bin_dir}/espp-service
+%{_unitdir}/espp-service.service
+%license LICENSE.APLv2
+
+%files client
+%manifest %{name}.manifest
+%defattr(-,root,root,-)
+%{_libdir}/*.so*
+%exclude %{_libdir}/debug/*
+%license LICENSE.APLv2
+
+%files client-devel
+%manifest %{name}.manifest
+%{_libdir}/*.so
+%{_libdir}/pkgconfig/espp-service*.pc
+%{_includedir}/*.h
+
diff --git a/agent/espp-service/project_def.prop b/agent/espp-service/project_def.prop
new file mode 100644 (file)
index 0000000..72ca044
--- /dev/null
@@ -0,0 +1,26 @@
+# Project Name
+APPNAME = espp-service
+
+# Project Type
+type = app
+
+# Project Profile
+profile = tizen-8.0
+
+# Sources
+USER_SRCS = ./src/daemon/*.c ./src/common/*.c
+
+# User Defines
+USER_DEFS = USE_DLOG USE_SERVICE_APP ESPP_SERVICE_VERSION="0.3.21"
+
+# User Includes
+USER_INC_DIRS = ./src/daemon ./src/common ./inc ./inc/esplusplayer_capi
+
+# User Libraries
+USER_LIBS = esplusplayer
+
+# Linker Flags
+USER_LFLAGS = -Xlinker --allow-shlib-undefined -Xlinker -rpath='/usr/lib'
+
+# User Library Path
+USER_LIB_DIRS = ./libs
diff --git a/agent/espp-service/src/client/build_def.prop b/agent/espp-service/src/client/build_def.prop
new file mode 100644 (file)
index 0000000..58ec40b
--- /dev/null
@@ -0,0 +1,4 @@
+PREBUILD_COMMAND = sh update_version.sh
+PREBUILD_DESC =
+POSTBUILD_COMMAND =
+POSTBUILD_DESC =
diff --git a/agent/espp-service/src/client/espp_service_client.c b/agent/espp-service/src/client/espp_service_client.c
new file mode 100644 (file)
index 0000000..1890c1b
--- /dev/null
@@ -0,0 +1,796 @@
+/*
+ * Copyright (c) 2023 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 "espp_service_client.h"
+#include "espp_service_client_priv.h"
+
+int espp_client_set_ready_to_prepare_cb(espp_h espp, espp_ready_to_prepare_cb callback, void *user_data)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+       g_autoptr(GMutexLocker) cb_locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+       RET_VAL_IF(!callback, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "callback is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_callback(_espp, ESPP_SERVICE_EVENT_CB_READY_TO_PREPARE, (void *)callback, user_data) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       cb_locker = g_mutex_locker_new(&_espp->cb_mutex);
+       LOG_WARNING_IF_CALLBACK_EXISTS(_espp->ready_to_prepare_cb);
+
+       _espp->ready_to_prepare_cb.callback = callback;
+       _espp->ready_to_prepare_cb.user_data = user_data;
+
+       LOG_INFO("espp[%p] callback[%p] user_data[%p]", espp, callback, user_data);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_set_prepare_async_done_cb(espp_h espp, espp_prepare_async_done_cb callback, void *user_data)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+       g_autoptr(GMutexLocker) cb_locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+       RET_VAL_IF(!callback, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "callback is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_callback(_espp, ESPP_SERVICE_EVENT_CB_PREPARE_ASYNC_DONE, (void *)callback, user_data) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       cb_locker = g_mutex_locker_new(&_espp->cb_mutex);
+       LOG_WARNING_IF_CALLBACK_EXISTS(_espp->prepare_async_done_cb);
+
+       _espp->prepare_async_done_cb.callback = callback;
+       _espp->prepare_async_done_cb.user_data = user_data;
+
+       LOG_INFO("espp[%p] callback[%p] user_data[%p]", espp, callback, user_data);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_set_ready_to_seek_cb(espp_h espp, espp_ready_to_seek_cb callback, void *user_data)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+       g_autoptr(GMutexLocker) cb_locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+       RET_VAL_IF(!callback, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "callback is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_callback(_espp, ESPP_SERVICE_EVENT_CB_READY_TO_SEEK, (void *)callback, user_data) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       cb_locker = g_mutex_locker_new(&_espp->cb_mutex);
+       LOG_WARNING_IF_CALLBACK_EXISTS(_espp->ready_to_seek_cb);
+
+       _espp->ready_to_seek_cb.callback = callback;
+       _espp->ready_to_seek_cb.user_data = user_data;
+
+       LOG_INFO("espp[%p] callback[%p] user_data[%p]", espp, callback, user_data);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_set_seek_done_cb(espp_h espp, espp_seek_done_cb callback, void *user_data)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+       g_autoptr(GMutexLocker) cb_locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+       RET_VAL_IF(!callback, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "callback is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_callback(_espp, ESPP_SERVICE_EVENT_CB_SEEK_DONE, (void *)callback, user_data) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       cb_locker = g_mutex_locker_new(&_espp->cb_mutex);
+       LOG_WARNING_IF_CALLBACK_EXISTS(_espp->seek_done_cb);
+
+       _espp->seek_done_cb.callback = callback;
+       _espp->seek_done_cb.user_data = user_data;
+
+       LOG_INFO("espp[%p] callback[%p] user_data[%p]", espp, callback, user_data);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_set_eos_cb(espp_h espp, espp_eos_cb callback, void *user_data)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+       g_autoptr(GMutexLocker) cb_locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+       RET_VAL_IF(!callback, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "callback is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_callback(_espp, ESPP_SERVICE_EVENT_CB_EOS, (void *)callback, user_data) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       cb_locker = g_mutex_locker_new(&_espp->cb_mutex);
+       LOG_WARNING_IF_CALLBACK_EXISTS(_espp->eos_cb);
+
+       _espp->eos_cb.callback = callback;
+       _espp->eos_cb.user_data = user_data;
+
+       LOG_INFO("espp[%p] callback[%p] user_data[%p]", espp, callback, user_data);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_set_buffer_status_cb(espp_h espp, espp_buffer_status_cb callback, void *user_data)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+       g_autoptr(GMutexLocker) cb_locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+       RET_VAL_IF(!callback, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "callback is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_callback(_espp, ESPP_SERVICE_EVENT_CB_BUFFER_STATUS, (void *)callback, user_data) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       cb_locker = g_mutex_locker_new(&_espp->cb_mutex);
+       LOG_WARNING_IF_CALLBACK_EXISTS(_espp->buffer_status_cb);
+
+       _espp->buffer_status_cb.callback = callback;
+       _espp->buffer_status_cb.user_data = user_data;
+
+       LOG_INFO("espp[%p] callback[%p] user_data[%p]", espp, callback, user_data);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_set_resource_conflicted_cb(espp_h espp, espp_resource_conflicted_cb callback, void *user_data)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+       g_autoptr(GMutexLocker) cb_locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+       RET_VAL_IF(!callback, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "callback is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_callback(_espp, ESPP_SERVICE_EVENT_CB_RESOURCE_CONFLICTED, (void *)callback, user_data) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       cb_locker = g_mutex_locker_new(&_espp->cb_mutex);
+       LOG_WARNING_IF_CALLBACK_EXISTS(_espp->resource_conflicted_cb);
+
+       _espp->resource_conflicted_cb.callback = callback;
+       _espp->resource_conflicted_cb.user_data = user_data;
+
+       LOG_INFO("espp[%p] callback[%p] user_data[%p]", espp, callback, user_data);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_set_error_cb(espp_h espp, espp_error_cb callback, void *user_data)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+       g_autoptr(GMutexLocker) cb_locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+       RET_VAL_IF(!callback, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "callback is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_callback(_espp, ESPP_SERVICE_EVENT_CB_ERROR, (void *)callback, user_data) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       cb_locker = g_mutex_locker_new(&_espp->cb_mutex);
+       LOG_WARNING_IF_CALLBACK_EXISTS(_espp->error_cb);
+
+       _espp->error_cb.callback = callback;
+       _espp->error_cb.user_data = user_data;
+
+       LOG_INFO("espp[%p] callback[%p] user_data[%p]", espp, callback, user_data);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+static void __snapshot_destroy_cb(gpointer data)
+{
+       espp_callback_s *cb_data = (espp_callback_s *)data;
+       LOG_DEBUG("data[%p, calllback:%p, user_data:%p]", data, cb_data->callback, cb_data->user_data);
+       g_free(data);
+}
+
+int espp_client_create(espp_h *espp)
+{
+       espp_s *_espp;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       LOG_WARNING("version[%s]", ESPP_SVC_VERSION);
+
+       _espp = g_new0(espp_s, 1);
+       _espp->fd = -1;
+       _espp->event_fd = -1;
+
+       g_mutex_init(&_espp->mutex);
+       g_mutex_init(&_espp->cb_mutex);
+
+       _espp->snapshot_cbs = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, __snapshot_destroy_cb);
+
+       if (espp_service_client_socket_request_create(_espp) != 0)
+               goto error;
+
+       if (espp_service_client_socket_request_init_event(_espp) != 0) {
+               espp_service_client_socket_request_destroy(_espp);
+               goto error;
+       }
+
+       *espp = _espp;
+
+       LOG_INFO("espp[%p] is created", *espp);
+
+       return ESPP_CLIENT_ERROR_NONE;
+
+error:
+       g_hash_table_destroy(_espp->snapshot_cbs);
+       g_mutex_clear(&_espp->mutex);
+       g_mutex_clear(&_espp->cb_mutex);
+       g_free(_espp);
+       return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+}
+
+int espp_client_destroy(espp_h espp)
+{
+       espp_s *_espp = (espp_s *)espp;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       g_mutex_lock(&_espp->mutex);
+
+       if (espp_service_client_socket_request_deinit_event(_espp) != 0) {
+               g_mutex_unlock(&_espp->mutex);
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+       }
+
+       if (espp_service_client_socket_request_destroy(_espp) != 0) {
+               g_mutex_unlock(&_espp->mutex);
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+       }
+
+       if (_espp->snapshot_cbs) {
+               g_hash_table_destroy(_espp->snapshot_cbs);
+               _espp->snapshot_cbs = NULL;
+       }
+
+       g_mutex_unlock(&_espp->mutex);
+       g_mutex_clear(&_espp->mutex);
+       g_mutex_clear(&_espp->cb_mutex);
+
+       LOG_INFO("espp[%p] is destroyed", espp);
+
+       g_free(espp);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_open(espp_h espp)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_open(_espp) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] is opened", espp);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_close(espp_h espp)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_close(_espp) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] is close", espp);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_start(espp_h espp)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_start(_espp) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] is started", espp);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_stop(espp_h espp)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_stop(_espp) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] is stopped", espp);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_pause(espp_h espp)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_pause(_espp) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] is paused", espp);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_resume(espp_h espp)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_resume(_espp) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] is resumed", espp);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_prepare_async(espp_h espp)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_prepare_async(_espp) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p]", espp);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_seek(espp_h espp, uint64_t time_ms)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_seek(_espp, time_ms) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] time_ms[%" PRIu64 "]", espp, time_ms);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_get_state(espp_h espp, espp_state_e *state)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+       RET_VAL_IF(!state, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "state is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_get_state(_espp, state) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] state[%d]", espp, *state);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_get_playing_time(espp_h espp, uint64_t *time_ms)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+       RET_VAL_IF(!time_ms, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "time_ms is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_get_playing_time(_espp, time_ms) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] time_ms[%" PRIu64 "]", espp, *time_ms);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_set_audio_stream_info(espp_h espp, espp_audio_stream_info_s *info)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_audio_stream_info(_espp, info) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p]", espp);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_set_video_stream_info(espp_h espp, espp_video_stream_info_s *info)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_video_stream_info(_espp, info) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p]", espp);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_set_playback_rate(espp_h espp, double rate, bool mute_audio)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_playback_rate(_espp, rate, mute_audio) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] rate[%f] mute_audio[%d]", espp, rate, mute_audio);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_set_display_surface_id(espp_h espp, espp_display_type_e type, unsigned int surface_id, int x, int y, int w, int h)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_display_surface_id(_espp, type, surface_id, x, y, w, h) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] type[%d] surface_id[%u]", espp, type, surface_id);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_set_display_mode(espp_h espp, espp_display_mode_e mode)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_display_mode(_espp, mode) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] mode[%d]", espp, mode);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_set_display_roi(espp_h espp, int x, int y, int w, int h)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_display_roi(_espp, x, y, w, h) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] x[%d] y[%d] w[%d] h[%d]", espp, x, y, w, h);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_set_display_visible(espp_h espp, bool visible)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_display_visible(_espp, visible) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] visible[%d]", espp, visible);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_set_display_rotation(espp_h espp, espp_display_rotation_angle_e angle)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_display_rotation(_espp, angle) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] angle[%d]", espp, angle);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_set_audio_mute(espp_h espp, bool mute)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_audio_mute(_espp, mute) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] mute[%d]", espp, mute);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_set_audio_volume(espp_h espp, int volume)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_audio_volume(_espp, volume) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] volume[%d]", espp, volume);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_get_audio_volume(espp_h espp, int *volume)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+       RET_VAL_IF(!volume, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "volume is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_get_audio_volume(_espp, volume) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] volume[%d]", espp, *volume);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_submit_packet(espp_h espp, espp_packet_s *packet, espp_submit_error_e *error)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+       RET_VAL_IF(!packet, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "packet is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_submit_packet(_espp, packet, error) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_DEBUG("espp[%p], packet[%p, %s]", espp, packet, packet->type == ESPP_STREAM_TYPE_AUDIO ? "AUDIO" : "VIDEO");
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_submit_eos_packet(espp_h espp, espp_stream_type_e stream_type, espp_submit_error_e *error)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_submit_eos_packet(_espp, stream_type, error) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] stream_type[%d]", espp, stream_type);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_set_buffer_size(espp_h espp, espp_buffer_size_type_e size_type, uint64_t size)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_buffer_size(_espp, size_type, size) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] size_type[%d] size[%" PRIu64 "]", espp, size_type, size);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_set_low_latency_mode(espp_h espp, espp_low_latency_mode_e mode)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_low_latency_mode(_espp, mode) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] mode[0x%x]", espp, mode);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_set_decoded_video_frame_buffer_type(espp_h espp, espp_decoded_video_frame_buffer_type_e type)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_decoded_video_frame_buffer_type(_espp, type) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] type[%d]", espp, type);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_take_snapshot(espp_h espp, espp_snapshot_cb callback, void *user_data)
+{
+       espp_s *_espp = (espp_s *)espp;
+       espp_callback_s *cb_data;
+       g_autoptr(GMutexLocker) locker = NULL;
+       gint *id;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+       RET_VAL_IF(!callback, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "callback is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       cb_data = g_new0(espp_callback_s, 1);
+       cb_data->callback = callback;
+       cb_data->user_data = user_data;
+
+       id = g_new(gint, 1);
+       *id = ++_espp->snapshot_cb_id;
+       if (!g_hash_table_insert(_espp->snapshot_cbs, id, (gpointer)cb_data)) {
+               LOG_ERROR("should not be reached here, snapshot_cb_id[%d] already exist", _espp->snapshot_cb_id);
+               /* Due to the imple. of g_hash_table_insert() in this case, we need to alloc again for id. */
+               id = g_new(gint, 1);
+               *id = _espp->snapshot_cb_id--;
+               g_hash_table_remove(_espp->snapshot_cbs, id);
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+       }
+
+       if (espp_service_client_socket_request_take_snapshot(_espp, _espp->snapshot_cb_id) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] snapshot_cb_id[%d] callback[%p] user_data[%p]", espp, _espp->snapshot_cb_id, callback, user_data);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
+int espp_client_set_render_time_offset(espp_h espp, espp_stream_type_e stream_type, int64_t time_offset_ms)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_render_time_offset(_espp, stream_type, time_offset_ms) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] stream_type[%d] time_offset_ms[%" PRId64 "]", espp, stream_type, time_offset_ms);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
diff --git a/agent/espp-service/src/client/espp_service_client.h b/agent/espp-service/src/client/espp_service_client.h
new file mode 100644 (file)
index 0000000..29ff8e1
--- /dev/null
@@ -0,0 +1,917 @@
+/*
+ * Copyright (c) 2023 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 __ESPP_SERVICE_CLIENT_H__
+#define __ESPP_SERVICE_CLIENT_H__
+
+#include <tizen.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @brief ESPP service client handle type.
+ */
+typedef void *espp_h;
+
+/**
+ * @brief Enumeration for ESPP service client error.
+ */
+typedef enum {
+       ESPP_CLIENT_ERROR_NONE = TIZEN_ERROR_NONE,                              /**< Successful */
+       ESPP_CLIENT_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,    /**< Invalid parameter */
+       ESPP_CLIENT_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION,    /**< Invalid operation */
+} espp_client_error_e;
+
+/**
+ * @brief  Enumerations for the state.
+ */
+typedef enum {
+  ESPP_STATE_NONE,    /**< The handle is created, but not opened */
+  ESPP_STATE_IDLE,    /**< The handle is open, but not prepared or stopped */
+  ESPP_STATE_READY,   /**< The handle is ready to play(start) */
+  ESPP_STATE_PLAYING, /**< The handle is playing */
+  ESPP_STATE_PAUSED,  /**< The handle is paused */
+} espp_state_e;
+
+/**
+ * @brief  Enumerations for the stream type
+ */
+typedef enum {
+       ESPP_STREAM_TYPE_AUDIO,     /**< Audio stream type */
+       ESPP_STREAM_TYPE_VIDEO,     /**< Video stream type */
+} espp_stream_type_e;
+
+/**
+ * @brief Enumerations for audio mime type
+ */
+typedef enum {
+       ESPP_AUDIO_MIME_TYPE_UNKNOWN,    /**< Unknown */
+       ESPP_AUDIO_MIME_TYPE_AAC,        /**< AAC */
+       ESPP_AUDIO_MIME_TYPE_MP2,        /**< MP2 */
+       ESPP_AUDIO_MIME_TYPE_MP3,        /**< MP3 */
+       ESPP_AUDIO_MIME_TYPE_AC3,        /**< AC3 */
+       ESPP_AUDIO_MIME_TYPE_EAC3,       /**< EAC3 */
+       ESPP_AUDIO_MIME_TYPE_VORBIS,     /**< VORBIS */
+       ESPP_AUDIO_MIME_TYPE_OPUS,       /**< OPUS */
+       ESPP_AUDIO_MIME_TYPE_PCM_S16LE,  /**< PCM s16le */
+       ESPP_AUDIO_MIME_TYPE_PCM_S16BE,  /**< PCM s16be */
+       ESPP_AUDIO_MIME_TYPE_PCM_U16LE,  /**< PCM u16le */
+       ESPP_AUDIO_MIME_TYPE_PCM_U16BE,  /**< PCM u16be */
+       ESPP_AUDIO_MIME_TYPE_PCM_S24LE,  /**< PCM s24le */
+       ESPP_AUDIO_MIME_TYPE_PCM_S24BE,  /**< PCM s24be */
+       ESPP_AUDIO_MIME_TYPE_PCM_U24LE,  /**< PCM u24le */
+       ESPP_AUDIO_MIME_TYPE_PCM_U24BE,  /**< PCM u24be */
+       ESPP_AUDIO_MIME_TYPE_PCM_S32LE,  /**< PCM s32le */
+       ESPP_AUDIO_MIME_TYPE_PCM_S32BE,  /**< PCM s32be */
+       ESPP_AUDIO_MIME_TYPE_PCM_U32LE,  /**< PCM u32le */
+       ESPP_AUDIO_MIME_TYPE_PCM_U32BE,  /**< PCM u32be */
+       ESPP_AUDIO_MIME_TYPE_G711_MULAW  /**< G711 mulaw */
+} espp_audio_mime_type_e;
+
+/**
+ * @brief Enumerations for video mime type
+ */
+typedef enum {
+       ESPP_VIDEO_MIME_TYPE_UNKNOWN,   /**< Unknown */
+       ESPP_VIDEO_MIME_TYPE_H263,      /**< H263 */
+       ESPP_VIDEO_MIME_TYPE_H264,      /**< H264 */
+       ESPP_VIDEO_MIME_TYPE_HEVC,      /**< HEVC */
+       ESPP_VIDEO_MIME_TYPE_MPEG1,     /**< MPEG1 */
+       ESPP_VIDEO_MIME_TYPE_MPEG2,     /**< MPEG2 */
+       ESPP_VIDEO_MIME_TYPE_MPEG4,     /**< MPEG4 */
+       ESPP_VIDEO_MIME_TYPE_VP8,       /**< VP8 */
+       ESPP_VIDEO_MIME_TYPE_VP9,       /**< VP9 */
+       ESPP_VIDEO_MIME_TYPE_WMV3,      /**< WMV3 */
+       ESPP_VIDEO_MIME_TYPE_AV1,       /**< AV1 */
+       ESPP_VIDEO_MIME_TYPE_MJPEG      /**< MJPEG */
+} espp_video_mime_type_e;
+
+/**
+ * @brief Enumerations for the display type
+ */
+typedef enum {
+       ESPP_DISPLAY_TYPE_NONE,    /**< None */
+       ESPP_DISPLAY_TYPE_OVERLAY, /**< Overlay */
+       ESPP_DISPLAY_TYPE_EVAS,    /**< Evas */
+       ESPP_DISPLAY_TYPE_MIXER,   /**< Mixer */
+} espp_display_type_e;
+
+/**
+ * @brief Enumerations for the display mode
+ */
+typedef enum {
+       ESPP_DISPLAY_MODE_LETTER_BOX,       /**< Letter box */
+       ESPP_DISPLAY_MODE_ORIGIN_SIZE,      /**< Origin size */
+       ESPP_DISPLAY_MODE_FULL_SCREEN,      /**< Full screen */
+       ESPP_DISPLAY_MODE_CROPPED_FULL,     /**< Cropped full */
+       ESPP_DISPLAY_MODE_ORIGIN_OR_LETTER, /**< Origin size or letter box */
+       ESPP_DISPLAY_MODE_DST_ROI,          /**< Destination RoI */
+} espp_display_mode_e;
+
+/**
+ * @brief  Enumerations for the display rotation angle
+ */
+typedef enum {
+       ESPP_DISPLAY_ROTATION_ANGLE_0,      /**< Rotation angle 0 */
+       ESPP_DISPLAY_ROTATION_ANGLE_90,     /**< Rotation angle 90 */
+       ESPP_DISPLAY_ROTATION_ANGLE_180,    /**< Rotation angle 180 */
+       ESPP_DISPLAY_ROTATION_ANGLE_270,    /**< Rotation angle 270 */
+} espp_display_rotation_angle_e;
+
+/**
+ * @brief Enumerations for decoded video buffer type
+ */
+typedef enum {
+       ESPP_DECODED_VIDEO_FRAME_BUFFER_TYPE_NONE,            /**< None */
+       ESPP_DECODED_VIDEO_FRAME_BUFFER_TYPE_MANUAL_COPY = 4, /**< Manual copy */
+} espp_decoded_video_frame_buffer_type_e;
+
+/**
+ * @brief Enumerations for the buffer status
+ */
+typedef enum {
+       ESPP_BUFFER_STATUS_UNDERRUN,   /**< Underrun */
+       ESPP_BUFFER_STATUS_OVERRUN,    /**< Overrun */
+} espp_buffer_status_e;
+
+/**
+ * @brief  Enumerations for buffer size type
+ */
+typedef enum {
+       ESPP_BUFFER_SIZE_TYPE_AUDIO_MAX_TIME,            /**< The maximum amount of data for audio (in ms) */
+       ESPP_BUFFER_SIZE_TYPE_VIDEO_MAX_TIME,            /**< The maximum amount of data for video (in ms) */
+       ESPP_BUFFER_SIZE_TYPE_AUDIO_MIN_TIME_THRESHOLD,  /**< Emit underrun when queued bytes drops below the percent of the audio max time (in %) */
+       ESPP_BUFFER_SIZE_TYPE_VIDEO_MIN_TIME_THRESHOLD,  /**< Emit underrun when queued bytes drops below the percent of the video max time (in %) */
+       ESPP_BUFFER_SIZE_TYPE_AUDIO_MAX_BYTE,            /**< The maximum amount of data for audio (in bytes) */
+       ESPP_BUFFER_SIZE_TYPE_VIDEO_MAX_BYTE,            /**< The maximum amount of data for video (in bytes) */
+       ESPP_BUFFER_SIZE_TYPE_AUDIO_MIN_BYTE_THRESHOLD,  /**< Emit underrun when queued bytes drops below the percent of the audio max bytes size (in %) */
+       ESPP_BUFFER_SIZE_TYPE_VIDEO_MIN_BYTE_THRESHOLD,  /**< Emit underrun when queued bytes drops below the percent of the video max bytes size (in %) */
+} espp_buffer_size_type_e;
+
+/**
+ * @brief Enumerations for the submit error
+ */
+typedef enum {
+       ESPP_SUBMIT_ERROR_NOT_PREPARED,    /**< Not prepared */
+       ESPP_SUBMIT_ERROR_INVALID_PACKET,  /**< Invalid packet */
+       ESPP_SUBMIT_ERROR_OUT_OF_MEMORY,   /**< Out of memory */
+       ESPP_SUBMIT_ERROR_FULL,            /**< Full */
+} espp_submit_error_e;
+
+/**
+ * @brief Enumerations for low latency mode
+ */
+typedef enum {
+       ESPP_LOW_LATENCY_MODE_NONE                 = 0x0000, /**< None */
+       ESPP_LOW_LATENCY_MODE_AUDIO                = 0x0001, /**< For audio fast decoding/rendering */
+       ESPP_LOW_LATENCY_MODE_VIDEO                = 0x0010, /**< For video fast decoding/rendering. Video stream should be composed only of P and I frames. */
+       ESPP_LOW_LATENCY_MODE_VIDEO_DISTORTION_CONCEALMENT = /**< For video fast decoding/rendering and video distortion concealment. Video stream should be composed only of P and I frames. */
+               ESPP_LOW_LATENCY_MODE_VIDEO | 0x0020,
+       ESPP_LOW_LATENCY_MODE_DISABLE_SYNC         = 0x0100, /**< To disable clock sync and a/v sync when rendering. It includes #ESPP_LOW_LATENCY_MODE_DISABLE_PREROLL. */
+       ESPP_LOW_LATENCY_MODE_DISABLE_PREROLL      = 0x0200, /**< To disable preroll which does not wait for the first buffer when state is changed to #ESPP_STATE_READY from #ESPP_STATE_IDLE. */
+       ESPP_LOW_LATENCY_MODE_ENABLE_GAME_MODE =             /**< To set game mode for the minimum latency. Video stream should be composed only of P and I frames. */
+               ESPP_LOW_LATENCY_MODE_AUDIO |
+               ESPP_LOW_LATENCY_MODE_VIDEO | 0x2000,
+       ESPP_LOW_LATENCY_MODE_ENABLE_GAME_MODE_WITH_FIXED_RESOLUTION = /**< To set game mode for latency. Video stream should be composed only of P and I frames. Video stream must use fixed resolution. */
+               ESPP_LOW_LATENCY_MODE_ENABLE_GAME_MODE | 0x4000,
+} espp_low_latency_mode_e;
+
+/**
+ * @brief Audio stream information structure
+ */
+typedef struct {
+       char *codec_data;
+       uint32_t codec_data_length;
+       espp_audio_mime_type_e mime_type;
+       uint32_t bitrate;
+       uint32_t channels;
+       uint32_t sample_rate;
+} espp_audio_stream_info_s;
+
+/**
+ * @brief Video stream information structure
+ */
+typedef struct {
+       char *codec_data;
+       uint32_t codec_data_length;
+       espp_video_mime_type_e mime_type;
+       uint32_t width;
+       uint32_t height;
+       uint32_t max_width;
+       uint32_t max_height;
+       uint32_t framerate_num;
+       uint32_t framerate_den;
+} espp_video_stream_info_s;
+
+/**
+ * @brief ESPP packet structure
+ */
+typedef struct {
+       espp_stream_type_e type;
+       char *buffer;
+       uint32_t buffer_size;
+       uint64_t pts;
+       uint64_t duration;
+       void *matroska_color_info; /* FIXME: add matroska_color structure if needed */
+       uint32_t hdr10p_metadata_size;
+       char *hdr10p_metadata;
+} espp_packet_s;
+
+/**
+ * @brief Called when when the ESPP service client handle is prepared to receive ESPP packets after calling espp_client_prepare_async().
+ * @param[in] stream_type  The stream type
+ * @param[in] user_data    The user data passed from the callback registration function
+ * @see espp_client_set_ready_to_prepare_cb()
+ * @see espp_client_submit_packet()
+ */
+typedef void (*espp_ready_to_prepare_cb)(espp_stream_type_e stream_type, void *user_data);
+
+/**
+ * @brief Called when the ESPP service client handle is prepared to be started.
+ * @param[in] result       The result (@c true = success, @c false = failure)
+ * @param[in] user_data    The user data passed from the callback registration function
+ * @see espp_client_set_prepare_async_done_cb()
+ * @see espp_client_submit_packet()
+ */
+typedef void (*espp_prepare_async_done_cb)(bool result, void *user_data);
+
+/**
+ * @brief Called when the ESPP service client handle is prepared to receive ESPP packets after calling espp_client_seek().
+ * @param[in] stream_type  The stream type
+ * @param[in] time_ms      The seek time in milliseconds
+ * @param[in] user_data    The user data passed from the callback registration function
+ * @see espp_client_set_ready_to_seek_cb()
+ * @see espp_client_seek()
+ * @see espp_client_submit_packet()
+ */
+typedef void (*espp_ready_to_seek_cb)(espp_stream_type_e stream_type, uint64_t time_ms, void *user_data);
+
+/**
+ * @brief Called when the seek operation of the ESPP service client handle has been finished.
+ * @param[in] user_data    The user data passed from the callback registration function
+ * @see espp_client_set_seek_done_cb()
+ * @see espp_client_seek()
+ * @see espp_client_submit_packet()
+ */
+typedef void (*espp_seek_done_cb)(void *user_data);
+
+/**
+ * @brief Called when the ESPP service client handle has reached the end of stream.
+ * @param[in] user_data    The user data passed from the callback registration function
+ * @see espp_client_set_eos_cb()
+ */
+typedef void (*espp_eos_cb)(void *user_data);
+
+/**
+ * @brief Called when the buffer of the ESPP service client handle faces underrun or overrun condition.
+ * @param[in] stream_type    The stream type
+ * @param[in] buffer_status  The buffer status
+ * @param[in] user_data      The user data passed from the callback registration function
+ * @see espp_client_set_buffer_status_cb()
+ */
+typedef void (*espp_buffer_status_cb)(espp_stream_type_e stream_type, espp_buffer_status_e buffer_status, void *user_data);
+
+/**
+ * @brief Called when an image is captured by espp_client_take_snapshot().
+ * @remarks The @a espp is the same object for which the callback was set.\n
+ *          The @a espp should not be released.\n
+ *          The @a data should not be released. The @a data can be used only in the callback. To use outside, make a copy.
+ * @param[in] espp       ESPP service client handle
+ * @param[in] data       The snapshot image data (24-bit RGB)
+ * @param[in] width      The snapshot image width
+ * @param[in] height     The snapshot image height
+ * @param[in] size       The size of @a data
+ * @param[in] user_data  The user data passed from the callback registration function
+ * @see espp_client_take_snapshot()
+ */
+typedef void (*espp_snapshot_cb)(espp_h espp, const char *data, int width, int height, unsigned int size, void *user_data);
+
+/**
+ * @brief Called when a H/W resource of the ESPP service client handle has been conflicted.
+ * @param[in] user_data    The user data passed from the callback registration function
+ * @see espp_client_set_resource_conflicted_cb()
+ */
+typedef void (*espp_resource_conflicted_cb)(void *user_data);
+
+/**
+ * @brief Called when an error occurs.
+ * @param[in] error        The error value
+ * @param[in] user_data    The user data passed from the callback registration function
+ * @see espp_client_set_error_cb()
+ */
+typedef void (*espp_error_cb)(espp_client_error_e error, void *user_data);
+
+/**
+ * @brief Sets a callback function to be invoked when the ESPP service client handle is prepared to receive ESPP packets after calling espp_client_prepare_async().
+ * @param[in] espp       ESPP service client handle
+ * @param[in] callback   Callback function pointer
+ * @param[in] user_data  The user data to be passed to the callback function
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @post espp_ready_to_prepare_cb() will be invoked.
+ * @see espp_client_prepare_async()
+ * @see espp_client_submit_packet()
+ */
+int espp_client_set_ready_to_prepare_cb(espp_h espp, espp_ready_to_prepare_cb callback, void *user_data);
+
+/**
+ * @brief Sets a callback function to be invoked when the ESPP service client handle is prepared to be started.
+ * @param[in] espp       ESPP service client handle
+ * @param[in] callback   Callback function pointer
+ * @param[in] user_data  The user data to be passed to the callback function
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @post espp_prepare_async_done_cb() will be invoked.
+ * @see espp_client_submit_packet()
+ */
+int espp_client_set_prepare_async_done_cb(espp_h espp, espp_prepare_async_done_cb callback, void *user_data);
+
+/**
+ * @brief Sets a callback function to be invoked when the ESPP service client handle is prepared to receive ESPP packets after calling espp_client_seek().
+ * @param[in] espp       ESPP service client handle
+ * @param[in] callback   Callback function pointer
+ * @param[in] user_data  The user data to be passed to the callback function
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The state must be #ESPP_STATE_NONE or #ESPP_STATE_IDLE.
+ * @post espp_ready_to_seek_cb() will be invoked.
+ * @see espp_client_seek()
+ * @see espp_client_submit_packet()
+ */
+int espp_client_set_ready_to_seek_cb(espp_h espp, espp_ready_to_seek_cb callback, void *user_data);
+
+/**
+ * @brief Sets a callback function to be invoked when the seek operation of the ESPP service client handle has been finished.
+ * @param[in] espp       ESPP service client handle
+ * @param[in] callback   Callback function pointer
+ * @param[in] user_data  The user data to be passed to the callback function
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @post espp_seek_done_cb() will be invoked.
+ * @see espp_client_seek()
+ * @see espp_client_submit_packet()
+ */
+int espp_client_set_seek_done_cb(espp_h espp, espp_seek_done_cb callback, void *user_data);
+
+/**
+ * @brief Sets a callback function to be invoked when the ESPP service client handle has reached the end of stream.
+ * @param[in] espp       ESPP service client handle
+ * @param[in] callback   Callback function pointer
+ * @param[in] user_data  The user data to be passed to the callback function
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @post espp_eos_cb() will be invoked.
+ */
+int espp_client_set_eos_cb(espp_h espp, espp_eos_cb callback, void *user_data);
+
+/**
+ * @brief Sets a callback function to be invoked when the buffer of the ESPP service client handle faces underrun or overflow condition.
+ * @param[in] espp       ESPP service client handle
+ * @param[in] callback   Callback function pointer
+ * @param[in] user_data  The user data to be passed to the callback function
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @post espp_buffer_status_cb() will be invoked.
+ */
+int espp_client_set_buffer_status_cb(espp_h espp, espp_buffer_status_cb callback, void *user_data);
+
+/**
+ * @brief Sets a callback function to be invoked when a H/W resource of the ESPP service client handle has been conflicted.
+ * @param[in] espp       ESPP service client handle
+ * @param[in] callback   Callback function pointer
+ * @param[in] user_data  The user data to be passed to the callback function
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @post espp_resource_conflicted_cb() will be invoked.
+ */
+int espp_client_set_resource_conflicted_cb(espp_h espp, espp_resource_conflicted_cb callback, void *user_data);
+
+/**
+ * @brief Sets a callback function to be invoked when an error occurs.
+ * @param[in] espp       ESPP service client handle
+ * @param[in] callback   Callback function pointer
+ * @param[in] user_data  The user data to be passed to the callback function
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The state must be #ESPP_STATE_NONE or #ESPP_STATE_IDLE.
+ * @post espp_error_cb() will be invoked.
+ */
+int espp_client_set_error_cb(espp_h espp, espp_error_cb callback, void *user_data);
+
+/**
+ * @brief Creates an instance of ESPP service client.
+ * @param[out] espp    ESPP service client handle
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @see espp_client_destroy()
+ */
+int espp_client_create(espp_h *espp);
+
+/**
+ * @brief Destroys the ESPP service client handle.
+ * @param[in] espp    ESPP service client handle
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @see espp_client_create()
+ */
+int espp_client_destroy(espp_h espp);
+
+/**
+ * @brief Opens the ESPP service client handle.
+ * @param[in] espp    ESPP service client handle
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre Functions for setting callbacks must be called before calling this function.\n
+ *      The state must be #ESPP_STATE_NONE.
+ * @post The state will be #ESPP_STATE_IDLE.
+ * @see espp_client_create()
+ * @see espp_client_close()
+ */
+int espp_client_open(espp_h espp);
+
+/**
+ * @brief Closes the ESPP service client handle.
+ * @param[in] espp    ESPP service client handle
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The state must be one of espp_state_e values except #ESPP_STATE_NONE.
+ * @post The state will be #ESPP_STATE_NONE.
+ * @see espp_client_open()
+ * @see espp_client_stop()
+ */
+int espp_client_close(espp_h espp);
+
+/**
+ * @brief Starts the ESPP service client handle.
+ * @param[in] espp    ESPP service client handle
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The state must be #ESPP_STATE_READY.
+ * @post The state will be #ESPP_STATE_PLAYING.
+ * @see espp_client_create()
+ * @see espp_client_set_audio_stream_info()
+ * @see espp_client_set_video_stream_info()
+ * @see espp_client_prepare_async()
+ * @see espp_client_stop()
+ * @see espp_client_pause()
+ * @see espp_client_resume()
+ */
+int espp_client_start(espp_h espp);
+
+/**
+ * @brief Stops the ESPP service client handle.
+ * @remarks espp_client_close() must be called after this handle is stopped.
+ * @param[in] espp    ESPP service client handle
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The state must be one of espp_state_e values except #ESPP_STATE_NONE.
+ * @post The state will be #ESPP_STATE_IDLE.
+ * @see espp_client_start()
+ * @see espp_client_close()
+ * @see espp_client_pause()
+ * @see espp_client_resume()
+ */
+int espp_client_stop(espp_h espp);
+
+/**
+ * @brief Pauses the ESPP service client handle.
+ * @param[in] espp    ESPP service client handle
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The state must be one of #ESPP_STATE_READY or #ESPP_STATE_PAUSED or #ESPP_STATE_PLAYING.
+ * @post The state will be #ESPP_STATE_PAUSED.
+ * @see espp_client_start()
+ * @see espp_client_stop()
+ * @see espp_client_resume()
+ */
+int espp_client_pause(espp_h espp);
+
+/**
+ * @brief Resumes the ESPP service client handle.
+ * @param[in] espp    ESPP service client handle
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The state must be #ESPP_STATE_PAUSED or #ESPP_STATE_PLAYING.
+ * @post The state will be #ESPP_STATE_PLAYING.
+ * @see espp_client_start()
+ * @see espp_client_stop()
+ * @see espp_client_pause()
+ */
+int espp_client_resume(espp_h espp);
+
+/**
+ * @brief Prepares the ESPP service client handle asynchronously.
+ * @param[in] espp    ESPP service client handle
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The state must be #ESPP_STATE_IDLE.
+ * @post espp_client_prepare_async_done_cb() will be called when the preparation is finished.\n
+ *       If the result is success, the state will be #ESPP_STATE_READY.
+ * @see espp_client_set_audio_stream_info()
+ * @see espp_client_set_video_stream_info()
+ * @see espp_client_start()
+ */
+int espp_client_prepare_async(espp_h espp);
+
+/**
+ * @brief Seeks playback to a given time in milliseconds
+ * @remarks In ESPP_STATE_IDLE, this function can be called between espp_client_open() and espp_client_prepare_async().\n
+ *          The playback start time can be set in case of the first playback without calling espp_seek_done_cb().
+ * @param[in] espp    ESPP service client handle
+ * @param[in] time_ms Destination time to seek
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The state must be one of #ESPP_STATE_READY or #ESPP_STATE_PAUSED or #ESPP_STATE_PLAYING.
+ * @post espp_client_seek_done_cb() will be called when the seek operation is finished.
+ * @see espp_client_set_seek_done_cb()
+ */
+int espp_client_seek(espp_h espp, uint64_t time_ms);
+
+/**
+ * @brief Gets the current stats of the ESPP service client handle.
+ * @param[in] espp    ESPP service client handle
+ * @param[out] state  The state of the handle
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @see espp_client_create()
+ */
+int espp_client_get_state(espp_h espp, espp_state_e *state);
+
+/**
+ * @brief Gets the current playing time of the ESPP service client handle.
+ * @param[in] espp      ESPP service client handle
+ * @param[out] time_ms  The playing time in milliseconds
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The state must be #ESPP_STATE_PAUSED or #ESPP_STATE_PLAYING.
+ * @see espp_client_prepare_async()
+ */
+int espp_client_get_playing_time(espp_h espp, uint64_t *time_ms);
+
+/**
+ * @brief Sets the audio stream information to the ESPP service client handle.
+ * @remarks This function must be called before calling the espp_client_prepare_async().
+ * @param[in] espp    ESPP service client handle
+ * @param[in] info    Audio stream information structure pointer
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @see espp_client_prepare_async()
+ * @see espp_client_set_video_stream_info()
+ */
+int espp_client_set_audio_stream_info(espp_h espp, espp_audio_stream_info_s *info);
+
+/**
+ * @brief Sets the video stream information to the ESPP service client handle.
+ * @remarks This function must be called before calling the espp_client_prepare_async().
+ * @param[in] espp    ESPP service client handle
+ * @param[in] info    Video stream information structure pointer
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @see espp_client_prepare_async()
+ * @see espp_client_set_audio_stream_info()
+ */
+int espp_client_set_video_stream_info(espp_h espp, espp_video_stream_info_s *info);
+
+/**
+ * @brief Sets the playback rate.
+ * @remarks User has to push the data as fast as playback rate.
+ * @param[in] espp       ESPP service client handle
+ * @param[in] rate       The playback rate from 0.0 to 2.0
+ * @param[in] mute_audio Mute audio or not (@c true = mute, @c false = not mute)
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The state must be one of #ESPP_STATE_READY or #ESPP_STATE_PAUSED or #ESPP_STATE_PLAYING.
+ * @see espp_client_prepare_async()
+ */
+int espp_client_set_playback_rate(espp_h espp, double rate, bool mute_audio);
+
+/**
+ * @brief Sets the video display surface id.
+ * @param[in] espp       ESPP service client handle
+ * @param[in] type       The display type
+ * @param[in] surface_id Resource id of window
+ * @param[in] x          The x coordinate of window
+ * @param[in] y          The y coordinate of window
+ * @param[in] w          The width of window
+ * @param[in] h          The height of window
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @see espp_client_set_display_mode()
+ * @see espp_client_set_display_roi()
+ * @see espp_client_set_display_visible()
+ * @see espp_client_set_display_rotation()
+ */
+int espp_client_set_display_surface_id(espp_h espp, espp_display_type_e type, unsigned int surface_id, int x, int y, int w, int h);
+
+/**
+ * @brief Sets the video display mode.
+ * @param[in] espp    ESPP service client handle
+ * @param[in] mode    The display mode
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre espp_client_open() must be called before calling this function.
+ * @see espp_client_open()
+ * @see espp_client_set_display_surface_id()
+ * @see espp_client_set_display_roi()
+ * @see espp_client_set_display_rotation()
+ */
+int espp_client_set_display_mode(espp_h espp, espp_display_mode_e mode);
+
+/**
+ * @brief Sets the video display RoI(Region of Interest).
+ * @param[in] espp       ESPP service client handle
+ * @param[in] x          The starting x coordinate of RoI on the video source
+ * @param[in] y          The starting y coordinate of RoI on the video source
+ * @param[in] w          The width of RoI on the video source
+ * @param[in] h          The height of RoI on the video source
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre #ESPP_DISPLAY_MODE_DST_ROI must be set by espp_client_set_display_mode() before calling this function.
+ * @see espp_client_set_display_surface_id()
+ * @see espp_client_set_display_mode()
+ * @see espp_client_set_display_rotation()
+ */
+int espp_client_set_display_roi(espp_h espp, int x, int y, int w, int h);
+
+/**
+ * @brief Sets the video display visibility.
+ * @param[in] espp       ESPP service client handle
+ * @param[in] visible    The visibility of the display (@c true = visible, @c false = invisible)
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @see espp_client_set_display_surface_id()
+ */
+int espp_client_set_display_visible(espp_h espp, bool visible);
+
+/**
+ * @brief Set the rotate angle of the video display.
+ * @param[in] espp       ESPP service client handle
+ * @param[in] angle      The rotation angle of the display
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @see espp_client_set_display_surface_id()
+ * @see espp_client_set_display_mode()
+ * @see espp_client_set_display_roi()
+ */
+int espp_client_set_display_rotation(espp_h espp, espp_display_rotation_angle_e angle);
+
+/**
+ * @brief Sets mute of the audio stream.
+ * @param[in] espp    ESPP service client handle
+ * @param[in] mute    Mute or not (@c true = mute, @c false = not mute)
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre espp_client_open() must be called before calling this function.
+ * @see espp_client_open()
+ */
+int espp_client_set_audio_mute(espp_h espp, bool mute);
+
+/**
+ * @brief Sets volume of the audio stream.
+ * @param[in] espp    ESPP service client handle
+ * @param[in] volume  Volume level from 0 to 100
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre espp_client_open() must be called before calling this function.
+ * @see espp_client_open()
+ * @see espp_client_get_audio_volume()
+ */
+int espp_client_set_audio_volume(espp_h espp, int volume);
+
+/**
+ * @brief Gets the current volume of the audio stream.
+ * @param[in] espp    ESPP service client handle
+ * @param[out] volume  Volume level from 0 to 100
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre espp_client_open() must be called before calling this function.
+ * @see espp_client_open()
+ * @see espp_client_set_audio_volume()
+ */
+int espp_client_get_audio_volume(espp_h espp, int *volume);
+
+/**
+ * @brief Submits ESPP packet.
+ * @param[in] espp    ESPP service client handle
+ * @param[in] packet  ESPP packet pointer
+ * @param[out] error  ESPP packet submit error (optional, this can be NULL)
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre This function must be called after espp_ready_to_prepare_cb() or espp_ready_to_seek_cb() is invoked.
+ * @see espp_ready_to_prepare_cb()
+ * @see espp_ready_to_seek_cb()
+ * @see espp_buffer_status_cb()
+ */
+int espp_client_submit_packet(espp_h espp, espp_packet_s *packet, espp_submit_error_e *error);
+
+/**
+ * @brief Generates EoS(End of Stream) packet and submits it.
+ * @param[in] espp         ESPP service client handle
+ * @param[in] stream_type  The stream type that reaches EoS
+ * @param[out] error       ESPP packet submit error (optional, this can be NULL)
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @see espp_ready_to_prepare_cb()
+ * @see espp_ready_to_seek_cb()
+ * @see espp_buffer_status_cb()
+ */
+int espp_client_submit_eos_packet(espp_h espp, espp_stream_type_e stream_type, espp_submit_error_e *error);
+
+/**
+ * @brief Sets buffer size.
+ * @param[in] espp    ESPP service client handle
+ * @param[in] type    The buffer size type to be set
+ * @param[in] size    The size of the selected buffer type
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre espp_client_open() must be called before calling this function.
+ * @see espp_open()
+ */
+int espp_client_set_buffer_size(espp_h espp, espp_buffer_size_type_e size_type, uint64_t size);
+
+/**
+ * @brief Sets low latency mode, multiple modes can be set.
+ * @param[in] espp    ESPP service client handle
+ * @param[in] mode    One of the low latency mode to be set
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre espp_client_open() must be called before calling this function.
+ * @see espp_open()
+ */
+int espp_client_set_low_latency_mode(espp_h espp, espp_low_latency_mode_e mode);
+
+/**
+ * @brief Sets the decoded video frame buffer type.
+ * @param[in] espp    ESPP service client handle
+ * @param[in] type    The video frame buffer type
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre espp_client_open() must be called before calling this function.
+ * @see espp_client_open()
+ */
+int espp_client_set_decoded_video_frame_buffer_type(espp_h espp, espp_decoded_video_frame_buffer_type_e type);
+
+/**
+ * @brief Takes a snapshot asynchronously.
+ * @param[in] espp     ESPP service client handle
+ * @param[in] callback    Callback function pointer
+ * @param[in] user_data   The user data to be passed to the callback function
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre #ESPP_DECODED_VIDEO_FRAME_BUFFER_TYPE_MANUAL_COPY must be set by espp_client_set_decoded_video_frame_buffer_type() before calling this function.
+ * @see espp_client_set_decoded_video_frame_buffer_type()
+ */
+int espp_client_take_snapshot(espp_h espp, espp_snapshot_cb callback, void *user_data);
+
+/**
+ * @brief Sets the render time offset of the stream type.
+ * @remarks The default value of @a time_offset_ms is 0 and the valid range is between INT64_MIN/1000000 and INT64_MAX/1000000.
+ * @param[in] espp           ESPP service client handle
+ * @param[in] stream_type    The stream type to set render time offset
+ * @param[in] time_offset_ms Render time offset in milliseconds
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The state must be one of #ESPP_STATE_READY or #ESPP_STATE_PAUSED or #ESPP_STATE_PLAYING.
+ * @pre Low latency mode has to be set except for #ESPP_LOW_LATENCY_MODE_NONE and #ESPP_LOW_LATENCY_MODE_DISABLE_SYNC.
+ * @see espp_client_prepare_async()
+ * @see espp_client_set_low_latency_mode()
+ */
+int espp_client_set_render_time_offset(espp_h espp, espp_stream_type_e stream_type, int64_t time_offset_ms);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __ESPP_SERVICE_CLIENT_H__ */
+
diff --git a/agent/espp-service/src/client/espp_service_client_event_handler.c b/agent/espp-service/src/client/espp_service_client_event_handler.c
new file mode 100644 (file)
index 0000000..efc4ee2
--- /dev/null
@@ -0,0 +1,363 @@
+/*
+ * Copyright (c) 2023 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 "espp_service_client_priv.h"
+
+typedef void (*func_handler) (espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result);
+
+static void __handle_event_msg(espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result)
+{
+       int ret;
+       g_autofree gchar *msg = NULL;
+
+       ASSERT(espp);
+       ASSERT(data);
+       ASSERT(result);
+
+       result->ret = -1;
+
+       ret = espp_service_client_msg_parse_params(data->params, data->event, &msg);
+       if (ret != 0)
+               return;
+
+       LOG_INFO("msg[%s]", msg);
+
+       result->ret = 0;
+}
+
+static void __handle_event_cb_ready_to_prepare(espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result)
+{
+       int ret;
+       espp_stream_type_e stream_type;
+
+       ASSERT(espp);
+       ASSERT(data);
+       ASSERT(result);
+
+       result->ret = -1;
+
+       ret = espp_service_client_msg_parse_params(data->params, data->event, &stream_type);
+       if (ret != 0)
+               return;
+
+       LOG_INFO("cb params[stream_type:%d]", stream_type);
+
+       if (espp->ready_to_prepare_cb.callback) {
+               LOG_DEBUG(">>> callback[%p] user_data[%p]", espp->ready_to_prepare_cb.callback, espp->ready_to_prepare_cb.user_data);
+               ((espp_ready_to_prepare_cb)(espp->ready_to_prepare_cb.callback))(stream_type, espp->ready_to_prepare_cb.user_data);
+               LOG_DEBUG("<<< end of the callback");
+       }
+
+       result->ret = 0;
+}
+
+static void __handle_event_cb_prepare_async_done(espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result)
+{
+       int ret;
+       bool _result;
+
+       ASSERT(espp);
+       ASSERT(data);
+       ASSERT(result);
+
+       result->ret = -1;
+
+       ret = espp_service_client_msg_parse_params(data->params, data->event, &_result);
+       if (ret != 0)
+               return;
+
+       LOG_INFO("cb params[result:%d]", _result);
+
+       if (espp->prepare_async_done_cb.callback) {
+               LOG_DEBUG(">>> callback[%p] user_data[%p]", espp->prepare_async_done_cb.callback, espp->prepare_async_done_cb.user_data);
+               ((espp_prepare_async_done_cb)(espp->prepare_async_done_cb.callback))(_result, espp->prepare_async_done_cb.user_data);
+               LOG_DEBUG("<<< end of the callback");
+       }
+
+       result->ret = 0;
+}
+
+static void __handle_event_cb_ready_to_seek(espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result)
+{
+       int ret;
+       espp_stream_type_e stream_type;
+       uint64_t time_ms;
+
+       ASSERT(espp);
+       ASSERT(data);
+       ASSERT(result);
+
+       ret = espp_service_client_msg_parse_params(data->params, data->event, &stream_type, &time_ms);
+       if (ret != 0)
+               return;
+
+       LOG_INFO("cb params[stream_type:%d, time_ms:%" PRIu64 "]", stream_type, time_ms);
+
+       if (espp->ready_to_seek_cb.callback) {
+               LOG_DEBUG(">>> callback[%p] user_data[%p]", espp->ready_to_seek_cb.callback, espp->ready_to_seek_cb.user_data);
+               ((espp_ready_to_seek_cb)(espp->ready_to_seek_cb.callback))(stream_type, time_ms, espp->ready_to_seek_cb.user_data);
+               LOG_DEBUG("<<< end of the callback");
+       }
+
+       result->ret = 0;
+}
+
+static void __handle_event_cb_seek_done(espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result)
+{
+       ASSERT(espp);
+       ASSERT(data);
+       ASSERT(result);
+
+       if (espp->seek_done_cb.callback) {
+               LOG_DEBUG(">>> callback[%p] user_data[%p]", espp->seek_done_cb.callback, espp->seek_done_cb.user_data);
+               ((espp_seek_done_cb)(espp->seek_done_cb.callback))(espp->seek_done_cb.user_data);
+               LOG_DEBUG("<<< end of the callback");
+       }
+
+       result->ret = 0;
+}
+
+static void __handle_event_cb_eos(espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result)
+{
+       ASSERT(espp);
+       ASSERT(data);
+       ASSERT(result);
+
+       if (espp->eos_cb.callback) {
+               LOG_DEBUG(">>> callback[%p] user_data[%p]", espp->eos_cb.callback, espp->eos_cb.user_data);
+               ((espp_eos_cb)(espp->eos_cb.callback))(espp->eos_cb.user_data);
+               LOG_DEBUG("<<< end of the callback");
+       }
+
+       result->ret = 0;
+}
+
+static void __handle_event_cb_buffer_status(espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result)
+{
+       int ret;
+       espp_stream_type_e stream_type;
+       espp_buffer_status_e buffer_status;
+
+       ASSERT(espp);
+       ASSERT(data);
+       ASSERT(result);
+
+       result->ret = -1;
+
+       ret = espp_service_client_msg_parse_params(data->params, data->event, &stream_type, &buffer_status);
+       if (ret != 0)
+               return;
+
+       LOG_INFO("cb params[stream_type:%d, buffer_status:%d]", stream_type, buffer_status);
+
+       if (espp->buffer_status_cb.callback) {
+               LOG_DEBUG(">>> callback[%p] user_data[%p]", espp->buffer_status_cb.callback, espp->buffer_status_cb.user_data);
+               ((espp_buffer_status_cb)(espp->buffer_status_cb.callback))(stream_type, buffer_status, espp->buffer_status_cb.user_data);
+               LOG_DEBUG("<<< end of the callback");
+       }
+
+       result->ret = 0;
+}
+
+static void __handle_event_cb_resource_conflicted(espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result)
+{
+       ASSERT(espp);
+       ASSERT(data);
+       ASSERT(result);
+
+       if (espp->resource_conflicted_cb.callback) {
+               LOG_DEBUG(">>> callback[%p] user_data[%p]", espp->resource_conflicted_cb.callback, espp->resource_conflicted_cb.user_data);
+               ((espp_resource_conflicted_cb)(espp->resource_conflicted_cb.callback))(espp->resource_conflicted_cb.user_data);
+               LOG_DEBUG("<<< end of the callback");
+       }
+
+       result->ret = 0;
+}
+
+static void __handle_event_cb_error(espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result)
+{
+       int ret;
+       espp_client_error_e error;
+
+       ASSERT(espp);
+       ASSERT(data);
+       ASSERT(result);
+
+       result->ret = -1;
+
+       ret = espp_service_client_msg_parse_params(data->params, data->event, &error);
+       if (ret != 0)
+               return;
+
+       LOG_INFO("cb params[error:%d]", error);
+
+       if (espp->error_cb.callback) {
+               LOG_DEBUG(">>> callback[%p] user_data[%p]", espp->error_cb.callback, espp->error_cb.user_data);
+               ((espp_error_cb)(espp->error_cb.callback))(error, espp->error_cb.user_data);
+               LOG_DEBUG("<<< end of the callback");
+       }
+
+       result->ret = 0;
+}
+
+static int __read_buffer(int fd, gchar *buffer, uint32_t size)
+{
+       int ret;
+       uint32_t total = 0;
+       char str_error[MAX_ERROR_LEN] = {'\0',};
+
+       ASSERT(fd >= 0);
+       ASSERT(buffer);
+
+       do {
+               if ((ret = read(fd, buffer + total, size - total)) < 0) {
+                       strerror_r(errno, str_error, sizeof(str_error));
+                       LOG_ERROR("failed to read(), fd[%d], ret[%d], err: %s", fd, ret, str_error);
+                       break;
+               }
+               total += ret;
+       } while (total < size);
+
+       if (total != size) {
+               LOG_ERROR("total[%u], expected size[%u]", total, size);
+               return -1;
+       }
+
+       LOG_DEBUG("fd[%d] buffer[%p, size:%u]", fd, buffer, size);
+
+       return 0;
+}
+
+static void __handle_event_cb_snapshot(espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result)
+{
+       int ret;
+       int32_t cb_id;
+       uint32_t width;
+       uint32_t height;
+       uint32_t size;
+       g_autofree gchar *buffer = NULL;
+       g_autofree gint *id = NULL;
+       espp_callback_s *cb_data;
+
+       ASSERT(espp);
+       ASSERT(data);
+       ASSERT(result);
+
+       result->ret = -1;
+
+       ret = espp_service_client_msg_parse_params(data->params, data->event, &cb_id, &width, &height, &size);
+       if (ret != 0)
+               return;
+
+       LOG_INFO("cb params[cb_id:%d, width:%u, height:%u, size:%u]", cb_id, width, height, size);
+
+       buffer = g_malloc0(size);
+       if (__read_buffer(espp->event_fd, buffer, size) != 0)
+               return;
+
+       id = g_new(gint, 1);
+       *id = cb_id;
+       cb_data = g_hash_table_lookup(espp->snapshot_cbs, id);
+       if (!cb_data) {
+               LOG_ERROR("could not find cb_data of cb_id[%d]", cb_id);
+               return;
+       }
+
+       if (cb_data->callback) {
+               LOG_DEBUG(">>> cb_id[%d] callback[%p] user_data[%p]", cb_id, cb_data->callback, cb_data->user_data);
+               ((espp_snapshot_cb)(cb_data->callback))((espp_h)espp, (const char *)buffer, (int)width, (int)height, (unsigned int)size, cb_data->user_data);
+               LOG_DEBUG("<<< end of the callback");
+       }
+       result->ret = 0;
+}
+
+static func_handler handlers[] = {
+       [ESPP_SERVICE_EVENT_MSG] = __handle_event_msg,
+       [ESPP_SERVICE_EVENT_CB_READY_TO_PREPARE] = __handle_event_cb_ready_to_prepare,
+       [ESPP_SERVICE_EVENT_CB_PREPARE_ASYNC_DONE] = __handle_event_cb_prepare_async_done,
+       [ESPP_SERVICE_EVENT_CB_READY_TO_SEEK] = __handle_event_cb_ready_to_seek,
+       [ESPP_SERVICE_EVENT_CB_SEEK_DONE] = __handle_event_cb_seek_done,
+       [ESPP_SERVICE_EVENT_CB_EOS] = __handle_event_cb_eos,
+       [ESPP_SERVICE_EVENT_CB_BUFFER_STATUS] = __handle_event_cb_buffer_status,
+       [ESPP_SERVICE_EVENT_CB_RESOURCE_CONFLICTED] = __handle_event_cb_resource_conflicted,
+       [ESPP_SERVICE_EVENT_CB_ERROR] = __handle_event_cb_error,
+       [ESPP_SERVICE_EVENT_CB_SNAPSHOT] = __handle_event_cb_snapshot,
+};
+
+static void __func_handler(espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result)
+{
+       ASSERT(espp);
+       ASSERT(data);
+       ASSERT(result);
+       ASSERT(data->event >= 0);
+       ASSERT(data->event < ESPP_SERVICE_EVENT_CB_NUM);
+
+       LOG_WARNING("espp[%p] data[%p, event:%s]", espp, data, espp_service_common_get_events()[data->event].str);
+
+       handlers[data->event](espp, data, result);
+}
+
+gpointer espp_service_client_event_handler_thread_func(gpointer user_data)
+{
+       int ret;
+       const int read_len = sizeof(espp_service_data_from_server_s);
+       const int write_len = sizeof(espp_service_data_from_client_s);
+       char str_error[MAX_ERROR_LEN] = {'\0',};
+       espp_service_data_from_server_s rx_data;
+       espp_service_data_from_client_s tx_data;
+       espp_s *espp = (espp_s *)user_data;
+
+       ASSERT(espp);
+       ASSERT(espp->event_fd >= 0);
+
+       LOG_DEBUG_ENTER();
+
+       while (!espp->event_handler.exit) {
+               LOG_DEBUG("wait for read..");
+
+               memset(&rx_data, 0x00, read_len);
+               if ((ret = read(espp->event_fd, &rx_data, read_len)) <= 0) {
+                       if (errno == EAGAIN) {
+                               LOG_DEBUG("socket might be closed");
+                               goto exit;
+                       }
+                       strerror_r(errno, str_error, sizeof(str_error));
+                       LOG_ERROR("failed to read(), fd[%d], err: %s", espp->event_fd, str_error);
+                       goto exit;
+               }
+
+               ASSERT(rx_data.event >= 0);
+               ASSERT(rx_data.event < ESPP_SERVICE_EVENT_CB_NUM);
+               LOG_DEBUG("<<<<< from fd[%d]: event[%s]", espp->event_fd, espp_service_common_get_events()[rx_data.event].str);
+
+               memset(&tx_data, 0x00, write_len);
+
+               g_mutex_lock(&espp->cb_mutex);
+               __func_handler(espp, &rx_data, &tx_data);
+               g_mutex_unlock(&espp->cb_mutex);
+
+               LOG_DEBUG(">>>>>> to fd[%d]: tx_data.ret[%d]", espp->event_fd, tx_data.ret);
+
+               if (write(espp->event_fd, &tx_data, write_len) < 0) {
+                       strerror_r(errno, str_error, sizeof(str_error));
+                       LOG_ERROR("failed to write(), fd[%d], err: %s", espp->event_fd, str_error);
+               }
+       }
+
+exit:
+       LOG_DEBUG_LEAVE();
+       return NULL;
+}
diff --git a/agent/espp-service/src/client/espp_service_client_msg.c b/agent/espp-service/src/client/espp_service_client_msg.c
new file mode 100644 (file)
index 0000000..b992479
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2023 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 "espp_service_client_priv.h"
+#include <stdarg.h>
+
+int espp_service_client_msg_parse_params(const char *params, espp_service_event_e event, ...)
+{
+       int ret;
+       va_list ap;
+
+       ASSERT(params);
+       ASSERT(event < ESPP_SERVICE_EVENT_CB_NUM);
+
+       va_start(ap, event);
+       ret = espp_service_common_parse_json_structured_message(ap, params, espp_service_common_get_events()[event].param_formats);
+       va_end(ap);
+
+       return ret;
+}
diff --git a/agent/espp-service/src/client/espp_service_client_priv.h b/agent/espp-service/src/client/espp_service_client_priv.h
new file mode 100644 (file)
index 0000000..b14244b
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2023 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 __ESPP_SERVICE_CLIENT_PRIVATE_H__
+#define __ESPP_SERVICE_CLIENT_PRIVATE_H__
+
+#include "../common/espp_service_common.h"
+#include "../common/espp_service_ipc.h"
+#include "espp_service_client.h"
+#include <unistd.h>
+#include <inttypes.h>
+
+#ifdef USE_DLOG
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "ESPP_SERVICE_CLIENT"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LOG_WARNING_IF_CALLBACK_EXISTS(x_callback) \
+do { \
+       if (x_callback.callback) \
+               LOG_WARNING("previous callback[%p] user_data[%p]", x_callback.callback, x_callback.user_data); \
+} while (0)
+
+typedef struct {
+       void *callback;
+       void *user_data;
+} espp_callback_s;
+
+typedef struct _espp_s {
+       GMutex mutex;
+       GMutex cb_mutex;
+
+       int fd;
+       int event_fd;
+       int snapshot_cb_id;
+
+       struct {
+               GThread *thread;
+               bool exit;
+       } event_handler;
+
+       espp_callback_s ready_to_prepare_cb;
+       espp_callback_s prepare_async_done_cb;
+       espp_callback_s ready_to_seek_cb;
+       espp_callback_s seek_done_cb;
+       espp_callback_s eos_cb;
+       espp_callback_s buffer_status_cb;
+       espp_callback_s resource_conflicted_cb;
+       espp_callback_s error_cb;
+       GHashTable *snapshot_cbs;
+} espp_s;
+
+/* socket */
+int espp_service_client_socket_fd_new(void);
+int espp_service_client_socket_request_init_event(espp_s *espp);
+int espp_service_client_socket_request_deinit_event(espp_s *espp);
+int espp_service_client_socket_request_create(espp_s *espp);
+int espp_service_client_socket_request_destroy(espp_s *espp);
+int espp_service_client_socket_request_open(espp_s *espp);
+int espp_service_client_socket_request_close(espp_s *espp);
+int espp_service_client_socket_request_start(espp_s *espp);
+int espp_service_client_socket_request_stop(espp_s *espp);
+int espp_service_client_socket_request_pause(espp_s *espp);
+int espp_service_client_socket_request_resume(espp_s *espp);
+int espp_service_client_socket_request_prepare_async(espp_s *espp);
+int espp_service_client_socket_request_seek(espp_s *espp, uint64_t time_ms);
+int espp_service_client_socket_request_get_state(espp_s *espp, espp_state_e *state);
+int espp_service_client_socket_request_get_playing_time(espp_s *espp, uint64_t *time_ms);
+int espp_service_client_socket_request_set_audio_stream_info(espp_s *espp, espp_audio_stream_info_s *info);
+int espp_service_client_socket_request_set_video_stream_info(espp_s *espp, espp_video_stream_info_s *info);
+int espp_service_client_socket_request_set_playback_rate(espp_s *espp, double rate, bool mute_audio);
+int espp_service_client_socket_request_set_display_surface_id(espp_s *espp, espp_display_type_e type, unsigned int surface_id, int x, int y, int w, int h);
+int espp_service_client_socket_request_set_display_mode(espp_s *espp, espp_display_mode_e mode);
+int espp_service_client_socket_request_set_display_roi(espp_s *espp, int x, int y, int w, int h);
+int espp_service_client_socket_request_set_display_visible(espp_s *espp, bool visible);
+int espp_service_client_socket_request_set_display_rotation(espp_s *espp, espp_display_rotation_angle_e angle);
+int espp_service_client_socket_request_set_audio_mute(espp_s *espp, bool mute);
+int espp_service_client_socket_request_set_audio_volume(espp_s *espp, int volume);
+int espp_service_client_socket_request_get_audio_volume(espp_s *espp, int *volume);
+int espp_service_client_socket_request_set_callback(espp_s *espp, espp_service_event_e type, void *callback, void *user_data);
+int espp_service_client_socket_request_submit_packet(espp_s *espp, espp_packet_s *packet, espp_submit_error_e *error);
+int espp_service_client_socket_request_submit_eos_packet(espp_s *espp, espp_stream_type_e stream_type, espp_submit_error_e *error);
+int espp_service_client_socket_request_set_buffer_size(espp_s *espp, espp_buffer_size_type_e size_type, uint64_t size);
+int espp_service_client_socket_request_set_low_latency_mode(espp_s *espp, espp_low_latency_mode_e mode);
+int espp_service_client_socket_request_set_decoded_video_frame_buffer_type(espp_s *espp, espp_decoded_video_frame_buffer_type_e type);
+int espp_service_client_socket_request_take_snapshot(espp_s *espp, int id);
+int espp_service_client_socket_request_set_render_time_offset(espp_s *espp, espp_stream_type_e stream_type, int64_t time_offset_ms);
+
+/* event handler */
+gpointer espp_service_client_event_handler_thread_func(gpointer user_data);
+
+/* message */
+int espp_service_client_msg_parse_params(const char *params, espp_service_event_e event, ...);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __ESPP_SERVICE_CLIENT_PRIVATE_H__ */
diff --git a/agent/espp-service/src/client/espp_service_client_socket.c b/agent/espp-service/src/client/espp_service_client_socket.c
new file mode 100644 (file)
index 0000000..9c76a3d
--- /dev/null
@@ -0,0 +1,943 @@
+/*
+ * Copyright (c) 2023 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 "espp_service_client_priv.h"
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#define MAX_CONNECT_RETRY 10
+#define RETRY_CONNECT_INTERVAL_US 300000
+
+#define FILL_SOCKET_MSG_PARAMS(x_msg, x_request, ...) \
+do { \
+       gchar *params = espp_service_common_msg_params_new(espp_service_common_get_requests()[x_request].param_formats, ##__VA_ARGS__); \
+       memset(&x_msg.params, 0x00, MAX_PARAMS_LEN); \
+       if (!params) break; \
+       STRNCPY(x_msg.params, params, MAX_PARAMS_LEN); \
+       g_free(params); \
+} while (0) \
+
+#define FILL_SOCKET_MSG_REQUEST(x_msg, x_request) \
+do { \
+       memset(&x_msg, 0x00, sizeof(x_msg)); \
+       x_msg.request = x_request; \
+} while (0) \
+
+#define FILL_SOCKET_MSG_RET(x_msg, x_ret) \
+do { \
+       memset(&x_msg, 0x00, sizeof(x_msg)); \
+       x_msg.ret = x_ret; \
+} while (0) \
+
+#define RET_VAL_IF_SERVER_RESULT_ERROR(x_result, x_val) \
+do { \
+       if (x_result.ret < 0) { \
+               LOG_ERROR("failure from server side, result.ret[%d]", x_result.ret); \
+               return x_val; \
+       } \
+       LOG_DEBUG("result.ret[%d]", x_result.ret); \
+} while (0) \
+
+static int get_client_socket_fd(int *fd)
+{
+       int _fd;
+       char str_error[MAX_ERROR_LEN] = {'\0',};
+
+       ASSERT(fd);
+
+       _fd = socket(AF_UNIX, SOCK_STREAM, 0);
+       if (_fd < 0) {
+               strerror_r(errno, str_error, sizeof(str_error));
+               LOG_ERROR("failed to socket(), err: %s", str_error);
+               return -1;
+       }
+
+       *fd = _fd;
+
+       LOG_DEBUG("fd[%d]", _fd);
+
+       return 0;
+}
+
+static int connect_socket(int fd)
+{
+       int ret;
+       int retry_count = MAX_CONNECT_RETRY;
+       struct sockaddr_un addr_un;
+       char str_error[MAX_ERROR_LEN] = {'\0',};
+       g_autofree gchar *sock_path = NULL;
+
+       ASSERT(fd >= 0);
+
+       memset(&addr_un, 0, sizeof(addr_un));
+       addr_un.sun_family = AF_UNIX;
+       sock_path = espp_service_common_get_sock_file_path();
+       strncpy(addr_un.sun_path, sock_path, sizeof(addr_un.sun_path) - 1);
+
+       do {
+               ret = connect(fd, (struct sockaddr *)&addr_un, sizeof(addr_un));
+               if (ret == 0) {
+                       LOG_DEBUG("connected successfully, fd[%d]", fd);
+                       return 0;
+               }
+
+               strerror_r(errno, str_error, sizeof(str_error));
+               LOG_ERROR("[%2d] failed to connect(), fd[%d], sun_path[%s], err: %s",
+                       retry_count, fd, addr_un.sun_path, str_error);
+
+               usleep(RETRY_CONNECT_INTERVAL_US);
+       } while (--retry_count > 0);
+
+       LOG_ERROR("connection timeout[%u us]", MAX_CONNECT_RETRY * RETRY_CONNECT_INTERVAL_US);
+
+       return -1;
+}
+
+static int send_data(int fd, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       char str_error[MAX_ERROR_LEN] = {'\0',};
+
+       ASSERT(fd >= 0);
+       ASSERT(data);
+       ASSERT(result);
+
+       if (write(fd, data, sizeof(espp_service_data_from_client_s)) < 0) {
+               strerror_r(errno, str_error, sizeof(str_error));
+               LOG_ERROR("failed to write(), fd[%d], err: %s", fd, str_error);
+               return -1;
+       }
+
+       if (read(fd, result, sizeof(espp_service_data_from_server_s)) < 0) {
+               strerror_r(errno, str_error, sizeof(str_error));
+               LOG_ERROR("failed to read(), fd[%d], err: %s", fd, str_error);
+               return -1;
+       }
+
+       LOG_DEBUG("fd[%d] request[%d], result->ret[%d]", fd, data->request, result->ret);
+
+       return 0;
+}
+
+static int send_data_and_buffer(int fd, espp_service_data_from_client_s *data, char *buffer, uint32_t buffer_size, espp_service_data_from_server_s *result)
+{
+       char str_error[MAX_ERROR_LEN] = {'\0',};
+
+       ASSERT(fd >= 0);
+       ASSERT(data);
+       ASSERT(buffer);
+       ASSERT(buffer_size > 0);
+       ASSERT(result);
+
+       if (write(fd, data, sizeof(espp_service_data_from_client_s)) < 0) {
+               strerror_r(errno, str_error, sizeof(str_error));
+               LOG_ERROR("failed to write(), fd[%d], err: %s", fd, str_error);
+               return -1;
+       }
+
+       if (write(fd, buffer, buffer_size) < 0) {
+               strerror_r(errno, str_error, sizeof(str_error));
+               LOG_ERROR("failed to write(), fd[%d], err: %s", fd, str_error);
+               return -1;
+       }
+
+       if (read(fd, result, sizeof(espp_service_data_from_server_s)) < 0) {
+               strerror_r(errno, str_error, sizeof(str_error));
+               LOG_ERROR("failed to read(), fd[%d], err: %s", fd, str_error);
+               return -1;
+       }
+
+       LOG_DEBUG("fd[%d] request[%d], buffer_size[%u], result->ret[%d]", fd, data->request, buffer_size, result->ret);
+
+       return 0;
+}
+
+static int send_data_without_result(int fd, espp_service_data_from_client_s *data)
+{
+       char str_error[MAX_ERROR_LEN] = {'\0',};
+
+       ASSERT(fd >= 0);
+       ASSERT(data);
+
+       if (write(fd, data, sizeof(espp_service_data_from_client_s)) < 0) {
+               strerror_r(errno, str_error, sizeof(str_error));
+               LOG_ERROR("failed to write(), fd[%d], err: %s", fd, str_error);
+               return -1;
+       }
+
+       LOG_DEBUG("fd[%d] data->ret[%d]", fd, data->ret);
+
+       return 0;
+}
+
+int espp_service_client_socket_fd_new(void)
+{
+       int fd = -1;
+
+       if (get_client_socket_fd(&fd) != 0)
+               return -1;
+
+       if (connect_socket(fd) != 0)
+               goto error;
+
+       LOG_INFO("fd[%d]", fd);
+
+       return fd;
+
+error:
+       if (fd != -1)
+               close(fd);
+
+       return -1;
+}
+
+int espp_service_client_socket_request_init_event(espp_s *espp)
+{
+       int fd = -1;
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       ASSERT(espp->event_fd == -1);
+
+       fd = espp_service_client_socket_fd_new();
+       RET_VAL_IF(fd == -1, -1, "failed to espp_service_client_socket_fd_new()");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_INIT_EVENT);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_INIT_EVENT, "handle", (long)espp);
+       if (send_data(fd, &data, &result) != 0)
+               goto error;
+       if (result.ret != 0) {
+               LOG_ERROR("failure from server side, result.ret[%d]", result.ret);
+               goto error;
+       }
+
+       espp->event_fd = fd;
+
+       LOG_DEBUG("espp[%p], event_fd[%d]", espp, fd);
+
+       if (!(espp->event_handler.thread = g_thread_try_new("event_handler_thread", espp_service_client_event_handler_thread_func, (gpointer)espp, NULL))) {
+               LOG_ERROR("failed to g_thread_try_new()");
+               goto error;
+       }
+
+       return 0;
+
+error:
+       close(fd);
+       espp->event_fd = -1;
+       return -1;
+}
+
+int espp_service_client_socket_request_deinit_event(espp_s *espp)
+{
+       espp_service_data_from_client_s data;
+
+       ASSERT(espp);
+       ASSERT(espp->event_fd != -1);
+       ASSERT(espp->event_handler.thread);
+
+       FILL_SOCKET_MSG_RET(data, -2); /* -2 to exit */
+       if (send_data_without_result(espp->event_fd, &data) != 0)
+               return -1;
+
+       espp->event_handler.exit = true;
+
+       LOG_DEBUG("espp[%p], event_fd[%d]", espp, espp->event_fd);
+
+       LOG_DEBUG("waiting for thread join...");
+       g_thread_join(espp->event_handler.thread);
+       LOG_DEBUG("thread exits");
+
+       close(espp->event_fd);
+       espp->event_fd = -1;
+       espp->event_handler.thread = NULL;
+       espp->event_handler.exit = false;
+
+       return 0;
+}
+
+int espp_service_client_socket_request_create(espp_s *espp)
+{
+       int fd = -1;
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       ASSERT(espp->fd == -1);
+
+       fd = espp_service_client_socket_fd_new();
+       RET_VAL_IF(fd == -1, -1, "failed to espp_service_client_socket_fd_new()");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_CREATE);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_CREATE, "handle", (long)espp);
+       if (send_data(fd, &data, &result) != 0)
+               goto error;
+       if (result.ret != 0) {
+               LOG_ERROR("failure from server side, result.ret[%d]", result.ret);
+               goto error;
+       }
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, fd);
+
+       espp->fd = fd;
+
+       return 0;
+
+error:
+       if (fd != -1)
+               close(fd);
+       return -1;
+}
+
+int espp_service_client_socket_request_destroy(espp_s *espp)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_DESTROY);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       close(espp->fd);
+       espp->fd = -1;
+
+       return 0;
+}
+
+int espp_service_client_socket_request_open(espp_s *espp)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_OPEN);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_close(espp_s *espp)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_CLOSE);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_start(espp_s *espp)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_START);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_stop(espp_s *espp)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_STOP);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_pause(espp_s *espp)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_PAUSE);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_resume(espp_s *espp)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_RESUME);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_prepare_async(espp_s *espp)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_PREPARE_ASYNC);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_seek(espp_s *espp, uint64_t time_ms)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SEEK);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SEEK, "time_ms", time_ms);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_get_state(espp_s *espp, espp_state_e *state)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       ASSERT(state);
+
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_GET_STATE);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       *state = result.ret_int;
+
+       return 0;
+}
+
+int espp_service_client_socket_request_get_playing_time(espp_s *espp, uint64_t *time_ms)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       ASSERT(time_ms);
+
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_GET_PLAYING_TIME);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       *time_ms = result.ret_uint64;
+
+       return 0;
+}
+
+int espp_service_client_socket_request_set_audio_stream_info(espp_s *espp, espp_audio_stream_info_s *info)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+       g_autofree gchar *base64_codec_data = NULL;
+
+       ASSERT(espp);
+       ASSERT(info);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       /* NOTE that encoding 'codec_data' member with base64 to avoid parsing json string error on the daemon side. */
+       if (info->codec_data_length > 0)
+               base64_codec_data = g_base64_encode((guchar *)info->codec_data, info->codec_data_length);
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_AUDIO_STREAM_INFO);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_AUDIO_STREAM_INFO,
+               "codec_data", base64_codec_data, "codec_data_length", info->codec_data_length, "mime_type", info->mime_type,
+               "bitrate", info->bitrate, "channels", info->channels, "sample_rate", info->sample_rate);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_set_video_stream_info(espp_s *espp, espp_video_stream_info_s *info)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+       g_autofree gchar *base64_codec_data = NULL;
+
+       ASSERT(espp);
+       ASSERT(info);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       /* NOTE that encoding 'codec_data' member with base64 to avoid parsing json string error on the daemon side. */
+       if (info->codec_data_length > 0)
+               base64_codec_data = g_base64_encode((guchar *)info->codec_data, info->codec_data_length);
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_VIDEO_STREAM_INFO);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_VIDEO_STREAM_INFO,
+               "codec_data", base64_codec_data, "codec_data_length", info->codec_data_length, "mime_type", info->mime_type,
+               "width", info->width, "height", info->height, "max_width", info->max_width, "max_height", info->max_height,
+               "framerate_num", info->framerate_num, "framerate_den", info->framerate_den);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+
+int espp_service_client_socket_request_set_playback_rate(espp_s *espp, double rate, bool mute_audio)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_PLAYBACK_RATE);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_PLAYBACK_RATE,
+               "rate", rate, "mute_audio", mute_audio);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_set_display_surface_id(espp_s *espp, espp_display_type_e type, unsigned int surface_id, int x, int y, int w, int h)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_SURFACE_ID);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_SURFACE_ID,
+               "type", type, "surface_id", surface_id,
+               "x", x, "y", y, "w", w, "h", h);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_set_display_mode(espp_s *espp, espp_display_mode_e mode)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_MODE);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_MODE, "mode", mode);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_set_display_roi(espp_s *espp, int x, int y, int w, int h)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_ROI);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_ROI,
+               "x", x, "y", y, "w", w, "h", h);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_set_display_visible(espp_s *espp, bool visible)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_VISIBLE);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_VISIBLE, "visible", visible);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_set_display_rotation(espp_s *espp, espp_display_rotation_angle_e angle)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_ROTATION);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_ROTATION, "angle", angle);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_set_audio_mute(espp_s *espp, bool mute)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_AUDIO_MUTE);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_AUDIO_MUTE, "mute", mute);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_set_audio_volume(espp_s *espp, int volume)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_AUDIO_VOLUME);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_AUDIO_VOLUME, "volume", volume);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_get_audio_volume(espp_s *espp, int *volume)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       ASSERT(volume);
+
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_GET_AUDIO_VOLUME);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       *volume = result.ret_int;
+
+       return 0;
+}
+
+int espp_service_client_socket_request_set_callback(espp_s *espp, espp_service_event_e type, void *callback, void *user_data)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_CALLBACK);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_CALLBACK, "type", type);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_submit_packet(espp_s *espp, espp_packet_s *packet, espp_submit_error_e *error)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       ASSERT(packet);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+       RET_VAL_IF(packet->buffer_size == 0, -1, "packet->buffer_size is 0");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SUBMIT_PACKET);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SUBMIT_PACKET,
+               "type", packet->type,
+               "buffer_size", packet->buffer_size,
+               "pts", packet->pts,
+               "duration", packet->duration,
+               "hdr10p_metadata_size", packet->hdr10p_metadata_size);
+       if (send_data_and_buffer(espp->fd, &data, packet->buffer, packet->buffer_size, &result) != 0)
+               return -1;
+
+       if (result.ret < 0 && error)
+               *error = result.ret_int;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_submit_eos_packet(espp_s *espp, espp_stream_type_e stream_type, espp_submit_error_e *error)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SUBMIT_EOS_PACKET);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SUBMIT_EOS_PACKET, "stream_type", stream_type);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       if (result.ret < 0 && error)
+               *error = result.ret_int;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_set_buffer_size(espp_s *espp, espp_buffer_size_type_e size_type, uint64_t size)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_BUFFER_SIZE);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_BUFFER_SIZE,
+               "size_type", size_type, "size", size);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_set_low_latency_mode(espp_s *espp, espp_low_latency_mode_e mode)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_LOW_LATENCY_MODE);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_LOW_LATENCY_MODE, "mode", mode);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_set_decoded_video_frame_buffer_type(espp_s *espp, espp_decoded_video_frame_buffer_type_e type)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_DECODED_VIDEO_FRAME_BUFFER_TYPE);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_DECODED_VIDEO_FRAME_BUFFER_TYPE, "type", type);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_take_snapshot(espp_s *espp, int id)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_TAKE_SNAPSHOT);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_TAKE_SNAPSHOT, "id", id);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
+int espp_service_client_socket_request_set_render_time_offset(espp_s *espp, espp_stream_type_e stream_type, int64_t time_offset_ms)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_RENDER_TIME_OFFSET);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_RENDER_TIME_OFFSET,
+               "stream_type", stream_type, "time_offset_ms", time_offset_ms);
+
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
diff --git a/agent/espp-service/src/client/meson.build b/agent/espp-service/src/client/meson.build
new file mode 100644 (file)
index 0000000..3fae2ed
--- /dev/null
@@ -0,0 +1,34 @@
+espp_service_client_headers = files([
+  'espp_service_client.h',
+])
+
+install_headers(espp_service_client_headers)
+
+espp_service_client_sources = files([
+  '../common/espp_service_ipc.c',
+  'espp_service_client.c',
+  'espp_service_client_socket.c',
+  'espp_service_client_msg.c',
+  'espp_service_client_event_handler.c',
+])
+
+capi_base_common_dep = dependency('capi-base-common', required: true)
+
+libespp_service_client = library('espp-service-client',
+  espp_service_client_sources,
+  dependencies: [common_deps, capi_base_common_dep],
+  include_directories: [configinc, '.'],
+  version: espp_service_version,
+  soversion: version_major,
+  install: true,
+)
+
+libespp_service_client_dep = declare_dependency(link_with : libespp_service_client,
+  include_directories : [configinc, '.']
+)
+
+pkgconfig.generate(libespp_service_client,
+  name: 'espp-service-client',
+  description: 'ESPP service client library',
+)
+
diff --git a/agent/espp-service/src/client/project_def.prop b/agent/espp-service/src/client/project_def.prop
new file mode 100644 (file)
index 0000000..61f1431
--- /dev/null
@@ -0,0 +1,26 @@
+# Project Name
+APPNAME = espp-service-client
+
+# Project Type
+type = sharedLib
+
+# Project Profile
+profile = tizen-8.0
+
+# Sources
+USER_SRCS = ../common/*.c ./*.c
+
+# User Defines
+USER_DEFS = USE_DLOG USE_SERVICE_APP ESPP_SERVICE_VERSION="0.3.21"
+
+# User Includes
+USER_INC_DIRS = ../common ./
+
+# User Libraries
+USER_LIBS =
+
+# Linker Flags
+USER_LFLAGS = -Xlinker -rpath='/usr/lib'
+
+# User Library Path
+USER_LIB_DIRS =
diff --git a/agent/espp-service/src/client/update_version.sh b/agent/espp-service/src/client/update_version.sh
new file mode 100755 (executable)
index 0000000..a9c6e88
--- /dev/null
@@ -0,0 +1,8 @@
+echo "===== Update client's project_def.prop version ====="
+VER_SPEC=$(grep "Version" ../../packaging/espp-service.spec | cut -f2 -d : | sed 's/ //g')
+VER_PROJ=$(grep -oP '(?<=VERSION=").*?(?=")' project_def.prop)
+if [ "${VER_SPEC}" != "${VER_PROJ}" ]; then
+       echo "update project_def.prop version: ${VER_PROJ} => ${VER_SPEC}"
+       sed -i "s/\(VERSION=\"\)[^\"]*\(\"\)/\1${VER_SPEC}\2/" project_def.prop
+fi
+echo "===================================================="
diff --git a/agent/espp-service/src/common/espp_service_common.h b/agent/espp-service/src/common/espp_service_common.h
new file mode 100644 (file)
index 0000000..04a97fe
--- /dev/null
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2023 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 __ESPP_SERVICE_COMMON_H__
+#define __ESPP_SERVICE_COMMON_H__
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdlib.h>
+#include <glib.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <string.h>
+#ifdef USE_DLOG
+#include <dlog.h>
+#endif
+#define GET_STRING(x) #x
+#define TO_STRING(x) GET_STRING(x)
+#ifndef ESPP_SERVICE_VERSION
+#define ESPP_SVC_VERSION "unknown"
+#else
+#define ESPP_SVC_VERSION TO_STRING(ESPP_SERVICE_VERSION)
+#endif
+#ifndef ESPP_SERVICE_SOCK_PATH
+#define ESPP_SVC_SOCK_PATH "/tmp/espp_service.sock"
+#else
+#define ESPP_SVC_SOCK_PATH TO_STRING(ESPP_SERVICE_SOCK_PATH)
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define FONT_COLOR_RESET    "\033[0m"
+#define FONT_COLOR_RED      "\033[31m"
+#define FONT_COLOR_GREEN    "\033[32m"
+#define FONT_COLOR_YELLOW   "\033[33m"
+#define FONT_COLOR_BLUE     "\033[34m"
+#define FONT_COLOR_PURPLE   "\033[35m"
+#define FONT_COLOR_CYAN     "\033[36m"
+#define FONT_COLOR_GRAY     "\033[37m"
+
+#ifdef USE_DLOG
+#ifndef LOGI
+#define LOGI(fmt, arg...) dlog_print(DLOG_INFO, LOG_TAG, "%s (%d) %s : " fmt, __FILE__, __LINE__, __FUNCTION__, ##arg)
+#endif
+#ifndef LOGD
+#define LOGD(fmt, arg...) dlog_print(DLOG_DEBUG, LOG_TAG, "%s (%d) %s : " fmt, __FILE__, __LINE__, __FUNCTION__, ##arg)
+#endif
+#ifndef LOGW
+#define LOGW(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, "%s (%d) %s : " fmt, __FILE__, __LINE__, __FUNCTION__, ##arg)
+#endif
+#ifndef LOGE
+#define LOGE(fmt, arg...) dlog_print(DLOG_ERROR, LOG_TAG, "%s (%d) %s : " fmt, __FILE__, __LINE__, __FUNCTION__, ##arg)
+#endif
+
+#define LOG_DEBUG(fmt, arg...) \
+do { \
+       LOGD(FONT_COLOR_RESET""fmt""FONT_COLOR_RESET, ##arg); \
+} while (0)
+
+#define LOG_INFO(fmt, arg...) \
+do { \
+       LOGI(FONT_COLOR_GREEN""fmt""FONT_COLOR_RESET, ##arg); \
+} while (0)
+
+#define LOG_WARNING(fmt, arg...) \
+do { \
+       LOGW(FONT_COLOR_YELLOW""fmt""FONT_COLOR_RESET, ##arg); \
+} while (0)
+
+#define LOG_ERROR(fmt, arg...) \
+do { \
+       LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \
+} while (0)
+
+#define LOG_DEBUG_ENTER() \
+do { \
+       LOGD(FONT_COLOR_PURPLE"<Enter>"FONT_COLOR_RESET); \
+} while (0)
+
+#define LOG_DEBUG_LEAVE() \
+do { \
+       LOGD(FONT_COLOR_PURPLE"<Leave>"FONT_COLOR_RESET); \
+} while (0)
+
+#define LOG_INFO_OR_DEBUG(expr, fmt, arg...) \
+do { \
+       if ((expr)) \
+               LOGI(FONT_COLOR_GREEN""fmt""FONT_COLOR_RESET, ##arg); \
+       else \
+               LOGD(FONT_COLOR_RESET""fmt""FONT_COLOR_RESET, ##arg); \
+} while (0)
+
+#else
+#define LOG_DEBUG(fmt, arg...) printf(FONT_COLOR_RESET""fmt"\n"FONT_COLOR_RESET, ##arg);
+#define LOG_INFO(fmt, arg...) printf(FONT_COLOR_GREEN""fmt"\n"FONT_COLOR_RESET, ##arg);
+#define LOG_WARNING(fmt, arg...) printf(FONT_COLOR_YELLOW""fmt"\n"FONT_COLOR_RESET, ##arg);
+#define LOG_ERROR(fmt, arg...) printf(FONT_COLOR_RED""fmt"\n"FONT_COLOR_RESET, ##arg);
+#define LOG_DEBUG_ENTER() printf(FONT_COLOR_PURPLE"<Enter>\n"FONT_COLOR_RESET);
+#define LOG_DEBUG_LEAVE() printf(FONT_COLOR_PURPLE"<Leave>\n"FONT_COLOR_RESET);
+#define LOG_INFO_OR_DEBUG(info, fmt, arg...) printf(FONT_COLOR_GREEN""fmt"\n"FONT_COLOR_RESET, ##arg);
+#endif
+
+#define RET_IF(expr, fmt, arg...) \
+do { \
+       if ((expr)) { \
+               LOG_ERROR(""fmt"", ##arg); \
+               return; \
+       } \
+} while (0)
+
+#define RET_VAL_IF(expr, val, fmt, arg...) \
+do { \
+       if ((expr)) { \
+               LOG_ERROR(""fmt"", ##arg); \
+               return (val);\
+       } \
+} while (0)
+
+#define UNLIKELY(x) (__builtin_expect(!!(x),0))
+#define ASSERT(expr) \
+do {\
+       if (UNLIKELY(!(expr))) { \
+               LOG_ERROR("Assertion '%s' failed. Aborting.", #expr); \
+               abort(); \
+       } \
+} while (0)
+
+#define STRNCPY(x_dst, x_src, x_size) \
+do { \
+       ASSERT(x_dst); \
+       ASSERT(x_src); \
+       ASSERT(x_size > 0); \
+       strncpy(x_dst, x_src, x_size); \
+       x_dst[x_size - 1] = '\0';\
+} while (0) \
+
+#define ESPP_SERVICE_SOCK ESPP_SVC_SOCK_PATH
+#define MAX_ERROR_LEN 64
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __ESPP_SERVICE_COMMON_H__ */
diff --git a/agent/espp-service/src/common/espp_service_ipc.c b/agent/espp-service/src/common/espp_service_ipc.c
new file mode 100644 (file)
index 0000000..e1ad63f
--- /dev/null
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) 2023 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 "espp_service_common.h"
+#include "espp_service_ipc.h"
+#ifdef USE_SERVICE_APP
+#include <app_common.h>
+#endif
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#define LOG_TAG "ESPP_SERVICE_IPC"
+#endif
+
+static espp_service_ipc_data_s requests[] = {
+       [ESPP_SERVICE_REQUEST_INIT_EVENT] = { "InitEvent", "i" },
+       [ESPP_SERVICE_REQUEST_CREATE] = { "Create", "i" },
+       [ESPP_SERVICE_REQUEST_DESTROY] = {"Destroy", NULL },
+       [ESPP_SERVICE_REQUEST_OPEN] = { "Open", NULL },
+       [ESPP_SERVICE_REQUEST_CLOSE] = { "Close", NULL },
+       [ESPP_SERVICE_REQUEST_START] = { "Start", NULL },
+       [ESPP_SERVICE_REQUEST_STOP] = { "Stop", NULL },
+       [ESPP_SERVICE_REQUEST_PAUSE] = { "Pause", NULL },
+       [ESPP_SERVICE_REQUEST_RESUME] = { "Resume", NULL },
+       [ESPP_SERVICE_REQUEST_PREPARE_ASYNC] = { "PrepareAsync", NULL },
+       [ESPP_SERVICE_REQUEST_SEEK] = { "Seek", "k" },
+       [ESPP_SERVICE_REQUEST_GET_STATE] = { "GetState", NULL },
+       [ESPP_SERVICE_REQUEST_GET_PLAYING_TIME] = { "GetPlayingTime", NULL },
+       [ESPP_SERVICE_REQUEST_SET_AUDIO_STREAM_INFO] = { "SetAudioStreamInfo", "suiuuu" },
+       [ESPP_SERVICE_REQUEST_SET_VIDEO_STREAM_INFO] = { "SetVideoStreamInfo", "suiuuuuuu" },
+       [ESPP_SERVICE_REQUEST_SET_PLAYBACK_RATE] = { "SetPlaybackRate", "db" },
+       [ESPP_SERVICE_REQUEST_SET_DISPLAY_SURFACE_ID] = { "SetDisplaySurfaceId", "iuiiii" },
+       [ESPP_SERVICE_REQUEST_SET_DISPLAY_MODE] = { "SetDisplayMode", "i" },
+       [ESPP_SERVICE_REQUEST_SET_DISPLAY_ROI] = { "SetDisplayRoi", "iiii" },
+       [ESPP_SERVICE_REQUEST_SET_DISPLAY_VISIBLE] = { "SetDisplayVisible", "b" },
+       [ESPP_SERVICE_REQUEST_SET_DISPLAY_ROTATION] = { "SetDisplayRotation", "i" },
+       [ESPP_SERVICE_REQUEST_SET_AUDIO_MUTE] = { "SetAudioMute", "b" },
+       [ESPP_SERVICE_REQUEST_SET_AUDIO_VOLUME] = { "SetAudioVolume", "i" },
+       [ESPP_SERVICE_REQUEST_GET_AUDIO_VOLUME] = { "GetAudioVolume", NULL },
+       [ESPP_SERVICE_REQUEST_SUBMIT_PACKET] = { "SubmitPacket", "iukku" },
+       [ESPP_SERVICE_REQUEST_SUBMIT_EOS_PACKET] = { "SubmitEosPacket", "i" },
+       [ESPP_SERVICE_REQUEST_SET_BUFFER_SIZE] = { "SetBufferSize", "ik" },
+       [ESPP_SERVICE_REQUEST_SET_LOW_LATENCY_MODE] = { "SetLowLatencyMode", "i" },
+       [ESPP_SERVICE_REQUEST_SET_DECODED_VIDEO_FRAME_BUFFER_TYPE] = { "SetDecodedVideoFrameBufferType", "i" },
+       [ESPP_SERVICE_REQUEST_TAKE_SNAPSHOT] = { "TakeSnapshot", "i" },
+       [ESPP_SERVICE_REQUEST_SET_RENDER_TIME_OFFSET] = { "SetRenderTimeOffset", "il" },
+       [ESPP_SERVICE_REQUEST_SET_CALLBACK] = { "SetCallback", "i" },
+};
+
+static espp_service_ipc_data_s events[] = {
+       [ESPP_SERVICE_EVENT_MSG] = { "Message", "s" },
+       [ESPP_SERVICE_EVENT_CB_READY_TO_PREPARE] = { "ReadyToPrepareCB", "i" },
+       [ESPP_SERVICE_EVENT_CB_PREPARE_ASYNC_DONE] = { "PrepareAsyncDoneCB", "b" },
+       [ESPP_SERVICE_EVENT_CB_READY_TO_SEEK] = { "ReadyToSeekCB", "ik" },
+       [ESPP_SERVICE_EVENT_CB_SEEK_DONE] = { "SeekDoneCB", NULL },
+       [ESPP_SERVICE_EVENT_CB_EOS] = { "EosCB", NULL },
+       [ESPP_SERVICE_EVENT_CB_BUFFER_STATUS] = { "BufferStatusCB", "ii" },
+       [ESPP_SERVICE_EVENT_CB_RESOURCE_CONFLICTED] = { "PrepareAsyncDoneCB", NULL },
+       [ESPP_SERVICE_EVENT_CB_ERROR] = { "ErrorCB", "i" },
+       [ESPP_SERVICE_EVENT_CB_SNAPSHOT] = { "SnapshotCB", "iuuu" },
+};
+
+const char *data_type_strs[] = {
+       [ESPP_SERVICE_DATA_TYPE_BOOL] = "bool",
+       [ESPP_SERVICE_DATA_TYPE_INT] = "int",
+       [ESPP_SERVICE_DATA_TYPE_INT64] = "int64",
+       [ESPP_SERVICE_DATA_TYPE_UINT] = "uint",
+       [ESPP_SERVICE_DATA_TYPE_UINT64] = "uint64",
+       [ESPP_SERVICE_DATA_TYPE_DOUBLE] = "double",
+       [ESPP_SERVICE_DATA_TYPE_STRING] = "string",
+};
+
+typedef struct {
+       va_list ap;
+       const char *formats;
+       int count;
+} formats_data_s;
+
+static void __json_obj_foreach_func(JsonObject *object, const gchar *name, JsonNode *node, gpointer user_data)
+{
+       formats_data_s *data  = (formats_data_s *)user_data;
+       char c;
+       JsonObject *member = json_node_get_object(node);
+
+       ASSERT(data);
+       ASSERT(member);
+
+       switch ((c = *(data->formats + data->count++))) {
+       case 'b':
+               *(va_arg(data->ap, bool*)) = json_object_get_boolean_member(member, data_type_strs[ESPP_SERVICE_DATA_TYPE_BOOL]);
+               break;
+       case 'i':
+               *(va_arg(data->ap, int*)) = json_object_get_int_member(member, data_type_strs[ESPP_SERVICE_DATA_TYPE_INT]);
+               break;
+       case 'l':
+               *(va_arg(data->ap, int64_t*)) = json_object_get_int_member(member, data_type_strs[ESPP_SERVICE_DATA_TYPE_INT64]);
+               break;
+       case 'u':
+               *(va_arg(data->ap, unsigned int*)) = json_object_get_int_member(member, data_type_strs[ESPP_SERVICE_DATA_TYPE_UINT]);
+               break;
+       case 'k':
+               *(va_arg(data->ap, uint64_t*)) = json_object_get_int_member(member, data_type_strs[ESPP_SERVICE_DATA_TYPE_UINT64]);
+               break;
+       case 'd':
+               *(va_arg(data->ap, double*)) = json_object_get_double_member(member, data_type_strs[ESPP_SERVICE_DATA_TYPE_DOUBLE]);
+               break;
+       case 's':
+               *(va_arg(data->ap, char**)) =  g_strdup(json_object_get_string_member(member, data_type_strs[ESPP_SERVICE_DATA_TYPE_STRING]));
+               break;
+       default:
+               LOG_ERROR("not supported format[%c]", c);
+       }
+}
+
+espp_service_ipc_data_s *espp_service_common_get_requests()
+{
+       return requests;
+}
+espp_service_ipc_data_s *espp_service_common_get_events()
+{
+       return events;
+}
+
+int espp_service_common_parse_json_structured_message(va_list ap, const char *message, const char *formats)
+{
+       g_autoptr(JsonParser) parser = NULL;
+       JsonNode *root;
+       JsonObject *object;
+       JsonObject *params;
+       formats_data_s data = { .formats = formats, .count = 0 };
+
+       ASSERT(message);
+       ASSERT(formats);
+
+       va_copy(data.ap, ap);
+
+       parser = json_parser_new();
+
+       if (!json_parser_load_from_data(parser, message, -1, NULL)) {
+               LOG_ERROR("failed to json_parser_load_from_data()");
+               return -1;
+       }
+
+       root = json_parser_get_root(parser);
+       if (!JSON_NODE_HOLDS_OBJECT(root)) {
+               LOG_ERROR("failed to JSON_NODE_HOLDS_OBJECT()");
+               return -1;
+       }
+
+       object = json_node_get_object(root);
+       if (!(params = json_object_get_object_member(object, "params"))) {
+               LOG_ERROR("params object is NULL");
+               return -1;
+       }
+
+       json_object_foreach_member(params, __json_obj_foreach_func, &data);
+
+       va_end(data.ap);
+
+       return 0;
+}
+
+JsonObject *espp_service_common_make_json_object_params(va_list ap, const char *formats, JsonObject *object)
+{
+       char c;
+       JsonObject *params = json_object_new();
+       JsonObject *member;
+
+       ASSERT(object);
+
+       while (*formats) {
+               member = json_object_new();
+               switch ((c = *formats++)) {
+               case 'b':
+                       json_object_set_object_member(params, (const gchar*)va_arg(ap, char *), member);
+                       json_object_set_boolean_member(member,
+                               data_type_strs[ESPP_SERVICE_DATA_TYPE_BOOL], (gboolean)va_arg(ap, int));
+                       break;
+               case 'i':
+                       json_object_set_object_member(params, (const gchar*)va_arg(ap, char *), member);
+                       json_object_set_int_member(member,
+                               data_type_strs[ESPP_SERVICE_DATA_TYPE_INT], (gint64)va_arg(ap, int));
+                       break;
+               case 'l':
+                       json_object_set_object_member(params, (const gchar*)va_arg(ap, char *), member);
+                       json_object_set_int_member(member,
+                               data_type_strs[ESPP_SERVICE_DATA_TYPE_INT64], (gint64)va_arg(ap, int64_t));
+                       break;
+               case 'u':
+                       json_object_set_object_member(params, (const gchar*)va_arg(ap, char *), member);
+                       json_object_set_int_member(member,
+                               data_type_strs[ESPP_SERVICE_DATA_TYPE_UINT], (gint64)va_arg(ap, unsigned int));
+                       break;
+               case 'k':
+                       json_object_set_object_member(params, (const gchar*)va_arg(ap, char *), member);
+                       json_object_set_int_member(member,
+                               data_type_strs[ESPP_SERVICE_DATA_TYPE_UINT64], (gint64)va_arg(ap, uint64_t));
+                       break;
+               case 'd':
+                       json_object_set_object_member(params, (const gchar*)va_arg(ap, char *), member);
+                       json_object_set_double_member(member,
+                               data_type_strs[ESPP_SERVICE_DATA_TYPE_DOUBLE], (gdouble)va_arg(ap, double));
+                       break;
+               case 's':
+                       json_object_set_object_member(params, (const gchar*)va_arg(ap, char *), member);
+                       json_object_set_string_member(member,
+                               data_type_strs[ESPP_SERVICE_DATA_TYPE_STRING], (const gchar*)va_arg(ap, char *));
+                       break;
+               default:
+                       LOG_ERROR("not supported format[%c]", c);
+                       json_object_unref(member);
+                       json_object_unref(params);
+                       json_object_unref(object);
+                       return NULL;
+               }
+       }
+
+       json_object_set_object_member(object, "params", params);
+
+       return object;
+}
+
+/* Use g_free() to release the return value. */
+gchar *espp_service_common_get_string_from_json_object(JsonObject *object)
+{
+       g_autoptr(JsonNode) root = NULL;
+       g_autoptr(JsonGenerator) generator = NULL;
+
+       ASSERT(object);
+
+       root = json_node_init_object(json_node_alloc(), object);
+       generator = json_generator_new();
+       json_generator_set_root(generator, root);
+       return json_generator_to_data(generator, NULL);
+}
+
+/* Use g_free() to release the return value. */
+gchar *espp_service_common_msg_params_new(const char *formats, ...)
+{
+       gchar *result = NULL;
+       JsonObject *obj;
+       va_list ap;
+
+       ASSERT(formats);
+
+       obj = json_object_new();
+
+       va_start(ap, formats);
+       obj = espp_service_common_make_json_object_params(ap, formats, obj);
+       va_end(ap);
+
+       if (!obj)
+               return NULL;
+
+       result = espp_service_common_get_string_from_json_object(obj);
+       json_object_unref(obj);
+
+       LOG_DEBUG("params: %s", result);
+
+       return result;
+}
+
+/* Use g_free() to release the return value. */
+gchar *espp_service_common_get_sock_file_path(void)
+{
+       char *app_data_path = NULL;
+       gchar *result;
+
+#ifdef USE_SERVICE_APP
+       app_data_path = app_get_data_path();
+#endif
+       if (app_data_path) {
+               result = g_strdup_printf("%s%s", app_data_path, "espp_service.sock");
+               free(app_data_path);
+       } else {
+               result = g_strdup_printf("%s", ESPP_SERVICE_SOCK);
+       }
+
+       LOG_INFO("sock_file[%s]", result);
+       return result;
+}
diff --git a/agent/espp-service/src/common/espp_service_ipc.h b/agent/espp-service/src/common/espp_service_ipc.h
new file mode 100644 (file)
index 0000000..c270628
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2023 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 __ESPP_SERVICE_IPC_H__
+#define __ESPP_SERVICE_IPC_H__
+
+#include <stdarg.h>
+#include <json-glib/json-glib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MAX_PARAMS_LEN 1024
+
+typedef enum {
+       ESPP_SERVICE_REQUEST_INIT_EVENT,
+       ESPP_SERVICE_REQUEST_CREATE,
+       ESPP_SERVICE_REQUEST_DESTROY,
+       ESPP_SERVICE_REQUEST_OPEN,
+       ESPP_SERVICE_REQUEST_CLOSE,
+       ESPP_SERVICE_REQUEST_START,
+       ESPP_SERVICE_REQUEST_STOP,
+       ESPP_SERVICE_REQUEST_PAUSE,
+       ESPP_SERVICE_REQUEST_RESUME,
+       ESPP_SERVICE_REQUEST_PREPARE_ASYNC,
+       ESPP_SERVICE_REQUEST_SEEK,
+       ESPP_SERVICE_REQUEST_GET_STATE,
+       ESPP_SERVICE_REQUEST_GET_PLAYING_TIME,
+       ESPP_SERVICE_REQUEST_SET_AUDIO_STREAM_INFO,
+       ESPP_SERVICE_REQUEST_SET_VIDEO_STREAM_INFO,
+       ESPP_SERVICE_REQUEST_SET_PLAYBACK_RATE,
+       ESPP_SERVICE_REQUEST_SET_DISPLAY_SURFACE_ID,
+       ESPP_SERVICE_REQUEST_SET_DISPLAY_MODE,
+       ESPP_SERVICE_REQUEST_SET_DISPLAY_ROI,
+       ESPP_SERVICE_REQUEST_SET_DISPLAY_VISIBLE,
+       ESPP_SERVICE_REQUEST_SET_DISPLAY_ROTATION,
+       ESPP_SERVICE_REQUEST_SET_AUDIO_MUTE,
+       ESPP_SERVICE_REQUEST_SET_AUDIO_VOLUME,
+       ESPP_SERVICE_REQUEST_GET_AUDIO_VOLUME,
+       ESPP_SERVICE_REQUEST_SUBMIT_PACKET,
+       ESPP_SERVICE_REQUEST_SUBMIT_EOS_PACKET,
+       ESPP_SERVICE_REQUEST_SET_BUFFER_SIZE,
+       ESPP_SERVICE_REQUEST_SET_LOW_LATENCY_MODE,
+       ESPP_SERVICE_REQUEST_SET_DECODED_VIDEO_FRAME_BUFFER_TYPE,
+       ESPP_SERVICE_REQUEST_TAKE_SNAPSHOT,
+       ESPP_SERVICE_REQUEST_SET_RENDER_TIME_OFFSET,
+       ESPP_SERVICE_REQUEST_SET_CALLBACK,
+       ESPP_SERVICE_REQUEST_NUM,
+} espp_service_request_e;
+
+typedef enum {
+       ESPP_SERVICE_EVENT_MSG,
+       ESPP_SERVICE_EVENT_CB_READY_TO_PREPARE,
+       ESPP_SERVICE_EVENT_CB_PREPARE_ASYNC_DONE,
+       ESPP_SERVICE_EVENT_CB_READY_TO_SEEK,
+       ESPP_SERVICE_EVENT_CB_SEEK_DONE,
+       ESPP_SERVICE_EVENT_CB_EOS,
+       ESPP_SERVICE_EVENT_CB_BUFFER_STATUS,
+       ESPP_SERVICE_EVENT_CB_RESOURCE_CONFLICTED,
+       ESPP_SERVICE_EVENT_CB_ERROR,
+       ESPP_SERVICE_EVENT_CB_SNAPSHOT,
+       ESPP_SERVICE_EVENT_CB_NUM,
+} espp_service_event_e;
+
+enum {
+       ESPP_SERVICE_DATA_TYPE_BOOL,
+       ESPP_SERVICE_DATA_TYPE_INT,
+       ESPP_SERVICE_DATA_TYPE_INT64,
+       ESPP_SERVICE_DATA_TYPE_UINT,
+       ESPP_SERVICE_DATA_TYPE_UINT64,
+       ESPP_SERVICE_DATA_TYPE_DOUBLE,
+       ESPP_SERVICE_DATA_TYPE_STRING,
+};
+
+typedef struct {
+       union {
+               int ret;
+               espp_service_request_e request;
+       };
+       char params[MAX_PARAMS_LEN];
+} espp_service_data_from_client_s;
+
+typedef struct {
+       union {
+               int ret;
+               espp_service_event_e event;
+       };
+       union {
+               uint64_t ret_uint64;
+               int ret_int;
+       };
+       char params[MAX_PARAMS_LEN];
+} espp_service_data_from_server_s;
+
+typedef struct {
+       const char *str;
+       const char *param_formats; /* 'b':bool, 'i':int, 'l':int64, 'u':uint, 'k':uint64, 'd':double, 's':string */
+} espp_service_ipc_data_s;
+
+espp_service_ipc_data_s *espp_service_common_get_requests();
+espp_service_ipc_data_s *espp_service_common_get_events();
+int espp_service_common_parse_json_structured_message(va_list ap, const char *message, const char *formats);
+JsonObject *espp_service_common_make_json_object_params(va_list ap, const char *formats, JsonObject *object);
+gchar *espp_service_common_get_string_from_json_object(JsonObject *object);
+gchar *espp_service_common_msg_params_new(const char *formats, ...);
+gchar *espp_service_common_get_sock_file_path(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __ESPP_SERVICE_IPC_H__ */
diff --git a/agent/espp-service/src/daemon/espp_service.c b/agent/espp-service/src/daemon/espp_service.c
new file mode 100644 (file)
index 0000000..e6b58fe
--- /dev/null
@@ -0,0 +1,316 @@
+/*
+ * Copyright (c) 2023 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 "espp_service_priv.h"
+
+#include <stdio.h>
+#include <getopt.h>
+#include <sys/stat.h>
+#ifdef USE_SERVICE_APP
+#include <service_app.h>
+static espp_service_s g_svc = { NULL, NULL, -1, 0, NULL };
+#else
+static espp_service_s g_svc = { NULL, false, -1, 0, NULL };
+static struct sigaction g_int_old_action;
+static struct sigaction g_abrt_old_action;
+static struct sigaction g_segv_old_action;
+static struct sigaction g_term_old_action;
+static struct sigaction g_sys_old_action;
+static struct sigaction g_xcpu_old_action;
+#endif
+
+#ifndef USE_SERVICE_APP
+static void print_usage()
+{
+       g_print("Usage : ");
+       g_print("espp-service [option]\n\n"
+               "  -s, --start                     start the ESPP service\n"
+               "  -h, --help                      help\n");
+}
+
+static int get_option(int argc, char **argv, espp_service_s *svc)
+{
+       int opt;
+       int opt_idx = 0;
+
+       ASSERT(argv);
+       ASSERT(svc);
+
+       static struct option long_options[] = {
+               { "start", required_argument, 0, 's' },
+               { "help", no_argument, 0, 'h' },
+               { 0, 0, 0, 0 }
+       };
+
+       while (1) {
+               if ((opt = getopt_long(argc, argv, "sh", long_options, &opt_idx)) == -1)
+                       break;
+
+               switch (opt) {
+               case 's':
+                       svc->start_service = true;
+                       break;
+               case 'h':
+               default:
+                       print_usage();
+                       return 0;
+               }
+       }
+
+       return 0;
+}
+
+static void __sa_handler(int signal)
+{
+       LOG_ERROR("-------------------- signal[%d] --------------------", signal);
+
+       /* signal block -------------- */
+       sigset_t old_mask, all_mask;
+       sigfillset(&all_mask);
+       sigprocmask(SIG_BLOCK, &all_mask, &old_mask);
+
+       g_hash_table_destroy(g_svc.fd_table);
+       espp_service_deinit_socket(&g_svc);
+
+       sigprocmask(SIG_SETMASK, &old_mask, NULL);
+       /* signal unblock ------------ */
+
+       switch (signal) {
+       case SIGINT:
+               sigaction(SIGINT, &g_int_old_action, NULL);
+               LOG_DEBUG("SIGINT");
+               break;
+       case SIGABRT:
+               sigaction(SIGABRT, &g_abrt_old_action, NULL);
+               LOG_DEBUG("SIGABRT");
+               break;
+       case SIGSEGV:
+               sigaction(SIGSEGV, &g_segv_old_action, NULL);
+               LOG_DEBUG("SIGSEGV");
+               break;
+       case SIGTERM:
+               sigaction(SIGTERM, &g_term_old_action, NULL);
+               LOG_DEBUG("SIGTERM");
+               break;
+       case SIGSYS:
+               sigaction(SIGSYS, &g_sys_old_action, NULL);
+               LOG_DEBUG("SIGSYS");
+               break;
+       case SIGXCPU:
+               sigaction(SIGXCPU, &g_xcpu_old_action, NULL);
+               LOG_DEBUG("SIGXCPU");
+               break;
+       default:
+               LOG_DEBUG("not supported, signal[%d]", signal);
+               break;
+       }
+
+       raise(signal);
+
+       LOG_ERROR("----------------------------------------------------");
+}
+
+static void initialize_signals(void)
+{
+       struct sigaction action;
+       action.sa_handler = __sa_handler;
+       action.sa_flags = SA_NOCLDSTOP;
+
+       sigemptyset(&action.sa_mask);
+
+       sigaction(SIGINT, &action, &g_int_old_action);
+       sigaction(SIGABRT, &action, &g_abrt_old_action);
+       sigaction(SIGSEGV, &action, &g_segv_old_action);
+       sigaction(SIGTERM, &action, &g_term_old_action);
+       sigaction(SIGSYS, &action, &g_sys_old_action);
+       sigaction(SIGXCPU, &action, &g_xcpu_old_action);
+
+       LOG_DEBUG_LEAVE();
+}
+
+static void deinitialize_signals(void)
+{
+       sigaction(SIGINT, &g_int_old_action, NULL);
+       sigaction(SIGABRT, &g_abrt_old_action, NULL);
+       sigaction(SIGSEGV, &g_segv_old_action, NULL);
+       sigaction(SIGTERM, &g_term_old_action, NULL);
+       sigaction(SIGSYS, &g_sys_old_action, NULL);
+       sigaction(SIGXCPU, &g_xcpu_old_action, NULL);
+
+       LOG_DEBUG_LEAVE();
+}
+
+static void run(espp_service_s *svc)
+{
+       ASSERT(svc);
+
+       svc->mainloop = g_main_loop_new(NULL, TRUE);
+       ASSERT(svc->mainloop);
+
+       LOG_DEBUG("run mainloop[%p]", svc->mainloop);
+       g_main_loop_run(svc->mainloop);
+
+       LOG_DEBUG_LEAVE();
+}
+#else
+#define NUM_OF_CLIENTS_CHECK_TIMER_SEC    10
+
+static gboolean __timer_cb(gpointer data)
+{
+       espp_service_s *svc = (espp_service_s *)data;
+       guint num_of_clients;
+
+       ASSERT(svc);
+       ASSERT(svc->fd_table);
+
+       if ((num_of_clients = g_hash_table_size(svc->fd_table)) == 0) {
+               LOG_WARNING("num of clients is 0, quit main loop to exit service...");
+               g_main_loop_quit(svc->mainloop);
+               return G_SOURCE_REMOVE;
+       }
+
+       LOG_DEBUG("num of clients[%d]", num_of_clients);
+       return G_SOURCE_CONTINUE;
+}
+
+static gpointer __loop_thread_func(gpointer data)
+{
+       espp_service_s *svc = (espp_service_s *)data;
+
+       ASSERT(svc);
+
+       g_timeout_add_seconds(NUM_OF_CLIENTS_CHECK_TIMER_SEC, __timer_cb, svc);
+
+       LOG_DEBUG("loop[%p] runs", svc->mainloop);
+       g_main_loop_run(svc->mainloop);
+
+       g_main_loop_unref(svc->mainloop);
+       svc->mainloop = NULL;
+
+       service_app_exit();
+       LOG_DEBUG("request to exit service");
+
+       return NULL;
+}
+
+static bool svc_app_create_cb(void *user_data)
+{
+       espp_service_s *svc = (espp_service_s *)user_data;
+
+       ASSERT(svc);
+       LOG_INFO("svc[%p]", svc);
+
+       if (espp_service_init_socket(svc) != 0)
+               return false;
+
+       svc->fd_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, espp_service_handle_destroy_cb);
+
+       svc->mainloop = g_main_loop_new(NULL, FALSE);
+       svc->thread = g_thread_new("loop-thread-for-timer", __loop_thread_func, svc);
+
+       return true;
+}
+
+static void svc_app_terminate_cb(void *user_data)
+{
+       espp_service_s *svc = (espp_service_s *)user_data;
+
+       ASSERT(svc);
+       LOG_INFO("svc[%p]", svc);
+
+       g_hash_table_destroy(svc->fd_table);
+       espp_service_deinit_socket(svc);
+
+       g_thread_join(svc->thread);
+       LOG_DEBUG("thread[%p] joined", svc->thread);
+       svc->thread = NULL;
+
+       LOG_WARNING("exit");
+}
+
+static void svc_app_control_cb(app_control_h app_control, void *user_data)
+{
+       char *app_id = NULL;
+       char *operation = NULL;
+       espp_service_s *svc = (espp_service_s *)user_data;
+
+       ASSERT(svc);
+       LOG_INFO("app_control[%p], svc[%p]", app_control, svc);
+
+       if (app_control_get_app_id(app_control, &app_id) != APP_CONTROL_ERROR_NONE) {
+               LOG_ERROR("failed to app_control_get_app_id()");
+               goto exit;
+       }
+
+       if (app_control_get_operation(app_control, &operation) != APP_CONTROL_ERROR_NONE) {
+               LOG_ERROR("failed to app_control_get_operation()");
+               goto exit;
+       }
+
+       LOG_INFO("app_id[%s] operation[%s]", app_id, operation);
+
+exit:
+       if (app_id)
+               free(app_id);
+       if (operation)
+               free(operation);
+}
+#endif
+
+int main(int argc, char *argv[])
+{
+       LOG_WARNING("launched, version[%s]", ESPP_SVC_VERSION);
+
+#ifndef USE_SERVICE_APP
+       if (get_option(argc, argv, &g_svc))
+               return 1;
+
+       if (!g_svc.start_service) {
+               LOG_DEBUG("Use 'espp-service -s' to start the service");
+               goto exit;
+       }
+
+       initialize_signals();
+
+       signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE */
+
+       umask(0); /* change the file mode mask */
+
+       if (espp_service_init_socket(&g_svc) != 0)
+               goto exit;
+
+       g_svc.fd_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, espp_service_handle_destroy_cb);
+
+       run(&g_svc);
+
+       g_hash_table_destroy(g_svc.fd_table);
+       espp_service_deinit_socket(&g_svc);
+       deinitialize_signals();
+
+exit:
+       LOG_WARNING("exit");
+
+       return 0;
+#else
+       service_app_lifecycle_callback_s event_cb = {0, };
+       event_cb.create = svc_app_create_cb;
+       event_cb.terminate = svc_app_terminate_cb;
+       event_cb.app_control = svc_app_control_cb;
+
+       LOG_WARNING("Use service_app_main()");
+       return service_app_main(argc, argv, &event_cb, &g_svc);
+#endif
+}
diff --git a/agent/espp-service/src/daemon/espp_service_handler.c b/agent/espp-service/src/daemon/espp_service_handler.c
new file mode 100644 (file)
index 0000000..78dafdb
--- /dev/null
@@ -0,0 +1,1363 @@
+/*
+ * Copyright (c) 2023 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 "espp_service_priv.h"
+#include <esplusplayer_capi.h>
+#include <esplusplayer_internal.h>
+#include <inttypes.h>
+#ifndef USE_TIZEN_60
+#include <tbm_surface.h>
+#include <image_util.h>
+#endif
+
+#define USECONDS_TO_MSECONDS(usec) ((usec) / G_GINT64_CONSTANT (1000))
+#define C(b,m)              (((b) >> (m)) & 0xFF)
+#define FOURCC_STR(id)      C(id,0), C(id,8), C(id,16), C(id,24)
+
+typedef int (*set_cb_func) (esplusplayer_handle handle, void *callback, void *user_data);
+typedef void (*func_handler) (handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result);
+#ifndef USE_TIZEN_60
+static gpointer __snapshot_work_thread(gpointer data);
+#endif
+
+typedef struct {
+       set_cb_func set_cb;
+       void *callback;
+} cb_intf_s;
+
+typedef struct {
+       int fd;
+       int event_fd;
+       esplusplayer_handle espp;
+       struct {
+               GThread *thread;
+               GAsyncQueue *queue;
+       } snapshot;
+} tb_data_s;
+#ifndef USE_TIZEN_60
+typedef struct {
+       int32_t id;
+       uint32_t width;
+       uint32_t height;
+       uint32_t size;
+       unsigned char *data;
+} snapshot_data_s;
+#endif
+
+static void __handle_init_event(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+       tb_data_s *tbs;
+       g_autofree gchar *key = NULL;
+
+       result->ret = -1;
+
+       ret = espp_service_msg_parse_params(data->params, data->request, &hdata->client.handle_addr);
+       if (ret != 0)
+               return;
+
+       LOG_INFO("fd[%d], client[pid:%u, handle:0x%x]", hdata->fd, hdata->client.pid, hdata->client.handle_addr);
+
+       key = g_strdup_printf("%u_%x", hdata->client.pid, hdata->client.handle_addr);
+       RET_IF(!(tbs = g_hash_table_lookup(hdata->svc->fd_table, key)), "failed to g_hash_table_lookup(), key[%s]", key);
+
+       tbs->event_fd = hdata->fd;
+
+       result->ret = 0;
+}
+
+#ifndef USE_TIZEN_60
+typedef struct {
+       int cb_id;
+       bool exit;
+} queue_data_s;
+
+static void __release_qd(gpointer data)
+{
+       queue_data_s *qd = (queue_data_s *)data;
+
+       LOG_DEBUG("release qd[%p, exit:%d] done", qd, qd->exit);
+       g_free(qd);
+}
+
+static int __init_snapshot_thread(tb_data_s *tbs)
+{
+       ASSERT(tbs);
+       ASSERT(!tbs->snapshot.queue);
+       ASSERT(!tbs->snapshot.thread);
+
+       tbs->snapshot.queue = g_async_queue_new_full(__release_qd);
+
+       if (!(tbs->snapshot.thread = g_thread_try_new("__snapshot_work_thread", __snapshot_work_thread, (gpointer)tbs, NULL))) {
+               LOG_ERROR("failed to g_thread_try_new()");
+               g_async_queue_unref(tbs->snapshot.queue);
+               tbs->snapshot.queue = NULL;
+               return -1;
+       }
+
+       return 0;
+}
+
+static void __deinit_snapshot_thread(tb_data_s *tbs)
+{
+       queue_data_s *qd;
+
+       ASSERT(tbs);
+       ASSERT(tbs->snapshot.queue);
+       ASSERT(tbs->snapshot.thread);
+
+       qd = g_new0(queue_data_s, 1);
+       qd->exit = true;
+       g_async_queue_push_front(tbs->snapshot.queue, qd);
+
+       LOG_DEBUG("waiting for thread join...");
+       g_thread_join(tbs->snapshot.thread);
+       LOG_DEBUG("snapshot thread exits");
+
+       g_async_queue_unref(tbs->snapshot.queue);
+
+       tbs->snapshot.queue = NULL;
+       tbs->snapshot.thread = NULL;
+}
+#endif
+
+static void __handle_create(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+       esplusplayer_handle espp;
+       tb_data_s *tbs;
+
+       result->ret = -1;
+
+       ret = espp_service_msg_parse_params(data->params, data->request, &hdata->client.handle_addr);
+       if (ret != 0)
+               return;
+
+       espp = esplusplayer_create();
+       ASSERT(espp);
+
+       hdata->espp = espp;
+       hdata->key = g_strdup_printf("%u_%x", hdata->client.pid, hdata->client.handle_addr);
+
+       LOG_INFO("fd[%d], client[pid:%u, handle:0x%x], ESPP[%p]: esplusplayer_create() success",
+               hdata->fd, hdata->client.pid, hdata->client.handle_addr, espp);
+
+       tbs = g_new0(tb_data_s, 1);
+       tbs->fd = hdata->fd;
+       tbs->espp = hdata->espp;
+
+       if (!g_hash_table_insert(hdata->svc->fd_table, hdata->key, (gpointer)tbs)) {
+               LOG_ERROR("should not be reached here, key[%s] already exist", hdata->key);
+               g_hash_table_remove(hdata->svc->fd_table, hdata->key);
+               esplusplayer_destroy(espp);
+               return;
+       }
+#ifndef USE_TIZEN_60
+       if (__init_snapshot_thread(tbs) != 0) {
+               g_hash_table_remove(hdata->svc->fd_table, hdata->key);
+               esplusplayer_destroy(espp);
+               return;
+       }
+#endif
+
+       result->ret = 0;
+}
+
+static void __handle_destroy(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       tb_data_s *tbs;
+       result->ret = -1;
+
+       RET_IF(!(tbs = g_hash_table_lookup(hdata->svc->fd_table, hdata->key)), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       RET_IF(esplusplayer_destroy((esplusplayer_handle)hdata->espp) != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_destroy()");
+
+       LOG_INFO("fd[%d]: esplusplayer_destroy() success", hdata->fd);
+
+       ASSERT(g_hash_table_steal(hdata->svc->fd_table, hdata->key));
+#ifndef USE_TIZEN_60
+       __deinit_snapshot_thread(tbs);
+#endif
+
+       result->ret = 0;
+}
+
+static void __handle_open(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = esplusplayer_open((esplusplayer_handle)hdata->espp);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_open(), ESPP[%p]", hdata->espp);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_open() success", hdata->fd, hdata->espp);
+
+       result->ret = 0;
+}
+
+static void __handle_close(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = esplusplayer_close((esplusplayer_handle)hdata->espp);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_close(), ESPP[%p]", hdata->espp);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_close() success", hdata->fd, hdata->espp);
+
+       result->ret = 0;
+}
+
+static void __handle_start(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = esplusplayer_start((esplusplayer_handle)hdata->espp);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_start(), ESPP[%p]", hdata->espp);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_start() success", hdata->fd, hdata->espp);
+
+       result->ret = 0;
+}
+
+static void __handle_stop(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = esplusplayer_stop((esplusplayer_handle)hdata->espp);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_stop(), ESPP[%p]", hdata->espp);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_stop() success", hdata->fd, hdata->espp);
+
+       result->ret = 0;
+}
+
+static void __handle_pause(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = esplusplayer_pause((esplusplayer_handle)hdata->espp);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_pause(), ESPP[%p]", hdata->espp);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_pause() success", hdata->fd, hdata->espp);
+
+       result->ret = 0;
+}
+
+static void __handle_resume(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = esplusplayer_resume((esplusplayer_handle)hdata->espp);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_resume(), ESPP[%p]", hdata->espp);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_resume() success", hdata->fd, hdata->espp);
+
+       result->ret = 0;
+}
+
+static void __handle_prepare_async(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = esplusplayer_prepare_async((esplusplayer_handle)hdata->espp);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_prepare_async(), ESPP[%p]", hdata->espp);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_prepare_async() success", hdata->fd, hdata->espp);
+
+       result->ret = 0;
+}
+
+static void __handle_seek(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+       uint64_t time_ms;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = espp_service_msg_parse_params(data->params, data->request, &time_ms);
+       if (ret != 0)
+               return;
+
+       ret = esplusplayer_seek((esplusplayer_handle)hdata->espp, time_ms);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_seek(), ESPP[%p], time_ms[%" PRIu64 "]", hdata->espp, time_ms);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_seek() success, time_ms[%" PRIu64 "]", hdata->fd, hdata->espp, time_ms);
+
+       result->ret = 0;
+}
+
+
+static void __handle_get_state(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       result->ret_int = esplusplayer_get_state((esplusplayer_handle)hdata->espp);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_get_state() success, state[%d]", hdata->fd, hdata->espp, result->ret_int);
+
+       result->ret = 0;
+}
+
+static void __handle_get_playing_time(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = esplusplayer_get_playing_time((esplusplayer_handle)hdata->espp, &result->ret_uint64);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_get_playing_time(), ESPP[%p]", hdata->espp);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_get_playing_time() success, time_ms[%" PRIu64 "]",
+               hdata->fd, hdata->espp, result->ret_uint64);
+
+       result->ret = 0;
+}
+
+guchar *__get_plain_string(const gchar *base64_str, uint32_t origin_len)
+{
+       guchar *str;
+       gsize len;
+
+       if (!base64_str)
+               return NULL;
+       if (origin_len == 0)
+               return NULL;
+
+       str = g_base64_decode(base64_str, &len);
+       ASSERT(len == origin_len);
+
+       LOG_DEBUG("base64_str[%s]", base64_str);
+
+       return str;
+}
+
+static void __handle_set_audio_stream_info(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+       esplusplayer_audio_stream_info info;
+       g_autofree guchar *codec_data = NULL;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = espp_service_msg_parse_params(data->params, data->request,
+               &info.codec_data, &info.codec_data_length, &info.mime_type,
+               &info.bitrate, &info.channels, &info.sample_rate);
+       if (ret != 0)
+               return;
+
+       /* NOTE that decoding 'codec_data' member with base64 here, see the client side. */
+       codec_data = __get_plain_string((const gchar *)info.codec_data, info.codec_data_length);
+       g_free(info.codec_data);
+       info.codec_data = (char *)codec_data;
+
+       ret = esplusplayer_set_audio_stream_info((esplusplayer_handle)hdata->espp, &info);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_audio_stream_info(), ESPP[%p]", hdata->espp);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_audio_stream_info() success", hdata->fd, hdata->espp);
+
+       result->ret = 0;
+}
+
+static void __handle_set_video_stream_info(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+       esplusplayer_video_stream_info info;
+       g_autofree guchar *codec_data = NULL;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = espp_service_msg_parse_params(data->params, data->request,
+               &info.codec_data, &info.codec_data_length, &info.mime_type,
+               &info.width, &info.height, &info.max_width, &info.max_height,
+               &info.framerate_num, &info.framerate_den);
+       if (ret != 0)
+               return;
+
+       /* NOTE that decoding 'codec_data' member with base64 here, see the client side. */
+       codec_data = __get_plain_string((const gchar *)info.codec_data, info.codec_data_length);
+       g_free(info.codec_data);
+       info.codec_data = (char *)codec_data;
+
+       ret = esplusplayer_set_video_stream_info((esplusplayer_handle)hdata->espp, &info);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_video_stream_info(), ESPP[%p]", hdata->espp);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_video_stream_info() success", hdata->fd, hdata->espp);
+
+       result->ret = 0;
+}
+
+static void __handle_set_playback_rate(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+       double rate;
+       bool mute_audio;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = espp_service_msg_parse_params(data->params, data->request,
+               &rate, &mute_audio);
+       if (ret != 0)
+               return;
+
+       ret = esplusplayer_set_playback_rate((esplusplayer_handle)hdata->espp, rate, mute_audio);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_playback_rate(), ESPP[%p], rate[%f], mute_audio[%d]",
+               hdata->espp, rate, mute_audio);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_playback_rate() success, rate[%f], mute_audio[%d]",
+               hdata->fd, hdata->espp, rate, mute_audio);
+
+       result->ret = 0;
+}
+
+static void __handle_set_display_surface_id(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+       esplusplayer_display_type type;
+       unsigned int surface_id;
+       int x, y, w, h;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = espp_service_msg_parse_params(data->params, data->request,
+               &type, &surface_id, &x, &y, &w, &h);
+       if (ret != 0)
+               return;
+
+       ret = esplusplayer_set_surface_display((esplusplayer_handle)hdata->espp, type, surface_id, x, y, w, h);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_surface_display(), ESPP[%p], surface_id[%u]", hdata->espp, surface_id);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_surface_display() success, surface_id[%u]", hdata->fd, hdata->espp, surface_id);
+
+       result->ret = 0;
+}
+
+static void __handle_set_display_mode(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+       esplusplayer_display_mode mode;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = espp_service_msg_parse_params(data->params, data->request, &mode);
+       if (ret != 0)
+               return;
+
+       ret = esplusplayer_set_display_mode((esplusplayer_handle)hdata->espp, mode);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_display_mode(), ESPP[%p], mode[%d]", hdata->espp, mode);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_display_mode() success, mode[%d]", hdata->fd, hdata->espp, mode);
+
+       result->ret = 0;
+}
+
+static void __handle_set_display_roi(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+       int x, y, w, h;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = espp_service_msg_parse_params(data->params, data->request,
+               &x, &y, &w, &h);
+       if (ret != 0)
+               return;
+
+       ret = esplusplayer_set_display_roi((esplusplayer_handle)hdata->espp, x, y, w, h);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_display_roi(), ESPP[%p], x[%d], y[%d], w[%d], h[%d]",
+               hdata->espp, x, y, w, h);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_display_roi() success, x[%d], y[%d], w[%d], h[%d]",
+               hdata->fd, hdata->espp, x, y, w, h);
+
+       result->ret = 0;
+}
+
+static void __handle_set_display_visible(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+       bool visible;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = espp_service_msg_parse_params(data->params, data->request, &visible);
+       if (ret != 0)
+               return;
+
+       ret = esplusplayer_set_display_visible((esplusplayer_handle)hdata->espp, visible);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_display_visible(), ESPP[%p], visible[%d]",
+               hdata->espp, visible);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_display_visible() success, visible[%d]", hdata->fd, hdata->espp, visible);
+
+       result->ret = 0;
+}
+
+static void __handle_set_display_rotation(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+       esplusplayer_display_rotation_type type;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = espp_service_msg_parse_params(data->params, data->request, &type);
+       if (ret != 0)
+               return;
+
+       ret = esplusplayer_set_display_rotation((esplusplayer_handle)hdata->espp, type);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_display_rotation(), ESPP[%p], type[%d]",
+               hdata->espp, type);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_display_rotation() success, type[%d]",
+               hdata->fd, hdata->espp, type);
+
+       result->ret = 0;
+}
+
+static void __handle_set_audio_mute(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+       bool mute;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = espp_service_msg_parse_params(data->params, data->request, &mute);
+       if (ret != 0)
+               return;
+
+       ret = esplusplayer_set_audio_mute((esplusplayer_handle)hdata->espp, mute);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_audio_mute(), ESPP[%p], mute[%d]", hdata->espp, mute);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_audio_mute() success, mute[%d]", hdata->fd, hdata->espp, mute);
+
+       result->ret = 0;
+}
+
+static void __handle_set_audio_volume(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+       int volume;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = espp_service_msg_parse_params(data->params, data->request, &volume);
+       if (ret != 0)
+               return;
+
+       ret = esplusplayer_set_volume((esplusplayer_handle)hdata->espp, volume);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_volume(), ESPP[%p], volume[%d]", hdata->espp, volume);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_volume() success, volume[%d]", hdata->fd, hdata->espp, volume);
+
+       result->ret = 0;
+}
+
+static void __handle_get_audio_volume(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = esplusplayer_get_volume((esplusplayer_handle)hdata->espp, &result->ret_int);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_get_volume(), ESPP[%p]", hdata->espp);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_get_volume() success, volume[%d]",
+               hdata->fd, hdata->espp, result->ret_int);
+
+       result->ret = 0;
+}
+
+static void __handle_submit_packet(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+       esplusplayer_es_packet es_packet;
+       esplusplayer_submit_status status;
+       g_autofree gchar *buffer = NULL;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       memset(&es_packet, 0x0, sizeof(esplusplayer_es_packet));
+       ret = espp_service_msg_parse_params(data->params, data->request,
+               &es_packet.type, &es_packet.buffer_size,
+               &es_packet.pts, &es_packet.duration,
+               &es_packet.hdr10p_metadata_size);
+       if (ret != 0)
+               return;
+
+       LOG_INFO_OR_DEBUG(hdata->submit_count % 100 == 0,
+               "type[%d], buffer_size[%u], pts[%" PRIu64 "], duration[%" PRIu64 "], hdr10p_metadata_size[%u]",
+               es_packet.type, es_packet.buffer_size, es_packet.pts, es_packet.duration, es_packet.hdr10p_metadata_size);
+
+       if (es_packet.buffer_size > 0) {
+               buffer = g_malloc0(es_packet.buffer_size);
+               espp_service_read_buffer(hdata->fd, buffer, es_packet.buffer_size);
+               es_packet.buffer = buffer;
+       }
+
+       status = esplusplayer_submit_packet((esplusplayer_handle)hdata->espp, &es_packet);
+       if (status != ESPLUSPLAYER_SUBMIT_STATUS_SUCCESS) {
+               result->ret_int = status;
+               LOG_ERROR("failed to esplusplayer_submit_packet(), status[%d]", status);
+               return;
+       }
+
+       LOG_INFO_OR_DEBUG(hdata->submit_count++ % 100 == 0, "fd[%d], ESPP[%p]: esplusplayer_submit_packet() success [%d]",
+               hdata->fd, hdata->espp, hdata->submit_count);
+
+       result->ret = 0;
+}
+
+static void __handle_submit_eos_packet(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+       esplusplayer_submit_status status;
+       esplusplayer_stream_type stream_type;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = espp_service_msg_parse_params(data->params, data->request, &stream_type);
+       if (ret != 0)
+               return;
+
+       status = esplusplayer_submit_eos_packet((esplusplayer_handle)hdata->espp, stream_type);
+       if (status != ESPLUSPLAYER_SUBMIT_STATUS_SUCCESS) {
+               result->ret_int = status;
+               LOG_ERROR("failed to esplusplayer_submit_eos_packet(), stream_type[%d], status[%d]", stream_type, status);
+               return;
+       }
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_submit_eos_packet() success, stream_type[%d]", hdata->fd, hdata->espp, stream_type);
+
+       result->ret = 0;
+}
+
+static void __handle_set_buffer_size(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+       esplusplayer_buffer_option option;
+       uint64_t size;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = espp_service_msg_parse_params(data->params, data->request,
+               &option, &size);
+       if (ret != 0)
+               return;
+
+       ret = esplusplayer_set_buffer_size((esplusplayer_handle)hdata->espp, option, size);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_buffer_size(), ESPP[%p], option[%d], size[%" PRIu64 "]",
+               hdata->espp, option, size);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_buffer_size() success, option[%d], size[%" PRIu64 "]",
+               hdata->fd, hdata->espp, option, size);
+
+       result->ret = 0;
+}
+
+static void __handle_set_low_latency_mode(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+       esplusplayer_low_latency_mode mode;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = espp_service_msg_parse_params(data->params, data->request, &mode);
+       if (ret != 0)
+               return;
+
+       ret = esplusplayer_set_low_latency_mode((esplusplayer_handle)hdata->espp, mode);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_low_latency_mode(), ESPP[%p], mode[0x%x]",
+               hdata->espp, mode);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_low_latency_mode() success, mode[0x%x]",
+               hdata->fd, hdata->espp, mode);
+
+       result->ret = 0;
+}
+
+static void __handle_set_decoded_video_frame_buffer_type(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+       int type;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = espp_service_msg_parse_params(data->params, data->request, &type);
+       if (ret != 0)
+               return;
+
+#ifdef USE_TIZEN_60
+       LOG_WARNING("It's not supported because it's built with tizen 6.0");
+#else
+       ret = esplusplayer_set_video_frame_buffer_type((esplusplayer_handle)hdata->espp, (esplusplayer_decoded_video_frame_buffer_type)type);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_video_frame_buffer_type(), ESPP[%p], type[%d]",
+               hdata->espp, type);
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_video_frame_buffer_type() success, type[%d]",
+               hdata->fd, hdata->espp, type);
+#endif
+
+       result->ret = 0;
+}
+
+#ifndef USE_TIZEN_60
+static int __convert_colorspace(unsigned char *src_data, size_t src_size, int src_w, int src_h, image_util_colorspace_e src_colorspace, image_util_colorspace_e dst_colorspace, snapshot_data_s *result)
+{
+       int ret;
+       image_util_image_h src_image = NULL;
+       image_util_image_h dst_image = NULL;
+       transformation_h transform = NULL;
+       size_t size;
+
+       RET_VAL_IF(src_data == NULL, -1, "src_data is NULL");
+       RET_VAL_IF(result == NULL, -1, "result is NULL");
+
+       ret = image_util_create_image(src_w, src_h, src_colorspace, src_data, src_size, &src_image);
+       RET_VAL_IF(ret != IMAGE_UTIL_ERROR_NONE, -1, "failed to image_util_create_image()");
+
+       if ((ret = image_util_transform_create(&transform) != IMAGE_UTIL_ERROR_NONE)) {
+               LOG_ERROR("failed to image_util_transform_create(), ret[0x%x]", ret);
+               goto error;
+       }
+
+       if ((ret = image_util_transform_set_colorspace(transform, dst_colorspace) != IMAGE_UTIL_ERROR_NONE)) {
+               LOG_ERROR("failed to image_util_transform_set_colorspace(), ret[0x%x]", ret);
+               goto error;
+       }
+
+       if ((ret = image_util_transform_run2(transform, src_image, &dst_image) != IMAGE_UTIL_ERROR_NONE)) {
+               LOG_ERROR("failed to image_util_transform_run2(), ret[0x%x]", ret);
+               goto error;
+       }
+
+       if ((ret = image_util_get_image(dst_image, &result->width, &result->height, NULL, &result->data, &size) != IMAGE_UTIL_ERROR_NONE)) {
+               LOG_ERROR("failed to image_util_get_image(), ret[0x%x]", ret);
+               goto error;
+       }
+
+       image_util_transform_destroy(transform);
+       image_util_destroy_image(dst_image);
+       image_util_destroy_image(src_image);
+
+       result->size = (uint32_t)size;
+
+       LOG_INFO("src[data:%p, size:%zu, %dx%d, colorspace:%d] -> dst[data:%p, size:%u, %ux%u, colorspace:%d]",
+               src_data, src_size, src_w, src_h, src_colorspace, result->data, result->size, result->width, result->height, dst_colorspace);
+
+       return 0;
+error:
+       if (transform)
+               image_util_transform_destroy(transform);
+       if (dst_image)
+               image_util_destroy_image(dst_image);
+       if (src_image)
+               image_util_destroy_image(src_image);
+       return -1;
+}
+
+static int __get_image_util_colorspace(tbm_format in_format, image_util_colorspace_e *colorspace)
+{
+       switch(in_format) {
+               case TBM_FORMAT_NV12:
+                       *colorspace = IMAGE_UTIL_COLORSPACE_NV12;
+                       break;
+               case TBM_FORMAT_YUV420:
+                       *colorspace = IMAGE_UTIL_COLORSPACE_I420;
+                       break;
+               case TBM_FORMAT_BGRA8888:
+                       *colorspace = IMAGE_UTIL_COLORSPACE_BGRA8888;
+                       break;
+               case TBM_FORMAT_BGRX8888:
+                       *colorspace = IMAGE_UTIL_COLORSPACE_BGRX8888;
+                       break;
+               case TBM_FORMAT_ARGB8888:
+                       *colorspace = IMAGE_UTIL_COLORSPACE_ARGB8888;
+                       break;
+               default:
+                       LOG_ERROR("invalid tbm format");
+                       return -1;
+       }
+       return 0;
+}
+
+static int __convert_colorspace_to_rgb24(tbm_surface_h tbm_surf, snapshot_data_s *snapshot)
+{
+       guint src_size;
+       unsigned char *dst_buffer = NULL;
+       unsigned char *tmp_dst = NULL;
+       unsigned char *tmp_src = NULL;
+       unsigned int i;
+       tbm_surface_info_s info;
+       image_util_colorspace_e src_colorspace;
+
+       RET_VAL_IF(!tbm_surf, -1, "tbm_surf is NULL");
+       RET_VAL_IF(!snapshot, -1, "snapshot is NULL");
+
+       if (tbm_surface_get_info(tbm_surf, &info)) {
+         LOG_ERROR("failed to tbm_surface_get_info()");
+         return -1;
+       }
+
+       LOG_DEBUG("%c%c%c%c, %dx%d, size:%d, num of planes:%d",
+               FOURCC_STR(info.format), info.width, info.height, info.size, info.num_planes);
+
+       if (__get_image_util_colorspace(info.format, &src_colorspace) < 0) {
+               LOG_ERROR("failed to __get_image_util_color_space()");
+               return -1;
+       }
+
+       switch (src_colorspace) {
+       case IMAGE_UTIL_COLORSPACE_NV12:
+               src_size = (info.width * info.height) + (info.width * (info.height >> 1));
+
+               dst_buffer = (unsigned char *)g_malloc(src_size);
+               tmp_dst = dst_buffer;
+
+               /* Y plane */
+               tmp_src = (unsigned char *)info.planes[0].ptr;
+               for (i = 0; i < info.height; i++) {
+                       memcpy(tmp_dst, tmp_src, info.width);
+                       tmp_dst += info.width;
+                       tmp_src += info.planes[0].stride;
+               }
+               /* UV plane*/
+               tmp_src = (unsigned char *)info.planes[1].ptr;
+               for (i = 0; i < (info.height >> 1); i++) {
+                       memcpy(tmp_dst, tmp_src, info.width);
+                       tmp_dst += info.width;
+                       tmp_src += info.planes[1].stride;
+               }
+               break;
+       case IMAGE_UTIL_COLORSPACE_I420:
+               src_size = (info.width * info.height) * 2;
+
+               dst_buffer = (unsigned char *)g_malloc(src_size);
+               tmp_dst = dst_buffer;
+
+               /* Y plane */
+               tmp_src = (unsigned char *)info.planes[0].ptr;
+               for (i = 0; i < info.height; i++) {
+                       memcpy(tmp_dst, tmp_src, info.width);
+                       tmp_dst += info.width;
+                       tmp_src += info.planes[0].stride;
+               }
+               /* U plane */
+               tmp_src = (unsigned char *)info.planes[1].ptr;
+               for (i = 0; i < (info.height >> 1); i++) {
+                       memcpy(tmp_dst, tmp_src, (info.width >> 1));
+                       tmp_dst += (info.width >> 1);
+                       tmp_src += info.planes[1].stride;
+               }
+               /* V plane */
+               tmp_src = (unsigned char *)info.planes[2].ptr;
+               for (i = 0; i < (info.height >> 1); i++) {
+                       memcpy(tmp_dst, tmp_src, (info.width >> 1));
+                       tmp_dst += (info.width >> 1);
+                       tmp_src += info.planes[2].stride;
+               }
+               break;
+       case IMAGE_UTIL_COLORSPACE_BGRA8888:
+       case IMAGE_UTIL_COLORSPACE_BGRX8888:
+       case IMAGE_UTIL_COLORSPACE_ARGB8888:
+               src_size = (info.width * 4) * info.height;
+
+               dst_buffer = (unsigned char *)g_malloc(src_size);
+               memcpy(dst_buffer, info.planes[0].ptr, src_size);
+               break;
+       default:
+               LOG_ERROR("not supported format");
+               return -1;
+       }
+
+       return __convert_colorspace(dst_buffer, src_size, info.width, info.height,
+               src_colorspace, IMAGE_UTIL_COLORSPACE_RGB888, snapshot);
+}
+
+static int __get_rgb24_frame(esplusplayer_handle espp, snapshot_data_s *snapshot)
+{
+       int ret;
+       esplusplayer_decoded_video_packet pkt;
+       esplusplayer_get_decoded_video_frame_status_type status;
+       gint64 start_time = g_get_monotonic_time();
+
+       ASSERT(espp);
+       ASSERT(snapshot);
+
+       ret = esplusplayer_get_decoded_video_packet(espp, &pkt, &status);
+       RET_VAL_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, -1, "failed to esplusplayer_get_decoded_video_packet(), ESPP[%p]", espp);
+       RET_VAL_IF(status != ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_SUCCESS, -1, "failed to esplusplayer_get_decoded_video_packet(), ESPP[%p], status[%d]", espp, status);
+       LOG_DEBUG("elapsed: %"G_GINT64_FORMAT" ms (esplusplayer_get_decoded_video_packet())",
+               USECONDS_TO_MSECONDS(g_get_monotonic_time() - start_time));
+
+       if (__convert_colorspace_to_rgb24((tbm_surface_h)pkt.surface_data, snapshot) < 0)
+               goto exit;
+       LOG_DEBUG("elapsed: %"G_GINT64_FORMAT" ms (__convert_colorspace_to_rgb24())",
+               USECONDS_TO_MSECONDS(g_get_monotonic_time() - start_time));
+
+       LOG_INFO("ESPP[%p], snapshot[%ux%u, size:%u, data:%p]",
+               espp, snapshot->width, snapshot->height, snapshot->size, snapshot->data);
+exit:
+       if (esplusplayer_decoded_buffer_destroy(espp, &pkt) != ESPLUSPLAYER_ERROR_TYPE_NONE)
+               LOG_WARNING("failed to esplusplayer_decoded_buffer_destroy()");
+
+       return 0;
+}
+
+static void __snapshot_cb(tb_data_s *tbs, snapshot_data_s *snapshot)
+{
+       espp_service_data_from_server_s data = {0, };
+
+       ASSERT(tbs);
+       ASSERT(snapshot);
+
+       LOG_DEBUG("event_fd[%d], ESPP[%p]", tbs->event_fd, tbs->espp);
+
+       FILL_SOCKET_MSG_EVENT(data, ESPP_SERVICE_EVENT_CB_SNAPSHOT);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_EVENT_CB_SNAPSHOT,
+               "id", snapshot->id, "width", snapshot->width, "height", snapshot->height, "size", snapshot->size);
+
+       espp_service_send_data(tbs->event_fd, &data);
+       espp_service_send_buffer(tbs->event_fd, snapshot->data, snapshot->size);
+}
+
+static gpointer __snapshot_work_thread(gpointer data)
+{
+       tb_data_s *tbs = (tb_data_s *)data;
+       queue_data_s *qd;
+
+       while (1) {
+               snapshot_data_s snapshot = {-1, 0, 0, 0, NULL};
+
+               LOG_DEBUG("wait for data...");
+               if (!(qd = g_async_queue_pop(tbs->snapshot.queue))) {
+                       LOG_ERROR("qd is NULL");
+                       break;
+               }
+               LOG_INFO("process qd[%p, cb_id:%d, exit:%d]", qd, qd->cb_id, qd->exit);
+               if (qd->exit) {
+                       __release_qd(qd);
+                       break;
+               }
+
+               snapshot.id = qd->cb_id;
+               if (__get_rgb24_frame(tbs->espp, &snapshot) == 0) {
+                       __snapshot_cb(tbs, &snapshot);
+                       g_free(snapshot.data);
+               }
+               __release_qd(qd);
+       }
+
+       LOG_DEBUG("exit");
+       return NULL;
+}
+#endif
+
+static void __handle_take_snapshot(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+       int id;
+       tb_data_s *tbs;
+#ifndef USE_TIZEN_60
+       queue_data_s *qd;
+#endif
+
+       result->ret = -1;
+
+       RET_IF(!(tbs = g_hash_table_lookup(hdata->svc->fd_table, hdata->key)), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+#ifndef USE_TIZEN_60
+       ASSERT(tbs->snapshot.queue);
+#endif
+       ret = espp_service_msg_parse_params(data->params, data->request, &id);
+       if (ret != 0)
+               return;
+#ifdef USE_TIZEN_60
+       LOG_WARNING("It's not supported because it's built with tizen 6.0");
+#else
+       qd = g_new0(queue_data_s, 1);
+       qd->cb_id = id;
+       g_async_queue_push(tbs->snapshot.queue, qd);
+       LOG_INFO("qd[%p, cb_id:%d]", qd, id);
+#endif
+
+       result->ret = 0;
+}
+
+static void __handle_set_render_time_offset(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+       esplusplayer_stream_type stream_type;
+       int64_t time_offset_ms;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = espp_service_msg_parse_params(data->params, data->request, &stream_type, &time_offset_ms);
+       if (ret != 0)
+               return;
+#ifdef USE_TIZEN_60
+       LOG_WARNING("It's not supported because it's built with tizen 6.0");
+#else
+       ret = esplusplayer_set_render_time_offset((esplusplayer_handle)hdata->espp, stream_type, time_offset_ms);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE,
+               "failed to esplusplayer_set_render_time_offset(), ESPP[%p], stream_type[%d], time_offset_ms[%" PRId64 "]",
+               hdata->espp, stream_type, time_offset_ms);
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_render_time_offset() success, stream_type[%d], time_offset_ms[%" PRId64 "]",
+               hdata->fd, hdata->espp, stream_type, time_offset_ms);
+#endif
+
+       result->ret = 0;
+}
+
+static void __ready_to_prepare_cb(const int type, void *user_data)
+{
+       handler_userdata_s *hdata = (handler_userdata_s *)user_data;
+       tb_data_s *tbs;
+       espp_service_data_from_server_s data = {0, };
+
+       ASSERT(hdata);
+       ASSERT(hdata->svc);
+       ASSERT(hdata->fd >= 0);
+
+       LOG_DEBUG("type[%d], fd[%d], ESPP[%p]", type, hdata->fd, hdata->espp);
+
+       RET_IF(!(tbs = g_hash_table_lookup(hdata->svc->fd_table, hdata->key)), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       LOG_DEBUG("event_fd[%d], ESPP[%p]", tbs->event_fd, tbs->espp);
+
+       FILL_SOCKET_MSG_EVENT(data, ESPP_SERVICE_EVENT_CB_READY_TO_PREPARE);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_EVENT_CB_READY_TO_PREPARE, "type", type);
+
+       espp_service_send_data(tbs->event_fd, &data);
+}
+
+static void __prepare_async_done_cb(bool res, void *user_data)
+{
+       handler_userdata_s *hdata = (handler_userdata_s *)user_data;
+       tb_data_s *tbs;
+       espp_service_data_from_server_s data = {0, };
+
+       ASSERT(hdata);
+       ASSERT(hdata->svc);
+       ASSERT(hdata->fd >= 0);
+
+       LOG_DEBUG("res[%d], fd[%d], ESPP[%p]", res, hdata->fd, hdata->espp);
+
+       RET_IF(!(tbs = g_hash_table_lookup(hdata->svc->fd_table, hdata->key)), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       LOG_DEBUG("event_fd[%d], ESPP[%p]", tbs->event_fd, tbs->espp);
+
+       FILL_SOCKET_MSG_EVENT(data, ESPP_SERVICE_EVENT_CB_PREPARE_ASYNC_DONE);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_EVENT_CB_PREPARE_ASYNC_DONE, "result", res);
+       espp_service_send_data(tbs->event_fd, &data);
+}
+
+static void __ready_to_seek_cb(const int type, uint64_t time_ms, void *user_data)
+{
+       handler_userdata_s *hdata = (handler_userdata_s *)user_data;
+       tb_data_s *tbs;
+       espp_service_data_from_server_s data = {0, };
+
+       ASSERT(hdata);
+       ASSERT(hdata->svc);
+       ASSERT(hdata->fd >= 0);
+
+       LOG_DEBUG("type[%d], fd[%d], ESPP[%p]", type, hdata->fd, hdata->espp);
+
+       RET_IF(!(tbs = g_hash_table_lookup(hdata->svc->fd_table, hdata->key)), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       LOG_DEBUG("event_fd[%d], ESPP[%p]", tbs->event_fd, tbs->espp);
+
+       FILL_SOCKET_MSG_EVENT(data, ESPP_SERVICE_EVENT_CB_READY_TO_SEEK);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_EVENT_CB_READY_TO_SEEK,
+               "type", type, "time_ms", time_ms);
+
+       espp_service_send_data(tbs->event_fd, &data);
+}
+
+static void __seek_done_cb(void *user_data)
+{
+       handler_userdata_s *hdata = (handler_userdata_s *)user_data;
+       tb_data_s *tbs;
+       espp_service_data_from_server_s data = {0, };
+
+       ASSERT(hdata);
+       ASSERT(hdata->svc);
+       ASSERT(hdata->fd >= 0);
+
+       LOG_DEBUG("fd[%d], ESPP[%p]", hdata->fd, hdata->espp);
+
+       RET_IF(!(tbs = g_hash_table_lookup(hdata->svc->fd_table, hdata->key)), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       LOG_DEBUG("event_fd[%d], ESPP[%p]", tbs->event_fd, tbs->espp);
+
+       FILL_SOCKET_MSG_EVENT(data, ESPP_SERVICE_EVENT_CB_SEEK_DONE);
+       espp_service_send_data(tbs->event_fd, &data);
+}
+
+static void __eos_cb(void *user_data)
+{
+       handler_userdata_s *hdata = (handler_userdata_s *)user_data;
+       tb_data_s *tbs;
+       espp_service_data_from_server_s data = {0, };
+
+       ASSERT(hdata);
+       ASSERT(hdata->svc);
+       ASSERT(hdata->fd >= 0);
+
+       LOG_DEBUG("fd[%d], ESPP[%p]", hdata->fd, hdata->espp);
+
+       RET_IF(!(tbs = g_hash_table_lookup(hdata->svc->fd_table, hdata->key)), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       LOG_DEBUG("event_fd[%d], ESPP[%p]", tbs->event_fd, tbs->espp);
+
+       FILL_SOCKET_MSG_EVENT(data, ESPP_SERVICE_EVENT_CB_EOS);
+       espp_service_send_data(tbs->event_fd, &data);
+}
+
+static void __buffer_status_cb(const int stream_type, const int buffer_status, void *user_data)
+{
+       handler_userdata_s *hdata = (handler_userdata_s *)user_data;
+       tb_data_s *tbs;
+       espp_service_data_from_server_s data = {0, };
+
+       ASSERT(hdata);
+       ASSERT(hdata->svc);
+       ASSERT(hdata->fd >= 0);
+
+       LOG_DEBUG("stream_type[%d], buffer_status[%d], fd[%d], ESPP[%p]", stream_type, buffer_status, hdata->fd, hdata->espp);
+
+       RET_IF(!(tbs = g_hash_table_lookup(hdata->svc->fd_table, hdata->key)), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       LOG_DEBUG("event_fd[%d], ESPP[%p]", tbs->event_fd, tbs->espp);
+
+       FILL_SOCKET_MSG_EVENT(data, ESPP_SERVICE_EVENT_CB_BUFFER_STATUS);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_EVENT_CB_BUFFER_STATUS,
+               "stream_type", stream_type, "buffer_status", buffer_status);
+       espp_service_send_data(tbs->event_fd, &data);
+}
+
+static void __resource_conflicted_cb(void *user_data)
+{
+       handler_userdata_s *hdata = (handler_userdata_s *)user_data;
+       tb_data_s *tbs;
+       espp_service_data_from_server_s data = {0, };
+
+       ASSERT(hdata);
+       ASSERT(hdata->svc);
+       ASSERT(hdata->fd >= 0);
+
+       LOG_DEBUG("fd[%d], ESPP[%p]", hdata->fd, hdata->espp);
+
+       RET_IF(!(tbs = g_hash_table_lookup(hdata->svc->fd_table, hdata->key)), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       LOG_DEBUG("event_fd[%d], ESPP[%p]", tbs->event_fd, tbs->espp);
+
+       FILL_SOCKET_MSG_EVENT(data, ESPP_SERVICE_EVENT_CB_RESOURCE_CONFLICTED);
+       espp_service_send_data(tbs->event_fd, &data);
+}
+
+static void __error_cb(const int error, void *user_data)
+{
+       handler_userdata_s *hdata = (handler_userdata_s *)user_data;
+       tb_data_s *tbs;
+       espp_service_data_from_server_s data = {0, };
+
+       ASSERT(hdata);
+       ASSERT(hdata->svc);
+       ASSERT(hdata->fd >= 0);
+
+       LOG_DEBUG("error[%d], fd[%d], ESPP[%p]", error, hdata->fd, hdata->espp);
+
+       RET_IF(!(tbs = g_hash_table_lookup(hdata->svc->fd_table, hdata->key)), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       LOG_DEBUG("event_fd[%d], ESPP[%p]", tbs->event_fd, tbs->espp);
+
+       FILL_SOCKET_MSG_EVENT(data, ESPP_SERVICE_EVENT_CB_ERROR);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_EVENT_CB_ERROR, "error", error);
+
+       espp_service_send_data(tbs->event_fd, &data);
+}
+
+static cb_intf_s cb_setters[] = {
+       [ESPP_SERVICE_EVENT_CB_READY_TO_PREPARE] = { (set_cb_func)esplusplayer_set_ready_to_prepare_cb, __ready_to_prepare_cb},
+       [ESPP_SERVICE_EVENT_CB_PREPARE_ASYNC_DONE] = { (set_cb_func)esplusplayer_set_prepare_async_done_cb, __prepare_async_done_cb},
+       [ESPP_SERVICE_EVENT_CB_READY_TO_SEEK] = { (set_cb_func)esplusplayer_set_ready_to_seek_cb, __ready_to_seek_cb},
+       [ESPP_SERVICE_EVENT_CB_SEEK_DONE] = { (set_cb_func)esplusplayer_set_seek_done_cb, __seek_done_cb},
+       [ESPP_SERVICE_EVENT_CB_EOS] = { (set_cb_func)esplusplayer_set_eos_cb, __eos_cb},
+       [ESPP_SERVICE_EVENT_CB_BUFFER_STATUS] = { (set_cb_func)esplusplayer_set_buffer_status_cb, __buffer_status_cb},
+       [ESPP_SERVICE_EVENT_CB_RESOURCE_CONFLICTED] = { (set_cb_func)esplusplayer_set_resource_conflicted_cb, __resource_conflicted_cb},
+       [ESPP_SERVICE_EVENT_CB_ERROR] = { (set_cb_func)esplusplayer_set_error_cb, __error_cb},
+};
+
+static void __handle_set_callback(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+       espp_service_event_e cb_type;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = espp_service_msg_parse_params(data->params, data->request, &cb_type);
+       if (ret != 0)
+               return;
+
+       RET_IF(cb_type < ESPP_SERVICE_EVENT_CB_READY_TO_PREPARE || cb_type > ESPP_SERVICE_EVENT_CB_ERROR,
+               "invalid cb_type[%d]", cb_type);
+
+       ret = cb_setters[cb_type].set_cb((esplusplayer_handle)hdata->espp, cb_setters[cb_type].callback, hdata);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to set an esplusplayer callback, ESPP[%p], cb_type[%d]", hdata->espp, cb_type);
+
+       LOG_INFO("fd[%d], ESPP[%p]: cb_type[%d]", hdata->fd, hdata->espp, cb_type);
+
+       result->ret = 0;
+}
+
+static func_handler handlers[] = {
+       [ESPP_SERVICE_REQUEST_INIT_EVENT] = __handle_init_event,
+       [ESPP_SERVICE_REQUEST_CREATE] = __handle_create,
+       [ESPP_SERVICE_REQUEST_DESTROY] = __handle_destroy,
+       [ESPP_SERVICE_REQUEST_OPEN] = __handle_open,
+       [ESPP_SERVICE_REQUEST_CLOSE] = __handle_close,
+       [ESPP_SERVICE_REQUEST_START] = __handle_start,
+       [ESPP_SERVICE_REQUEST_STOP] = __handle_stop,
+       [ESPP_SERVICE_REQUEST_PAUSE] = __handle_pause,
+       [ESPP_SERVICE_REQUEST_RESUME] = __handle_resume,
+       [ESPP_SERVICE_REQUEST_PREPARE_ASYNC] = __handle_prepare_async,
+       [ESPP_SERVICE_REQUEST_SEEK] = __handle_seek,
+       [ESPP_SERVICE_REQUEST_GET_STATE] = __handle_get_state,
+       [ESPP_SERVICE_REQUEST_GET_PLAYING_TIME] = __handle_get_playing_time,
+       [ESPP_SERVICE_REQUEST_SET_AUDIO_STREAM_INFO] = __handle_set_audio_stream_info,
+       [ESPP_SERVICE_REQUEST_SET_VIDEO_STREAM_INFO] = __handle_set_video_stream_info,
+       [ESPP_SERVICE_REQUEST_SET_PLAYBACK_RATE] = __handle_set_playback_rate,
+       [ESPP_SERVICE_REQUEST_SET_DISPLAY_SURFACE_ID] = __handle_set_display_surface_id,
+       [ESPP_SERVICE_REQUEST_SET_DISPLAY_MODE] = __handle_set_display_mode,
+       [ESPP_SERVICE_REQUEST_SET_DISPLAY_ROI] = __handle_set_display_roi,
+       [ESPP_SERVICE_REQUEST_SET_DISPLAY_VISIBLE] = __handle_set_display_visible,
+       [ESPP_SERVICE_REQUEST_SET_DISPLAY_ROTATION] = __handle_set_display_rotation,
+       [ESPP_SERVICE_REQUEST_SET_AUDIO_MUTE] = __handle_set_audio_mute,
+       [ESPP_SERVICE_REQUEST_SET_AUDIO_VOLUME] = __handle_set_audio_volume,
+       [ESPP_SERVICE_REQUEST_GET_AUDIO_VOLUME] = __handle_get_audio_volume,
+       [ESPP_SERVICE_REQUEST_SUBMIT_PACKET] = __handle_submit_packet,
+       [ESPP_SERVICE_REQUEST_SUBMIT_EOS_PACKET] = __handle_submit_eos_packet,
+       [ESPP_SERVICE_REQUEST_SET_BUFFER_SIZE] = __handle_set_buffer_size,
+       [ESPP_SERVICE_REQUEST_SET_LOW_LATENCY_MODE] = __handle_set_low_latency_mode,
+       [ESPP_SERVICE_REQUEST_SET_DECODED_VIDEO_FRAME_BUFFER_TYPE] = __handle_set_decoded_video_frame_buffer_type,
+       [ESPP_SERVICE_REQUEST_TAKE_SNAPSHOT] = __handle_take_snapshot,
+       [ESPP_SERVICE_REQUEST_SET_RENDER_TIME_OFFSET] = __handle_set_render_time_offset,
+       [ESPP_SERVICE_REQUEST_SET_CALLBACK] = __handle_set_callback,
+};
+
+void espp_service_func_handler(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       ASSERT(hdata);
+       ASSERT(hdata->fd >= 0);
+       ASSERT(hdata->svc);
+       ASSERT(data);
+       ASSERT(result);
+       ASSERT(data->request < ESPP_SERVICE_REQUEST_NUM);
+
+       if (data->request == ESPP_SERVICE_REQUEST_SUBMIT_PACKET)
+               LOG_DEBUG("fd[%d] data[%p, request:%s]", hdata->fd, data, espp_service_common_get_requests()[data->request].str);
+       else
+               LOG_WARNING("fd[%d] data[%p, request:%s]", hdata->fd, data, espp_service_common_get_requests()[data->request].str);
+
+       handlers[data->request](hdata, data, result);
+}
+
+void espp_service_handle_destroy_cb(gpointer data)
+{
+       tb_data_s *tbs = (tb_data_s *)data;
+
+       ASSERT(tbs);
+
+       LOG_INFO("destroy tbs[%p, fd:%d, event_fd:%d, ESPP:%p]",
+               tbs, tbs->fd, tbs->event_fd, tbs->espp);
+
+       if (esplusplayer_stop(tbs->espp) != ESPLUSPLAYER_ERROR_TYPE_NONE)
+               LOG_ERROR("failed to esplusplayer_stop()");
+       if (esplusplayer_close(tbs->espp) != ESPLUSPLAYER_ERROR_TYPE_NONE)
+               LOG_ERROR("failed to esplusplayer_close()");
+       if (esplusplayer_destroy(tbs->espp) != ESPLUSPLAYER_ERROR_TYPE_NONE)
+               LOG_ERROR("failed to esplusplayer_destroy()");
+
+       g_free(tbs);
+}
diff --git a/agent/espp-service/src/daemon/espp_service_msg.c b/agent/espp-service/src/daemon/espp_service_msg.c
new file mode 100644 (file)
index 0000000..c95759c
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2023 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 "espp_service_priv.h"
+
+int espp_service_msg_parse_params(const char *params, espp_service_request_e request, ...)
+{
+       int ret;
+       va_list ap;
+
+       ASSERT(params);
+       ASSERT(request < ESPP_SERVICE_REQUEST_NUM);
+
+       va_start(ap, request);
+       ret = espp_service_common_parse_json_structured_message(ap, params, espp_service_common_get_requests()[request].param_formats);
+       va_end(ap);
+
+       return ret;
+}
diff --git a/agent/espp-service/src/daemon/espp_service_priv.h b/agent/espp-service/src/daemon/espp_service_priv.h
new file mode 100644 (file)
index 0000000..a9c88e1
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2023 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 __ESPP_SERVICE_PRIV_H__
+#define __ESPP_SERVICE_PRIV_H__
+
+#include "../common/espp_service_common.h"
+#include "../common/espp_service_ipc.h"
+
+#ifdef ST_AVP_TIZEN_70
+#ifdef USE_TIZEN_60
+#undef USE_TIZEN_60
+#endif
+#endif
+
+#ifdef USE_DLOG
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "ESPP_SERVICE"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define FILL_SOCKET_MSG_PARAMS(x_msg, x_event, ...) \
+do { \
+       gchar *params = espp_service_common_msg_params_new(espp_service_common_get_events()[x_event].param_formats, ##__VA_ARGS__); \
+       memset(&x_msg.params, 0x00, MAX_PARAMS_LEN); \
+       if (!params) break; \
+       STRNCPY(x_msg.params, params, MAX_PARAMS_LEN); \
+       g_free(params); \
+} while (0) \
+
+#define FILL_SOCKET_MSG_EVENT(x_msg, x_event) \
+do { \
+       x_msg.event = x_event; \
+} while (0) \
+
+typedef struct {
+       GMainLoop *mainloop;
+#ifdef USE_SERVICE_APP
+       GThread *thread;
+#else
+       bool start_service;
+#endif
+       int fd;
+       pthread_t thread_id;
+       GHashTable *fd_table;
+} espp_service_s;
+
+typedef struct {
+       espp_service_s *svc;
+       int fd;
+       struct {
+               int handle_addr;
+               unsigned int pid;
+       } client;
+       void *espp;
+       gchar *key;
+       int submit_count;
+} handler_userdata_s;
+
+/* socket */
+int espp_service_init_socket(espp_service_s *svc);
+void espp_service_deinit_socket(espp_service_s *svc);
+int espp_service_send_data(int fd, espp_service_data_from_server_s *data);
+int espp_service_read_buffer(int fd, char *buffer, uint32_t size);
+int espp_service_send_buffer(int fd, const unsigned char *buffer, uint32_t size);
+
+/* handler */
+void espp_service_func_handler(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result);
+void espp_service_handle_destroy_cb(gpointer data);
+
+/* message */
+int espp_service_msg_parse_params(const char *params, espp_service_request_e request, ...);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __ESPP_SERVICE_PRIV_H__ */
diff --git a/agent/espp-service/src/daemon/espp_service_socket.c b/agent/espp-service/src/daemon/espp_service_socket.c
new file mode 100644 (file)
index 0000000..6821895
--- /dev/null
@@ -0,0 +1,408 @@
+/*
+ * Copyright (c) 2023 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 "espp_service_priv.h"
+#include <gio/gio.h>
+#define __USE_GNU /* define for ucred in socket.h */
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <pthread.h>
+#ifdef USE_SERVICE_APP
+#include <service_app.h>
+#endif
+
+#define EXIT_IF_NEEDED(x_rx_data) \
+do { \
+       if (x_rx_data.request == ESPP_SERVICE_REQUEST_DESTROY) \
+               return -1; \
+} while (0)
+
+#define SET_IF_EVENT_MODE(x_rx_data, x_event_mode) \
+do { \
+       if (x_rx_data.request == ESPP_SERVICE_REQUEST_INIT_EVENT) { \
+               *x_event_mode = true; \
+               return 0; \
+       } \
+} while (0)
+
+static int __event_ret_msg_handling(handler_userdata_s *hdata)
+{
+       int fd;
+       int ret;
+       const int read_len = sizeof(espp_service_data_from_client_s);
+       char str_error[MAX_ERROR_LEN] = {'\0',};
+       espp_service_data_from_client_s rx_data;
+
+       ASSERT(hdata);
+       ASSERT(hdata->fd >= 0);
+       ASSERT(hdata->svc);
+
+       fd = hdata->fd;
+
+       memset(&rx_data, 0x00, read_len);
+       if ((ret = read(fd, &rx_data, read_len)) <= 0) {
+               strerror_r(errno, str_error, sizeof(str_error));
+               LOG_ERROR("failed to read(), fd[%d], err: %s", fd, str_error);
+               return -1;
+       }
+
+       if (ret != read_len) {
+               LOG_ERROR("failed to read(), fd[%d], read size mismatched: ret[%d], expect size[%d]",
+                       fd, ret, read_len);
+               return -1;
+       }
+
+       LOG_DEBUG("<<<<< from fd[%d]: ret[%d]", fd, rx_data.ret);
+
+       if (rx_data.ret == -2) {
+               LOG_WARNING("ret[-2] to exit, bye");
+               return -1;
+       }
+
+       return 0;
+}
+
+static int __request_msg_handling(handler_userdata_s *hdata, bool *event_mode)
+{
+       int fd;
+       int ret;
+       const int read_len = sizeof(espp_service_data_from_client_s);
+       const int write_len = sizeof(espp_service_data_from_server_s);
+       char str_error[MAX_ERROR_LEN] = {'\0',};
+       espp_service_data_from_client_s rx_data;
+       espp_service_data_from_server_s tx_data;
+
+       ASSERT(hdata);
+       ASSERT(hdata->fd >= 0);
+       ASSERT(hdata->svc);
+       ASSERT(event_mode);
+
+       fd = hdata->fd;
+
+       memset(&rx_data, 0x00, read_len);
+       if ((ret = read(fd, &rx_data, read_len)) <= 0) {
+               strerror_r(errno, str_error, sizeof(str_error));
+               LOG_ERROR("failed to read(), fd[%d], err: %s", fd, str_error);
+               goto remove_data_from_table;
+       }
+
+       if (ret != read_len) {
+               LOG_ERROR("failed to read(), fd[%d], read size mismatched: ret[%d], expect size[%d]",
+                       fd, ret, read_len);
+               return -1;
+       }
+
+       ASSERT(rx_data.request < ESPP_SERVICE_REQUEST_NUM);
+       LOG_DEBUG("<<<<< from fd[%d]: request[%s]", fd, espp_service_common_get_requests()[rx_data.request].str);
+
+       memset(&tx_data, 0x00, write_len);
+       espp_service_func_handler(hdata, &rx_data, &tx_data);
+       LOG_DEBUG(">>>>>> to fd[%d]: ret[%d]", fd, tx_data.ret);
+
+       if (write(fd, &tx_data, write_len) < 0) {
+               strerror_r(errno, str_error, sizeof(str_error));
+               LOG_ERROR("failed to write(), fd[%d], err: %s", fd, str_error);
+       }
+
+       EXIT_IF_NEEDED(rx_data);
+       SET_IF_EVENT_MODE(rx_data, event_mode);
+
+       return 0;
+
+remove_data_from_table:
+       /* NOTE: Because both event return and request msg channel use the same hdata->key value,
+        * remove the key from the hashtable here only. 'hdata->key' will be freed. */
+       g_hash_table_remove(hdata->svc->fd_table, hdata->key);
+       return -1;
+}
+
+static void *__work_thread_func(void *data)
+{
+       bool event_mode = false;
+       handler_userdata_s *hdata = (handler_userdata_s *)data;
+       espp_service_s *svc;
+       guint num_of_clients;
+
+       ASSERT(hdata);
+       ASSERT(hdata->fd != -1);
+
+       svc = hdata->svc;
+
+       LOG_WARNING("entrance, fd[%d]", hdata->fd);
+
+       while (1) {
+               if (!event_mode) {
+                       if (__request_msg_handling(hdata, &event_mode) == -1)
+                               goto exit;
+               } else {
+                       if (__event_ret_msg_handling(hdata) == -1)
+                               goto exit;
+               }
+       }
+
+exit:
+       num_of_clients = g_hash_table_size(hdata->svc->fd_table);
+       LOG_WARNING("exit, fd[%d], svc[%p], num_of_clients[%u] remain", hdata->fd, svc, num_of_clients);
+       close(hdata->fd);
+       g_free(hdata);
+#ifdef USE_SERVICE_APP
+       if (num_of_clients == 0) {
+               LOG_ERROR("no more clients, quit main loop to exit service...");
+               g_main_loop_quit(svc->mainloop);
+       }
+#endif
+       pthread_exit(NULL);
+}
+
+static unsigned int get_pid_from_fd(int fd)
+{
+       struct ucred cred;
+       socklen_t len = (socklen_t)sizeof(struct ucred);
+       char str_error[MAX_ERROR_LEN] = {'\0',};
+
+       if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cred, &len) < 0) {
+               strerror_r(errno, str_error, sizeof(str_error));
+               LOG_ERROR("failed to getsockopt(), err: %s", str_error);
+               return 0;
+       }
+
+       LOG_INFO("fd[%d] pid[%u]", fd, cred.pid);
+
+       return cred.pid;
+}
+
+static void *__listen_thread_func(void *data)
+{
+       espp_service_s *svc = (espp_service_s *)data;
+       int ret;
+       int fd;
+       int client_fd = -1;
+       pthread_attr_t attr;
+       char str_error[MAX_ERROR_LEN] = {'\0',};
+       handler_userdata_s *userdata = NULL;
+       pthread_t work_thread_id;
+
+       ASSERT(svc);
+       ASSERT(svc->fd >= 0);
+
+       ret = pthread_attr_init(&attr);
+       if (ret != 0) {
+               LOG_ERROR("failed to pthread_attr_init(), ret[%d]", ret);
+               goto exit;
+       }
+
+       ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+       if (ret != 0) {
+               LOG_ERROR("failed to pthread_attr_setdetachstate(), ret[%d]", ret);
+               goto exit;
+       }
+
+       fd = svc->fd;
+
+       if (listen(fd, 5)) {
+               strerror_r(errno, str_error, sizeof(str_error));
+               LOG_ERROR("failed to listen(), err: %s", str_error);
+               goto exit;
+       }
+       LOG_INFO("listen for fd[%d] success", fd);
+
+       while (1) {
+               client_fd = accept(fd, NULL, NULL);
+               if (client_fd == -1) {
+                       if (errno == EINVAL) /* this might be for socket close */
+                               goto exit;
+                       strerror_r(errno, str_error, sizeof(str_error));
+                       LOG_ERROR("failed to accept(), err: %s", str_error);
+                       goto exit;
+               }
+
+               userdata = g_new0(handler_userdata_s, 1);
+               userdata->svc = svc;
+               userdata->fd = client_fd;
+               userdata->client.pid = get_pid_from_fd(client_fd);
+
+               LOG_DEBUG("client[fd:%d, pid:%u]", client_fd, userdata->client.pid);
+
+               if (pthread_create(&work_thread_id, &attr, (void *)__work_thread_func, (void *)userdata)) {
+                       LOG_ERROR("failed to pthread_create(), client_fd[%d]", client_fd);
+                       g_free(userdata);
+                       goto exit;
+               }
+       }
+
+exit:
+       if (client_fd >= 0)
+               close(client_fd);
+
+       LOG_DEBUG("pthread_exit()");
+       pthread_attr_destroy(&attr);
+       pthread_exit(NULL);
+}
+
+static int __create_listener_thread(espp_service_s *svc)
+{
+       ASSERT(svc);
+       ASSERT(svc->fd >= 0);
+
+       if (pthread_create(&svc->thread_id, NULL, (void *)__listen_thread_func, (void *)svc)) {
+               LOG_ERROR("failed to pthread_create()");
+               return -1;
+       }
+
+       LOG_DEBUG("thread_id[0x%x]", (unsigned)svc->thread_id);
+
+       return 0;
+}
+
+int espp_service_init_socket(espp_service_s *svc)
+{
+       int fd;
+       struct sockaddr_un addr_un;
+       char str_error[128] = {'\0',};
+       g_autofree gchar *sock_path = NULL;
+
+       ASSERT(svc);
+
+       fd = socket(AF_UNIX, SOCK_STREAM, 0);
+       if (fd < 0) {
+               strerror_r(errno, str_error, sizeof(str_error));
+               LOG_ERROR("failed to socket(), err: %s", str_error);
+               goto exit;
+       }
+
+       LOG_DEBUG("fd[%d]", fd);
+
+       memset(&addr_un, 0, sizeof(addr_un));
+       addr_un.sun_family = AF_UNIX;
+       sock_path = espp_service_common_get_sock_file_path();
+       strncpy(addr_un.sun_path, sock_path, sizeof(addr_un.sun_path) - 1);
+
+       if (bind(fd, (struct sockaddr *)&addr_un, sizeof(addr_un))) {
+               int errsv = errno;
+               strerror_r(errsv, str_error, sizeof(str_error));
+               LOG_ERROR("failed to bind(), sun_path[%s], err: %s", addr_un.sun_path, str_error);
+               if (errsv == EADDRINUSE) {
+                       unlink(sock_path);
+                       LOG_DEBUG("unlink socket and bind again...");
+                       if (bind(fd, (struct sockaddr *)&addr_un, sizeof(addr_un))) {
+                               strerror_r(errno, str_error, sizeof(str_error));
+                               LOG_ERROR("failed to bind() again, err: %s", str_error);
+                               goto exit;
+                       }
+               } else {
+                       goto exit;
+               }
+       }
+
+       svc->fd = fd;
+       LOG_DEBUG("socket binding success, sock_path[%s], fd[%d]", sock_path, svc->fd);
+
+       if (__create_listener_thread(svc) != 0)
+               goto exit;
+
+       return 0;
+
+exit:
+       if (fd >= 0)
+               close(fd);
+
+       return -1;
+}
+
+void espp_service_deinit_socket(espp_service_s *svc)
+{
+       ASSERT(svc);
+
+       if (svc->fd >= 0) {
+               unlink(ESPP_SERVICE_SOCK);
+               shutdown(svc->fd, SHUT_RDWR);
+               close(svc->fd);
+               LOG_DEBUG("close() done, fd[%d]", svc->fd);
+               svc->fd = -1;
+       }
+
+       if (svc->thread_id > 0) {
+               LOG_DEBUG("try to pthread_join(), thread_id[0x%x]", (unsigned)svc->thread_id);
+               pthread_join(svc->thread_id, NULL);
+               LOG_DEBUG("pthread_join() done");
+               svc->thread_id = 0;
+       }
+}
+
+int espp_service_send_data(int fd, espp_service_data_from_server_s *data)
+{
+       char str_error[MAX_ERROR_LEN] = {'\0',};
+
+       ASSERT(fd >= 0);
+       ASSERT(data);
+
+       if (write(fd, data, sizeof(espp_service_data_from_server_s)) < 0) {
+               strerror_r(errno, str_error, sizeof(str_error));
+               LOG_ERROR("failed to write(), fd[%d], err: %s", fd, str_error);
+               return -1;
+       }
+
+       LOG_DEBUG("fd[%d] event[%d]", fd, data->event);
+
+       return 0;
+}
+
+int espp_service_send_buffer(int fd, const unsigned char *buffer, uint32_t size)
+{
+       char str_error[MAX_ERROR_LEN] = {'\0',};
+
+       ASSERT(fd >= 0);
+       ASSERT(buffer);
+       ASSERT(size > 0);
+
+       if (write(fd, buffer, size) < 0) {
+               strerror_r(errno, str_error, sizeof(str_error));
+               LOG_ERROR("failed to write(), fd[%d], err: %s", fd, str_error);
+               return -1;
+       }
+
+       LOG_DEBUG("fd[%d] buffer[%p] size[%u]", fd, buffer, size);
+
+       return 0;
+}
+
+int espp_service_read_buffer(int fd, char *buffer, uint32_t size)
+{
+       int ret;
+       uint32_t total = 0;
+       char str_error[MAX_ERROR_LEN] = {'\0',};
+
+       ASSERT(fd >= 0);
+       ASSERT(buffer);
+
+       do {
+               if ((ret = read(fd, buffer + total, size - total)) < 0) {
+                       strerror_r(errno, str_error, sizeof(str_error));
+                       LOG_ERROR("failed to read(), fd[%d], ret[%d], err: %s", fd, ret, str_error);
+                       break;
+               }
+               total += ret;
+       } while (total < size);
+
+       if (total != size) {
+               LOG_ERROR("total[%u], expected size[%u]", total, size);
+               return -1;
+       }
+
+       LOG_DEBUG("fd[%d] buffer[%p, size:%u]", fd, buffer, size);
+
+       return 0;
+}
diff --git a/agent/espp-service/src/daemon/meson.build b/agent/espp-service/src/daemon/meson.build
new file mode 100644 (file)
index 0000000..43e50dd
--- /dev/null
@@ -0,0 +1,44 @@
+espp_service_sources = [
+  '../common/espp_service_ipc.c',
+  'espp_service.c',
+  'espp_service_socket.c',
+  'espp_service_handler.c',
+  'espp_service_msg.c',
+]
+
+daemon_deps = common_deps
+
+message('================ daemon options ================')
+if get_option('tizen-60')
+  message('tizen-6.0 option is enabled, set USE_TIZEN_60')
+  conf_data.set('USE_TIZEN_60', true)
+else
+  tbm_dep = dependency('libtbm', required: true)
+  image_util_dep = dependency('capi-media-image-util', required: true)
+  daemon_deps += [tbm_dep, image_util_dep]
+endif
+message('bindir: '+ get_option('_bindir'))
+if get_option('service-app')
+  message('service-app option is enabled, set USE_SERVICE_APP')
+  conf_data.set('USE_SERVICE_APP', true)
+  service_app_dep = dependency('capi-appfw-service-application', required: true)
+  daemon_deps += [service_app_dep]
+endif
+
+message('================================================')
+
+thread_dep = dependency('threads', required: true)
+espp_dep = dependency('esplusplayer', required: true)
+
+daemon_deps += [thread_dep, espp_dep]
+
+executable('espp-service',
+  espp_service_sources,
+  include_directories : [configinc],
+  dependencies : daemon_deps,
+  install: true,
+  install_dir: get_option('_bindir'),
+  install_rpath: libdir_path,
+  pie : true,
+)
+
diff --git a/agent/espp-service/src/meson.build b/agent/espp-service/src/meson.build
new file mode 100644 (file)
index 0000000..b0441da
--- /dev/null
@@ -0,0 +1,2 @@
+subdir('client')
+subdir('daemon')
diff --git a/agent/espp-service/tizen-manifest.xml b/agent/espp-service/tizen-manifest.xml
new file mode 100644 (file)
index 0000000..678c0a3
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="8.0" package="com.samsung.tizen.espp-service" version="0.3.21">
+    <profile name="mobile"/>
+    <description>espp-service</description>
+    <service-application appid="com.samsung.tizen.espp-service" auto-restart="false" exec="espp-service" multiple="false" nodisplay="false" on-boot="false" taskmanage="false" type="capp">
+        <label>espp-service</label>
+    </service-application>
+</manifest>
diff --git a/agent/espp-service/update_version.sh b/agent/espp-service/update_version.sh
new file mode 100755 (executable)
index 0000000..aafb026
--- /dev/null
@@ -0,0 +1,13 @@
+echo "===== Update tizen-manifest.xml & project_def.prop version ====="
+VER_SPEC=$(grep "Version" packaging/espp-service.spec | cut -f2 -d : | sed 's/ //g')
+VER_XML=$(grep -oP '(?<= version=").*?(?=">)' tizen-manifest.xml)
+if [ "${VER_SPEC}" != "${VER_XML}" ]; then
+       echo "update tizen-manifest.xml version: ${VER_XML} => ${VER_SPEC}"
+       sed -i "s/\( version=\"\)[^\"]*\(\">\)/\1${VER_SPEC}\2/" tizen-manifest.xml
+fi
+VER_PROJ=$(grep -oP '(?<=VERSION=").*?(?=")' project_def.prop)
+if [ "${VER_SPEC}" != "${VER_PROJ}" ]; then
+       echo "update project_def.prop version: ${VER_PROJ} => ${VER_SPEC}"
+       sed -i "s/\(VERSION=\"\)[^\"]*\(\"\)/\1${VER_SPEC}\2/" project_def.prop
+fi
+echo "================================================================"
diff --git a/build_def.prop b/build_def.prop
deleted file mode 100644 (file)
index 85b3545..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-PREBUILD_COMMAND =
-PREBUILD_COMMAND = sh update_version.sh
-POSTBUILD_COMMAND =
-POSTBUILD_DESC =
diff --git a/build_def.sh b/build_def.sh
deleted file mode 100755 (executable)
index 6bc573e..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-source build_def_common
-
-BUILD_COMMAND=${1}
-BUILD_ARCH=${2}
-BUILD_CONFIG=${3}
-PROJ_PATH=${4}
-TIZEN_VERSION=${5}
-archPath=$BUILD_ARCH
-
-echo "Using build build arch :: $BUILD_ARCH"
-echo "Using build build config :: $BUILD_CONFIG"
-
-echo "Current PWD :: $PROJ_PATH"
-PROJ_ROOT="$(echo $PROJ_PATH|tr '^C' 'c'|tr '\\' '/')"
-echo "Current PWD :: $PROJ_ROOT"
-echo "Using build tizen version :: $TIZEN_VERSION"
-
-PROP_FILE="${PROJ_ROOT}/project_def.prop"
-
-echo "[================= ${1} script =================]"
-if [ "${1}" == "PREBUILD_COMMAND" ]; then
-    echo "Copying Dependent Libraries to Libs Folder"
-
-    # Recover original prop file
-    RecoverProp $PROP_FILE
-
-    # remove so
-    rm -f ${PROJ_ROOT}/libs/*.so
-
-    # copy esplusplayer to build
-    cp -f ${PROJ_ROOT}/../libs/mm-avplayer/$TIZEN_VERSION/lib/fhub_esplusplayer/$BUILD_CONFIG/6.0-$archPath/libesplusplayer.so ${PROJ_ROOT}/libs
-    ls -als ${PROJ_ROOT}/libs
-    printenv
-
-    # Backup original prop file
-    BackupProp $PROP_FILE
-
-    # Add options for coverage
-    if [ "$TIZEN_VERSION" == "tizen7.0" ]; then
-        AddOpts "USER_DEFS =" "ST_AVP_TIZEN_70" $PROP_FILE
-    fi
-elif [ "${1}" == "POSTBUILD_COMMAND" ]; then
-    # Recover original prop file
-    RecoverProp $PROP_FILE
-fi
diff --git a/get_version.sh b/get_version.sh
deleted file mode 100755 (executable)
index 74ab915..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-grep "Version" packaging/espp-service.spec | cut -f2 -d :
diff --git a/inc/esplusplayer_capi/buffer.h b/inc/esplusplayer_capi/buffer.h
deleted file mode 100644 (file)
index acaf120..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * @file
- * @brief          The buffer for playback.
- * @interfacetype  Platform
- * @privlevel      None-privilege
- * @privilege      None
- * @product        TV, AV, B2B
- * @version        2.0
- * @SDK_Support    N
- * @remark         This is a group of C style buffer related enum.
- * @see            N/A
- *
- * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
- * PROPRIETARY/CONFIDENTIAL
- * This software is the confidential and proprietary
- * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
- * not disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into with
- * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
- * suitability of the software, either express or implied, including but not
- * limited to the implied warranties of merchantability, fitness for a
- * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
- * damages suffered by licensee as a result of using, modifying or distributing
- * this software or its derivatives.
- */
-
-#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_BUFFER_H__
-#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_BUFFER_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-/**
- * @brief  Enumerations for the buffer status
- */
-typedef enum {
-  ESPLUSPLAYER_BUFFER_STATUS_UNDERRUN,
-  ESPLUSPLAYER_BUFFER_STATUS_OVERRUN
-} esplusplayer_buffer_status;
-
-/**
- * @brief  Enumerations for video decoded buffer type
- * ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_SCALE:
- * decoded video frame will be croped and scaled, then sent to
- * user by media_packet_video_decoded_cb, only support hw decoder now
-*/
-typedef enum {
-  ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_NONE,
-  ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_COPY,
-  ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_REFERENCE,
-  ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_SCALE
-} esplusplayer_decoded_video_frame_buffer_type;
-
-/**
- * @brief  Enumerations for buffer size option
- * MAX_TIME_SIZE: The maximum amount of data to esplusplayer internally(in ms)
- * MIN_TIME_THRESHOLD : Emit under-run when queued bytes drops below this
- * percent of max-time-size(size%)
- * MAX_BYTE_SIZE: The maximum number of bytes to esplusplayer internally
- * MIN_BYTE_THRESHOLD : Emit under-run when queued bytes drops below this
- * percent of  max-byte-size(size%)
- */
-typedef enum {
-  ESPLUSPLAYER_BUFFER_AUDIO_MAX_TIME_SIZE,
-  ESPLUSPLAYER_BUFFER_VIDEO_MAX_TIME_SIZE,
-  ESPLUSPLAYER_BUFFER_AUDIO_MIN_TIME_THRESHOLD,
-  ESPLUSPLAYER_BUFFER_VIDEO_MIN_TIME_THRESHOLD,
-  ESPLUSPLAYER_BUFFER_AUDIO_MAX_BYTE_SIZE,
-  ESPLUSPLAYER_BUFFER_VIDEO_MAX_BYTE_SIZE,
-  ESPLUSPLAYER_BUFFER_AUDIO_MIN_BYTE_THRESHOLD,
-  ESPLUSPLAYER_BUFFER_VIDEO_MIN_BYTE_THRESHOLD
-} esplusplayer_buffer_option;
-
-/**
- * @brief  video decoded buffer struct
- */
-typedef struct {
-  /**
-   * @description   buffer pts, in millisecond
-   */
-  uint64_t pts;
-  /**
-   * @description   buffer duration, in millisecond
-   */
-  uint64_t duration;
-  /**
-   * @description   surface data
-   */
-  void* surface_data;
-  /**
-   * @description   the scaler index,0 1 ...
-   */
-  void* private_data;
-} esplusplayer_decoded_video_packet;
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif
-
-#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_BUFFER_H__
diff --git a/inc/esplusplayer_capi/display.h b/inc/esplusplayer_capi/display.h
deleted file mode 100644 (file)
index a509f82..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * @file
- * @brief          Display related enums
- * @interfacetype  Platform
- * @privlevel      None-privilege
- * @privilege      None
- * @product        TV, AV, B2B
- * @version        2.0
- * @SDK_Support    N
- * @remark         This is a group of C style display releted data structures
- *                 and enums.
- * @see            The display related enum values and data structures will be
- *                 converted by this managed C version types to avoid binary
- *                 compatibility.
- *
- * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
- * PROPRIETARY/CONFIDENTIAL
- * This software is the confidential and proprietary
- * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
- * not disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into with
- * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
- * suitability of the software, either express or implied, including but not
- * limited to the implied warranties of merchantability, fitness for a
- * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
- * damages suffered by licensee as a result of using, modifying or distributing
- * this software or its derivatives.
- */
-
-#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_DISPLAY_H__
-#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_DISPLAY_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief  Enumerations for the display mode
- */
-typedef enum {
-  ESPLUSPLAYER_DISPLAY_MODE_LETTER_BOX,
-  ESPLUSPLAYER_DISPLAY_MODE_ORIGIN_SIZE,
-  ESPLUSPLAYER_DISPLAY_MODE_FULL_SCREEN,
-  ESPLUSPLAYER_DISPLAY_MODE_CROPPED_FULL,
-  ESPLUSPLAYER_DISPLAY_MODE_ORIGIN_OR_LETTER,
-  ESPLUSPLAYER_DISPLAY_MODE_DST_ROI,
-  ESPLUSPLAYER_DISPLAY_MODE_MAX
-} esplusplayer_display_mode;
-
-/**
- * @brief  Enumerations for the display type
- */
-typedef enum {
-  ESPLUSPLAYER_DISPLAY_TYPE_NONE,
-  ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,
-  ESPLUSPLAYER_DISPLAY_TYPE_EVAS,
-  ESPLUSPLAYER_DISPLAY_TYPE_MIXER,
-  ESPLUSPLAYER_DISPLAY_TYPE_MAX
-} esplusplayer_display_type;
-
-/**
- * @brief  Enumerations for the display rotation type
- */
-typedef enum {
-  ESPLUSPLAYER_DISPLAY_ROTATION_TYPE_NONE,
-  ESPLUSPLAYER_DISPLAY_ROTATION_TYPE_90,
-  ESPLUSPLAYER_DISPLAY_ROTATION_TYPE_180,
-  ESPLUSPLAYER_DISPLAY_ROTATION_TYPE_270
-} esplusplayer_display_rotation_type;
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif
-
-#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_DISPLAY_H__
diff --git a/inc/esplusplayer_capi/drm.h b/inc/esplusplayer_capi/drm.h
deleted file mode 100644 (file)
index a40c213..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-/**
- * @file
- * @brief          Drm related enums
- * @interfacetype  Platform
- * @privlevel      None-privilege
- * @privilege      None
- * @product        TV, AV, B2B
- * @version        2.0
- * @SDK_Support    N
- * @remark         This is a group of C style drm releted data structures and
- *                 enums.
- * @see            Drm releated event listeners, enum classes, etc.. are
- *                 converted to this.
- *
- * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
- * PROPRIETARY/CONFIDENTIAL
- * This software is the confidential and proprietary
- * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
- * not disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into with
- * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
- * suitability of the software, either express or implied, including but not
- * limited to the implied warranties of merchantability, fitness for a
- * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
- * damages suffered by licensee as a result of using, modifying or distributing
- * this software or its derivatives.
- */
-
-#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_DRM_H__
-#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_DRM_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-/**
- * @brief  Enumerations for the drm type
- */
-typedef enum {
-  ESPLUSPLAYER_DRM_TYPE_NONE,
-  ESPLUSPLAYER_DRM_TYPE_PLAYREADY,
-  ESPLUSPLAYER_DRM_TYPE_MARLIN,
-  ESPLUSPLAYER_DRM_TYPE_VERIMATRIX,
-  ESPLUSPLAYER_DRM_TYPE_WV_MODULAR
-} esplusplayer_drm_type;
-
-/**
- * @brief  Enumerations for the algorithm encrypted
- */
-typedef enum {
-  ESPLUSPLAYER_DRMB_ES_CIPHER_ALGORITHM_UNKNOWN = -1,
-  ESPLUSPLAYER_DRMB_ES_CIPHER_ALGORITHM_RC4 = 0,
-  ESPLUSPLAYER_DRMB_ES_CIPHER_ALGORITHM_AES128_CTR = 1,
-  ESPLUSPLAYER_DRMB_ES_CIPHER_ALGORITHM_AES128_CBC = 2
-} esplusplayer_drmb_es_cipher_algorithm;
-
-/**
- * @brief  Enumerations for the algorithm encrypted
- */
-typedef enum {
-  ESPLUSPLAYER_DRMB_ES_MEDIA_FORMAT_NONE = 0,
-  ESPLUSPLAYER_DRMB_ES_MEDIA_FORMAT_FMP4 = 1,
-  ESPLUSPLAYER_DRMB_ES_MEDIA_FORMAT_TS = 2,
-  ESPLUSPLAYER_DRMB_ES_MEDIA_FORMAT_ASF = 3,
-  ESPLUSPLAYER_DRMB_ES_MEDIA_FORMAT_FMP4_AUDIO = 4,
-  ESPLUSPLAYER_DRMB_ES_MEDIA_FORMAT_FMP4_VIDEO = 5,
-  ESPLUSPLAYER_DRMB_ES_MEDIA_FORMAT_CLEAN_AUDIO = 6,
-  ESPLUSPLAYER_DRMB_ES_MEDIA_FORMAT_PES = 7
-} esplusplayer_drmb_es_media_format;
-
-/**
- * @brief  Enumerations for the phase for cipher
- */
-typedef enum {
-  ESPLUSPLAYER_DRMB_ES_CIPHER_PHASE_NONE = 0,
-  ESPLUSPLAYER_DRMB_ES_CIPHER_PHASE_INIT = 1,
-  ESPLUSPLAYER_DRMB_ES_CIPHER_PHASE_UPDATE = 2,
-  ESPLUSPLAYER_DRMB_ES_CIPHER_PHASE_FINAL = 3
-} esplusplayer_drmb_es_cipher_phase;
-
-/**
- * @brief  Subsample information structure for encrypted es
- */
-typedef struct {
-  /**
-   * @description   The bytes of clear data.
-   */
-  uint32_t bytes_of_clear_data;
-  /**
-   * @description   The bytes of encrypted data.
-   */
-  uint32_t bytes_of_encrypted_data;
-} esplusplayer_drmb_es_subsample_info;
-
-/**
- * @brief  Fragmented MP4 data structure for encrypted es
- */
-typedef struct {
-  /**
-   * @description   The count of subsample informations
-   */
-  uint32_t subsample_count;
-  /**
-   * @description   The subsample informations
-   */
-  esplusplayer_drmb_es_subsample_info* subsample_infos;
-} esplusplayer_drmb_es_fmp4_data;
-
-/**
- * @brief  The information to decrypt es packet
- */
-typedef struct {
-  /**
-   * @description   The handle to decrypt es packet.
-   */
-  int32_t handle;
-  /**
-   * @description   The algorithm encrypted.
-   */
-  esplusplayer_drmb_es_cipher_algorithm algorithm;
-  /**
-   * @description   The es media format.
-   */
-  esplusplayer_drmb_es_media_format format;
-  /**
-   * @description   The phase to decrypt.
-   */
-  esplusplayer_drmb_es_cipher_phase phase;
-  /**
-   * @description   The KID.
-   */
-  unsigned char* kid;
-  /**
-   * @description   The length of KID.
-   */
-  uint32_t kid_length;
-  /**
-   * @description   The vector for initialization.
-   */
-  unsigned char* iv;
-  /**
-   * @description   The length of IV.
-   */
-  uint32_t iv_length;
-  /**
-   * @description   The sub data.
-   * @see           esplusplayer_drmb_es_fmp4_data
-   */
-  void* sub_data;
-  /**
-   * @description   The offset of sample.
-   *                It can be NULL.
-   *                If used, it have to be -1 terminated.
-   *                Max offset is 15.
-   */
-  int* split_offsets;
-  /**
-   * @description   It should be 0 when it must be protected with trustzone.
-   */
-  bool use_out_buffer;
-  /**
-   * @description   If use 'cbcs' pattern scheme, It should be 1. otherwise 0.
-   */
-  bool use_pattern;
-  /**
-   * @description   In case that use_patter is 1,
-   *                count of the encrypted blocks in the protection pattern.
-   */
-  uint32_t crypt_byte_block;
-  /**
-   * @description   In case that use_patter is 1,
-   *                count of the unencrypted blocks in the protection pattern.
-   */
-  uint32_t skip_byte_block;
-} esplusplayer_drm_info;
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif
-
-#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_DRM_H__
diff --git a/inc/esplusplayer_capi/error.h b/inc/esplusplayer_capi/error.h
deleted file mode 100644 (file)
index c1f7874..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * @file
- * @brief          Error related enums
- * @interfacetype  Platform
- * @privlevel      None-privilege
- * @privilege      None
- * @product        TV, AV, B2B
- * @version        2.0
- * @SDK_Support    N
- * @remark         This is a group of C style error releted enum.
- * @see            All error enum values will be converted to this managed error
- *                 types.
- *
- * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
- * PROPRIETARY/CONFIDENTIAL
- * This software is the confidential and proprietary
- * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
- * not disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into with
- * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
- * suitability of the software, either express or implied, including but not
- * limited to the implied warranties of merchantability, fitness for a
- * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
- * damages suffered by licensee as a result of using, modifying or distributing
- * this software or its derivatives.
- */
-
-#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_ERROR_H__
-#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_ERROR_H__
-
-#include "tizen.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define ESPLUSPLAYER_ERROR_CLASS TIZEN_ERROR_PLAYER | 0x20
-
-/* This is for custom defined esplusplayer error. */
-#define ESPLUSPLAYER_CUSTOM_ERROR_CLASS TIZEN_ERROR_PLAYER | 0x1000
-
-/**
- * @brief  Enumerations for the error type
- */
-typedef enum {
-  ESPLUSPLAYER_ERROR_TYPE_NONE = TIZEN_ERROR_NONE, /**< Successful */
-  ESPLUSPLAYER_ERROR_TYPE_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
-  ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
-  ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
-  ESPLUSPLAYER_ERROR_TYPE_INVALID_STATE  = ESPLUSPLAYER_ERROR_CLASS | 0x02, /**< Invalid state */
-  ESPLUSPLAYER_ERROR_TYPE_NOT_SUPPORTED_AUDIO_CODEC = ESPLUSPLAYER_ERROR_CLASS | 0x0e, /**< Not supported audio codec but video can be played (Since 4.0)*/
-  ESPLUSPLAYER_ERROR_TYPE_NOT_SUPPORTED_VIDEO_CODEC = ESPLUSPLAYER_ERROR_CLASS | 0x0f, /**< Not supported video codec but audio can be played (Since 4.0)*/
-  ESPLUSPLAYER_ERROR_TYPE_NOT_SUPPORTED_FILE = ESPLUSPLAYER_ERROR_CLASS | 0x03, /**< File format not supported */
-  ESPLUSPLAYER_ERROR_TYPE_CONNECTION_FAILED = ESPLUSPLAYER_ERROR_CLASS | 0x06, /**< Streaming connection failed */
-  ESPLUSPLAYER_ERROR_TYPE_DRM_EXPIRED = ESPLUSPLAYER_ERROR_CLASS | 0x08, /**< Expired license */
-  ESPLUSPLAYER_ERROR_TYPE_DRM_NO_LICENSE = ESPLUSPLAYER_ERROR_CLASS | 0x09, /**< No license */
-  ESPLUSPLAYER_ERROR_TYPE_DRM_FUTURE_USE = ESPLUSPLAYER_ERROR_CLASS | 0x0a, /**< License for future use */
-  ESPLUSPLAYER_ERROR_TYPE_NOT_PERMITTED = ESPLUSPLAYER_ERROR_CLASS | 0x0b, /**< Format not permitted */
-
-  ESPLUSPLAYER_ERROR_TYPE_DRM_DECRYPTION_FAILED = ESPLUSPLAYER_CUSTOM_ERROR_CLASS | 0x05, /**< drm decryption failed */
-  ESPLUSPLAYER_ERROR_TYPE_NOT_SUPPORTED_FORMAT = ESPLUSPLAYER_CUSTOM_ERROR_CLASS | 0x08,/**< format not supported */
-  ESPLUSPLAYER_ERROR_TYPE_UNKNOWN
-} esplusplayer_error_type;
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif
-
-#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_ERROR_H__
diff --git a/inc/esplusplayer_capi/espacket.h b/inc/esplusplayer_capi/espacket.h
deleted file mode 100644 (file)
index 417da2d..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * @file
- * @brief          The packet for elementary stream
- * @interfacetype  Platform
- * @privlevel      None-privilege
- * @privilege      None
- * @product        TV, AV, B2B
- * @version        2.0
- * @SDK_Support    N
- * @see            plusplayer::EsPlusPlayer class
- *
- * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
- * PROPRIETARY/CONFIDENTIAL
- * This software is the confidential and proprietary
- * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
- * not disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into with
- * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
- * suitability of the software, either express or implied, including but not
- * limited to the implied warranties of merchantability, fitness for a
- * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
- * damages suffered by licensee as a result of using, modifying or distributing
- * this software or its derivatives.
- */
-
-#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_ESPACKET_H__
-#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_ESPACKET_H__
-
-#include "esplusplayer_capi/matroska_color.h"
-#include "esplusplayer_capi/stream.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-/**
- * @brief   Es packet structure
- */
-typedef struct {
-  /**
-   * @description   The stream type.
-   */
-  esplusplayer_stream_type type;
-  /**
-   * @description   The buffer data pointer
-   */
-  char* buffer;
-  /**
-   * @description   The buffer size.
-   */
-  uint32_t buffer_size;
-  /**
-   * @description   The pts value in milisecond.
-   */
-  uint64_t pts;
-  /**
-   * @description   The duration value in milisecond.
-   */
-  uint64_t duration;
-  /**
-   * @description   The matroska color information. this value is only for video
-   * packet. If you set this value on a packet of other type, you can see an
-   * error when you submit the packet.
-   */
-  esplusplayer_matroska_color* matroska_color_info;
-  /**
-   * @description   The hdr10+ metadata size.
-   */
-  uint32_t hdr10p_metadata_size;
-  /**
-   * @description   The hdr10+ metadata.
-   */
-  char* hdr10p_metadata;
-} esplusplayer_es_packet;
-
-/**
- * @brief   Trust zone es packet structure
- */
-typedef struct {
-  /**
-   * @description   The Stream type.
-   */
-  esplusplayer_stream_type type;
-  /**
-   * @description   The tz handle.
-   */
-  uint32_t handle;
-  /**
-   * @description   The tz handle size.
-   */
-  uint32_t handle_size;
-  /**
-   * @description   The pts value in milisecond.
-   */
-  uint64_t pts;
-  /**
-   * @description   The duration value in milisecond.
-   */
-  uint64_t duration;
-  /**
-   * @description   The matroska color information. this value is only for video
-   * packet. If you set this value on a packet of other type, you can see an
-   * error when you submit the packet.
-   */
-  esplusplayer_matroska_color* matroska_color_info;
-} esplusplayer_es_tz_packet;
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif
-
-#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_ESPACKET_H__
diff --git a/inc/esplusplayer_capi/esplusplayer_capi.h b/inc/esplusplayer_capi/esplusplayer_capi.h
deleted file mode 100644 (file)
index 9c17146..0000000
+++ /dev/null
@@ -1,2049 +0,0 @@
-/**
- * @file           esplusplayer_capi.h
- * @brief          EsPlusPlayer api c version
- * @interfacetype  Platform
- * @privlevel      None-privilege
- * @privilege      None
- * @product        TV, AV, B2B
- * @version        2.0
- * @SDK_Support    N
- * @remark         This is esplusplayer api header implemented as C style to
- *                 avoid binary compatibility issues.
- *
- * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
- * PROPRIETARY/CONFIDENTIAL
- * This software is the confidential and proprietary
- * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
- * not disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into with
- * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
- * suitability of the software, either express or implied, including but not
- * limited to the implied warranties of merchantability, fitness for a
- * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
- * damages suffered by licensee as a result of using, modifying or distributing
- * this software or its derivatives.
- */
-
-#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_ESPLUSPLAYER_CAPI_H__
-#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_ESPLUSPLAYER_CAPI_H__
-
-#include "esplusplayer_capi/buffer.h"
-#include "esplusplayer_capi/display.h"
-#include "esplusplayer_capi/drm.h"
-#include "esplusplayer_capi/error.h"
-#include "esplusplayer_capi/espacket.h"
-#include "esplusplayer_capi/event.h"
-#include "esplusplayer_capi/state.h"
-#include "esplusplayer_capi/stream.h"
-#include "esplusplayer_capi/submitdatatype.h"
-#include "esplusplayer_capi/submitstatus.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-typedef void (*esplusplayer_error_cb)(const esplusplayer_error_type, void*);
-typedef void (*esplusplayer_buffer_status_cb)(const esplusplayer_stream_type,
-                                              const esplusplayer_buffer_status,
-                                              void*);
-typedef void (*esplusplayer_buffer_byte_status_cb)(
-    const esplusplayer_stream_type, const esplusplayer_buffer_status, uint64_t,
-    void*);
-typedef void (*esplusplayer_buffer_time_status_cb)(
-    const esplusplayer_stream_type, const esplusplayer_buffer_status, uint64_t,
-    void*);
-typedef void (*esplusplayer_resource_conflicted_cb)(void*);
-typedef void (*esplusplayer_eos_cb)(void*);
-typedef void (*esplusplayer_ready_to_prepare_cb)(const esplusplayer_stream_type,
-                                                 void*);
-typedef void (*esplusplayer_prepare_async_done_cb)(bool, void*);
-typedef void (*esplusplayer_seek_done_cb)(void*);
-typedef void (*esplusplayer_ready_to_seek_cb)(const esplusplayer_stream_type,
-                                              const uint64_t, void*);
-typedef void (*esplusplayer_media_packet_video_decoded_cb)(
-    const esplusplayer_decoded_video_packet*, void*);
-typedef void (*esplusplayer_closed_caption_cb)(const char* data, const int size,
-                                               void* userdata);
-typedef void (*esplusplayer_flush_done_cb)(void*);
-typedef void (*esplusplayer_event_cb)(const esplusplayer_event_type,
-                                      const esplusplayer_event_msg, void*);
-
-typedef void* esplusplayer_handle;
-
-/**
- * @brief  Enumerations for the Adaptive info type
- */
-typedef enum {
-  ESPLUSPLAYER_ADAPT_INFO_TYPE_NONE,
-  ESPLUSPLAYER_ADAPT_INFO_TYPE_DROPPED_FRAMES,
-  ESPLUSPLAYER_ADAPT_INFO_TYPE_DROPPED_VIDEO_FRAMES_FOR_CATCHUP,
-  ESPLUSPLAYER_ADAPT_INFO_TYPE_DROPPED_AUDIO_FRAMES_FOR_CATCHUP,
-} esplusplayer_adaptive_info_type;
-
-/**
- * @brief   Enumerations for low latency mode
- * @remark  Public supports #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_PREROLL only.
- */
-typedef enum {
-  ESPLUSPLAYER_LOW_LATENCY_MODE_NONE = 0x0000,
-  /**
-   * @description   to support audio fast decoding/rendering
-   */
-  ESPLUSPLAYER_LOW_LATENCY_MODE_AUDIO = 0x0001,
-  /**
-   * @description   to support video fast decoding/rendering
-   *                Video stream should be composed only of P and I frames.
-   *                The mode support seamless resolution change since tizen 6.5
-   */
-  ESPLUSPLAYER_LOW_LATENCY_MODE_VIDEO = 0x0010,
-  /**
-   * @description   to support video fast decoding/rendering and video
-   *                distortion concealment.
-   *                Video stream should be composed only of P and I frames.
-   *                For applications using the UDP protocol, packet loss can
-   *                occur. when video distortion by video packet loss is
-   *                detected, it is a function to conceal distortion by showing
-   *                previous video frame. It is supported only in h.264 codec &
-   *                FHD or lower resolution.
-   */
-  ESPLUSPLAYER_LOW_LATENCY_MODE_VIDEO_DISTORTION_CONCEALMENT =
-      ESPLUSPLAYER_LOW_LATENCY_MODE_VIDEO | 0x0020,
-  /**
-   * @description   to disable clock sync and a/v sync when rendering. it
-   *                includes #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_PREROLL.
-   */
-  ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_SYNC = 0x0100,
-  /**
-   * @description   to disable preroll which means player doesn't wait for
-   *                first buffer when state is changed to
-   *                #ESPLUSPLAYER_STATE_READY from #ESPLUSPLAYER_STATE_IDLE.
-   *                It changes the state immediately.
-   *                It's usually used for sparse stream. (e.g. video packet
-   *                arrives but audio packet doesn't yet.)
-   */
-  ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_PREROLL = 0x0200,
-  /**
-   * @deprecated    Deprecated since tizen 6.5
-   * @description   to set lower video quality
-   *                If set this value, it can use original game_mode.
-   *                This value will be deprecated from 2022TV.
-   *                Please use ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE.
-   */
-  ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_VIDEO_QUALITY = 0x1000,
-  /**
-   * @description   to set game mode for minimum latency
-   *                Video stream should be composed only of P and I frames.
-   *                It must not be used together with
-   *                #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_VIDEO_QUALITY.
-   *                If use this value, It can expect better latency performance
-   *                than #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_VIDEO_QUALITY.
-   *                The mode support seamless resolution change.
-   *                The mode use lower video quality.
-   */
-  ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE =
-      ESPLUSPLAYER_LOW_LATENCY_MODE_AUDIO |
-      ESPLUSPLAYER_LOW_LATENCY_MODE_VIDEO | 0x2000,
-  /**
-   * @description   to set game mode for latency
-   *                Video stream should be composed only of P and I frames.
-   *                Video stream must use fixed resolution.
-   *                It must not be used together with
-   *                #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_VIDEO_QUALITY.
-   *                If use this value, It can expect better latency
-   *                performance than
-   *                #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_VIDEO_QUALITY and
-   *                #ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE
-   *                The mode use lower video quality.
-   */
-  ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE_WITH_FIXED_RESOLUTION =
-      ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE | 0x4000,
-} esplusplayer_low_latency_mode;
-
-/**
- * @brief   Enumerations for esplusplayer audio codec type
- */
-typedef enum {
-  /**
-   * @description   hardware codec can only be selected, default type
-   */
-  ESPLUSPLAYER_AUDIO_CODEC_TYPE_HW,
-  /**
-   * @description   software codec can only be selected
-   */
-  ESPLUSPLAYER_AUDIO_CODEC_TYPE_SW,
-  ESPLUSPLAYER_AUDIO_CODEC_TYPE_MAX
-} esplusplayer_audio_codec_type;
-
-/**
- * @brief   Enumerations for esplusplayer video codec type
- */
-typedef enum {
-  /**
-   * @description   hardware codec can only be selected, default type
-   */
-  ESPLUSPLAYER_VIDEO_CODEC_TYPE_HW,
-  /**
-   * @description   software codec can only be selected
-   */
-  ESPLUSPLAYER_VIDEO_CODEC_TYPE_SW,
-  /**
-  * @description   hardware codec using n-decoding mode can only be selected.
-                   It must set display type to mixer type by display setting
-  api.
-                   esplusplayer_set_display()
-  */
-  ESPLUSPLAYER_VIDEO_CODEC_TYPE_HW_N_DECODING,
-  ESPLUSPLAYER_VIDEO_CODEC_TYPE_MAX
-
-} esplusplayer_video_codec_type;
-/**
- * @brief   Enumerations for esplusplayer audio easing type
- * @version 3.0
- */
-typedef enum {
-  /**
-   * @description audio easing function type is linear
-   */
-  ESPLUSPLAYER_AUDIO_EASING_LINEAR,
-  /**
-   * @description audio easing function type is incubic
-   */
-  ESPLUSPLAYER_AUDIO_EASING_INCUBIC,
-  /**
-   * @description audio easing function type is outcubic
-   */
-  ESPLUSPLAYER_AUDIO_EASING_OUTCUBIC,
-  /**
-   * @description audio easing function type is none
-   */
-  ESPLUSPLAYER_AUDIO_EASING_NONE
-} esplusplayer_audio_easing_type;
-
-/**
- * @brief   Enumerations for esplusplayer resource type
- * @version 3.0
- */
-typedef enum {
-  /**
-   * @description video renderer type
-   */
-  ESPLUSPLAYER_RSC_TYPE_VIDEO_RENDERER
-} esplusplayer_rsc_type;
-
-/**
- * @brief   Enumerations for advanced video quality type
- * @version 3.1
- */
-typedef enum {
-  /**
-   * @description advanced picture quality for video call
-   */
-  ESPLUSPLAYER_ADVANCED_PICTURE_QUALITY_VIDEO_CALL,
-  /**
-   * @description advanced picture quality for usb camera
-   */
-  ESPLUSPLAYER_ADVANCED_PICTURE_QUALITY_USB_CAMERA
-} esplusplayer_advanced_picture_quality_type;
-
-typedef struct {
-  /**
-   * @description   the minimum frame number in case of mid latency
-   */
-  int mid_latency_threshold;
-  /**
-   * @description   the minimum frame number in case of high latency
-   */
-  int high_latency_threshold;
-} esplusplayer_latency_threshold;
-
-/**
- * @brief  rational number numerator/denominator
- */
-typedef struct {
-  /**
-   * @description   the numerator value
-   */
-  int num;
-  /**
-   * @description   the denominator value
-   */
-  int den;
-} esplusplayer_rational;
-
-/**
- * @brief  resource allocate policy
- */
-typedef enum {
-  /**
-   * @description exclusive policy, RM will return the requested resources,
-   * default policy
-   */
-  ESPLUSPLAYER_RSC_ALLOC_EXCLUSIVE = 0,
-  /**
-   * @description conditional policy, when trying to allocate resources and
-   * available resources are not left, RM will return fail.
-   */
-  ESPLUSPLAYER_RSC_ALLOC_EXCLUSIVE_CONDITIONAL
-} esplusplayer_rsc_alloc_policy;
-
-/**
- * @brief Enumerations for the status of getting decoded video frame
- * @version 4.0
- */
-typedef enum {
-  /** @brief successfully decoded video frame acquired. */
-  ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_SUCCESS,
-  /** @brief  it means app has to return the video before getting decoded
-   * video frame frame.
-   */
-  ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_NO_REMAINING_BUFFER,
-  /**
-   * @brief  there is no filled video frame yet.
-   */
-  ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_NO_FILLED_BUFFER,
-  /**
-   * @brief  internal error
-   */
-  ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_UNKNOWN
-} esplusplayer_get_decoded_video_frame_status_type;
-
-/**
- * @brief     Create a esplusplayer handle.
- * @param     None
- * @return    return esplusplayer handle pointer.
- * @code
- *            esplusplayer_handle esplayer = esplusplayer_create();
- *            // ... your codes ...
- *            esplusplayer_destroy(esplayer);
- * @endcode
- * @pre       None
- * @post      The player state will be #ESPLUSPLAYER_STATE_NONE.
- * @exception None
- */
-esplusplayer_handle esplusplayer_create();
-
-/**
- * @brief     Open esplusplayer handle.
- * @param     [in] handle : esplusplayer handle
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            esplusplayer_handle esplayer = esplusplayer_create();
- *            esplusplayer_open(esplayer);
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- *            esplusplayer_destroy(esplayer);
- * @endcode
- * @pre       The player state must be #ESPLUSPLAYER_STATE_NONE.
- * @post      The player state will be #ESPLUSPLAYER_STATE_IDLE.
- * @exception None
- * @see       esplusplayer_close()
- */
-int esplusplayer_open(esplusplayer_handle handle);
-
-/**
- * @brief     Release all the player resources and all setting except callback
- *            functions.
- * @param     [in] handle : esplusplayer handle.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @pre       The player state must be all of #esplusplayer_state except
- *            #ESPLUSPLAYER_STATE_NONE.
- * @post      The player state will be #ESPLUSPLAYER_STATE_NONE.
- * @exception None
- * @see       esplusplayer_open()
- */
-int esplusplayer_close(esplusplayer_handle handle);
-
-/**
- * @brief     Release player handle.
- * @param     [in] handle : esplusplayer handle.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            refer to the sample code of esplusplayer_create()
- * @endcode
- * @pre       The player state must be #ESPLUSPLAYER_STATE_NONE
- * @post      player handle will be removed.
- * @exception None
- * @see       esplusplayer_create()
- */
-int esplusplayer_destroy(esplusplayer_handle handle);
-
-/**
- * @brief     Flush the specific buffered stream data and release TV resource
- *            to change stream.
- * @remark    To activate, the stream must be set again.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] type : stream type which user want to deactivate.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
-              refer to the sample code of esplusplayer_activate()
- * @endcode
- * @pre       The player state must be at least #ESPLUSPLAYER_STATE_READY
- * @post      The player state is same as before calling
- *            esplusplayer_deactivate(). The deactivated stream will stop
- *            rendering and release the decoder, renderer resources.
- * @exception None
- * @see       esplusplayer_activate
- */
-int esplusplayer_deactivate(esplusplayer_handle handle,
-                            esplusplayer_stream_type type);
-
-/**
- * @brief     Reprepare for the specific stream playback.
- * @remark    There must be active stream to prepare playback.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] type : stream type which user want to activate.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            prepare esplayer done
- *            // ... your codes ...
- *            esplusplayer_deactivate(esplayer, ESPLUSPLAYER_STREAM_TYPE_VIDEO);
- *            esplusplayer_video_stream_info stream;
- *            stream.width = 640;
- *            stream.height = 352;
- *            stream.mime_type = ESPLUSPLAYER_VIDEO_MIME_TYPE_H264;
- *            stream.framerate_num = 30;
- *            stream.framerate_den = 1;
- *            esplusplayer_set_video_stream_info(esplayer, &stream);
- *            esplusplayer_activate(esplayer, ESPLUSPLAYER_STREAM_TYPE_VIDEO);
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- *            esplusplayer_destroy(esplayer);
- * @endcode
- * @pre       The player state must be at least #ESPLUSPLAYER_STATE_READY
- * @post      The player state is same as before calling
- *            esplusplayer_activate(). Rebuild pipeline to render the stream.
- * @exception None
- * @see       esplusplayer_prepare_async()
- */
-int esplusplayer_activate(esplusplayer_handle handle,
-                          esplusplayer_stream_type type);
-
-/**
- * @brief     Prepare the player for playback, asynchronously.
- * @param     [in] handle : esplusplayer handle.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            static void OnPrepareDone(bool ret, void* userdata) {
- *                //Something you want to do when prepare done, but, we strongly
- *                //recommend DO NOT CALL PLAYER APIs in this callback
- *                printf("OnPrepareDone\n");
- *            }
- *            esplusplayer_handle esplayer = esplusplayer_create();
- *            esplusplayer_set_prepare_async_done_cb(esplayer, OnPrepareDone,nullptr);
- *            esplusplayer_open(esplayer);
- *            esplusplayer_prepare_async(esplayer);
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- *            esplusplayer_destroy(esplayer);
- * @endcode
- * @pre       The player state must be #ESPLUSPLAYER_STATE_IDLE. \n
- *            Call at least one of esplusplayer_set_video_stream_info() or
- *            esplusplayer_set_audio_stream_info(). \n
- * @post      It invokes esplusplayer_prepare_async_done_cb() when prepare is
- *            finished. \n
- *            Prepare result can be succeeded or not at this moment. \n
- *            If the result is succeeded, the player state will be
- *            #ESPLUSPLAYER_STATE_READY and one frame will be displayed
- *            unless esplusplayer_set_display_visible() is set to @c false.
- * @exception None
- * @remark    esplusplayer_prepare_async_done_cb() can be invoked only when as
- *            many es packets as at least one decoded frame is submitted. \n
- *            The player can receive es packets after
- *            esplusplayer_ready_to_seek_cb() is called.
- * @see       esplusplayer_open() \n
- *            esplusplayer_stop() \n
- *            esplusplayer_submit_packet() \n
- *            esplusplayer_ready_to_prepare_cb() \n
- *            esplusplayer_close()
- */
-int esplusplayer_prepare_async(esplusplayer_handle handle);
-
-/**
- * @brief     Start playback.
- * @param     [in] handle : esplusplayer handle.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            prepare esplayer done
- *            esplusplayer_start(esplayer);
- *            // ... your codes ...
- *            esplusplayer_stop(esplayer);
- * @endcode
- * @pre       The player state should be #ESPLUSPLAYER_STATE_READY.
- * @post      The player state will be #ESPLUSPLAYER_STATE_PLAYING.
- * @exception None
- * @see       esplusplayer_open() \n
- *            esplusplayer_prepare_async() \n
- *            esplusplayer_stop() \n
- *            esplusplayer_close()
- */
-int esplusplayer_start(esplusplayer_handle handle);
-
-/**
- * @brief     Stop playing media content.
- * @param     [in] handle : esplusplayer handle.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            prepare esplayer done
- *            // ... your codes ...
- *            esplusplayer_stop(esplayer);
- *             // ... your codes ...
- *            esplusplayer_close(esplayer);
- * @endcode
- * @pre       The player state must be all of #esplusplayer_state except
- *            #ESPLUSPLAYER_STATE_NONE.
- * @post      The player state will be #ESPLUSPLAYER_STATE_IDLE.
- * @exception None
- * @remark    esplusplayer_close() must be called once after player is stopped
- * @see       esplusplayer_open() \n
- *            esplusplayer_prepare_async() \n
- *            esplusplayer_start() \n
- *            esplusplayer_pause() \n
- *            esplusplayer_resume() \n
- *            esplusplayer_close()
- */
-int esplusplayer_stop(esplusplayer_handle handle);
-
-/**
- * @brief     Pause playing media content.
- * @param     [in] handle : esplusplayer handle.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            prepare esplayer done
- *            // ... your codes ...
- *            esplusplayer_pause(esplayer);
- *            // ... your codes ...
- *            esplusplayer_stop(esplayer);
- * @endcode
- * @pre       The player state must be one of #ESPLUSPLAYER_STATE_READY or
- *            #ESPLUSPLAYER_STATE_PAUSED or #ESPLUSPLAYER_STATE_PLAYING.
- * @post      The player state will be #ESPLUSPLAYER_STATE_PAUSE.
- * @exception None
- * @see       esplusplayer_start() \n
- *            esplusplayer_resume() \n
- *            esplusplayer_prepare_async()
- */
-int esplusplayer_pause(esplusplayer_handle handle);
-
-/**
- * @brief     Resume playing media content.
- * @param     [in] handle : esplusplayer handle.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            prepare esplayer done
- *            // ... your codes ...
- *            esplusplayer_pause(esplayer);
- *            // ... your codes ...
- *            esplusplayer_resume(esplayer);
- *            // ... your codes ...
- *            esplusplayer_stop(esplayer);
- * @endcode
- * @pre       The player state must be one of #ESPLUSPLAYER_STATE_PAUSED or
- *            #ESPLUSPLAYER_STATE_PLAYING.
- * @post      The player state will be #ESPLUSPLAYER_STATE_PLAYING.
- * @exception None
- * @see       esplusplayer_start() \n
- *            esplusplayer_pause() \n
- *            esplusplayer_prepare_async()
- */
-int esplusplayer_resume(esplusplayer_handle handle);
-
-/**
- * @brief     Set playback rate.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] playback_rate :  the playback rate from 0.0 to 2.0.
- * @param     [in] audio_mute :  the audio is mute on/off, true: mute on, false:
- * mute off.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            prepare esplayer done
- *            // ... your codes ...
- *            esplusplayer_set_playback_rate(esplayer,2,true);
- *            // ... your codes ...
- *            esplusplayer_stop(esplayer);
- * @endcode
- * @pre       The player state must be one of #ESPLUSPLAYER_STATE_READY or
- *            #ESPLUSPLAYER_STATE_PAUSED or #ESPLUSPLAYER_STATE_PLAYING. \n
- *            User has to push the data as fast as playback rate.
- * @post      None
- * @exception None
- * @see       esplusplayer_prepare_async()
- */
-int esplusplayer_set_playback_rate(esplusplayer_handle handle,
-                                   const double playback_rate,
-                                   const bool audio_mute);
-
-/**
- * @brief     Seek for playback, asynchronously.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] time_ms : seek time in milliseconds
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            prepare esplayer done
- *            // ... your codes ...
- *            const uint64_t ms_to_seek = 0;
- *            esplusplayer_seek(esplayer,ms_to_seek);
- *            // ... your codes ...
- *            esplusplayer_stop(esplayer);
- * @endcode
- * @pre       The player state must be one of #ESPLUSPLAYER_STATE_READY or
- *            #ESPLUSPLAYER_STATE_PAUSED or #ESPLUSPLAYER_STATE_PLAYING.
- *            In ESPLUSPLAYER_STATE_IDLE, this api can be called exceptionally
- *            between esplusplayer_open() and esplusplayer_prepare_async().
- *            the start time of playback can be set explicitly when starting
- *            first playback. In this case, esplusplayer_set_seek_done_cb is not
- *            called.
- * @post      None
- * @exception None
- * @remark    esplusplayer_set_seek_done_cb() will be invoked if seek operation
- *            is finished. \n
- *            Seek result can be succeeded or not at this moment. \n
- *            esplusplayer_set_seek_done_cb() can be invoked only when as many
- *            es packets as at least one decoded frame is submitted. \n
- *            The player can receive es packets from seek time after
- *            esplusplayer_ready_to_seek_cb() is invoked.
- * @see       esplusplayer_ready_to_seek_cb() \n
- *            esplusplayer_prepare_async()
- */
-int esplusplayer_seek(esplusplayer_handle handle, uint64_t time_ms);
-
-/**
- * @brief     Set the video display.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] type : display type.
- * @param     [in] window : the handle to display window.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            esplusplayer_open(esplayer);
- *            esplusplayer_set_display(esplayer,ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,window);
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- * @endcode
- * @pre       The player state must be #ESPLUSPLAYER_STATE_IDLE.
- * @post      None
- * @exception None
- * @remark    Esplusplayer is not supporting changing display. \n
- *            This API have to be called before calling
- *            esplusplayer_prepare_async() to reflect the display type.
- * @see       esplusplayer_open() \n
- *            esplusplayer_set_display_mode() \n
- *            esplusplayer_set_display_roi() \n
- *            esplusplayer_set_display_visible()
- */
-int esplusplayer_set_display(esplusplayer_handle handle,
-                             esplusplayer_display_type type, void* window);
-
-#ifdef TIZEN_FEATURE_TV
-/**
- * @brief     Set the video display.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] type : display type.
- * @param     [in] subsurface : the ecore wayland subsurface handle.
- * @param     [in] x : the x coordinate of subsurface.
- * @param     [in] y : the y coordinate of subsurface.
- * @param     [in] width : the width of subsurface.
- * @param     [in] height : the height of subsurface.
- * @return    @c one of esplusplayer_error_type values will be returned.
- * @pre       The player state must be #ESPLUSPLAYER_STATE_IDLE.
- * @post      None
- * @exception   None
- * @version   3.1
- * @see       esplusplayer_set_display_mode() \n
- *            esplusplayer_set_display_roi() \n
- *            esplusplayer_set_display_visible()
- */
-int esplusplayer_set_display_ecore_subsurface(esplusplayer_handle handle,
-                                              esplusplayer_display_type type,
-                                              void* subsurface, int x, int y,
-                                              int width, int height);
-#endif
-
-/**
- * @brief     Set the video display mode.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] mode : display mode.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            esplusplayer_open(esplayer);
- *            esplusplayer_set_display_mode(esplayer,ESPLUSPLAYER_DISPLAY_MODE_DST_ROI);
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- * @endcode
- * @pre       The player state can be all of #esplusplayer_state except
- *            #ESPLUSPLAYER_STATE_NONE.
- * @post      None
- * @exception None
- * @remark    If no display is set, no operation is performed.
- * @see       esplusplayer_open() \n
- *            esplusplayer_set_display_mode() \n
- *            esplusplayer_set_display_roi() \n
- *            esplusplayer_set_display_visible()
- */
-int esplusplayer_set_display_mode(esplusplayer_handle handle,
-                                  esplusplayer_display_mode mode);
-
-/**
- * @brief     Set the ROI(Region Of Interest) area of display.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] x : var startPointX in src video area.
- * @param     [in] y : var startPointY in src video area.
- * @param     [in] width : width of display in src video area.
- * @param     [in] height : height of display in src video area.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            esplusplayer_open(esplayer);
- *            esplusplayer_set_display(esplayer,ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,window);
- *            esplusplayer_set_display_mode(esplayer,ESPLUSPLAYER_DISPLAY_MODE_DST_ROI);
- *            esplusplayer_set_display_roi(esplayer,0,0,600,500);
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- * @endcode
- * @pre       The player state can be all of #esplusplayer_state except
- *            #ESPLUSPLAYER_STATE_NONE. \n
- *            Before set display ROI, #ESPLUSPLAYER_DISPLAY_MODE_DST_ROI
- *            must be set with esplusplayer_set_display_mode().
- * @post      None
- * @exception None
- * @remark    The minimum value of width and height are 1.
- * @see       esplusplayer_open() \n
- *            esplusplayer_set_display() \n
- *            esplusplayer_set_display_mode() \n
- *            esplusplayer_set_display_visible()
- */
-int esplusplayer_set_display_roi(esplusplayer_handle handle, int x, int y,
-                                 int width, int height);
-
-/**
- * @brief     Set the Crop Area(Region Of Src ratio) area of display.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] scale_x: x label ratio in src video area.
- * @param     [in] scale_y: y label ratio in src video area.
- * @param     [in] scale_w: width ratio in src video area.
- * @param     [in] scale_h: height ratio in src video area.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            esplusplayer_open(esplayer);
- *            esplusplayer_set_display(esplayer,ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,window);
- *            esplusplayer_set_video_roi(esplayer,0,0,0.5,0.5);
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- * @endcode
- * @pre       The player state can be all of #esplusplayer_state except
- *            #ESPLUSPLAYER_STATE_NONE. \n
- * @post      None
- * @exception None
- * @remark    The minimum value of input are 0,maximum value is 1.
- * @see       esplusplayer_open() \n
- *            esplusplayer_set_display() \n
- *            esplusplayer_set_display_visible()
- */
-int esplusplayer_set_video_roi(esplusplayer_handle handle, double scale_x,
-                               double scale_y, double scale_w, double scale_h);
-
-/**
- * @brief     Set the visibility of the video display.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] visible : the visibility of the display.
- *            (@c true = visible, @c false = non-visible)
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            esplusplayer_open(esplayer);
- *            esplusplayer_set_display(esplayer,ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,window);
- *            esplusplayer_set_display_visible(esplayer,false);
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- * @endcode
- * @pre       The player state can be all of #esplusplayer_state except
- *            #ESPLUSPLAYER_STATE_NONE.
- * @post      None
- * @exception   None
- * @see       esplusplayer_open() \n
- *            esplusplayer_set_display()
- */
-int esplusplayer_set_display_visible(esplusplayer_handle handle, bool visible);
-
-/**
- * @brief     Set the rotate angle of the video display.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] rotation : the rotate angle of the display.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            esplusplayer_open(esplayer);
- *            esplusplayer_set_display(esplayer,ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,window);
- *            esplusplayer_set_display_rotation(esplayer_,ESPLUSPLAYER_DISPLAY_ROTATION_TYPE_90);
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- * @endcode
- * @pre       The player state can be all of #esplusplayer_state except
- *            #ESPLUSPLAYER_STATE_NONE.
- * @post      this API worked only when video sink created.
- * @exception None
- * @see       esplusplayer_open() \n
- *            esplusplayer_set_display()
- */
-int esplusplayer_set_display_rotation(
-    esplusplayer_handle handle, esplusplayer_display_rotation_type rotation);
-
-/**
- * @brief     Get the rotate angle of the video display.
- * @param     [in] handle : esplusplayer handle.
- * @param     [out] rotation : the rotate angle of the display which want to
- * get.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            esplusplayer_open(esplayer);
- *            esplusplayer_set_display_rotation(esplayer,ESPLUSPLAYER_DISPLAY_ROTATION_TYPE_90);
- *            esplusplayer_display_rotation_type rotation_get = ESPLUSPLAYER_DISPLAY_ROTATION_TYPE_NONE;
- *            // ... your codes ...
- *            esplusplayer_get_display_rotation(esplayer,&rotation_get);
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- * @endcode
- * @pre       The player state can be all of #esplusplayer_state except
- *            #ESPLUSPLAYER_STATE_NONE.
- * @post      this API worked only when video sink created.
- * @exception None
- * @see       esplusplayer_open() \n
- *            esplusplayer_set_display_rotation()
- */
-int esplusplayer_get_display_rotation(
-    esplusplayer_handle handle, esplusplayer_display_rotation_type* rotation);
-
-/**
- * @brief     Set whether to send decrypted es packets in the trust zone or
- *            encrypted es packets.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] type : whether to use trust zone memory or encrypted data
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            esplusplayer_open(esplayer);
- *            esplusplayer_set_submit_data_type(esplayer,ESPLUSPLAYER_SUBMIT_DATA_TYPE_CLEAN_DATA);
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- * @endcode
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_IDLE.
- * @post      None
- * @exception None
- * @remark    This API have to be called before calling
- *            esplusplayer_prepare_async(). \n
- *            If type is ESPLUSPLAYER_SUBMIT_DATA_TYPE_CLEAN_DATA use
- *            esplusplayer_submit_packet() to send clean packets. \n
- *            If type is ESPLUSPLAYER_SUBMIT_DATA_TYPE_ENCRYPTED_DATA, use
- *            esplusplayer_submit_encrypted_packet() to send encrypted packets.
- * @see       esplusplayer_open() \n
- *            esplusplayer_submit_encrypted_packet() \n
- *            esplusplayer_submit_data_type
- */
-int esplusplayer_set_submit_data_type(esplusplayer_handle handle,
-                                      esplusplayer_submit_data_type type);
-
-/**
- * @brief     Set on mute of the audio sound.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] mute : on mute of the sound.
- *            (@c true = mute, @c false = non-mute)
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success, otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            esplusplayer_open(esplayer);
- *            esplusplayer_set_audio_mute(esplayer, true);
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- * @endcode
- * @pre       The player state can be all of #esplusplayer_state except
- *            #ESPLUSPLAYER_STATE_NONE.
- * @post      None
- * @exception None
- * @see       esplusplayer_open()
- */
-int esplusplayer_set_audio_mute(esplusplayer_handle handle, bool mute);
-
-/**
- * @brief     Get current state of player.
- * @param     [in] handle : esplusplayer handle.
- * @return    current #esplusplayer_state of player.
- * @code
- *            esplusplayer_handle esplayer = esplusplayer_create();
- *            // ... your codes ...
- *            esplusplayer_state ret = esplusplayer_get_state(esplayer);
- *            // ... your codes ...
- *            esplusplayer_destroy(esplayer);
- * @endcode
- * @pre       None
- * @post      None
- * @exception None
- */
-esplusplayer_state esplusplayer_get_state(esplusplayer_handle handle);
-
-/**
- * @brief     Submit es packet to decode audio or video.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] packet : es packet pointer.
- * @return    @c ESPLUSPLAYER_SUBMIT_STATUS_SUCCESS : succeed to submit es
- *            packet,
- *            otherwise @c : fail to submit es packet.
- * @code
- *            static void OnPrepareDone(bool ret, void* userdata) {
- *                // ... your codes ...
- *                printf ("OnPrepareDone\n");
- *            }
- *            static void OnReadyToPrepare(const esplusplayer_stream_type type,void* userdata) {
- *                if (type == ESPLUSPLAYER_STREAM_TYPE_VIDEO) {
- *                    //Something you want to do when feed es video stream is allowed
- *                } else {
- *                    //Something you want to do when feed es audio stream is allowed
- *                }
- *                //Something you want to do when OnReadyToPrepare
- *                printf ("OnReadyToPrepare\n");
- *            }
- *            static void OnBufferByteStatus(const esplusplayer_stream_type type,
- *                                           const esplusplayer_buffer_status status,
- *                                           uint64_t byte_size, void* userdata) {
- *                if (type == ESPLUSPLAYER_STREAM_TYPE_VIDEO) {
- *                    if (status == ESPLUSPLAYER_BUFFER_STATUS_UNDERRUN) {
- *                        //Something you want to do when es video buffer is enough
- *                    } else {
- *                        //Something you want to do when es video buffer is not enough
- *                    }
- *                } else {
- *                    if (status == ESPLUSPLAYER_BUFFER_STATUS_UNDERRUN) {
- *                        //Something you want to do when es audio buffer is enough
- *                    } else {
- *                        //Something you want to do when es audio buffer is not enough
- *                    }
- *                }
- *                //Something you want to do when OnBufferByteStatus
- *                printf ("OnBufferByteStatus\n");
- *            }
- *            static void OnBufferTimeStatus(const esplusplayer_stream_type type,
- *                                           const esplusplayer_buffer_status status,
- *                                           uint64_t time_size,void* userdata) {
- *                if (type == ESPLUSPLAYER_STREAM_TYPE_VIDEO) {
- *                    if (status == ESPLUSPLAYER_BUFFER_STATUS_UNDERRUN) {
- *                        //Something you want to do when es video buffer is enough
- *                    } else {
- *                        //Something you want to do when es video buffer is not enough
- *                    }
- *                } else {
- *                    if (status == ESPLUSPLAYER_BUFFER_STATUS_UNDERRUN) {
- *                        //Something you want to do when es audio buffer is enough
- *                    } else {
- *                        //Something you want to do when es audio buffer is not enough
- *                    }
- *                }
- *                //Something you want to do when OnBufferTimeStatus
- *                printf ("OnBufferTimeStatus\n");
- *            }
- *            void FeedEsPacket(esplusplayer_handle player,esplusplayer_es_packet pkt) {
- *               // ... your codes ...
- *              if(feed is allowed && buffer is enough) {
- *                   esplusplayer_submit_packet(player, &pkt);
- *               }
- *               // ... your codes ...
- *           )
- *            esplusplayer_handle esplayer = esplusplayer_create();
- *            esplusplayer_set_prepare_async_done_cb(esplayer,OnPrepareDone,&esplayer);
- *            esplusplayer_set_ready_to_prepare_cb(esplayer,OnReadyToPrepare,&esplayer);
- *            esplusplayer_set_buffer_byte_status_cb(esplayer,OnBufferByteStatus,&esplayer);
- *            esplusplayer_set_buffer_time_status_cb(esplayer,OnBufferTimeStatus,&esplayer);
- *            esplusplayer_open(esplayer);
- *            esplusplayer_prepare_async(esplayer);
- *            // ... your codes ...
- *            //FeedEsPacket()(call a new thread to do this)
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- *            esplusplayer_destroy(esplayer);
- * @endcode
- * @pre       User can submit es packets after
- *            esplusplayer_ready_to_prepare_cb() or
- *            esplusplayer_ready_to_seek_cb() is called.
- * @post      None
- * @exception None
- * @remark    Amount of packets for at least one decoded frame must be submitted
- *            after calling esplusplayer_prepare_async() or esplusplayer_seek()
- *            for invoking esplusplayer_prepare_async_done_cb() or
- *            esplusplayer_seek_done_cb() \n
- *            This api must be called from a different thread than other apis.
- * @see       esplusplayer_set_submit_data_type() \n
- *            esplusplayer_es_packet \n
- *            esplusplayer_buffer_status_cb() \n
- *            esplusplayer_ready_to_prepare_cb() \n
- *            esplusplayer_ready_to_seek_cb()
- */
-esplusplayer_submit_status esplusplayer_submit_packet(
-    esplusplayer_handle handle, esplusplayer_es_packet* packet);
-
-#ifdef TIZEN_FEATURE_TV
-/**
- * @brief     Submit encrypted es packet to decode and decrypt audio or video.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] packet : es packet pointer.
- * @param     [in] drm_info : information to decrypt es packet.
- *                            esplusplayer doesn't take ownership. user should
- *                            free it. if you deliver it as (null), this api
- *                            works as esplusplayer_submit_packet().
- * @return    @c ESPLUSPLAYER_SUBMIT_STATUS_SUCCESS : succeed to submit es
- *            packet,
- *            otherwise @c : fail to submit es packet.
- * @code
- *            refer to the sample code of esplusplayer_submit_packet();
- * @endcode
- * @pre       User can submit es packets after
- *            esplusplayer_ready_to_prepare_cb() or
- *            esplusplayer_ready_to_seek_cb() is called.
- * @post      None
- * @exception None
- * @remark    Amount of packets for at least one decoded frame must be submitted
- *            after calling esplusplayer_prepare_async() or esplusplayer_seek()
- *            for invoking esplusplayer_prepare_async_done_cb() or
- *            esplusplayer_seek_done_cb(). \n
- *            To use this api, Must set
- * ESPLUSPLAYER_SUBMIT_DATA_TYPE_ENCRYPTED_DATA using
- * esplusplayer_set_submit_data_type() \n This api must be called from a
- * different thread than other apis.
- * @see       esplusplayer_es_packet \n
- *            esplusplayer_drm_info \n
- *            esplusplayer_buffer_status_cb() \n
- *            esplusplayer_ready_to_prepare_cb() \n
- *            esplusplayer_ready_to_seek_cb() \n
- *            esplusplayer_submit_packet()
- */
-esplusplayer_submit_status esplusplayer_submit_encrypted_packet(
-    esplusplayer_handle handle, esplusplayer_es_packet* packet,
-    esplusplayer_drm_info* drm_info);
-#endif
-
-/**
- * @brief     Generate EOS(End Of Stream) packet explicitly and submit it to the
- *            player.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] type : stream type which reaches eos.
- * @return    @c ESPLUSPLAYER_SUBMIT_STATUS_SUCCESS : succeed to submit EOS
- * packet,
- *            otherwise @c : fail to submit EOS packet.
- * @code
- *            esplusplayer_handle esplayer = esplusplayer_create();
- *            // ... your codes ...
- *            esplusplayer_submit_eos_packet(esplayer,ESPLUSPLAYER_STREAM_TYPE_VIDEO);
- *            // ... your codes ...
- * @endcode
- * @pre       None
- * @post      None
- * @exception None
- */
-esplusplayer_submit_status esplusplayer_submit_eos_packet(
-    esplusplayer_handle handle, esplusplayer_stream_type type);
-
-/**
- * @brief     Set audio stream to have contents information.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] stream : audio stream pointer.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            esplusplayer_open(esplayer);
- *            esplusplayer_audio_stream_info audio_stream;
- *            audio_stream.codec_data = nullptr;
- *            audio_stream.codec_data_length = 0;
- *            esplusplayer_set_audio_stream_info(esplayer, &audio_stream);
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- * @endcode
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_IDLE except
- *            audio stream is deactivated.
- * @post      None
- * @exception None
- * @remark    This API have to be called before calling the
- *            esplusplayer_prepare_async().
- * @see       esplusplayer_open() \n
- *            esplusplayer_audio_stream_info
- */
-int esplusplayer_set_audio_stream_info(esplusplayer_handle handle,
-                                       esplusplayer_audio_stream_info* stream);
-
-/**
- * @brief     Set video stream to have contents information.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] stream : video stream pointer.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_IDLE except
- *            video stream is deactivated.
- * @post      None
- * @exception None
- * @remark    This API have to be called before calling the
- *            esplusplayer_prepare_async().
- * @see       esplusplayer_audio_stream_info
- *            esplusplayer_activate
- */
-int esplusplayer_set_video_stream_info(esplusplayer_handle handle,
-                                       esplusplayer_video_stream_info* stream);
-
-/**
- * @brief     Get the current playing time of the associated media.
- * @param     [in] handle : esplusplayer handle.
- * @param     [out] ms : current playing time in milliseconds.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            prepare esplayer done
- *            esplusplayer_start(esplayer);
- *            // ... your codes ...
- *            uint64_t cur_time = 0;
- *            esplusplayer_get_playing_time(esplayer, &cur_time);
- *            // ... your codes ...
- *            esplusplayer_stop(esplayer);
- * @endcode
- * @pre       The player must be one of #ESPLUSPLAYER_STATE_PAUSE or
- *            #ESPLUSPLAYER_STATE_PLAYING.
- * @post      None
- * @exception None
- * @see       esplusplayer_prepare_async()
- */
-int esplusplayer_get_playing_time(esplusplayer_handle handle, uint64_t* ms);
-
-/**
- * @brief     Get dropped frame counts in videosink.
- * @param     [in] handle : esplusplayer handle.
- * @param     [out] padaptive_info : dropped frame counts.
- * @param     [in] adaptive_type : type of adaptive info which APP want to get.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            prepare esplayer done
- *            // ... your codes ...
- *            uint64_t count = 0;
- *            esplusplayer_get_adaptive_info(esplayer,
- *                static_cast<void*>(&count),ESPLUSPLAYER_ADAPT_INFO_TYPE_DROPPED_FRAMES);
- *            // ... your codes ...
- *            esplusplayer_stop(esplayer);
- * @endcode
- * @pre       The player must be one of #ESPLUSPLAYER_STATE_READY,
- *                   #ESPLUSPLAYER_STATE_PAUSE or #ESPLUSPLAYER_STATE_PLAYING.
- * @post      None
- * @exception None
- * @see       esplusplayer_prepare_async()
- */
-int esplusplayer_get_adaptive_info(
-    esplusplayer_handle handle, void* padaptive_info,
-    esplusplayer_adaptive_info_type adaptive_type);
-
-/**
- * @brief     Set volume to player
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] volume : volume level(0 ~ 100).
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            esplusplayer_open(esplayer);
- *            int vol = 80;
- *            esplusplayer_set_volume(esplayer, vol)
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- * @endcode
- * @pre       The player state must be not #ESPLUSPLAYER_STATE_NONE.
- * @post      None
- * @exception None
- * @see       esplusplayer_open()
- */
-int esplusplayer_set_volume(esplusplayer_handle handle, const int volume);
-
-/**
- * @brief     Get volume from player
- * @param     [in] handle : esplusplayer handle.
- * @param     [out] volume : volume ptr.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            esplusplayer_open(esplayer);
- *            // ... your codes ...
- *            int vol = 0;
- *            esplusplayer_get_volume(esplayer, &vol)
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- * @endcode
- * @pre       The player state must be not #ESPLUSPLAYER_STATE_NONE.
- * @post      None
- * @exception None
- * @see       esplusplayer_open()
- */
-int esplusplayer_get_volume(esplusplayer_handle handle, int* volume);
-
-/**
- * @brief     Set decoded video frame buffer type.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] type : one of the video decoded buffer type to set .
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            esplusplayer_open(esplayer);
- *            esplusplayer_set_video_frame_buffer_type(esplayer,
- *                ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_NONE);
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- * @endcode
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_IDLE when type
-              is not equal to be
- ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_SCALE
-              The player state must be not #ESPLUSPLAYER_STATE_NONE when
-              type is equal to be
- ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_SCALE
- * @post      None
- * @exception None
- * @remark    reference can't support sw codec type.
- *            esplusplayer_set_media_packet_video_decoded_cb()
- *            esplusplayer_set_video_codec_type()
- *            when type is SCALE, the target scale resolution can be set by
- *            esplusplayer_set_video_frame_buffer_scale_resolution()
- * @see       esplusplayer_open()
- */
-int esplusplayer_set_video_frame_buffer_type(
-    esplusplayer_handle handle,
-    esplusplayer_decoded_video_frame_buffer_type type);
-
-/**
- * @brief     Flush buffers for a player.
- * @param     [in] handle : esplusplayer handle ptr.
- * @param     [in] type : choose which stream data need to be
- *            flush,audio/video,if need flush all pipeline can call this API
- * twice.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            prepare esplayer done
- *            // ... your codes ...
- *            esplusplayer_flush(esplayer, ESPLUSPLAYER_STREAM_TYPE_VIDEO);
- *            // ... your codes ...
- *            esplusplayer_stop(esplayer);
- * @endcode
- * @pre       The player state should greater than #ESPLUSPLAYER_STATE_IDLE
- * @post      None
- * @exception None
- * @see       esplusplayer_prepare_async()
- */
-int esplusplayer_flush(esplusplayer_handle handle,
-                       esplusplayer_stream_type type);
-
-/**
- * @brief     Convert the esplusplayer error type to a string.
- * @param     [in] type : esplusplayer error type
- * @return    @c not nullptr  the converted error string otherwise @c failed to
- *            convert the error.
- * @code
- *            // ... your codes ...
- *            const char* error;
- *            error = esplusplayer_get_error_string(ESPLUSPLAYER_ERROR_TYPE_NOT_SUPPORTED_FILE);
- *            // ... your codes ...
- * @endcode
- * @pre       None
- * @post      None
- * @exception None
- */
-const char* esplusplayer_get_error_string(esplusplayer_error_type type);
-
-/**
- * @brief     Sets a callback function to be invoked when an error occurs.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] error_cb : the error callback function to register.
- * @param     [in] userdata : userdata of esplusplayer_error_cb()
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            static void OnError(const esplusplayer_error_type err_code, void*
- *                userdata) {
- *                //Something you want to do when error occur
- *                printf ("OnError\n");
- *            }
- *            esplusplayer_handle esplayer = esplusplayer_create();
- *            esplusplayer_set_error_cb(esplayer, OnError, nullptr);
- *            // ... your codes ...
- *            esplusplayer_destroy(esplayer);
- * @endcode
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
- *            or #ESPLUSPLAYER_STATE_IDLE.
- * @post      esplusplayer_error_cb() will be invoked.
- * @exception None
- * @remark    esplusplayer_error_cb()
- *            if error_cb is set to null, esplusplayer_error_cb() will not be
- *            invoked anymore.
- */
-int esplusplayer_set_error_cb(esplusplayer_handle handle,
-                              esplusplayer_error_cb error_cb, void* userdata);
-
-/**
- * @brief     Set a callback function to be invoked when buffer underrun or
- *            overflow is occurred.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] buffer_status_cb : the buffer status callback function to
- * register.
- * @param     [in] userdata : userdata of esplusplayer_buffer_status_cb()
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            refer to the sample code of esplusplayer_set_error_cb();
- * @endcode
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
- *            or #ESPLUSPLAYER_STATE_IDLE.
- * @post      esplusplayer_buffer_status_cb() will be invoked.
- * @exception None
- * @remark    esplusplayer_buffer_status_cb()
- *            if buffer_status_cb is set to null,
- *            esplusplayer_buffer_status_cb() will not be invoked anymore.
- */
-int esplusplayer_set_buffer_status_cb(
-    esplusplayer_handle handle, esplusplayer_buffer_status_cb buffer_status_cb,
-    void* userdata);
-
-/**
- * @brief     Set a callback function to be invoked when buffer underrun or
- *            overflow is occurred and buffer size in byte will be passed.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] buffer_status_cb : the buffer byte status callback function
- *            to register.
- * @param     [in] userdata : userdata of esplusplayer_buffer_byte_status_cb()
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            refer to the sample code of esplusplayer_submit_packet();
- * @endcode
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
- *            or #ESPLUSPLAYER_STATE_IDLE.
- * @post      esplusplayer_buffer_byte_status_cb() will be invoked.
- * @exception None
- * @remark    esplusplayer_buffer_byte_status_cb()
- */
-int esplusplayer_set_buffer_byte_status_cb(
-    esplusplayer_handle handle,
-    esplusplayer_buffer_byte_status_cb buffer_status_cb, void* userdata);
-
-/**
- * @brief     Set a callback function to be invoked when buffer underrun or
- *            overflow is occurred and buffer size in time will be passed.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] buffer_status_cb : the buffer time status callback function
- *            to register.
- * @param     [in] userdata : userdata of esplusplayer_buffer_time_status_cb()
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
-              refer to the sample code of esplusplayer_submit_packet();
- * @endcode
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
- *            or #ESPLUSPLAYER_STATE_IDLE.
- * @post      esplusplayer_buffer_time_status_cb() will be invoked.
- * @exception None
- * @remark    esplusplayer_buffer_time_status_cb(),
- *            esplusplayer_buffer_time_status_cb() will be invoked only
- *            when the duration value of espacket is set.
- *            if buffer_status_cb is set to null,
- *            esplusplayer_buffer_time_status_cb() will not be invoked anymore.
- */
-int esplusplayer_set_buffer_time_status_cb(
-    esplusplayer_handle handle,
-    esplusplayer_buffer_time_status_cb buffer_status_cb, void* userdata);
-
-/**
- * @brief     Set buffer size with different option
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] option : the option of buffer size.
- * @param     [in] size : size of selected buffer option.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            esplusplayer_open(esplayer);
- *            esplusplayer_set_buffer_size(esplayer,ESPLUSPLAYER_BUFFER_AUDIO_MAX_BYTE_SIZE,10240)
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- * @endcode
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_IDLE.
- * @post      None
- * @exception None
- * @remark    esplusplayer_buffer_option
- * @see       esplusplayer_open()
- */
-int esplusplayer_set_buffer_size(esplusplayer_handle handle,
-                                 esplusplayer_buffer_option option,
-                                 uint64_t size);
-/**
- * @brief     Set a callback function to be invoked when resource confliction is
- * occurred.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] resource_conflicted_cb : the resource conflicted callback
- *            function to register.
- * @param     [in] userdata : userdata of resource_conflicted_cb()
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            refer to the sample code of esplusplayer_set_error_cb();
- * @endcode
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
- *            or #ESPLUSPLAYER_STATE_IDLE.
- * @post      esplusplayer_resource_conflicted_cb() will be invoked.
- * @exception None
- * @remark    esplusplayer_resource_conflicted_cb()
- *            if resource_conflicted_cb is set to null,
- *            esplusplayer_resource_conflicted_cb() will not be invoked
- *            anymore.
- */
-int esplusplayer_set_resource_conflicted_cb(
-    esplusplayer_handle handle,
-    esplusplayer_resource_conflicted_cb resource_conflicted_cb, void* userdata);
-
-/**
- * @brief     Set a callback function to be invoked when player has reached the
- *            end of stream.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] eos_cb : the eos callback function to register.
- * @param     [in] userdata : userdata of esplusplayer_eos_cb()
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            refer to the sample code of esplusplayer_set_error_cb();
- * @endcode
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
- *            or #ESPLUSPLAYER_STATE_IDLE.
- * @post      esplusplayer_eos_cb() will be invoked.
- * @exception None
- * @remark    esplusplayer_eos_cb()
- *            if eos_cb is set to null, esplusplayer_eos_cb() will not be
- *            invoked anymore.
- */
-int esplusplayer_set_eos_cb(esplusplayer_handle handle,
-                            esplusplayer_eos_cb eos_cb, void* userdata);
-
-/**
- * @brief     Set a callback function to be invoked when player is prepared to
- *            receive es packets after calling esplusplayer_prepare_async().
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] ready_to_prepare_cb : the ready to prepare callback function
- *            to register.
- * @param     [in] userdata : userdata of ready_to_prepare_cb()
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            refer to the sample code of esplusplayer_submit_packet();
- * @endcode
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
- *            or #ESPLUSPLAYER_STATE_IDLE.
- * @post      None
- * @exception None
- * @remark    esplusplayer_prepare_async()
- *            if ready_to_prepare_cb is set to null,
- *            esplusplayer_ready_to_prepare_cb() will not be invoked anymore.
- */
-int esplusplayer_set_ready_to_prepare_cb(
-    esplusplayer_handle handle,
-    esplusplayer_ready_to_prepare_cb ready_to_prepare_cb, void* userdata);
-
-/**
- * @brief     Set a callback function to be invoked when player is prepared to
- *            be started.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] prepare_async_done_cb : the prepare async done callback
- * function to register.
- * @param     [in] userdata : userdata of prepare_async_done_cb()
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            refer to the sample code of plusplayer_prepare_async();
- * @endcode
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
- *            or #ESPLUSPLAYER_STATE_IDLE.
- * @post      esplusplayer_prepare_async_done_cb() will be invoked.
- * @exception It is prohibited to call any player APIs at
- *            esplusplayer_prepare_async_done_cb callback.
- * @remark    esplusplayer_prepare_async_done_cb()
- *            if prepare_async_done_cb is set to null,
- *            esplusplayer_prepare_async_done_cb() will not be
- *            invoked anymore.
- * @see       plusplayer_prepare_async
- */
-int esplusplayer_set_prepare_async_done_cb(
-    esplusplayer_handle handle,
-    esplusplayer_prepare_async_done_cb prepare_async_done_cb, void* userdata);
-
-/**
- * @brief     Set a callback function to be invoked when player is prepared to
- *            be started.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] seek_done_cb : the seek done callback function to register.
- * @param     [in] userdata : userdata of esplusplayer_seek_done_cb()
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            refer to the sample code of esplusplayer_set_error_cb();
- * @endcode
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
- *            or #ESPLUSPLAYER_STATE_IDLE.
- * @post      esplusplayer_seek_done_cb() will be invoked.
- *            if seek_done_cb is set to null, esplusplayer_seek_done_cb() will
- *            not be invoked anymore.
- * @exception None
- */
-int esplusplayer_set_seek_done_cb(esplusplayer_handle handle,
-                                  esplusplayer_seek_done_cb seek_done_cb,
-                                  void* userdata);
-
-/**
- * @brief     Set a callback function to be invoked when player is prepared to
- *            receive es packets after flushing all submitted es packets for
- *            seek.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] ready_to_seek_cb : the ready to seek callback function to
- *            register.
- * @param     [in] userdata : userdata of esplusplayer_ready_to_seek_cb()
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            refer to the sample code of esplusplayer_set_error_cb();
- * @endcode
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
- *            or #ESPLUSPLAYER_STATE_IDLE.
- * @post      None
- * @exception None
- * @remark    esplusplayer_seek()
- *            if ready_to_seek_cb is set to null, esplusplayer_ready_to_seek_cb()
- *            will not be invoked anymore.
- */
-int esplusplayer_set_ready_to_seek_cb(
-    esplusplayer_handle handle, esplusplayer_ready_to_seek_cb ready_to_seek_cb,
-    void* userdata);
-
-/**
- * @brief     Set a callback function to be invoked when player decoded video
- *            frame. A video frame can be retrieved using a registered callback.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] media_packet_video_decoded_cb : the media packet video
- * decoded callback function to register.
- * @param     [in] userdata : userdata of
- * esplusplayer_set_media_packet_video_decoded_cb()
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            refer to the sample code of esplusplayer_set_error_cb();
- * @endcode
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
- *            or #ESPLUSPLAYER_STATE_IDLE.
- * @post      None
- * @exception None
- * @remark    esplusplayer_set_video_frame_buffer_type()
- *            if media_packet_video_decoded_cb is set to null,
- *            esplusplayer_error_cb() will not be invoked anymore.
- *            media packets have to be released by calling
- *            esplusplayer_decoded_buffer_destroy().
- * @see       esplusplayer_set_video_frame_buffer_scale_resolution
- */
-int esplusplayer_set_media_packet_video_decoded_cb(
-    esplusplayer_handle handle,
-    esplusplayer_media_packet_video_decoded_cb media_packet_video_decoded_cb,
-    void* userdata);
-
-/**
- * @brief     Set closed caption callback function.
- * @description   In this function set closed caption callback to handle the
- *            closed caption. If there is closed caption to display,
- *            esplusplayer_closed_caption_cb will be called to notify there
- *            is closed caption to display.
- * @param     [in] handle : esplusplayer handle ptr.
- * @param     [in] closed_caption_cb :  the closed caption callback  function to
- * register.
- * @param     [in] userdata : userdata of esplusplayer_closed_caption_cb
- *            callback function.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            refer to the sample code of esplusplayer_set_error_cb();
- * @endcode
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
- *            or #ESPLUSPLAYER_STATE_IDLE.
- * @post      When there is closed caption data, call
- *            esplusplayer_closed_caption_cb to notify that there is closed
- *            caption needed to be displayed.
- * @exception None
- * @remark    esplusplayer_closed_caption_cb \n
- *            [in] data : closed caption data \n
- *            [in] size : length of closed caption data \n
- *            [in] userdata : userdata of esplusplayer_closed_caption_cb
- *            callback function.
- *            if closed_caption_cb is set to null, esplusplayer_closed_caption_cb()
- *            will not be invoked anymore.
- */
-int esplusplayer_set_closed_caption_cb(
-    esplusplayer_handle handle,
-    esplusplayer_closed_caption_cb closed_caption_cb, void* userdata);
-
-/**
- * @brief     Set a callback function to be invoked when the flush operation is
- *            done.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] flush_done_cb : the flush done callback function to register.
- * @param     [in] userdata : userdata of esplusplayer_flush_done_cb()
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            refer to the sample code of esplusplayer_set_error_cb();
- * @endcode
- * @pre       This api should be called before esplusplayer_flush() is called
- * @post      esplusplayer_flush_done_cb() will be invoked.
- * @exception None
- * @remark    called before esplusplayer_flush().
- *            if flush_done_cb is set to null, esplusplayer_error_cb() will
- *            not be invoked anymore.
- */
-int esplusplayer_set_flush_done_cb(esplusplayer_handle handle,
-                                   esplusplayer_flush_done_cb flush_done_cb,
-                                   void* userdata);
-/**
- * @brief     Set a callback function to be invoked when a specific event
- *            occurs.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] event_cb : the callback function to register.
- * @param     [in] userdata : userdata of esplusplayer_event_cb()
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            refer to the sample code of esplusplayer_set_error_cb();
- * @endcode
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_NONE
- *            or #ESPLUSPLAYER_STATE_IDLE.
- * @post      esplusplayer_event_cb() will be invoked.
- * @exception None
- * @remark    esplusplayer_set_event_cb()
- *            if event_cb is set to null, esplusplayer_event_cb() will not be
- *            invoked anymore.
- */
-int esplusplayer_set_event_cb(esplusplayer_handle handle,
-                              esplusplayer_event_cb event_cb, void* userdata);
-/**
- * @brief     Provided api for destroying decoded buffer.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] packet : the decoded buffer.
- * @return    @c one of esplusplayer_error_type values will be returned.
- * @pre       The player state can be greater than #ESPLUSPLAYER_STATE_IDLE.
- * @post      esplusplayer_decoded_buffer_destroy will be invoked for video
- *            texturing
- * @exception None
- * @remark    esplusplayer_decoded_buffer_destroy().
- */
-int esplusplayer_decoded_buffer_destroy(
-    esplusplayer_handle handle, esplusplayer_decoded_video_packet* packet);
-
-/**
- * @brief     Provided api for setting low latency mode, multiple modes can be
- *            set to duplicate.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] mode : one of the low latency mode to set.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            esplusplayer_open(esplayer);
- *            esplusplayer_set_low_latency_mode(esplayer, ESPLUSPLAYER_LOW_LATENCY_MODE_NONE);
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- * @endcode
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_IDLE.
- * @post      None
- * @exception None
- * @remark    Public supports #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_PREROLL only.
- *            No operation is performed and #ESPLUSPLAYER_ERROR_TYPE_NONE will be returned,
- *            if @a mode is not #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_PREROLL to make compatible with TV API.
- * @see       esplusplayer_open()
- */
-int esplusplayer_set_low_latency_mode(esplusplayer_handle handle,
-                                      esplusplayer_low_latency_mode mode);
-
-/**
- * @brief     Provided api for setting unlimited max buffer mode, the player
- *            does not limit es packet transmission although in buffer overrun
- * status
- * @param     [in] handle : esplusplayer handle.
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            esplusplayer_open(esplayer);
- *            esplusplayer_set_unlimited_max_buffer_mode(esplayer);
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- * @endcode
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_IDLE.
- * @post      None
- * @exception None
- * @remark    esplusplayer_set_unlimited_max_buffer_mode().
- *            esplusplayer_buffer_status_cb() will be invoked in
- *            overrun/underrun buffer status. but
- *            esplusplayer_submit_packet() /
- *            esplusplayer_submit_encrypted_packet()
- *            does not return ESPLUSPLAYER_SUBMIT_STATUS_FULL
- * @see       esplusplayer_open() \n
- *            esplusplayer_submit_packet() \n
- *            esplusplayer_submit_encrypted_packet()
- */
-int esplusplayer_set_unlimited_max_buffer_mode(esplusplayer_handle handle);
-
-/**
- * @brief     Provided api for setting audio codec type for playback.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] type : codec type(hardware/software).
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            esplusplayer_open(esplayer);
- *            esplusplayer_set_audio_codec_type(esplayer,ESPLUSPLAYER_AUDIO_CODEC_TYPE_SW);
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- * @endcode
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_IDLE.
-              When the audio stream is not set or deactivated, it can be set
-              in #ESPLUSPLAYER_STATE_READY, #ESPLUSPLAYER_STATE_PAUSED and
-              #ESPLUSPLAYER_STATE_PLAYING. The set codec type will be
-              applied when esplusplayer_activate() is called.
- * @post      None
- * @exception None
- * @see       esplusplayer_open() \n
- *            esplusplayer_deactivate() \n
-              esplusplayer_activate() \n
-              esplusplayer_set_audio_stream_info()
- */
-int esplusplayer_set_audio_codec_type(esplusplayer_handle handle,
-                                      esplusplayer_audio_codec_type type);
-/**
- * @brief     Provided api for setting video codec type for playback.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] type : codec type(hardware/software).
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            esplusplayer_open(esplayer);
- *            esplusplayer_set_video_codec_type(esplayer,ESPLUSPLAYER_VIDEO_CODEC_TYPE_SW);
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- * @endcode
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_IDLE.
-              When the video stream is not set or deactivated, it can be set
-              in #ESPLUSPLAYER_STATE_READY, #ESPLUSPLAYER_STATE_PAUSED and
-              #ESPLUSPLAYER_STATE_PLAYING. The set codec type will be
-              applied when esplusplayer_activate() is called.
- * @post      None
- * @exception None
- * @see       esplusplayer_open() \n
- *            esplusplayer_deactivate() \n
-              esplusplayer_activate() \n
-              esplusplayer_set_video_stream_info()
- */
-int esplusplayer_set_video_codec_type(esplusplayer_handle handle,
-                                      esplusplayer_video_codec_type type);
-/**
- * @brief     Provided api for setting render time offset
- * @param     [in] handle : esplusplayer handle ptr.
- * @param     [in] type : stream type
- * @param     [in] offset : offset (in milliseconds).
- *                          G_MININT64 <= offset * 1000000 <= G_MAXINT64
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            esplusplayer_open(esplayer);
- *            esplusplayer_set_low_latency_mode(esplayer,ESPLUSPLAYER_LOW_LATENCY_MODE_NONE);
- *            prepare esplayer
- *            // ... your codes ...
- *            int64_t set_offset = 10;
- *            esplusplayer_set_render_time_offset(esplayer,ESPLUSPLAYER_STREAM_TYPE_VIDEO,
- *                                                set_offset);
- *            int64_t get_offset = 0;
- *            esplusplayer_get_render_time_offset(esplayer_,ESPLUSPLAYER_STREAM_TYPE_VIDEO,
- *                                                &get_offset);
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- * @endcode
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_READY,
- *            #ESPLUSPLAYER_STATE_PAUSED or #ESPLUSPLAYER_STATE_PLAYING.
- *            It have to be set to low latency mode. (all mode except
- *            # ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_SYNC)
- * @remark    esplusplayer_set_low_latency_mode().
- * @post      None
- * @exception None
- * @see       esplusplayer_open()
- *            esplusplayer_get_render_time_offset()
- */
-int esplusplayer_set_render_time_offset(esplusplayer_handle handle,
-                                        esplusplayer_stream_type type,
-                                        int64_t offset);
-/**
- * @brief     Provided api for getting render time offset
- * @param     [in] handle : esplusplayer handle ptr.
- * @param     [in] type : stream type
- * @param     [in] offset : offset ptr (in milliseconds).
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @pre       The player state must be set to #ESPLUSPLAYER_STATE_READY,
- *            #ESPLUSPLAYER_STATE_PAUSED or #ESPLUSPLAYER_STATE_PLAYING.
- *            It have to be set to low latency mode.
- * @remark    esplusplayer_set_low_latency_mode().
- * @post      None
- * @exception None
- * see        esplusplayer_set_render_time_offset()
- */
-int esplusplayer_get_render_time_offset(esplusplayer_handle handle,
-                                        esplusplayer_stream_type type,
-                                        int64_t* offset);
-/**
- * @brief     Requests decoded video frame packet to acquire it. it works only
- *            with #ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_MANUAL_COPY
- *            mode
- * @param     [in] handle : esplusplayer handle.
- * @param     [out] packet : the decoded buffer.
- * @param     [out] status : (nullable) the result of video frame requested
- * @pre       The player state must be one of #ESPLUSPLAYER_STATE_READY or
- *            #ESPLUSPLAYER_STATE_PAUSED or #ESPLUSPLAYER_STATE_PLAYING.
- * @post      None
- * @return    #ESPLUSPLAYER_ERROR_TYPE_NONE on success, otherwise one of
- *            esplusplayer_error_type values will be returned.
- * @exception None
- * @version   4.0
- * @see       esplusplayer_set_video_frame_buffer_type()
- * @see       esplusplayer_decoded_buffer_destroy()
- * @see       esplusplayer_decoded_video_frame_buffer_type
- * @code
- * ...
- * esplusplayer_set_video_frame_buffer_type(handle,
- * ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_MANUAL_COPY);
- * ...
- * esplusplayer_prepare_async(handle);
- * ...
- * // after prepared
- * esplusplayer_decoded_video_packet packet;
- * esplusplayer_get_decoded_video_frame_status_type state;
- * int retval = esplusplayer_get_decoded_video_packet(handle, &packet, &state);
- * if (state == ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_SUCCESS) {
- *   // successful case.
- *   // in this case, retval will be ESPLUSPLAYER_ERROR_TYPE_NONE
- *   // you have to call esplusplayer_decoded_buffer_destroy() after using the
- *   // packet
- *   ...
- *   esplusplayer_decoded_buffer_destroy(handle, &packet);
- * } else if (state ==
- * ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_NO_REMAINING_BUFFER) {
- *   // app has to call esplusplayer_decoded_buffer_destroy() with previous
- *   // video packet.
- *   // it means player couldn't draw the video frame into a buffer due to no
- * buffer.
- *   // in this case ,retval will be ESPLUSPLAYER_ERROR_TYPE_NONE
- * } else if (state ==
- * ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_NO_FILLED_BUFFER) {
- *   // it means app should retry to get decoded video packet.
- *   // in most case, there were no buffers drawn in the timing you called this
- *   // api.
- *   // in this case, retval will be ESPLUSPLAYER_ERROR_TYPE_NONE
- * } else if (state == ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_UNKNOWN) {
- *   // internal error happened
- *   // in this case, retval will be ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION
- * }
- * ...
- * @endcode
- */
-int esplusplayer_get_decoded_video_packet(
-    esplusplayer_handle handle, esplusplayer_decoded_video_packet* packet,
-    esplusplayer_get_decoded_video_frame_status_type* status);
-
-/**
- * @brief     Provided api for enabling video hole.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] value : the value of video hole.
- *            (@c true = video hole enabled, @c false = video hole disabled)
- * @return    @c ESPLUSPLAYER_ERROR_TYPE_NONE on success, otherwise @c one of esplusplayer_error_type
- *            values will be returned.
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
- * @retval    #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
- * @code
- *            esplusplayer_open(esplayer);
- *            esplusplayer_enable_video_hole(esplayer, false);
- *            // ... your codes ...
- *            esplusplayer_close(esplayer);
- * @endcode
- * @pre       The player state must not be #ESPLUSPLAYER_STATE_NONE.
- * @remark    To disable video hole, esplusplayer_decoded_video_frame_buffer_type() must
- *            not be set to #ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_NONE.
- *            To enable video hole, esplusplayer_set_display() must be set to #ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY
- * @post      None
- * @exception None
- * @see       esplusplayer_set_video_frame_buffer_type()
- *            esplusplayer_set_media_packet_video_decoded_cb()
- */
-int esplusplayer_enable_video_hole(esplusplayer_handle handle, const bool value);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_ESPLUSPLAYER_CAPI_H__
diff --git a/inc/esplusplayer_capi/esplusplayer_internal.h b/inc/esplusplayer_capi/esplusplayer_internal.h
deleted file mode 100644 (file)
index 11b398b..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * @file           esplusplayer_internal.h
- * @brief          EsPlusPlayer internally used api c version
- * @interfacetype  module
- * @privlevel      None-privilege
- * @privilege      None
- * @product        TV, AV, B2B
- * @version        2.0
- * @SDK_Support    N
- * @remark         This is esplusplayer api header implemented as C style to
- *                 avoid binary compatibility issues.
- *
- * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
- * PROPRIETARY/CONFIDENTIAL
- * This software is the confidential and proprietary
- * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
- * not disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into with
- * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
- * suitability of the software, either express or implied, including but not
- * limited to the implied warranties of merchantability, fitness for a
- * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
- * damages suffered by licensee as a result of using, modifying or distributing
- * this software or its derivatives.
- */
-
-#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_ESPLUSPLAYER_INTERNAL_H__
-#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_ESPLUSPLAYER_INTERNAL_H__
-
-#include "esplusplayer_capi/display.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-typedef void* esplusplayer_handle;
-typedef void (*esplusplayer_first_video_decoding_done_cb)(void*);
-
-/**
- * @brief     Set the video display.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] type : display type.
- * @param     [in] window : the ecore wayland window handle.
- * @param     [in] x : the x coordinate of window.
- * @param     [in] y : the ycoordinate of window.
- * @param     [in] width : the width of window.
- * @param     [in] height : the height of window.
- * @return    @c one of esplusplayer_error_type values will be returned.
- * @pre       The player state can be all of #esplusplayer_state except
- *            #ESPLUSPLAYER_STATE_NONE.
- * @post      None
- * @exception   None
- * @see       esplusplayer_set_display_mode() \n
- *            esplusplayer_set_display_roi() \n
- *            esplusplayer_set_display_visible()
- */
-int esplusplayer_set_ecore_display(esplusplayer_handle handle,
-                                   esplusplayer_display_type type, void* window,
-                                   int x, int y, int width, int height);
-/**
- * @brief     Set the video display.
- * @param     [in] handle : esplusplayer handle.
- * @param     [in] type : display type.
- * @param     [in] surface_id : resource id of window.
- * @param     [in] x : the x coordinate of window.
- * @param     [in] y : the ycoordinate of window.
- * @param     [in] width : the width of window.
- * @param     [in] height : the height of window.
- * @return    @c one of esplusplayer_error_type values will be returned.
- * @pre       The player state can be all of #esplusplayer_state except
- *            #ESPLUSPLAYER_STATE_NONE.
- * @post      None
- * @exception   None
- * @see       esplusplayer_set_display_mode() \n
- *            esplusplayer_set_display_roi() \n
- *            esplusplayer_set_display_visible()
- */
-int esplusplayer_set_surface_display(esplusplayer_handle handle,
-                                     esplusplayer_display_type type,
-                                     unsigned int surface_id, int x, int y,
-                                     int width, int height);
-
-int esplusplayer_set_first_video_decoding_done_cb(
-    esplusplayer_handle handle,
-    esplusplayer_first_video_decoding_done_cb first_video_decoding_done_cb,
-    void* userdata);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_ESPLUSPLAYER_INTERNAL_H__
diff --git a/inc/esplusplayer_capi/event.h b/inc/esplusplayer_capi/event.h
deleted file mode 100644 (file)
index 779ff7b..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * @file
- * @brief          The event for playback.
- * @interfacetype  Platform
- * @privlevel      None-privilege
- * @privilege      None
- * @product        TV, AV, B2B
- * @version        2.0
- * @SDK_Support    N
- * @remark         This is a group of C style event related enum and structure.
- * @see            N/A
- *
- * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
- * PROPRIETARY/CONFIDENTIAL
- * This software is the confidential and proprietary
- * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
- * not disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into with
- * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
- * suitability of the software, either express or implied, including but not
- * limited to the implied warranties of merchantability, fitness for a
- * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
- * damages suffered by licensee as a result of using, modifying or distributing
- * this software or its derivatives.
- */
-
-#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_EVENT_H__
-#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_EVENT_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-/**
- * @brief Event message
- */
-typedef struct {
-  /**
-   * @description event message data
-   *              eg) ESPLUSPLAYER_EVENT_RESOLUTION_CHANGED : "1920x1080"
-   */
-  char* data;
-  /**
-   * @description the length of event message data
-   */
-  uint64_t len;
-} esplusplayer_event_msg;
-
-/**
- * @brief Enumerations for event message types
- */
-typedef enum {
-  ESPLUSPLAYER_EVENT_NONE,
-  ESPLUSPLAYER_EVENT_RESOLUTION_CHANGED,
-} esplusplayer_event_type;
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif
-
-#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_EVENT_H__
diff --git a/inc/esplusplayer_capi/matroska_color.h b/inc/esplusplayer_capi/matroska_color.h
deleted file mode 100644 (file)
index 42d1187..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-/**
- * @file
- * @brief          The matroska color info
- * @interfacetype  Platform
- * @privlevel      None-privilege
- * @privilege      None
- * @product        TV, AV, B2B
- * @version        2.0
- * @SDK_Support    N
- * @see            plusplayer::EsPlusPlayer class
- *
- * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
- * PROPRIETARY/CONFIDENTIAL
- * This software is the confidential and proprietary
- * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
- * not disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into with
- * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
- * suitability of the software, either express or implied, including but not
- * limited to the implied warranties of merchantability, fitness for a
- * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
- * damages suffered by licensee as a result of using, modifying or distributing
- * this software or its derivatives.
- */
-
-#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_MATROSKA_COLOR_H__
-#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_MATROSKA_COLOR_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-/**
- * @brief   Structure of matroska matering metadata
- */
-typedef struct {
-  /**
-   * @description    Red X chromaticity coordinate as defined by CIE 1931.
-   */
-  double primary_r_chromaticity_x;
-  /**
-   * @description    Red Y chromaticity coordinate as defined by CIE 1931.
-   */
-  double primary_r_chromaticity_y;
-  /**
-   * @description    Green X chromaticity coordinate as defined by CIE 1931.
-   */
-  double primary_g_chromaticity_x;
-  /**
-   * @description    Green Y chromaticity coordinate as defined by CIE 1931.
-   */
-  double primary_g_chromaticity_y;
-  /**
-   * @description    Blue X chromaticity coordinate as defined by CIE 1931.
-   */
-  double primary_b_chromaticity_x;
-  /**
-   * @description    Blue Y chromaticity coordinate as defined by CIE 1931.
-   */
-  double primary_b_chromaticity_y;
-  /**
-   * @description    White X chromaticity coordinate as defined by CIE 1931.
-   */
-  double white_point_chromaticity_x;
-  /**
-   * @description    White Y chromaticity coordinate as defined by CIE 1931.
-   */
-  double white_point_chromaticity_y;
-  /**
-   * @description    Maximum luminance. Represented in candelas per square meter
-   * (cd/m²).
-   */
-  double luminance_max;
-  /**
-   * @description    Mininum luminance. Represented in candelas per square meter
-   * (cd/m²).
-   */
-  double luminance_min;
-} esplusplayer_matroska_mastering_metadata;
-
-/**
- * @brief   Structure of matroska color information
- */
-typedef struct {
-  /**
-   * @description   The Matrix Coefficients of the video used to derive luma and
-   * chroma values from red, green, and blue color primaries. For clarity, the
-   * value and meanings for MatrixCoefficients are adopted from Table 4 of
-   * ISO/IEC 23001-8:2013/DCOR1.
-   */
-  uint32_t matrix_coefficients;
-  /**
-   * @description   Number of decoded bits per channel. A value of 0 indicates
-   * that the BitsPerChannel is unspecified.
-   */
-  uint32_t bits_per_channel;
-  /**
-   * @description   The amount of pixels to remove in the Cr and Cb channels for
-   * every pixel not removed horizontally.
-   */
-  uint32_t chroma_subsampling_horizontal;
-  /**
-   * @description   The amount of pixels to remove in the Cr and Cb channels for
-   * every pixel not removed vertically.
-   */
-  uint32_t chroma_subsampling_vertical;
-  /**
-   * @description    The amount of pixels to remove in the Cb channel for every
-   * pixel not removed horizontally. This is additive with
-   * chroma_subsampling_horizontal.
-   */
-  uint32_t cb_subsampling_horizontal;
-  /**
-   * @description    The amount of pixels to remove in the Cb channel for every
-   * pixel not removed vertically. This is additive with
-   * chroma_subsampling_vertical.
-   */
-  uint32_t cb_subsampling_vertical;
-  /**
-   * @description    How chroma is subsampled horizontally.
-   */
-  uint32_t chroma_siting_horizontal;
-  /**
-   * @description    How chroma is subsampled vertically.
-   */
-  uint32_t chroma_siting_vertical;
-  /**
-   * @description    Clipping of the color ranges.
-   */
-  uint32_t range;
-  /**
-   * @description    The transfer characteristics of the video. For clarity, the
-   * value and meanings for transfer_characteristics 1-15 are adopted from Table
-   * 3 of ISO/IEC 23001-8:2013/DCOR1. transfer_characteristics 16-18 are
-   * proposed values.
-   */
-  uint32_t transfer_characteristics;
-  /**
-   * @description    The colour primaries of the video. For clarity, the value
-   * and meanings for primaries are adopted from Table 2 of ISO/IEC
-   * 23001-8:2013/DCOR1.
-   */
-  uint32_t primaries;
-  /**
-   * @description    Maximum brightness of a single pixel (Maximum Content Light
-   * Level) in candelas per square meter (cd/m²).
-   */
-  uint32_t max_cll;
-  /**
-   * @description    Maximum brightness of a single full frame (Maximum
-   * Frame-Average Light Level) in candelas per square meter (cd/m²).
-   */
-  uint32_t max_fall;
-  /**
-   * @description    SMPTE 2086 mastering data.
-   */
-  esplusplayer_matroska_mastering_metadata metadata;
-  /**
-   * @description    flag to check if this file is hdr10+ (cd/m²).
-   */
-  uint32_t isHDR10p;
-} esplusplayer_matroska_color;
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif
-
-#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_MATROSKA_COLOR_H__
diff --git a/inc/esplusplayer_capi/state.h b/inc/esplusplayer_capi/state.h
deleted file mode 100644 (file)
index 2c2d1c5..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * @file
- * @brief          State enum.
- * @interfacetype  Platform
- * @privlevel      None-privilege
- * @privilege      None
- * @product        TV, AV, B2B
- * @version        2.0
- * @SDK_Support    N
- * @remark         This is a group of C style state related enum.
- * @see            State enum convertion.
- *
- * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
- * PROPRIETARY/CONFIDENTIAL
- * This software is the confidential and proprietary
- * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
- * not disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into with
- * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
- * suitability of the software, either express or implied, including but not
- * limited to the implied warranties of merchantability, fitness for a
- * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
- * damages suffered by licensee as a result of using, modifying or distributing
- * this software or its derivatives.
- */
-
-#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_STATE_H__
-#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_STATE_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief  Enumerations for es player state.
- */
-typedef enum {
-  ESPLUSPLAYER_STATE_NONE,  /**<Player is created, but not opened*/
-  ESPLUSPLAYER_STATE_IDLE,  /**<Player is opened, but not prepared or player is
-                               stopped*/
-  ESPLUSPLAYER_STATE_READY, /**<Player is ready to play(start)*/
-  ESPLUSPLAYER_STATE_PLAYING, /**<Player is playing media*/
-  ESPLUSPLAYER_STATE_PAUSED,    /**<Player is playing media*/
-  ESPLUSPLAYER_STATE_MAX
-} esplusplayer_state;
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif
-
-#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_STATE_H__
diff --git a/inc/esplusplayer_capi/stream.h b/inc/esplusplayer_capi/stream.h
deleted file mode 100644 (file)
index 902632b..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-/**
- * @file
- * @brief          Stream info related data structures and enums
- * @interfacetype  Platform
- * @privlevel      None-privilege
- * @privilege      None
- * @product        TV, AV, B2B
- * @version        2.0
- * @SDK_Support    N
- * @remark         This is a group of C style track releted data structures and
- *                 enums.
- * @see            All track releated types shared_ptr, boost::any, enum
- *                 classes, std::string, etc.. are converted to this.
- *
- * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
- * PROPRIETARY/CONFIDENTIAL
- * This software is the confidential and proprietary
- * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
- * not disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into with
- * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
- * suitability of the software, either express or implied, including but not
- * limited to the implied warranties of merchantability, fitness for a
- * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
- * damages suffered by licensee as a result of using, modifying or distributing
- * this software or its derivatives.
- */
-
-#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_TRACK_H__
-#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_TRACK_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief  Enumerations for the stream type
- */
-typedef enum {
-  ESPLUSPLAYER_STREAM_TYPE_AUDIO,
-  ESPLUSPLAYER_STREAM_TYPE_VIDEO,
-  ESPLUSPLAYER_STREAM_TYPE_MAX
-} esplusplayer_stream_type;
-
-/**
- * @brief   Enumerations for audio mime type
- */
-typedef enum {
-  ESPLUSPLAYER_AUDIO_MIME_TYPE_UNKNOWN,
-  ESPLUSPLAYER_AUDIO_MIME_TYPE_AAC,
-  ESPLUSPLAYER_AUDIO_MIME_TYPE_MP2,
-  ESPLUSPLAYER_AUDIO_MIME_TYPE_MP3,
-  ESPLUSPLAYER_AUDIO_MIME_TYPE_AC3,
-  ESPLUSPLAYER_AUDIO_MIME_TYPE_EAC3,
-  ESPLUSPLAYER_AUDIO_MIME_TYPE_VORBIS,
-  ESPLUSPLAYER_AUDIO_MIME_TYPE_OPUS,
-  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_S16LE,
-  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_S16BE,
-  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_U16LE,
-  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_U16BE,
-  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_S24LE,
-  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_S24BE,
-  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_U24LE,
-  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_U24BE,
-  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_S32LE,
-  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_S32BE,
-  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_U32LE,
-  ESPLUSPLAYER_AUDIO_MIME_TYPE_PCM_U32BE,
-  ESPLUSPLAYER_AUDIO_MIME_TYPE_G711_MULAW
-} esplusplayer_audio_mime_type;
-
-/**
- * @brief   Enumerations for video mime type
- */
-typedef enum {
-  ESPLUSPLAYER_VIDEO_MIME_TYPE_UNKNOWN,
-  ESPLUSPLAYER_VIDEO_MIME_TYPE_H263,
-  ESPLUSPLAYER_VIDEO_MIME_TYPE_H264,
-  ESPLUSPLAYER_VIDEO_MIME_TYPE_HEVC,
-  ESPLUSPLAYER_VIDEO_MIME_TYPE_MPEG1,
-  ESPLUSPLAYER_VIDEO_MIME_TYPE_MPEG2,
-  ESPLUSPLAYER_VIDEO_MIME_TYPE_MPEG4,
-  ESPLUSPLAYER_VIDEO_MIME_TYPE_VP8,
-  ESPLUSPLAYER_VIDEO_MIME_TYPE_VP9,
-  ESPLUSPLAYER_VIDEO_MIME_TYPE_WMV3,
-  ESPLUSPLAYER_VIDEO_MIME_TYPE_AV1,
-  ESPLUSPLAYER_VIDEO_MIME_TYPE_MJPEG
-} esplusplayer_video_mime_type;
-
-/**
- * @brief   Audio stream information structure
- */
-typedef struct {
-  /**
-   * @description   The audio codec data pointer.
-   */
-  char* codec_data;
-  /**
-   * @description   The audio codec data length.
-   */
-  uint32_t codec_data_length;
-  /**
-   * @description   The audio mime type.
-   */
-  esplusplayer_audio_mime_type mime_type;
-  /**
-   * @description   The audio bitrate value.
-   */
-  uint32_t bitrate;
-  /**
-   * @description   The audio channel number.
-   */
-  uint32_t channels;
-  /**
-   * @description   The audio sample rate value.
-   */
-  uint32_t sample_rate;
-} esplusplayer_audio_stream_info;
-
-/**
- * @brief   Video stream information structure
- */
-typedef struct {
-  /**
-   * @description   The video codec data pointer.
-   */
-  char* codec_data;
-  /**
-   * @description   The video codec data length.
-   */
-  uint32_t codec_data_length;
-  /**
-   * @description   The video mime type.
-   */
-  esplusplayer_video_mime_type mime_type;
-  /**
-   * @description   The width value of the video.
-   */
-  uint32_t width;
-  /**
-   * @description   The height value of the video.
-   */
-  uint32_t height;
-  /**
-   * @description   The max width value of the video.
-   */
-  uint32_t max_width;
-  /**
-   * @description   The max height value of the video.
-   */
-  uint32_t max_height;
-  /**
-   * @description   The numerator value of the video frame rate.
-   */
-  uint32_t framerate_num;
-  /**
-   * @description   The denominator value of the video frame rate.
-   */
-  uint32_t framerate_den;
-} esplusplayer_video_stream_info;
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif
-
-#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_TRACK_H__
diff --git a/inc/esplusplayer_capi/submitdatatype.h b/inc/esplusplayer_capi/submitdatatype.h
deleted file mode 100644 (file)
index acb80ca..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * @file
- * @brief          For submit data type enum.
- * @interfacetype  Platform
- * @privlevel      None-privilege
- * @privilege      None
- * @product        TV, AV, B2B
- * @version        2.0
- * @SDK_Support    N
- * @remark         This is a group of C style submitstatus related enum.
- * @see            SubmitDataType enum conversion.
- *
- * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
- * PROPRIETARY/CONFIDENTIAL
- * This software is the confidential and proprietary
- * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
- * not disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into with
- * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
- * suitability of the software, either express or implied, including but not
- * limited to the implied warranties of merchantability, fitness for a
- * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
- * damages suffered by licensee as a result of using, modifying or distributing
- * this software or its derivatives.
- */
-
-#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_SUBMITDATATYPE_H__
-#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_SUBMITDATATYPE_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief  Enumerations for the type of buffers submitted
- */
-typedef enum {
-  ESPLUSPLAYER_SUBMIT_DATA_TYPE_CLEAN_DATA,
-  ESPLUSPLAYER_SUBMIT_DATA_TYPE_ENCRYPTED_DATA,
-//  ESPLUSPLAYER_SUBMIT_DATA_TYPE_TRUSTZONE_DATA,
-  ESPLUSPLAYER_SUBMIT_DATA_TYPE_MAX,
-} esplusplayer_submit_data_type;
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif
-
-#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_SUBMITDATATYPE_H__
diff --git a/inc/esplusplayer_capi/submitstatus.h b/inc/esplusplayer_capi/submitstatus.h
deleted file mode 100644 (file)
index cc28c4c..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * @file
- * @brief          For submitstatus enum.
- * @interfacetype  Platform
- * @privlevel      None-privilege
- * @privilege      None
- * @product        TV, AV, B2B
- * @version        2.0
- * @SDK_Support    N
- * @remark         This is a group of C style submitstatus related enum.
- * @see            Submitstatus enum convertion.
- *
- * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
- * PROPRIETARY/CONFIDENTIAL
- * This software is the confidential and proprietary
- * information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
- * not disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into with
- * SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
- * suitability of the software, either express or implied, including but not
- * limited to the implied warranties of merchantability, fitness for a
- * particular purpose, or non-infringement. SAMSUNG shall not be liable for any
- * damages suffered by licensee as a result of using, modifying or distributing
- * this software or its derivatives.
- */
-
-#ifndef __PLUSPLAYER_ESPLUSPLAYER_CAPI_SUBMITSTATUS_H__
-#define __PLUSPLAYER_ESPLUSPLAYER_CAPI_SUBMITSTATUS_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief  Enumerations for the buffer status
- */
-typedef enum {
-  ESPLUSPLAYER_SUBMIT_STATUS_NOT_PREPARED,
-  ESPLUSPLAYER_SUBMIT_STATUS_INVALID_PACKET,
-  ESPLUSPLAYER_SUBMIT_STATUS_OUT_OF_MEMORY,
-  ESPLUSPLAYER_SUBMIT_STATUS_FULL,
-  ESPLUSPLAYER_SUBMIT_STATUS_SUCCESS
-} esplusplayer_submit_status;
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif
-
-#endif  // __PLUSPLAYER_ESPLUSPLAYER_CAPI_SUBMITSTATUS_H__
diff --git a/meson.build b/meson.build
deleted file mode 100644 (file)
index cc81e60..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-project('espp-service', 'c',
-  version: run_command('get_version.sh', check: true).stdout().strip(),
-  default_options : ['warning_level=2',
-                     'buildtype=debugoptimized',
-                     'werror=false'])
-
-espp_service_version = meson.project_version()
-version_arr = espp_service_version.split('.')
-version_major = version_arr[0]
-
-pkgconfig = import('pkgconfig')
-
-add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
-add_project_arguments('-Wno-unused-parameter', language: 'c')
-
-conf_data = configuration_data()
-
-configinc = include_directories('.')
-
-common_deps = []
-
-libdir_path = '$ORIGIN/../lib'
-message('libdir_path[' + libdir_path + ']')
-
-message('================ common options ================')
-
-conf_data.set('ESPP_SERVICE_VERSION', espp_service_version)
-conf_data.set('ESPP_SERVICE_SOCK_PATH', get_option('sock-path'))
-
-if get_option('dlog')
-  message('dlog option is enabled, set USE_DLOG')
-  conf_data.set('USE_DLOG', true)
-  dlog_dep = dependency('dlog', required: true)
-  common_deps += [dlog_dep]
-endif
-
-if get_option('service-app')
-  message('service-app option is enabled, set USE_SERVICE_APP')
-  conf_data.set('USE_SERVICE_APP', true)
-  app_common_dep = dependency('capi-appfw-application', required: true)
-  common_deps += [app_common_dep]
-endif
-
-message('================================================')
-
-glib_dep = dependency('glib-2.0', required: true)
-common_deps += [glib_dep]
-
-json_dep = dependency('json-glib-1.0', required: true)
-common_deps += [json_dep]
-
-subdir('src')
-
-configure_file(output: 'config.h', configuration: conf_data)
diff --git a/meson_options.txt b/meson_options.txt
deleted file mode 100644 (file)
index 42c2cc3..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#common
-option('sock-path', type: 'string', value: '/tmp/espp_service.sock', description: 'ESPP service socket path')
-option('dlog', type: 'boolean', value: true, description: 'Use dlog')
-
-#daemon
-option('tizen-60', type: 'boolean', value: false, description: 'For tizen 6.0')
-option('_bindir', type: 'string', value: '/usr/bin', yield: true, description: 'ESPP service daemon install dir')
-option('service-app', type: 'boolean', value: true, yield: true, description: 'ESPP service daemon is launched as Tizen service app')
diff --git a/packaging/espp-service.manifest b/packaging/espp-service.manifest
deleted file mode 100644 (file)
index 2a0cec5..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<manifest>
-  <request>
-    <domain name="_"/>
-  </request>
-</manifest>
diff --git a/packaging/espp-service.service b/packaging/espp-service.service
deleted file mode 100644 (file)
index e5995d0..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-[Unit]
-Description=Start the ESPP service
-
-[Service]
-ExecStart=/usr/bin/espp-service -s
-Restart=always
-RestartSec=0
-MemoryLimit=50M
-User=multimedia_fw
-Group=multimedia_fw
-SmackProcessLabel=System
-SecureBits=keep-caps
-Capabilities=cap_lease=i
-EnvironmentFile=/run/xdg-root-env
-
diff --git a/packaging/espp-service.spec b/packaging/espp-service.spec
deleted file mode 100644 (file)
index 6413036..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-%if 0%{?debug:1}
-%define debug_package %{nil}
-%define __debug_install_post %{nil}
-%endif
-
-Name:       espp-service
-Summary:    ESPP service package which contains client lib. and daemon binary
-Version:    0.3.22
-Release:    0
-Group:      Multimedia/Libraries
-License:    Apache-2.0
-Source0:    %{name}-%{version}.tar.gz
-Source1:    %{name}.manifest
-Source2:    %{name}.service
-Requires(post): /sbin/ldconfig
-Requires(postun): /sbin/ldconfig
-BuildRequires: meson
-BuildRequires: pkgconfig(capi-base-common)
-BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: pkgconfig(gio-2.0)
-BuildRequires: pkgconfig(json-glib-1.0)
-BuildRequires: pkgconfig(esplusplayer)
-%if "%{use_tizen_60}" != "1"
-BuildRequires: pkgconfig(libtbm)
-BuildRequires: pkgconfig(capi-media-image-util)
-%endif
-%if "%{use_service_app}" == "1"
-BuildRequires: pkgconfig(capi-appfw-service-application)
-BuildRequires: pkgconfig(capi-appfw-application)
-%endif
-
-%description
-ESPP service package contains daemon binary which uses esplusplayer to render audio/video buffers and it's client library
-
-%package client
-Summary:    ESPP service client library
-Group:      Multimedia/Libraries
-
-%description client
-ESPP service client library used by applications that request to render audio/video buffers to ESPP service daemon
-
-%package client-devel
-Summary:    ESPP service client development header and library
-Group:      Development/Libraries
-Requires:   %{name} = %{version}-%{release}
-
-%description client-devel
-ESPP service client development header and library
-
-%prep
-%setup -q -n %{name}-%{version}
-cp %{SOURCE1} %{SOURCE2} .
-
-%define _bin_dir %{_bindir}
-
-%build
-meson setup --auto-features=disabled \
-  --prefix=/usr \
-  --libdir=%{_libdir} \
-  --datadir=%{_datadir} \
-%if "%{use_tizen_60}" == "1"
-  -Dtizen-60=true \
-%else
-  -Dtizen-60=false \
-%endif
-  -Dsock-path=/tmp/espp_service.sock \
-%if "%{use_service_app}" == "1"
-  -Dservice-app=true \
-%else
-  -Dservice-app=false \
-%endif
-  -D_bindir=%{_bin_dir} \
-%if "%{asan}" != "1"
-%ifnarch x86_64
-  --werror \
-%endif
-%endif
-  build
-
-ninja -C build
-
-%install
-rm -rf %{buildroot}
-export DESTDIR=%{buildroot}
-ninja -C build install
-
-mkdir -p %{buildroot}%{_unitdir}/
-install -m0644 %{SOURCE2} %{buildroot}%{_unitdir}/
-
-%post -p /sbin/ldconfig
-%postun -p /sbin/ldconfig
-
-%files
-%manifest %{name}.manifest
-%defattr(-,root,root,-)
-%{_bin_dir}/espp-service
-%{_unitdir}/espp-service.service
-%license LICENSE.APLv2
-
-%files client
-%manifest %{name}.manifest
-%defattr(-,root,root,-)
-%{_libdir}/*.so*
-%exclude %{_libdir}/debug/*
-%license LICENSE.APLv2
-
-%files client-devel
-%manifest %{name}.manifest
-%{_libdir}/*.so
-%{_libdir}/pkgconfig/espp-service*.pc
-%{_includedir}/*.h
-
diff --git a/project_def.prop b/project_def.prop
deleted file mode 100644 (file)
index 72ca044..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# Project Name
-APPNAME = espp-service
-
-# Project Type
-type = app
-
-# Project Profile
-profile = tizen-8.0
-
-# Sources
-USER_SRCS = ./src/daemon/*.c ./src/common/*.c
-
-# User Defines
-USER_DEFS = USE_DLOG USE_SERVICE_APP ESPP_SERVICE_VERSION="0.3.21"
-
-# User Includes
-USER_INC_DIRS = ./src/daemon ./src/common ./inc ./inc/esplusplayer_capi
-
-# User Libraries
-USER_LIBS = esplusplayer
-
-# Linker Flags
-USER_LFLAGS = -Xlinker --allow-shlib-undefined -Xlinker -rpath='/usr/lib'
-
-# User Library Path
-USER_LIB_DIRS = ./libs
diff --git a/src/client/build_def.prop b/src/client/build_def.prop
deleted file mode 100644 (file)
index 58ec40b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-PREBUILD_COMMAND = sh update_version.sh
-PREBUILD_DESC =
-POSTBUILD_COMMAND =
-POSTBUILD_DESC =
diff --git a/src/client/espp_service_client.c b/src/client/espp_service_client.c
deleted file mode 100644 (file)
index 1890c1b..0000000
+++ /dev/null
@@ -1,796 +0,0 @@
-/*
- * Copyright (c) 2023 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 "espp_service_client.h"
-#include "espp_service_client_priv.h"
-
-int espp_client_set_ready_to_prepare_cb(espp_h espp, espp_ready_to_prepare_cb callback, void *user_data)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-       g_autoptr(GMutexLocker) cb_locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-       RET_VAL_IF(!callback, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "callback is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_set_callback(_espp, ESPP_SERVICE_EVENT_CB_READY_TO_PREPARE, (void *)callback, user_data) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       cb_locker = g_mutex_locker_new(&_espp->cb_mutex);
-       LOG_WARNING_IF_CALLBACK_EXISTS(_espp->ready_to_prepare_cb);
-
-       _espp->ready_to_prepare_cb.callback = callback;
-       _espp->ready_to_prepare_cb.user_data = user_data;
-
-       LOG_INFO("espp[%p] callback[%p] user_data[%p]", espp, callback, user_data);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_set_prepare_async_done_cb(espp_h espp, espp_prepare_async_done_cb callback, void *user_data)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-       g_autoptr(GMutexLocker) cb_locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-       RET_VAL_IF(!callback, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "callback is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_set_callback(_espp, ESPP_SERVICE_EVENT_CB_PREPARE_ASYNC_DONE, (void *)callback, user_data) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       cb_locker = g_mutex_locker_new(&_espp->cb_mutex);
-       LOG_WARNING_IF_CALLBACK_EXISTS(_espp->prepare_async_done_cb);
-
-       _espp->prepare_async_done_cb.callback = callback;
-       _espp->prepare_async_done_cb.user_data = user_data;
-
-       LOG_INFO("espp[%p] callback[%p] user_data[%p]", espp, callback, user_data);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_set_ready_to_seek_cb(espp_h espp, espp_ready_to_seek_cb callback, void *user_data)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-       g_autoptr(GMutexLocker) cb_locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-       RET_VAL_IF(!callback, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "callback is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_set_callback(_espp, ESPP_SERVICE_EVENT_CB_READY_TO_SEEK, (void *)callback, user_data) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       cb_locker = g_mutex_locker_new(&_espp->cb_mutex);
-       LOG_WARNING_IF_CALLBACK_EXISTS(_espp->ready_to_seek_cb);
-
-       _espp->ready_to_seek_cb.callback = callback;
-       _espp->ready_to_seek_cb.user_data = user_data;
-
-       LOG_INFO("espp[%p] callback[%p] user_data[%p]", espp, callback, user_data);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_set_seek_done_cb(espp_h espp, espp_seek_done_cb callback, void *user_data)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-       g_autoptr(GMutexLocker) cb_locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-       RET_VAL_IF(!callback, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "callback is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_set_callback(_espp, ESPP_SERVICE_EVENT_CB_SEEK_DONE, (void *)callback, user_data) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       cb_locker = g_mutex_locker_new(&_espp->cb_mutex);
-       LOG_WARNING_IF_CALLBACK_EXISTS(_espp->seek_done_cb);
-
-       _espp->seek_done_cb.callback = callback;
-       _espp->seek_done_cb.user_data = user_data;
-
-       LOG_INFO("espp[%p] callback[%p] user_data[%p]", espp, callback, user_data);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_set_eos_cb(espp_h espp, espp_eos_cb callback, void *user_data)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-       g_autoptr(GMutexLocker) cb_locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-       RET_VAL_IF(!callback, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "callback is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_set_callback(_espp, ESPP_SERVICE_EVENT_CB_EOS, (void *)callback, user_data) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       cb_locker = g_mutex_locker_new(&_espp->cb_mutex);
-       LOG_WARNING_IF_CALLBACK_EXISTS(_espp->eos_cb);
-
-       _espp->eos_cb.callback = callback;
-       _espp->eos_cb.user_data = user_data;
-
-       LOG_INFO("espp[%p] callback[%p] user_data[%p]", espp, callback, user_data);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_set_buffer_status_cb(espp_h espp, espp_buffer_status_cb callback, void *user_data)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-       g_autoptr(GMutexLocker) cb_locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-       RET_VAL_IF(!callback, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "callback is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_set_callback(_espp, ESPP_SERVICE_EVENT_CB_BUFFER_STATUS, (void *)callback, user_data) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       cb_locker = g_mutex_locker_new(&_espp->cb_mutex);
-       LOG_WARNING_IF_CALLBACK_EXISTS(_espp->buffer_status_cb);
-
-       _espp->buffer_status_cb.callback = callback;
-       _espp->buffer_status_cb.user_data = user_data;
-
-       LOG_INFO("espp[%p] callback[%p] user_data[%p]", espp, callback, user_data);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_set_resource_conflicted_cb(espp_h espp, espp_resource_conflicted_cb callback, void *user_data)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-       g_autoptr(GMutexLocker) cb_locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-       RET_VAL_IF(!callback, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "callback is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_set_callback(_espp, ESPP_SERVICE_EVENT_CB_RESOURCE_CONFLICTED, (void *)callback, user_data) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       cb_locker = g_mutex_locker_new(&_espp->cb_mutex);
-       LOG_WARNING_IF_CALLBACK_EXISTS(_espp->resource_conflicted_cb);
-
-       _espp->resource_conflicted_cb.callback = callback;
-       _espp->resource_conflicted_cb.user_data = user_data;
-
-       LOG_INFO("espp[%p] callback[%p] user_data[%p]", espp, callback, user_data);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_set_error_cb(espp_h espp, espp_error_cb callback, void *user_data)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-       g_autoptr(GMutexLocker) cb_locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-       RET_VAL_IF(!callback, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "callback is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_set_callback(_espp, ESPP_SERVICE_EVENT_CB_ERROR, (void *)callback, user_data) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       cb_locker = g_mutex_locker_new(&_espp->cb_mutex);
-       LOG_WARNING_IF_CALLBACK_EXISTS(_espp->error_cb);
-
-       _espp->error_cb.callback = callback;
-       _espp->error_cb.user_data = user_data;
-
-       LOG_INFO("espp[%p] callback[%p] user_data[%p]", espp, callback, user_data);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-static void __snapshot_destroy_cb(gpointer data)
-{
-       espp_callback_s *cb_data = (espp_callback_s *)data;
-       LOG_DEBUG("data[%p, calllback:%p, user_data:%p]", data, cb_data->callback, cb_data->user_data);
-       g_free(data);
-}
-
-int espp_client_create(espp_h *espp)
-{
-       espp_s *_espp;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       LOG_WARNING("version[%s]", ESPP_SVC_VERSION);
-
-       _espp = g_new0(espp_s, 1);
-       _espp->fd = -1;
-       _espp->event_fd = -1;
-
-       g_mutex_init(&_espp->mutex);
-       g_mutex_init(&_espp->cb_mutex);
-
-       _espp->snapshot_cbs = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, __snapshot_destroy_cb);
-
-       if (espp_service_client_socket_request_create(_espp) != 0)
-               goto error;
-
-       if (espp_service_client_socket_request_init_event(_espp) != 0) {
-               espp_service_client_socket_request_destroy(_espp);
-               goto error;
-       }
-
-       *espp = _espp;
-
-       LOG_INFO("espp[%p] is created", *espp);
-
-       return ESPP_CLIENT_ERROR_NONE;
-
-error:
-       g_hash_table_destroy(_espp->snapshot_cbs);
-       g_mutex_clear(&_espp->mutex);
-       g_mutex_clear(&_espp->cb_mutex);
-       g_free(_espp);
-       return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-}
-
-int espp_client_destroy(espp_h espp)
-{
-       espp_s *_espp = (espp_s *)espp;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       g_mutex_lock(&_espp->mutex);
-
-       if (espp_service_client_socket_request_deinit_event(_espp) != 0) {
-               g_mutex_unlock(&_espp->mutex);
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-       }
-
-       if (espp_service_client_socket_request_destroy(_espp) != 0) {
-               g_mutex_unlock(&_espp->mutex);
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-       }
-
-       if (_espp->snapshot_cbs) {
-               g_hash_table_destroy(_espp->snapshot_cbs);
-               _espp->snapshot_cbs = NULL;
-       }
-
-       g_mutex_unlock(&_espp->mutex);
-       g_mutex_clear(&_espp->mutex);
-       g_mutex_clear(&_espp->cb_mutex);
-
-       LOG_INFO("espp[%p] is destroyed", espp);
-
-       g_free(espp);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_open(espp_h espp)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_open(_espp) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] is opened", espp);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_close(espp_h espp)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_close(_espp) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] is close", espp);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_start(espp_h espp)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_start(_espp) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] is started", espp);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_stop(espp_h espp)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_stop(_espp) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] is stopped", espp);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_pause(espp_h espp)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_pause(_espp) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] is paused", espp);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_resume(espp_h espp)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_resume(_espp) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] is resumed", espp);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_prepare_async(espp_h espp)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_prepare_async(_espp) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p]", espp);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_seek(espp_h espp, uint64_t time_ms)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_seek(_espp, time_ms) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] time_ms[%" PRIu64 "]", espp, time_ms);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_get_state(espp_h espp, espp_state_e *state)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-       RET_VAL_IF(!state, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "state is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_get_state(_espp, state) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] state[%d]", espp, *state);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_get_playing_time(espp_h espp, uint64_t *time_ms)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-       RET_VAL_IF(!time_ms, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "time_ms is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_get_playing_time(_espp, time_ms) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] time_ms[%" PRIu64 "]", espp, *time_ms);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_set_audio_stream_info(espp_h espp, espp_audio_stream_info_s *info)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_set_audio_stream_info(_espp, info) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p]", espp);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_set_video_stream_info(espp_h espp, espp_video_stream_info_s *info)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_set_video_stream_info(_espp, info) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p]", espp);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_set_playback_rate(espp_h espp, double rate, bool mute_audio)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_set_playback_rate(_espp, rate, mute_audio) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] rate[%f] mute_audio[%d]", espp, rate, mute_audio);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_set_display_surface_id(espp_h espp, espp_display_type_e type, unsigned int surface_id, int x, int y, int w, int h)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_set_display_surface_id(_espp, type, surface_id, x, y, w, h) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] type[%d] surface_id[%u]", espp, type, surface_id);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_set_display_mode(espp_h espp, espp_display_mode_e mode)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_set_display_mode(_espp, mode) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] mode[%d]", espp, mode);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_set_display_roi(espp_h espp, int x, int y, int w, int h)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_set_display_roi(_espp, x, y, w, h) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] x[%d] y[%d] w[%d] h[%d]", espp, x, y, w, h);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_set_display_visible(espp_h espp, bool visible)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_set_display_visible(_espp, visible) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] visible[%d]", espp, visible);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_set_display_rotation(espp_h espp, espp_display_rotation_angle_e angle)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_set_display_rotation(_espp, angle) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] angle[%d]", espp, angle);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_set_audio_mute(espp_h espp, bool mute)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_set_audio_mute(_espp, mute) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] mute[%d]", espp, mute);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_set_audio_volume(espp_h espp, int volume)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_set_audio_volume(_espp, volume) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] volume[%d]", espp, volume);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_get_audio_volume(espp_h espp, int *volume)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-       RET_VAL_IF(!volume, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "volume is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_get_audio_volume(_espp, volume) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] volume[%d]", espp, *volume);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_submit_packet(espp_h espp, espp_packet_s *packet, espp_submit_error_e *error)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-       RET_VAL_IF(!packet, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "packet is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_submit_packet(_espp, packet, error) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_DEBUG("espp[%p], packet[%p, %s]", espp, packet, packet->type == ESPP_STREAM_TYPE_AUDIO ? "AUDIO" : "VIDEO");
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_submit_eos_packet(espp_h espp, espp_stream_type_e stream_type, espp_submit_error_e *error)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_submit_eos_packet(_espp, stream_type, error) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] stream_type[%d]", espp, stream_type);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_set_buffer_size(espp_h espp, espp_buffer_size_type_e size_type, uint64_t size)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_set_buffer_size(_espp, size_type, size) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] size_type[%d] size[%" PRIu64 "]", espp, size_type, size);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_set_low_latency_mode(espp_h espp, espp_low_latency_mode_e mode)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_set_low_latency_mode(_espp, mode) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] mode[0x%x]", espp, mode);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_set_decoded_video_frame_buffer_type(espp_h espp, espp_decoded_video_frame_buffer_type_e type)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_set_decoded_video_frame_buffer_type(_espp, type) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] type[%d]", espp, type);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_take_snapshot(espp_h espp, espp_snapshot_cb callback, void *user_data)
-{
-       espp_s *_espp = (espp_s *)espp;
-       espp_callback_s *cb_data;
-       g_autoptr(GMutexLocker) locker = NULL;
-       gint *id;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-       RET_VAL_IF(!callback, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "callback is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       cb_data = g_new0(espp_callback_s, 1);
-       cb_data->callback = callback;
-       cb_data->user_data = user_data;
-
-       id = g_new(gint, 1);
-       *id = ++_espp->snapshot_cb_id;
-       if (!g_hash_table_insert(_espp->snapshot_cbs, id, (gpointer)cb_data)) {
-               LOG_ERROR("should not be reached here, snapshot_cb_id[%d] already exist", _espp->snapshot_cb_id);
-               /* Due to the imple. of g_hash_table_insert() in this case, we need to alloc again for id. */
-               id = g_new(gint, 1);
-               *id = _espp->snapshot_cb_id--;
-               g_hash_table_remove(_espp->snapshot_cbs, id);
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-       }
-
-       if (espp_service_client_socket_request_take_snapshot(_espp, _espp->snapshot_cb_id) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] snapshot_cb_id[%d] callback[%p] user_data[%p]", espp, _espp->snapshot_cb_id, callback, user_data);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
-
-int espp_client_set_render_time_offset(espp_h espp, espp_stream_type_e stream_type, int64_t time_offset_ms)
-{
-       espp_s *_espp = (espp_s *)espp;
-       g_autoptr(GMutexLocker) locker = NULL;
-
-       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
-
-       locker = g_mutex_locker_new(&_espp->mutex);
-
-       if (espp_service_client_socket_request_set_render_time_offset(_espp, stream_type, time_offset_ms) != 0)
-               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
-
-       LOG_INFO("espp[%p] stream_type[%d] time_offset_ms[%" PRId64 "]", espp, stream_type, time_offset_ms);
-
-       return ESPP_CLIENT_ERROR_NONE;
-}
diff --git a/src/client/espp_service_client.h b/src/client/espp_service_client.h
deleted file mode 100644 (file)
index 29ff8e1..0000000
+++ /dev/null
@@ -1,917 +0,0 @@
-/*
- * Copyright (c) 2023 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 __ESPP_SERVICE_CLIENT_H__
-#define __ESPP_SERVICE_CLIENT_H__
-
-#include <tizen.h>
-#include <stdint.h>
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/**
- * @brief ESPP service client handle type.
- */
-typedef void *espp_h;
-
-/**
- * @brief Enumeration for ESPP service client error.
- */
-typedef enum {
-       ESPP_CLIENT_ERROR_NONE = TIZEN_ERROR_NONE,                              /**< Successful */
-       ESPP_CLIENT_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,    /**< Invalid parameter */
-       ESPP_CLIENT_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION,    /**< Invalid operation */
-} espp_client_error_e;
-
-/**
- * @brief  Enumerations for the state.
- */
-typedef enum {
-  ESPP_STATE_NONE,    /**< The handle is created, but not opened */
-  ESPP_STATE_IDLE,    /**< The handle is open, but not prepared or stopped */
-  ESPP_STATE_READY,   /**< The handle is ready to play(start) */
-  ESPP_STATE_PLAYING, /**< The handle is playing */
-  ESPP_STATE_PAUSED,  /**< The handle is paused */
-} espp_state_e;
-
-/**
- * @brief  Enumerations for the stream type
- */
-typedef enum {
-       ESPP_STREAM_TYPE_AUDIO,     /**< Audio stream type */
-       ESPP_STREAM_TYPE_VIDEO,     /**< Video stream type */
-} espp_stream_type_e;
-
-/**
- * @brief Enumerations for audio mime type
- */
-typedef enum {
-       ESPP_AUDIO_MIME_TYPE_UNKNOWN,    /**< Unknown */
-       ESPP_AUDIO_MIME_TYPE_AAC,        /**< AAC */
-       ESPP_AUDIO_MIME_TYPE_MP2,        /**< MP2 */
-       ESPP_AUDIO_MIME_TYPE_MP3,        /**< MP3 */
-       ESPP_AUDIO_MIME_TYPE_AC3,        /**< AC3 */
-       ESPP_AUDIO_MIME_TYPE_EAC3,       /**< EAC3 */
-       ESPP_AUDIO_MIME_TYPE_VORBIS,     /**< VORBIS */
-       ESPP_AUDIO_MIME_TYPE_OPUS,       /**< OPUS */
-       ESPP_AUDIO_MIME_TYPE_PCM_S16LE,  /**< PCM s16le */
-       ESPP_AUDIO_MIME_TYPE_PCM_S16BE,  /**< PCM s16be */
-       ESPP_AUDIO_MIME_TYPE_PCM_U16LE,  /**< PCM u16le */
-       ESPP_AUDIO_MIME_TYPE_PCM_U16BE,  /**< PCM u16be */
-       ESPP_AUDIO_MIME_TYPE_PCM_S24LE,  /**< PCM s24le */
-       ESPP_AUDIO_MIME_TYPE_PCM_S24BE,  /**< PCM s24be */
-       ESPP_AUDIO_MIME_TYPE_PCM_U24LE,  /**< PCM u24le */
-       ESPP_AUDIO_MIME_TYPE_PCM_U24BE,  /**< PCM u24be */
-       ESPP_AUDIO_MIME_TYPE_PCM_S32LE,  /**< PCM s32le */
-       ESPP_AUDIO_MIME_TYPE_PCM_S32BE,  /**< PCM s32be */
-       ESPP_AUDIO_MIME_TYPE_PCM_U32LE,  /**< PCM u32le */
-       ESPP_AUDIO_MIME_TYPE_PCM_U32BE,  /**< PCM u32be */
-       ESPP_AUDIO_MIME_TYPE_G711_MULAW  /**< G711 mulaw */
-} espp_audio_mime_type_e;
-
-/**
- * @brief Enumerations for video mime type
- */
-typedef enum {
-       ESPP_VIDEO_MIME_TYPE_UNKNOWN,   /**< Unknown */
-       ESPP_VIDEO_MIME_TYPE_H263,      /**< H263 */
-       ESPP_VIDEO_MIME_TYPE_H264,      /**< H264 */
-       ESPP_VIDEO_MIME_TYPE_HEVC,      /**< HEVC */
-       ESPP_VIDEO_MIME_TYPE_MPEG1,     /**< MPEG1 */
-       ESPP_VIDEO_MIME_TYPE_MPEG2,     /**< MPEG2 */
-       ESPP_VIDEO_MIME_TYPE_MPEG4,     /**< MPEG4 */
-       ESPP_VIDEO_MIME_TYPE_VP8,       /**< VP8 */
-       ESPP_VIDEO_MIME_TYPE_VP9,       /**< VP9 */
-       ESPP_VIDEO_MIME_TYPE_WMV3,      /**< WMV3 */
-       ESPP_VIDEO_MIME_TYPE_AV1,       /**< AV1 */
-       ESPP_VIDEO_MIME_TYPE_MJPEG      /**< MJPEG */
-} espp_video_mime_type_e;
-
-/**
- * @brief Enumerations for the display type
- */
-typedef enum {
-       ESPP_DISPLAY_TYPE_NONE,    /**< None */
-       ESPP_DISPLAY_TYPE_OVERLAY, /**< Overlay */
-       ESPP_DISPLAY_TYPE_EVAS,    /**< Evas */
-       ESPP_DISPLAY_TYPE_MIXER,   /**< Mixer */
-} espp_display_type_e;
-
-/**
- * @brief Enumerations for the display mode
- */
-typedef enum {
-       ESPP_DISPLAY_MODE_LETTER_BOX,       /**< Letter box */
-       ESPP_DISPLAY_MODE_ORIGIN_SIZE,      /**< Origin size */
-       ESPP_DISPLAY_MODE_FULL_SCREEN,      /**< Full screen */
-       ESPP_DISPLAY_MODE_CROPPED_FULL,     /**< Cropped full */
-       ESPP_DISPLAY_MODE_ORIGIN_OR_LETTER, /**< Origin size or letter box */
-       ESPP_DISPLAY_MODE_DST_ROI,          /**< Destination RoI */
-} espp_display_mode_e;
-
-/**
- * @brief  Enumerations for the display rotation angle
- */
-typedef enum {
-       ESPP_DISPLAY_ROTATION_ANGLE_0,      /**< Rotation angle 0 */
-       ESPP_DISPLAY_ROTATION_ANGLE_90,     /**< Rotation angle 90 */
-       ESPP_DISPLAY_ROTATION_ANGLE_180,    /**< Rotation angle 180 */
-       ESPP_DISPLAY_ROTATION_ANGLE_270,    /**< Rotation angle 270 */
-} espp_display_rotation_angle_e;
-
-/**
- * @brief Enumerations for decoded video buffer type
- */
-typedef enum {
-       ESPP_DECODED_VIDEO_FRAME_BUFFER_TYPE_NONE,            /**< None */
-       ESPP_DECODED_VIDEO_FRAME_BUFFER_TYPE_MANUAL_COPY = 4, /**< Manual copy */
-} espp_decoded_video_frame_buffer_type_e;
-
-/**
- * @brief Enumerations for the buffer status
- */
-typedef enum {
-       ESPP_BUFFER_STATUS_UNDERRUN,   /**< Underrun */
-       ESPP_BUFFER_STATUS_OVERRUN,    /**< Overrun */
-} espp_buffer_status_e;
-
-/**
- * @brief  Enumerations for buffer size type
- */
-typedef enum {
-       ESPP_BUFFER_SIZE_TYPE_AUDIO_MAX_TIME,            /**< The maximum amount of data for audio (in ms) */
-       ESPP_BUFFER_SIZE_TYPE_VIDEO_MAX_TIME,            /**< The maximum amount of data for video (in ms) */
-       ESPP_BUFFER_SIZE_TYPE_AUDIO_MIN_TIME_THRESHOLD,  /**< Emit underrun when queued bytes drops below the percent of the audio max time (in %) */
-       ESPP_BUFFER_SIZE_TYPE_VIDEO_MIN_TIME_THRESHOLD,  /**< Emit underrun when queued bytes drops below the percent of the video max time (in %) */
-       ESPP_BUFFER_SIZE_TYPE_AUDIO_MAX_BYTE,            /**< The maximum amount of data for audio (in bytes) */
-       ESPP_BUFFER_SIZE_TYPE_VIDEO_MAX_BYTE,            /**< The maximum amount of data for video (in bytes) */
-       ESPP_BUFFER_SIZE_TYPE_AUDIO_MIN_BYTE_THRESHOLD,  /**< Emit underrun when queued bytes drops below the percent of the audio max bytes size (in %) */
-       ESPP_BUFFER_SIZE_TYPE_VIDEO_MIN_BYTE_THRESHOLD,  /**< Emit underrun when queued bytes drops below the percent of the video max bytes size (in %) */
-} espp_buffer_size_type_e;
-
-/**
- * @brief Enumerations for the submit error
- */
-typedef enum {
-       ESPP_SUBMIT_ERROR_NOT_PREPARED,    /**< Not prepared */
-       ESPP_SUBMIT_ERROR_INVALID_PACKET,  /**< Invalid packet */
-       ESPP_SUBMIT_ERROR_OUT_OF_MEMORY,   /**< Out of memory */
-       ESPP_SUBMIT_ERROR_FULL,            /**< Full */
-} espp_submit_error_e;
-
-/**
- * @brief Enumerations for low latency mode
- */
-typedef enum {
-       ESPP_LOW_LATENCY_MODE_NONE                 = 0x0000, /**< None */
-       ESPP_LOW_LATENCY_MODE_AUDIO                = 0x0001, /**< For audio fast decoding/rendering */
-       ESPP_LOW_LATENCY_MODE_VIDEO                = 0x0010, /**< For video fast decoding/rendering. Video stream should be composed only of P and I frames. */
-       ESPP_LOW_LATENCY_MODE_VIDEO_DISTORTION_CONCEALMENT = /**< For video fast decoding/rendering and video distortion concealment. Video stream should be composed only of P and I frames. */
-               ESPP_LOW_LATENCY_MODE_VIDEO | 0x0020,
-       ESPP_LOW_LATENCY_MODE_DISABLE_SYNC         = 0x0100, /**< To disable clock sync and a/v sync when rendering. It includes #ESPP_LOW_LATENCY_MODE_DISABLE_PREROLL. */
-       ESPP_LOW_LATENCY_MODE_DISABLE_PREROLL      = 0x0200, /**< To disable preroll which does not wait for the first buffer when state is changed to #ESPP_STATE_READY from #ESPP_STATE_IDLE. */
-       ESPP_LOW_LATENCY_MODE_ENABLE_GAME_MODE =             /**< To set game mode for the minimum latency. Video stream should be composed only of P and I frames. */
-               ESPP_LOW_LATENCY_MODE_AUDIO |
-               ESPP_LOW_LATENCY_MODE_VIDEO | 0x2000,
-       ESPP_LOW_LATENCY_MODE_ENABLE_GAME_MODE_WITH_FIXED_RESOLUTION = /**< To set game mode for latency. Video stream should be composed only of P and I frames. Video stream must use fixed resolution. */
-               ESPP_LOW_LATENCY_MODE_ENABLE_GAME_MODE | 0x4000,
-} espp_low_latency_mode_e;
-
-/**
- * @brief Audio stream information structure
- */
-typedef struct {
-       char *codec_data;
-       uint32_t codec_data_length;
-       espp_audio_mime_type_e mime_type;
-       uint32_t bitrate;
-       uint32_t channels;
-       uint32_t sample_rate;
-} espp_audio_stream_info_s;
-
-/**
- * @brief Video stream information structure
- */
-typedef struct {
-       char *codec_data;
-       uint32_t codec_data_length;
-       espp_video_mime_type_e mime_type;
-       uint32_t width;
-       uint32_t height;
-       uint32_t max_width;
-       uint32_t max_height;
-       uint32_t framerate_num;
-       uint32_t framerate_den;
-} espp_video_stream_info_s;
-
-/**
- * @brief ESPP packet structure
- */
-typedef struct {
-       espp_stream_type_e type;
-       char *buffer;
-       uint32_t buffer_size;
-       uint64_t pts;
-       uint64_t duration;
-       void *matroska_color_info; /* FIXME: add matroska_color structure if needed */
-       uint32_t hdr10p_metadata_size;
-       char *hdr10p_metadata;
-} espp_packet_s;
-
-/**
- * @brief Called when when the ESPP service client handle is prepared to receive ESPP packets after calling espp_client_prepare_async().
- * @param[in] stream_type  The stream type
- * @param[in] user_data    The user data passed from the callback registration function
- * @see espp_client_set_ready_to_prepare_cb()
- * @see espp_client_submit_packet()
- */
-typedef void (*espp_ready_to_prepare_cb)(espp_stream_type_e stream_type, void *user_data);
-
-/**
- * @brief Called when the ESPP service client handle is prepared to be started.
- * @param[in] result       The result (@c true = success, @c false = failure)
- * @param[in] user_data    The user data passed from the callback registration function
- * @see espp_client_set_prepare_async_done_cb()
- * @see espp_client_submit_packet()
- */
-typedef void (*espp_prepare_async_done_cb)(bool result, void *user_data);
-
-/**
- * @brief Called when the ESPP service client handle is prepared to receive ESPP packets after calling espp_client_seek().
- * @param[in] stream_type  The stream type
- * @param[in] time_ms      The seek time in milliseconds
- * @param[in] user_data    The user data passed from the callback registration function
- * @see espp_client_set_ready_to_seek_cb()
- * @see espp_client_seek()
- * @see espp_client_submit_packet()
- */
-typedef void (*espp_ready_to_seek_cb)(espp_stream_type_e stream_type, uint64_t time_ms, void *user_data);
-
-/**
- * @brief Called when the seek operation of the ESPP service client handle has been finished.
- * @param[in] user_data    The user data passed from the callback registration function
- * @see espp_client_set_seek_done_cb()
- * @see espp_client_seek()
- * @see espp_client_submit_packet()
- */
-typedef void (*espp_seek_done_cb)(void *user_data);
-
-/**
- * @brief Called when the ESPP service client handle has reached the end of stream.
- * @param[in] user_data    The user data passed from the callback registration function
- * @see espp_client_set_eos_cb()
- */
-typedef void (*espp_eos_cb)(void *user_data);
-
-/**
- * @brief Called when the buffer of the ESPP service client handle faces underrun or overrun condition.
- * @param[in] stream_type    The stream type
- * @param[in] buffer_status  The buffer status
- * @param[in] user_data      The user data passed from the callback registration function
- * @see espp_client_set_buffer_status_cb()
- */
-typedef void (*espp_buffer_status_cb)(espp_stream_type_e stream_type, espp_buffer_status_e buffer_status, void *user_data);
-
-/**
- * @brief Called when an image is captured by espp_client_take_snapshot().
- * @remarks The @a espp is the same object for which the callback was set.\n
- *          The @a espp should not be released.\n
- *          The @a data should not be released. The @a data can be used only in the callback. To use outside, make a copy.
- * @param[in] espp       ESPP service client handle
- * @param[in] data       The snapshot image data (24-bit RGB)
- * @param[in] width      The snapshot image width
- * @param[in] height     The snapshot image height
- * @param[in] size       The size of @a data
- * @param[in] user_data  The user data passed from the callback registration function
- * @see espp_client_take_snapshot()
- */
-typedef void (*espp_snapshot_cb)(espp_h espp, const char *data, int width, int height, unsigned int size, void *user_data);
-
-/**
- * @brief Called when a H/W resource of the ESPP service client handle has been conflicted.
- * @param[in] user_data    The user data passed from the callback registration function
- * @see espp_client_set_resource_conflicted_cb()
- */
-typedef void (*espp_resource_conflicted_cb)(void *user_data);
-
-/**
- * @brief Called when an error occurs.
- * @param[in] error        The error value
- * @param[in] user_data    The user data passed from the callback registration function
- * @see espp_client_set_error_cb()
- */
-typedef void (*espp_error_cb)(espp_client_error_e error, void *user_data);
-
-/**
- * @brief Sets a callback function to be invoked when the ESPP service client handle is prepared to receive ESPP packets after calling espp_client_prepare_async().
- * @param[in] espp       ESPP service client handle
- * @param[in] callback   Callback function pointer
- * @param[in] user_data  The user data to be passed to the callback function
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @post espp_ready_to_prepare_cb() will be invoked.
- * @see espp_client_prepare_async()
- * @see espp_client_submit_packet()
- */
-int espp_client_set_ready_to_prepare_cb(espp_h espp, espp_ready_to_prepare_cb callback, void *user_data);
-
-/**
- * @brief Sets a callback function to be invoked when the ESPP service client handle is prepared to be started.
- * @param[in] espp       ESPP service client handle
- * @param[in] callback   Callback function pointer
- * @param[in] user_data  The user data to be passed to the callback function
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @post espp_prepare_async_done_cb() will be invoked.
- * @see espp_client_submit_packet()
- */
-int espp_client_set_prepare_async_done_cb(espp_h espp, espp_prepare_async_done_cb callback, void *user_data);
-
-/**
- * @brief Sets a callback function to be invoked when the ESPP service client handle is prepared to receive ESPP packets after calling espp_client_seek().
- * @param[in] espp       ESPP service client handle
- * @param[in] callback   Callback function pointer
- * @param[in] user_data  The user data to be passed to the callback function
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre The state must be #ESPP_STATE_NONE or #ESPP_STATE_IDLE.
- * @post espp_ready_to_seek_cb() will be invoked.
- * @see espp_client_seek()
- * @see espp_client_submit_packet()
- */
-int espp_client_set_ready_to_seek_cb(espp_h espp, espp_ready_to_seek_cb callback, void *user_data);
-
-/**
- * @brief Sets a callback function to be invoked when the seek operation of the ESPP service client handle has been finished.
- * @param[in] espp       ESPP service client handle
- * @param[in] callback   Callback function pointer
- * @param[in] user_data  The user data to be passed to the callback function
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @post espp_seek_done_cb() will be invoked.
- * @see espp_client_seek()
- * @see espp_client_submit_packet()
- */
-int espp_client_set_seek_done_cb(espp_h espp, espp_seek_done_cb callback, void *user_data);
-
-/**
- * @brief Sets a callback function to be invoked when the ESPP service client handle has reached the end of stream.
- * @param[in] espp       ESPP service client handle
- * @param[in] callback   Callback function pointer
- * @param[in] user_data  The user data to be passed to the callback function
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @post espp_eos_cb() will be invoked.
- */
-int espp_client_set_eos_cb(espp_h espp, espp_eos_cb callback, void *user_data);
-
-/**
- * @brief Sets a callback function to be invoked when the buffer of the ESPP service client handle faces underrun or overflow condition.
- * @param[in] espp       ESPP service client handle
- * @param[in] callback   Callback function pointer
- * @param[in] user_data  The user data to be passed to the callback function
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @post espp_buffer_status_cb() will be invoked.
- */
-int espp_client_set_buffer_status_cb(espp_h espp, espp_buffer_status_cb callback, void *user_data);
-
-/**
- * @brief Sets a callback function to be invoked when a H/W resource of the ESPP service client handle has been conflicted.
- * @param[in] espp       ESPP service client handle
- * @param[in] callback   Callback function pointer
- * @param[in] user_data  The user data to be passed to the callback function
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @post espp_resource_conflicted_cb() will be invoked.
- */
-int espp_client_set_resource_conflicted_cb(espp_h espp, espp_resource_conflicted_cb callback, void *user_data);
-
-/**
- * @brief Sets a callback function to be invoked when an error occurs.
- * @param[in] espp       ESPP service client handle
- * @param[in] callback   Callback function pointer
- * @param[in] user_data  The user data to be passed to the callback function
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre The state must be #ESPP_STATE_NONE or #ESPP_STATE_IDLE.
- * @post espp_error_cb() will be invoked.
- */
-int espp_client_set_error_cb(espp_h espp, espp_error_cb callback, void *user_data);
-
-/**
- * @brief Creates an instance of ESPP service client.
- * @param[out] espp    ESPP service client handle
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @see espp_client_destroy()
- */
-int espp_client_create(espp_h *espp);
-
-/**
- * @brief Destroys the ESPP service client handle.
- * @param[in] espp    ESPP service client handle
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @see espp_client_create()
- */
-int espp_client_destroy(espp_h espp);
-
-/**
- * @brief Opens the ESPP service client handle.
- * @param[in] espp    ESPP service client handle
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre Functions for setting callbacks must be called before calling this function.\n
- *      The state must be #ESPP_STATE_NONE.
- * @post The state will be #ESPP_STATE_IDLE.
- * @see espp_client_create()
- * @see espp_client_close()
- */
-int espp_client_open(espp_h espp);
-
-/**
- * @brief Closes the ESPP service client handle.
- * @param[in] espp    ESPP service client handle
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre The state must be one of espp_state_e values except #ESPP_STATE_NONE.
- * @post The state will be #ESPP_STATE_NONE.
- * @see espp_client_open()
- * @see espp_client_stop()
- */
-int espp_client_close(espp_h espp);
-
-/**
- * @brief Starts the ESPP service client handle.
- * @param[in] espp    ESPP service client handle
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre The state must be #ESPP_STATE_READY.
- * @post The state will be #ESPP_STATE_PLAYING.
- * @see espp_client_create()
- * @see espp_client_set_audio_stream_info()
- * @see espp_client_set_video_stream_info()
- * @see espp_client_prepare_async()
- * @see espp_client_stop()
- * @see espp_client_pause()
- * @see espp_client_resume()
- */
-int espp_client_start(espp_h espp);
-
-/**
- * @brief Stops the ESPP service client handle.
- * @remarks espp_client_close() must be called after this handle is stopped.
- * @param[in] espp    ESPP service client handle
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre The state must be one of espp_state_e values except #ESPP_STATE_NONE.
- * @post The state will be #ESPP_STATE_IDLE.
- * @see espp_client_start()
- * @see espp_client_close()
- * @see espp_client_pause()
- * @see espp_client_resume()
- */
-int espp_client_stop(espp_h espp);
-
-/**
- * @brief Pauses the ESPP service client handle.
- * @param[in] espp    ESPP service client handle
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre The state must be one of #ESPP_STATE_READY or #ESPP_STATE_PAUSED or #ESPP_STATE_PLAYING.
- * @post The state will be #ESPP_STATE_PAUSED.
- * @see espp_client_start()
- * @see espp_client_stop()
- * @see espp_client_resume()
- */
-int espp_client_pause(espp_h espp);
-
-/**
- * @brief Resumes the ESPP service client handle.
- * @param[in] espp    ESPP service client handle
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre The state must be #ESPP_STATE_PAUSED or #ESPP_STATE_PLAYING.
- * @post The state will be #ESPP_STATE_PLAYING.
- * @see espp_client_start()
- * @see espp_client_stop()
- * @see espp_client_pause()
- */
-int espp_client_resume(espp_h espp);
-
-/**
- * @brief Prepares the ESPP service client handle asynchronously.
- * @param[in] espp    ESPP service client handle
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre The state must be #ESPP_STATE_IDLE.
- * @post espp_client_prepare_async_done_cb() will be called when the preparation is finished.\n
- *       If the result is success, the state will be #ESPP_STATE_READY.
- * @see espp_client_set_audio_stream_info()
- * @see espp_client_set_video_stream_info()
- * @see espp_client_start()
- */
-int espp_client_prepare_async(espp_h espp);
-
-/**
- * @brief Seeks playback to a given time in milliseconds
- * @remarks In ESPP_STATE_IDLE, this function can be called between espp_client_open() and espp_client_prepare_async().\n
- *          The playback start time can be set in case of the first playback without calling espp_seek_done_cb().
- * @param[in] espp    ESPP service client handle
- * @param[in] time_ms Destination time to seek
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre The state must be one of #ESPP_STATE_READY or #ESPP_STATE_PAUSED or #ESPP_STATE_PLAYING.
- * @post espp_client_seek_done_cb() will be called when the seek operation is finished.
- * @see espp_client_set_seek_done_cb()
- */
-int espp_client_seek(espp_h espp, uint64_t time_ms);
-
-/**
- * @brief Gets the current stats of the ESPP service client handle.
- * @param[in] espp    ESPP service client handle
- * @param[out] state  The state of the handle
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @see espp_client_create()
- */
-int espp_client_get_state(espp_h espp, espp_state_e *state);
-
-/**
- * @brief Gets the current playing time of the ESPP service client handle.
- * @param[in] espp      ESPP service client handle
- * @param[out] time_ms  The playing time in milliseconds
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre The state must be #ESPP_STATE_PAUSED or #ESPP_STATE_PLAYING.
- * @see espp_client_prepare_async()
- */
-int espp_client_get_playing_time(espp_h espp, uint64_t *time_ms);
-
-/**
- * @brief Sets the audio stream information to the ESPP service client handle.
- * @remarks This function must be called before calling the espp_client_prepare_async().
- * @param[in] espp    ESPP service client handle
- * @param[in] info    Audio stream information structure pointer
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @see espp_client_prepare_async()
- * @see espp_client_set_video_stream_info()
- */
-int espp_client_set_audio_stream_info(espp_h espp, espp_audio_stream_info_s *info);
-
-/**
- * @brief Sets the video stream information to the ESPP service client handle.
- * @remarks This function must be called before calling the espp_client_prepare_async().
- * @param[in] espp    ESPP service client handle
- * @param[in] info    Video stream information structure pointer
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @see espp_client_prepare_async()
- * @see espp_client_set_audio_stream_info()
- */
-int espp_client_set_video_stream_info(espp_h espp, espp_video_stream_info_s *info);
-
-/**
- * @brief Sets the playback rate.
- * @remarks User has to push the data as fast as playback rate.
- * @param[in] espp       ESPP service client handle
- * @param[in] rate       The playback rate from 0.0 to 2.0
- * @param[in] mute_audio Mute audio or not (@c true = mute, @c false = not mute)
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre The state must be one of #ESPP_STATE_READY or #ESPP_STATE_PAUSED or #ESPP_STATE_PLAYING.
- * @see espp_client_prepare_async()
- */
-int espp_client_set_playback_rate(espp_h espp, double rate, bool mute_audio);
-
-/**
- * @brief Sets the video display surface id.
- * @param[in] espp       ESPP service client handle
- * @param[in] type       The display type
- * @param[in] surface_id Resource id of window
- * @param[in] x          The x coordinate of window
- * @param[in] y          The y coordinate of window
- * @param[in] w          The width of window
- * @param[in] h          The height of window
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @see espp_client_set_display_mode()
- * @see espp_client_set_display_roi()
- * @see espp_client_set_display_visible()
- * @see espp_client_set_display_rotation()
- */
-int espp_client_set_display_surface_id(espp_h espp, espp_display_type_e type, unsigned int surface_id, int x, int y, int w, int h);
-
-/**
- * @brief Sets the video display mode.
- * @param[in] espp    ESPP service client handle
- * @param[in] mode    The display mode
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre espp_client_open() must be called before calling this function.
- * @see espp_client_open()
- * @see espp_client_set_display_surface_id()
- * @see espp_client_set_display_roi()
- * @see espp_client_set_display_rotation()
- */
-int espp_client_set_display_mode(espp_h espp, espp_display_mode_e mode);
-
-/**
- * @brief Sets the video display RoI(Region of Interest).
- * @param[in] espp       ESPP service client handle
- * @param[in] x          The starting x coordinate of RoI on the video source
- * @param[in] y          The starting y coordinate of RoI on the video source
- * @param[in] w          The width of RoI on the video source
- * @param[in] h          The height of RoI on the video source
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre #ESPP_DISPLAY_MODE_DST_ROI must be set by espp_client_set_display_mode() before calling this function.
- * @see espp_client_set_display_surface_id()
- * @see espp_client_set_display_mode()
- * @see espp_client_set_display_rotation()
- */
-int espp_client_set_display_roi(espp_h espp, int x, int y, int w, int h);
-
-/**
- * @brief Sets the video display visibility.
- * @param[in] espp       ESPP service client handle
- * @param[in] visible    The visibility of the display (@c true = visible, @c false = invisible)
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @see espp_client_set_display_surface_id()
- */
-int espp_client_set_display_visible(espp_h espp, bool visible);
-
-/**
- * @brief Set the rotate angle of the video display.
- * @param[in] espp       ESPP service client handle
- * @param[in] angle      The rotation angle of the display
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @see espp_client_set_display_surface_id()
- * @see espp_client_set_display_mode()
- * @see espp_client_set_display_roi()
- */
-int espp_client_set_display_rotation(espp_h espp, espp_display_rotation_angle_e angle);
-
-/**
- * @brief Sets mute of the audio stream.
- * @param[in] espp    ESPP service client handle
- * @param[in] mute    Mute or not (@c true = mute, @c false = not mute)
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre espp_client_open() must be called before calling this function.
- * @see espp_client_open()
- */
-int espp_client_set_audio_mute(espp_h espp, bool mute);
-
-/**
- * @brief Sets volume of the audio stream.
- * @param[in] espp    ESPP service client handle
- * @param[in] volume  Volume level from 0 to 100
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre espp_client_open() must be called before calling this function.
- * @see espp_client_open()
- * @see espp_client_get_audio_volume()
- */
-int espp_client_set_audio_volume(espp_h espp, int volume);
-
-/**
- * @brief Gets the current volume of the audio stream.
- * @param[in] espp    ESPP service client handle
- * @param[out] volume  Volume level from 0 to 100
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre espp_client_open() must be called before calling this function.
- * @see espp_client_open()
- * @see espp_client_set_audio_volume()
- */
-int espp_client_get_audio_volume(espp_h espp, int *volume);
-
-/**
- * @brief Submits ESPP packet.
- * @param[in] espp    ESPP service client handle
- * @param[in] packet  ESPP packet pointer
- * @param[out] error  ESPP packet submit error (optional, this can be NULL)
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre This function must be called after espp_ready_to_prepare_cb() or espp_ready_to_seek_cb() is invoked.
- * @see espp_ready_to_prepare_cb()
- * @see espp_ready_to_seek_cb()
- * @see espp_buffer_status_cb()
- */
-int espp_client_submit_packet(espp_h espp, espp_packet_s *packet, espp_submit_error_e *error);
-
-/**
- * @brief Generates EoS(End of Stream) packet and submits it.
- * @param[in] espp         ESPP service client handle
- * @param[in] stream_type  The stream type that reaches EoS
- * @param[out] error       ESPP packet submit error (optional, this can be NULL)
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @see espp_ready_to_prepare_cb()
- * @see espp_ready_to_seek_cb()
- * @see espp_buffer_status_cb()
- */
-int espp_client_submit_eos_packet(espp_h espp, espp_stream_type_e stream_type, espp_submit_error_e *error);
-
-/**
- * @brief Sets buffer size.
- * @param[in] espp    ESPP service client handle
- * @param[in] type    The buffer size type to be set
- * @param[in] size    The size of the selected buffer type
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre espp_client_open() must be called before calling this function.
- * @see espp_open()
- */
-int espp_client_set_buffer_size(espp_h espp, espp_buffer_size_type_e size_type, uint64_t size);
-
-/**
- * @brief Sets low latency mode, multiple modes can be set.
- * @param[in] espp    ESPP service client handle
- * @param[in] mode    One of the low latency mode to be set
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre espp_client_open() must be called before calling this function.
- * @see espp_open()
- */
-int espp_client_set_low_latency_mode(espp_h espp, espp_low_latency_mode_e mode);
-
-/**
- * @brief Sets the decoded video frame buffer type.
- * @param[in] espp    ESPP service client handle
- * @param[in] type    The video frame buffer type
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre espp_client_open() must be called before calling this function.
- * @see espp_client_open()
- */
-int espp_client_set_decoded_video_frame_buffer_type(espp_h espp, espp_decoded_video_frame_buffer_type_e type);
-
-/**
- * @brief Takes a snapshot asynchronously.
- * @param[in] espp     ESPP service client handle
- * @param[in] callback    Callback function pointer
- * @param[in] user_data   The user data to be passed to the callback function
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre #ESPP_DECODED_VIDEO_FRAME_BUFFER_TYPE_MANUAL_COPY must be set by espp_client_set_decoded_video_frame_buffer_type() before calling this function.
- * @see espp_client_set_decoded_video_frame_buffer_type()
- */
-int espp_client_take_snapshot(espp_h espp, espp_snapshot_cb callback, void *user_data);
-
-/**
- * @brief Sets the render time offset of the stream type.
- * @remarks The default value of @a time_offset_ms is 0 and the valid range is between INT64_MIN/1000000 and INT64_MAX/1000000.
- * @param[in] espp           ESPP service client handle
- * @param[in] stream_type    The stream type to set render time offset
- * @param[in] time_offset_ms Render time offset in milliseconds
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #ESPP_CLIENT_ERROR_NONE Successful
- * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
- * @pre The state must be one of #ESPP_STATE_READY or #ESPP_STATE_PAUSED or #ESPP_STATE_PLAYING.
- * @pre Low latency mode has to be set except for #ESPP_LOW_LATENCY_MODE_NONE and #ESPP_LOW_LATENCY_MODE_DISABLE_SYNC.
- * @see espp_client_prepare_async()
- * @see espp_client_set_low_latency_mode()
- */
-int espp_client_set_render_time_offset(espp_h espp, espp_stream_type_e stream_type, int64_t time_offset_ms);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __ESPP_SERVICE_CLIENT_H__ */
-
diff --git a/src/client/espp_service_client_event_handler.c b/src/client/espp_service_client_event_handler.c
deleted file mode 100644 (file)
index efc4ee2..0000000
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- * Copyright (c) 2023 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 "espp_service_client_priv.h"
-
-typedef void (*func_handler) (espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result);
-
-static void __handle_event_msg(espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result)
-{
-       int ret;
-       g_autofree gchar *msg = NULL;
-
-       ASSERT(espp);
-       ASSERT(data);
-       ASSERT(result);
-
-       result->ret = -1;
-
-       ret = espp_service_client_msg_parse_params(data->params, data->event, &msg);
-       if (ret != 0)
-               return;
-
-       LOG_INFO("msg[%s]", msg);
-
-       result->ret = 0;
-}
-
-static void __handle_event_cb_ready_to_prepare(espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result)
-{
-       int ret;
-       espp_stream_type_e stream_type;
-
-       ASSERT(espp);
-       ASSERT(data);
-       ASSERT(result);
-
-       result->ret = -1;
-
-       ret = espp_service_client_msg_parse_params(data->params, data->event, &stream_type);
-       if (ret != 0)
-               return;
-
-       LOG_INFO("cb params[stream_type:%d]", stream_type);
-
-       if (espp->ready_to_prepare_cb.callback) {
-               LOG_DEBUG(">>> callback[%p] user_data[%p]", espp->ready_to_prepare_cb.callback, espp->ready_to_prepare_cb.user_data);
-               ((espp_ready_to_prepare_cb)(espp->ready_to_prepare_cb.callback))(stream_type, espp->ready_to_prepare_cb.user_data);
-               LOG_DEBUG("<<< end of the callback");
-       }
-
-       result->ret = 0;
-}
-
-static void __handle_event_cb_prepare_async_done(espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result)
-{
-       int ret;
-       bool _result;
-
-       ASSERT(espp);
-       ASSERT(data);
-       ASSERT(result);
-
-       result->ret = -1;
-
-       ret = espp_service_client_msg_parse_params(data->params, data->event, &_result);
-       if (ret != 0)
-               return;
-
-       LOG_INFO("cb params[result:%d]", _result);
-
-       if (espp->prepare_async_done_cb.callback) {
-               LOG_DEBUG(">>> callback[%p] user_data[%p]", espp->prepare_async_done_cb.callback, espp->prepare_async_done_cb.user_data);
-               ((espp_prepare_async_done_cb)(espp->prepare_async_done_cb.callback))(_result, espp->prepare_async_done_cb.user_data);
-               LOG_DEBUG("<<< end of the callback");
-       }
-
-       result->ret = 0;
-}
-
-static void __handle_event_cb_ready_to_seek(espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result)
-{
-       int ret;
-       espp_stream_type_e stream_type;
-       uint64_t time_ms;
-
-       ASSERT(espp);
-       ASSERT(data);
-       ASSERT(result);
-
-       ret = espp_service_client_msg_parse_params(data->params, data->event, &stream_type, &time_ms);
-       if (ret != 0)
-               return;
-
-       LOG_INFO("cb params[stream_type:%d, time_ms:%" PRIu64 "]", stream_type, time_ms);
-
-       if (espp->ready_to_seek_cb.callback) {
-               LOG_DEBUG(">>> callback[%p] user_data[%p]", espp->ready_to_seek_cb.callback, espp->ready_to_seek_cb.user_data);
-               ((espp_ready_to_seek_cb)(espp->ready_to_seek_cb.callback))(stream_type, time_ms, espp->ready_to_seek_cb.user_data);
-               LOG_DEBUG("<<< end of the callback");
-       }
-
-       result->ret = 0;
-}
-
-static void __handle_event_cb_seek_done(espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result)
-{
-       ASSERT(espp);
-       ASSERT(data);
-       ASSERT(result);
-
-       if (espp->seek_done_cb.callback) {
-               LOG_DEBUG(">>> callback[%p] user_data[%p]", espp->seek_done_cb.callback, espp->seek_done_cb.user_data);
-               ((espp_seek_done_cb)(espp->seek_done_cb.callback))(espp->seek_done_cb.user_data);
-               LOG_DEBUG("<<< end of the callback");
-       }
-
-       result->ret = 0;
-}
-
-static void __handle_event_cb_eos(espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result)
-{
-       ASSERT(espp);
-       ASSERT(data);
-       ASSERT(result);
-
-       if (espp->eos_cb.callback) {
-               LOG_DEBUG(">>> callback[%p] user_data[%p]", espp->eos_cb.callback, espp->eos_cb.user_data);
-               ((espp_eos_cb)(espp->eos_cb.callback))(espp->eos_cb.user_data);
-               LOG_DEBUG("<<< end of the callback");
-       }
-
-       result->ret = 0;
-}
-
-static void __handle_event_cb_buffer_status(espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result)
-{
-       int ret;
-       espp_stream_type_e stream_type;
-       espp_buffer_status_e buffer_status;
-
-       ASSERT(espp);
-       ASSERT(data);
-       ASSERT(result);
-
-       result->ret = -1;
-
-       ret = espp_service_client_msg_parse_params(data->params, data->event, &stream_type, &buffer_status);
-       if (ret != 0)
-               return;
-
-       LOG_INFO("cb params[stream_type:%d, buffer_status:%d]", stream_type, buffer_status);
-
-       if (espp->buffer_status_cb.callback) {
-               LOG_DEBUG(">>> callback[%p] user_data[%p]", espp->buffer_status_cb.callback, espp->buffer_status_cb.user_data);
-               ((espp_buffer_status_cb)(espp->buffer_status_cb.callback))(stream_type, buffer_status, espp->buffer_status_cb.user_data);
-               LOG_DEBUG("<<< end of the callback");
-       }
-
-       result->ret = 0;
-}
-
-static void __handle_event_cb_resource_conflicted(espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result)
-{
-       ASSERT(espp);
-       ASSERT(data);
-       ASSERT(result);
-
-       if (espp->resource_conflicted_cb.callback) {
-               LOG_DEBUG(">>> callback[%p] user_data[%p]", espp->resource_conflicted_cb.callback, espp->resource_conflicted_cb.user_data);
-               ((espp_resource_conflicted_cb)(espp->resource_conflicted_cb.callback))(espp->resource_conflicted_cb.user_data);
-               LOG_DEBUG("<<< end of the callback");
-       }
-
-       result->ret = 0;
-}
-
-static void __handle_event_cb_error(espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result)
-{
-       int ret;
-       espp_client_error_e error;
-
-       ASSERT(espp);
-       ASSERT(data);
-       ASSERT(result);
-
-       result->ret = -1;
-
-       ret = espp_service_client_msg_parse_params(data->params, data->event, &error);
-       if (ret != 0)
-               return;
-
-       LOG_INFO("cb params[error:%d]", error);
-
-       if (espp->error_cb.callback) {
-               LOG_DEBUG(">>> callback[%p] user_data[%p]", espp->error_cb.callback, espp->error_cb.user_data);
-               ((espp_error_cb)(espp->error_cb.callback))(error, espp->error_cb.user_data);
-               LOG_DEBUG("<<< end of the callback");
-       }
-
-       result->ret = 0;
-}
-
-static int __read_buffer(int fd, gchar *buffer, uint32_t size)
-{
-       int ret;
-       uint32_t total = 0;
-       char str_error[MAX_ERROR_LEN] = {'\0',};
-
-       ASSERT(fd >= 0);
-       ASSERT(buffer);
-
-       do {
-               if ((ret = read(fd, buffer + total, size - total)) < 0) {
-                       strerror_r(errno, str_error, sizeof(str_error));
-                       LOG_ERROR("failed to read(), fd[%d], ret[%d], err: %s", fd, ret, str_error);
-                       break;
-               }
-               total += ret;
-       } while (total < size);
-
-       if (total != size) {
-               LOG_ERROR("total[%u], expected size[%u]", total, size);
-               return -1;
-       }
-
-       LOG_DEBUG("fd[%d] buffer[%p, size:%u]", fd, buffer, size);
-
-       return 0;
-}
-
-static void __handle_event_cb_snapshot(espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result)
-{
-       int ret;
-       int32_t cb_id;
-       uint32_t width;
-       uint32_t height;
-       uint32_t size;
-       g_autofree gchar *buffer = NULL;
-       g_autofree gint *id = NULL;
-       espp_callback_s *cb_data;
-
-       ASSERT(espp);
-       ASSERT(data);
-       ASSERT(result);
-
-       result->ret = -1;
-
-       ret = espp_service_client_msg_parse_params(data->params, data->event, &cb_id, &width, &height, &size);
-       if (ret != 0)
-               return;
-
-       LOG_INFO("cb params[cb_id:%d, width:%u, height:%u, size:%u]", cb_id, width, height, size);
-
-       buffer = g_malloc0(size);
-       if (__read_buffer(espp->event_fd, buffer, size) != 0)
-               return;
-
-       id = g_new(gint, 1);
-       *id = cb_id;
-       cb_data = g_hash_table_lookup(espp->snapshot_cbs, id);
-       if (!cb_data) {
-               LOG_ERROR("could not find cb_data of cb_id[%d]", cb_id);
-               return;
-       }
-
-       if (cb_data->callback) {
-               LOG_DEBUG(">>> cb_id[%d] callback[%p] user_data[%p]", cb_id, cb_data->callback, cb_data->user_data);
-               ((espp_snapshot_cb)(cb_data->callback))((espp_h)espp, (const char *)buffer, (int)width, (int)height, (unsigned int)size, cb_data->user_data);
-               LOG_DEBUG("<<< end of the callback");
-       }
-       result->ret = 0;
-}
-
-static func_handler handlers[] = {
-       [ESPP_SERVICE_EVENT_MSG] = __handle_event_msg,
-       [ESPP_SERVICE_EVENT_CB_READY_TO_PREPARE] = __handle_event_cb_ready_to_prepare,
-       [ESPP_SERVICE_EVENT_CB_PREPARE_ASYNC_DONE] = __handle_event_cb_prepare_async_done,
-       [ESPP_SERVICE_EVENT_CB_READY_TO_SEEK] = __handle_event_cb_ready_to_seek,
-       [ESPP_SERVICE_EVENT_CB_SEEK_DONE] = __handle_event_cb_seek_done,
-       [ESPP_SERVICE_EVENT_CB_EOS] = __handle_event_cb_eos,
-       [ESPP_SERVICE_EVENT_CB_BUFFER_STATUS] = __handle_event_cb_buffer_status,
-       [ESPP_SERVICE_EVENT_CB_RESOURCE_CONFLICTED] = __handle_event_cb_resource_conflicted,
-       [ESPP_SERVICE_EVENT_CB_ERROR] = __handle_event_cb_error,
-       [ESPP_SERVICE_EVENT_CB_SNAPSHOT] = __handle_event_cb_snapshot,
-};
-
-static void __func_handler(espp_s *espp, espp_service_data_from_server_s *data, espp_service_data_from_client_s *result)
-{
-       ASSERT(espp);
-       ASSERT(data);
-       ASSERT(result);
-       ASSERT(data->event >= 0);
-       ASSERT(data->event < ESPP_SERVICE_EVENT_CB_NUM);
-
-       LOG_WARNING("espp[%p] data[%p, event:%s]", espp, data, espp_service_common_get_events()[data->event].str);
-
-       handlers[data->event](espp, data, result);
-}
-
-gpointer espp_service_client_event_handler_thread_func(gpointer user_data)
-{
-       int ret;
-       const int read_len = sizeof(espp_service_data_from_server_s);
-       const int write_len = sizeof(espp_service_data_from_client_s);
-       char str_error[MAX_ERROR_LEN] = {'\0',};
-       espp_service_data_from_server_s rx_data;
-       espp_service_data_from_client_s tx_data;
-       espp_s *espp = (espp_s *)user_data;
-
-       ASSERT(espp);
-       ASSERT(espp->event_fd >= 0);
-
-       LOG_DEBUG_ENTER();
-
-       while (!espp->event_handler.exit) {
-               LOG_DEBUG("wait for read..");
-
-               memset(&rx_data, 0x00, read_len);
-               if ((ret = read(espp->event_fd, &rx_data, read_len)) <= 0) {
-                       if (errno == EAGAIN) {
-                               LOG_DEBUG("socket might be closed");
-                               goto exit;
-                       }
-                       strerror_r(errno, str_error, sizeof(str_error));
-                       LOG_ERROR("failed to read(), fd[%d], err: %s", espp->event_fd, str_error);
-                       goto exit;
-               }
-
-               ASSERT(rx_data.event >= 0);
-               ASSERT(rx_data.event < ESPP_SERVICE_EVENT_CB_NUM);
-               LOG_DEBUG("<<<<< from fd[%d]: event[%s]", espp->event_fd, espp_service_common_get_events()[rx_data.event].str);
-
-               memset(&tx_data, 0x00, write_len);
-
-               g_mutex_lock(&espp->cb_mutex);
-               __func_handler(espp, &rx_data, &tx_data);
-               g_mutex_unlock(&espp->cb_mutex);
-
-               LOG_DEBUG(">>>>>> to fd[%d]: tx_data.ret[%d]", espp->event_fd, tx_data.ret);
-
-               if (write(espp->event_fd, &tx_data, write_len) < 0) {
-                       strerror_r(errno, str_error, sizeof(str_error));
-                       LOG_ERROR("failed to write(), fd[%d], err: %s", espp->event_fd, str_error);
-               }
-       }
-
-exit:
-       LOG_DEBUG_LEAVE();
-       return NULL;
-}
diff --git a/src/client/espp_service_client_msg.c b/src/client/espp_service_client_msg.c
deleted file mode 100644 (file)
index b992479..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2023 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 "espp_service_client_priv.h"
-#include <stdarg.h>
-
-int espp_service_client_msg_parse_params(const char *params, espp_service_event_e event, ...)
-{
-       int ret;
-       va_list ap;
-
-       ASSERT(params);
-       ASSERT(event < ESPP_SERVICE_EVENT_CB_NUM);
-
-       va_start(ap, event);
-       ret = espp_service_common_parse_json_structured_message(ap, params, espp_service_common_get_events()[event].param_formats);
-       va_end(ap);
-
-       return ret;
-}
diff --git a/src/client/espp_service_client_priv.h b/src/client/espp_service_client_priv.h
deleted file mode 100644 (file)
index b14244b..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 2023 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 __ESPP_SERVICE_CLIENT_PRIVATE_H__
-#define __ESPP_SERVICE_CLIENT_PRIVATE_H__
-
-#include "../common/espp_service_common.h"
-#include "../common/espp_service_ipc.h"
-#include "espp_service_client.h"
-#include <unistd.h>
-#include <inttypes.h>
-
-#ifdef USE_DLOG
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "ESPP_SERVICE_CLIENT"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define LOG_WARNING_IF_CALLBACK_EXISTS(x_callback) \
-do { \
-       if (x_callback.callback) \
-               LOG_WARNING("previous callback[%p] user_data[%p]", x_callback.callback, x_callback.user_data); \
-} while (0)
-
-typedef struct {
-       void *callback;
-       void *user_data;
-} espp_callback_s;
-
-typedef struct _espp_s {
-       GMutex mutex;
-       GMutex cb_mutex;
-
-       int fd;
-       int event_fd;
-       int snapshot_cb_id;
-
-       struct {
-               GThread *thread;
-               bool exit;
-       } event_handler;
-
-       espp_callback_s ready_to_prepare_cb;
-       espp_callback_s prepare_async_done_cb;
-       espp_callback_s ready_to_seek_cb;
-       espp_callback_s seek_done_cb;
-       espp_callback_s eos_cb;
-       espp_callback_s buffer_status_cb;
-       espp_callback_s resource_conflicted_cb;
-       espp_callback_s error_cb;
-       GHashTable *snapshot_cbs;
-} espp_s;
-
-/* socket */
-int espp_service_client_socket_fd_new(void);
-int espp_service_client_socket_request_init_event(espp_s *espp);
-int espp_service_client_socket_request_deinit_event(espp_s *espp);
-int espp_service_client_socket_request_create(espp_s *espp);
-int espp_service_client_socket_request_destroy(espp_s *espp);
-int espp_service_client_socket_request_open(espp_s *espp);
-int espp_service_client_socket_request_close(espp_s *espp);
-int espp_service_client_socket_request_start(espp_s *espp);
-int espp_service_client_socket_request_stop(espp_s *espp);
-int espp_service_client_socket_request_pause(espp_s *espp);
-int espp_service_client_socket_request_resume(espp_s *espp);
-int espp_service_client_socket_request_prepare_async(espp_s *espp);
-int espp_service_client_socket_request_seek(espp_s *espp, uint64_t time_ms);
-int espp_service_client_socket_request_get_state(espp_s *espp, espp_state_e *state);
-int espp_service_client_socket_request_get_playing_time(espp_s *espp, uint64_t *time_ms);
-int espp_service_client_socket_request_set_audio_stream_info(espp_s *espp, espp_audio_stream_info_s *info);
-int espp_service_client_socket_request_set_video_stream_info(espp_s *espp, espp_video_stream_info_s *info);
-int espp_service_client_socket_request_set_playback_rate(espp_s *espp, double rate, bool mute_audio);
-int espp_service_client_socket_request_set_display_surface_id(espp_s *espp, espp_display_type_e type, unsigned int surface_id, int x, int y, int w, int h);
-int espp_service_client_socket_request_set_display_mode(espp_s *espp, espp_display_mode_e mode);
-int espp_service_client_socket_request_set_display_roi(espp_s *espp, int x, int y, int w, int h);
-int espp_service_client_socket_request_set_display_visible(espp_s *espp, bool visible);
-int espp_service_client_socket_request_set_display_rotation(espp_s *espp, espp_display_rotation_angle_e angle);
-int espp_service_client_socket_request_set_audio_mute(espp_s *espp, bool mute);
-int espp_service_client_socket_request_set_audio_volume(espp_s *espp, int volume);
-int espp_service_client_socket_request_get_audio_volume(espp_s *espp, int *volume);
-int espp_service_client_socket_request_set_callback(espp_s *espp, espp_service_event_e type, void *callback, void *user_data);
-int espp_service_client_socket_request_submit_packet(espp_s *espp, espp_packet_s *packet, espp_submit_error_e *error);
-int espp_service_client_socket_request_submit_eos_packet(espp_s *espp, espp_stream_type_e stream_type, espp_submit_error_e *error);
-int espp_service_client_socket_request_set_buffer_size(espp_s *espp, espp_buffer_size_type_e size_type, uint64_t size);
-int espp_service_client_socket_request_set_low_latency_mode(espp_s *espp, espp_low_latency_mode_e mode);
-int espp_service_client_socket_request_set_decoded_video_frame_buffer_type(espp_s *espp, espp_decoded_video_frame_buffer_type_e type);
-int espp_service_client_socket_request_take_snapshot(espp_s *espp, int id);
-int espp_service_client_socket_request_set_render_time_offset(espp_s *espp, espp_stream_type_e stream_type, int64_t time_offset_ms);
-
-/* event handler */
-gpointer espp_service_client_event_handler_thread_func(gpointer user_data);
-
-/* message */
-int espp_service_client_msg_parse_params(const char *params, espp_service_event_e event, ...);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __ESPP_SERVICE_CLIENT_PRIVATE_H__ */
diff --git a/src/client/espp_service_client_socket.c b/src/client/espp_service_client_socket.c
deleted file mode 100644 (file)
index 9c76a3d..0000000
+++ /dev/null
@@ -1,943 +0,0 @@
-/*
- * Copyright (c) 2023 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 "espp_service_client_priv.h"
-#include <sys/socket.h>
-#include <sys/un.h>
-
-#define MAX_CONNECT_RETRY 10
-#define RETRY_CONNECT_INTERVAL_US 300000
-
-#define FILL_SOCKET_MSG_PARAMS(x_msg, x_request, ...) \
-do { \
-       gchar *params = espp_service_common_msg_params_new(espp_service_common_get_requests()[x_request].param_formats, ##__VA_ARGS__); \
-       memset(&x_msg.params, 0x00, MAX_PARAMS_LEN); \
-       if (!params) break; \
-       STRNCPY(x_msg.params, params, MAX_PARAMS_LEN); \
-       g_free(params); \
-} while (0) \
-
-#define FILL_SOCKET_MSG_REQUEST(x_msg, x_request) \
-do { \
-       memset(&x_msg, 0x00, sizeof(x_msg)); \
-       x_msg.request = x_request; \
-} while (0) \
-
-#define FILL_SOCKET_MSG_RET(x_msg, x_ret) \
-do { \
-       memset(&x_msg, 0x00, sizeof(x_msg)); \
-       x_msg.ret = x_ret; \
-} while (0) \
-
-#define RET_VAL_IF_SERVER_RESULT_ERROR(x_result, x_val) \
-do { \
-       if (x_result.ret < 0) { \
-               LOG_ERROR("failure from server side, result.ret[%d]", x_result.ret); \
-               return x_val; \
-       } \
-       LOG_DEBUG("result.ret[%d]", x_result.ret); \
-} while (0) \
-
-static int get_client_socket_fd(int *fd)
-{
-       int _fd;
-       char str_error[MAX_ERROR_LEN] = {'\0',};
-
-       ASSERT(fd);
-
-       _fd = socket(AF_UNIX, SOCK_STREAM, 0);
-       if (_fd < 0) {
-               strerror_r(errno, str_error, sizeof(str_error));
-               LOG_ERROR("failed to socket(), err: %s", str_error);
-               return -1;
-       }
-
-       *fd = _fd;
-
-       LOG_DEBUG("fd[%d]", _fd);
-
-       return 0;
-}
-
-static int connect_socket(int fd)
-{
-       int ret;
-       int retry_count = MAX_CONNECT_RETRY;
-       struct sockaddr_un addr_un;
-       char str_error[MAX_ERROR_LEN] = {'\0',};
-       g_autofree gchar *sock_path = NULL;
-
-       ASSERT(fd >= 0);
-
-       memset(&addr_un, 0, sizeof(addr_un));
-       addr_un.sun_family = AF_UNIX;
-       sock_path = espp_service_common_get_sock_file_path();
-       strncpy(addr_un.sun_path, sock_path, sizeof(addr_un.sun_path) - 1);
-
-       do {
-               ret = connect(fd, (struct sockaddr *)&addr_un, sizeof(addr_un));
-               if (ret == 0) {
-                       LOG_DEBUG("connected successfully, fd[%d]", fd);
-                       return 0;
-               }
-
-               strerror_r(errno, str_error, sizeof(str_error));
-               LOG_ERROR("[%2d] failed to connect(), fd[%d], sun_path[%s], err: %s",
-                       retry_count, fd, addr_un.sun_path, str_error);
-
-               usleep(RETRY_CONNECT_INTERVAL_US);
-       } while (--retry_count > 0);
-
-       LOG_ERROR("connection timeout[%u us]", MAX_CONNECT_RETRY * RETRY_CONNECT_INTERVAL_US);
-
-       return -1;
-}
-
-static int send_data(int fd, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       char str_error[MAX_ERROR_LEN] = {'\0',};
-
-       ASSERT(fd >= 0);
-       ASSERT(data);
-       ASSERT(result);
-
-       if (write(fd, data, sizeof(espp_service_data_from_client_s)) < 0) {
-               strerror_r(errno, str_error, sizeof(str_error));
-               LOG_ERROR("failed to write(), fd[%d], err: %s", fd, str_error);
-               return -1;
-       }
-
-       if (read(fd, result, sizeof(espp_service_data_from_server_s)) < 0) {
-               strerror_r(errno, str_error, sizeof(str_error));
-               LOG_ERROR("failed to read(), fd[%d], err: %s", fd, str_error);
-               return -1;
-       }
-
-       LOG_DEBUG("fd[%d] request[%d], result->ret[%d]", fd, data->request, result->ret);
-
-       return 0;
-}
-
-static int send_data_and_buffer(int fd, espp_service_data_from_client_s *data, char *buffer, uint32_t buffer_size, espp_service_data_from_server_s *result)
-{
-       char str_error[MAX_ERROR_LEN] = {'\0',};
-
-       ASSERT(fd >= 0);
-       ASSERT(data);
-       ASSERT(buffer);
-       ASSERT(buffer_size > 0);
-       ASSERT(result);
-
-       if (write(fd, data, sizeof(espp_service_data_from_client_s)) < 0) {
-               strerror_r(errno, str_error, sizeof(str_error));
-               LOG_ERROR("failed to write(), fd[%d], err: %s", fd, str_error);
-               return -1;
-       }
-
-       if (write(fd, buffer, buffer_size) < 0) {
-               strerror_r(errno, str_error, sizeof(str_error));
-               LOG_ERROR("failed to write(), fd[%d], err: %s", fd, str_error);
-               return -1;
-       }
-
-       if (read(fd, result, sizeof(espp_service_data_from_server_s)) < 0) {
-               strerror_r(errno, str_error, sizeof(str_error));
-               LOG_ERROR("failed to read(), fd[%d], err: %s", fd, str_error);
-               return -1;
-       }
-
-       LOG_DEBUG("fd[%d] request[%d], buffer_size[%u], result->ret[%d]", fd, data->request, buffer_size, result->ret);
-
-       return 0;
-}
-
-static int send_data_without_result(int fd, espp_service_data_from_client_s *data)
-{
-       char str_error[MAX_ERROR_LEN] = {'\0',};
-
-       ASSERT(fd >= 0);
-       ASSERT(data);
-
-       if (write(fd, data, sizeof(espp_service_data_from_client_s)) < 0) {
-               strerror_r(errno, str_error, sizeof(str_error));
-               LOG_ERROR("failed to write(), fd[%d], err: %s", fd, str_error);
-               return -1;
-       }
-
-       LOG_DEBUG("fd[%d] data->ret[%d]", fd, data->ret);
-
-       return 0;
-}
-
-int espp_service_client_socket_fd_new(void)
-{
-       int fd = -1;
-
-       if (get_client_socket_fd(&fd) != 0)
-               return -1;
-
-       if (connect_socket(fd) != 0)
-               goto error;
-
-       LOG_INFO("fd[%d]", fd);
-
-       return fd;
-
-error:
-       if (fd != -1)
-               close(fd);
-
-       return -1;
-}
-
-int espp_service_client_socket_request_init_event(espp_s *espp)
-{
-       int fd = -1;
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       ASSERT(espp->event_fd == -1);
-
-       fd = espp_service_client_socket_fd_new();
-       RET_VAL_IF(fd == -1, -1, "failed to espp_service_client_socket_fd_new()");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_INIT_EVENT);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_INIT_EVENT, "handle", (long)espp);
-       if (send_data(fd, &data, &result) != 0)
-               goto error;
-       if (result.ret != 0) {
-               LOG_ERROR("failure from server side, result.ret[%d]", result.ret);
-               goto error;
-       }
-
-       espp->event_fd = fd;
-
-       LOG_DEBUG("espp[%p], event_fd[%d]", espp, fd);
-
-       if (!(espp->event_handler.thread = g_thread_try_new("event_handler_thread", espp_service_client_event_handler_thread_func, (gpointer)espp, NULL))) {
-               LOG_ERROR("failed to g_thread_try_new()");
-               goto error;
-       }
-
-       return 0;
-
-error:
-       close(fd);
-       espp->event_fd = -1;
-       return -1;
-}
-
-int espp_service_client_socket_request_deinit_event(espp_s *espp)
-{
-       espp_service_data_from_client_s data;
-
-       ASSERT(espp);
-       ASSERT(espp->event_fd != -1);
-       ASSERT(espp->event_handler.thread);
-
-       FILL_SOCKET_MSG_RET(data, -2); /* -2 to exit */
-       if (send_data_without_result(espp->event_fd, &data) != 0)
-               return -1;
-
-       espp->event_handler.exit = true;
-
-       LOG_DEBUG("espp[%p], event_fd[%d]", espp, espp->event_fd);
-
-       LOG_DEBUG("waiting for thread join...");
-       g_thread_join(espp->event_handler.thread);
-       LOG_DEBUG("thread exits");
-
-       close(espp->event_fd);
-       espp->event_fd = -1;
-       espp->event_handler.thread = NULL;
-       espp->event_handler.exit = false;
-
-       return 0;
-}
-
-int espp_service_client_socket_request_create(espp_s *espp)
-{
-       int fd = -1;
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       ASSERT(espp->fd == -1);
-
-       fd = espp_service_client_socket_fd_new();
-       RET_VAL_IF(fd == -1, -1, "failed to espp_service_client_socket_fd_new()");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_CREATE);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_CREATE, "handle", (long)espp);
-       if (send_data(fd, &data, &result) != 0)
-               goto error;
-       if (result.ret != 0) {
-               LOG_ERROR("failure from server side, result.ret[%d]", result.ret);
-               goto error;
-       }
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, fd);
-
-       espp->fd = fd;
-
-       return 0;
-
-error:
-       if (fd != -1)
-               close(fd);
-       return -1;
-}
-
-int espp_service_client_socket_request_destroy(espp_s *espp)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_DESTROY);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       close(espp->fd);
-       espp->fd = -1;
-
-       return 0;
-}
-
-int espp_service_client_socket_request_open(espp_s *espp)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_OPEN);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_close(espp_s *espp)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_CLOSE);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_start(espp_s *espp)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_START);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_stop(espp_s *espp)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_STOP);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_pause(espp_s *espp)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_PAUSE);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_resume(espp_s *espp)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_RESUME);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_prepare_async(espp_s *espp)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_PREPARE_ASYNC);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_seek(espp_s *espp, uint64_t time_ms)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SEEK);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SEEK, "time_ms", time_ms);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_get_state(espp_s *espp, espp_state_e *state)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       ASSERT(state);
-
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_GET_STATE);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       *state = result.ret_int;
-
-       return 0;
-}
-
-int espp_service_client_socket_request_get_playing_time(espp_s *espp, uint64_t *time_ms)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       ASSERT(time_ms);
-
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_GET_PLAYING_TIME);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       *time_ms = result.ret_uint64;
-
-       return 0;
-}
-
-int espp_service_client_socket_request_set_audio_stream_info(espp_s *espp, espp_audio_stream_info_s *info)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-       g_autofree gchar *base64_codec_data = NULL;
-
-       ASSERT(espp);
-       ASSERT(info);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       /* NOTE that encoding 'codec_data' member with base64 to avoid parsing json string error on the daemon side. */
-       if (info->codec_data_length > 0)
-               base64_codec_data = g_base64_encode((guchar *)info->codec_data, info->codec_data_length);
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_AUDIO_STREAM_INFO);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_AUDIO_STREAM_INFO,
-               "codec_data", base64_codec_data, "codec_data_length", info->codec_data_length, "mime_type", info->mime_type,
-               "bitrate", info->bitrate, "channels", info->channels, "sample_rate", info->sample_rate);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_set_video_stream_info(espp_s *espp, espp_video_stream_info_s *info)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-       g_autofree gchar *base64_codec_data = NULL;
-
-       ASSERT(espp);
-       ASSERT(info);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       /* NOTE that encoding 'codec_data' member with base64 to avoid parsing json string error on the daemon side. */
-       if (info->codec_data_length > 0)
-               base64_codec_data = g_base64_encode((guchar *)info->codec_data, info->codec_data_length);
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_VIDEO_STREAM_INFO);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_VIDEO_STREAM_INFO,
-               "codec_data", base64_codec_data, "codec_data_length", info->codec_data_length, "mime_type", info->mime_type,
-               "width", info->width, "height", info->height, "max_width", info->max_width, "max_height", info->max_height,
-               "framerate_num", info->framerate_num, "framerate_den", info->framerate_den);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-
-int espp_service_client_socket_request_set_playback_rate(espp_s *espp, double rate, bool mute_audio)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_PLAYBACK_RATE);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_PLAYBACK_RATE,
-               "rate", rate, "mute_audio", mute_audio);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_set_display_surface_id(espp_s *espp, espp_display_type_e type, unsigned int surface_id, int x, int y, int w, int h)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_SURFACE_ID);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_SURFACE_ID,
-               "type", type, "surface_id", surface_id,
-               "x", x, "y", y, "w", w, "h", h);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_set_display_mode(espp_s *espp, espp_display_mode_e mode)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_MODE);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_MODE, "mode", mode);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_set_display_roi(espp_s *espp, int x, int y, int w, int h)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_ROI);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_ROI,
-               "x", x, "y", y, "w", w, "h", h);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_set_display_visible(espp_s *espp, bool visible)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_VISIBLE);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_VISIBLE, "visible", visible);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_set_display_rotation(espp_s *espp, espp_display_rotation_angle_e angle)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_ROTATION);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_ROTATION, "angle", angle);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_set_audio_mute(espp_s *espp, bool mute)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_AUDIO_MUTE);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_AUDIO_MUTE, "mute", mute);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_set_audio_volume(espp_s *espp, int volume)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_AUDIO_VOLUME);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_AUDIO_VOLUME, "volume", volume);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_get_audio_volume(espp_s *espp, int *volume)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       ASSERT(volume);
-
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_GET_AUDIO_VOLUME);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       *volume = result.ret_int;
-
-       return 0;
-}
-
-int espp_service_client_socket_request_set_callback(espp_s *espp, espp_service_event_e type, void *callback, void *user_data)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_CALLBACK);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_CALLBACK, "type", type);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_submit_packet(espp_s *espp, espp_packet_s *packet, espp_submit_error_e *error)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       ASSERT(packet);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-       RET_VAL_IF(packet->buffer_size == 0, -1, "packet->buffer_size is 0");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SUBMIT_PACKET);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SUBMIT_PACKET,
-               "type", packet->type,
-               "buffer_size", packet->buffer_size,
-               "pts", packet->pts,
-               "duration", packet->duration,
-               "hdr10p_metadata_size", packet->hdr10p_metadata_size);
-       if (send_data_and_buffer(espp->fd, &data, packet->buffer, packet->buffer_size, &result) != 0)
-               return -1;
-
-       if (result.ret < 0 && error)
-               *error = result.ret_int;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_submit_eos_packet(espp_s *espp, espp_stream_type_e stream_type, espp_submit_error_e *error)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SUBMIT_EOS_PACKET);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SUBMIT_EOS_PACKET, "stream_type", stream_type);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       if (result.ret < 0 && error)
-               *error = result.ret_int;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_set_buffer_size(espp_s *espp, espp_buffer_size_type_e size_type, uint64_t size)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_BUFFER_SIZE);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_BUFFER_SIZE,
-               "size_type", size_type, "size", size);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_set_low_latency_mode(espp_s *espp, espp_low_latency_mode_e mode)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_LOW_LATENCY_MODE);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_LOW_LATENCY_MODE, "mode", mode);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_set_decoded_video_frame_buffer_type(espp_s *espp, espp_decoded_video_frame_buffer_type_e type)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_DECODED_VIDEO_FRAME_BUFFER_TYPE);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_DECODED_VIDEO_FRAME_BUFFER_TYPE, "type", type);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_take_snapshot(espp_s *espp, int id)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_TAKE_SNAPSHOT);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_TAKE_SNAPSHOT, "id", id);
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
-
-int espp_service_client_socket_request_set_render_time_offset(espp_s *espp, espp_stream_type_e stream_type, int64_t time_offset_ms)
-{
-       espp_service_data_from_client_s data;
-       espp_service_data_from_server_s result;
-
-       ASSERT(espp);
-       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
-
-       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_RENDER_TIME_OFFSET);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_RENDER_TIME_OFFSET,
-               "stream_type", stream_type, "time_offset_ms", time_offset_ms);
-
-       if (send_data(espp->fd, &data, &result) != 0)
-               return -1;
-
-       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
-
-       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
-
-       return 0;
-}
diff --git a/src/client/meson.build b/src/client/meson.build
deleted file mode 100644 (file)
index 3fae2ed..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-espp_service_client_headers = files([
-  'espp_service_client.h',
-])
-
-install_headers(espp_service_client_headers)
-
-espp_service_client_sources = files([
-  '../common/espp_service_ipc.c',
-  'espp_service_client.c',
-  'espp_service_client_socket.c',
-  'espp_service_client_msg.c',
-  'espp_service_client_event_handler.c',
-])
-
-capi_base_common_dep = dependency('capi-base-common', required: true)
-
-libespp_service_client = library('espp-service-client',
-  espp_service_client_sources,
-  dependencies: [common_deps, capi_base_common_dep],
-  include_directories: [configinc, '.'],
-  version: espp_service_version,
-  soversion: version_major,
-  install: true,
-)
-
-libespp_service_client_dep = declare_dependency(link_with : libespp_service_client,
-  include_directories : [configinc, '.']
-)
-
-pkgconfig.generate(libespp_service_client,
-  name: 'espp-service-client',
-  description: 'ESPP service client library',
-)
-
diff --git a/src/client/project_def.prop b/src/client/project_def.prop
deleted file mode 100644 (file)
index 61f1431..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# Project Name
-APPNAME = espp-service-client
-
-# Project Type
-type = sharedLib
-
-# Project Profile
-profile = tizen-8.0
-
-# Sources
-USER_SRCS = ../common/*.c ./*.c
-
-# User Defines
-USER_DEFS = USE_DLOG USE_SERVICE_APP ESPP_SERVICE_VERSION="0.3.21"
-
-# User Includes
-USER_INC_DIRS = ../common ./
-
-# User Libraries
-USER_LIBS =
-
-# Linker Flags
-USER_LFLAGS = -Xlinker -rpath='/usr/lib'
-
-# User Library Path
-USER_LIB_DIRS =
diff --git a/src/client/update_version.sh b/src/client/update_version.sh
deleted file mode 100755 (executable)
index a9c6e88..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-echo "===== Update client's project_def.prop version ====="
-VER_SPEC=$(grep "Version" ../../packaging/espp-service.spec | cut -f2 -d : | sed 's/ //g')
-VER_PROJ=$(grep -oP '(?<=VERSION=").*?(?=")' project_def.prop)
-if [ "${VER_SPEC}" != "${VER_PROJ}" ]; then
-       echo "update project_def.prop version: ${VER_PROJ} => ${VER_SPEC}"
-       sed -i "s/\(VERSION=\"\)[^\"]*\(\"\)/\1${VER_SPEC}\2/" project_def.prop
-fi
-echo "===================================================="
diff --git a/src/common/espp_service_common.h b/src/common/espp_service_common.h
deleted file mode 100644 (file)
index 04a97fe..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (c) 2023 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 __ESPP_SERVICE_COMMON_H__
-#define __ESPP_SERVICE_COMMON_H__
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdlib.h>
-#include <glib.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <string.h>
-#ifdef USE_DLOG
-#include <dlog.h>
-#endif
-#define GET_STRING(x) #x
-#define TO_STRING(x) GET_STRING(x)
-#ifndef ESPP_SERVICE_VERSION
-#define ESPP_SVC_VERSION "unknown"
-#else
-#define ESPP_SVC_VERSION TO_STRING(ESPP_SERVICE_VERSION)
-#endif
-#ifndef ESPP_SERVICE_SOCK_PATH
-#define ESPP_SVC_SOCK_PATH "/tmp/espp_service.sock"
-#else
-#define ESPP_SVC_SOCK_PATH TO_STRING(ESPP_SERVICE_SOCK_PATH)
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define FONT_COLOR_RESET    "\033[0m"
-#define FONT_COLOR_RED      "\033[31m"
-#define FONT_COLOR_GREEN    "\033[32m"
-#define FONT_COLOR_YELLOW   "\033[33m"
-#define FONT_COLOR_BLUE     "\033[34m"
-#define FONT_COLOR_PURPLE   "\033[35m"
-#define FONT_COLOR_CYAN     "\033[36m"
-#define FONT_COLOR_GRAY     "\033[37m"
-
-#ifdef USE_DLOG
-#ifndef LOGI
-#define LOGI(fmt, arg...) dlog_print(DLOG_INFO, LOG_TAG, "%s (%d) %s : " fmt, __FILE__, __LINE__, __FUNCTION__, ##arg)
-#endif
-#ifndef LOGD
-#define LOGD(fmt, arg...) dlog_print(DLOG_DEBUG, LOG_TAG, "%s (%d) %s : " fmt, __FILE__, __LINE__, __FUNCTION__, ##arg)
-#endif
-#ifndef LOGW
-#define LOGW(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, "%s (%d) %s : " fmt, __FILE__, __LINE__, __FUNCTION__, ##arg)
-#endif
-#ifndef LOGE
-#define LOGE(fmt, arg...) dlog_print(DLOG_ERROR, LOG_TAG, "%s (%d) %s : " fmt, __FILE__, __LINE__, __FUNCTION__, ##arg)
-#endif
-
-#define LOG_DEBUG(fmt, arg...) \
-do { \
-       LOGD(FONT_COLOR_RESET""fmt""FONT_COLOR_RESET, ##arg); \
-} while (0)
-
-#define LOG_INFO(fmt, arg...) \
-do { \
-       LOGI(FONT_COLOR_GREEN""fmt""FONT_COLOR_RESET, ##arg); \
-} while (0)
-
-#define LOG_WARNING(fmt, arg...) \
-do { \
-       LOGW(FONT_COLOR_YELLOW""fmt""FONT_COLOR_RESET, ##arg); \
-} while (0)
-
-#define LOG_ERROR(fmt, arg...) \
-do { \
-       LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \
-} while (0)
-
-#define LOG_DEBUG_ENTER() \
-do { \
-       LOGD(FONT_COLOR_PURPLE"<Enter>"FONT_COLOR_RESET); \
-} while (0)
-
-#define LOG_DEBUG_LEAVE() \
-do { \
-       LOGD(FONT_COLOR_PURPLE"<Leave>"FONT_COLOR_RESET); \
-} while (0)
-
-#define LOG_INFO_OR_DEBUG(expr, fmt, arg...) \
-do { \
-       if ((expr)) \
-               LOGI(FONT_COLOR_GREEN""fmt""FONT_COLOR_RESET, ##arg); \
-       else \
-               LOGD(FONT_COLOR_RESET""fmt""FONT_COLOR_RESET, ##arg); \
-} while (0)
-
-#else
-#define LOG_DEBUG(fmt, arg...) printf(FONT_COLOR_RESET""fmt"\n"FONT_COLOR_RESET, ##arg);
-#define LOG_INFO(fmt, arg...) printf(FONT_COLOR_GREEN""fmt"\n"FONT_COLOR_RESET, ##arg);
-#define LOG_WARNING(fmt, arg...) printf(FONT_COLOR_YELLOW""fmt"\n"FONT_COLOR_RESET, ##arg);
-#define LOG_ERROR(fmt, arg...) printf(FONT_COLOR_RED""fmt"\n"FONT_COLOR_RESET, ##arg);
-#define LOG_DEBUG_ENTER() printf(FONT_COLOR_PURPLE"<Enter>\n"FONT_COLOR_RESET);
-#define LOG_DEBUG_LEAVE() printf(FONT_COLOR_PURPLE"<Leave>\n"FONT_COLOR_RESET);
-#define LOG_INFO_OR_DEBUG(info, fmt, arg...) printf(FONT_COLOR_GREEN""fmt"\n"FONT_COLOR_RESET, ##arg);
-#endif
-
-#define RET_IF(expr, fmt, arg...) \
-do { \
-       if ((expr)) { \
-               LOG_ERROR(""fmt"", ##arg); \
-               return; \
-       } \
-} while (0)
-
-#define RET_VAL_IF(expr, val, fmt, arg...) \
-do { \
-       if ((expr)) { \
-               LOG_ERROR(""fmt"", ##arg); \
-               return (val);\
-       } \
-} while (0)
-
-#define UNLIKELY(x) (__builtin_expect(!!(x),0))
-#define ASSERT(expr) \
-do {\
-       if (UNLIKELY(!(expr))) { \
-               LOG_ERROR("Assertion '%s' failed. Aborting.", #expr); \
-               abort(); \
-       } \
-} while (0)
-
-#define STRNCPY(x_dst, x_src, x_size) \
-do { \
-       ASSERT(x_dst); \
-       ASSERT(x_src); \
-       ASSERT(x_size > 0); \
-       strncpy(x_dst, x_src, x_size); \
-       x_dst[x_size - 1] = '\0';\
-} while (0) \
-
-#define ESPP_SERVICE_SOCK ESPP_SVC_SOCK_PATH
-#define MAX_ERROR_LEN 64
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __ESPP_SERVICE_COMMON_H__ */
diff --git a/src/common/espp_service_ipc.c b/src/common/espp_service_ipc.c
deleted file mode 100644 (file)
index e1ad63f..0000000
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Copyright (c) 2023 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 "espp_service_common.h"
-#include "espp_service_ipc.h"
-#ifdef USE_SERVICE_APP
-#include <app_common.h>
-#endif
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#define LOG_TAG "ESPP_SERVICE_IPC"
-#endif
-
-static espp_service_ipc_data_s requests[] = {
-       [ESPP_SERVICE_REQUEST_INIT_EVENT] = { "InitEvent", "i" },
-       [ESPP_SERVICE_REQUEST_CREATE] = { "Create", "i" },
-       [ESPP_SERVICE_REQUEST_DESTROY] = {"Destroy", NULL },
-       [ESPP_SERVICE_REQUEST_OPEN] = { "Open", NULL },
-       [ESPP_SERVICE_REQUEST_CLOSE] = { "Close", NULL },
-       [ESPP_SERVICE_REQUEST_START] = { "Start", NULL },
-       [ESPP_SERVICE_REQUEST_STOP] = { "Stop", NULL },
-       [ESPP_SERVICE_REQUEST_PAUSE] = { "Pause", NULL },
-       [ESPP_SERVICE_REQUEST_RESUME] = { "Resume", NULL },
-       [ESPP_SERVICE_REQUEST_PREPARE_ASYNC] = { "PrepareAsync", NULL },
-       [ESPP_SERVICE_REQUEST_SEEK] = { "Seek", "k" },
-       [ESPP_SERVICE_REQUEST_GET_STATE] = { "GetState", NULL },
-       [ESPP_SERVICE_REQUEST_GET_PLAYING_TIME] = { "GetPlayingTime", NULL },
-       [ESPP_SERVICE_REQUEST_SET_AUDIO_STREAM_INFO] = { "SetAudioStreamInfo", "suiuuu" },
-       [ESPP_SERVICE_REQUEST_SET_VIDEO_STREAM_INFO] = { "SetVideoStreamInfo", "suiuuuuuu" },
-       [ESPP_SERVICE_REQUEST_SET_PLAYBACK_RATE] = { "SetPlaybackRate", "db" },
-       [ESPP_SERVICE_REQUEST_SET_DISPLAY_SURFACE_ID] = { "SetDisplaySurfaceId", "iuiiii" },
-       [ESPP_SERVICE_REQUEST_SET_DISPLAY_MODE] = { "SetDisplayMode", "i" },
-       [ESPP_SERVICE_REQUEST_SET_DISPLAY_ROI] = { "SetDisplayRoi", "iiii" },
-       [ESPP_SERVICE_REQUEST_SET_DISPLAY_VISIBLE] = { "SetDisplayVisible", "b" },
-       [ESPP_SERVICE_REQUEST_SET_DISPLAY_ROTATION] = { "SetDisplayRotation", "i" },
-       [ESPP_SERVICE_REQUEST_SET_AUDIO_MUTE] = { "SetAudioMute", "b" },
-       [ESPP_SERVICE_REQUEST_SET_AUDIO_VOLUME] = { "SetAudioVolume", "i" },
-       [ESPP_SERVICE_REQUEST_GET_AUDIO_VOLUME] = { "GetAudioVolume", NULL },
-       [ESPP_SERVICE_REQUEST_SUBMIT_PACKET] = { "SubmitPacket", "iukku" },
-       [ESPP_SERVICE_REQUEST_SUBMIT_EOS_PACKET] = { "SubmitEosPacket", "i" },
-       [ESPP_SERVICE_REQUEST_SET_BUFFER_SIZE] = { "SetBufferSize", "ik" },
-       [ESPP_SERVICE_REQUEST_SET_LOW_LATENCY_MODE] = { "SetLowLatencyMode", "i" },
-       [ESPP_SERVICE_REQUEST_SET_DECODED_VIDEO_FRAME_BUFFER_TYPE] = { "SetDecodedVideoFrameBufferType", "i" },
-       [ESPP_SERVICE_REQUEST_TAKE_SNAPSHOT] = { "TakeSnapshot", "i" },
-       [ESPP_SERVICE_REQUEST_SET_RENDER_TIME_OFFSET] = { "SetRenderTimeOffset", "il" },
-       [ESPP_SERVICE_REQUEST_SET_CALLBACK] = { "SetCallback", "i" },
-};
-
-static espp_service_ipc_data_s events[] = {
-       [ESPP_SERVICE_EVENT_MSG] = { "Message", "s" },
-       [ESPP_SERVICE_EVENT_CB_READY_TO_PREPARE] = { "ReadyToPrepareCB", "i" },
-       [ESPP_SERVICE_EVENT_CB_PREPARE_ASYNC_DONE] = { "PrepareAsyncDoneCB", "b" },
-       [ESPP_SERVICE_EVENT_CB_READY_TO_SEEK] = { "ReadyToSeekCB", "ik" },
-       [ESPP_SERVICE_EVENT_CB_SEEK_DONE] = { "SeekDoneCB", NULL },
-       [ESPP_SERVICE_EVENT_CB_EOS] = { "EosCB", NULL },
-       [ESPP_SERVICE_EVENT_CB_BUFFER_STATUS] = { "BufferStatusCB", "ii" },
-       [ESPP_SERVICE_EVENT_CB_RESOURCE_CONFLICTED] = { "PrepareAsyncDoneCB", NULL },
-       [ESPP_SERVICE_EVENT_CB_ERROR] = { "ErrorCB", "i" },
-       [ESPP_SERVICE_EVENT_CB_SNAPSHOT] = { "SnapshotCB", "iuuu" },
-};
-
-const char *data_type_strs[] = {
-       [ESPP_SERVICE_DATA_TYPE_BOOL] = "bool",
-       [ESPP_SERVICE_DATA_TYPE_INT] = "int",
-       [ESPP_SERVICE_DATA_TYPE_INT64] = "int64",
-       [ESPP_SERVICE_DATA_TYPE_UINT] = "uint",
-       [ESPP_SERVICE_DATA_TYPE_UINT64] = "uint64",
-       [ESPP_SERVICE_DATA_TYPE_DOUBLE] = "double",
-       [ESPP_SERVICE_DATA_TYPE_STRING] = "string",
-};
-
-typedef struct {
-       va_list ap;
-       const char *formats;
-       int count;
-} formats_data_s;
-
-static void __json_obj_foreach_func(JsonObject *object, const gchar *name, JsonNode *node, gpointer user_data)
-{
-       formats_data_s *data  = (formats_data_s *)user_data;
-       char c;
-       JsonObject *member = json_node_get_object(node);
-
-       ASSERT(data);
-       ASSERT(member);
-
-       switch ((c = *(data->formats + data->count++))) {
-       case 'b':
-               *(va_arg(data->ap, bool*)) = json_object_get_boolean_member(member, data_type_strs[ESPP_SERVICE_DATA_TYPE_BOOL]);
-               break;
-       case 'i':
-               *(va_arg(data->ap, int*)) = json_object_get_int_member(member, data_type_strs[ESPP_SERVICE_DATA_TYPE_INT]);
-               break;
-       case 'l':
-               *(va_arg(data->ap, int64_t*)) = json_object_get_int_member(member, data_type_strs[ESPP_SERVICE_DATA_TYPE_INT64]);
-               break;
-       case 'u':
-               *(va_arg(data->ap, unsigned int*)) = json_object_get_int_member(member, data_type_strs[ESPP_SERVICE_DATA_TYPE_UINT]);
-               break;
-       case 'k':
-               *(va_arg(data->ap, uint64_t*)) = json_object_get_int_member(member, data_type_strs[ESPP_SERVICE_DATA_TYPE_UINT64]);
-               break;
-       case 'd':
-               *(va_arg(data->ap, double*)) = json_object_get_double_member(member, data_type_strs[ESPP_SERVICE_DATA_TYPE_DOUBLE]);
-               break;
-       case 's':
-               *(va_arg(data->ap, char**)) =  g_strdup(json_object_get_string_member(member, data_type_strs[ESPP_SERVICE_DATA_TYPE_STRING]));
-               break;
-       default:
-               LOG_ERROR("not supported format[%c]", c);
-       }
-}
-
-espp_service_ipc_data_s *espp_service_common_get_requests()
-{
-       return requests;
-}
-espp_service_ipc_data_s *espp_service_common_get_events()
-{
-       return events;
-}
-
-int espp_service_common_parse_json_structured_message(va_list ap, const char *message, const char *formats)
-{
-       g_autoptr(JsonParser) parser = NULL;
-       JsonNode *root;
-       JsonObject *object;
-       JsonObject *params;
-       formats_data_s data = { .formats = formats, .count = 0 };
-
-       ASSERT(message);
-       ASSERT(formats);
-
-       va_copy(data.ap, ap);
-
-       parser = json_parser_new();
-
-       if (!json_parser_load_from_data(parser, message, -1, NULL)) {
-               LOG_ERROR("failed to json_parser_load_from_data()");
-               return -1;
-       }
-
-       root = json_parser_get_root(parser);
-       if (!JSON_NODE_HOLDS_OBJECT(root)) {
-               LOG_ERROR("failed to JSON_NODE_HOLDS_OBJECT()");
-               return -1;
-       }
-
-       object = json_node_get_object(root);
-       if (!(params = json_object_get_object_member(object, "params"))) {
-               LOG_ERROR("params object is NULL");
-               return -1;
-       }
-
-       json_object_foreach_member(params, __json_obj_foreach_func, &data);
-
-       va_end(data.ap);
-
-       return 0;
-}
-
-JsonObject *espp_service_common_make_json_object_params(va_list ap, const char *formats, JsonObject *object)
-{
-       char c;
-       JsonObject *params = json_object_new();
-       JsonObject *member;
-
-       ASSERT(object);
-
-       while (*formats) {
-               member = json_object_new();
-               switch ((c = *formats++)) {
-               case 'b':
-                       json_object_set_object_member(params, (const gchar*)va_arg(ap, char *), member);
-                       json_object_set_boolean_member(member,
-                               data_type_strs[ESPP_SERVICE_DATA_TYPE_BOOL], (gboolean)va_arg(ap, int));
-                       break;
-               case 'i':
-                       json_object_set_object_member(params, (const gchar*)va_arg(ap, char *), member);
-                       json_object_set_int_member(member,
-                               data_type_strs[ESPP_SERVICE_DATA_TYPE_INT], (gint64)va_arg(ap, int));
-                       break;
-               case 'l':
-                       json_object_set_object_member(params, (const gchar*)va_arg(ap, char *), member);
-                       json_object_set_int_member(member,
-                               data_type_strs[ESPP_SERVICE_DATA_TYPE_INT64], (gint64)va_arg(ap, int64_t));
-                       break;
-               case 'u':
-                       json_object_set_object_member(params, (const gchar*)va_arg(ap, char *), member);
-                       json_object_set_int_member(member,
-                               data_type_strs[ESPP_SERVICE_DATA_TYPE_UINT], (gint64)va_arg(ap, unsigned int));
-                       break;
-               case 'k':
-                       json_object_set_object_member(params, (const gchar*)va_arg(ap, char *), member);
-                       json_object_set_int_member(member,
-                               data_type_strs[ESPP_SERVICE_DATA_TYPE_UINT64], (gint64)va_arg(ap, uint64_t));
-                       break;
-               case 'd':
-                       json_object_set_object_member(params, (const gchar*)va_arg(ap, char *), member);
-                       json_object_set_double_member(member,
-                               data_type_strs[ESPP_SERVICE_DATA_TYPE_DOUBLE], (gdouble)va_arg(ap, double));
-                       break;
-               case 's':
-                       json_object_set_object_member(params, (const gchar*)va_arg(ap, char *), member);
-                       json_object_set_string_member(member,
-                               data_type_strs[ESPP_SERVICE_DATA_TYPE_STRING], (const gchar*)va_arg(ap, char *));
-                       break;
-               default:
-                       LOG_ERROR("not supported format[%c]", c);
-                       json_object_unref(member);
-                       json_object_unref(params);
-                       json_object_unref(object);
-                       return NULL;
-               }
-       }
-
-       json_object_set_object_member(object, "params", params);
-
-       return object;
-}
-
-/* Use g_free() to release the return value. */
-gchar *espp_service_common_get_string_from_json_object(JsonObject *object)
-{
-       g_autoptr(JsonNode) root = NULL;
-       g_autoptr(JsonGenerator) generator = NULL;
-
-       ASSERT(object);
-
-       root = json_node_init_object(json_node_alloc(), object);
-       generator = json_generator_new();
-       json_generator_set_root(generator, root);
-       return json_generator_to_data(generator, NULL);
-}
-
-/* Use g_free() to release the return value. */
-gchar *espp_service_common_msg_params_new(const char *formats, ...)
-{
-       gchar *result = NULL;
-       JsonObject *obj;
-       va_list ap;
-
-       ASSERT(formats);
-
-       obj = json_object_new();
-
-       va_start(ap, formats);
-       obj = espp_service_common_make_json_object_params(ap, formats, obj);
-       va_end(ap);
-
-       if (!obj)
-               return NULL;
-
-       result = espp_service_common_get_string_from_json_object(obj);
-       json_object_unref(obj);
-
-       LOG_DEBUG("params: %s", result);
-
-       return result;
-}
-
-/* Use g_free() to release the return value. */
-gchar *espp_service_common_get_sock_file_path(void)
-{
-       char *app_data_path = NULL;
-       gchar *result;
-
-#ifdef USE_SERVICE_APP
-       app_data_path = app_get_data_path();
-#endif
-       if (app_data_path) {
-               result = g_strdup_printf("%s%s", app_data_path, "espp_service.sock");
-               free(app_data_path);
-       } else {
-               result = g_strdup_printf("%s", ESPP_SERVICE_SOCK);
-       }
-
-       LOG_INFO("sock_file[%s]", result);
-       return result;
-}
diff --git a/src/common/espp_service_ipc.h b/src/common/espp_service_ipc.h
deleted file mode 100644 (file)
index c270628..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2023 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 __ESPP_SERVICE_IPC_H__
-#define __ESPP_SERVICE_IPC_H__
-
-#include <stdarg.h>
-#include <json-glib/json-glib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MAX_PARAMS_LEN 1024
-
-typedef enum {
-       ESPP_SERVICE_REQUEST_INIT_EVENT,
-       ESPP_SERVICE_REQUEST_CREATE,
-       ESPP_SERVICE_REQUEST_DESTROY,
-       ESPP_SERVICE_REQUEST_OPEN,
-       ESPP_SERVICE_REQUEST_CLOSE,
-       ESPP_SERVICE_REQUEST_START,
-       ESPP_SERVICE_REQUEST_STOP,
-       ESPP_SERVICE_REQUEST_PAUSE,
-       ESPP_SERVICE_REQUEST_RESUME,
-       ESPP_SERVICE_REQUEST_PREPARE_ASYNC,
-       ESPP_SERVICE_REQUEST_SEEK,
-       ESPP_SERVICE_REQUEST_GET_STATE,
-       ESPP_SERVICE_REQUEST_GET_PLAYING_TIME,
-       ESPP_SERVICE_REQUEST_SET_AUDIO_STREAM_INFO,
-       ESPP_SERVICE_REQUEST_SET_VIDEO_STREAM_INFO,
-       ESPP_SERVICE_REQUEST_SET_PLAYBACK_RATE,
-       ESPP_SERVICE_REQUEST_SET_DISPLAY_SURFACE_ID,
-       ESPP_SERVICE_REQUEST_SET_DISPLAY_MODE,
-       ESPP_SERVICE_REQUEST_SET_DISPLAY_ROI,
-       ESPP_SERVICE_REQUEST_SET_DISPLAY_VISIBLE,
-       ESPP_SERVICE_REQUEST_SET_DISPLAY_ROTATION,
-       ESPP_SERVICE_REQUEST_SET_AUDIO_MUTE,
-       ESPP_SERVICE_REQUEST_SET_AUDIO_VOLUME,
-       ESPP_SERVICE_REQUEST_GET_AUDIO_VOLUME,
-       ESPP_SERVICE_REQUEST_SUBMIT_PACKET,
-       ESPP_SERVICE_REQUEST_SUBMIT_EOS_PACKET,
-       ESPP_SERVICE_REQUEST_SET_BUFFER_SIZE,
-       ESPP_SERVICE_REQUEST_SET_LOW_LATENCY_MODE,
-       ESPP_SERVICE_REQUEST_SET_DECODED_VIDEO_FRAME_BUFFER_TYPE,
-       ESPP_SERVICE_REQUEST_TAKE_SNAPSHOT,
-       ESPP_SERVICE_REQUEST_SET_RENDER_TIME_OFFSET,
-       ESPP_SERVICE_REQUEST_SET_CALLBACK,
-       ESPP_SERVICE_REQUEST_NUM,
-} espp_service_request_e;
-
-typedef enum {
-       ESPP_SERVICE_EVENT_MSG,
-       ESPP_SERVICE_EVENT_CB_READY_TO_PREPARE,
-       ESPP_SERVICE_EVENT_CB_PREPARE_ASYNC_DONE,
-       ESPP_SERVICE_EVENT_CB_READY_TO_SEEK,
-       ESPP_SERVICE_EVENT_CB_SEEK_DONE,
-       ESPP_SERVICE_EVENT_CB_EOS,
-       ESPP_SERVICE_EVENT_CB_BUFFER_STATUS,
-       ESPP_SERVICE_EVENT_CB_RESOURCE_CONFLICTED,
-       ESPP_SERVICE_EVENT_CB_ERROR,
-       ESPP_SERVICE_EVENT_CB_SNAPSHOT,
-       ESPP_SERVICE_EVENT_CB_NUM,
-} espp_service_event_e;
-
-enum {
-       ESPP_SERVICE_DATA_TYPE_BOOL,
-       ESPP_SERVICE_DATA_TYPE_INT,
-       ESPP_SERVICE_DATA_TYPE_INT64,
-       ESPP_SERVICE_DATA_TYPE_UINT,
-       ESPP_SERVICE_DATA_TYPE_UINT64,
-       ESPP_SERVICE_DATA_TYPE_DOUBLE,
-       ESPP_SERVICE_DATA_TYPE_STRING,
-};
-
-typedef struct {
-       union {
-               int ret;
-               espp_service_request_e request;
-       };
-       char params[MAX_PARAMS_LEN];
-} espp_service_data_from_client_s;
-
-typedef struct {
-       union {
-               int ret;
-               espp_service_event_e event;
-       };
-       union {
-               uint64_t ret_uint64;
-               int ret_int;
-       };
-       char params[MAX_PARAMS_LEN];
-} espp_service_data_from_server_s;
-
-typedef struct {
-       const char *str;
-       const char *param_formats; /* 'b':bool, 'i':int, 'l':int64, 'u':uint, 'k':uint64, 'd':double, 's':string */
-} espp_service_ipc_data_s;
-
-espp_service_ipc_data_s *espp_service_common_get_requests();
-espp_service_ipc_data_s *espp_service_common_get_events();
-int espp_service_common_parse_json_structured_message(va_list ap, const char *message, const char *formats);
-JsonObject *espp_service_common_make_json_object_params(va_list ap, const char *formats, JsonObject *object);
-gchar *espp_service_common_get_string_from_json_object(JsonObject *object);
-gchar *espp_service_common_msg_params_new(const char *formats, ...);
-gchar *espp_service_common_get_sock_file_path(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __ESPP_SERVICE_IPC_H__ */
diff --git a/src/daemon/espp_service.c b/src/daemon/espp_service.c
deleted file mode 100644 (file)
index e6b58fe..0000000
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * Copyright (c) 2023 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 "espp_service_priv.h"
-
-#include <stdio.h>
-#include <getopt.h>
-#include <sys/stat.h>
-#ifdef USE_SERVICE_APP
-#include <service_app.h>
-static espp_service_s g_svc = { NULL, NULL, -1, 0, NULL };
-#else
-static espp_service_s g_svc = { NULL, false, -1, 0, NULL };
-static struct sigaction g_int_old_action;
-static struct sigaction g_abrt_old_action;
-static struct sigaction g_segv_old_action;
-static struct sigaction g_term_old_action;
-static struct sigaction g_sys_old_action;
-static struct sigaction g_xcpu_old_action;
-#endif
-
-#ifndef USE_SERVICE_APP
-static void print_usage()
-{
-       g_print("Usage : ");
-       g_print("espp-service [option]\n\n"
-               "  -s, --start                     start the ESPP service\n"
-               "  -h, --help                      help\n");
-}
-
-static int get_option(int argc, char **argv, espp_service_s *svc)
-{
-       int opt;
-       int opt_idx = 0;
-
-       ASSERT(argv);
-       ASSERT(svc);
-
-       static struct option long_options[] = {
-               { "start", required_argument, 0, 's' },
-               { "help", no_argument, 0, 'h' },
-               { 0, 0, 0, 0 }
-       };
-
-       while (1) {
-               if ((opt = getopt_long(argc, argv, "sh", long_options, &opt_idx)) == -1)
-                       break;
-
-               switch (opt) {
-               case 's':
-                       svc->start_service = true;
-                       break;
-               case 'h':
-               default:
-                       print_usage();
-                       return 0;
-               }
-       }
-
-       return 0;
-}
-
-static void __sa_handler(int signal)
-{
-       LOG_ERROR("-------------------- signal[%d] --------------------", signal);
-
-       /* signal block -------------- */
-       sigset_t old_mask, all_mask;
-       sigfillset(&all_mask);
-       sigprocmask(SIG_BLOCK, &all_mask, &old_mask);
-
-       g_hash_table_destroy(g_svc.fd_table);
-       espp_service_deinit_socket(&g_svc);
-
-       sigprocmask(SIG_SETMASK, &old_mask, NULL);
-       /* signal unblock ------------ */
-
-       switch (signal) {
-       case SIGINT:
-               sigaction(SIGINT, &g_int_old_action, NULL);
-               LOG_DEBUG("SIGINT");
-               break;
-       case SIGABRT:
-               sigaction(SIGABRT, &g_abrt_old_action, NULL);
-               LOG_DEBUG("SIGABRT");
-               break;
-       case SIGSEGV:
-               sigaction(SIGSEGV, &g_segv_old_action, NULL);
-               LOG_DEBUG("SIGSEGV");
-               break;
-       case SIGTERM:
-               sigaction(SIGTERM, &g_term_old_action, NULL);
-               LOG_DEBUG("SIGTERM");
-               break;
-       case SIGSYS:
-               sigaction(SIGSYS, &g_sys_old_action, NULL);
-               LOG_DEBUG("SIGSYS");
-               break;
-       case SIGXCPU:
-               sigaction(SIGXCPU, &g_xcpu_old_action, NULL);
-               LOG_DEBUG("SIGXCPU");
-               break;
-       default:
-               LOG_DEBUG("not supported, signal[%d]", signal);
-               break;
-       }
-
-       raise(signal);
-
-       LOG_ERROR("----------------------------------------------------");
-}
-
-static void initialize_signals(void)
-{
-       struct sigaction action;
-       action.sa_handler = __sa_handler;
-       action.sa_flags = SA_NOCLDSTOP;
-
-       sigemptyset(&action.sa_mask);
-
-       sigaction(SIGINT, &action, &g_int_old_action);
-       sigaction(SIGABRT, &action, &g_abrt_old_action);
-       sigaction(SIGSEGV, &action, &g_segv_old_action);
-       sigaction(SIGTERM, &action, &g_term_old_action);
-       sigaction(SIGSYS, &action, &g_sys_old_action);
-       sigaction(SIGXCPU, &action, &g_xcpu_old_action);
-
-       LOG_DEBUG_LEAVE();
-}
-
-static void deinitialize_signals(void)
-{
-       sigaction(SIGINT, &g_int_old_action, NULL);
-       sigaction(SIGABRT, &g_abrt_old_action, NULL);
-       sigaction(SIGSEGV, &g_segv_old_action, NULL);
-       sigaction(SIGTERM, &g_term_old_action, NULL);
-       sigaction(SIGSYS, &g_sys_old_action, NULL);
-       sigaction(SIGXCPU, &g_xcpu_old_action, NULL);
-
-       LOG_DEBUG_LEAVE();
-}
-
-static void run(espp_service_s *svc)
-{
-       ASSERT(svc);
-
-       svc->mainloop = g_main_loop_new(NULL, TRUE);
-       ASSERT(svc->mainloop);
-
-       LOG_DEBUG("run mainloop[%p]", svc->mainloop);
-       g_main_loop_run(svc->mainloop);
-
-       LOG_DEBUG_LEAVE();
-}
-#else
-#define NUM_OF_CLIENTS_CHECK_TIMER_SEC    10
-
-static gboolean __timer_cb(gpointer data)
-{
-       espp_service_s *svc = (espp_service_s *)data;
-       guint num_of_clients;
-
-       ASSERT(svc);
-       ASSERT(svc->fd_table);
-
-       if ((num_of_clients = g_hash_table_size(svc->fd_table)) == 0) {
-               LOG_WARNING("num of clients is 0, quit main loop to exit service...");
-               g_main_loop_quit(svc->mainloop);
-               return G_SOURCE_REMOVE;
-       }
-
-       LOG_DEBUG("num of clients[%d]", num_of_clients);
-       return G_SOURCE_CONTINUE;
-}
-
-static gpointer __loop_thread_func(gpointer data)
-{
-       espp_service_s *svc = (espp_service_s *)data;
-
-       ASSERT(svc);
-
-       g_timeout_add_seconds(NUM_OF_CLIENTS_CHECK_TIMER_SEC, __timer_cb, svc);
-
-       LOG_DEBUG("loop[%p] runs", svc->mainloop);
-       g_main_loop_run(svc->mainloop);
-
-       g_main_loop_unref(svc->mainloop);
-       svc->mainloop = NULL;
-
-       service_app_exit();
-       LOG_DEBUG("request to exit service");
-
-       return NULL;
-}
-
-static bool svc_app_create_cb(void *user_data)
-{
-       espp_service_s *svc = (espp_service_s *)user_data;
-
-       ASSERT(svc);
-       LOG_INFO("svc[%p]", svc);
-
-       if (espp_service_init_socket(svc) != 0)
-               return false;
-
-       svc->fd_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, espp_service_handle_destroy_cb);
-
-       svc->mainloop = g_main_loop_new(NULL, FALSE);
-       svc->thread = g_thread_new("loop-thread-for-timer", __loop_thread_func, svc);
-
-       return true;
-}
-
-static void svc_app_terminate_cb(void *user_data)
-{
-       espp_service_s *svc = (espp_service_s *)user_data;
-
-       ASSERT(svc);
-       LOG_INFO("svc[%p]", svc);
-
-       g_hash_table_destroy(svc->fd_table);
-       espp_service_deinit_socket(svc);
-
-       g_thread_join(svc->thread);
-       LOG_DEBUG("thread[%p] joined", svc->thread);
-       svc->thread = NULL;
-
-       LOG_WARNING("exit");
-}
-
-static void svc_app_control_cb(app_control_h app_control, void *user_data)
-{
-       char *app_id = NULL;
-       char *operation = NULL;
-       espp_service_s *svc = (espp_service_s *)user_data;
-
-       ASSERT(svc);
-       LOG_INFO("app_control[%p], svc[%p]", app_control, svc);
-
-       if (app_control_get_app_id(app_control, &app_id) != APP_CONTROL_ERROR_NONE) {
-               LOG_ERROR("failed to app_control_get_app_id()");
-               goto exit;
-       }
-
-       if (app_control_get_operation(app_control, &operation) != APP_CONTROL_ERROR_NONE) {
-               LOG_ERROR("failed to app_control_get_operation()");
-               goto exit;
-       }
-
-       LOG_INFO("app_id[%s] operation[%s]", app_id, operation);
-
-exit:
-       if (app_id)
-               free(app_id);
-       if (operation)
-               free(operation);
-}
-#endif
-
-int main(int argc, char *argv[])
-{
-       LOG_WARNING("launched, version[%s]", ESPP_SVC_VERSION);
-
-#ifndef USE_SERVICE_APP
-       if (get_option(argc, argv, &g_svc))
-               return 1;
-
-       if (!g_svc.start_service) {
-               LOG_DEBUG("Use 'espp-service -s' to start the service");
-               goto exit;
-       }
-
-       initialize_signals();
-
-       signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE */
-
-       umask(0); /* change the file mode mask */
-
-       if (espp_service_init_socket(&g_svc) != 0)
-               goto exit;
-
-       g_svc.fd_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, espp_service_handle_destroy_cb);
-
-       run(&g_svc);
-
-       g_hash_table_destroy(g_svc.fd_table);
-       espp_service_deinit_socket(&g_svc);
-       deinitialize_signals();
-
-exit:
-       LOG_WARNING("exit");
-
-       return 0;
-#else
-       service_app_lifecycle_callback_s event_cb = {0, };
-       event_cb.create = svc_app_create_cb;
-       event_cb.terminate = svc_app_terminate_cb;
-       event_cb.app_control = svc_app_control_cb;
-
-       LOG_WARNING("Use service_app_main()");
-       return service_app_main(argc, argv, &event_cb, &g_svc);
-#endif
-}
diff --git a/src/daemon/espp_service_handler.c b/src/daemon/espp_service_handler.c
deleted file mode 100644 (file)
index 78dafdb..0000000
+++ /dev/null
@@ -1,1363 +0,0 @@
-/*
- * Copyright (c) 2023 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 "espp_service_priv.h"
-#include <esplusplayer_capi.h>
-#include <esplusplayer_internal.h>
-#include <inttypes.h>
-#ifndef USE_TIZEN_60
-#include <tbm_surface.h>
-#include <image_util.h>
-#endif
-
-#define USECONDS_TO_MSECONDS(usec) ((usec) / G_GINT64_CONSTANT (1000))
-#define C(b,m)              (((b) >> (m)) & 0xFF)
-#define FOURCC_STR(id)      C(id,0), C(id,8), C(id,16), C(id,24)
-
-typedef int (*set_cb_func) (esplusplayer_handle handle, void *callback, void *user_data);
-typedef void (*func_handler) (handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result);
-#ifndef USE_TIZEN_60
-static gpointer __snapshot_work_thread(gpointer data);
-#endif
-
-typedef struct {
-       set_cb_func set_cb;
-       void *callback;
-} cb_intf_s;
-
-typedef struct {
-       int fd;
-       int event_fd;
-       esplusplayer_handle espp;
-       struct {
-               GThread *thread;
-               GAsyncQueue *queue;
-       } snapshot;
-} tb_data_s;
-#ifndef USE_TIZEN_60
-typedef struct {
-       int32_t id;
-       uint32_t width;
-       uint32_t height;
-       uint32_t size;
-       unsigned char *data;
-} snapshot_data_s;
-#endif
-
-static void __handle_init_event(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-       tb_data_s *tbs;
-       g_autofree gchar *key = NULL;
-
-       result->ret = -1;
-
-       ret = espp_service_msg_parse_params(data->params, data->request, &hdata->client.handle_addr);
-       if (ret != 0)
-               return;
-
-       LOG_INFO("fd[%d], client[pid:%u, handle:0x%x]", hdata->fd, hdata->client.pid, hdata->client.handle_addr);
-
-       key = g_strdup_printf("%u_%x", hdata->client.pid, hdata->client.handle_addr);
-       RET_IF(!(tbs = g_hash_table_lookup(hdata->svc->fd_table, key)), "failed to g_hash_table_lookup(), key[%s]", key);
-
-       tbs->event_fd = hdata->fd;
-
-       result->ret = 0;
-}
-
-#ifndef USE_TIZEN_60
-typedef struct {
-       int cb_id;
-       bool exit;
-} queue_data_s;
-
-static void __release_qd(gpointer data)
-{
-       queue_data_s *qd = (queue_data_s *)data;
-
-       LOG_DEBUG("release qd[%p, exit:%d] done", qd, qd->exit);
-       g_free(qd);
-}
-
-static int __init_snapshot_thread(tb_data_s *tbs)
-{
-       ASSERT(tbs);
-       ASSERT(!tbs->snapshot.queue);
-       ASSERT(!tbs->snapshot.thread);
-
-       tbs->snapshot.queue = g_async_queue_new_full(__release_qd);
-
-       if (!(tbs->snapshot.thread = g_thread_try_new("__snapshot_work_thread", __snapshot_work_thread, (gpointer)tbs, NULL))) {
-               LOG_ERROR("failed to g_thread_try_new()");
-               g_async_queue_unref(tbs->snapshot.queue);
-               tbs->snapshot.queue = NULL;
-               return -1;
-       }
-
-       return 0;
-}
-
-static void __deinit_snapshot_thread(tb_data_s *tbs)
-{
-       queue_data_s *qd;
-
-       ASSERT(tbs);
-       ASSERT(tbs->snapshot.queue);
-       ASSERT(tbs->snapshot.thread);
-
-       qd = g_new0(queue_data_s, 1);
-       qd->exit = true;
-       g_async_queue_push_front(tbs->snapshot.queue, qd);
-
-       LOG_DEBUG("waiting for thread join...");
-       g_thread_join(tbs->snapshot.thread);
-       LOG_DEBUG("snapshot thread exits");
-
-       g_async_queue_unref(tbs->snapshot.queue);
-
-       tbs->snapshot.queue = NULL;
-       tbs->snapshot.thread = NULL;
-}
-#endif
-
-static void __handle_create(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-       esplusplayer_handle espp;
-       tb_data_s *tbs;
-
-       result->ret = -1;
-
-       ret = espp_service_msg_parse_params(data->params, data->request, &hdata->client.handle_addr);
-       if (ret != 0)
-               return;
-
-       espp = esplusplayer_create();
-       ASSERT(espp);
-
-       hdata->espp = espp;
-       hdata->key = g_strdup_printf("%u_%x", hdata->client.pid, hdata->client.handle_addr);
-
-       LOG_INFO("fd[%d], client[pid:%u, handle:0x%x], ESPP[%p]: esplusplayer_create() success",
-               hdata->fd, hdata->client.pid, hdata->client.handle_addr, espp);
-
-       tbs = g_new0(tb_data_s, 1);
-       tbs->fd = hdata->fd;
-       tbs->espp = hdata->espp;
-
-       if (!g_hash_table_insert(hdata->svc->fd_table, hdata->key, (gpointer)tbs)) {
-               LOG_ERROR("should not be reached here, key[%s] already exist", hdata->key);
-               g_hash_table_remove(hdata->svc->fd_table, hdata->key);
-               esplusplayer_destroy(espp);
-               return;
-       }
-#ifndef USE_TIZEN_60
-       if (__init_snapshot_thread(tbs) != 0) {
-               g_hash_table_remove(hdata->svc->fd_table, hdata->key);
-               esplusplayer_destroy(espp);
-               return;
-       }
-#endif
-
-       result->ret = 0;
-}
-
-static void __handle_destroy(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       tb_data_s *tbs;
-       result->ret = -1;
-
-       RET_IF(!(tbs = g_hash_table_lookup(hdata->svc->fd_table, hdata->key)), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       RET_IF(esplusplayer_destroy((esplusplayer_handle)hdata->espp) != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_destroy()");
-
-       LOG_INFO("fd[%d]: esplusplayer_destroy() success", hdata->fd);
-
-       ASSERT(g_hash_table_steal(hdata->svc->fd_table, hdata->key));
-#ifndef USE_TIZEN_60
-       __deinit_snapshot_thread(tbs);
-#endif
-
-       result->ret = 0;
-}
-
-static void __handle_open(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = esplusplayer_open((esplusplayer_handle)hdata->espp);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_open(), ESPP[%p]", hdata->espp);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_open() success", hdata->fd, hdata->espp);
-
-       result->ret = 0;
-}
-
-static void __handle_close(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = esplusplayer_close((esplusplayer_handle)hdata->espp);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_close(), ESPP[%p]", hdata->espp);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_close() success", hdata->fd, hdata->espp);
-
-       result->ret = 0;
-}
-
-static void __handle_start(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = esplusplayer_start((esplusplayer_handle)hdata->espp);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_start(), ESPP[%p]", hdata->espp);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_start() success", hdata->fd, hdata->espp);
-
-       result->ret = 0;
-}
-
-static void __handle_stop(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = esplusplayer_stop((esplusplayer_handle)hdata->espp);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_stop(), ESPP[%p]", hdata->espp);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_stop() success", hdata->fd, hdata->espp);
-
-       result->ret = 0;
-}
-
-static void __handle_pause(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = esplusplayer_pause((esplusplayer_handle)hdata->espp);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_pause(), ESPP[%p]", hdata->espp);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_pause() success", hdata->fd, hdata->espp);
-
-       result->ret = 0;
-}
-
-static void __handle_resume(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = esplusplayer_resume((esplusplayer_handle)hdata->espp);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_resume(), ESPP[%p]", hdata->espp);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_resume() success", hdata->fd, hdata->espp);
-
-       result->ret = 0;
-}
-
-static void __handle_prepare_async(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = esplusplayer_prepare_async((esplusplayer_handle)hdata->espp);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_prepare_async(), ESPP[%p]", hdata->espp);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_prepare_async() success", hdata->fd, hdata->espp);
-
-       result->ret = 0;
-}
-
-static void __handle_seek(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-       uint64_t time_ms;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = espp_service_msg_parse_params(data->params, data->request, &time_ms);
-       if (ret != 0)
-               return;
-
-       ret = esplusplayer_seek((esplusplayer_handle)hdata->espp, time_ms);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_seek(), ESPP[%p], time_ms[%" PRIu64 "]", hdata->espp, time_ms);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_seek() success, time_ms[%" PRIu64 "]", hdata->fd, hdata->espp, time_ms);
-
-       result->ret = 0;
-}
-
-
-static void __handle_get_state(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       result->ret_int = esplusplayer_get_state((esplusplayer_handle)hdata->espp);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_get_state() success, state[%d]", hdata->fd, hdata->espp, result->ret_int);
-
-       result->ret = 0;
-}
-
-static void __handle_get_playing_time(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = esplusplayer_get_playing_time((esplusplayer_handle)hdata->espp, &result->ret_uint64);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_get_playing_time(), ESPP[%p]", hdata->espp);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_get_playing_time() success, time_ms[%" PRIu64 "]",
-               hdata->fd, hdata->espp, result->ret_uint64);
-
-       result->ret = 0;
-}
-
-guchar *__get_plain_string(const gchar *base64_str, uint32_t origin_len)
-{
-       guchar *str;
-       gsize len;
-
-       if (!base64_str)
-               return NULL;
-       if (origin_len == 0)
-               return NULL;
-
-       str = g_base64_decode(base64_str, &len);
-       ASSERT(len == origin_len);
-
-       LOG_DEBUG("base64_str[%s]", base64_str);
-
-       return str;
-}
-
-static void __handle_set_audio_stream_info(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-       esplusplayer_audio_stream_info info;
-       g_autofree guchar *codec_data = NULL;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = espp_service_msg_parse_params(data->params, data->request,
-               &info.codec_data, &info.codec_data_length, &info.mime_type,
-               &info.bitrate, &info.channels, &info.sample_rate);
-       if (ret != 0)
-               return;
-
-       /* NOTE that decoding 'codec_data' member with base64 here, see the client side. */
-       codec_data = __get_plain_string((const gchar *)info.codec_data, info.codec_data_length);
-       g_free(info.codec_data);
-       info.codec_data = (char *)codec_data;
-
-       ret = esplusplayer_set_audio_stream_info((esplusplayer_handle)hdata->espp, &info);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_audio_stream_info(), ESPP[%p]", hdata->espp);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_audio_stream_info() success", hdata->fd, hdata->espp);
-
-       result->ret = 0;
-}
-
-static void __handle_set_video_stream_info(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-       esplusplayer_video_stream_info info;
-       g_autofree guchar *codec_data = NULL;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = espp_service_msg_parse_params(data->params, data->request,
-               &info.codec_data, &info.codec_data_length, &info.mime_type,
-               &info.width, &info.height, &info.max_width, &info.max_height,
-               &info.framerate_num, &info.framerate_den);
-       if (ret != 0)
-               return;
-
-       /* NOTE that decoding 'codec_data' member with base64 here, see the client side. */
-       codec_data = __get_plain_string((const gchar *)info.codec_data, info.codec_data_length);
-       g_free(info.codec_data);
-       info.codec_data = (char *)codec_data;
-
-       ret = esplusplayer_set_video_stream_info((esplusplayer_handle)hdata->espp, &info);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_video_stream_info(), ESPP[%p]", hdata->espp);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_video_stream_info() success", hdata->fd, hdata->espp);
-
-       result->ret = 0;
-}
-
-static void __handle_set_playback_rate(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-       double rate;
-       bool mute_audio;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = espp_service_msg_parse_params(data->params, data->request,
-               &rate, &mute_audio);
-       if (ret != 0)
-               return;
-
-       ret = esplusplayer_set_playback_rate((esplusplayer_handle)hdata->espp, rate, mute_audio);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_playback_rate(), ESPP[%p], rate[%f], mute_audio[%d]",
-               hdata->espp, rate, mute_audio);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_playback_rate() success, rate[%f], mute_audio[%d]",
-               hdata->fd, hdata->espp, rate, mute_audio);
-
-       result->ret = 0;
-}
-
-static void __handle_set_display_surface_id(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-       esplusplayer_display_type type;
-       unsigned int surface_id;
-       int x, y, w, h;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = espp_service_msg_parse_params(data->params, data->request,
-               &type, &surface_id, &x, &y, &w, &h);
-       if (ret != 0)
-               return;
-
-       ret = esplusplayer_set_surface_display((esplusplayer_handle)hdata->espp, type, surface_id, x, y, w, h);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_surface_display(), ESPP[%p], surface_id[%u]", hdata->espp, surface_id);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_surface_display() success, surface_id[%u]", hdata->fd, hdata->espp, surface_id);
-
-       result->ret = 0;
-}
-
-static void __handle_set_display_mode(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-       esplusplayer_display_mode mode;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = espp_service_msg_parse_params(data->params, data->request, &mode);
-       if (ret != 0)
-               return;
-
-       ret = esplusplayer_set_display_mode((esplusplayer_handle)hdata->espp, mode);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_display_mode(), ESPP[%p], mode[%d]", hdata->espp, mode);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_display_mode() success, mode[%d]", hdata->fd, hdata->espp, mode);
-
-       result->ret = 0;
-}
-
-static void __handle_set_display_roi(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-       int x, y, w, h;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = espp_service_msg_parse_params(data->params, data->request,
-               &x, &y, &w, &h);
-       if (ret != 0)
-               return;
-
-       ret = esplusplayer_set_display_roi((esplusplayer_handle)hdata->espp, x, y, w, h);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_display_roi(), ESPP[%p], x[%d], y[%d], w[%d], h[%d]",
-               hdata->espp, x, y, w, h);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_display_roi() success, x[%d], y[%d], w[%d], h[%d]",
-               hdata->fd, hdata->espp, x, y, w, h);
-
-       result->ret = 0;
-}
-
-static void __handle_set_display_visible(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-       bool visible;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = espp_service_msg_parse_params(data->params, data->request, &visible);
-       if (ret != 0)
-               return;
-
-       ret = esplusplayer_set_display_visible((esplusplayer_handle)hdata->espp, visible);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_display_visible(), ESPP[%p], visible[%d]",
-               hdata->espp, visible);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_display_visible() success, visible[%d]", hdata->fd, hdata->espp, visible);
-
-       result->ret = 0;
-}
-
-static void __handle_set_display_rotation(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-       esplusplayer_display_rotation_type type;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = espp_service_msg_parse_params(data->params, data->request, &type);
-       if (ret != 0)
-               return;
-
-       ret = esplusplayer_set_display_rotation((esplusplayer_handle)hdata->espp, type);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_display_rotation(), ESPP[%p], type[%d]",
-               hdata->espp, type);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_display_rotation() success, type[%d]",
-               hdata->fd, hdata->espp, type);
-
-       result->ret = 0;
-}
-
-static void __handle_set_audio_mute(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-       bool mute;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = espp_service_msg_parse_params(data->params, data->request, &mute);
-       if (ret != 0)
-               return;
-
-       ret = esplusplayer_set_audio_mute((esplusplayer_handle)hdata->espp, mute);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_audio_mute(), ESPP[%p], mute[%d]", hdata->espp, mute);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_audio_mute() success, mute[%d]", hdata->fd, hdata->espp, mute);
-
-       result->ret = 0;
-}
-
-static void __handle_set_audio_volume(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-       int volume;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = espp_service_msg_parse_params(data->params, data->request, &volume);
-       if (ret != 0)
-               return;
-
-       ret = esplusplayer_set_volume((esplusplayer_handle)hdata->espp, volume);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_volume(), ESPP[%p], volume[%d]", hdata->espp, volume);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_volume() success, volume[%d]", hdata->fd, hdata->espp, volume);
-
-       result->ret = 0;
-}
-
-static void __handle_get_audio_volume(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = esplusplayer_get_volume((esplusplayer_handle)hdata->espp, &result->ret_int);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_get_volume(), ESPP[%p]", hdata->espp);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_get_volume() success, volume[%d]",
-               hdata->fd, hdata->espp, result->ret_int);
-
-       result->ret = 0;
-}
-
-static void __handle_submit_packet(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-       esplusplayer_es_packet es_packet;
-       esplusplayer_submit_status status;
-       g_autofree gchar *buffer = NULL;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       memset(&es_packet, 0x0, sizeof(esplusplayer_es_packet));
-       ret = espp_service_msg_parse_params(data->params, data->request,
-               &es_packet.type, &es_packet.buffer_size,
-               &es_packet.pts, &es_packet.duration,
-               &es_packet.hdr10p_metadata_size);
-       if (ret != 0)
-               return;
-
-       LOG_INFO_OR_DEBUG(hdata->submit_count % 100 == 0,
-               "type[%d], buffer_size[%u], pts[%" PRIu64 "], duration[%" PRIu64 "], hdr10p_metadata_size[%u]",
-               es_packet.type, es_packet.buffer_size, es_packet.pts, es_packet.duration, es_packet.hdr10p_metadata_size);
-
-       if (es_packet.buffer_size > 0) {
-               buffer = g_malloc0(es_packet.buffer_size);
-               espp_service_read_buffer(hdata->fd, buffer, es_packet.buffer_size);
-               es_packet.buffer = buffer;
-       }
-
-       status = esplusplayer_submit_packet((esplusplayer_handle)hdata->espp, &es_packet);
-       if (status != ESPLUSPLAYER_SUBMIT_STATUS_SUCCESS) {
-               result->ret_int = status;
-               LOG_ERROR("failed to esplusplayer_submit_packet(), status[%d]", status);
-               return;
-       }
-
-       LOG_INFO_OR_DEBUG(hdata->submit_count++ % 100 == 0, "fd[%d], ESPP[%p]: esplusplayer_submit_packet() success [%d]",
-               hdata->fd, hdata->espp, hdata->submit_count);
-
-       result->ret = 0;
-}
-
-static void __handle_submit_eos_packet(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-       esplusplayer_submit_status status;
-       esplusplayer_stream_type stream_type;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = espp_service_msg_parse_params(data->params, data->request, &stream_type);
-       if (ret != 0)
-               return;
-
-       status = esplusplayer_submit_eos_packet((esplusplayer_handle)hdata->espp, stream_type);
-       if (status != ESPLUSPLAYER_SUBMIT_STATUS_SUCCESS) {
-               result->ret_int = status;
-               LOG_ERROR("failed to esplusplayer_submit_eos_packet(), stream_type[%d], status[%d]", stream_type, status);
-               return;
-       }
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_submit_eos_packet() success, stream_type[%d]", hdata->fd, hdata->espp, stream_type);
-
-       result->ret = 0;
-}
-
-static void __handle_set_buffer_size(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-       esplusplayer_buffer_option option;
-       uint64_t size;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = espp_service_msg_parse_params(data->params, data->request,
-               &option, &size);
-       if (ret != 0)
-               return;
-
-       ret = esplusplayer_set_buffer_size((esplusplayer_handle)hdata->espp, option, size);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_buffer_size(), ESPP[%p], option[%d], size[%" PRIu64 "]",
-               hdata->espp, option, size);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_buffer_size() success, option[%d], size[%" PRIu64 "]",
-               hdata->fd, hdata->espp, option, size);
-
-       result->ret = 0;
-}
-
-static void __handle_set_low_latency_mode(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-       esplusplayer_low_latency_mode mode;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = espp_service_msg_parse_params(data->params, data->request, &mode);
-       if (ret != 0)
-               return;
-
-       ret = esplusplayer_set_low_latency_mode((esplusplayer_handle)hdata->espp, mode);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_low_latency_mode(), ESPP[%p], mode[0x%x]",
-               hdata->espp, mode);
-
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_low_latency_mode() success, mode[0x%x]",
-               hdata->fd, hdata->espp, mode);
-
-       result->ret = 0;
-}
-
-static void __handle_set_decoded_video_frame_buffer_type(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-       int type;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = espp_service_msg_parse_params(data->params, data->request, &type);
-       if (ret != 0)
-               return;
-
-#ifdef USE_TIZEN_60
-       LOG_WARNING("It's not supported because it's built with tizen 6.0");
-#else
-       ret = esplusplayer_set_video_frame_buffer_type((esplusplayer_handle)hdata->espp, (esplusplayer_decoded_video_frame_buffer_type)type);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_video_frame_buffer_type(), ESPP[%p], type[%d]",
-               hdata->espp, type);
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_video_frame_buffer_type() success, type[%d]",
-               hdata->fd, hdata->espp, type);
-#endif
-
-       result->ret = 0;
-}
-
-#ifndef USE_TIZEN_60
-static int __convert_colorspace(unsigned char *src_data, size_t src_size, int src_w, int src_h, image_util_colorspace_e src_colorspace, image_util_colorspace_e dst_colorspace, snapshot_data_s *result)
-{
-       int ret;
-       image_util_image_h src_image = NULL;
-       image_util_image_h dst_image = NULL;
-       transformation_h transform = NULL;
-       size_t size;
-
-       RET_VAL_IF(src_data == NULL, -1, "src_data is NULL");
-       RET_VAL_IF(result == NULL, -1, "result is NULL");
-
-       ret = image_util_create_image(src_w, src_h, src_colorspace, src_data, src_size, &src_image);
-       RET_VAL_IF(ret != IMAGE_UTIL_ERROR_NONE, -1, "failed to image_util_create_image()");
-
-       if ((ret = image_util_transform_create(&transform) != IMAGE_UTIL_ERROR_NONE)) {
-               LOG_ERROR("failed to image_util_transform_create(), ret[0x%x]", ret);
-               goto error;
-       }
-
-       if ((ret = image_util_transform_set_colorspace(transform, dst_colorspace) != IMAGE_UTIL_ERROR_NONE)) {
-               LOG_ERROR("failed to image_util_transform_set_colorspace(), ret[0x%x]", ret);
-               goto error;
-       }
-
-       if ((ret = image_util_transform_run2(transform, src_image, &dst_image) != IMAGE_UTIL_ERROR_NONE)) {
-               LOG_ERROR("failed to image_util_transform_run2(), ret[0x%x]", ret);
-               goto error;
-       }
-
-       if ((ret = image_util_get_image(dst_image, &result->width, &result->height, NULL, &result->data, &size) != IMAGE_UTIL_ERROR_NONE)) {
-               LOG_ERROR("failed to image_util_get_image(), ret[0x%x]", ret);
-               goto error;
-       }
-
-       image_util_transform_destroy(transform);
-       image_util_destroy_image(dst_image);
-       image_util_destroy_image(src_image);
-
-       result->size = (uint32_t)size;
-
-       LOG_INFO("src[data:%p, size:%zu, %dx%d, colorspace:%d] -> dst[data:%p, size:%u, %ux%u, colorspace:%d]",
-               src_data, src_size, src_w, src_h, src_colorspace, result->data, result->size, result->width, result->height, dst_colorspace);
-
-       return 0;
-error:
-       if (transform)
-               image_util_transform_destroy(transform);
-       if (dst_image)
-               image_util_destroy_image(dst_image);
-       if (src_image)
-               image_util_destroy_image(src_image);
-       return -1;
-}
-
-static int __get_image_util_colorspace(tbm_format in_format, image_util_colorspace_e *colorspace)
-{
-       switch(in_format) {
-               case TBM_FORMAT_NV12:
-                       *colorspace = IMAGE_UTIL_COLORSPACE_NV12;
-                       break;
-               case TBM_FORMAT_YUV420:
-                       *colorspace = IMAGE_UTIL_COLORSPACE_I420;
-                       break;
-               case TBM_FORMAT_BGRA8888:
-                       *colorspace = IMAGE_UTIL_COLORSPACE_BGRA8888;
-                       break;
-               case TBM_FORMAT_BGRX8888:
-                       *colorspace = IMAGE_UTIL_COLORSPACE_BGRX8888;
-                       break;
-               case TBM_FORMAT_ARGB8888:
-                       *colorspace = IMAGE_UTIL_COLORSPACE_ARGB8888;
-                       break;
-               default:
-                       LOG_ERROR("invalid tbm format");
-                       return -1;
-       }
-       return 0;
-}
-
-static int __convert_colorspace_to_rgb24(tbm_surface_h tbm_surf, snapshot_data_s *snapshot)
-{
-       guint src_size;
-       unsigned char *dst_buffer = NULL;
-       unsigned char *tmp_dst = NULL;
-       unsigned char *tmp_src = NULL;
-       unsigned int i;
-       tbm_surface_info_s info;
-       image_util_colorspace_e src_colorspace;
-
-       RET_VAL_IF(!tbm_surf, -1, "tbm_surf is NULL");
-       RET_VAL_IF(!snapshot, -1, "snapshot is NULL");
-
-       if (tbm_surface_get_info(tbm_surf, &info)) {
-         LOG_ERROR("failed to tbm_surface_get_info()");
-         return -1;
-       }
-
-       LOG_DEBUG("%c%c%c%c, %dx%d, size:%d, num of planes:%d",
-               FOURCC_STR(info.format), info.width, info.height, info.size, info.num_planes);
-
-       if (__get_image_util_colorspace(info.format, &src_colorspace) < 0) {
-               LOG_ERROR("failed to __get_image_util_color_space()");
-               return -1;
-       }
-
-       switch (src_colorspace) {
-       case IMAGE_UTIL_COLORSPACE_NV12:
-               src_size = (info.width * info.height) + (info.width * (info.height >> 1));
-
-               dst_buffer = (unsigned char *)g_malloc(src_size);
-               tmp_dst = dst_buffer;
-
-               /* Y plane */
-               tmp_src = (unsigned char *)info.planes[0].ptr;
-               for (i = 0; i < info.height; i++) {
-                       memcpy(tmp_dst, tmp_src, info.width);
-                       tmp_dst += info.width;
-                       tmp_src += info.planes[0].stride;
-               }
-               /* UV plane*/
-               tmp_src = (unsigned char *)info.planes[1].ptr;
-               for (i = 0; i < (info.height >> 1); i++) {
-                       memcpy(tmp_dst, tmp_src, info.width);
-                       tmp_dst += info.width;
-                       tmp_src += info.planes[1].stride;
-               }
-               break;
-       case IMAGE_UTIL_COLORSPACE_I420:
-               src_size = (info.width * info.height) * 2;
-
-               dst_buffer = (unsigned char *)g_malloc(src_size);
-               tmp_dst = dst_buffer;
-
-               /* Y plane */
-               tmp_src = (unsigned char *)info.planes[0].ptr;
-               for (i = 0; i < info.height; i++) {
-                       memcpy(tmp_dst, tmp_src, info.width);
-                       tmp_dst += info.width;
-                       tmp_src += info.planes[0].stride;
-               }
-               /* U plane */
-               tmp_src = (unsigned char *)info.planes[1].ptr;
-               for (i = 0; i < (info.height >> 1); i++) {
-                       memcpy(tmp_dst, tmp_src, (info.width >> 1));
-                       tmp_dst += (info.width >> 1);
-                       tmp_src += info.planes[1].stride;
-               }
-               /* V plane */
-               tmp_src = (unsigned char *)info.planes[2].ptr;
-               for (i = 0; i < (info.height >> 1); i++) {
-                       memcpy(tmp_dst, tmp_src, (info.width >> 1));
-                       tmp_dst += (info.width >> 1);
-                       tmp_src += info.planes[2].stride;
-               }
-               break;
-       case IMAGE_UTIL_COLORSPACE_BGRA8888:
-       case IMAGE_UTIL_COLORSPACE_BGRX8888:
-       case IMAGE_UTIL_COLORSPACE_ARGB8888:
-               src_size = (info.width * 4) * info.height;
-
-               dst_buffer = (unsigned char *)g_malloc(src_size);
-               memcpy(dst_buffer, info.planes[0].ptr, src_size);
-               break;
-       default:
-               LOG_ERROR("not supported format");
-               return -1;
-       }
-
-       return __convert_colorspace(dst_buffer, src_size, info.width, info.height,
-               src_colorspace, IMAGE_UTIL_COLORSPACE_RGB888, snapshot);
-}
-
-static int __get_rgb24_frame(esplusplayer_handle espp, snapshot_data_s *snapshot)
-{
-       int ret;
-       esplusplayer_decoded_video_packet pkt;
-       esplusplayer_get_decoded_video_frame_status_type status;
-       gint64 start_time = g_get_monotonic_time();
-
-       ASSERT(espp);
-       ASSERT(snapshot);
-
-       ret = esplusplayer_get_decoded_video_packet(espp, &pkt, &status);
-       RET_VAL_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, -1, "failed to esplusplayer_get_decoded_video_packet(), ESPP[%p]", espp);
-       RET_VAL_IF(status != ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_SUCCESS, -1, "failed to esplusplayer_get_decoded_video_packet(), ESPP[%p], status[%d]", espp, status);
-       LOG_DEBUG("elapsed: %"G_GINT64_FORMAT" ms (esplusplayer_get_decoded_video_packet())",
-               USECONDS_TO_MSECONDS(g_get_monotonic_time() - start_time));
-
-       if (__convert_colorspace_to_rgb24((tbm_surface_h)pkt.surface_data, snapshot) < 0)
-               goto exit;
-       LOG_DEBUG("elapsed: %"G_GINT64_FORMAT" ms (__convert_colorspace_to_rgb24())",
-               USECONDS_TO_MSECONDS(g_get_monotonic_time() - start_time));
-
-       LOG_INFO("ESPP[%p], snapshot[%ux%u, size:%u, data:%p]",
-               espp, snapshot->width, snapshot->height, snapshot->size, snapshot->data);
-exit:
-       if (esplusplayer_decoded_buffer_destroy(espp, &pkt) != ESPLUSPLAYER_ERROR_TYPE_NONE)
-               LOG_WARNING("failed to esplusplayer_decoded_buffer_destroy()");
-
-       return 0;
-}
-
-static void __snapshot_cb(tb_data_s *tbs, snapshot_data_s *snapshot)
-{
-       espp_service_data_from_server_s data = {0, };
-
-       ASSERT(tbs);
-       ASSERT(snapshot);
-
-       LOG_DEBUG("event_fd[%d], ESPP[%p]", tbs->event_fd, tbs->espp);
-
-       FILL_SOCKET_MSG_EVENT(data, ESPP_SERVICE_EVENT_CB_SNAPSHOT);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_EVENT_CB_SNAPSHOT,
-               "id", snapshot->id, "width", snapshot->width, "height", snapshot->height, "size", snapshot->size);
-
-       espp_service_send_data(tbs->event_fd, &data);
-       espp_service_send_buffer(tbs->event_fd, snapshot->data, snapshot->size);
-}
-
-static gpointer __snapshot_work_thread(gpointer data)
-{
-       tb_data_s *tbs = (tb_data_s *)data;
-       queue_data_s *qd;
-
-       while (1) {
-               snapshot_data_s snapshot = {-1, 0, 0, 0, NULL};
-
-               LOG_DEBUG("wait for data...");
-               if (!(qd = g_async_queue_pop(tbs->snapshot.queue))) {
-                       LOG_ERROR("qd is NULL");
-                       break;
-               }
-               LOG_INFO("process qd[%p, cb_id:%d, exit:%d]", qd, qd->cb_id, qd->exit);
-               if (qd->exit) {
-                       __release_qd(qd);
-                       break;
-               }
-
-               snapshot.id = qd->cb_id;
-               if (__get_rgb24_frame(tbs->espp, &snapshot) == 0) {
-                       __snapshot_cb(tbs, &snapshot);
-                       g_free(snapshot.data);
-               }
-               __release_qd(qd);
-       }
-
-       LOG_DEBUG("exit");
-       return NULL;
-}
-#endif
-
-static void __handle_take_snapshot(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-       int id;
-       tb_data_s *tbs;
-#ifndef USE_TIZEN_60
-       queue_data_s *qd;
-#endif
-
-       result->ret = -1;
-
-       RET_IF(!(tbs = g_hash_table_lookup(hdata->svc->fd_table, hdata->key)), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-#ifndef USE_TIZEN_60
-       ASSERT(tbs->snapshot.queue);
-#endif
-       ret = espp_service_msg_parse_params(data->params, data->request, &id);
-       if (ret != 0)
-               return;
-#ifdef USE_TIZEN_60
-       LOG_WARNING("It's not supported because it's built with tizen 6.0");
-#else
-       qd = g_new0(queue_data_s, 1);
-       qd->cb_id = id;
-       g_async_queue_push(tbs->snapshot.queue, qd);
-       LOG_INFO("qd[%p, cb_id:%d]", qd, id);
-#endif
-
-       result->ret = 0;
-}
-
-static void __handle_set_render_time_offset(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-       esplusplayer_stream_type stream_type;
-       int64_t time_offset_ms;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = espp_service_msg_parse_params(data->params, data->request, &stream_type, &time_offset_ms);
-       if (ret != 0)
-               return;
-#ifdef USE_TIZEN_60
-       LOG_WARNING("It's not supported because it's built with tizen 6.0");
-#else
-       ret = esplusplayer_set_render_time_offset((esplusplayer_handle)hdata->espp, stream_type, time_offset_ms);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE,
-               "failed to esplusplayer_set_render_time_offset(), ESPP[%p], stream_type[%d], time_offset_ms[%" PRId64 "]",
-               hdata->espp, stream_type, time_offset_ms);
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_render_time_offset() success, stream_type[%d], time_offset_ms[%" PRId64 "]",
-               hdata->fd, hdata->espp, stream_type, time_offset_ms);
-#endif
-
-       result->ret = 0;
-}
-
-static void __ready_to_prepare_cb(const int type, void *user_data)
-{
-       handler_userdata_s *hdata = (handler_userdata_s *)user_data;
-       tb_data_s *tbs;
-       espp_service_data_from_server_s data = {0, };
-
-       ASSERT(hdata);
-       ASSERT(hdata->svc);
-       ASSERT(hdata->fd >= 0);
-
-       LOG_DEBUG("type[%d], fd[%d], ESPP[%p]", type, hdata->fd, hdata->espp);
-
-       RET_IF(!(tbs = g_hash_table_lookup(hdata->svc->fd_table, hdata->key)), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       LOG_DEBUG("event_fd[%d], ESPP[%p]", tbs->event_fd, tbs->espp);
-
-       FILL_SOCKET_MSG_EVENT(data, ESPP_SERVICE_EVENT_CB_READY_TO_PREPARE);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_EVENT_CB_READY_TO_PREPARE, "type", type);
-
-       espp_service_send_data(tbs->event_fd, &data);
-}
-
-static void __prepare_async_done_cb(bool res, void *user_data)
-{
-       handler_userdata_s *hdata = (handler_userdata_s *)user_data;
-       tb_data_s *tbs;
-       espp_service_data_from_server_s data = {0, };
-
-       ASSERT(hdata);
-       ASSERT(hdata->svc);
-       ASSERT(hdata->fd >= 0);
-
-       LOG_DEBUG("res[%d], fd[%d], ESPP[%p]", res, hdata->fd, hdata->espp);
-
-       RET_IF(!(tbs = g_hash_table_lookup(hdata->svc->fd_table, hdata->key)), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       LOG_DEBUG("event_fd[%d], ESPP[%p]", tbs->event_fd, tbs->espp);
-
-       FILL_SOCKET_MSG_EVENT(data, ESPP_SERVICE_EVENT_CB_PREPARE_ASYNC_DONE);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_EVENT_CB_PREPARE_ASYNC_DONE, "result", res);
-       espp_service_send_data(tbs->event_fd, &data);
-}
-
-static void __ready_to_seek_cb(const int type, uint64_t time_ms, void *user_data)
-{
-       handler_userdata_s *hdata = (handler_userdata_s *)user_data;
-       tb_data_s *tbs;
-       espp_service_data_from_server_s data = {0, };
-
-       ASSERT(hdata);
-       ASSERT(hdata->svc);
-       ASSERT(hdata->fd >= 0);
-
-       LOG_DEBUG("type[%d], fd[%d], ESPP[%p]", type, hdata->fd, hdata->espp);
-
-       RET_IF(!(tbs = g_hash_table_lookup(hdata->svc->fd_table, hdata->key)), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       LOG_DEBUG("event_fd[%d], ESPP[%p]", tbs->event_fd, tbs->espp);
-
-       FILL_SOCKET_MSG_EVENT(data, ESPP_SERVICE_EVENT_CB_READY_TO_SEEK);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_EVENT_CB_READY_TO_SEEK,
-               "type", type, "time_ms", time_ms);
-
-       espp_service_send_data(tbs->event_fd, &data);
-}
-
-static void __seek_done_cb(void *user_data)
-{
-       handler_userdata_s *hdata = (handler_userdata_s *)user_data;
-       tb_data_s *tbs;
-       espp_service_data_from_server_s data = {0, };
-
-       ASSERT(hdata);
-       ASSERT(hdata->svc);
-       ASSERT(hdata->fd >= 0);
-
-       LOG_DEBUG("fd[%d], ESPP[%p]", hdata->fd, hdata->espp);
-
-       RET_IF(!(tbs = g_hash_table_lookup(hdata->svc->fd_table, hdata->key)), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       LOG_DEBUG("event_fd[%d], ESPP[%p]", tbs->event_fd, tbs->espp);
-
-       FILL_SOCKET_MSG_EVENT(data, ESPP_SERVICE_EVENT_CB_SEEK_DONE);
-       espp_service_send_data(tbs->event_fd, &data);
-}
-
-static void __eos_cb(void *user_data)
-{
-       handler_userdata_s *hdata = (handler_userdata_s *)user_data;
-       tb_data_s *tbs;
-       espp_service_data_from_server_s data = {0, };
-
-       ASSERT(hdata);
-       ASSERT(hdata->svc);
-       ASSERT(hdata->fd >= 0);
-
-       LOG_DEBUG("fd[%d], ESPP[%p]", hdata->fd, hdata->espp);
-
-       RET_IF(!(tbs = g_hash_table_lookup(hdata->svc->fd_table, hdata->key)), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       LOG_DEBUG("event_fd[%d], ESPP[%p]", tbs->event_fd, tbs->espp);
-
-       FILL_SOCKET_MSG_EVENT(data, ESPP_SERVICE_EVENT_CB_EOS);
-       espp_service_send_data(tbs->event_fd, &data);
-}
-
-static void __buffer_status_cb(const int stream_type, const int buffer_status, void *user_data)
-{
-       handler_userdata_s *hdata = (handler_userdata_s *)user_data;
-       tb_data_s *tbs;
-       espp_service_data_from_server_s data = {0, };
-
-       ASSERT(hdata);
-       ASSERT(hdata->svc);
-       ASSERT(hdata->fd >= 0);
-
-       LOG_DEBUG("stream_type[%d], buffer_status[%d], fd[%d], ESPP[%p]", stream_type, buffer_status, hdata->fd, hdata->espp);
-
-       RET_IF(!(tbs = g_hash_table_lookup(hdata->svc->fd_table, hdata->key)), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       LOG_DEBUG("event_fd[%d], ESPP[%p]", tbs->event_fd, tbs->espp);
-
-       FILL_SOCKET_MSG_EVENT(data, ESPP_SERVICE_EVENT_CB_BUFFER_STATUS);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_EVENT_CB_BUFFER_STATUS,
-               "stream_type", stream_type, "buffer_status", buffer_status);
-       espp_service_send_data(tbs->event_fd, &data);
-}
-
-static void __resource_conflicted_cb(void *user_data)
-{
-       handler_userdata_s *hdata = (handler_userdata_s *)user_data;
-       tb_data_s *tbs;
-       espp_service_data_from_server_s data = {0, };
-
-       ASSERT(hdata);
-       ASSERT(hdata->svc);
-       ASSERT(hdata->fd >= 0);
-
-       LOG_DEBUG("fd[%d], ESPP[%p]", hdata->fd, hdata->espp);
-
-       RET_IF(!(tbs = g_hash_table_lookup(hdata->svc->fd_table, hdata->key)), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       LOG_DEBUG("event_fd[%d], ESPP[%p]", tbs->event_fd, tbs->espp);
-
-       FILL_SOCKET_MSG_EVENT(data, ESPP_SERVICE_EVENT_CB_RESOURCE_CONFLICTED);
-       espp_service_send_data(tbs->event_fd, &data);
-}
-
-static void __error_cb(const int error, void *user_data)
-{
-       handler_userdata_s *hdata = (handler_userdata_s *)user_data;
-       tb_data_s *tbs;
-       espp_service_data_from_server_s data = {0, };
-
-       ASSERT(hdata);
-       ASSERT(hdata->svc);
-       ASSERT(hdata->fd >= 0);
-
-       LOG_DEBUG("error[%d], fd[%d], ESPP[%p]", error, hdata->fd, hdata->espp);
-
-       RET_IF(!(tbs = g_hash_table_lookup(hdata->svc->fd_table, hdata->key)), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       LOG_DEBUG("event_fd[%d], ESPP[%p]", tbs->event_fd, tbs->espp);
-
-       FILL_SOCKET_MSG_EVENT(data, ESPP_SERVICE_EVENT_CB_ERROR);
-       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_EVENT_CB_ERROR, "error", error);
-
-       espp_service_send_data(tbs->event_fd, &data);
-}
-
-static cb_intf_s cb_setters[] = {
-       [ESPP_SERVICE_EVENT_CB_READY_TO_PREPARE] = { (set_cb_func)esplusplayer_set_ready_to_prepare_cb, __ready_to_prepare_cb},
-       [ESPP_SERVICE_EVENT_CB_PREPARE_ASYNC_DONE] = { (set_cb_func)esplusplayer_set_prepare_async_done_cb, __prepare_async_done_cb},
-       [ESPP_SERVICE_EVENT_CB_READY_TO_SEEK] = { (set_cb_func)esplusplayer_set_ready_to_seek_cb, __ready_to_seek_cb},
-       [ESPP_SERVICE_EVENT_CB_SEEK_DONE] = { (set_cb_func)esplusplayer_set_seek_done_cb, __seek_done_cb},
-       [ESPP_SERVICE_EVENT_CB_EOS] = { (set_cb_func)esplusplayer_set_eos_cb, __eos_cb},
-       [ESPP_SERVICE_EVENT_CB_BUFFER_STATUS] = { (set_cb_func)esplusplayer_set_buffer_status_cb, __buffer_status_cb},
-       [ESPP_SERVICE_EVENT_CB_RESOURCE_CONFLICTED] = { (set_cb_func)esplusplayer_set_resource_conflicted_cb, __resource_conflicted_cb},
-       [ESPP_SERVICE_EVENT_CB_ERROR] = { (set_cb_func)esplusplayer_set_error_cb, __error_cb},
-};
-
-static void __handle_set_callback(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       int ret;
-       espp_service_event_e cb_type;
-
-       result->ret = -1;
-
-       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
-
-       ret = espp_service_msg_parse_params(data->params, data->request, &cb_type);
-       if (ret != 0)
-               return;
-
-       RET_IF(cb_type < ESPP_SERVICE_EVENT_CB_READY_TO_PREPARE || cb_type > ESPP_SERVICE_EVENT_CB_ERROR,
-               "invalid cb_type[%d]", cb_type);
-
-       ret = cb_setters[cb_type].set_cb((esplusplayer_handle)hdata->espp, cb_setters[cb_type].callback, hdata);
-       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to set an esplusplayer callback, ESPP[%p], cb_type[%d]", hdata->espp, cb_type);
-
-       LOG_INFO("fd[%d], ESPP[%p]: cb_type[%d]", hdata->fd, hdata->espp, cb_type);
-
-       result->ret = 0;
-}
-
-static func_handler handlers[] = {
-       [ESPP_SERVICE_REQUEST_INIT_EVENT] = __handle_init_event,
-       [ESPP_SERVICE_REQUEST_CREATE] = __handle_create,
-       [ESPP_SERVICE_REQUEST_DESTROY] = __handle_destroy,
-       [ESPP_SERVICE_REQUEST_OPEN] = __handle_open,
-       [ESPP_SERVICE_REQUEST_CLOSE] = __handle_close,
-       [ESPP_SERVICE_REQUEST_START] = __handle_start,
-       [ESPP_SERVICE_REQUEST_STOP] = __handle_stop,
-       [ESPP_SERVICE_REQUEST_PAUSE] = __handle_pause,
-       [ESPP_SERVICE_REQUEST_RESUME] = __handle_resume,
-       [ESPP_SERVICE_REQUEST_PREPARE_ASYNC] = __handle_prepare_async,
-       [ESPP_SERVICE_REQUEST_SEEK] = __handle_seek,
-       [ESPP_SERVICE_REQUEST_GET_STATE] = __handle_get_state,
-       [ESPP_SERVICE_REQUEST_GET_PLAYING_TIME] = __handle_get_playing_time,
-       [ESPP_SERVICE_REQUEST_SET_AUDIO_STREAM_INFO] = __handle_set_audio_stream_info,
-       [ESPP_SERVICE_REQUEST_SET_VIDEO_STREAM_INFO] = __handle_set_video_stream_info,
-       [ESPP_SERVICE_REQUEST_SET_PLAYBACK_RATE] = __handle_set_playback_rate,
-       [ESPP_SERVICE_REQUEST_SET_DISPLAY_SURFACE_ID] = __handle_set_display_surface_id,
-       [ESPP_SERVICE_REQUEST_SET_DISPLAY_MODE] = __handle_set_display_mode,
-       [ESPP_SERVICE_REQUEST_SET_DISPLAY_ROI] = __handle_set_display_roi,
-       [ESPP_SERVICE_REQUEST_SET_DISPLAY_VISIBLE] = __handle_set_display_visible,
-       [ESPP_SERVICE_REQUEST_SET_DISPLAY_ROTATION] = __handle_set_display_rotation,
-       [ESPP_SERVICE_REQUEST_SET_AUDIO_MUTE] = __handle_set_audio_mute,
-       [ESPP_SERVICE_REQUEST_SET_AUDIO_VOLUME] = __handle_set_audio_volume,
-       [ESPP_SERVICE_REQUEST_GET_AUDIO_VOLUME] = __handle_get_audio_volume,
-       [ESPP_SERVICE_REQUEST_SUBMIT_PACKET] = __handle_submit_packet,
-       [ESPP_SERVICE_REQUEST_SUBMIT_EOS_PACKET] = __handle_submit_eos_packet,
-       [ESPP_SERVICE_REQUEST_SET_BUFFER_SIZE] = __handle_set_buffer_size,
-       [ESPP_SERVICE_REQUEST_SET_LOW_LATENCY_MODE] = __handle_set_low_latency_mode,
-       [ESPP_SERVICE_REQUEST_SET_DECODED_VIDEO_FRAME_BUFFER_TYPE] = __handle_set_decoded_video_frame_buffer_type,
-       [ESPP_SERVICE_REQUEST_TAKE_SNAPSHOT] = __handle_take_snapshot,
-       [ESPP_SERVICE_REQUEST_SET_RENDER_TIME_OFFSET] = __handle_set_render_time_offset,
-       [ESPP_SERVICE_REQUEST_SET_CALLBACK] = __handle_set_callback,
-};
-
-void espp_service_func_handler(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
-{
-       ASSERT(hdata);
-       ASSERT(hdata->fd >= 0);
-       ASSERT(hdata->svc);
-       ASSERT(data);
-       ASSERT(result);
-       ASSERT(data->request < ESPP_SERVICE_REQUEST_NUM);
-
-       if (data->request == ESPP_SERVICE_REQUEST_SUBMIT_PACKET)
-               LOG_DEBUG("fd[%d] data[%p, request:%s]", hdata->fd, data, espp_service_common_get_requests()[data->request].str);
-       else
-               LOG_WARNING("fd[%d] data[%p, request:%s]", hdata->fd, data, espp_service_common_get_requests()[data->request].str);
-
-       handlers[data->request](hdata, data, result);
-}
-
-void espp_service_handle_destroy_cb(gpointer data)
-{
-       tb_data_s *tbs = (tb_data_s *)data;
-
-       ASSERT(tbs);
-
-       LOG_INFO("destroy tbs[%p, fd:%d, event_fd:%d, ESPP:%p]",
-               tbs, tbs->fd, tbs->event_fd, tbs->espp);
-
-       if (esplusplayer_stop(tbs->espp) != ESPLUSPLAYER_ERROR_TYPE_NONE)
-               LOG_ERROR("failed to esplusplayer_stop()");
-       if (esplusplayer_close(tbs->espp) != ESPLUSPLAYER_ERROR_TYPE_NONE)
-               LOG_ERROR("failed to esplusplayer_close()");
-       if (esplusplayer_destroy(tbs->espp) != ESPLUSPLAYER_ERROR_TYPE_NONE)
-               LOG_ERROR("failed to esplusplayer_destroy()");
-
-       g_free(tbs);
-}
diff --git a/src/daemon/espp_service_msg.c b/src/daemon/espp_service_msg.c
deleted file mode 100644 (file)
index c95759c..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2023 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 "espp_service_priv.h"
-
-int espp_service_msg_parse_params(const char *params, espp_service_request_e request, ...)
-{
-       int ret;
-       va_list ap;
-
-       ASSERT(params);
-       ASSERT(request < ESPP_SERVICE_REQUEST_NUM);
-
-       va_start(ap, request);
-       ret = espp_service_common_parse_json_structured_message(ap, params, espp_service_common_get_requests()[request].param_formats);
-       va_end(ap);
-
-       return ret;
-}
diff --git a/src/daemon/espp_service_priv.h b/src/daemon/espp_service_priv.h
deleted file mode 100644 (file)
index a9c88e1..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2023 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 __ESPP_SERVICE_PRIV_H__
-#define __ESPP_SERVICE_PRIV_H__
-
-#include "../common/espp_service_common.h"
-#include "../common/espp_service_ipc.h"
-
-#ifdef ST_AVP_TIZEN_70
-#ifdef USE_TIZEN_60
-#undef USE_TIZEN_60
-#endif
-#endif
-
-#ifdef USE_DLOG
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "ESPP_SERVICE"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define FILL_SOCKET_MSG_PARAMS(x_msg, x_event, ...) \
-do { \
-       gchar *params = espp_service_common_msg_params_new(espp_service_common_get_events()[x_event].param_formats, ##__VA_ARGS__); \
-       memset(&x_msg.params, 0x00, MAX_PARAMS_LEN); \
-       if (!params) break; \
-       STRNCPY(x_msg.params, params, MAX_PARAMS_LEN); \
-       g_free(params); \
-} while (0) \
-
-#define FILL_SOCKET_MSG_EVENT(x_msg, x_event) \
-do { \
-       x_msg.event = x_event; \
-} while (0) \
-
-typedef struct {
-       GMainLoop *mainloop;
-#ifdef USE_SERVICE_APP
-       GThread *thread;
-#else
-       bool start_service;
-#endif
-       int fd;
-       pthread_t thread_id;
-       GHashTable *fd_table;
-} espp_service_s;
-
-typedef struct {
-       espp_service_s *svc;
-       int fd;
-       struct {
-               int handle_addr;
-               unsigned int pid;
-       } client;
-       void *espp;
-       gchar *key;
-       int submit_count;
-} handler_userdata_s;
-
-/* socket */
-int espp_service_init_socket(espp_service_s *svc);
-void espp_service_deinit_socket(espp_service_s *svc);
-int espp_service_send_data(int fd, espp_service_data_from_server_s *data);
-int espp_service_read_buffer(int fd, char *buffer, uint32_t size);
-int espp_service_send_buffer(int fd, const unsigned char *buffer, uint32_t size);
-
-/* handler */
-void espp_service_func_handler(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result);
-void espp_service_handle_destroy_cb(gpointer data);
-
-/* message */
-int espp_service_msg_parse_params(const char *params, espp_service_request_e request, ...);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __ESPP_SERVICE_PRIV_H__ */
diff --git a/src/daemon/espp_service_socket.c b/src/daemon/espp_service_socket.c
deleted file mode 100644 (file)
index 6821895..0000000
+++ /dev/null
@@ -1,408 +0,0 @@
-/*
- * Copyright (c) 2023 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 "espp_service_priv.h"
-#include <gio/gio.h>
-#define __USE_GNU /* define for ucred in socket.h */
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <pthread.h>
-#ifdef USE_SERVICE_APP
-#include <service_app.h>
-#endif
-
-#define EXIT_IF_NEEDED(x_rx_data) \
-do { \
-       if (x_rx_data.request == ESPP_SERVICE_REQUEST_DESTROY) \
-               return -1; \
-} while (0)
-
-#define SET_IF_EVENT_MODE(x_rx_data, x_event_mode) \
-do { \
-       if (x_rx_data.request == ESPP_SERVICE_REQUEST_INIT_EVENT) { \
-               *x_event_mode = true; \
-               return 0; \
-       } \
-} while (0)
-
-static int __event_ret_msg_handling(handler_userdata_s *hdata)
-{
-       int fd;
-       int ret;
-       const int read_len = sizeof(espp_service_data_from_client_s);
-       char str_error[MAX_ERROR_LEN] = {'\0',};
-       espp_service_data_from_client_s rx_data;
-
-       ASSERT(hdata);
-       ASSERT(hdata->fd >= 0);
-       ASSERT(hdata->svc);
-
-       fd = hdata->fd;
-
-       memset(&rx_data, 0x00, read_len);
-       if ((ret = read(fd, &rx_data, read_len)) <= 0) {
-               strerror_r(errno, str_error, sizeof(str_error));
-               LOG_ERROR("failed to read(), fd[%d], err: %s", fd, str_error);
-               return -1;
-       }
-
-       if (ret != read_len) {
-               LOG_ERROR("failed to read(), fd[%d], read size mismatched: ret[%d], expect size[%d]",
-                       fd, ret, read_len);
-               return -1;
-       }
-
-       LOG_DEBUG("<<<<< from fd[%d]: ret[%d]", fd, rx_data.ret);
-
-       if (rx_data.ret == -2) {
-               LOG_WARNING("ret[-2] to exit, bye");
-               return -1;
-       }
-
-       return 0;
-}
-
-static int __request_msg_handling(handler_userdata_s *hdata, bool *event_mode)
-{
-       int fd;
-       int ret;
-       const int read_len = sizeof(espp_service_data_from_client_s);
-       const int write_len = sizeof(espp_service_data_from_server_s);
-       char str_error[MAX_ERROR_LEN] = {'\0',};
-       espp_service_data_from_client_s rx_data;
-       espp_service_data_from_server_s tx_data;
-
-       ASSERT(hdata);
-       ASSERT(hdata->fd >= 0);
-       ASSERT(hdata->svc);
-       ASSERT(event_mode);
-
-       fd = hdata->fd;
-
-       memset(&rx_data, 0x00, read_len);
-       if ((ret = read(fd, &rx_data, read_len)) <= 0) {
-               strerror_r(errno, str_error, sizeof(str_error));
-               LOG_ERROR("failed to read(), fd[%d], err: %s", fd, str_error);
-               goto remove_data_from_table;
-       }
-
-       if (ret != read_len) {
-               LOG_ERROR("failed to read(), fd[%d], read size mismatched: ret[%d], expect size[%d]",
-                       fd, ret, read_len);
-               return -1;
-       }
-
-       ASSERT(rx_data.request < ESPP_SERVICE_REQUEST_NUM);
-       LOG_DEBUG("<<<<< from fd[%d]: request[%s]", fd, espp_service_common_get_requests()[rx_data.request].str);
-
-       memset(&tx_data, 0x00, write_len);
-       espp_service_func_handler(hdata, &rx_data, &tx_data);
-       LOG_DEBUG(">>>>>> to fd[%d]: ret[%d]", fd, tx_data.ret);
-
-       if (write(fd, &tx_data, write_len) < 0) {
-               strerror_r(errno, str_error, sizeof(str_error));
-               LOG_ERROR("failed to write(), fd[%d], err: %s", fd, str_error);
-       }
-
-       EXIT_IF_NEEDED(rx_data);
-       SET_IF_EVENT_MODE(rx_data, event_mode);
-
-       return 0;
-
-remove_data_from_table:
-       /* NOTE: Because both event return and request msg channel use the same hdata->key value,
-        * remove the key from the hashtable here only. 'hdata->key' will be freed. */
-       g_hash_table_remove(hdata->svc->fd_table, hdata->key);
-       return -1;
-}
-
-static void *__work_thread_func(void *data)
-{
-       bool event_mode = false;
-       handler_userdata_s *hdata = (handler_userdata_s *)data;
-       espp_service_s *svc;
-       guint num_of_clients;
-
-       ASSERT(hdata);
-       ASSERT(hdata->fd != -1);
-
-       svc = hdata->svc;
-
-       LOG_WARNING("entrance, fd[%d]", hdata->fd);
-
-       while (1) {
-               if (!event_mode) {
-                       if (__request_msg_handling(hdata, &event_mode) == -1)
-                               goto exit;
-               } else {
-                       if (__event_ret_msg_handling(hdata) == -1)
-                               goto exit;
-               }
-       }
-
-exit:
-       num_of_clients = g_hash_table_size(hdata->svc->fd_table);
-       LOG_WARNING("exit, fd[%d], svc[%p], num_of_clients[%u] remain", hdata->fd, svc, num_of_clients);
-       close(hdata->fd);
-       g_free(hdata);
-#ifdef USE_SERVICE_APP
-       if (num_of_clients == 0) {
-               LOG_ERROR("no more clients, quit main loop to exit service...");
-               g_main_loop_quit(svc->mainloop);
-       }
-#endif
-       pthread_exit(NULL);
-}
-
-static unsigned int get_pid_from_fd(int fd)
-{
-       struct ucred cred;
-       socklen_t len = (socklen_t)sizeof(struct ucred);
-       char str_error[MAX_ERROR_LEN] = {'\0',};
-
-       if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cred, &len) < 0) {
-               strerror_r(errno, str_error, sizeof(str_error));
-               LOG_ERROR("failed to getsockopt(), err: %s", str_error);
-               return 0;
-       }
-
-       LOG_INFO("fd[%d] pid[%u]", fd, cred.pid);
-
-       return cred.pid;
-}
-
-static void *__listen_thread_func(void *data)
-{
-       espp_service_s *svc = (espp_service_s *)data;
-       int ret;
-       int fd;
-       int client_fd = -1;
-       pthread_attr_t attr;
-       char str_error[MAX_ERROR_LEN] = {'\0',};
-       handler_userdata_s *userdata = NULL;
-       pthread_t work_thread_id;
-
-       ASSERT(svc);
-       ASSERT(svc->fd >= 0);
-
-       ret = pthread_attr_init(&attr);
-       if (ret != 0) {
-               LOG_ERROR("failed to pthread_attr_init(), ret[%d]", ret);
-               goto exit;
-       }
-
-       ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-       if (ret != 0) {
-               LOG_ERROR("failed to pthread_attr_setdetachstate(), ret[%d]", ret);
-               goto exit;
-       }
-
-       fd = svc->fd;
-
-       if (listen(fd, 5)) {
-               strerror_r(errno, str_error, sizeof(str_error));
-               LOG_ERROR("failed to listen(), err: %s", str_error);
-               goto exit;
-       }
-       LOG_INFO("listen for fd[%d] success", fd);
-
-       while (1) {
-               client_fd = accept(fd, NULL, NULL);
-               if (client_fd == -1) {
-                       if (errno == EINVAL) /* this might be for socket close */
-                               goto exit;
-                       strerror_r(errno, str_error, sizeof(str_error));
-                       LOG_ERROR("failed to accept(), err: %s", str_error);
-                       goto exit;
-               }
-
-               userdata = g_new0(handler_userdata_s, 1);
-               userdata->svc = svc;
-               userdata->fd = client_fd;
-               userdata->client.pid = get_pid_from_fd(client_fd);
-
-               LOG_DEBUG("client[fd:%d, pid:%u]", client_fd, userdata->client.pid);
-
-               if (pthread_create(&work_thread_id, &attr, (void *)__work_thread_func, (void *)userdata)) {
-                       LOG_ERROR("failed to pthread_create(), client_fd[%d]", client_fd);
-                       g_free(userdata);
-                       goto exit;
-               }
-       }
-
-exit:
-       if (client_fd >= 0)
-               close(client_fd);
-
-       LOG_DEBUG("pthread_exit()");
-       pthread_attr_destroy(&attr);
-       pthread_exit(NULL);
-}
-
-static int __create_listener_thread(espp_service_s *svc)
-{
-       ASSERT(svc);
-       ASSERT(svc->fd >= 0);
-
-       if (pthread_create(&svc->thread_id, NULL, (void *)__listen_thread_func, (void *)svc)) {
-               LOG_ERROR("failed to pthread_create()");
-               return -1;
-       }
-
-       LOG_DEBUG("thread_id[0x%x]", (unsigned)svc->thread_id);
-
-       return 0;
-}
-
-int espp_service_init_socket(espp_service_s *svc)
-{
-       int fd;
-       struct sockaddr_un addr_un;
-       char str_error[128] = {'\0',};
-       g_autofree gchar *sock_path = NULL;
-
-       ASSERT(svc);
-
-       fd = socket(AF_UNIX, SOCK_STREAM, 0);
-       if (fd < 0) {
-               strerror_r(errno, str_error, sizeof(str_error));
-               LOG_ERROR("failed to socket(), err: %s", str_error);
-               goto exit;
-       }
-
-       LOG_DEBUG("fd[%d]", fd);
-
-       memset(&addr_un, 0, sizeof(addr_un));
-       addr_un.sun_family = AF_UNIX;
-       sock_path = espp_service_common_get_sock_file_path();
-       strncpy(addr_un.sun_path, sock_path, sizeof(addr_un.sun_path) - 1);
-
-       if (bind(fd, (struct sockaddr *)&addr_un, sizeof(addr_un))) {
-               int errsv = errno;
-               strerror_r(errsv, str_error, sizeof(str_error));
-               LOG_ERROR("failed to bind(), sun_path[%s], err: %s", addr_un.sun_path, str_error);
-               if (errsv == EADDRINUSE) {
-                       unlink(sock_path);
-                       LOG_DEBUG("unlink socket and bind again...");
-                       if (bind(fd, (struct sockaddr *)&addr_un, sizeof(addr_un))) {
-                               strerror_r(errno, str_error, sizeof(str_error));
-                               LOG_ERROR("failed to bind() again, err: %s", str_error);
-                               goto exit;
-                       }
-               } else {
-                       goto exit;
-               }
-       }
-
-       svc->fd = fd;
-       LOG_DEBUG("socket binding success, sock_path[%s], fd[%d]", sock_path, svc->fd);
-
-       if (__create_listener_thread(svc) != 0)
-               goto exit;
-
-       return 0;
-
-exit:
-       if (fd >= 0)
-               close(fd);
-
-       return -1;
-}
-
-void espp_service_deinit_socket(espp_service_s *svc)
-{
-       ASSERT(svc);
-
-       if (svc->fd >= 0) {
-               unlink(ESPP_SERVICE_SOCK);
-               shutdown(svc->fd, SHUT_RDWR);
-               close(svc->fd);
-               LOG_DEBUG("close() done, fd[%d]", svc->fd);
-               svc->fd = -1;
-       }
-
-       if (svc->thread_id > 0) {
-               LOG_DEBUG("try to pthread_join(), thread_id[0x%x]", (unsigned)svc->thread_id);
-               pthread_join(svc->thread_id, NULL);
-               LOG_DEBUG("pthread_join() done");
-               svc->thread_id = 0;
-       }
-}
-
-int espp_service_send_data(int fd, espp_service_data_from_server_s *data)
-{
-       char str_error[MAX_ERROR_LEN] = {'\0',};
-
-       ASSERT(fd >= 0);
-       ASSERT(data);
-
-       if (write(fd, data, sizeof(espp_service_data_from_server_s)) < 0) {
-               strerror_r(errno, str_error, sizeof(str_error));
-               LOG_ERROR("failed to write(), fd[%d], err: %s", fd, str_error);
-               return -1;
-       }
-
-       LOG_DEBUG("fd[%d] event[%d]", fd, data->event);
-
-       return 0;
-}
-
-int espp_service_send_buffer(int fd, const unsigned char *buffer, uint32_t size)
-{
-       char str_error[MAX_ERROR_LEN] = {'\0',};
-
-       ASSERT(fd >= 0);
-       ASSERT(buffer);
-       ASSERT(size > 0);
-
-       if (write(fd, buffer, size) < 0) {
-               strerror_r(errno, str_error, sizeof(str_error));
-               LOG_ERROR("failed to write(), fd[%d], err: %s", fd, str_error);
-               return -1;
-       }
-
-       LOG_DEBUG("fd[%d] buffer[%p] size[%u]", fd, buffer, size);
-
-       return 0;
-}
-
-int espp_service_read_buffer(int fd, char *buffer, uint32_t size)
-{
-       int ret;
-       uint32_t total = 0;
-       char str_error[MAX_ERROR_LEN] = {'\0',};
-
-       ASSERT(fd >= 0);
-       ASSERT(buffer);
-
-       do {
-               if ((ret = read(fd, buffer + total, size - total)) < 0) {
-                       strerror_r(errno, str_error, sizeof(str_error));
-                       LOG_ERROR("failed to read(), fd[%d], ret[%d], err: %s", fd, ret, str_error);
-                       break;
-               }
-               total += ret;
-       } while (total < size);
-
-       if (total != size) {
-               LOG_ERROR("total[%u], expected size[%u]", total, size);
-               return -1;
-       }
-
-       LOG_DEBUG("fd[%d] buffer[%p, size:%u]", fd, buffer, size);
-
-       return 0;
-}
diff --git a/src/daemon/meson.build b/src/daemon/meson.build
deleted file mode 100644 (file)
index 43e50dd..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-espp_service_sources = [
-  '../common/espp_service_ipc.c',
-  'espp_service.c',
-  'espp_service_socket.c',
-  'espp_service_handler.c',
-  'espp_service_msg.c',
-]
-
-daemon_deps = common_deps
-
-message('================ daemon options ================')
-if get_option('tizen-60')
-  message('tizen-6.0 option is enabled, set USE_TIZEN_60')
-  conf_data.set('USE_TIZEN_60', true)
-else
-  tbm_dep = dependency('libtbm', required: true)
-  image_util_dep = dependency('capi-media-image-util', required: true)
-  daemon_deps += [tbm_dep, image_util_dep]
-endif
-message('bindir: '+ get_option('_bindir'))
-if get_option('service-app')
-  message('service-app option is enabled, set USE_SERVICE_APP')
-  conf_data.set('USE_SERVICE_APP', true)
-  service_app_dep = dependency('capi-appfw-service-application', required: true)
-  daemon_deps += [service_app_dep]
-endif
-
-message('================================================')
-
-thread_dep = dependency('threads', required: true)
-espp_dep = dependency('esplusplayer', required: true)
-
-daemon_deps += [thread_dep, espp_dep]
-
-executable('espp-service',
-  espp_service_sources,
-  include_directories : [configinc],
-  dependencies : daemon_deps,
-  install: true,
-  install_dir: get_option('_bindir'),
-  install_rpath: libdir_path,
-  pie : true,
-)
-
diff --git a/src/meson.build b/src/meson.build
deleted file mode 100644 (file)
index b0441da..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-subdir('client')
-subdir('daemon')
diff --git a/tizen-manifest.xml b/tizen-manifest.xml
deleted file mode 100644 (file)
index 678c0a3..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<manifest xmlns="http://tizen.org/ns/packages" api-version="8.0" package="com.samsung.tizen.espp-service" version="0.3.21">
-    <profile name="mobile"/>
-    <description>espp-service</description>
-    <service-application appid="com.samsung.tizen.espp-service" auto-restart="false" exec="espp-service" multiple="false" nodisplay="false" on-boot="false" taskmanage="false" type="capp">
-        <label>espp-service</label>
-    </service-application>
-</manifest>
diff --git a/update_version.sh b/update_version.sh
deleted file mode 100755 (executable)
index aafb026..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-echo "===== Update tizen-manifest.xml & project_def.prop version ====="
-VER_SPEC=$(grep "Version" packaging/espp-service.spec | cut -f2 -d : | sed 's/ //g')
-VER_XML=$(grep -oP '(?<= version=").*?(?=">)' tizen-manifest.xml)
-if [ "${VER_SPEC}" != "${VER_XML}" ]; then
-       echo "update tizen-manifest.xml version: ${VER_XML} => ${VER_SPEC}"
-       sed -i "s/\( version=\"\)[^\"]*\(\">\)/\1${VER_SPEC}\2/" tizen-manifest.xml
-fi
-VER_PROJ=$(grep -oP '(?<=VERSION=").*?(?=")' project_def.prop)
-if [ "${VER_SPEC}" != "${VER_PROJ}" ]; then
-       echo "update project_def.prop version: ${VER_PROJ} => ${VER_SPEC}"
-       sed -i "s/\(VERSION=\"\)[^\"]*\(\"\)/\1${VER_SPEC}\2/" project_def.prop
-fi
-echo "================================================================"