aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2013-12-22 18:04:29 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2013-12-24 18:09:27 +0100
commitd4c6a078285dda636e283413fdbd9b1adeab5ade (patch)
tree302fa3e0a6faf2184454483ec27343e8324f70bd
parentb0183733ef4c6f08ef8c7b73155268e54ca3f152 (diff)
downloaddabmux-ooinputs.tar.gz
dabmux-ooinputs.tar.bz2
dabmux-ooinputs.zip
Test for InputMpegFileooinputs
-rw-r--r--src/inputs/Input.h7
-rw-r--r--src/inputs/InputMpegFile.cpp10
-rw-r--r--src/inputs/Test.cpp38
-rwxr-xr-xsrc/inputs/test.sh2
4 files changed, 48 insertions, 9 deletions
diff --git a/src/inputs/Input.h b/src/inputs/Input.h
index fe54160..d2dcd48 100644
--- a/src/inputs/Input.h
+++ b/src/inputs/Input.h
@@ -118,9 +118,12 @@ class InputFile : public InputBase {
#ifdef HAVE_FORMAT_MPEG
class InputMpegFile : public InputFile, public InputBuffered {
public:
- InputMpegFile(std::string fileName) :
+ InputMpegFile(std::string fileName,
+ int prebuffer_stages,
+ int frame_size,
+ int overfull_thresh) :
InputFile(fileName),
- InputBuffered(prebuffer_stages, source_size, overfull_thresh, 1)
+ InputBuffered(prebuffer_stages, frame_size, overfull_thresh, 1)
{ m_name = "mpeg " + m_filename;}
int ReadFrame(void* buffer, int size);
const char* GetName() { return m_name.c_str(); }
diff --git a/src/inputs/InputMpegFile.cpp b/src/inputs/InputMpegFile.cpp
index 480a251..f61c410 100644
--- a/src/inputs/InputMpegFile.cpp
+++ b/src/inputs/InputMpegFile.cpp
@@ -53,11 +53,6 @@ extern TcpLog etiLog;
#define MPEG_ORIGINAL -5
#define MPEG_EMPHASIS -6
-const char* InputMpegFile::GetName()
-{
- return m_name.c_str();
-}
-
int checkDabMpegFrame(void* data)
{
mpegHeader* header = (mpegHeader*)data;
@@ -184,6 +179,11 @@ MUTE_SUBCHANNEL:
return result;
}
+int InputMpegFile::ReadFrame(void* buffer, int size)
+{
+ return ReadFrameFromBuffer(buffer, size);
+}
+
#endif
#endif
diff --git a/src/inputs/Test.cpp b/src/inputs/Test.cpp
index 925f871..29356ed 100644
--- a/src/inputs/Test.cpp
+++ b/src/inputs/Test.cpp
@@ -8,7 +8,36 @@ using namespace std;
TcpLog etiLog;
-int main(int argc, char** argv)
+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;
@@ -37,3 +66,10 @@ int main(int argc, char** argv)
cout << endl;
}
+
+int main(int argc, char** argv)
+{
+ testmpeg();
+}
+
+
diff --git a/src/inputs/test.sh b/src/inputs/test.sh
index c652cb8..cf810fa 100755
--- a/src/inputs/test.sh
+++ b/src/inputs/test.sh
@@ -1,3 +1,3 @@
#!/bin/sh
-clang++ -Wall -I.. -I../.. -I../../.. -includeTcpLog.h -DHAVE_INPUT_FILE -DHAVE_FORMAT_DABPLUS InputBuffered.cpp InputFile.cpp InputDabplusFile.cpp Test.cpp -o test \
+clang++ -Wall -I.. -I../.. -I../../.. -includeTcpLog.h -DHAVE_INPUT_FILE -DHAVE_FORMAT_MPEG -DHAVE_FORMAT_DABPLUS InputBuffered.cpp InputFile.cpp InputDabplusFile.cpp InputMpegFile.cpp ../mpeg.c Test.cpp -o test \
&& ./test