summaryrefslogtreecommitdiff
path: root/modules/ogg
diff options
context:
space:
mode:
Diffstat (limited to 'modules/ogg')
-rw-r--r--modules/ogg/SCsub3
-rw-r--r--modules/ogg/doc_classes/OGGPacketSequence.xml2
-rw-r--r--modules/ogg/doc_classes/OGGPacketSequencePlayback.xml2
-rw-r--r--modules/ogg/ogg_packet_sequence.cpp14
-rw-r--r--modules/ogg/ogg_packet_sequence.h6
-rw-r--r--modules/ogg/register_types.cpp16
-rw-r--r--modules/ogg/register_types.h10
7 files changed, 31 insertions, 22 deletions
diff --git a/modules/ogg/SCsub b/modules/ogg/SCsub
index e415d92498..f15525648f 100644
--- a/modules/ogg/SCsub
+++ b/modules/ogg/SCsub
@@ -3,9 +3,6 @@
Import("env")
Import("env_modules")
-# Only kept to build the thirdparty library used by the theora and webm
-# modules.
-
env_ogg = env_modules.Clone()
# Thirdparty source files
diff --git a/modules/ogg/doc_classes/OGGPacketSequence.xml b/modules/ogg/doc_classes/OGGPacketSequence.xml
index deac5b67e2..bff3691ce0 100644
--- a/modules/ogg/doc_classes/OGGPacketSequence.xml
+++ b/modules/ogg/doc_classes/OGGPacketSequence.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="OGGPacketSequence" inherits="Resource" version="4.0">
+<class name="OGGPacketSequence" inherits="Resource" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description>
A sequence of OGG packets.
</brief_description>
diff --git a/modules/ogg/doc_classes/OGGPacketSequencePlayback.xml b/modules/ogg/doc_classes/OGGPacketSequencePlayback.xml
index 86dee15567..11fc1f4cb6 100644
--- a/modules/ogg/doc_classes/OGGPacketSequencePlayback.xml
+++ b/modules/ogg/doc_classes/OGGPacketSequencePlayback.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="OGGPacketSequencePlayback" inherits="RefCounted" version="4.0">
+<class name="OGGPacketSequencePlayback" inherits="RefCounted" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description>
</brief_description>
<description>
diff --git a/modules/ogg/ogg_packet_sequence.cpp b/modules/ogg/ogg_packet_sequence.cpp
index b7a3ad2876..da52ecfdd5 100644
--- a/modules/ogg/ogg_packet_sequence.cpp
+++ b/modules/ogg/ogg_packet_sequence.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -127,9 +127,9 @@ 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_NOEDITOR), "set_packet_data", "get_packet_data");
- ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "granule_positions", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_packet_granule_positions", "get_packet_granule_positions");
- ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "sampling_rate", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_sampling_rate", "get_sampling_rate");
+ 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::FLOAT, "sampling_rate", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_sampling_rate", "get_sampling_rate");
}
bool OGGPacketSequencePlayback::next_ogg_packet(ogg_packet **p_packet) const {
@@ -162,6 +162,7 @@ bool OGGPacketSequencePlayback::next_ogg_packet(ogg_packet **p_packet) const {
}
uint32_t OGGPacketSequencePlayback::seek_page_internal(int64_t granule, uint32_t after_page_inclusive, uint32_t before_page_inclusive) {
+ // FIXME: This function needs better corner case handling.
if (before_page_inclusive == after_page_inclusive) {
return before_page_inclusive;
}
@@ -169,7 +170,8 @@ uint32_t OGGPacketSequencePlayback::seek_page_internal(int64_t granule, uint32_t
// Complicating the bisection search algorithm, the middle page might not have a packet that ends on it,
// which means it might not have a correct granule position. Find a nearby page that does have a packet ending on it.
uint32_t bisection_page = -1;
- for (uint32_t test_page = actual_middle_page; test_page <= before_page_inclusive; test_page++) {
+ // Don't include before_page_inclusive because that always succeeds and will cause infinite recursion later.
+ for (uint32_t test_page = actual_middle_page; test_page < before_page_inclusive; test_page++) {
if (ogg_packet_sequence->page_data[test_page].size() > 0) {
bisection_page = test_page;
break;
diff --git a/modules/ogg/ogg_packet_sequence.h b/modules/ogg/ogg_packet_sequence.h
index b00ada06c1..73e3cb4fff 100644
--- a/modules/ogg/ogg_packet_sequence.h
+++ b/modules/ogg/ogg_packet_sequence.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -104,7 +104,7 @@ class OGGPacketSequencePlayback : public RefCounted {
mutable ogg_packet *packet;
- uint64_t data_version;
+ uint64_t data_version = 0;
mutable int64_t packetno = 0;
diff --git a/modules/ogg/register_types.cpp b/modules/ogg/register_types.cpp
index 3448e7063a..01f04aa3d5 100644
--- a/modules/ogg/register_types.cpp
+++ b/modules/ogg/register_types.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -32,9 +32,17 @@
#include "ogg_packet_sequence.h"
-void register_ogg_types() {
+void initialize_ogg_module(ModuleInitializationLevel p_level) {
+ if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
+ return;
+ }
+
GDREGISTER_CLASS(OGGPacketSequence);
GDREGISTER_CLASS(OGGPacketSequencePlayback);
}
-void unregister_ogg_types() {}
+void uninitialize_ogg_module(ModuleInitializationLevel p_level) {
+ if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
+ return;
+ }
+}
diff --git a/modules/ogg/register_types.h b/modules/ogg/register_types.h
index 49d5ed9c80..9065d26d07 100644
--- a/modules/ogg/register_types.h
+++ b/modules/ogg/register_types.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -31,7 +31,9 @@
#ifndef OGG_REGISTER_TYPES_H
#define OGG_REGISTER_TYPES_H
-void register_ogg_types();
-void unregister_ogg_types();
+#include "modules/register_module_types.h"
+
+void initialize_ogg_module(ModuleInitializationLevel p_level);
+void uninitialize_ogg_module(ModuleInitializationLevel p_level);
#endif // OGG_REGISTER_TYPES_H