diff options
Diffstat (limited to 'src/inputs/InputBuffered.cpp')
-rw-r--r-- | src/inputs/InputBuffered.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/inputs/InputBuffered.cpp b/src/inputs/InputBuffered.cpp index 9eea2a7..093220b 100644 --- a/src/inputs/InputBuffered.cpp +++ b/src/inputs/InputBuffered.cpp @@ -27,11 +27,13 @@ #include "inputs/Input.h" +#ifdef HAVE_INPUT_FILE #include "TcpLog.h" #include <string> #include <cstring> +#include <iostream> #include <cstdlib> #include <cstdio> #include <fcntl.h> @@ -44,7 +46,7 @@ extern TcpLog etiLog; -int InputBuffered::ReadFrame(void* buffer, int size) +int InputBuffered::ReadFrameFromBuffer(void* buffer, int size) { int retval = 0; bool rc; @@ -115,11 +117,26 @@ bool InputBuffered::FillBuffer() } else { // copy the input frame into the frame_buffer one to one - std::vector<char> frame(m_source_size); - int rc = ReadSource(&frame.front(), m_source_size); + std::vector<char> superframe(m_source_size); + int rc = ReadSource(&superframe.front(), m_source_size); if (rc == m_source_size) { - m_buffer.push_back(frame); + int frame_size = m_source_size/m_framesplit; + std::vector<char> frame(frame_size); + + for (char* framestart = &superframe.front(); + framestart < &superframe[frame_size]; + framestart += frame_size) { + memcpy(&frame.front(), framestart, frame_size); + m_buffer.push_back(frame); + } + + int i = 0; + for (std::list< std::vector<char> >::iterator it = m_buffer.begin(); + it != m_buffer.end(); ++it, i++) + { + cout << "FRAME " << dec << i << " size " << it->size() << endl; + } return true; } else @@ -129,3 +146,5 @@ bool InputBuffered::FillBuffer() } } +#endif // HAVE_INPUT_FILE + |