blob: bacd6a9ce9dc6a4c7eec5296e7a23e0e4c036d39 (
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
38
39
40
41
42
43
44
45
|
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <math.h>
#include <iostream>
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;};
bool setup(const std::string &filename);
AVFrame* get_frame();
uint16_t* get_samples(int num){
if(!ready) return nullptr;
if (sample_start>0){
}
while (i<num) {
AVFrame *frame=get_frame();
if (frame==nullptr) return nullptr;
frame.nb_samples*
}
}
bool close();
bool ready;
private:
AVFrame* frame;
AVFormatContext* formatContext;
AVStream* audioStream;
AVCodecContext* codecContext;
AVPacket packet;
int sample_processed;
int sample_start;
};
}
|