aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputs/Test.cpp
blob: 29356ed808af1fffa68e793d1f2f6cb765fcf1cb (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
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
72
73
74
75
#include <string>
#include <iostream>
#include <vector>
#include "TcpLog.h"
#include "Input.h"

using namespace std;

TcpLog etiLog;

void testmpeg()
{
    const int bufsize = 96;
    const int num = 30;
    const string fname = "/home/bram/dab/mmbtools-aux/dings.mp2";

    cout << "Hello" << endl;

    InputMpegFile input(fname, 1, bufsize, 100);

    cout << "Open " << input.Open() << endl;

    cout << "Opened " << input.GetName() << endl;

    std::vector<uint8_t> buffer(bufsize);

    for (int i = 0; i < num; i++) {
        int rc = input.ReadFrame(&buffer.front(), bufsize);

        cout << "ReadFrame " << dec << rc << endl;

        for(std::vector<uint8_t>::iterator it = buffer.begin(); it != buffer.end(); ++it) {
            cout << hex << (unsigned int)*it << ",";
        }
    }
    cout << endl;

}

void testdabp()
{
    const int bufsize = 188;
    const int num = 10;
    const string fname = "/home/bram/dab/mmbtools-aux/fb.dab";

    cout << "Hello" << endl;

    InputDabplusFile input(fname, 1, 5*bufsize, 100);
    //InputFile input(fname);

    cout << "Open " << input.Open() << endl;

    cout << "Opened " << input.GetName() << endl;

    std::vector<uint8_t> buffer(bufsize);

    for (int i = 0; i < num; i++) {
        int rc = input.ReadFrame(&buffer.front(), bufsize);

        cout << "ReadFrame " << dec << rc << endl;

        for(std::vector<uint8_t>::iterator it = buffer.begin(); it != buffer.end(); ++it) {
            cout << hex << (unsigned int)*it << ", ";
        }
    }
    cout << endl;

}

int main(int argc, char** argv)
{
    testmpeg();
}