| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * This file is part of the Falcon Player (FPP) and is Copyright (C) | ||
| 3 | * 2013-2022 by the Falcon Player Developers. | ||
| 4 | * | ||
| 5 | * The Falcon Player (FPP) is free software, and is covered under | ||
| 6 | * multiple Open Source licenses. Please see the included 'LICENSES' | ||
| 7 | * file for descriptions of what files are covered by each license. | ||
| 8 | * | ||
| 9 | * This source file is covered under the LGPL v2.1 as described in the | ||
| 10 | * included LICENSE.LGPL file. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include "fpp-pch.h" | ||
| 14 | |||
| 15 | #include <sys/time.h> | ||
| 16 | #include <sys/wait.h> | ||
| 17 | #include <errno.h> | ||
| 18 | |||
| 19 | #include <cmath> | ||
| 20 | |||
| 21 | #include "../log.h" | ||
| 22 | #include "../settings.h" | ||
| 23 | |||
| 24 | #include "MediaOutputBase.h" | ||
| 25 | |||
| 26 | 1970 | MediaOutputBase::MediaOutputBase(void) { | |
| 27 |
1/2✓ Branch 0 taken 1970 times.
✗ Branch 1 not taken.
|
1970 | LogDebug(VB_MEDIAOUT, "MediaOutputBase::MediaOutputBase()\n"); |
| 28 | |||
| 29 |
3/4✓ Branch 0 taken 1970 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1951 times.
✓ Branch 3 taken 19 times.
|
1970 | if (getFPPmode() != REMOTE_MODE) { |
| 30 |
1/2✓ Branch 0 taken 1951 times.
✗ Branch 1 not taken.
|
1951 | mediaOffsetMS = getSettingInt("globalMediaOffset", 0); |
| 31 | 1951 | mediaOffset = (float)mediaOffsetMS * 0.001; | |
| 32 | } | ||
| 33 | 1970 | } | |
| 34 | |||
| 35 | 3816 | MediaOutputBase::~MediaOutputBase() { | |
| 36 | 3816 | LogDebug(VB_MEDIAOUT, "MediaOutputBase::~MediaOutputBase()\n"); | |
| 37 | 3816 | Close(); | |
| 38 | 3816 | } | |
| 39 | |||
| 40 | /* | ||
| 41 | * | ||
| 42 | */ | ||
| 43 | ✗ | int MediaOutputBase::Start(int msTime) { | |
| 44 | ✗ | return 0; | |
| 45 | } | ||
| 46 | |||
| 47 | /* | ||
| 48 | * | ||
| 49 | */ | ||
| 50 | ✗ | int MediaOutputBase::Stop(void) { | |
| 51 | ✗ | return 0; | |
| 52 | } | ||
| 53 | |||
| 54 | /* | ||
| 55 | * | ||
| 56 | */ | ||
| 57 | ✗ | int MediaOutputBase::Process(void) { | |
| 58 | ✗ | return 0; | |
| 59 | } | ||
| 60 | |||
| 61 | /* | ||
| 62 | * | ||
| 63 | */ | ||
| 64 | 1908 | int MediaOutputBase::Close(void) { | |
| 65 | 1908 | LogDebug(VB_MEDIAOUT, "MediaOutputBase::Close\n"); | |
| 66 | |||
| 67 | 1908 | return 1; | |
| 68 | } | ||
| 69 | |||
| 70 | /* | ||
| 71 | * | ||
| 72 | */ | ||
| 73 | ✗ | int MediaOutputBase::AdjustSpeed(float masterPos) { | |
| 74 | ✗ | return 1; | |
| 75 | } | ||
| 76 | |||
| 77 | /* | ||
| 78 | * | ||
| 79 | */ | ||
| 80 | ✗ | void MediaOutputBase::SetVolume(int volume) { | |
| 81 | ✗ | } | |
| 82 | |||
| 83 | /* | ||
| 84 | * | ||
| 85 | */ | ||
| 86 | ✗ | int MediaOutputBase::IsPlaying(void) { | |
| 87 | ✗ | return 0; | |
| 88 | } | ||
| 89 | |||
| 90 | 163846 | void MediaOutputBase::setMediaElapsed(float curtime, float remaining) { | |
| 91 | 163846 | float secs = curtime; | |
| 92 | 163846 | float rem = remaining; | |
| 93 |
2/2✓ Branch 0 taken 1660 times.
✓ Branch 1 taken 162186 times.
|
163846 | if (mediaOffset > 0) { |
| 94 | 1660 | secs -= mediaOffset; | |
| 95 | } else { | ||
| 96 | 162186 | rem -= mediaOffset; | |
| 97 | } | ||
| 98 |
2/2✓ Branch 0 taken 301 times.
✓ Branch 1 taken 163545 times.
|
163846 | if (secs < 0.0) { |
| 99 | 301 | secs = 0.0; | |
| 100 | } | ||
| 101 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 163846 times.
|
163846 | if (rem < 0.0) { |
| 102 | ✗ | rem = 0.0; | |
| 103 | } | ||
| 104 | float elapsed, elapsedSub, remain, remainSub; | ||
| 105 | 163846 | elapsedSub = std::modf(secs, &elapsed) * 100; | |
| 106 | 163846 | remainSub = std::modf(rem, &remain) * 100; | |
| 107 | |||
| 108 |
1/2✓ Branch 0 taken 163846 times.
✗ Branch 1 not taken.
|
163846 | std::lock_guard<std::mutex> lock(MediaOutputStatus::FieldsLock()); |
| 109 | 163846 | m_mediaOutputStatus->mediaSeconds = secs; | |
| 110 | 163846 | m_mediaOutputStatus->secondsElapsed = elapsed; | |
| 111 | 163846 | m_mediaOutputStatus->subSecondsElapsed = elapsedSub; | |
| 112 | 163846 | m_mediaOutputStatus->secondsRemaining = remain; | |
| 113 | 163846 | m_mediaOutputStatus->subSecondsRemaining = remainSub; | |
| 114 | 163846 | } | |
| 115 |