initial commit, 4.5 stable
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
This commit is contained in:
37
modules/ogg/SCsub
Normal file
37
modules/ogg/SCsub
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python
|
||||
from misc.utility.scons_hints import *
|
||||
|
||||
Import("env")
|
||||
Import("env_modules")
|
||||
|
||||
env_ogg = env_modules.Clone()
|
||||
|
||||
# Thirdparty source files
|
||||
|
||||
thirdparty_obj = []
|
||||
|
||||
if env["builtin_libogg"]:
|
||||
thirdparty_dir = "#thirdparty/libogg/"
|
||||
thirdparty_sources = [
|
||||
"bitwise.c",
|
||||
"framing.c",
|
||||
]
|
||||
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
|
||||
|
||||
env_ogg.Prepend(CPPEXTPATH=[thirdparty_dir])
|
||||
|
||||
env_thirdparty = env_ogg.Clone()
|
||||
env_thirdparty.disable_warnings()
|
||||
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
|
||||
env.modules_sources += thirdparty_obj
|
||||
|
||||
|
||||
# Godot source files
|
||||
|
||||
module_obj = []
|
||||
|
||||
env_ogg.add_source_files(module_obj, "*.cpp")
|
||||
env.modules_sources += module_obj
|
||||
|
||||
# Needed to force rebuilding the module files when the thirdparty library is updated.
|
||||
env.Depends(module_obj, thirdparty_obj)
|
17
modules/ogg/config.py
Normal file
17
modules/ogg/config.py
Normal file
@@ -0,0 +1,17 @@
|
||||
def can_build(env, platform):
|
||||
return True
|
||||
|
||||
|
||||
def configure(env):
|
||||
pass
|
||||
|
||||
|
||||
def get_doc_classes():
|
||||
return [
|
||||
"OggPacketSequence",
|
||||
"OggPacketSequencePlayback",
|
||||
]
|
||||
|
||||
|
||||
def get_doc_path():
|
||||
return "doc_classes"
|
30
modules/ogg/doc_classes/OggPacketSequence.xml
Normal file
30
modules/ogg/doc_classes/OggPacketSequence.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="OggPacketSequence" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
A sequence of Ogg packets.
|
||||
</brief_description>
|
||||
<description>
|
||||
A sequence of Ogg packets.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="get_length" qualifiers="const">
|
||||
<return type="float" />
|
||||
<description>
|
||||
The length of this stream, in seconds.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="granule_positions" type="PackedInt64Array" setter="set_packet_granule_positions" getter="get_packet_granule_positions" default="PackedInt64Array()">
|
||||
Contains the granule positions for each page in this packet sequence.
|
||||
</member>
|
||||
<member name="packet_data" type="Array[]" setter="set_packet_data" getter="get_packet_data" default="[]">
|
||||
Contains the raw packets that make up this OggPacketSequence.
|
||||
</member>
|
||||
<member name="sampling_rate" type="float" setter="set_sampling_rate" getter="get_sampling_rate" default="0.0">
|
||||
Holds sample rate information about this sequence. Must be set by another class that actually understands the codec.
|
||||
</member>
|
||||
</members>
|
||||
</class>
|
9
modules/ogg/doc_classes/OggPacketSequencePlayback.xml
Normal file
9
modules/ogg/doc_classes/OggPacketSequencePlayback.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="OggPacketSequencePlayback" inherits="RefCounted" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
</brief_description>
|
||||
<description>
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
</class>
|
239
modules/ogg/ogg_packet_sequence.cpp
Normal file
239
modules/ogg/ogg_packet_sequence.cpp
Normal file
@@ -0,0 +1,239 @@
|
||||
/**************************************************************************/
|
||||
/* ogg_packet_sequence.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "ogg_packet_sequence.h"
|
||||
|
||||
#include "core/variant/typed_array.h"
|
||||
|
||||
void OggPacketSequence::push_page(int64_t p_granule_pos, const Vector<PackedByteArray> &p_data) {
|
||||
Vector<PackedByteArray> data_stored;
|
||||
for (int i = 0; i < p_data.size(); i++) {
|
||||
data_stored.push_back(p_data[i]);
|
||||
}
|
||||
page_granule_positions.push_back(p_granule_pos);
|
||||
page_data.push_back(data_stored);
|
||||
data_version++;
|
||||
}
|
||||
|
||||
void OggPacketSequence::set_packet_data(const TypedArray<Array> &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++) {
|
||||
// Push a new page. We cleared the vector so this will be at index `page_idx`.
|
||||
page_data.push_back(Vector<PackedByteArray>());
|
||||
TypedArray<PackedByteArray> this_page_data = p_data[page_idx];
|
||||
for (int packet = 0; packet < this_page_data.size(); packet++) {
|
||||
page_data.write[page_idx].push_back(this_page_data[packet]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TypedArray<Array> OggPacketSequence::get_packet_data() const {
|
||||
TypedArray<Array> ret;
|
||||
for (const Vector<PackedByteArray> &page : page_data) {
|
||||
Array page_variant;
|
||||
for (const PackedByteArray &packet : page) {
|
||||
page_variant.push_back(packet);
|
||||
}
|
||||
ret.push_back(page_variant);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
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++) {
|
||||
int64_t granule_pos = p_granule_positions[page_idx];
|
||||
page_granule_positions.push_back(granule_pos);
|
||||
}
|
||||
}
|
||||
|
||||
PackedInt64Array OggPacketSequence::get_packet_granule_positions() const {
|
||||
PackedInt64Array ret;
|
||||
for (int64_t granule_pos : page_granule_positions) {
|
||||
ret.push_back(granule_pos);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void OggPacketSequence::set_sampling_rate(float p_sampling_rate) {
|
||||
sampling_rate = p_sampling_rate;
|
||||
}
|
||||
|
||||
float OggPacketSequence::get_sampling_rate() const {
|
||||
return sampling_rate;
|
||||
}
|
||||
|
||||
int64_t OggPacketSequence::get_final_granule_pos() const {
|
||||
if (!page_granule_positions.is_empty()) {
|
||||
return page_granule_positions[page_granule_positions.size() - 1];
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
float OggPacketSequence::get_length() const {
|
||||
int64_t granule_pos = get_final_granule_pos();
|
||||
if (granule_pos < 0) {
|
||||
return 0;
|
||||
}
|
||||
return granule_pos / sampling_rate;
|
||||
}
|
||||
|
||||
Ref<OggPacketSequencePlayback> OggPacketSequence::instantiate_playback() {
|
||||
Ref<OggPacketSequencePlayback> playback;
|
||||
playback.instantiate();
|
||||
playback->ogg_packet_sequence = Ref<OggPacketSequence>(this);
|
||||
playback->data_version = data_version;
|
||||
|
||||
return playback;
|
||||
}
|
||||
|
||||
void OggPacketSequence::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_packet_data", "packet_data"), &OggPacketSequence::set_packet_data);
|
||||
ClassDB::bind_method(D_METHOD("get_packet_data"), &OggPacketSequence::get_packet_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_packet_granule_positions", "granule_positions"), &OggPacketSequence::set_packet_granule_positions);
|
||||
ClassDB::bind_method(D_METHOD("get_packet_granule_positions"), &OggPacketSequence::get_packet_granule_positions);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_sampling_rate", "sampling_rate"), &OggPacketSequence::set_sampling_rate);
|
||||
ClassDB::bind_method(D_METHOD("get_sampling_rate"), &OggPacketSequence::get_sampling_rate);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_length"), &OggPacketSequence::get_length);
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
bool OggPacketSequencePlayback::next_ogg_packet(ogg_packet **p_packet) const {
|
||||
ERR_FAIL_COND_V(data_version != ogg_packet_sequence->data_version, false);
|
||||
ERR_FAIL_COND_V(ogg_packet_sequence->page_data.is_empty(), false);
|
||||
ERR_FAIL_COND_V(ogg_packet_sequence->page_granule_positions.is_empty(), false);
|
||||
ERR_FAIL_COND_V(page_cursor >= ogg_packet_sequence->page_data.size(), false);
|
||||
|
||||
// Move on to the next page if need be. This happens first to help simplify seek logic.
|
||||
while (packet_cursor >= ogg_packet_sequence->page_data[page_cursor].size()) {
|
||||
packet_cursor = 0;
|
||||
page_cursor++;
|
||||
if (page_cursor >= ogg_packet_sequence->page_data.size()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ERR_FAIL_COND_V(page_cursor >= ogg_packet_sequence->page_data.size(), false);
|
||||
|
||||
packet->b_o_s = page_cursor == 0 && packet_cursor == 0;
|
||||
packet->e_o_s = page_cursor == ogg_packet_sequence->page_data.size() - 1 && packet_cursor == ogg_packet_sequence->page_data[page_cursor].size() - 1;
|
||||
packet->granulepos = packet_cursor == ogg_packet_sequence->page_data[page_cursor].size() - 1 ? ogg_packet_sequence->page_granule_positions[page_cursor] : -1;
|
||||
packet->packetno = packetno++;
|
||||
packet->bytes = ogg_packet_sequence->page_data[page_cursor][packet_cursor].size();
|
||||
packet->packet = (unsigned char *)(ogg_packet_sequence->page_data[page_cursor][packet_cursor].ptr());
|
||||
|
||||
*p_packet = packet;
|
||||
|
||||
packet_cursor++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
uint32_t actual_middle_page = after_page_inclusive + (before_page_inclusive - after_page_inclusive) / 2;
|
||||
// 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;
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
// Check if we have to go backwards.
|
||||
if (bisection_page == (unsigned int)-1) {
|
||||
for (uint32_t test_page = actual_middle_page; test_page >= after_page_inclusive; test_page--) {
|
||||
if (ogg_packet_sequence->page_data[test_page].size() > 0) {
|
||||
bisection_page = test_page;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bisection_page == (unsigned int)-1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int64_t bisection_granule_pos = ogg_packet_sequence->page_granule_positions[bisection_page];
|
||||
if (granule > bisection_granule_pos) {
|
||||
return seek_page_internal(granule, bisection_page + 1, before_page_inclusive);
|
||||
} else {
|
||||
return seek_page_internal(granule, after_page_inclusive, bisection_page);
|
||||
}
|
||||
}
|
||||
|
||||
bool OggPacketSequencePlayback::seek_page(int64_t p_granule_pos) {
|
||||
int correct_page = seek_page_internal(p_granule_pos, 0, ogg_packet_sequence->page_data.size() - 1);
|
||||
if (correct_page == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
packet_cursor = 0;
|
||||
page_cursor = correct_page;
|
||||
|
||||
// Don't pretend subsequent packets are contiguous with previous ones.
|
||||
packetno = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int64_t OggPacketSequencePlayback::get_page_number() const {
|
||||
return page_cursor;
|
||||
}
|
||||
|
||||
bool OggPacketSequencePlayback::set_page_number(int64_t p_page_number) {
|
||||
if (p_page_number >= 0 && p_page_number < ogg_packet_sequence->page_data.size()) {
|
||||
page_cursor = p_page_number;
|
||||
packet_cursor = 0;
|
||||
packetno = 0;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
OggPacketSequencePlayback::OggPacketSequencePlayback() {
|
||||
packet = new ogg_packet();
|
||||
}
|
||||
|
||||
OggPacketSequencePlayback::~OggPacketSequencePlayback() {
|
||||
delete packet;
|
||||
}
|
131
modules/ogg/ogg_packet_sequence.h
Normal file
131
modules/ogg/ogg_packet_sequence.h
Normal file
@@ -0,0 +1,131 @@
|
||||
/**************************************************************************/
|
||||
/* ogg_packet_sequence.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/io/resource.h"
|
||||
#include "core/variant/typed_array.h"
|
||||
#include "core/variant/variant.h"
|
||||
|
||||
#include <ogg/ogg.h>
|
||||
|
||||
class OggPacketSequencePlayback;
|
||||
|
||||
class OggPacketSequence : public Resource {
|
||||
GDCLASS(OggPacketSequence, Resource);
|
||||
|
||||
friend class OggPacketSequencePlayback;
|
||||
|
||||
// List of pages, each of which is a list of packets on that page. The innermost PackedByteArrays contain complete ogg packets.
|
||||
Vector<Vector<PackedByteArray>> page_data;
|
||||
|
||||
// List of the granule position for each page.
|
||||
Vector<uint64_t> page_granule_positions;
|
||||
|
||||
// The page after the current last page. Similar semantics to an end() iterator.
|
||||
int64_t end_page = 0;
|
||||
|
||||
uint64_t data_version = 0;
|
||||
|
||||
float sampling_rate = 0;
|
||||
float length = 0;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
// Pushes information about all the pages that ended on this page.
|
||||
// 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<PackedByteArray> &p_data);
|
||||
|
||||
void set_packet_data(const TypedArray<Array> &p_data);
|
||||
TypedArray<Array> get_packet_data() 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.
|
||||
void set_sampling_rate(float p_sampling_rate);
|
||||
|
||||
// Returns a sampling rate previously set by set_sampling_rate().
|
||||
float get_sampling_rate() const;
|
||||
|
||||
// Returns a length previously set by set_length().
|
||||
float get_length() const;
|
||||
|
||||
// Returns the granule position of the last page in this sequence.
|
||||
int64_t get_final_granule_pos() const;
|
||||
|
||||
Ref<OggPacketSequencePlayback> instantiate_playback();
|
||||
|
||||
OggPacketSequence() {}
|
||||
virtual ~OggPacketSequence() {}
|
||||
};
|
||||
|
||||
class OggPacketSequencePlayback : public RefCounted {
|
||||
GDCLASS(OggPacketSequencePlayback, RefCounted);
|
||||
|
||||
friend class OggPacketSequence;
|
||||
|
||||
Ref<OggPacketSequence> ogg_packet_sequence;
|
||||
|
||||
mutable int64_t page_cursor = 0;
|
||||
mutable int32_t packet_cursor = 0;
|
||||
|
||||
mutable ogg_packet *packet;
|
||||
|
||||
uint64_t data_version = 0;
|
||||
|
||||
mutable int64_t packetno = 0;
|
||||
|
||||
// Recursive bisection search for the correct page.
|
||||
uint32_t seek_page_internal(int64_t granule, uint32_t after_page_inclusive, uint32_t before_page_inclusive);
|
||||
|
||||
public:
|
||||
// Calling functions must not modify this packet.
|
||||
// Returns true on success, false on error or if there is no next packet.
|
||||
bool next_ogg_packet(ogg_packet **p_packet) const;
|
||||
|
||||
// Seeks to the page such that the previous page has a granule position less than or equal to this value,
|
||||
// and the current page has a granule position greater than this value.
|
||||
// Returns true on success, false on failure.
|
||||
bool seek_page(int64_t p_granule_pos);
|
||||
|
||||
// Gets the current page number.
|
||||
int64_t get_page_number() const;
|
||||
|
||||
// Moves to a specific page in the stream.
|
||||
// Returns true on success, false if the page number is out of bounds.
|
||||
bool set_page_number(int64_t p_page_number);
|
||||
|
||||
OggPacketSequencePlayback();
|
||||
virtual ~OggPacketSequencePlayback();
|
||||
};
|
48
modules/ogg/register_types.cpp
Normal file
48
modules/ogg/register_types.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
/**************************************************************************/
|
||||
/* register_types.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "register_types.h"
|
||||
|
||||
#include "ogg_packet_sequence.h"
|
||||
|
||||
void initialize_ogg_module(ModuleInitializationLevel p_level) {
|
||||
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||
return;
|
||||
}
|
||||
|
||||
GDREGISTER_CLASS(OggPacketSequence);
|
||||
GDREGISTER_CLASS(OggPacketSequencePlayback);
|
||||
}
|
||||
|
||||
void uninitialize_ogg_module(ModuleInitializationLevel p_level) {
|
||||
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||
return;
|
||||
}
|
||||
}
|
36
modules/ogg/register_types.h
Normal file
36
modules/ogg/register_types.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/**************************************************************************/
|
||||
/* register_types.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "modules/register_module_types.h"
|
||||
|
||||
void initialize_ogg_module(ModuleInitializationLevel p_level);
|
||||
void uninitialize_ogg_module(ModuleInitializationLevel p_level);
|
Reference in New Issue
Block a user