-
Notifications
You must be signed in to change notification settings - Fork 1
/
avfile.h
58 lines (43 loc) · 1.21 KB
/
avfile.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
#ifndef AVFILE_H
#define AVFILE_H
#include "avobject.h"
struct AVFormatContext;
struct AVCodecContext;
struct SwrContext;
class AVFile: public AVObject
{
public:
AVFile();
virtual ~AVFile();
virtual const char * getName();
virtual void setSamplerate(av_sample_rate_t samplerate);
virtual void setChannels(av_channels_t channels);
virtual size_t pull(av_sample_t *buffer_ptr, size_t buffer_size);
virtual size_t push(av_sample_t *buffer_ptr, size_t buffer_size);
void open(const char *);
void close();
float getDurationInSeconds();
size_t getDurationInSamples();
float getPositionInSeconds();
float getPositionInPercents();
size_t getBitrate();
size_t getCodecBitrate();
int getCodecSamplerate();
int getCodecChannels();
void seekToPercent(float percent);
void seekToSecond(float second);
void seekBackward(float seconds);
void seekForward(float seconds);
void decode();
void cancelDecoding();
private:
AVFormatContext *formatCtx;
AVCodecContext *codecCtx;
SwrContext *swrCtx;
int audioStream;
bool decoding;
volatile int64_t _position;
volatile int64_t _seek_to;
void _updateSWR();
};
#endif // AVFILE_H