* Include Jellyfin Exoplayer FFmpeg dep
Port the includes from the Android repo as-is into this repo to include
the dependency
Convert our initialisation to prefer the built in extensions. This
should avoid flaky device logic and matches the Android app choice too.
* Drop check for DCS / DCA on firestick gen 1
FFmpeg should handle the decoding on these devices for us natively, and
likely uses the same codepath as libVLC. This should help us stick with
the native player instead of VLC where possible
* Replace TvApp.getApplication with getting context from activity
This removes another deprecated usage of TvApp by the reviewer
* Add new codecs to list of supported profiles
Adds the new codecs to reflect the new capabilities available from our
FFmpeg extensions.
* Refactor duplicated audio codec list into method
Refactor the duplicated audio codecs. Whilst I can't think of a case
where a user might play say DTS / TrueHD audio files, I equally can't
think of a reason why not to support it.
This simplifies the code, whilst allowing us to still extend the list
with some Audio only codecs for audio direct-play
* Lowercase PCM formats
This matches the format found on the server and the Android mobile
implementation to be safe
* AudioDirectPlayProfile: Replace vaarg with Array<String>
This allows us to easily combine two arrays together without having to
create copies with spread operators.
Internally the copies still function the same as we have an interable
type we are applying joinToString(",") with
* Switch to using EXTENSION_RENDERER_MODE_ON
This will use the system core renderers first. To get the fallback
behaviour we simply needed to add `setEnabledDecoderFallback`. This
allows Exoplayer to try the first decoder, then silently fallback on
error to ffmpeg.
Functionally this matches the implementation goals in the Android Mobile where
they will manually fallback instead. Since we can't access / restart the
media queue easily in this repo.
* Code cleanup from PR review
Addresses various comments where we can improve the readability around
the various changes we've made
* Drop ExoPlayerProfileTests
Since it only check hardcoded values which rarely change are there
* Whitespace tidy up + manual reformatting
Some various tidy ups and manual reformatting as pointed out from the
PR. This helps reduce down the amount of empty whitespace in the file
* Formatting fixes
Various hand-fixes where the formatter hasn't quite got it right
* Add Mockk to test framework deps
Add Mockk as this is aware of Kotlin inheritence unlike Mockito.
This primarily shows up where classes are not marked open. We can
either:
- Mark all unit tested classes open (least viable option)
- Add boilerplate to Mockito each time we test a Kotlin class
- Add a mocking framework that is Kotlin aware.
In this case I've opted for the latter, since it also avoids us having
to look up the boilerplate for static mocks...etc.
* Stub out testing Android.utils.log
Slf4j will try to invoke IsLoggable, despite stubbing out everything
else, which is explicitly disabled within the Android SDK.
We could revert to hacks, such as using Android -> returnDefaultValue=true in the
testing options. But according to the docs this should be a last resort.
Instead we can simply stub out the logging to forward calls to println,
allowing us to mock / init anything that uses SLF4J implicitly.
* Add tests and null checks for DeviceUtils
This commit does two things to help testing going forwards:
- It adds a null check for Build.MODEL, typically found in unit tests.
Allowing us to simply avoid having to mock all the various capability
tests which were throwing NPEs in unit tests.
- Adds tests for the existing functionality. This requires Mockk to
easily overwrite static class methods. We also add a small shim method
to make mocking much easier too.
* Run CustomSeekProvider through automatic Java->Kotlin
Convert the file to Kotlin. This means all of our unit tests that use
Mockk will have the same syntax inside, making it much easier for future
developers to reason with.
* Convert Mockito to Mockk
Converts the single usage of Mockito to Mockk, so we can use the same
mocking framework throughout the codebase.
* Drop Mockito in favour of Mockk
Drops Mockito to use Mockk throughout the project.
This is because we have a mix between Java and Kotlin. The latter is
"harder" to mock as classes are not marked open by default.
This means Mockito requires boilerplate in comparison to Mockk.
Additionally, using a single framework lowers the burden on developers
to known multiple tools
* Run Android Studio formatter over code
Despite having format on save enabled, many lines were missed (probably
from the cherry-pick).
Run formatter over the code to address PR reviewer comments.
* Return string instead of null from getBuildModel
This removes a number of null checks from the implementation, and allows
us to mark the method as nonNull too.
This allows Koin to do DI during unit tests and allows us to establish
Junit rules which involve Koin
This is essential for testing some classes as the playback code, where
DI is used heavily
This simplifies our code as there is now only a single place to restore the session. This automatically supports opening the app after putting it in the background.