mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
Add opus codec test
This commit is contained in:
31
tests/opus/main.cpp
Normal file
31
tests/opus/main.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include "OpusEncoderImpl.h"
|
||||
#include "opus/opus.h"
|
||||
|
||||
int main() {
|
||||
OpusEncoderImpl* opusEncoder = new OpusEncoderImpl(48000, 2);
|
||||
|
||||
std::ifstream inputFile("ls.pcm", std::ios::binary);
|
||||
if (!inputFile) {
|
||||
std::cerr << "Failed to open input file." << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
char sample[960];
|
||||
while (inputFile.read(sample, 960)) {
|
||||
opusEncoder->Feed((unsigned char*)sample, 960);
|
||||
}
|
||||
|
||||
// // <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>opus<75><73>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>̣߳<DFB3><CCA3><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>Ϊ<EFBFBD>˷<EFBFBD><CBB7><EFBFBD>
|
||||
// StreamInfo info;
|
||||
// while (opusEncoder.PopFrame(info)) {
|
||||
// .....
|
||||
// }
|
||||
|
||||
opusEncoder->Stop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user