forked from moutazhaq/Android-Video-Recorder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVideoRecorder.h
66 lines (53 loc) · 1.67 KB
/
VideoRecorder.h
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
66
#ifndef _AVR_VIDEORECORDER_H_
#define _AVR_VIDEORECORDER_H_
// Encodes video to H.264
// Encodes audio to AAC-LC
// Outputs to MP4 file
namespace AVR {
enum VideoFrameFormat {
VideoFrameFormatYUV420P=0,
VideoFrameFormatNV12,
VideoFrameFormatNV21,
VideoFrameFormatRGB24,
VideoFrameFormatBGR24,
VideoFrameFormatARGB,
VideoFrameFormatRGBA,
VideoFrameFormatABGR,
VideoFrameFormatBGRA,
VideoFrameFormatRGB565LE,
VideoFrameFormatRGB565BE,
VideoFrameFormatBGR565LE,
VideoFrameFormatBGR565BE,
VideoFrameFormatMax
};
enum AudioSampleFormat {
AudioSampleFormatU8=0,
AudioSampleFormatS16,
AudioSampleFormatS32,
AudioSampleFormatFLT,
AudioSampleFormatDBL,
AudioSampleFormatMax
};
class VideoRecorder {
public:
VideoRecorder();
virtual ~VideoRecorder();
// Use this to get an instance of VideoRecorder. Use delete operator to delete it.
static VideoRecorder* New();
// Return true on success, false on failure
// Call these first
virtual bool SetVideoOptions(VideoFrameFormat fmt,int width,int height,unsigned long bitrate)=0;
virtual bool SetAudioOptions(AudioSampleFormat fmt,int channels,unsigned long samplerate,unsigned long bitrate)=0;
// Call after SetVideoOptions/SetAudioOptions
virtual bool Open(const char* mp4file,bool hasAudio,bool dbg)=0;
// Call last
virtual bool Close()=0;
// After this succeeds, you can call SupplyVideoFrame and SupplyAudioSamples
virtual bool Start()=0;
// Supply a video frame
virtual void SupplyVideoFrame(const void* frame,unsigned long numBytes,unsigned long timestamp)=0;
// Supply audio samples
virtual void SupplyAudioSamples(const void* samples,unsigned long numSamples)=0;
};
} // namespace AVR
#endif // _AVR_VIDEORECORDER_H_