Skip to content

Commit 3eca695

Browse files
committed
DiscordCoreAPI v1.40
-Removing superfluous functions from the OggDemuxer class and updating. -Modifying the MatroskaDemuxer class to better handle end-of-string demuxing. -Removing FFMPEG as a dependency as a result of having written our own audio Demuxers. For the Matroska and Ogg containers. Significant reduction to build time as well as memory usage while streaming audio. -Switching from std::copy to std::memcpy. -Modified it so that the library can now be built statically.
1 parent c22041d commit 3eca695

File tree

16 files changed

+36
-34
lines changed

16 files changed

+36
-34
lines changed

BuildTools/Classes/Packager/Vcpkg.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ function constructPortAndVersionFile(string $sha512 = "0"): string
164164
INSTALL "${SOURCE_PATH}/License.md"
165165
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}"
166166
RENAME copyright
167-
)';
167+
)
168+
';
168169
// ./Vcpkg/ports/discordcoreapi/vcpkg.json
169170
$versionFileContent = '{
170171
"name": "discordcoreapi",

Include/discordcoreapi/DiscordCoreClient.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include <discordcoreapi/ChannelEntities.hpp>
3232
#include <discordcoreapi/CoRoutine.hpp>
3333
#include <discordcoreapi/CommandController.hpp>
34-
#include <discordcoreapi/EventEntities.hpp>
34+
#include <discordcoreapi/Utilities/EventEntities.hpp>
3535
#include <discordcoreapi/EventManager.hpp>
3636
#include <discordcoreapi/GuildEntities.hpp>
3737
#include <discordcoreapi/GuildMemberEntities.hpp>

Include/discordcoreapi/EventManager.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <discordcoreapi/ApplicationCommandEntities.hpp>
3030
#include <discordcoreapi/AutoModerationEntities.hpp>
3131
#include <discordcoreapi/ChannelEntities.hpp>
32-
#include <discordcoreapi/EventEntities.hpp>
32+
#include <discordcoreapi/Utilities/EventEntities.hpp>
3333
#include <discordcoreapi/GuildEntities.hpp>
3434
#include <discordcoreapi/GuildMemberEntities.hpp>
3535
#include <discordcoreapi/MessageEntities.hpp>

Include/discordcoreapi/FoundationEntities.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -800,13 +800,13 @@ namespace DiscordCoreAPI {
800800
public:
801801
friend class GuildData;
802802

803-
String unicodeEmoji{};///< Emoji representing the Role.
804803
Permissions permissions{};///< The Role's base Guild Permissions.
805-
String name{};///< The Role's name.
804+
String unicodeEmoji{};///< Emoji representing the Role.
806805
Snowflake guildId{};///< The id of the Guild that this Role is from.
807806
int16_t position{};///< Its position amongst the rest of the Guild's roles.
808807
RoleFlags flags{};///< Role flags.
809808
int32_t color{};///< The Role's color.
809+
String name{};///< The Role's name.
810810

811811
RoleData() noexcept = default;
812812

@@ -917,9 +917,9 @@ namespace DiscordCoreAPI {
917917
Permissions permissions{};///< Their base-level Permissions in the Guild.
918918
GuildMemberFlags flags{};///< GuildMember flags.
919919
TimeStamp joinedAt{};///< When they joined the Guild.
920-
String nick{};///< Their nick/display name.
921920
Snowflake guildId{};///< The current Guild's id.
922921
UserIdBase user{};
922+
String nick{};///< Their nick/display name.
923923

924924
GuildMemberData() noexcept = default;
925925

@@ -974,10 +974,10 @@ namespace DiscordCoreAPI {
974974
Permissions permissions{};///< Their base-level Permissions in the Guild.
975975
GuildMemberFlags flags{};///< GuildMember flags.
976976
TimeStamp joinedAt{};///< When they joined the Guild.
977-
String nick{};///< Their nick/display name.
978977
Snowflake guildId{};///< The current Guild's id.
979978
IconHash avatar{};///< This GuildMember's Guild Avatar.
980979
UserData user{};
980+
String nick{};///< Their nick/display name.
981981

982982
GuildMemberCacheData() noexcept = default;
983983

@@ -1052,13 +1052,13 @@ namespace DiscordCoreAPI {
10521052
ChannelType type{ ChannelType::DM };///< The type of the Channel.
10531053
SortOrderTypes defaultSortOrder{};///< Default sorting order for a forum thread.
10541054
uint32_t memberCount{};///< Count of members active in the Channel.
1055-
String topic{};///< Channel topic.
10561055
Snowflake parentId{};///< Snowflake of the Channel's parent Channel/category.
1057-
String name{};///< Name of the Channel.
10581056
ChannelFlags flags{};///< Flags combined as a bitmask.
10591057
uint16_t position{};///< The position of the Channel, in the Guild's Channel list.
10601058
Snowflake ownerId{};///< Snowflake of the Channel's owner.
10611059
Snowflake guildId{};///< Snowflake of the Channel's Guild, if applicable.
1060+
String topic{};///< Channel topic.
1061+
String name{};///< Name of the Channel.
10621062

10631063
ChannelData() noexcept = default;
10641064

@@ -1769,24 +1769,24 @@ namespace DiscordCoreAPI {
17691769
/// \brief Data structure representing a single Guild.
17701770
class DiscordCoreAPI_Dll GuildData : public DiscordEntity {
17711771
public:
1772-
DiscordCoreClient* discordCoreClient{};///< A pointer to the DiscordCoreClient.
1773-
VoiceConnection* voiceConnection{};///< A pointer to the VoiceConnection, if present.
1774-
std::vector<PresenceUpdateData> presences{};///< Presence states for each of the GuildMembers.
17751772
std::vector<Snowflake> guildScheduledEvents{};///< Array of Guild channels.
1776-
std::vector<Snowflake> voiceStates{};///< Voice states for each of the guild members.
1777-
std::vector<Snowflake> members{};///< Array of GuildMembers.
1773+
std::vector<PresenceUpdateData> presences{};///< Presence states for each of the GuildMembers.
17781774
std::vector<Snowflake> stageInstances{};///< Array of Guild channels.
1775+
DiscordCoreClient* discordCoreClient{};///< A pointer to the DiscordCoreClient.
1776+
std::vector<Snowflake> voiceStates{};///< Voice states for each of the guild members.
1777+
VoiceConnection* voiceConnection{};///< A pointer to the VoiceConnection, if present.
17791778
std::vector<Snowflake> stickers{};///< Array of Guild channels.
17801779
std::vector<Snowflake> channels{};///< Array of Guild channels.
1780+
std::vector<Snowflake> members{};///< Array of GuildMembers.
17811781
std::vector<Snowflake> threads{};///< Array of Guild channels.
17821782
std::vector<Snowflake> roles{};///< Array of Guild roles.
17831783
std::vector<Snowflake> emoji{};///< Array of Guild channels.
17841784
uint32_t memberCount{};///< Member count.
17851785
TimeStamp joinedAt{};///< When the bot joined this Guild.
1786-
String name{};///< The Guild's name.
17871786
Snowflake ownerId{};///< User id of the Guild's owner.
17881787
GuildFlags flags{};///< Guild flags.
17891788
IconHash icon{};///< Url to the Guild's icon.
1789+
String name{};///< The Guild's name.
17901790

17911791
GuildData() noexcept = default;
17921792

Include/discordcoreapi/SongAPI.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#pragma once
2727

2828
#include <discordcoreapi/FoundationEntities.hpp>
29-
#include <discordcoreapi/EventEntities.hpp>
29+
#include <discordcoreapi/Utilities/EventEntities.hpp>
3030
#include <discordcoreapi/GuildMemberEntities.hpp>
3131
#include <discordcoreapi/VoiceConnection.hpp>
3232

Include/discordcoreapi/TCPConnection.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
#include <discordcoreapi/Utilities/RingBuffer.hpp>
2929
#include <discordcoreapi/FoundationEntities.hpp>
30-
#include <discordcoreapi/EventEntities.hpp>
30+
#include <discordcoreapi/Utilities/EventEntities.hpp>
3131

3232
#ifndef OPENSSL_NO_DEPRECATED
3333
#define OPENSSL_NO_DEPRECATED

Include/discordcoreapi/Utilities/AudioEncoder.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030

3131
namespace DiscordCoreInternal {
3232

33-
struct DiscordCoreAPI_Dll EncoderReturnData {
33+
struct EncoderReturnData {
3434
std::basic_string_view<uint8_t> data{};
3535
uint64_t sampleCount{};
3636
};
3737

38-
struct DiscordCoreAPI_Dll OpusEncoderWrapper {
39-
struct DiscordCoreAPI_Dll OpusEncoderDeleter {
38+
struct OpusEncoderWrapper {
39+
struct OpusEncoderDeleter {
4040
inline void operator()(OpusEncoder* other) noexcept {
4141
if (other) {
4242
opus_encoder_destroy(other);

Include/discordcoreapi/Utilities/Demuxers.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace DiscordCoreInternal {
4444
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
4545
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 };
4646

47-
class DiscordCoreAPI_Dll MatroskaDemuxer {
47+
class MatroskaDemuxer {
4848
public:
4949
inline MatroskaDemuxer(bool doWePrintErrorsNew) noexcept {
5050
doWePrintErrors = doWePrintErrorsNew;
@@ -193,7 +193,7 @@ namespace DiscordCoreInternal {
193193
}
194194
};
195195

196-
class DiscordCoreAPI_Dll OpusPacket {
196+
class OpusPacket {
197197
public:
198198
inline OpusPacket() noexcept = default;
199199

@@ -204,7 +204,7 @@ namespace DiscordCoreInternal {
204204
std::basic_string_view<uint8_t> data{};
205205
};
206206

207-
class DiscordCoreAPI_Dll OggPage {
207+
class OggPage {
208208
public:
209209

210210
inline OggPage(std::basic_string_view<uint8_t>& newData) noexcept {
@@ -263,7 +263,7 @@ namespace DiscordCoreInternal {
263263
}
264264
};
265265

266-
class DiscordCoreAPI_Dll OggDemuxer {
266+
class OggDemuxer {
267267
public:
268268

269269
inline OggDemuxer(bool doWePrintErrorsNew) noexcept {

Include/discordcoreapi/Utilities/Etf.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
namespace DiscordCoreAPI {
3131

32-
struct DiscordCoreAPI_Dll DCAException : public std::runtime_error {
32+
struct DCAException : public std::runtime_error {
3333
DCAException(const std::string& error, std::source_location location = std::source_location::current()) noexcept;
3434
};
3535

@@ -70,7 +70,7 @@ namespace DiscordCoreInternal {
7070
}
7171
}
7272

73-
struct DiscordCoreAPI_Dll EtfParseError : public DiscordCoreAPI::DCAException {
73+
struct EtfParseError : public DiscordCoreAPI::DCAException {
7474
public:
7575
inline explicit EtfParseError(const std::string& message) : DCAException(message){};
7676
};
@@ -91,7 +91,7 @@ namespace DiscordCoreInternal {
9191

9292
constexpr uint8_t formatVersion{ 131 };
9393

94-
class DiscordCoreAPI_Dll EtfParser {
94+
class EtfParser {
9595
public:
9696
friend class WebSocketClient;
9797

@@ -447,7 +447,7 @@ namespace DiscordCoreInternal {
447447
}
448448
};
449449

450-
struct DiscordCoreAPI_Dll EtfSerializeError : public DiscordCoreAPI::DCAException {
450+
struct EtfSerializeError : public DiscordCoreAPI::DCAException {
451451
public:
452452
inline EtfSerializeError(const std::string& message, std::source_location location = std::source_location::current())
453453
: DCAException(message, location){};
@@ -514,7 +514,7 @@ namespace DiscordCoreInternal {
514514
typename ValueType::key_type;
515515
} && HasRange<ValueType> && !EtfSerializerT<ValueType>;
516516

517-
class DiscordCoreAPI_Dll EtfSerializer {
517+
class EtfSerializer {
518518
public:
519519
using MapAllocatorType = std::allocator<std::pair<const std::string, EtfSerializer>>;
520520
template<typename ValueType> using allocator = std::allocator<std::decay_t<ValueType>>;
File renamed without changes.

0 commit comments

Comments
 (0)