Skip to content

Commit

Permalink
modernize
Browse files Browse the repository at this point in the history
- don't use structure member `frame_number` (deprecated in libav 6.0)
- use newer clang-format syntax (llvm 15)
  • Loading branch information
DanielaE committed Apr 2, 2023
1 parent 6f639a7 commit 4fdbdda
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 30 deletions.
35 changes: 14 additions & 21 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
---
Language: Cpp
Standard: Cpp11
Standard: Latest
BasedOnStyle: LLVM
ColumnLimit: 90
IndentWidth: 4
TabWidth: 4
UseTab: ForIndentation
AccessModifierOffset: -4
AlignConsecutiveAssignments: Consecutive
AlignConsecutiveDeclarations: None
AlwaysBreakTemplateDeclarations: Yes
AlignConsecutiveAssignments:
Enabled: true
AlignCompound: true
PadOperators: false
AlignConsecutiveBitFields:
Enabled: true
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Empty
AlwaysBreakTemplateDeclarations: Yes
BreakConstructorInitializers: BeforeComma
BreakBeforeBraces: Custom
BraceWrapping:
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
ConstructorInitializerIndentWidth: 0
Cpp11BracedListStyle: false
CompactNamespaces: true
IndentCaseLabels: true
IndentRequires: true
IndentRequiresClause: true
IndentPPDirectives: AfterHash
KeepEmptyLinesAtTheStartOfBlocks: false
PointerAlignment: Middle
Expand Down Expand Up @@ -48,21 +57,5 @@ IncludeCategories:
# Headers in "" with extension.
- Regex: '"([A-Za-z0-9.\Q/-_\E])+"'
Priority: 2
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
...

8 changes: 4 additions & 4 deletions Demo-App/caboodle.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ static inline auto convertFromWide(std::wstring_view U16) noexcept {
}

template <typename String>
concept canResizeAndOverwrite = requires(String Str, std::size_t Size,
std::size_t (*Callable)(char *, std::size_t)) {
{ Str.resize_and_overwrite(Size, Callable) };
};
concept canResizeAndOverwrite =
requires(String Str, std::size_t Size, std::size_t (*Callable)(char *, std::size_t)) {
{ Str.resize_and_overwrite(Size, Callable) };
};

template <canResizeAndOverwrite String = std::string>
decltype(auto) toUTF8(std::wstring_view Utf16, String && Utf8 = {}) {
Expand Down
5 changes: 4 additions & 1 deletion Demo-App/executor.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ export [[nodiscard]] auto makeScheduler(asio::io_context & Context,
// abort operation of a given object depending on its capabilities.
// the close() operation is customizable to cater for more involved closing requirements.

#define THIS_WORKS(x) (requires(T Object) { { x }; }) x;
#define THIS_WORKS(x) \
(requires(T Object) { \
{ x }; \
}) x;

// clang-format off
template <typename T>
Expand Down
4 changes: 2 additions & 2 deletions Demo-App/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ static auto centeredBox(tDimensions Dimensions,
FancyWindow::FancyWindow(tDimensions Dimensions) noexcept {
const auto Viewport = centeredBox(Dimensions);

Window_ = { "Look at me!",
Viewport.x, Viewport.y, Viewport.Width, Viewport.Height,
Window_ = { "Look at me!", // clang-format off
Viewport.x, Viewport.y, Viewport.Width, Viewport.Height, // clang-format on
SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIDDEN };
Renderer_ = { Window_, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC };

Expand Down
2 changes: 1 addition & 1 deletion Demo-App/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ auto resolveHostEndpoints(std::string_view HostName, tPort Port,
using tResolver = asio::ip::tcp::resolver;
auto Flags = tResolver::numeric_service;
if (HostName.empty() || HostName == Local) {
Flags |= tResolver::passive;
Flags |= tResolver::passive;
HostName = Local;
}

Expand Down
3 changes: 2 additions & 1 deletion Demo-App/videodecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ auto decodeFrames(libav::File File, libav::Codec Decoder)
while (successful(Result)) {
Result = avcodec_receive_frame(Decoder, Frame);
if (successful(Result))
co_yield makeVideoFrame(Frame, Decoder->frame_number, TickDuration);
co_yield makeVideoFrame(Frame, static_cast<int>(Decoder->frame_num),
TickDuration);
}
}
}
Expand Down

0 comments on commit 4fdbdda

Please sign in to comment.