From 6b6ecf692879142a209d94feea113a4d109d3184 Mon Sep 17 00:00:00 2001 From: sunxilin Date: Mon, 4 Nov 2024 11:21:53 +0800 Subject: [PATCH] remove unused files --- packages/core_protocols/msgpack/msg/BUILD.gn | 5 - .../msgpack/msg/audio_frame/BUILD.gn | 19 --- .../msgpack/msg/audio_frame/audio_frame.c | 52 ------- .../msgpack/msg/audio_frame/audio_frame.h | 21 --- .../msgpack/msg/audio_frame/field/BUILD.gn | 18 --- .../msg/audio_frame/field/bytes_per_sample.c | 30 ---- .../msg/audio_frame/field/bytes_per_sample.h | 19 --- .../msgpack/msg/audio_frame/field/data.c | 33 ----- .../msgpack/msg/audio_frame/field/data.h | 18 --- .../msgpack/msg/audio_frame/field/data_fmt.c | 32 ---- .../msgpack/msg/audio_frame/field/data_fmt.h | 19 --- .../msg/audio_frame/field/field_info.h | 86 ----------- .../msgpack/msg/audio_frame/field/line_size.c | 31 ---- .../msgpack/msg/audio_frame/field/line_size.h | 18 --- .../msg/audio_frame/field/number_of_channel.c | 30 ---- .../msg/audio_frame/field/number_of_channel.h | 20 --- .../msg/audio_frame/field/sample_rate.c | 30 ---- .../msg/audio_frame/field/sample_rate.h | 18 --- .../audio_frame/field/samples_per_channel.c | 30 ---- .../audio_frame/field/samples_per_channel.h | 20 --- .../msgpack/msg/audio_frame/field/timestamp.c | 31 ---- .../msgpack/msg/audio_frame/field/timestamp.h | 18 --- .../core_protocols/msgpack/msg/cmd/BUILD.gn | 21 --- .../msgpack/msg/cmd/close_app/BUILD.gn | 19 --- .../msgpack/msg/cmd/close_app/cmd.c | 60 -------- .../msgpack/msg/cmd/close_app/cmd.h | 21 --- .../msgpack/msg/cmd/close_app/field/BUILD.gn | 18 --- .../msg/cmd/close_app/field/field_info.h | 33 ----- packages/core_protocols/msgpack/msg/cmd/cmd.c | 137 ------------------ packages/core_protocols/msgpack/msg/cmd/cmd.h | 26 ---- .../msgpack/msg/cmd/custom/BUILD.gn | 19 --- .../msgpack/msg/cmd/custom/cmd.c | 57 -------- .../msgpack/msg/cmd/custom/cmd.h | 21 --- .../msgpack/msg/cmd/custom/field/BUILD.gn | 18 --- .../msgpack/msg/cmd/custom/field/field_info.h | 32 ---- .../msgpack/msg/cmd/field/BUILD.gn | 18 --- .../msgpack/msg/cmd/field/cmd_id.c | 44 ------ .../msgpack/msg/cmd/field/cmd_id.h | 18 --- .../msgpack/msg/cmd/field/field_info.h | 49 ------- .../msgpack/msg/cmd/field/seq_id.c | 45 ------ .../msgpack/msg/cmd/field/seq_id.h | 18 --- .../msgpack/msg/cmd_result/BUILD.gn | 19 --- .../msgpack/msg/cmd_result/cmd.c | 55 ------- .../msgpack/msg/cmd_result/cmd.h | 21 --- .../msgpack/msg/cmd_result/field/BUILD.gn | 18 --- .../msgpack/msg/cmd_result/field/field_info.h | 51 ------- .../msgpack/msg/cmd_result/field/is_final.c | 55 ------- .../msgpack/msg/cmd_result/field/is_final.h | 18 --- .../msg/cmd_result/field/original_cmd_type.c | 48 ------ .../msg/cmd_result/field/original_cmd_type.h | 19 --- .../msg/cmd_result/field/status_code.c | 48 ------ .../msg/cmd_result/field/status_code.h | 18 --- .../core_protocols/msgpack/msg/data/BUILD.gn | 19 --- .../core_protocols/msgpack/msg/data/data.c | 46 ------ .../core_protocols/msgpack/msg/data/data.h | 22 --- .../msgpack/msg/data/field/BUILD.gn | 18 --- .../msgpack/msg/data/field/buf.c | 32 ---- .../msgpack/msg/data/field/buf.h | 18 --- .../msgpack/msg/data/field/field_info.h | 39 ----- .../core_protocols/msgpack/msg/field/dest.c | 31 ---- .../core_protocols/msgpack/msg/field/dest.h | 18 --- .../msgpack/msg/field/field_info.h | 68 --------- .../core_protocols/msgpack/msg/field/name.c | 42 ------ .../core_protocols/msgpack/msg/field/name.h | 19 --- .../msgpack/msg/field/properties.c | 69 --------- .../msgpack/msg/field/properties.h | 18 --- .../core_protocols/msgpack/msg/field/src.c | 28 ---- .../core_protocols/msgpack/msg/field/src.h | 18 --- packages/core_protocols/msgpack/msg/loc.h | 5 +- packages/core_protocols/msgpack/msg/msg.c | 36 +---- packages/core_protocols/msgpack/msg/msg.h | 6 - .../core_protocols/msgpack/msg/msg_info.h | 98 ------------- .../msgpack/msg/video_frame/BUILD.gn | 19 --- .../msgpack/msg/video_frame/field/BUILD.gn | 18 --- .../msgpack/msg/video_frame/field/buf.c | 31 ---- .../msgpack/msg/video_frame/field/buf.h | 18 --- .../msg/video_frame/field/field_info.h | 63 -------- .../msgpack/msg/video_frame/field/height.c | 45 ------ .../msgpack/msg/video_frame/field/height.h | 18 --- .../msgpack/msg/video_frame/field/pixel_fmt.c | 44 ------ .../msgpack/msg/video_frame/field/pixel_fmt.h | 18 --- .../msgpack/msg/video_frame/field/timestamp.c | 44 ------ .../msgpack/msg/video_frame/field/timestamp.h | 18 --- .../msgpack/msg/video_frame/field/width.c | 43 ------ .../msgpack/msg/video_frame/field/width.h | 18 --- .../msgpack/msg/video_frame/video_frame.c | 51 ------- .../msgpack/msg/video_frame/video_frame.h | 21 --- 87 files changed, 6 insertions(+), 2755 deletions(-) delete mode 100644 packages/core_protocols/msgpack/msg/audio_frame/BUILD.gn delete mode 100644 packages/core_protocols/msgpack/msg/audio_frame/audio_frame.c delete mode 100644 packages/core_protocols/msgpack/msg/audio_frame/audio_frame.h delete mode 100644 packages/core_protocols/msgpack/msg/audio_frame/field/BUILD.gn delete mode 100644 packages/core_protocols/msgpack/msg/audio_frame/field/bytes_per_sample.c delete mode 100644 packages/core_protocols/msgpack/msg/audio_frame/field/bytes_per_sample.h delete mode 100644 packages/core_protocols/msgpack/msg/audio_frame/field/data.c delete mode 100644 packages/core_protocols/msgpack/msg/audio_frame/field/data.h delete mode 100644 packages/core_protocols/msgpack/msg/audio_frame/field/data_fmt.c delete mode 100644 packages/core_protocols/msgpack/msg/audio_frame/field/data_fmt.h delete mode 100644 packages/core_protocols/msgpack/msg/audio_frame/field/field_info.h delete mode 100644 packages/core_protocols/msgpack/msg/audio_frame/field/line_size.c delete mode 100644 packages/core_protocols/msgpack/msg/audio_frame/field/line_size.h delete mode 100644 packages/core_protocols/msgpack/msg/audio_frame/field/number_of_channel.c delete mode 100644 packages/core_protocols/msgpack/msg/audio_frame/field/number_of_channel.h delete mode 100644 packages/core_protocols/msgpack/msg/audio_frame/field/sample_rate.c delete mode 100644 packages/core_protocols/msgpack/msg/audio_frame/field/sample_rate.h delete mode 100644 packages/core_protocols/msgpack/msg/audio_frame/field/samples_per_channel.c delete mode 100644 packages/core_protocols/msgpack/msg/audio_frame/field/samples_per_channel.h delete mode 100644 packages/core_protocols/msgpack/msg/audio_frame/field/timestamp.c delete mode 100644 packages/core_protocols/msgpack/msg/audio_frame/field/timestamp.h delete mode 100644 packages/core_protocols/msgpack/msg/cmd/BUILD.gn delete mode 100644 packages/core_protocols/msgpack/msg/cmd/close_app/BUILD.gn delete mode 100644 packages/core_protocols/msgpack/msg/cmd/close_app/cmd.c delete mode 100644 packages/core_protocols/msgpack/msg/cmd/close_app/cmd.h delete mode 100644 packages/core_protocols/msgpack/msg/cmd/close_app/field/BUILD.gn delete mode 100644 packages/core_protocols/msgpack/msg/cmd/close_app/field/field_info.h delete mode 100644 packages/core_protocols/msgpack/msg/cmd/cmd.c delete mode 100644 packages/core_protocols/msgpack/msg/cmd/cmd.h delete mode 100644 packages/core_protocols/msgpack/msg/cmd/custom/BUILD.gn delete mode 100644 packages/core_protocols/msgpack/msg/cmd/custom/cmd.c delete mode 100644 packages/core_protocols/msgpack/msg/cmd/custom/cmd.h delete mode 100644 packages/core_protocols/msgpack/msg/cmd/custom/field/BUILD.gn delete mode 100644 packages/core_protocols/msgpack/msg/cmd/custom/field/field_info.h delete mode 100644 packages/core_protocols/msgpack/msg/cmd/field/BUILD.gn delete mode 100644 packages/core_protocols/msgpack/msg/cmd/field/cmd_id.c delete mode 100644 packages/core_protocols/msgpack/msg/cmd/field/cmd_id.h delete mode 100644 packages/core_protocols/msgpack/msg/cmd/field/field_info.h delete mode 100644 packages/core_protocols/msgpack/msg/cmd/field/seq_id.c delete mode 100644 packages/core_protocols/msgpack/msg/cmd/field/seq_id.h delete mode 100644 packages/core_protocols/msgpack/msg/cmd_result/BUILD.gn delete mode 100644 packages/core_protocols/msgpack/msg/cmd_result/cmd.c delete mode 100644 packages/core_protocols/msgpack/msg/cmd_result/cmd.h delete mode 100644 packages/core_protocols/msgpack/msg/cmd_result/field/BUILD.gn delete mode 100644 packages/core_protocols/msgpack/msg/cmd_result/field/field_info.h delete mode 100644 packages/core_protocols/msgpack/msg/cmd_result/field/is_final.c delete mode 100644 packages/core_protocols/msgpack/msg/cmd_result/field/is_final.h delete mode 100644 packages/core_protocols/msgpack/msg/cmd_result/field/original_cmd_type.c delete mode 100644 packages/core_protocols/msgpack/msg/cmd_result/field/original_cmd_type.h delete mode 100644 packages/core_protocols/msgpack/msg/cmd_result/field/status_code.c delete mode 100644 packages/core_protocols/msgpack/msg/cmd_result/field/status_code.h delete mode 100644 packages/core_protocols/msgpack/msg/data/BUILD.gn delete mode 100644 packages/core_protocols/msgpack/msg/data/data.c delete mode 100644 packages/core_protocols/msgpack/msg/data/data.h delete mode 100644 packages/core_protocols/msgpack/msg/data/field/BUILD.gn delete mode 100644 packages/core_protocols/msgpack/msg/data/field/buf.c delete mode 100644 packages/core_protocols/msgpack/msg/data/field/buf.h delete mode 100644 packages/core_protocols/msgpack/msg/data/field/field_info.h delete mode 100644 packages/core_protocols/msgpack/msg/field/dest.c delete mode 100644 packages/core_protocols/msgpack/msg/field/dest.h delete mode 100644 packages/core_protocols/msgpack/msg/field/field_info.h delete mode 100644 packages/core_protocols/msgpack/msg/field/name.c delete mode 100644 packages/core_protocols/msgpack/msg/field/name.h delete mode 100644 packages/core_protocols/msgpack/msg/field/properties.c delete mode 100644 packages/core_protocols/msgpack/msg/field/properties.h delete mode 100644 packages/core_protocols/msgpack/msg/field/src.c delete mode 100644 packages/core_protocols/msgpack/msg/field/src.h delete mode 100644 packages/core_protocols/msgpack/msg/msg_info.h delete mode 100644 packages/core_protocols/msgpack/msg/video_frame/BUILD.gn delete mode 100644 packages/core_protocols/msgpack/msg/video_frame/field/BUILD.gn delete mode 100644 packages/core_protocols/msgpack/msg/video_frame/field/buf.c delete mode 100644 packages/core_protocols/msgpack/msg/video_frame/field/buf.h delete mode 100644 packages/core_protocols/msgpack/msg/video_frame/field/field_info.h delete mode 100644 packages/core_protocols/msgpack/msg/video_frame/field/height.c delete mode 100644 packages/core_protocols/msgpack/msg/video_frame/field/height.h delete mode 100644 packages/core_protocols/msgpack/msg/video_frame/field/pixel_fmt.c delete mode 100644 packages/core_protocols/msgpack/msg/video_frame/field/pixel_fmt.h delete mode 100644 packages/core_protocols/msgpack/msg/video_frame/field/timestamp.c delete mode 100644 packages/core_protocols/msgpack/msg/video_frame/field/timestamp.h delete mode 100644 packages/core_protocols/msgpack/msg/video_frame/field/width.c delete mode 100644 packages/core_protocols/msgpack/msg/video_frame/field/width.h delete mode 100644 packages/core_protocols/msgpack/msg/video_frame/video_frame.c delete mode 100644 packages/core_protocols/msgpack/msg/video_frame/video_frame.h diff --git a/packages/core_protocols/msgpack/msg/BUILD.gn b/packages/core_protocols/msgpack/msg/BUILD.gn index 5234909408..0283d076e7 100644 --- a/packages/core_protocols/msgpack/msg/BUILD.gn +++ b/packages/core_protocols/msgpack/msg/BUILD.gn @@ -12,12 +12,7 @@ glob("msg") { "//packages", ] deps = [ - "audio_frame", - "cmd", - "cmd_result", - "data", "field", - "video_frame", "//core/src/ten_runtime:ten_runtime_library", "//third_party/msgpack:msgpackc", ] diff --git a/packages/core_protocols/msgpack/msg/audio_frame/BUILD.gn b/packages/core_protocols/msgpack/msg/audio_frame/BUILD.gn deleted file mode 100644 index 037416aa9f..0000000000 --- a/packages/core_protocols/msgpack/msg/audio_frame/BUILD.gn +++ /dev/null @@ -1,19 +0,0 @@ -# -# This file is part of TEN Framework, an open source project. -# Licensed under the Apache License, Version 2.0. -# See the LICENSE file for more information. -# -import("//.gnfiles/build/feature/glob.gni") - -glob("audio_frame") { - file_list = all_native_files - include_dirs = [ - "//core", - "//packages", - ] - deps = [ - "field", - "//core/src/ten_runtime:ten_runtime_library", - "//third_party/msgpack:msgpackc", - ] -} diff --git a/packages/core_protocols/msgpack/msg/audio_frame/audio_frame.c b/packages/core_protocols/msgpack/msg/audio_frame/audio_frame.c deleted file mode 100644 index 13b635ba26..0000000000 --- a/packages/core_protocols/msgpack/msg/audio_frame/audio_frame.c +++ /dev/null @@ -1,52 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "ten_runtime/msg/audio_frame/audio_frame.h" - -#include -#include -#include -#include - -#include "core_protocols/msgpack/msg/audio_frame/audio_frame.h" -#include "core_protocols/msgpack/msg/audio_frame/field/field_info.h" -#include "include_internal/ten_runtime/msg/audio_frame/audio_frame.h" - -bool ten_msgpack_audio_frame_serialize(ten_shared_ptr_t *self_, - msgpack_packer *pck, ten_error_t *err) { - TEN_ASSERT(self_ && pck, "Invalid argument."); - - ten_audio_frame_t *self = ten_shared_ptr_get_data(self_); - - for (size_t i = 0; i < ten_audio_frame_fields_info_size; ++i) { - ten_msg_field_serialize_func_t serialize = - ten_audio_frame_fields_info[i].serialize; - if (serialize) { - serialize(&self->msg_hdr, pck); - } - } - - return true; -} - -bool ten_msgpack_audio_frame_deserialize(ten_shared_ptr_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - ten_audio_frame_t *raw_msg = ten_shared_ptr_get_data(self); - - for (size_t i = 0; i < ten_audio_frame_fields_info_size; ++i) { - ten_msg_field_deserialize_func_t deserialize = - ten_audio_frame_fields_info[i].deserialize; - if (deserialize) { - if (!deserialize(&raw_msg->msg_hdr, unpacker, unpacked)) { - return false; - } - } - } - - return true; -} diff --git a/packages/core_protocols/msgpack/msg/audio_frame/audio_frame.h b/packages/core_protocols/msgpack/msg/audio_frame/audio_frame.h deleted file mode 100644 index ebe1670afb..0000000000 --- a/packages/core_protocols/msgpack/msg/audio_frame/audio_frame.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include -#include - -#include "ten_utils/lib/error.h" -#include "ten_utils/lib/smart_ptr.h" - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_audio_frame_serialize( - ten_shared_ptr_t *self, msgpack_packer *pck, ten_error_t *err); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_audio_frame_deserialize( - ten_shared_ptr_t *self, msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/audio_frame/field/BUILD.gn b/packages/core_protocols/msgpack/msg/audio_frame/field/BUILD.gn deleted file mode 100644 index d0c879c824..0000000000 --- a/packages/core_protocols/msgpack/msg/audio_frame/field/BUILD.gn +++ /dev/null @@ -1,18 +0,0 @@ -# -# This file is part of TEN Framework, an open source project. -# Licensed under the Apache License, Version 2.0. -# See the LICENSE file for more information. -# -import("//.gnfiles/build/feature/glob.gni") - -glob("field") { - file_list = all_native_files - include_dirs = [ - "//core", - "//packages", - ] - deps = [ - "//core/src/ten_runtime:ten_runtime_library", - "//third_party/msgpack:msgpackc", - ] -} diff --git a/packages/core_protocols/msgpack/msg/audio_frame/field/bytes_per_sample.c b/packages/core_protocols/msgpack/msg/audio_frame/field/bytes_per_sample.c deleted file mode 100644 index be6d350a0a..0000000000 --- a/packages/core_protocols/msgpack/msg/audio_frame/field/bytes_per_sample.c +++ /dev/null @@ -1,30 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "core_protocols/msgpack/msg/audio_frame/field/bytes_per_sample.h" - -#include - -#include "core_protocols/msgpack/common/value.h" -#include "include_internal/ten_runtime/msg/audio_frame/audio_frame.h" -#include "msgpack/pack.h" -#include "ten_runtime/msg/audio_frame/audio_frame.h" - -void ten_msgpack_audio_frame_bytes_per_sample_serialize(ten_msg_t *self, - msgpack_packer *pck) { - TEN_ASSERT(self && ten_raw_msg_check_integrity(self) && pck, - "Invalid argument."); - - ten_audio_frame_t *audio_frame = (ten_audio_frame_t *)self; - ten_msgpack_value_serialize(&audio_frame->bytes_per_sample, pck); -} - -bool ten_msgpack_audio_frame_bytes_per_sample_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - return ten_msgpack_value_deserialize_inplace( - &((ten_audio_frame_t *)self)->bytes_per_sample, unpacker, unpacked); -} diff --git a/packages/core_protocols/msgpack/msg/audio_frame/field/bytes_per_sample.h b/packages/core_protocols/msgpack/msg/audio_frame/field/bytes_per_sample.h deleted file mode 100644 index 529b5aeb4d..0000000000 --- a/packages/core_protocols/msgpack/msg/audio_frame/field/bytes_per_sample.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "core_protocols/msgpack/common/common.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void ten_msgpack_audio_frame_bytes_per_sample_serialize( - ten_msg_t *self, msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool -ten_msgpack_audio_frame_bytes_per_sample_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/audio_frame/field/data.c b/packages/core_protocols/msgpack/msg/audio_frame/field/data.c deleted file mode 100644 index 2852569621..0000000000 --- a/packages/core_protocols/msgpack/msg/audio_frame/field/data.c +++ /dev/null @@ -1,33 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "core_protocols/msgpack/msg/audio_frame/field/data.h" - -#include - -#include "core_protocols/msgpack/common/value.h" -#include "include_internal/ten_runtime/msg/audio_frame/audio_frame.h" -#include "include_internal/ten_runtime/msg/msg.h" -#include "msgpack/object.h" -#include "ten_runtime/msg/audio_frame/audio_frame.h" -#include "ten_utils/lib/alloc.h" - -void ten_msgpack_audio_frame_data_serialize(ten_msg_t *self, - msgpack_packer *pck) { - TEN_ASSERT(self && ten_raw_msg_check_integrity(self) && pck, - "Invalid argument."); - - ten_audio_frame_t *audio_frame = (ten_audio_frame_t *)self; - ten_msgpack_value_serialize(&audio_frame->buf, pck); -} - -bool ten_msgpack_audio_frame_data_deserialize(ten_msg_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - return ten_msgpack_value_deserialize_inplace( - &((ten_audio_frame_t *)self)->buf, unpacker, unpacked); -} diff --git a/packages/core_protocols/msgpack/msg/audio_frame/field/data.h b/packages/core_protocols/msgpack/msg/audio_frame/field/data.h deleted file mode 100644 index c7112d3c91..0000000000 --- a/packages/core_protocols/msgpack/msg/audio_frame/field/data.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "core_protocols/msgpack/common/common.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void ten_msgpack_audio_frame_data_serialize( - ten_msg_t *self, msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_audio_frame_data_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/audio_frame/field/data_fmt.c b/packages/core_protocols/msgpack/msg/audio_frame/field/data_fmt.c deleted file mode 100644 index cccb19a133..0000000000 --- a/packages/core_protocols/msgpack/msg/audio_frame/field/data_fmt.c +++ /dev/null @@ -1,32 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "core_protocols/msgpack/msg/audio_frame/field/data_fmt.h" - -#include - -#include "core_protocols/msgpack/common/common.h" -#include "core_protocols/msgpack/common/value.h" -#include "include_internal/ten_runtime/msg/audio_frame/audio_frame.h" -#include "include_internal/ten_runtime/msg/msg.h" -#include "ten_runtime/msg/audio_frame/audio_frame.h" - -void ten_msgpack_audio_frame_data_fmt_serialize(ten_msg_t *self, - msgpack_packer *pck) { - TEN_ASSERT(self && ten_raw_msg_check_integrity(self) && pck, - "Invalid argument."); - - ten_audio_frame_t *audio_frame = (ten_audio_frame_t *)self; - ten_msgpack_value_serialize(&audio_frame->data_fmt, pck); -} - -bool ten_msgpack_audio_frame_data_fmt_deserialize(ten_msg_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - return ten_msgpack_value_deserialize_inplace( - &((ten_audio_frame_t *)self)->data_fmt, unpacker, unpacked); -} diff --git a/packages/core_protocols/msgpack/msg/audio_frame/field/data_fmt.h b/packages/core_protocols/msgpack/msg/audio_frame/field/data_fmt.h deleted file mode 100644 index 29da17cb67..0000000000 --- a/packages/core_protocols/msgpack/msg/audio_frame/field/data_fmt.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "msgpack/pack.h" -#include "msgpack/unpack.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void ten_msgpack_audio_frame_data_fmt_serialize( - ten_msg_t *self, msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_audio_frame_data_fmt_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/audio_frame/field/field_info.h b/packages/core_protocols/msgpack/msg/audio_frame/field/field_info.h deleted file mode 100644 index 09b3474e91..0000000000 --- a/packages/core_protocols/msgpack/msg/audio_frame/field/field_info.h +++ /dev/null @@ -1,86 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include - -#include "core_protocols/msgpack/msg/audio_frame/field/bytes_per_sample.h" -#include "core_protocols/msgpack/msg/audio_frame/field/data.h" -#include "core_protocols/msgpack/msg/audio_frame/field/data_fmt.h" -#include "core_protocols/msgpack/msg/audio_frame/field/line_size.h" -#include "core_protocols/msgpack/msg/audio_frame/field/number_of_channel.h" -#include "core_protocols/msgpack/msg/audio_frame/field/sample_rate.h" -#include "core_protocols/msgpack/msg/audio_frame/field/samples_per_channel.h" -#include "core_protocols/msgpack/msg/audio_frame/field/timestamp.h" -#include "core_protocols/msgpack/msg/field/field_info.h" -#include "core_protocols/msgpack/msg/msg.h" -#include "include_internal/ten_runtime/msg/audio_frame/field/field.h" - -#ifdef __cplusplus -#error \ - "This file contains C99 array designated initializer, and Visual Studio C++ compiler can only support up to C89 by default, so we enable this checking to prevent any wrong inclusion of this file." -#endif - -static const ten_protocol_msgpack_msg_field_info_t - ten_audio_frame_fields_info[] = { - [TEN_AUDIO_FRAME_FIELD_MSGHDR] = - { - .serialize = ten_msgpack_msghdr_serialize, - .deserialize = ten_msgpack_msghdr_deserialize, - }, - [TEN_AUDIO_FRAME_FIELD_TIMESTAMP] = - { - .serialize = ten_msgpack_audio_frame_timestamp_serialize, - .deserialize = ten_msgpack_audio_frame_timestamp_deserialize, - }, - [TEN_AUDIO_FRAME_FIELD_SAMPLE_RATE] = - { - .serialize = ten_msgpack_audio_frame_sample_rate_serialize, - .deserialize = ten_msgpack_audio_frame_sample_rate_deserialize, - }, - [TEN_AUDIO_FRAME_FIELD_BYTES_PER_SAMPLE] = - { - .serialize = ten_msgpack_audio_frame_bytes_per_sample_serialize, - .deserialize = - ten_msgpack_audio_frame_bytes_per_sample_deserialize, - }, - [TEN_AUDIO_FRAME_FIELD_SAMPLES_PER_CHANNEL] = - { - .serialize = - ten_msgpack_audio_frame_samples_per_channel_serialize, - .deserialize = - ten_msgpack_audio_frame_samples_per_channel_deserialize, - }, - [TEN_AUDIO_FRAME_FIELD_NUMBER_OF_CHANNEL] = - { - .serialize = - ten_msgpack_audio_frame_number_of_channel_serialize, - .deserialize = - ten_msgpack_audio_frame_number_of_channel_deserialize, - }, - [TEN_AUDIO_FRAME_FIELD_DATA_FMT] = - { - .serialize = ten_msgpack_audio_frame_data_fmt_serialize, - .deserialize = ten_msgpack_audio_frame_data_fmt_deserialize, - }, - [TEN_AUDIO_FRAME_FIELD_BUF] = - { - .serialize = ten_msgpack_audio_frame_data_serialize, - .deserialize = ten_msgpack_audio_frame_data_deserialize, - }, - [TEN_AUDIO_FRAME_FIELD_LINE_SIZE] = - { - .serialize = ten_msgpack_audio_frame_line_size_serialize, - .deserialize = ten_msgpack_audio_frame_line_size_deserialize, - }, - [TEN_AUDIO_FRAME_FIELD_LAST] = {0}, -}; - -static const size_t ten_audio_frame_fields_info_size = - sizeof(ten_audio_frame_fields_info) / - sizeof(ten_audio_frame_fields_info[0]); diff --git a/packages/core_protocols/msgpack/msg/audio_frame/field/line_size.c b/packages/core_protocols/msgpack/msg/audio_frame/field/line_size.c deleted file mode 100644 index 9599e005ac..0000000000 --- a/packages/core_protocols/msgpack/msg/audio_frame/field/line_size.c +++ /dev/null @@ -1,31 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "core_protocols/msgpack/msg/audio_frame/field/line_size.h" - -#include - -#include "core_protocols/msgpack/common/value.h" -#include "include_internal/ten_runtime/msg/audio_frame/audio_frame.h" -#include "include_internal/ten_runtime/msg/msg.h" -#include "ten_runtime/msg/audio_frame/audio_frame.h" - -void ten_msgpack_audio_frame_line_size_serialize(ten_msg_t *self, - msgpack_packer *pck) { - TEN_ASSERT(self && ten_raw_msg_check_integrity(self) && pck, - "Invalid argument."); - - ten_audio_frame_t *audio_frame = (ten_audio_frame_t *)self; - ten_msgpack_value_serialize(&audio_frame->line_size, pck); -} - -bool ten_msgpack_audio_frame_line_size_deserialize(ten_msg_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - return ten_msgpack_value_deserialize_inplace( - &((ten_audio_frame_t *)self)->line_size, unpacker, unpacked); -} diff --git a/packages/core_protocols/msgpack/msg/audio_frame/field/line_size.h b/packages/core_protocols/msgpack/msg/audio_frame/field/line_size.h deleted file mode 100644 index 0caca0d3f5..0000000000 --- a/packages/core_protocols/msgpack/msg/audio_frame/field/line_size.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "core_protocols/msgpack/common/common.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void ten_msgpack_audio_frame_line_size_serialize( - ten_msg_t *self, msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_audio_frame_line_size_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/audio_frame/field/number_of_channel.c b/packages/core_protocols/msgpack/msg/audio_frame/field/number_of_channel.c deleted file mode 100644 index 0bcb70d474..0000000000 --- a/packages/core_protocols/msgpack/msg/audio_frame/field/number_of_channel.c +++ /dev/null @@ -1,30 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "core_protocols/msgpack/msg/audio_frame/field/number_of_channel.h" - -#include - -#include "core_protocols/msgpack/common/value.h" -#include "include_internal/ten_runtime/msg/audio_frame/audio_frame.h" -#include "include_internal/ten_runtime/msg/msg.h" -#include "ten_runtime/msg/audio_frame/audio_frame.h" - -void ten_msgpack_audio_frame_number_of_channel_serialize(ten_msg_t *self, - msgpack_packer *pck) { - TEN_ASSERT(self && ten_raw_msg_check_integrity(self) && pck, - "Invalid argument."); - - ten_audio_frame_t *audio_frame = (ten_audio_frame_t *)self; - ten_msgpack_value_serialize(&audio_frame->number_of_channel, pck); -} - -bool ten_msgpack_audio_frame_number_of_channel_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - return ten_msgpack_value_deserialize_inplace( - &((ten_audio_frame_t *)self)->number_of_channel, unpacker, unpacked); -} diff --git a/packages/core_protocols/msgpack/msg/audio_frame/field/number_of_channel.h b/packages/core_protocols/msgpack/msg/audio_frame/field/number_of_channel.h deleted file mode 100644 index 5f79ff9ee2..0000000000 --- a/packages/core_protocols/msgpack/msg/audio_frame/field/number_of_channel.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "core_protocols/msgpack/common/common.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void -ten_msgpack_audio_frame_number_of_channel_serialize(ten_msg_t *self, - msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool -ten_msgpack_audio_frame_number_of_channel_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/audio_frame/field/sample_rate.c b/packages/core_protocols/msgpack/msg/audio_frame/field/sample_rate.c deleted file mode 100644 index b7aeec3638..0000000000 --- a/packages/core_protocols/msgpack/msg/audio_frame/field/sample_rate.c +++ /dev/null @@ -1,30 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "core_protocols/msgpack/msg/audio_frame/field/sample_rate.h" - -#include - -#include "core_protocols/msgpack/common/value.h" -#include "include_internal/ten_runtime/msg/audio_frame/audio_frame.h" -#include "include_internal/ten_runtime/msg/msg.h" -#include "ten_runtime/msg/audio_frame/audio_frame.h" - -void ten_msgpack_audio_frame_sample_rate_serialize(ten_msg_t *self, - msgpack_packer *pck) { - TEN_ASSERT(self && ten_raw_msg_check_integrity(self) && pck, - "Invalid argument."); - - ten_audio_frame_t *audio_frame = (ten_audio_frame_t *)self; - ten_msgpack_value_serialize(&audio_frame->sample_rate, pck); -} - -bool ten_msgpack_audio_frame_sample_rate_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - return ten_msgpack_value_deserialize_inplace( - &((ten_audio_frame_t *)self)->sample_rate, unpacker, unpacked); -} diff --git a/packages/core_protocols/msgpack/msg/audio_frame/field/sample_rate.h b/packages/core_protocols/msgpack/msg/audio_frame/field/sample_rate.h deleted file mode 100644 index 9d44d12090..0000000000 --- a/packages/core_protocols/msgpack/msg/audio_frame/field/sample_rate.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "core_protocols/msgpack/common/common.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void ten_msgpack_audio_frame_sample_rate_serialize( - ten_msg_t *self, msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_audio_frame_sample_rate_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/audio_frame/field/samples_per_channel.c b/packages/core_protocols/msgpack/msg/audio_frame/field/samples_per_channel.c deleted file mode 100644 index 7574e7a537..0000000000 --- a/packages/core_protocols/msgpack/msg/audio_frame/field/samples_per_channel.c +++ /dev/null @@ -1,30 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "core_protocols/msgpack/msg/audio_frame/field/samples_per_channel.h" - -#include - -#include "core_protocols/msgpack/common/value.h" -#include "include_internal/ten_runtime/msg/audio_frame/audio_frame.h" -#include "include_internal/ten_runtime/msg/msg.h" -#include "ten_runtime/msg/audio_frame/audio_frame.h" - -void ten_msgpack_audio_frame_samples_per_channel_serialize( - ten_msg_t *self, msgpack_packer *pck) { - TEN_ASSERT(self && ten_raw_msg_check_integrity(self) && pck, - "Invalid argument."); - - ten_audio_frame_t *audio_frame = (ten_audio_frame_t *)self; - ten_msgpack_value_serialize(&audio_frame->samples_per_channel, pck); -} - -bool ten_msgpack_audio_frame_samples_per_channel_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - return ten_msgpack_value_deserialize_inplace( - &((ten_audio_frame_t *)self)->samples_per_channel, unpacker, unpacked); -} diff --git a/packages/core_protocols/msgpack/msg/audio_frame/field/samples_per_channel.h b/packages/core_protocols/msgpack/msg/audio_frame/field/samples_per_channel.h deleted file mode 100644 index 3e5f356b17..0000000000 --- a/packages/core_protocols/msgpack/msg/audio_frame/field/samples_per_channel.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "core_protocols/msgpack/common/common.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void -ten_msgpack_audio_frame_samples_per_channel_serialize(ten_msg_t *self, - msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool -ten_msgpack_audio_frame_samples_per_channel_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/audio_frame/field/timestamp.c b/packages/core_protocols/msgpack/msg/audio_frame/field/timestamp.c deleted file mode 100644 index 6eb5034741..0000000000 --- a/packages/core_protocols/msgpack/msg/audio_frame/field/timestamp.c +++ /dev/null @@ -1,31 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "core_protocols/msgpack/msg/audio_frame/field/timestamp.h" - -#include - -#include "core_protocols/msgpack/common/value.h" -#include "include_internal/ten_runtime/msg/audio_frame/audio_frame.h" -#include "include_internal/ten_runtime/msg/msg.h" -#include "ten_runtime/msg/audio_frame/audio_frame.h" - -void ten_msgpack_audio_frame_timestamp_serialize(ten_msg_t *self, - msgpack_packer *pck) { - TEN_ASSERT(self && ten_raw_msg_check_integrity(self) && pck, - "Invalid argument."); - - ten_audio_frame_t *audio_frame = (ten_audio_frame_t *)self; - ten_msgpack_value_serialize(&audio_frame->timestamp, pck); -} - -bool ten_msgpack_audio_frame_timestamp_deserialize(ten_msg_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - return ten_msgpack_value_deserialize_inplace( - &((ten_audio_frame_t *)self)->timestamp, unpacker, unpacked); -} diff --git a/packages/core_protocols/msgpack/msg/audio_frame/field/timestamp.h b/packages/core_protocols/msgpack/msg/audio_frame/field/timestamp.h deleted file mode 100644 index 8479eecfc7..0000000000 --- a/packages/core_protocols/msgpack/msg/audio_frame/field/timestamp.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "core_protocols/msgpack/common/common.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void ten_msgpack_audio_frame_timestamp_serialize( - ten_msg_t *self, msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_audio_frame_timestamp_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/cmd/BUILD.gn b/packages/core_protocols/msgpack/msg/cmd/BUILD.gn deleted file mode 100644 index 1401ad96eb..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd/BUILD.gn +++ /dev/null @@ -1,21 +0,0 @@ -# -# This file is part of TEN Framework, an open source project. -# Licensed under the Apache License, Version 2.0. -# See the LICENSE file for more information. -# -import("//.gnfiles/build/feature/glob.gni") - -glob("cmd") { - file_list = all_native_files - include_dirs = [ - "//core", - "//packages", - ] - deps = [ - "close_app", - "custom", - "field", - "//core/src/ten_runtime:ten_runtime_library", - "//third_party/msgpack:msgpackc", - ] -} diff --git a/packages/core_protocols/msgpack/msg/cmd/close_app/BUILD.gn b/packages/core_protocols/msgpack/msg/cmd/close_app/BUILD.gn deleted file mode 100644 index 8f30979956..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd/close_app/BUILD.gn +++ /dev/null @@ -1,19 +0,0 @@ -# -# This file is part of TEN Framework, an open source project. -# Licensed under the Apache License, Version 2.0. -# See the LICENSE file for more information. -# -import("//.gnfiles/build/feature/glob.gni") - -glob("close_app") { - file_list = all_native_files - include_dirs = [ - "//core", - "//packages", - ] - deps = [ - "field", - "//core/src/ten_runtime:ten_runtime_library", - "//third_party/msgpack:msgpackc", - ] -} diff --git a/packages/core_protocols/msgpack/msg/cmd/close_app/cmd.c b/packages/core_protocols/msgpack/msg/cmd/close_app/cmd.c deleted file mode 100644 index cfa8a7625e..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd/close_app/cmd.c +++ /dev/null @@ -1,60 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "core_protocols/msgpack/msg/cmd/close_app/cmd.h" - -#include -#include -#include -#include - -#include "core_protocols/msgpack/msg/cmd/close_app/field/field_info.h" -#include "include_internal/ten_runtime/msg/cmd_base/cmd/close_app/cmd.h" -#include "include_internal/ten_runtime/msg/msg.h" -#include "ten_runtime/ten.h" -#include "ten_utils/lib/smart_ptr.h" - -bool ten_msgpack_cmd_close_app_serialize(ten_shared_ptr_t *self, - msgpack_packer *pck, - ten_error_t *err) { - TEN_ASSERT( - self && ten_msg_get_type(self) == TEN_MSG_TYPE_CMD_CLOSE_APP && pck, - "Invalid argument."); - - ten_cmd_close_app_t *raw_cmd = - (ten_cmd_close_app_t *)ten_msg_get_raw_msg(self); - - for (size_t i = 0; i < ten_cmd_close_app_fields_info_size; ++i) { - ten_msg_field_serialize_func_t serialize = - ten_cmd_close_app_fields_info[i].serialize; - if (serialize) { - serialize(&raw_cmd->cmd_hdr.cmd_base_hdr.msg_hdr, pck); - } - } - - return true; -} - -bool ten_msgpack_cmd_close_app_deserialize(ten_shared_ptr_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - ten_cmd_close_app_t *raw_cmd = - (ten_cmd_close_app_t *)ten_msg_get_raw_msg(self); - - for (size_t i = 0; i < ten_cmd_close_app_fields_info_size; ++i) { - ten_msg_field_deserialize_func_t deserialize = - ten_cmd_close_app_fields_info[i].deserialize; - if (deserialize) { - if (!deserialize(&raw_cmd->cmd_hdr.cmd_base_hdr.msg_hdr, unpacker, - unpacked)) { - return false; - } - } - } - - return true; -} diff --git a/packages/core_protocols/msgpack/msg/cmd/close_app/cmd.h b/packages/core_protocols/msgpack/msg/cmd/close_app/cmd.h deleted file mode 100644 index f07341aa06..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd/close_app/cmd.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include -#include - -#include "ten_utils/lib/error.h" -#include "ten_utils/lib/smart_ptr.h" - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_cmd_close_app_serialize( - ten_shared_ptr_t *self, msgpack_packer *pck, ten_error_t *err); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_cmd_close_app_deserialize( - ten_shared_ptr_t *self, msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/cmd/close_app/field/BUILD.gn b/packages/core_protocols/msgpack/msg/cmd/close_app/field/BUILD.gn deleted file mode 100644 index d0c879c824..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd/close_app/field/BUILD.gn +++ /dev/null @@ -1,18 +0,0 @@ -# -# This file is part of TEN Framework, an open source project. -# Licensed under the Apache License, Version 2.0. -# See the LICENSE file for more information. -# -import("//.gnfiles/build/feature/glob.gni") - -glob("field") { - file_list = all_native_files - include_dirs = [ - "//core", - "//packages", - ] - deps = [ - "//core/src/ten_runtime:ten_runtime_library", - "//third_party/msgpack:msgpackc", - ] -} diff --git a/packages/core_protocols/msgpack/msg/cmd/close_app/field/field_info.h b/packages/core_protocols/msgpack/msg/cmd/close_app/field/field_info.h deleted file mode 100644 index 8300855f01..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd/close_app/field/field_info.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include - -#include "core_protocols/msgpack/msg/cmd/cmd.h" -#include "core_protocols/msgpack/msg/field/field_info.h" -#include "include_internal/ten_runtime/msg/cmd_base/cmd/close_app/field/field.h" - -#ifdef __cplusplus -#error \ - "This file contains C99 array designated initializer, and Visual Studio C++ compiler can only support up to C89 by default, so we enable this checking to prevent any wrong inclusion of this file." -#endif - -static const ten_protocol_msgpack_msg_field_info_t - ten_cmd_close_app_fields_info[] = { - [TEN_CMD_CLOSE_APP_FIELD_CMD_HDR] = - { - .serialize = ten_msgpack_cmd_base_hdr_serialize, - .deserialize = ten_msgpack_cmd_base_hdr_deserialize, - }, - [TEN_CMD_CLOSE_APP_FIELD_LAST] = {0}, -}; - -static const size_t ten_cmd_close_app_fields_info_size = - sizeof(ten_cmd_close_app_fields_info) / - sizeof(ten_cmd_close_app_fields_info[0]); diff --git a/packages/core_protocols/msgpack/msg/cmd/cmd.c b/packages/core_protocols/msgpack/msg/cmd/cmd.c deleted file mode 100644 index 93ce66ef5c..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd/cmd.c +++ /dev/null @@ -1,137 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "core_protocols/msgpack/msg/cmd/cmd.h" - -#include - -#include "core_protocols/msgpack/msg/cmd/field/field_info.h" -#include "core_protocols/msgpack/msg/field/field_info.h" -#include "core_protocols/msgpack/msg/msg.h" -#include "include_internal/ten_runtime/common/constant_str.h" -#include "include_internal/ten_runtime/msg/cmd_base/cmd_base.h" -#include "include_internal/ten_runtime/msg/field/properties.h" -#include "include_internal/ten_runtime/msg/msg.h" -#include "ten_runtime/msg/cmd/custom/cmd.h" -#include "ten_utils/lib/alloc.h" -#include "ten_utils/lib/json.h" -#include "ten_utils/lib/smart_ptr.h" -#include "ten_utils/lib/string.h" -#include "ten_utils/value/value.h" - -bool ten_msgpack_cmd_serialize_through_json(ten_shared_ptr_t *self, - msgpack_packer *pck, - ten_error_t *err) { - TEN_ASSERT(self && ten_cmd_base_check_integrity(self), "Invalid argument."); - - bool result = true; - ten_json_t *json = NULL; - const char *json_str = NULL; - ten_shared_ptr_t *custom_cmd = NULL; - - json = ten_msg_to_json(self, err); - if (!json) { - result = false; - goto done; - } - - TEN_ASSERT(ten_json_check_integrity(json), "Invalid argument."); - - bool must_free = false; - json_str = ten_json_to_string(json, NULL, &must_free); - if (!json_str) { - result = false; - goto done; - } - TEN_ASSERT(json_str, "Invalid argument."); - - custom_cmd = ten_cmd_custom_create(TEN_STR_SPECIAL_CMD_FOR_SERIALIZATION); - TEN_ASSERT(custom_cmd && ten_cmd_base_check_integrity(custom_cmd), - "Invalid argument."); - - ten_msg_set_property(custom_cmd, TEN_STR_MSGPACK_SERIALIZATION_HACK, - ten_value_create_string(json_str), NULL); - - if (!ten_msgpack_msg_serialize(custom_cmd, pck, err)) { - result = false; - } - -done: - if (json_str && must_free) { - TEN_FREE(json_str); - } - if (custom_cmd) { - ten_shared_ptr_destroy(custom_cmd); - } - if (json) { - ten_json_destroy(json); - } - - return result; -} - -ten_shared_ptr_t *ten_msgpack_cmd_deserialize_through_json( - ten_shared_ptr_t *msg) { - TEN_ASSERT(msg && ten_msg_check_integrity(msg), "Invalid argument."); - - if (ten_msg_get_type(msg) == TEN_MSG_TYPE_CMD && - ten_c_string_is_equal(ten_msg_get_name(msg), - TEN_STR_SPECIAL_CMD_FOR_SERIALIZATION) && - ten_msg_is_property_exist(msg, TEN_STR_MSGPACK_SERIALIZATION_HACK, - NULL)) { - const char *json_str = ten_value_peek_raw_str( - ten_msg_peek_property(msg, TEN_STR_MSGPACK_SERIALIZATION_HACK, NULL)); - - ten_json_t *json = ten_json_from_string(json_str, NULL); - TEN_ASSERT(ten_json_check_integrity(json), "Invalid argument."); - - ten_shared_ptr_t *original_msg = ten_msg_create_from_json(json, NULL); - TEN_ASSERT(ten_msg_check_integrity(original_msg), "Invalid argument."); - - ten_shared_ptr_destroy(msg); - ten_json_destroy(json); - - return original_msg; - } - - return msg; -} - -void ten_msgpack_cmd_base_hdr_serialize(ten_msg_t *self, msgpack_packer *pck) { - TEN_ASSERT( - self && ten_raw_cmd_base_check_integrity((ten_cmd_base_t *)self) && pck, - "Invalid argument."); - - for (size_t i = 0; i < ten_cmd_base_fields_info_size; ++i) { - ten_msg_field_serialize_func_t serialize = - ten_cmd_base_fields_info[i].serialize; - if (serialize) { - serialize(self, pck); - } - } -} - -bool ten_msgpack_cmd_base_hdr_deserialize(ten_msg_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && ten_raw_cmd_base_check_integrity((ten_cmd_base_t *)self) && - unpacker && unpacked, - "Invalid argument."); - - ten_cmd_base_t *raw_cmd = (ten_cmd_base_t *)self; - TEN_ASSERT(ten_raw_cmd_base_check_integrity(raw_cmd), "Invalid argument."); - - for (size_t i = 0; i < ten_cmd_base_fields_info_size; ++i) { - ten_msg_field_deserialize_func_t deserialize = - ten_cmd_base_fields_info[i].deserialize; - if (deserialize) { - if (!deserialize(self, unpacker, unpacked)) { - return false; - } - } - } - - return true; -} diff --git a/packages/core_protocols/msgpack/msg/cmd/cmd.h b/packages/core_protocols/msgpack/msg/cmd/cmd.h deleted file mode 100644 index d626fdbb08..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd/cmd.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include - -#include "include_internal/ten_runtime/msg/msg.h" -#include "msgpack.h" -#include "ten_utils/lib/smart_ptr.h" - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_cmd_serialize_through_json( - ten_shared_ptr_t *self, msgpack_packer *pck, ten_error_t *err); - -TEN_RUNTIME_PRIVATE_API ten_shared_ptr_t * -ten_msgpack_cmd_deserialize_through_json(ten_shared_ptr_t *msg); - -TEN_RUNTIME_PRIVATE_API void ten_msgpack_cmd_base_hdr_serialize( - ten_msg_t *self, msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_cmd_base_hdr_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/cmd/custom/BUILD.gn b/packages/core_protocols/msgpack/msg/cmd/custom/BUILD.gn deleted file mode 100644 index 3fdb67e596..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd/custom/BUILD.gn +++ /dev/null @@ -1,19 +0,0 @@ -# -# This file is part of TEN Framework, an open source project. -# Licensed under the Apache License, Version 2.0. -# See the LICENSE file for more information. -# -import("//.gnfiles/build/feature/glob.gni") - -glob("custom") { - file_list = all_native_files - include_dirs = [ - "//core", - "//packages", - ] - deps = [ - "field", - "//core/src/ten_runtime:ten_runtime_library", - "//third_party/msgpack:msgpackc", - ] -} diff --git a/packages/core_protocols/msgpack/msg/cmd/custom/cmd.c b/packages/core_protocols/msgpack/msg/cmd/custom/cmd.c deleted file mode 100644 index 0844e3b864..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd/custom/cmd.c +++ /dev/null @@ -1,57 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "include_internal/ten_runtime/msg/cmd_base/cmd/cmd.h" - -#include "core_protocols/msgpack/msg/cmd/custom/cmd.h" -#include "core_protocols/msgpack/msg/cmd/custom/field/field_info.h" -#include "core_protocols/msgpack/msg/field/field_info.h" -#include "ten_runtime/msg/cmd/custom/cmd.h" -#include "ten_utils/macro/check.h" - -static ten_cmd_t *get_raw_cmd(ten_shared_ptr_t *self) { - TEN_ASSERT(self && ten_cmd_base_check_integrity(self), "Invalid argument."); - - return (ten_cmd_t *)ten_shared_ptr_get_data(self); -} - -bool ten_msgpack_cmd_custom_serialize(ten_shared_ptr_t *self, - msgpack_packer *pck, ten_error_t *err) { - TEN_ASSERT(self && ten_cmd_base_check_integrity(self) && pck, - "Invalid argument."); - - ten_cmd_t *raw_cmd = get_raw_cmd(self); - - for (size_t i = 0; i < ten_cmd_custom_fields_info_size; ++i) { - ten_msg_field_serialize_func_t serialize = - ten_cmd_custom_fields_info[i].serialize; - if (serialize) { - serialize(&raw_cmd->cmd_base_hdr.msg_hdr, pck); - } - } - - return true; -} - -bool ten_msgpack_cmd_custom_deserialize(ten_shared_ptr_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && ten_cmd_base_check_integrity(self) && unpacker && unpacked, - "Invalid argument."); - - ten_cmd_t *raw_cmd = get_raw_cmd(self); - - for (size_t i = 0; i < ten_cmd_custom_fields_info_size; ++i) { - ten_msg_field_deserialize_func_t deserialize = - ten_cmd_custom_fields_info[i].deserialize; - if (deserialize) { - if (!deserialize(&raw_cmd->cmd_base_hdr.msg_hdr, unpacker, unpacked)) { - return false; - } - } - } - - return true; -} diff --git a/packages/core_protocols/msgpack/msg/cmd/custom/cmd.h b/packages/core_protocols/msgpack/msg/cmd/custom/cmd.h deleted file mode 100644 index 90c7f4c199..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd/custom/cmd.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include -#include - -#include "ten_utils/lib/error.h" -#include "ten_utils/lib/smart_ptr.h" - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_cmd_custom_serialize( - ten_shared_ptr_t *self, msgpack_packer *pck, ten_error_t *err); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_cmd_custom_deserialize( - ten_shared_ptr_t *self, msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/cmd/custom/field/BUILD.gn b/packages/core_protocols/msgpack/msg/cmd/custom/field/BUILD.gn deleted file mode 100644 index d0c879c824..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd/custom/field/BUILD.gn +++ /dev/null @@ -1,18 +0,0 @@ -# -# This file is part of TEN Framework, an open source project. -# Licensed under the Apache License, Version 2.0. -# See the LICENSE file for more information. -# -import("//.gnfiles/build/feature/glob.gni") - -glob("field") { - file_list = all_native_files - include_dirs = [ - "//core", - "//packages", - ] - deps = [ - "//core/src/ten_runtime:ten_runtime_library", - "//third_party/msgpack:msgpackc", - ] -} diff --git a/packages/core_protocols/msgpack/msg/cmd/custom/field/field_info.h b/packages/core_protocols/msgpack/msg/cmd/custom/field/field_info.h deleted file mode 100644 index 2d14dcc0b3..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd/custom/field/field_info.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include - -#include "core_protocols/msgpack/msg/cmd/cmd.h" -#include "core_protocols/msgpack/msg/field/field_info.h" -#include "include_internal/ten_runtime/msg/cmd_base/cmd/custom/field/field.h" - -#ifdef __cplusplus -#error \ - "This file contains C99 array designated initializer, and Visual Studio C++ compiler can only support up to C89 by default, so we enable this checking to prevent any wrong inclusion of this file." -#endif - -static const ten_protocol_msgpack_msg_field_info_t - ten_cmd_custom_fields_info[] = { - [TEN_CMD_CUSTOM_FIELD_CMD_HDR] = - { - .serialize = ten_msgpack_cmd_base_hdr_serialize, - .deserialize = ten_msgpack_cmd_base_hdr_deserialize, - }, - [TEN_CMD_CUSTOM_FIELD_LAST] = {0}, -}; - -static const size_t ten_cmd_custom_fields_info_size = - sizeof(ten_cmd_custom_fields_info) / sizeof(ten_cmd_custom_fields_info[0]); diff --git a/packages/core_protocols/msgpack/msg/cmd/field/BUILD.gn b/packages/core_protocols/msgpack/msg/cmd/field/BUILD.gn deleted file mode 100644 index d0c879c824..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd/field/BUILD.gn +++ /dev/null @@ -1,18 +0,0 @@ -# -# This file is part of TEN Framework, an open source project. -# Licensed under the Apache License, Version 2.0. -# See the LICENSE file for more information. -# -import("//.gnfiles/build/feature/glob.gni") - -glob("field") { - file_list = all_native_files - include_dirs = [ - "//core", - "//packages", - ] - deps = [ - "//core/src/ten_runtime:ten_runtime_library", - "//third_party/msgpack:msgpackc", - ] -} diff --git a/packages/core_protocols/msgpack/msg/cmd/field/cmd_id.c b/packages/core_protocols/msgpack/msg/cmd/field/cmd_id.c deleted file mode 100644 index 339db10b1e..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd/field/cmd_id.c +++ /dev/null @@ -1,44 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "core_protocols/msgpack/msg/cmd/field/cmd_id.h" - -#include - -#include "include_internal/ten_runtime/msg/cmd_base/cmd_base.h" -#include "ten_utils/lib/string.h" -#include "ten_utils/macro/check.h" - -void ten_msgpack_cmd_id_serialize(ten_msg_t *self, msgpack_packer *pck) { - TEN_ASSERT(self && ten_raw_msg_check_integrity(self) && pck, - "Invalid argument."); - - int rc = msgpack_pack_str_with_body( - pck, ten_value_peek_raw_str(&(((ten_cmd_base_t *)self)->cmd_id)), - ten_string_len( - ten_value_peek_string(&(((ten_cmd_base_t *)self)->cmd_id)))); - TEN_ASSERT(rc == 0, "Should not happen."); -} - -bool ten_msgpack_cmd_id_deserialize(ten_msg_t *self, msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - msgpack_unpack_return rc = msgpack_unpacker_next(unpacker, unpacked); - if (rc == MSGPACK_UNPACK_SUCCESS) { - if (MSGPACK_DATA_TYPE == MSGPACK_OBJECT_STR) { - ten_string_set_formatted( - ten_value_peek_string(&((ten_cmd_base_t *)self)->cmd_id), "%.*s", - MSGPACK_DATA_STR_SIZE, MSGPACK_DATA_STR_PTR); - return true; - } else { - TEN_ASSERT(0, "Should not happen."); - } - } else { - TEN_ASSERT(0, "Should not happen."); - } - - return false; -} diff --git a/packages/core_protocols/msgpack/msg/cmd/field/cmd_id.h b/packages/core_protocols/msgpack/msg/cmd/field/cmd_id.h deleted file mode 100644 index 39c87cb6f5..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd/field/cmd_id.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "core_protocols/msgpack/common/common.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void ten_msgpack_cmd_id_serialize(ten_msg_t *self, - msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_cmd_id_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/cmd/field/field_info.h b/packages/core_protocols/msgpack/msg/cmd/field/field_info.h deleted file mode 100644 index 642da5d70e..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd/field/field_info.h +++ /dev/null @@ -1,49 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include - -#include "core_protocols/msgpack/msg/cmd/field/cmd_id.h" -#include "core_protocols/msgpack/msg/cmd/field/seq_id.h" -#include "core_protocols/msgpack/msg/field/field_info.h" -#include "core_protocols/msgpack/msg/msg.h" -#include "include_internal/ten_runtime/msg/cmd_base/field/field.h" - -#ifdef __cplusplus -#error \ - "This file contains C99 array designated initializer, and Visual Studio C++ compiler can only support up to C89 by default, so we enable this checking to prevent any wrong inclusion of this file." -#endif - -static const ten_protocol_msgpack_msg_field_info_t ten_cmd_base_fields_info[] = - { - [TEN_CMD_BASE_FIELD_MSGHDR] = - { - .serialize = ten_msgpack_msghdr_serialize, - .deserialize = ten_msgpack_msghdr_deserialize, - }, - [TEN_CMD_BASE_FIELD_CMD_ID] = - { - .serialize = ten_msgpack_cmd_id_serialize, - .deserialize = ten_msgpack_cmd_id_deserialize, - }, - [TEN_CMD_BASE_FIELD_SEQ_ID] = - { - .serialize = ten_msgpack_cmd_seq_id_serialize, - .deserialize = ten_msgpack_cmd_seq_id_deserialize, - }, - [TEN_CMD_BASE_FIELD_ORIGINAL_CONNECTION] = - { - .serialize = NULL, - .deserialize = NULL, - }, - [TEN_CMD_BASE_FIELD_LAST] = {0}, -}; - -static const size_t ten_cmd_base_fields_info_size = - sizeof(ten_cmd_base_fields_info) / sizeof(ten_cmd_base_fields_info[0]); diff --git a/packages/core_protocols/msgpack/msg/cmd/field/seq_id.c b/packages/core_protocols/msgpack/msg/cmd/field/seq_id.c deleted file mode 100644 index 29712e2db0..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd/field/seq_id.c +++ /dev/null @@ -1,45 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "core_protocols/msgpack/msg/cmd/field/seq_id.h" - -#include - -#include "include_internal/ten_runtime/msg/cmd_base/cmd_base.h" -#include "include_internal/ten_runtime/msg/msg.h" -#include "ten_utils/macro/check.h" - -void ten_msgpack_cmd_seq_id_serialize(ten_msg_t *self, msgpack_packer *pck) { - TEN_ASSERT(self && ten_raw_msg_check_integrity(self) && pck, - "Invalid argument."); - - const char *seq_id = - ten_value_peek_raw_str(&(((ten_cmd_base_t *)self)->seq_id)); - - int rc = msgpack_pack_str_with_body(pck, seq_id, strlen(seq_id)); - TEN_ASSERT(rc == 0, "Should not happen."); -} - -bool ten_msgpack_cmd_seq_id_deserialize(ten_msg_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - msgpack_unpack_return rc = msgpack_unpacker_next(unpacker, unpacked); - if (rc == MSGPACK_UNPACK_SUCCESS) { - if (MSGPACK_DATA_TYPE == MSGPACK_OBJECT_STR) { - ten_string_set_formatted( - ten_value_peek_string(&((ten_cmd_base_t *)self)->seq_id), "%.*s", - MSGPACK_DATA_STR_SIZE, MSGPACK_DATA_STR_PTR); - return true; - } else { - TEN_ASSERT(0, "Should not happen."); - } - } else { - TEN_ASSERT(0, "Should not happen."); - } - - return false; -} diff --git a/packages/core_protocols/msgpack/msg/cmd/field/seq_id.h b/packages/core_protocols/msgpack/msg/cmd/field/seq_id.h deleted file mode 100644 index 247c8094dc..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd/field/seq_id.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "core_protocols/msgpack/common/common.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void ten_msgpack_cmd_seq_id_serialize( - ten_msg_t *self, msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_cmd_seq_id_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/cmd_result/BUILD.gn b/packages/core_protocols/msgpack/msg/cmd_result/BUILD.gn deleted file mode 100644 index f693c215c2..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd_result/BUILD.gn +++ /dev/null @@ -1,19 +0,0 @@ -# -# This file is part of TEN Framework, an open source project. -# Licensed under the Apache License, Version 2.0. -# See the LICENSE file for more information. -# -import("//.gnfiles/build/feature/glob.gni") - -glob("cmd_result") { - file_list = all_native_files - include_dirs = [ - "//core", - "//packages", - ] - deps = [ - "field", - "//core/src/ten_runtime:ten_runtime_library", - "//third_party/msgpack:msgpackc", - ] -} diff --git a/packages/core_protocols/msgpack/msg/cmd_result/cmd.c b/packages/core_protocols/msgpack/msg/cmd_result/cmd.c deleted file mode 100644 index cb1152e72e..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd_result/cmd.c +++ /dev/null @@ -1,55 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "core_protocols/msgpack/msg/cmd_result/cmd.h" - -#include -#include -#include -#include - -#include "core_protocols/msgpack/msg/cmd_result/field/field_info.h" -#include "include_internal/ten_runtime/msg/cmd_base/cmd_result/cmd.h" -#include "include_internal/ten_runtime/msg/msg.h" -#include "ten_runtime/msg/cmd_result/cmd_result.h" -#include "ten_utils/lib/smart_ptr.h" - -bool ten_msgpack_cmd_result_serialize(ten_shared_ptr_t *self, - msgpack_packer *pck, ten_error_t *err) { - TEN_ASSERT(self && ten_msg_get_type(self) == TEN_MSG_TYPE_CMD_RESULT && pck, - "Invalid argument."); - - ten_cmd_result_t *raw_cmd = (ten_cmd_result_t *)ten_msg_get_raw_msg(self); - - for (size_t i = 0; i < ten_cmd_result_fields_info_size; ++i) { - ten_msg_field_serialize_func_t serialize = - ten_cmd_result_fields_info[i].serialize; - if (serialize) { - serialize(&raw_cmd->cmd_base_hdr.msg_hdr, pck); - } - } - - return true; -} - -bool ten_msgpack_cmd_result_deserialize(ten_shared_ptr_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - ten_cmd_result_t *raw_cmd = (ten_cmd_result_t *)ten_msg_get_raw_msg(self); - - for (size_t i = 0; i < ten_cmd_result_fields_info_size; ++i) { - ten_msg_field_deserialize_func_t deserialize = - ten_cmd_result_fields_info[i].deserialize; - if (deserialize) { - if (!deserialize(&raw_cmd->cmd_base_hdr.msg_hdr, unpacker, unpacked)) { - return false; - } - } - } - - return true; -} diff --git a/packages/core_protocols/msgpack/msg/cmd_result/cmd.h b/packages/core_protocols/msgpack/msg/cmd_result/cmd.h deleted file mode 100644 index 4108b88c02..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd_result/cmd.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include -#include - -#include "ten_utils/lib/error.h" -#include "ten_utils/lib/smart_ptr.h" - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_cmd_result_serialize( - ten_shared_ptr_t *self, msgpack_packer *pck, ten_error_t *err); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_cmd_result_deserialize( - ten_shared_ptr_t *self, msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/cmd_result/field/BUILD.gn b/packages/core_protocols/msgpack/msg/cmd_result/field/BUILD.gn deleted file mode 100644 index d0c879c824..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd_result/field/BUILD.gn +++ /dev/null @@ -1,18 +0,0 @@ -# -# This file is part of TEN Framework, an open source project. -# Licensed under the Apache License, Version 2.0. -# See the LICENSE file for more information. -# -import("//.gnfiles/build/feature/glob.gni") - -glob("field") { - file_list = all_native_files - include_dirs = [ - "//core", - "//packages", - ] - deps = [ - "//core/src/ten_runtime:ten_runtime_library", - "//third_party/msgpack:msgpackc", - ] -} diff --git a/packages/core_protocols/msgpack/msg/cmd_result/field/field_info.h b/packages/core_protocols/msgpack/msg/cmd_result/field/field_info.h deleted file mode 100644 index a95f7b41b1..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd_result/field/field_info.h +++ /dev/null @@ -1,51 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include - -#include "core_protocols/msgpack/msg/cmd/cmd.h" -#include "core_protocols/msgpack/msg/cmd_result/field/is_final.h" -#include "core_protocols/msgpack/msg/cmd_result/field/original_cmd_type.h" -#include "core_protocols/msgpack/msg/cmd_result/field/status_code.h" -#include "core_protocols/msgpack/msg/field/field_info.h" -#include "include_internal/ten_runtime/msg/cmd_base/cmd_result/field/field.h" - -#ifdef __cplusplus -#error \ - "This file contains C99 array designated initializer, and Visual Studio C++ compiler can only support up to C89 by default, so we enable this checking to prevent any wrong inclusion of this file." -#endif - -static const ten_protocol_msgpack_msg_field_info_t - ten_cmd_result_fields_info[] = { - [TEN_CMD_STATUS_FIELD_CMD_BASE_HDR] = - { - .serialize = ten_msgpack_cmd_base_hdr_serialize, - .deserialize = ten_msgpack_cmd_base_hdr_deserialize, - }, - [TEN_CMD_STATUS_FIELD_ORIGINAL_CMD_TYPE] = - { - .serialize = ten_msgpack_cmd_result_original_cmd_type_serialize, - .deserialize = - ten_msgpack_cmd_result_original_cmd_type_deserialize, - }, - [TEN_CMD_STATUS_FIELD_STATUS_CODE] = - { - .serialize = ten_msgpack_cmd_result_code_serialize, - .deserialize = ten_msgpack_cmd_result_code_deserialize, - }, - [TEN_CMD_STATUS_FIELD_IS_FINAL] = - { - .serialize = ten_msgpack_cmd_result_is_final_serialize, - .deserialize = ten_msgpack_cmd_result_is_final_deserialize, - }, - [TEN_CMD_STATUS_FIELD_LAST] = {0}, -}; - -static const size_t ten_cmd_result_fields_info_size = - sizeof(ten_cmd_result_fields_info) / sizeof(ten_cmd_result_fields_info[0]); diff --git a/packages/core_protocols/msgpack/msg/cmd_result/field/is_final.c b/packages/core_protocols/msgpack/msg/cmd_result/field/is_final.c deleted file mode 100644 index 0470b96e2f..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd_result/field/is_final.c +++ /dev/null @@ -1,55 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include -#include - -#include "cmake/msgpackc/install/include/msgpack/object.h" -#include "core_protocols/msgpack/common/common.h" -#include "include_internal/ten_runtime/msg/cmd_base/cmd_result/cmd.h" -#include "include_internal/ten_runtime/msg/cmd_base/cmd_result/field/status_code.h" -#include "include_internal/ten_utils/value/value_set.h" -#include "msgpack/object.h" -#include "ten_runtime/msg/cmd_result/cmd_result.h" -#include "ten_utils/value/value_get.h" - -void ten_msgpack_cmd_result_is_final_serialize(ten_msg_t *self, - msgpack_packer *pck) { - TEN_ASSERT( - self && ten_raw_msg_get_type(self) == TEN_MSG_TYPE_CMD_RESULT && pck, - "Invalid argument."); - - bool is_final = - ten_value_get_bool(&((ten_cmd_result_t *)self)->is_final, NULL); - - if (is_final) { - int rc = msgpack_pack_true(pck); - TEN_ASSERT(rc == 0, "Should not happen."); - } else { - int rc = msgpack_pack_false(pck); - TEN_ASSERT(rc == 0, "Should not happen."); - } -} - -bool ten_msgpack_cmd_result_is_final_deserialize(ten_msg_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - msgpack_unpack_return rc = msgpack_unpacker_next(unpacker, unpacked); - if (rc == MSGPACK_UNPACK_SUCCESS) { - if (MSGPACK_DATA_TYPE == MSGPACK_OBJECT_BOOLEAN) { - ten_value_set_bool(&((ten_cmd_result_t *)self)->is_final, - MSGPACK_DATA_BOOL); - return true; - } else { - TEN_ASSERT(0, "Should not happen."); - } - } else { - TEN_ASSERT(0, "Should not happen."); - } - - return false; -} diff --git a/packages/core_protocols/msgpack/msg/cmd_result/field/is_final.h b/packages/core_protocols/msgpack/msg/cmd_result/field/is_final.h deleted file mode 100644 index 9514480b59..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd_result/field/is_final.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "core_protocols/msgpack/common/common.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void ten_msgpack_cmd_result_is_final_serialize( - ten_msg_t *self, msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_cmd_result_is_final_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/cmd_result/field/original_cmd_type.c b/packages/core_protocols/msgpack/msg/cmd_result/field/original_cmd_type.c deleted file mode 100644 index 37c17a69c5..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd_result/field/original_cmd_type.c +++ /dev/null @@ -1,48 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "include_internal/ten_runtime/msg/cmd_base/cmd_result/field/original_cmd_type.h" - -#include -#include -#include - -#include "core_protocols/msgpack/common/common.h" -#include "include_internal/ten_runtime/msg/cmd_base/cmd_result/cmd.h" -#include "include_internal/ten_utils/value/value_set.h" -#include "msgpack/object.h" -#include "ten_runtime/msg/cmd_result/cmd_result.h" - -void ten_msgpack_cmd_result_original_cmd_type_serialize(ten_msg_t *self, - msgpack_packer *pck) { - TEN_ASSERT( - self && ten_raw_msg_get_type(self) == TEN_MSG_TYPE_CMD_RESULT && pck, - "Invalid argument."); - - int rc = msgpack_pack_int32( - pck, ten_value_get_int32(&((ten_cmd_result_t *)self)->original_cmd_type, - NULL)); - TEN_ASSERT(rc == 0, "Should not happen."); -} - -bool ten_msgpack_cmd_result_original_cmd_type_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - msgpack_unpack_return rc = msgpack_unpacker_next(unpacker, unpacked); - if (rc == MSGPACK_UNPACK_SUCCESS) { - if (MSGPACK_DATA_TYPE == MSGPACK_OBJECT_POSITIVE_INTEGER) { - ten_value_set_int32(&((ten_cmd_result_t *)self)->original_cmd_type, - (int32_t)MSGPACK_DATA_I64); - return true; - } else { - TEN_ASSERT(0, "Should not happen."); - } - } else { - TEN_ASSERT(0, "Should not happen."); - } - - return false; -} diff --git a/packages/core_protocols/msgpack/msg/cmd_result/field/original_cmd_type.h b/packages/core_protocols/msgpack/msg/cmd_result/field/original_cmd_type.h deleted file mode 100644 index 0db9ec4318..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd_result/field/original_cmd_type.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "core_protocols/msgpack/common/common.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void ten_msgpack_cmd_result_original_cmd_type_serialize( - ten_msg_t *self, msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool -ten_msgpack_cmd_result_original_cmd_type_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/cmd_result/field/status_code.c b/packages/core_protocols/msgpack/msg/cmd_result/field/status_code.c deleted file mode 100644 index ce7a446e44..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd_result/field/status_code.c +++ /dev/null @@ -1,48 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "include_internal/ten_runtime/msg/cmd_base/cmd_result/field/status_code.h" - -#include -#include -#include - -#include "core_protocols/msgpack/common/common.h" -#include "include_internal/ten_runtime/msg/cmd_base/cmd_result/cmd.h" -#include "include_internal/ten_utils/value/value_set.h" -#include "msgpack/object.h" -#include "ten_runtime/msg/cmd_result/cmd_result.h" - -void ten_msgpack_cmd_result_code_serialize(ten_msg_t *self, - msgpack_packer *pck) { - TEN_ASSERT( - self && ten_raw_msg_get_type(self) == TEN_MSG_TYPE_CMD_RESULT && pck, - "Invalid argument."); - - int rc = msgpack_pack_int32( - pck, ten_value_get_int32(&((ten_cmd_result_t *)self)->status_code, NULL)); - TEN_ASSERT(rc == 0, "Should not happen."); -} - -bool ten_msgpack_cmd_result_code_deserialize(ten_msg_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - msgpack_unpack_return rc = msgpack_unpacker_next(unpacker, unpacked); - if (rc == MSGPACK_UNPACK_SUCCESS) { - if (MSGPACK_DATA_TYPE == MSGPACK_OBJECT_POSITIVE_INTEGER) { - ten_value_set_int32(&((ten_cmd_result_t *)self)->status_code, - (int32_t)MSGPACK_DATA_I64); - return true; - } else { - TEN_ASSERT(0, "Should not happen."); - } - } else { - TEN_ASSERT(0, "Should not happen."); - } - - return false; -} diff --git a/packages/core_protocols/msgpack/msg/cmd_result/field/status_code.h b/packages/core_protocols/msgpack/msg/cmd_result/field/status_code.h deleted file mode 100644 index 18af2e6cb6..0000000000 --- a/packages/core_protocols/msgpack/msg/cmd_result/field/status_code.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "core_protocols/msgpack/common/common.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void ten_msgpack_cmd_result_code_serialize( - ten_msg_t *self, msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_cmd_result_code_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/data/BUILD.gn b/packages/core_protocols/msgpack/msg/data/BUILD.gn deleted file mode 100644 index ec0c17d051..0000000000 --- a/packages/core_protocols/msgpack/msg/data/BUILD.gn +++ /dev/null @@ -1,19 +0,0 @@ -# -# This file is part of TEN Framework, an open source project. -# Licensed under the Apache License, Version 2.0. -# See the LICENSE file for more information. -# -import("//.gnfiles/build/feature/glob.gni") - -glob("data") { - file_list = all_native_files - include_dirs = [ - "//core", - "//packages", - ] - deps = [ - "field", - "//core/src/ten_runtime:ten_runtime_library", - "//third_party/msgpack:msgpackc", - ] -} diff --git a/packages/core_protocols/msgpack/msg/data/data.c b/packages/core_protocols/msgpack/msg/data/data.c deleted file mode 100644 index 21af984e04..0000000000 --- a/packages/core_protocols/msgpack/msg/data/data.c +++ /dev/null @@ -1,46 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "ten_runtime/msg/data/data.h" - -#include "core_protocols/msgpack/msg/data/field/field_info.h" -#include "include_internal/ten_runtime/msg/data/data.h" - -bool ten_msgpack_data_serialize(ten_shared_ptr_t *self_, msgpack_packer *pck, - ten_error_t *err) { - TEN_ASSERT(self_ && pck, "Invalid argument."); - - ten_data_t *self = ten_shared_ptr_get_data(self_); - - for (size_t i = 0; i < ten_protocol_msgpack_data_fields_info_size; ++i) { - ten_msg_field_serialize_func_t serialize = - ten_protocol_msgpack_data_fields_info[i].serialize; - if (serialize) { - serialize(&self->msg_hdr, pck); - } - } - - return true; -} - -bool ten_msgpack_data_deserialize(ten_shared_ptr_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - ten_data_t *raw_msg = ten_shared_ptr_get_data(self); - - for (size_t i = 0; i < ten_protocol_msgpack_data_fields_info_size; ++i) { - ten_msg_field_deserialize_func_t deserialize = - ten_protocol_msgpack_data_fields_info[i].deserialize; - if (deserialize) { - if (!deserialize(&raw_msg->msg_hdr, unpacker, unpacked)) { - return false; - } - } - } - - return true; -} diff --git a/packages/core_protocols/msgpack/msg/data/data.h b/packages/core_protocols/msgpack/msg/data/data.h deleted file mode 100644 index 40b38f9b1f..0000000000 --- a/packages/core_protocols/msgpack/msg/data/data.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include -#include - -#include "ten_utils/lib/error.h" -#include "ten_utils/lib/smart_ptr.h" - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_data_serialize(ten_shared_ptr_t *self, - msgpack_packer *pck, - ten_error_t *err); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_data_deserialize( - ten_shared_ptr_t *self, msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/data/field/BUILD.gn b/packages/core_protocols/msgpack/msg/data/field/BUILD.gn deleted file mode 100644 index d0c879c824..0000000000 --- a/packages/core_protocols/msgpack/msg/data/field/BUILD.gn +++ /dev/null @@ -1,18 +0,0 @@ -# -# This file is part of TEN Framework, an open source project. -# Licensed under the Apache License, Version 2.0. -# See the LICENSE file for more information. -# -import("//.gnfiles/build/feature/glob.gni") - -glob("field") { - file_list = all_native_files - include_dirs = [ - "//core", - "//packages", - ] - deps = [ - "//core/src/ten_runtime:ten_runtime_library", - "//third_party/msgpack:msgpackc", - ] -} diff --git a/packages/core_protocols/msgpack/msg/data/field/buf.c b/packages/core_protocols/msgpack/msg/data/field/buf.c deleted file mode 100644 index 30ae3bbee1..0000000000 --- a/packages/core_protocols/msgpack/msg/data/field/buf.c +++ /dev/null @@ -1,32 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "core_protocols/msgpack/msg/data/field/buf.h" - -#include - -#include "core_protocols/msgpack/common/value.h" -#include "include_internal/ten_runtime/msg/data/data.h" -#include "include_internal/ten_runtime/msg/msg.h" -#include "ten_runtime/msg/data/data.h" -#include "ten_utils/lib/buf.h" -#include "ten_utils/macro/check.h" - -void ten_msgpack_data_buf_serialize(ten_msg_t *self, msgpack_packer *pck) { - TEN_ASSERT(self && ten_raw_msg_check_integrity(self) && pck, - "Invalid argument."); - - ten_data_t *data = (ten_data_t *)self; - ten_msgpack_value_serialize(&data->buf, pck); -} - -bool ten_msgpack_data_buf_deserialize(ten_msg_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - return ten_msgpack_value_deserialize_inplace(&((ten_data_t *)self)->buf, - unpacker, unpacked); -} diff --git a/packages/core_protocols/msgpack/msg/data/field/buf.h b/packages/core_protocols/msgpack/msg/data/field/buf.h deleted file mode 100644 index 16ec40b596..0000000000 --- a/packages/core_protocols/msgpack/msg/data/field/buf.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "core_protocols/msgpack/common/common.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void ten_msgpack_data_buf_serialize( - ten_msg_t *self, msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_data_buf_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/data/field/field_info.h b/packages/core_protocols/msgpack/msg/data/field/field_info.h deleted file mode 100644 index 4d49543c6a..0000000000 --- a/packages/core_protocols/msgpack/msg/data/field/field_info.h +++ /dev/null @@ -1,39 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include - -#include "core_protocols/msgpack/msg/data/field/buf.h" -#include "core_protocols/msgpack/msg/field/field_info.h" -#include "core_protocols/msgpack/msg/msg.h" -#include "include_internal/ten_runtime/msg/data/field/field.h" - -#ifdef __cplusplus -#error \ - "This file contains C99 array designated initializer, and Visual Studio C++ compiler can only support up to C89 by default, so we enable this checking to prevent any wrong inclusion of this file." -#endif - -static const ten_protocol_msgpack_msg_field_info_t - ten_protocol_msgpack_data_fields_info[] = { - [TEN_DATA_FIELD_MSGHDR] = - { - .serialize = ten_msgpack_msghdr_serialize, - .deserialize = ten_msgpack_msghdr_deserialize, - }, - [TEN_DATA_FIELD_BUF] = - { - .serialize = ten_msgpack_data_buf_serialize, - .deserialize = ten_msgpack_data_buf_deserialize, - }, - [TEN_DATA_FIELD_LAST] = {0}, -}; - -static const size_t ten_protocol_msgpack_data_fields_info_size = - sizeof(ten_protocol_msgpack_data_fields_info) / - sizeof(ten_protocol_msgpack_data_fields_info[0]); diff --git a/packages/core_protocols/msgpack/msg/field/dest.c b/packages/core_protocols/msgpack/msg/field/dest.c deleted file mode 100644 index 4d4bd1f80f..0000000000 --- a/packages/core_protocols/msgpack/msg/field/dest.c +++ /dev/null @@ -1,31 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "include_internal/ten_runtime/msg/field/dest.h" - -#include - -#include "core_protocols/msgpack/msg/loc.h" -#include "include_internal/ten_runtime/msg/msg.h" -#include "ten_utils/lib/string.h" -#include "ten_utils/macro/check.h" - -void ten_msgpack_msg_dest_serialize(ten_msg_t *self, msgpack_packer *pck) { - TEN_ASSERT(self && ten_raw_msg_check_integrity(self) && pck, - "Invalid argument."); - - ten_msgpack_loc_list_serialize(&self->dest_loc, pck); -} - -bool ten_msgpack_msg_dest_deserialize(ten_msg_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - ten_list_t dests = ten_msgpack_loc_list_deserialize(unpacker, unpacked); - ten_list_swap(&self->dest_loc, &dests); - - return true; -} diff --git a/packages/core_protocols/msgpack/msg/field/dest.h b/packages/core_protocols/msgpack/msg/field/dest.h deleted file mode 100644 index 4c6212984b..0000000000 --- a/packages/core_protocols/msgpack/msg/field/dest.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "core_protocols/msgpack/common/common.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void ten_msgpack_msg_dest_serialize( - ten_msg_t *self, msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_msg_dest_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/field/field_info.h b/packages/core_protocols/msgpack/msg/field/field_info.h deleted file mode 100644 index c01488348a..0000000000 --- a/packages/core_protocols/msgpack/msg/field/field_info.h +++ /dev/null @@ -1,68 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include - -#include "core_protocols/msgpack/msg/field/dest.h" -#include "core_protocols/msgpack/msg/field/name.h" -#include "core_protocols/msgpack/msg/field/properties.h" -#include "core_protocols/msgpack/msg/field/src.h" -#include "core_protocols/msgpack/msg/field/type.h" -#include "include_internal/ten_runtime/msg/field/field.h" - -#ifdef __cplusplus -#error \ - "This file contains C99 array designated initializer, and Visual Studio C++ compiler can only support up to C89 by default, so we enable this checking to prevent any wrong inclusion of this file." -#endif - -typedef void (*ten_msg_field_serialize_func_t)(ten_msg_t *self, - msgpack_packer *pck); - -typedef bool (*ten_msg_field_deserialize_func_t)(ten_msg_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked); - -typedef struct ten_protocol_msgpack_msg_field_info_t { - ten_msg_field_serialize_func_t serialize; - ten_msg_field_deserialize_func_t deserialize; -} ten_protocol_msgpack_msg_field_info_t; - -static const ten_protocol_msgpack_msg_field_info_t - ten_protocol_msgpack_msg_fields_info[] = { - [TEN_MSG_FIELD_TYPE] = - { - .serialize = ten_msgpack_msg_type_serialize, - .deserialize = NULL, - }, - [TEN_MSG_FIELD_NAME] = - { - .serialize = ten_msgpack_msg_name_serialize, - .deserialize = ten_msgpack_msg_name_deserialize, - }, - [TEN_MSG_FIELD_SRC] = - { - .serialize = ten_msgpack_msg_src_serialize, - .deserialize = ten_msgpack_msg_src_deserialize, - }, - [TEN_MSG_FIELD_DEST] = - { - .serialize = ten_msgpack_msg_dest_serialize, - .deserialize = ten_msgpack_msg_dest_deserialize, - }, - [TEN_MSG_FIELD_PROPERTIES] = - { - .serialize = ten_msgpack_msg_properties_serialize, - .deserialize = ten_msgpack_msg_properties_deserialize, - }, - [TEN_MSG_FIELD_LAST] = {0}, -}; - -static const size_t ten_protocol_msgpack_msg_fields_info_size = - sizeof(ten_protocol_msgpack_msg_fields_info) / - sizeof(ten_protocol_msgpack_msg_fields_info[0]); diff --git a/packages/core_protocols/msgpack/msg/field/name.c b/packages/core_protocols/msgpack/msg/field/name.c deleted file mode 100644 index a3199315b8..0000000000 --- a/packages/core_protocols/msgpack/msg/field/name.c +++ /dev/null @@ -1,42 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "core_protocols/msgpack/msg/cmd/field/cmd_id.h" -#include "include_internal/ten_runtime/msg/msg.h" -#include "msgpack/object.h" -#include "ten_utils/macro/check.h" - -void ten_msgpack_msg_name_serialize(ten_msg_t *self, msgpack_packer *pck) { - TEN_ASSERT(self && ten_raw_msg_check_integrity(self) && pck, - "Invalid argument."); - - const char *msg_name = ten_raw_msg_get_name(self); - - if (msg_name) { - int rc = msgpack_pack_str_with_body(pck, msg_name, strlen(msg_name)); - TEN_ASSERT(rc == 0, "Should not happen."); - } -} - -bool ten_msgpack_msg_name_deserialize(ten_msg_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - msgpack_unpack_return rc = msgpack_unpacker_next(unpacker, unpacked); - if (rc == MSGPACK_UNPACK_SUCCESS) { - if (MSGPACK_DATA_TYPE == MSGPACK_OBJECT_STR) { - ten_raw_msg_set_name_with_size(self, MSGPACK_DATA_STR_PTR, - MSGPACK_DATA_STR_SIZE, NULL); - return true; - } else { - TEN_ASSERT(0, "Should not happen."); - } - } else { - TEN_ASSERT(0, "Should not happen."); - } - - return false; -} diff --git a/packages/core_protocols/msgpack/msg/field/name.h b/packages/core_protocols/msgpack/msg/field/name.h deleted file mode 100644 index e6c35268e3..0000000000 --- a/packages/core_protocols/msgpack/msg/field/name.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "msgpack/pack.h" -#include "msgpack/unpack.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void ten_msgpack_msg_name_serialize( - ten_msg_t *self, msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_msg_name_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/field/properties.c b/packages/core_protocols/msgpack/msg/field/properties.c deleted file mode 100644 index d4de45344b..0000000000 --- a/packages/core_protocols/msgpack/msg/field/properties.c +++ /dev/null @@ -1,69 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// - -#include "include_internal/ten_runtime/msg/field/properties.h" - -#include - -#include "core_protocols/msgpack/common/common.h" -#include "core_protocols/msgpack/common/value.h" -#include "include_internal/ten_runtime/msg/msg.h" -#include "msgpack/object.h" -#include "msgpack/pack.h" -#include "ten_utils/container/list_ptr.h" -#include "ten_utils/macro/check.h" -#include "ten_utils/value/value_kv.h" - -void ten_msgpack_msg_properties_serialize(ten_msg_t *self, - msgpack_packer *pck) { - TEN_ASSERT(self && ten_raw_msg_check_integrity(self) && pck, - "Invalid argument."); - - // Dump properties information if there is any. - - // Dump the size of properties[] first, so that the destination can - // know the array size. - int rc = - msgpack_pack_uint32(pck, ten_list_size(ten_raw_msg_get_properties(self))); - TEN_ASSERT(rc == 0, "Should not happen."); - - ten_list_foreach (ten_raw_msg_get_properties(self), iter) { - ten_value_kv_t *property = ten_ptr_listnode_get(iter.node); - TEN_ASSERT(property, "Invalid argument."); - - ten_msgpack_value_kv_serialize(property, pck); - } -} - -bool ten_msgpack_msg_properties_deserialize(ten_msg_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - msgpack_unpack_return rc = msgpack_unpacker_next(unpacker, unpacked); - if (rc == MSGPACK_UNPACK_SUCCESS) { - if (MSGPACK_DATA_TYPE == MSGPACK_OBJECT_POSITIVE_INTEGER) { - // Save the value, otherwise, the afterwards unpacking would corrupt this - // value. - size_t properties_cnt = MSGPACK_DATA_I64; - - for (size_t i = 0; i < properties_cnt; i++) { - ten_value_kv_t *kv = - ten_msgpack_create_value_kv_through_deserialization(unpacker, - unpacked); - TEN_ASSERT(kv, "Should not happen."); - - ten_list_push_ptr_back( - ten_raw_msg_get_properties(self), kv, - (ten_ptr_listnode_destroy_func_t)ten_value_kv_destroy); - } - - return true; - } - } - - return false; -} diff --git a/packages/core_protocols/msgpack/msg/field/properties.h b/packages/core_protocols/msgpack/msg/field/properties.h deleted file mode 100644 index ec2b013c45..0000000000 --- a/packages/core_protocols/msgpack/msg/field/properties.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "core_protocols/msgpack/common/common.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void ten_msgpack_msg_properties_serialize( - ten_msg_t *self, msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_msg_properties_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/field/src.c b/packages/core_protocols/msgpack/msg/field/src.c deleted file mode 100644 index 7b3b479095..0000000000 --- a/packages/core_protocols/msgpack/msg/field/src.c +++ /dev/null @@ -1,28 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include - -#include "core_protocols/msgpack/common/common.h" -#include "core_protocols/msgpack/msg/field/dest.h" -#include "core_protocols/msgpack/msg/loc.h" -#include "core_protocols/msgpack/msg/msg.h" -#include "ten_utils/macro/check.h" - -void ten_msgpack_msg_src_serialize(ten_msg_t *self, msgpack_packer *pck) { - TEN_ASSERT(self && ten_raw_msg_check_integrity(self) && pck, - "Invalid argument."); - - ten_msgpack_loc_serialize(&self->src_loc, pck); -} - -bool ten_msgpack_msg_src_deserialize(ten_msg_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - ten_msgpack_loc_deserialize(&self->src_loc, unpacker, unpacked); - return true; -} diff --git a/packages/core_protocols/msgpack/msg/field/src.h b/packages/core_protocols/msgpack/msg/field/src.h deleted file mode 100644 index 9acb42e7c3..0000000000 --- a/packages/core_protocols/msgpack/msg/field/src.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "core_protocols/msgpack/common/common.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void ten_msgpack_msg_src_serialize(ten_msg_t *self, - msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_msg_src_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/loc.h b/packages/core_protocols/msgpack/msg/loc.h index ee7546fb55..0a12658331 100644 --- a/packages/core_protocols/msgpack/msg/loc.h +++ b/packages/core_protocols/msgpack/msg/loc.h @@ -10,10 +10,13 @@ #include #include -#include "core_protocols/msgpack/common/common.h" #include "include_internal/ten_runtime/common/loc.h" #include "ten_utils/lib/string.h" +typedef struct msgpack_packer msgpack_packer; +typedef struct msgpack_unpacker msgpack_unpacker; +typedef struct msgpack_unpacked msgpack_unpacked; + TEN_RUNTIME_PRIVATE_API void ten_msgpack_loc_serialize(ten_loc_t *self, msgpack_packer *pck); diff --git a/packages/core_protocols/msgpack/msg/msg.c b/packages/core_protocols/msgpack/msg/msg.c index a830224ed1..f30533bebf 100644 --- a/packages/core_protocols/msgpack/msg/msg.c +++ b/packages/core_protocols/msgpack/msg/msg.c @@ -10,9 +10,8 @@ #include "core_protocols/msgpack/common/common.h" #include "core_protocols/msgpack/common/parser.h" #include "core_protocols/msgpack/common/value.h" -#include "core_protocols/msgpack/msg/field/field_info.h" +#include "core_protocols/msgpack/msg/field/type.h" #include "core_protocols/msgpack/msg/msg.h" -#include "core_protocols/msgpack/msg/msg_info.h" #include "ten_utils/lib/smart_ptr.h" #include "ten_utils/macro/check.h" #include "ten_utils/macro/memory.h" @@ -37,37 +36,6 @@ void ten_msg_deserialize_info_destroy(ten_msg_deserialize_info_t *self) { TEN_FREE(self); } -void ten_msgpack_msghdr_serialize(ten_msg_t *self, msgpack_packer *pck) { - TEN_ASSERT(self && ten_raw_msg_check_integrity(self) && pck, - "Invalid argument."); - - for (size_t i = 0; i < ten_protocol_msgpack_msg_fields_info_size; ++i) { - ten_msg_field_serialize_func_t serialize = - ten_protocol_msgpack_msg_fields_info[i].serialize; - if (serialize) { - serialize(self, pck); - } - } -} - -bool ten_msgpack_msghdr_deserialize(ten_msg_t *self, msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && ten_raw_msg_check_integrity(self) && unpacker && unpacked, - "Invalid argument."); - - for (size_t i = 0; i < ten_protocol_msgpack_msg_fields_info_size; ++i) { - ten_msg_field_deserialize_func_t deserialize = - ten_protocol_msgpack_msg_fields_info[i].deserialize; - if (deserialize) { - if (!deserialize(self, unpacker, unpacked)) { - return false; - } - } - } - - return true; -} - static bool ten_msg_field_serialize(ten_msg_t *msg, ten_msg_field_process_data_t *field, void *user_data, ten_error_t *err) { @@ -280,7 +248,7 @@ void ten_msgpack_deserialize_msg(ten_msgpack_parser_t *parser, break; } - msg = ten_msgpack_cmd_deserialize_through_json(msg); + // msg = ten_msgpack_cmd_deserialize_through_json(msg); ten_list_push_smart_ptr_back(result_msgs, msg); ten_shared_ptr_destroy(msg); diff --git a/packages/core_protocols/msgpack/msg/msg.h b/packages/core_protocols/msgpack/msg/msg.h index e8605dee8b..d78102425e 100644 --- a/packages/core_protocols/msgpack/msg/msg.h +++ b/packages/core_protocols/msgpack/msg/msg.h @@ -24,12 +24,6 @@ ten_msg_deserialize_info_create(msgpack_unpacker *unpacker, TEN_RUNTIME_PRIVATE_API void ten_msg_deserialize_info_destroy( ten_msg_deserialize_info_t *self); -TEN_RUNTIME_PRIVATE_API void ten_msgpack_msghdr_serialize(ten_msg_t *self, - msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_msghdr_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); - TEN_RUNTIME_PRIVATE_API bool ten_msgpack_msg_serialize(ten_shared_ptr_t *self, msgpack_packer *pck, ten_error_t *err); diff --git a/packages/core_protocols/msgpack/msg/msg_info.h b/packages/core_protocols/msgpack/msg/msg_info.h deleted file mode 100644 index 4f98c27e84..0000000000 --- a/packages/core_protocols/msgpack/msg/msg_info.h +++ /dev/null @@ -1,98 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "core_protocols/msgpack/msg/audio_frame/audio_frame.h" -#include "core_protocols/msgpack/msg/cmd/close_app/cmd.h" -#include "core_protocols/msgpack/msg/cmd/cmd.h" -#include "core_protocols/msgpack/msg/cmd/custom/cmd.h" -#include "core_protocols/msgpack/msg/cmd_result/cmd.h" -#include "core_protocols/msgpack/msg/data/data.h" -#include "core_protocols/msgpack/msg/video_frame/video_frame.h" -#include "ten_runtime/ten.h" -#include "ten_utils/lib/smart_ptr.h" - -typedef bool (*ten_msg_serialize_func_t)(ten_shared_ptr_t *msg, - msgpack_packer *packer, - ten_error_t *err); - -typedef bool (*ten_msg_deserialize_func_t)(ten_shared_ptr_t *msg, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked); - -typedef struct ten_protocol_msgpack_msg_info_t { - ten_msg_serialize_func_t serialize; - ten_msg_deserialize_func_t deserialize; -} ten_protocol_msgpack_msg_info_t; - -#ifdef __cplusplus -#error \ - "This file contains C99 array designated initializer, and Visual Studio C++ compiler can only support up to C89 by default, so we enable this checking to prevent any wrong inclusion of this file." -#endif - -static const ten_protocol_msgpack_msg_info_t ten_msg_info[] = { - [TEN_MSG_TYPE_INVALID] = - { - .serialize = NULL, - .deserialize = NULL, - }, - [TEN_MSG_TYPE_CMD_START_GRAPH] = - { - .serialize = ten_msgpack_cmd_serialize_through_json, - .deserialize = NULL, - }, - [TEN_MSG_TYPE_CMD_RESULT] = - { - .serialize = ten_msgpack_cmd_result_serialize, - .deserialize = ten_msgpack_cmd_result_deserialize, - }, - [TEN_MSG_TYPE_CMD_TIMEOUT] = - { - .serialize = NULL, - .deserialize = NULL, - }, - [TEN_MSG_TYPE_CMD_TIMER] = - { - .serialize = NULL, - .deserialize = NULL, - }, - [TEN_MSG_TYPE_CMD_CLOSE_APP] = - { - .serialize = ten_msgpack_cmd_close_app_serialize, - .deserialize = ten_msgpack_cmd_close_app_deserialize, - }, - [TEN_MSG_TYPE_CMD_STOP_GRAPH] = - { - .serialize = NULL, - .deserialize = NULL, - }, - [TEN_MSG_TYPE_CMD] = - { - .serialize = ten_msgpack_cmd_custom_serialize, - .deserialize = ten_msgpack_cmd_custom_deserialize, - }, - [TEN_MSG_TYPE_DATA] = - { - .serialize = ten_msgpack_data_serialize, - .deserialize = ten_msgpack_data_deserialize, - }, - [TEN_MSG_TYPE_AUDIO_FRAME] = - { - .serialize = ten_msgpack_audio_frame_serialize, - .deserialize = ten_msgpack_audio_frame_deserialize, - }, - [TEN_MSG_TYPE_VIDEO_FRAME] = - { - .serialize = ten_msgpack_video_frame_serialize, - .deserialize = ten_msgpack_video_frame_deserialize, - }, - [TEN_MSG_TYPE_LAST] = {0}, -}; - -static const size_t ten_msg_info_size = - sizeof(ten_msg_info) / sizeof(ten_msg_info[0]); diff --git a/packages/core_protocols/msgpack/msg/video_frame/BUILD.gn b/packages/core_protocols/msgpack/msg/video_frame/BUILD.gn deleted file mode 100644 index bb578461f0..0000000000 --- a/packages/core_protocols/msgpack/msg/video_frame/BUILD.gn +++ /dev/null @@ -1,19 +0,0 @@ -# -# This file is part of TEN Framework, an open source project. -# Licensed under the Apache License, Version 2.0. -# See the LICENSE file for more information. -# -import("//.gnfiles/build/feature/glob.gni") - -glob("video_frame") { - file_list = all_native_files - include_dirs = [ - "//core", - "//packages", - ] - deps = [ - "field", - "//core/src/ten_runtime:ten_runtime_library", - "//third_party/msgpack:msgpackc", - ] -} diff --git a/packages/core_protocols/msgpack/msg/video_frame/field/BUILD.gn b/packages/core_protocols/msgpack/msg/video_frame/field/BUILD.gn deleted file mode 100644 index d0c879c824..0000000000 --- a/packages/core_protocols/msgpack/msg/video_frame/field/BUILD.gn +++ /dev/null @@ -1,18 +0,0 @@ -# -# This file is part of TEN Framework, an open source project. -# Licensed under the Apache License, Version 2.0. -# See the LICENSE file for more information. -# -import("//.gnfiles/build/feature/glob.gni") - -glob("field") { - file_list = all_native_files - include_dirs = [ - "//core", - "//packages", - ] - deps = [ - "//core/src/ten_runtime:ten_runtime_library", - "//third_party/msgpack:msgpackc", - ] -} diff --git a/packages/core_protocols/msgpack/msg/video_frame/field/buf.c b/packages/core_protocols/msgpack/msg/video_frame/field/buf.c deleted file mode 100644 index ca55076f75..0000000000 --- a/packages/core_protocols/msgpack/msg/video_frame/field/buf.c +++ /dev/null @@ -1,31 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "core_protocols/msgpack/msg/video_frame/field/buf.h" - -#include - -#include "core_protocols/msgpack/common/value.h" -#include "include_internal/ten_runtime/msg/msg.h" -#include "include_internal/ten_runtime/msg/video_frame/video_frame.h" -#include "ten_runtime/msg/video_frame/video_frame.h" - -void ten_msgpack_video_frame_buf_serialize(ten_msg_t *self, - msgpack_packer *pck) { - TEN_ASSERT(self && ten_raw_msg_check_integrity(self) && pck, - "Invalid argument."); - - ten_video_frame_t *video_frame = (ten_video_frame_t *)self; - ten_msgpack_value_serialize(&video_frame->data, pck); -} - -bool ten_msgpack_video_frame_buf_deserialize(ten_msg_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - return ten_msgpack_value_deserialize_inplace( - &((ten_video_frame_t *)self)->data, unpacker, unpacked); -} diff --git a/packages/core_protocols/msgpack/msg/video_frame/field/buf.h b/packages/core_protocols/msgpack/msg/video_frame/field/buf.h deleted file mode 100644 index 9fe96185fc..0000000000 --- a/packages/core_protocols/msgpack/msg/video_frame/field/buf.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "core_protocols/msgpack/common/common.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void ten_msgpack_video_frame_buf_serialize( - ten_msg_t *self, msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_video_frame_buf_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/video_frame/field/field_info.h b/packages/core_protocols/msgpack/msg/video_frame/field/field_info.h deleted file mode 100644 index 2b2b136000..0000000000 --- a/packages/core_protocols/msgpack/msg/video_frame/field/field_info.h +++ /dev/null @@ -1,63 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include - -#include "core_protocols/msgpack/msg/field/field_info.h" -#include "core_protocols/msgpack/msg/msg.h" -#include "core_protocols/msgpack/msg/video_frame/field/buf.h" -#include "core_protocols/msgpack/msg/video_frame/field/height.h" -#include "core_protocols/msgpack/msg/video_frame/field/pixel_fmt.h" -#include "core_protocols/msgpack/msg/video_frame/field/timestamp.h" -#include "core_protocols/msgpack/msg/video_frame/field/width.h" -#include "include_internal/ten_runtime/msg/video_frame/field/field.h" - -#ifdef __cplusplus -#error \ - "This file contains C99 array designated initializer, and Visual Studio C++ compiler can only support up to C89 by default, so we enable this checking to prevent any wrong inclusion of this file." -#endif - -static const ten_protocol_msgpack_msg_field_info_t - ten_video_frame_fields_info[] = { - [TEN_VIDEO_FRAME_FIELD_MSGHDR] = - { - .serialize = ten_msgpack_msghdr_serialize, - .deserialize = ten_msgpack_msghdr_deserialize, - }, - [TEN_VIDEO_FRAME_FIELD_PIXEL_FMT] = - { - .serialize = ten_msgpack_video_frame_pixel_fmt_serialize, - .deserialize = ten_msgpack_video_frame_pixel_fmt_deserialize, - }, - [TEN_VIDEO_FRAME_FIELD_TIMESTAMP] = - { - .serialize = ten_msgpack_video_frame_timestamp_serialize, - .deserialize = ten_msgpack_video_frame_timestamp_deserialize, - }, - [TEN_VIDEO_FRAME_FIELD_WIDTH] = - { - .serialize = ten_msgpack_video_frame_width_serialize, - .deserialize = ten_msgpack_video_frame_width_deserialize, - }, - [TEN_VIDEO_FRAME_FIELD_HEIGHT] = - { - .serialize = ten_msgpack_video_frame_height_serialize, - .deserialize = ten_msgpack_video_frame_height_deserialize, - }, - [TEN_VIDEO_FRAME_FIELD_BUF] = - { - .serialize = ten_msgpack_video_frame_buf_serialize, - .deserialize = ten_msgpack_video_frame_buf_deserialize, - }, - [TEN_VIDEO_FRAME_FIELD_LAST] = {0}, -}; - -static const size_t ten_video_frame_fields_info_size = - sizeof(ten_video_frame_fields_info) / - sizeof(ten_video_frame_fields_info[0]); diff --git a/packages/core_protocols/msgpack/msg/video_frame/field/height.c b/packages/core_protocols/msgpack/msg/video_frame/field/height.c deleted file mode 100644 index 096ca46418..0000000000 --- a/packages/core_protocols/msgpack/msg/video_frame/field/height.c +++ /dev/null @@ -1,45 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "core_protocols/msgpack/msg/video_frame/field/height.h" - -#include - -#include "core_protocols/msgpack/common/value.h" -#include "include_internal/ten_runtime/msg/msg.h" -#include "include_internal/ten_runtime/msg/video_frame/video_frame.h" -#include "msgpack/object.h" -#include "ten_runtime/msg/video_frame/video_frame.h" - -void ten_msgpack_video_frame_height_serialize(ten_msg_t *self, - msgpack_packer *pck) { - TEN_ASSERT(self && ten_raw_msg_check_integrity(self) && pck, - "Invalid argument."); - - ten_video_frame_t *video_frame = (ten_video_frame_t *)self; - ten_msgpack_value_serialize(&video_frame->height, pck); -} - -bool ten_msgpack_video_frame_height_deserialize(ten_msg_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - msgpack_unpack_return rc = msgpack_unpacker_next(unpacker, unpacked); - if (rc == MSGPACK_UNPACK_SUCCESS) { - if (MSGPACK_DATA_TYPE == MSGPACK_OBJECT_POSITIVE_INTEGER) { - ten_msgpack_value_deserialize_inplace( - &((ten_video_frame_t *)self)->height, unpacker, unpacked); - - return true; - } else { - TEN_ASSERT(0, "Should not happen."); - } - } else { - TEN_ASSERT(0, "Should not happen."); - } - - return false; -} diff --git a/packages/core_protocols/msgpack/msg/video_frame/field/height.h b/packages/core_protocols/msgpack/msg/video_frame/field/height.h deleted file mode 100644 index faa51d18f0..0000000000 --- a/packages/core_protocols/msgpack/msg/video_frame/field/height.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "core_protocols/msgpack/common/common.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void ten_msgpack_video_frame_height_serialize( - ten_msg_t *self, msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_video_frame_height_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/video_frame/field/pixel_fmt.c b/packages/core_protocols/msgpack/msg/video_frame/field/pixel_fmt.c deleted file mode 100644 index 6788f87e73..0000000000 --- a/packages/core_protocols/msgpack/msg/video_frame/field/pixel_fmt.c +++ /dev/null @@ -1,44 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "core_protocols/msgpack/msg/video_frame/field/pixel_fmt.h" - -#include - -#include "core_protocols/msgpack/common/value.h" -#include "include_internal/ten_runtime/msg/msg.h" -#include "include_internal/ten_runtime/msg/video_frame/video_frame.h" -#include "ten_runtime/msg/video_frame/video_frame.h" - -void ten_msgpack_video_frame_pixel_fmt_serialize(ten_msg_t *self, - msgpack_packer *pck) { - TEN_ASSERT(self && ten_raw_msg_check_integrity(self) && pck, - "Invalid argument."); - - ten_video_frame_t *video_frame = (ten_video_frame_t *)self; - ten_msgpack_value_serialize(&video_frame->pixel_fmt, pck); -} - -bool ten_msgpack_video_frame_pixel_fmt_deserialize(ten_msg_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - msgpack_unpack_return rc = msgpack_unpacker_next(unpacker, unpacked); - if (rc == MSGPACK_UNPACK_SUCCESS) { - if (MSGPACK_DATA_TYPE == MSGPACK_OBJECT_POSITIVE_INTEGER) { - ten_msgpack_value_deserialize_inplace( - &((ten_video_frame_t *)self)->pixel_fmt, unpacker, unpacked); - - return true; - } else { - TEN_ASSERT(0, "Should not happen."); - } - } else { - TEN_ASSERT(0, "Should not happen."); - } - - return false; -} diff --git a/packages/core_protocols/msgpack/msg/video_frame/field/pixel_fmt.h b/packages/core_protocols/msgpack/msg/video_frame/field/pixel_fmt.h deleted file mode 100644 index 0093b0ea6e..0000000000 --- a/packages/core_protocols/msgpack/msg/video_frame/field/pixel_fmt.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "core_protocols/msgpack/common/common.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void ten_msgpack_video_frame_pixel_fmt_serialize( - ten_msg_t *self, msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_video_frame_pixel_fmt_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/video_frame/field/timestamp.c b/packages/core_protocols/msgpack/msg/video_frame/field/timestamp.c deleted file mode 100644 index b3a8389b4a..0000000000 --- a/packages/core_protocols/msgpack/msg/video_frame/field/timestamp.c +++ /dev/null @@ -1,44 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "core_protocols/msgpack/msg/video_frame/field/timestamp.h" - -#include - -#include "core_protocols/msgpack/common/value.h" -#include "include_internal/ten_runtime/msg/msg.h" -#include "include_internal/ten_runtime/msg/video_frame/video_frame.h" -#include "ten_runtime/msg/video_frame/video_frame.h" - -void ten_msgpack_video_frame_timestamp_serialize(ten_msg_t *self, - msgpack_packer *pck) { - TEN_ASSERT(self && ten_raw_msg_check_integrity(self) && pck, - "Invalid argument."); - - ten_video_frame_t *video_frame = (ten_video_frame_t *)self; - ten_msgpack_value_serialize(&video_frame->timestamp, pck); -} - -bool ten_msgpack_video_frame_timestamp_deserialize(ten_msg_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - msgpack_unpack_return rc = msgpack_unpacker_next(unpacker, unpacked); - if (rc == MSGPACK_UNPACK_SUCCESS) { - if (MSGPACK_DATA_TYPE == MSGPACK_OBJECT_POSITIVE_INTEGER) { - ten_msgpack_value_deserialize_inplace( - &((ten_video_frame_t *)self)->timestamp, unpacker, unpacked); - - return true; - } else { - TEN_ASSERT(0, "Should not happen."); - } - } else { - TEN_ASSERT(0, "Should not happen."); - } - - return false; -} diff --git a/packages/core_protocols/msgpack/msg/video_frame/field/timestamp.h b/packages/core_protocols/msgpack/msg/video_frame/field/timestamp.h deleted file mode 100644 index 820fccb52b..0000000000 --- a/packages/core_protocols/msgpack/msg/video_frame/field/timestamp.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "core_protocols/msgpack/common/common.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void ten_msgpack_video_frame_timestamp_serialize( - ten_msg_t *self, msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_video_frame_timestamp_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/video_frame/field/width.c b/packages/core_protocols/msgpack/msg/video_frame/field/width.c deleted file mode 100644 index 2e485e2878..0000000000 --- a/packages/core_protocols/msgpack/msg/video_frame/field/width.c +++ /dev/null @@ -1,43 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "core_protocols/msgpack/msg/video_frame/field/width.h" - -#include - -#include "core_protocols/msgpack/common/value.h" -#include "include_internal/ten_runtime/msg/msg.h" -#include "include_internal/ten_runtime/msg/video_frame/video_frame.h" -#include "ten_runtime/msg/video_frame/video_frame.h" - -void ten_msgpack_video_frame_width_serialize(ten_msg_t *self, - msgpack_packer *pck) { - TEN_ASSERT(self && ten_raw_msg_check_integrity(self) && pck, - "Invalid argument."); - - ten_video_frame_t *video_frame = (ten_video_frame_t *)self; - ten_msgpack_value_serialize(&video_frame->width, pck); -} - -bool ten_msgpack_video_frame_width_deserialize(ten_msg_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - msgpack_unpack_return rc = msgpack_unpacker_next(unpacker, unpacked); - if (rc == MSGPACK_UNPACK_SUCCESS) { - if (MSGPACK_DATA_TYPE == MSGPACK_OBJECT_POSITIVE_INTEGER) { - ten_msgpack_value_deserialize_inplace(&((ten_video_frame_t *)self)->width, - unpacker, unpacked); - return true; - } else { - TEN_ASSERT(0, "Should not happen."); - } - } else { - TEN_ASSERT(0, "Should not happen."); - } - - return false; -} diff --git a/packages/core_protocols/msgpack/msg/video_frame/field/width.h b/packages/core_protocols/msgpack/msg/video_frame/field/width.h deleted file mode 100644 index 470c47a17f..0000000000 --- a/packages/core_protocols/msgpack/msg/video_frame/field/width.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include "core_protocols/msgpack/common/common.h" - -typedef struct ten_msg_t ten_msg_t; - -TEN_RUNTIME_PRIVATE_API void ten_msgpack_video_frame_width_serialize( - ten_msg_t *self, msgpack_packer *pck); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_video_frame_width_deserialize( - ten_msg_t *self, msgpack_unpacker *unpacker, msgpack_unpacked *unpacked); diff --git a/packages/core_protocols/msgpack/msg/video_frame/video_frame.c b/packages/core_protocols/msgpack/msg/video_frame/video_frame.c deleted file mode 100644 index a204ab1aa5..0000000000 --- a/packages/core_protocols/msgpack/msg/video_frame/video_frame.c +++ /dev/null @@ -1,51 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#include "core_protocols/msgpack/msg/video_frame/video_frame.h" - -#include -#include -#include - -#include "core_protocols/msgpack/msg/video_frame/field/field_info.h" -#include "include_internal/ten_runtime/msg/video_frame/video_frame.h" -#include "ten_runtime/msg/video_frame/video_frame.h" - -bool ten_msgpack_video_frame_serialize(ten_shared_ptr_t *self_, - msgpack_packer *pck, ten_error_t *err) { - TEN_ASSERT(self_ && pck, "Invalid argument."); - - ten_video_frame_t *self = ten_shared_ptr_get_data(self_); - - for (size_t i = 0; i < ten_video_frame_fields_info_size; ++i) { - ten_msg_field_serialize_func_t serialize = - ten_video_frame_fields_info[i].serialize; - if (serialize) { - serialize(&self->msg_hdr, pck); - } - } - - return true; -} - -bool ten_msgpack_video_frame_deserialize(ten_shared_ptr_t *self, - msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked) { - TEN_ASSERT(self && unpacker && unpacked, "Invalid argument."); - - ten_video_frame_t *raw_msg = ten_shared_ptr_get_data(self); - - for (size_t i = 0; i < ten_video_frame_fields_info_size; ++i) { - ten_msg_field_deserialize_func_t deserialize = - ten_video_frame_fields_info[i].deserialize; - if (deserialize) { - if (!deserialize(&raw_msg->msg_hdr, unpacker, unpacked)) { - return false; - } - } - } - - return true; -} diff --git a/packages/core_protocols/msgpack/msg/video_frame/video_frame.h b/packages/core_protocols/msgpack/msg/video_frame/video_frame.h deleted file mode 100644 index c38f0ba92b..0000000000 --- a/packages/core_protocols/msgpack/msg/video_frame/video_frame.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// This file is part of TEN Framework, an open source project. -// Licensed under the Apache License, Version 2.0. -// See the LICENSE file for more information. -// -#pragma once - -#include "ten_runtime/ten_config.h" - -#include -#include - -#include "ten_utils/lib/error.h" -#include "ten_utils/lib/smart_ptr.h" - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_video_frame_serialize( - ten_shared_ptr_t *self, msgpack_packer *pck, ten_error_t *err); - -TEN_RUNTIME_PRIVATE_API bool ten_msgpack_video_frame_deserialize( - ten_shared_ptr_t *self, msgpack_unpacker *unpacker, - msgpack_unpacked *unpacked);