blob: aca6bd0b073779f60b7b0332437812c2443a4690 (
plain)
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
|
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <math.h>
#include <iostream>
#include <vector>
extern "C" {
#include <libavutil/mathematics.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
}
namespace libav {
class Audioloader{
public:
Audioloader(){ready=false;sample_start=0;sample_end=0;};
bool setup(const std::string &filename);
AVFrame* get_frame();
uint16_t* get_samples(int num);
AVPacket* get_packet();
bool close();
bool ready;
private:
std::vector<uint16_t> buffer;
AVFrame* frame;
AVFormatContext* formatContext;
AVStream* audioStream;
AVCodecContext* codecContext;
AVPacket packet;
int sample_end;
int sample_start;
};
}
|