summaryrefslogtreecommitdiffhomepage
path: root/video-ps3eye/PS3EYEDriver/sdl
diff options
context:
space:
mode:
Diffstat (limited to 'video-ps3eye/PS3EYEDriver/sdl')
-rw-r--r--video-ps3eye/PS3EYEDriver/sdl/CMakeLists.txt24
-rw-r--r--video-ps3eye/PS3EYEDriver/sdl/cmake/FindSDL2.cmake122
-rw-r--r--video-ps3eye/PS3EYEDriver/sdl/lang/nl_NL.ts4
-rw-r--r--video-ps3eye/PS3EYEDriver/sdl/lang/ru_RU.ts4
-rw-r--r--video-ps3eye/PS3EYEDriver/sdl/lang/stub.ts4
-rw-r--r--video-ps3eye/PS3EYEDriver/sdl/lang/zh_CN.ts4
-rw-r--r--video-ps3eye/PS3EYEDriver/sdl/main.cpp192
7 files changed, 0 insertions, 354 deletions
diff --git a/video-ps3eye/PS3EYEDriver/sdl/CMakeLists.txt b/video-ps3eye/PS3EYEDriver/sdl/CMakeLists.txt
deleted file mode 100644
index 5064b2d8..00000000
--- a/video-ps3eye/PS3EYEDriver/sdl/CMakeLists.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-set(cmake-modules "${CMAKE_CURRENT_LIST_DIR}/cmake/")
-if(MSVC)
- set(CMAKE_MODULE_PATH "${cmake-modules}" ${CMAKE_MODULE_PATH})
-else()
- list(APPEND CMAKE_MODULE_PATH "${cmake-modules}")
-endif()
-
-find_package(SDL2 QUIET)
-if(SDL2_FOUND)
- include_directories(${SDL2_INCLUDE_DIRS})
- link_libraries(${SDL2_LIBRARIES})
- link_libraries(opentrack-ps3eye)
- otr_module(ps3eye-test EXECUTABLE NO-QT WIN32-CONSOLE)
- if(WIN32)
- foreach(k ${SDL2_LIBRARIES})
- get_filename_component(path "${k}" PATH)
- set(lib "${path}/SDL2.dll")
- if(EXISTS "${lib}")
- otr_install_lib("${lib}" "${opentrack-hier-pfx}")
- break()
- endif()
- endforeach()
- endif()
-endif()
diff --git a/video-ps3eye/PS3EYEDriver/sdl/cmake/FindSDL2.cmake b/video-ps3eye/PS3EYEDriver/sdl/cmake/FindSDL2.cmake
deleted file mode 100644
index e55e5849..00000000
--- a/video-ps3eye/PS3EYEDriver/sdl/cmake/FindSDL2.cmake
+++ /dev/null
@@ -1,122 +0,0 @@
-
-# This module defines
-# SDL2_LIBRARIES, the name of the library to link against
-# SDL2_FOUND, if false, do not try to link to SDL2
-# SDL2_INCLUDE_DIRS, where to find SDL.h
-#
-# This module responds to the the flag:
-# SDL2_BUILDING_LIBRARY
-# If this is defined, then no SDL2main will be linked in because
-# only applications need main().
-# Otherwise, it is assumed you are building an application and this
-# module will attempt to locate and set the the proper link flags
-# as part of the returned SDL2_LIBRARY variable.
-#
-# Don't forget to include SDLmain.h and SDLmain.m your project for the
-# OS X framework based version. (Other versions link to -lSDL2main which
-# this module will try to find on your behalf.) Also for OS X, this
-# module will automatically add the -framework Cocoa on your behalf.
-#
-#
-# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration
-# and no SDL2_LIBRARY, it means CMake did not find your SDL2 library
-# (SDL2.dll, libsdl2.so, SDL2.framework, etc).
-# Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again.
-# Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value
-# as appropriate. These values are used to generate the final SDL2_LIBRARY
-# variable, but when these values are unset, SDL2_LIBRARY does not get created.
-#
-#
-# $SDL2DIR is an environment variable that would
-# correspond to the ./configure --prefix=$SDL2DIR
-# used in building SDL2.
-# l.e.galup 9-20-02
-#
-# Modified by Eric Wing.
-# Added code to assist with automated building by using environmental variables
-# and providing a more controlled/consistent search behavior.
-# Added new modifications to recognize OS X frameworks and
-# additional Unix paths (FreeBSD, etc).
-# Also corrected the header search path to follow "proper" SDL guidelines.
-# Added a search for SDL2main which is needed by some platforms.
-# Added a search for threads which is needed by some platforms.
-# Added needed compile switches for MinGW.
-#
-# On OSX, this will prefer the Framework version (if found) over others.
-# People will have to manually change the cache values of
-# SDL2_LIBRARY to override this selection or set the CMake environment
-# CMAKE_INCLUDE_PATH to modify the search paths.
-#
-# Note that the header path has changed from SDL2/SDL.h to just SDL.h
-# This needed to change because "proper" SDL convention
-# is #include "SDL.h", not <SDL2/SDL.h>. This is done for portability
-# reasons because not all systems place things in SDL2/ (see FreeBSD).
-
-#=============================================================================
-# Copyright 2003-2009 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-# message("<FindSDL2.cmake>")
-
-SET(SDL2_SEARCH_PATHS
- ~/Library/Frameworks
- /Library/Frameworks
- /usr/local
- /usr
- /sw # Fink
- /opt/local # DarwinPorts
- /opt/csw # Blastwave
- /opt
- ${SDL2_DIR}
-)
-
-FIND_PATH(SDL2_INCLUDE_DIR SDL.h
- PATH_SUFFIXES include/SDL2 include
- PATHS ${SDL2_SEARCH_PATHS}
-)
-
-if(CMAKE_SIZEOF_VOID_P EQUAL 8)
- set(PATH_SUFFIXES lib64 lib/x64 lib)
-else()
- set(PATH_SUFFIXES lib32 lib/x86 lib)
-endif()
-
-FIND_LIBRARY(SDL2_LIBRARY
- NAMES SDL2
- HINTS
- $ENV{SDL2DIR}
- PATH_SUFFIXES ${PATH_SUFFIXES}
- PATHS ${SDL2_SEARCH_PATHS}
-)
-
-if(SDL2_LIBRARY)
- set(SDL2_LIBRARIES "${SDL2_LIBRARY}")
-endif()
-
-IF(SDL2_LIBRARIES)
- # For OS X, SDL2 uses Cocoa as a backend so it must link to Cocoa.
- # CMake doesn't display the -framework Cocoa string in the UI even
- # though it actually is there if I modify a pre-used variable.
- # I think it has something to do with the CACHE STRING.
- # So I use a temporary variable until the end so I can set the
- # "real" variable in one-shot.
- IF(APPLE)
- list(APPEND SDL2_LIBRARIES "-framework Cocoa")
- ENDIF(APPLE)
-ENDIF()
-
-if(SDL2_INCLUDE_DIR)
- set(SDL2_INCLUDE_DIRS "${SDL2_INCLUDE_DIR}")
-endif()
-
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARIES SDL2_INCLUDE_DIRS)
diff --git a/video-ps3eye/PS3EYEDriver/sdl/lang/nl_NL.ts b/video-ps3eye/PS3EYEDriver/sdl/lang/nl_NL.ts
deleted file mode 100644
index 6401616d..00000000
--- a/video-ps3eye/PS3EYEDriver/sdl/lang/nl_NL.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE TS>
-<TS version="2.1">
-</TS>
diff --git a/video-ps3eye/PS3EYEDriver/sdl/lang/ru_RU.ts b/video-ps3eye/PS3EYEDriver/sdl/lang/ru_RU.ts
deleted file mode 100644
index 6401616d..00000000
--- a/video-ps3eye/PS3EYEDriver/sdl/lang/ru_RU.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE TS>
-<TS version="2.1">
-</TS>
diff --git a/video-ps3eye/PS3EYEDriver/sdl/lang/stub.ts b/video-ps3eye/PS3EYEDriver/sdl/lang/stub.ts
deleted file mode 100644
index 6401616d..00000000
--- a/video-ps3eye/PS3EYEDriver/sdl/lang/stub.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE TS>
-<TS version="2.1">
-</TS>
diff --git a/video-ps3eye/PS3EYEDriver/sdl/lang/zh_CN.ts b/video-ps3eye/PS3EYEDriver/sdl/lang/zh_CN.ts
deleted file mode 100644
index 6401616d..00000000
--- a/video-ps3eye/PS3EYEDriver/sdl/lang/zh_CN.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE TS>
-<TS version="2.1">
-</TS>
diff --git a/video-ps3eye/PS3EYEDriver/sdl/main.cpp b/video-ps3eye/PS3EYEDriver/sdl/main.cpp
deleted file mode 100644
index 6a5f3482..00000000
--- a/video-ps3eye/PS3EYEDriver/sdl/main.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-/**
- * PS3EYEDriver Simple SDL 2 example, using OpenGL where available.
- * Thomas Perl <m@thp.io>; 2014-01-10
- * Joseph Howse <josephhowse@nummist.com>; 2014-12-26
- **/
-
-#include "../ps3eye.hpp"
-#include "../log.hpp"
-
-#include <sstream>
-#include <iostream>
-
-#include <SDL.h>
-#undef main
-
-struct ps3eye_context {
- ps3eye_context(int width, int height, int fps)
- {
- if (hasDevices())
- {
- eye = devices[0];
- eye->init(width, height, (uint16_t)fps);
- }
- }
-
- bool hasDevices() { return !devices.empty(); }
-
- std::vector<ps3eye_camera::device> devices = ps3eye_camera::get_devices();
- ps3eye_camera::device eye = nullptr;
-
- bool running = true;
- Uint32 last_ticks = 0;
- Uint32 last_frames = 0;
-};
-
-void run_camera(int width, int height, int fps, Uint32 duration)
-{
- ps3eye_context ctx(width, height, fps);
- if (!ctx.hasDevices()) {
- printf("No PS3 Eye ps3eye_camera connected\n");
- return;
- }
- ctx.eye->set_flip(true); /* mirrored left-right */
-
- char title[256];
- sprintf(title, "%dx%d@%d\n", ctx.eye->getWidth(), ctx.eye->getHeight(), ctx.eye->getFrameRate());
-
- SDL_Window *window = SDL_CreateWindow(
- title, SDL_WINDOWPOS_UNDEFINED,
- SDL_WINDOWPOS_UNDEFINED, width, height, 0);
- if (window == NULL) {
- printf("Failed to create window: %s\n", SDL_GetError());
- return;
- }
-
- SDL_Renderer *renderer = SDL_CreateRenderer(window, -1,
- SDL_RENDERER_ACCELERATED);
- if (renderer == NULL) {
- printf("Failed to create renderer: %s\n", SDL_GetError());
- SDL_DestroyWindow(window);
- return;
- }
- SDL_RenderSetLogicalSize(renderer, ctx.eye->getWidth(), ctx.eye->getHeight());
-
- SDL_Texture *video_tex = SDL_CreateTexture(
- renderer, SDL_PIXELFORMAT_BGR24, SDL_TEXTUREACCESS_STREAMING,
- ctx.eye->getWidth(), ctx.eye->getHeight());
-
- if (video_tex == NULL)
- {
- printf("Failed to create video texture: %s\n", SDL_GetError());
- SDL_DestroyRenderer(renderer);
- SDL_DestroyWindow(window);
- return;
- }
-
- (void)ctx.eye->start();
-
- printf("Camera mode: %dx%d@%d\n", ctx.eye->getWidth(), ctx.eye->getHeight(), ctx.eye->getFrameRate());
-
- SDL_Event e;
-
- Uint32 start_ticks = SDL_GetTicks();
- while (ctx.running) {
- if (duration != 0 && (SDL_GetTicks() - start_ticks) / 1000 >= duration)
- break;
-
- while (SDL_PollEvent(&e)) {
- if (e.type == SDL_QUIT || (e.type == SDL_KEYUP && e.key.keysym.scancode == SDL_SCANCODE_ESCAPE)) {
- ctx.running = false;
- }
- }
-
- {
- Uint32 now_ticks = SDL_GetTicks();
-
- ctx.last_frames++;
-
- if (now_ticks - ctx.last_ticks > 1000)
- {
- printf("FPS: %.2f\n", 1000 * ctx.last_frames / (float(now_ticks - ctx.last_ticks)));
- ctx.last_ticks = now_ticks;
- ctx.last_frames = 0;
- }
- }
-
- void *video_tex_pixels;
- int pitch;
- SDL_LockTexture(video_tex, NULL, &video_tex_pixels, &pitch);
-
- if (!ctx.eye->get_frame((uint8_t*) video_tex_pixels))
- ctx.running = false;
-
- SDL_UnlockTexture(video_tex);
-
- SDL_RenderCopy(renderer, video_tex, NULL, NULL);
- SDL_RenderPresent(renderer);
- }
-
- ctx.eye->stop();
-
- SDL_DestroyTexture(video_tex);
- SDL_DestroyRenderer(renderer);
- SDL_DestroyWindow(window);
-}
-
-int main(int argc, char *argv[])
-{
- bool mode_test = false;
- int width = 640;
- int height = 480;
- int fps = 60;
- if (argc > 1)
- {
- bool good_arg = false;
- for (int arg_ix = 1; arg_ix < argc; ++arg_ix)
- {
- if (std::string(argv[arg_ix]) == "--qvga")
- {
- width = 320;
- height = 240;
- good_arg = true;
- }
-
- if ((std::string(argv[arg_ix]) == "--fps") && argc > arg_ix)
- {
- std::istringstream new_fps_ss( argv[arg_ix+1] );
- if (new_fps_ss >> fps)
- {
- good_arg = true;
- }
- }
-
- if (std::string(argv[arg_ix]) == "--mode_test")
- {
- mode_test = true;
- good_arg = true;
- }
- }
- if (!good_arg)
- {
- std::cerr << "Usage: " << argv[0] << " [--fps XX] [--qvga] [--mode_test]" << std::endl;
- }
- }
-
- if (SDL_Init(SDL_INIT_VIDEO) < 0) {
- printf("Failed to initialize SDL: %s\n", SDL_GetError());
- return EXIT_FAILURE;
- }
-
- if (mode_test)
- {
- int rates_qvga[] = { 2, 3, 5, 7, 10, 12, 15, 17, 30, 37, 40, 50, 60, 75, 90, 100, 125, 137, 150, 187 };
- int num_rates_qvga = sizeof(rates_qvga) / sizeof(int);
-
- int rates_vga[] = { 2, 3, 5, 8, 10, 15, 20, 25, 30, 40, 50, 60, 75 };
- int num_rates_vga = sizeof(rates_vga) / sizeof(int);
-
- for (int index = 0; index < num_rates_qvga; ++index)
- run_camera(320, 240, rates_qvga[index], 5);
-
- for (int index = 0; index < num_rates_vga; ++index)
- run_camera(640, 480, rates_vga[index], 5);
- }
- else
- {
- run_camera(width, height, fps, 0);
- }
-
- return EXIT_SUCCESS;
-}
-