Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(video): move encoder declarations to header #2185

Merged

Conversation

ReenigneArcher
Copy link
Member

Description

This PR aims to simplify creation of encoder fixtures for unit testing (#1603).

Screenshot

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

Branch Updates

LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch
must be updated before it can be merged. You must also
Allow edits from maintainers.

  • I want maintainers to keep my branch updated

@ReenigneArcher ReenigneArcher force-pushed the refactor(video)-move-encoder-declarations-to-header branch from 73c1b85 to a11a795 Compare February 27, 2024 15:28
@ReenigneArcher
Copy link
Member Author

Docs build fails due to duplicate C++ declaration. breathe-doc/breathe#972

@ReenigneArcher ReenigneArcher force-pushed the refactor(video)-move-encoder-declarations-to-header branch from a11a795 to 857030e Compare February 27, 2024 18:41
src/video.h Outdated Show resolved Hide resolved
src/video.h Outdated Show resolved Hide resolved
src/video.h Show resolved Hide resolved
src/video.h Outdated Show resolved Hide resolved
Copy link

@kentyman23 kentyman23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My using directive comment is the only one that might warrant a change.

@ReenigneArcher ReenigneArcher force-pushed the refactor(video)-move-encoder-declarations-to-header branch from 857030e to 578133d Compare February 27, 2024 20:31
src/video.h Outdated
Comment on lines 94 to 110
static std::string_view
from_flag(flag_e flag) {
#define _CONVERT(x) \
case flag_e::x: \
std::string_view(#x)
switch (flag) {
_CONVERT(PASSED);
_CONVERT(REF_FRAMES_RESTRICT);
_CONVERT(CBR);
_CONVERT(DYNAMIC_RANGE);
_CONVERT(VUI_PARAMETERS);
_CONVERT(MAX_FLAGS);
}
#undef _CONVERT

return {"unknown"};
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was refactored slightly to avoid using namespace std::literal; in the header.

@ReenigneArcher ReenigneArcher force-pushed the refactor(video)-move-encoder-declarations-to-header branch from 578133d to 20994a4 Compare February 27, 2024 20:39
@@ -14,7 +14,6 @@ extern "C" {
#include <libavutil/mastering_display_metadata.h>
#include <libavutil/opt.h>
#include <libavutil/pixdesc.h>
#include <libswscale/swscale.h>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is something else pulling this in for the swscale APIs below?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably swscale from the video.h

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can leave it in video.cpp as well, if that's preferred.

@ReenigneArcher ReenigneArcher force-pushed the refactor(video)-move-encoder-declarations-to-header branch 2 times, most recently from f443666 to 5c22ff9 Compare February 28, 2024 13:25
@ReenigneArcher ReenigneArcher marked this pull request as draft February 29, 2024 15:37
@ReenigneArcher
Copy link
Member Author

Converted to draft as there are a probably a few declarations that would need to be moved to the header in order to use for unit testing.

At least the following, but maybe more.

  bool
  validate_encoder(encoder_t &encoder, bool expect_failure);

@ReenigneArcher ReenigneArcher force-pushed the refactor(video)-move-encoder-declarations-to-header branch from 5c22ff9 to df6ac6b Compare February 29, 2024 22:57
@ReenigneArcher ReenigneArcher marked this pull request as ready for review February 29, 2024 23:43
@ReenigneArcher ReenigneArcher force-pushed the refactor(video)-move-encoder-declarations-to-header branch from df6ac6b to 73b3838 Compare February 29, 2024 23:44
@ReenigneArcher
Copy link
Member Author

ReenigneArcher commented Feb 29, 2024

I have a working H264 software encoder fixture, so I think this is ready

Edit: I now have parametrized encoder fixtures, unavailable encoders are skipped automatically except the software encoder which is set to fail since it "should" be available in all cases.

@ReenigneArcher ReenigneArcher force-pushed the refactor(video)-move-encoder-declarations-to-header branch 2 times, most recently from 815d277 to bdda93b Compare March 4, 2024 15:29
@ReenigneArcher ReenigneArcher requested a review from cgutman March 4, 2024 15:29
@ReenigneArcher ReenigneArcher force-pushed the refactor(video)-move-encoder-declarations-to-header branch from bdda93b to 6b45fe5 Compare March 9, 2024 16:37
@ReenigneArcher ReenigneArcher mentioned this pull request Mar 9, 2024
20 tasks
@ReenigneArcher ReenigneArcher force-pushed the refactor(video)-move-encoder-declarations-to-header branch from 6b45fe5 to d6abb19 Compare March 14, 2024 03:29
@ReenigneArcher ReenigneArcher force-pushed the refactor(video)-move-encoder-declarations-to-header branch from d6abb19 to f7ebffc Compare March 15, 2024 14:25
@ReenigneArcher ReenigneArcher merged commit 7534fa1 into nightly Mar 16, 2024
49 checks passed
@ReenigneArcher ReenigneArcher deleted the refactor(video)-move-encoder-declarations-to-header branch March 16, 2024 13:04
KuleRucket pushed a commit to KuleRucket/Sunshine that referenced this pull request Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants