• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

paulmthompson / WhiskerToolbox / 17402643318

02 Sep 2025 11:53AM UTC coverage: 71.394% (-0.3%) from 71.68%
17402643318

push

github

paulmthompson
remove unnecessary files

31766 of 44494 relevant lines covered (71.39%)

1386.13 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

9.09
/src/DataManager/Media/Video_Data.cpp
1
#include "Media/Video_Data.hpp"
2

3
#include "ffmpeg_wrapper/videodecoder.h"
4

5
VideoData::VideoData()
5✔
6
    : _vd{std::make_unique<ffmpeg_wrapper::VideoDecoder>()} {}
5✔
7

8
VideoData::~VideoData() = default;
5✔
9

10
void VideoData::doLoadMedia(std::string const & name) {
×
11
    setFilename(name);
×
12
    _vd->createMedia(name);
×
13

14
    updateHeight(_vd->getHeight());
×
15
    updateWidth(_vd->getWidth());
×
16

17
    switch (getFormat()) {
×
18
        case DisplayFormat::Gray:
×
19
            _vd->setFormat(ffmpeg_wrapper::VideoDecoder::Gray8);
×
20
            break;
×
21
        case DisplayFormat::Color:
×
22
            _vd->setFormat(ffmpeg_wrapper::VideoDecoder::ARGB);
×
23
            break;
×
24
        default:
×
25
            _vd->setFormat(ffmpeg_wrapper::VideoDecoder::Gray8);
×
26
    }
27

28
    // Set format of video decoder to the format currently
29
    // selected in the MediaData
30
    //setFormat(QImage::Format_Grayscale8);
31

32
    setTotalFrameCount(_vd->getFrameCount());
×
33
}
×
34

35
void VideoData::doLoadFrame(int frame_id) {
×
36
    // In most circumstances, we want to decode forward from
37
    // the current frame without reseeking to a keyframe
38
    bool frame_by_frame = true;
×
39

40
    // Direct seeking is needed when:
41
    // - Going to the start or end of video
42
    // - Going backwards
43
    // - Making large jumps forward (more than 100 frames ahead)
44
    if ((frame_id == 0) ||
×
45
        (frame_id >= this->getTotalFrameCount() - 1) ||
×
46
        (frame_id <= _last_decoded_frame) ||
×
47
        (frame_id > _last_decoded_frame + 100)) { // Add this condition for large forward jumps
×
48
        frame_by_frame = false;
×
49
    }
50

51
    // We load the data associated with the frame
52
    // Videos are typically 8-bit, so we use the 8-bit setRawData method
53
    this->setRawData(_vd->getFrame(frame_id, frame_by_frame));
×
54
    _last_decoded_frame = frame_id;
×
55
}
×
56

57
std::string VideoData::GetFrameID(int frame_id) const {
×
58
    return std::to_string(frame_id);
×
59
}
60

61
int VideoData::FindNearestSnapFrame(int frame_id) const {
×
62
    return static_cast<int>(_vd->nearest_iframe(frame_id));
×
63
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc