diff options
| author | Ed Tanous <ed.tanous@intel.com> | 2017-04-26 09:19:10 -0700 |
|---|---|---|
| committer | Ed Tanous <ed.tanous@intel.com> | 2017-04-26 09:19:10 -0700 |
| commit | e2fc45a1cd7645e50754d93ce52ec8935e723007 (patch) | |
| tree | 626f913e5622dd2d7f5c0fd6714362854da0fbdf /src | |
| parent | eb1b8620422c5bc6f9b4e00fe7baf0c64f92b68c (diff) | |
| download | bmcweb-e2fc45a1cd7645e50754d93ce52ec8935e723007.tar.gz bmcweb-e2fc45a1cd7645e50754d93ce52ec8935e723007.zip | |
incremental
Diffstat (limited to 'src')
| -rw-r--r-- | src/ast_video_puller_test.cpp | 49 | ||||
| -rw-r--r-- | src/getvideo_main.cpp | 2 |
2 files changed, 50 insertions, 1 deletions
diff --git a/src/ast_video_puller_test.cpp b/src/ast_video_puller_test.cpp new file mode 100644 index 0000000..ef1cbe3 --- /dev/null +++ b/src/ast_video_puller_test.cpp @@ -0,0 +1,49 @@ +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <ast_jpeg_decoder.hpp> +#include <ast_video_puller.hpp> +#include <chrono> +#include <fstream> +#include <iomanip> +#include <iostream> +#include <thread> +#include <vector> +#include <gmock/gmock.h> +#include <gtest/gtest.h> + +TEST(AstvideoPuller, BasicRead) { + std::cout << "Started\n"; + AstVideo::RawVideoBuffer out; + bool have_hardware = false; + if (access("/dev/video", F_OK) != -1) { + AstVideo::SimpleVideoPuller p; + p.initialize(); + out = p.read_video(); + } else { + FILE *fp = fopen("test_resources/ubuntu_444_800x600_0chrom_0lum.bin", "rb"); + if (fp) { + size_t newLen = fread(out.buffer.data(), sizeof(char), + out.buffer.size() * sizeof(long), fp); + if (ferror(fp) != 0) { + fputs("Error reading file", stderr); + } + fclose(fp); + out.buffer.resize(newLen); + out.mode = AstVideo::YuvMode::YUV444; + out.width = 800; + out.height = 600; + out.y_selector = 0; + out.uv_selector = 0; + } + } + + FILE *fp = fopen("/tmp/screendata.bin", "wb"); + fwrite(out.buffer.data(), sizeof(char), out.buffer.size(), fp); + + AstVideo::AstJpegDecoder d; + std::cout << "MODE " << static_cast<int>(out.mode); + d.decode(out.buffer, out.width, out.height, out.mode, out.y_selector, + out.uv_selector); +} diff --git a/src/getvideo_main.cpp b/src/getvideo_main.cpp index 8c92bd3..33885ee 100644 --- a/src/getvideo_main.cpp +++ b/src/getvideo_main.cpp @@ -24,7 +24,7 @@ int main() { AstVideo::RawVideoBuffer out; bool have_hardware = false; if (access("/dev/video", F_OK) != -1) { - AstVideo::VideoPuller p; + AstVideo::SimpleVideoPuller p; p.initialize(); out = p.read_video(); } else { |

