From 7adc8376ed79f016730845ea3a93f4015b95149e Mon Sep 17 00:00:00 2001 From: kobewi Date: Wed, 31 Aug 2022 19:24:04 +0200 Subject: Change Array arguments to TypedArray --- modules/ogg/doc_classes/OggPacketSequence.xml | 4 ++-- modules/ogg/ogg_packet_sequence.cpp | 16 ++++++++-------- modules/ogg/ogg_packet_sequence.h | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) (limited to 'modules/ogg') diff --git a/modules/ogg/doc_classes/OggPacketSequence.xml b/modules/ogg/doc_classes/OggPacketSequence.xml index d3bd4455d8..1148b38602 100644 --- a/modules/ogg/doc_classes/OggPacketSequence.xml +++ b/modules/ogg/doc_classes/OggPacketSequence.xml @@ -17,10 +17,10 @@ - + Contains the granule positions for each page in this packet sequence. - + Contains the raw packets that make up this OggPacketSequence. diff --git a/modules/ogg/ogg_packet_sequence.cpp b/modules/ogg/ogg_packet_sequence.cpp index de8bf4a087..b9e48191e1 100644 --- a/modules/ogg/ogg_packet_sequence.cpp +++ b/modules/ogg/ogg_packet_sequence.cpp @@ -41,7 +41,7 @@ void OggPacketSequence::push_page(int64_t p_granule_pos, const Vector &p_data) { data_version++; // Update the data version so old playbacks know that they can't rely on us anymore. page_data.clear(); for (int page_idx = 0; page_idx < p_data.size(); page_idx++) { @@ -54,8 +54,8 @@ void OggPacketSequence::set_packet_data(const Array &p_data) { } } -Array OggPacketSequence::get_packet_data() const { - Array ret; +TypedArray OggPacketSequence::get_packet_data() const { + TypedArray ret; for (const Vector &page : page_data) { Array page_variant; for (const PackedByteArray &packet : page) { @@ -66,7 +66,7 @@ Array OggPacketSequence::get_packet_data() const { return ret; } -void OggPacketSequence::set_packet_granule_positions(const Array &p_granule_positions) { +void OggPacketSequence::set_packet_granule_positions(const PackedInt64Array &p_granule_positions) { data_version++; // Update the data version so old playbacks know that they can't rely on us anymore. page_granule_positions.clear(); for (int page_idx = 0; page_idx < p_granule_positions.size(); page_idx++) { @@ -75,8 +75,8 @@ void OggPacketSequence::set_packet_granule_positions(const Array &p_granule_posi } } -Array OggPacketSequence::get_packet_granule_positions() const { - Array ret; +PackedInt64Array OggPacketSequence::get_packet_granule_positions() const { + PackedInt64Array ret; for (int64_t granule_pos : page_granule_positions) { ret.push_back(granule_pos); } @@ -127,8 +127,8 @@ void OggPacketSequence::_bind_methods() { ClassDB::bind_method(D_METHOD("get_length"), &OggPacketSequence::get_length); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "packet_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_packet_data", "get_packet_data"); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "granule_positions", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_packet_granule_positions", "get_packet_granule_positions"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "packet_data", PROPERTY_HINT_ARRAY_TYPE, "PackedByteArray", PROPERTY_USAGE_NO_EDITOR), "set_packet_data", "get_packet_data"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_INT64_ARRAY, "granule_positions", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_packet_granule_positions", "get_packet_granule_positions"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "sampling_rate", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_sampling_rate", "get_sampling_rate"); } diff --git a/modules/ogg/ogg_packet_sequence.h b/modules/ogg/ogg_packet_sequence.h index efd3b64a39..c275f0c639 100644 --- a/modules/ogg/ogg_packet_sequence.h +++ b/modules/ogg/ogg_packet_sequence.h @@ -67,11 +67,11 @@ public: // This should be called for each page, even for pages that no packets ended on. void push_page(int64_t p_granule_pos, const Vector &p_data); - void set_packet_data(const Array &p_data); - Array get_packet_data() const; + void set_packet_data(const TypedArray &p_data); + TypedArray get_packet_data() const; - void set_packet_granule_positions(const Array &p_granule_positions); - Array get_packet_granule_positions() const; + void set_packet_granule_positions(const PackedInt64Array &p_granule_positions); + PackedInt64Array get_packet_granule_positions() const; // Sets a sampling rate associated with this object. OggPacketSequence doesn't understand codecs, // so this value is naively stored as a convenience. -- cgit v1.2.3