-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.cpp
71 lines (65 loc) · 2.07 KB
/
test.cpp
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
59
60
61
62
63
64
65
66
67
68
69
70
71
//
// Useless now. Keep for reference.
//
#include <fstream>
#include <iostream>
#include <sstream>
#include <iomanip>
#include "cineia.h"
using namespace SMPTE::ImmersiveAudioBitstream;
using namespace std;
/*
int main() {
ifstream* imfInput = new ifstream("2.iab", ios::binary);
ofstream* atmosOutput = new ofstream("2.atmos", ios::binary);
// Make output file buffer
vector<char> atmosBuffer;
uint32_t atmosFileSize = 0;
iabError error;
// Make conversion
error = reassembleIAB(imfInput, atmosBuffer, atmosFileSize);
// Copy PreambleValue
copyPreambleValue(imfInput, atmosBuffer, atmosFileSize);
// Write output
atmosOutput->write(atmosBuffer.data(), atmosFileSize);
// Clean memory
imfInput->close();
atmosOutput->close();
delete imfInput;
imfInput = nullptr;
delete atmosOutput;
atmosOutput = nullptr;
return 0;
}
*/
std::string IntToStringWithLeadingZeros(int value, int width) {
std::stringstream ss;
ss << std::setw(width) << std::setfill('0') << value;
return ss.str();
}
int main() {
for(int frameNum = 0; ; frameNum ++) {
string imfFileName = "IMFIAB/" + to_string(frameNum) + ".iab";
ifstream* imfInput = new ifstream(imfFileName, ios::binary);
if(!imfInput->is_open()) return 0;
string atmosFileName = "DCPIAB/" + IntToStringWithLeadingZeros(frameNum, 6) + ".atmos";
cout<<atmosFileName<<endl;
ofstream* atmosOutput = new ofstream(atmosFileName, ios::out | ios::binary);
// Make output file buffer
vector<char> atmosBuffer;
uint32_t atmosFileSize = 0;
iabError error;
// Make conversion
error = reassembleIAB(imfInput, atmosBuffer, atmosFileSize);
// Copy PreambleValue
copyPreambleValue(imfInput, atmosBuffer, atmosFileSize);
// Write output
atmosOutput->write(atmosBuffer.data(), atmosFileSize);
imfInput->close();
atmosOutput->close();
delete imfInput;
imfInput = nullptr;
delete atmosOutput;
atmosOutput = nullptr;
}
}