-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvideo_clip.h
More file actions
executable file
·65 lines (56 loc) · 1.42 KB
/
video_clip.h
File metadata and controls
executable file
·65 lines (56 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef VIDEOCLIP_H
#define VIDEOCLIP_H
#include <string>
#include "opencv2/opencv.hpp"
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/avutil.h>
};
using namespace std;
using namespace cv;
class VideoClip
{
public:
VideoClip ( const string& file_name, const string& camera_name )
: _file_name ( file_name ), _camera_name ( camera_name ), _loaded ( false ) {}
~VideoClip() {}
bool ExtractAudioSamples ( Mat* mat, const int duration );
void LoadVideoCapture();
// Setters
void SetShiftInSeconds ( double shift ) {
_shift_in_seconds = shift;
}
// Getters
string GetFileName() {
return _file_name;
}
string GetCameraName() {
return _camera_name;
}
double GetShiftInSeconds() {
return _shift_in_seconds;
}
double GetAudioSampleRate() {
return _audio_sample_rate;
}
Size GetFrameSize() {
return _frame_size;
}
bool IsLoaded() {
return _loaded;
}
VideoCapture* GetVideoCapturePtr() {
return &_video_capture;
}
private:
void CopySamplesToVector ( const AVCodecContext* codec_context, const AVFrame* frame, vector<float>& samples );
string _file_name;
string _camera_name;
double _shift_in_seconds;
double _audio_sample_rate;
Size _frame_size;
bool _loaded;
VideoCapture _video_capture;
};
#endif // VIDEOCLIP_H