This struct holds the associated video frame and starting sample # for an audio packet.
| 142 | |
| 143 | // This struct holds the associated video frame and starting sample # for an audio packet. |
| 144 | bool AudioLocation::is_near(AudioLocation location, int samples_per_frame, int64_t amount) { |
| 145 | // Is frame even close to this one? |
| 146 | if (abs(location.frame - frame) >= 2) |
| 147 | // This is too far away to be considered |
| 148 | return false; |
| 149 | |
| 150 | // Note that samples_per_frame can vary slightly frame to frame when the |
| 151 | // audio sampling rate is not an integer multiple of the video fps. |
| 152 | int64_t diff = samples_per_frame * (location.frame - frame) + location.sample_start - sample_start; |
| 153 | if (abs(diff) <= amount) |
| 154 | // close |
| 155 | return true; |
| 156 | |
| 157 | // not close |
| 158 | return false; |
| 159 | } |
| 160 | |
| 161 | #if USE_HW_ACCEL |
| 162 |