-
Notifications
You must be signed in to change notification settings - Fork 1
/
fileAudioDecoder.h
45 lines (40 loc) · 934 Bytes
/
fileAudioDecoder.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
#define __STDC_CONSTANT_MACROS
extern "C"
{
#include "libavfilter/avfilter.h"
#include "libavfilter/buffersrc.h"
#include "libavfilter/buffersink.h"
#include "libavformat/avformat.h"
#include "libavcodec/avcodec.h"
#include "libavutil/imgutils.h"
#include "libavutil/error.h"
#include "libavutil/avutil.h"
#include "libavutil/mathematics.h"
#include "libavutil/samplefmt.h"
#include "libavutil/frame.h"
#include "libavutil/opt.h"
}
#include <stdint.h>
#include <inttypes.h>
#include <vector>
#include <iostream>
class fileAudioDecoder
{
private:
AVCodec *codec;
AVCodecParameters *codecParameters;
AVCodecContext *codecContext;
AVFormatContext *formatContext;
AVPacket *packet;
AVFrame *frame;
int streamID;
int finished;
void cleanUp();
int getPacket();
int decodeFrame();
public:
int init(const char *filePath);
double getStreamDuration();
AVCodecParameters *getCodecParameters();
AVFrame *getDecodedFrame();
};