Compare commits

..
250 Commits
Author SHA1 Message Date
Cameron Gutman 141f6669e8 Version 0.0.4 2018-07-29 21:44:10 -07:00
Cameron Gutman 6300d242cc Update AppStream metadata 2018-07-29 21:40:34 -07:00
Cameron Gutman 186579266c Fix Online -> Offline computer transition 2018-07-29 19:08:29 -07:00
Cameron Gutman 13490af90c Replace OpenSSL dylibs with static build for macOS 10.10+ 2018-07-29 19:07:42 -07:00
R. Aidan Campbell 23a9c2cd9e context menu opened by default for offline hosts 2018-07-29 16:13:42 -07:00
R. Aidan Campbell 88631e4a63 Merge branch 'master' of github.com:cgutman/moonlight-qt 2018-07-29 16:04:53 -07:00
R. Aidan Campbell 9e744ce169 Now with WoL and PC deletion from QML. Deletion needs bugfix, possibly not committed to storage? 2018-07-29 16:04:45 -07:00
Cameron Gutman 77a68db8c1 Code signing for Mac 2018-07-29 15:35:51 -07:00
Cameron Gutman 27247f253c Add Travis CI badge 2018-07-29 13:50:11 -07:00
Cameron Gutman ada7f92c75 Travis CI for Mac 2018-07-29 13:38:05 -07:00
Cameron Gutman 87db4e88a5 Replace autogenerate app bundle strings with real ones and relocate the icon for Mac 2018-07-29 13:05:18 -07:00
R. Aidan Campbell 277594139b Updated macos .app icon to use proper logo 2018-07-29 10:21:53 -07:00
Cameron Gutman 79d5e35306 Mac deployment
- Use the SDL2 framework wholesale instead of manually extracting dylib and headers
- Run install_name_tool on the remaining dylibs so they use the correct load path
- Add generate-dmg.sh for creating packaged Mac builds
2018-07-29 03:38:59 -07:00
Cameron Gutman cda80b319e Publish artifacts from AppVeyor builds 2018-07-28 23:59:20 -07:00
Cameron Gutman ab4b024df4 Travis CI support 2018-07-28 22:49:36 -07:00
Cameron Gutman 7f9cbac232 Fix more AppVeyor bugs 2018-07-28 19:56:08 -07:00
Cameron Gutman 8470ffcb0d Fix some build script bugs uncovered by AppVeyor 2018-07-28 19:44:09 -07:00
Cameron Gutman 92c897762b Fix AppVeyor link 2018-07-28 19:33:11 -07:00
Cameron Gutman 36014cfcfd Add AppVeyor build status 2018-07-28 19:29:54 -07:00
Cameron Gutman df26f731eb Improve debugging messages 2018-07-28 16:06:26 -07:00
Cameron Gutman e39b5a6a72 Block x86 installs on x64 OSes 2018-07-28 13:59:27 -07:00
Cameron Gutman c7138fe36c Fix Discord link 2018-07-28 03:52:24 -07:00
Cameron Gutman b5deab772d Add Discord link 2018-07-28 03:47:34 -07:00
Cameron Gutman 4bfeccec74 Update README with more information 2018-07-28 03:45:45 -07:00
Cameron Gutman 42ed39a67f Version 0.0.3 2018-07-28 03:13:39 -07:00
Cameron Gutman 68612db86d Fix audio glitching on GFE 3.14.1 at low bitrates 2018-07-28 03:13:05 -07:00
Cameron Gutman 3ad5f1478c Comment out HDR option since it's non-working and tweak the remaining option text 2018-07-28 03:06:11 -07:00
Cameron Gutman a81b501d7d Hide the gamepad mapping button since it's unimplemented 2018-07-28 01:27:42 -07:00
Cameron Gutman 871988b2cb Add 1440p and up to 90 FPS streaming options for > 60 Hz monitors 2018-07-28 01:22:31 -07:00
Cameron Gutman 59d087adf5 Add function for querying maximum supported streaming frame rate 2018-07-28 00:25:52 -07:00
Cameron Gutman d9ed3f9694 Fix incorrect key mappings with non-QWERTY keyboards on both host and client 2018-07-27 02:08:54 -07:00
Cameron Gutman e652dbcc79 Version 0.0.2 2018-07-27 00:14:29 -07:00
Cameron Gutman b5965d763c Create desktop shortcut, detect various error conditions to fail installation, and only install VCRedist if it's not already present 2018-07-27 00:13:02 -07:00
Cameron Gutman 717c3903d1 Fix top padding for grid views 2018-07-26 22:47:48 -07:00
Cameron Gutman 5854ce2000 Fix handling of long app names 2018-07-26 22:39:45 -07:00
Cameron Gutman eb1316ce32 Avoid asserting if we get a box art load completion callback for an app that's gone 2018-07-26 22:16:27 -07:00
Cameron Gutman c31e7262b2 Fix decoding of non-ASCII characters 2018-07-26 22:15:52 -07:00
Cameron Gutman 9e6aadffa1 Populate the DXVA2_VideoDesc with format details from the AVFrame 2018-07-26 21:04:05 -07:00
Cameron Gutman 0bde932550 Prevent HEVC streaming with the software decoder for performance reasons 2018-07-26 19:26:22 -07:00
Cameron Gutman f5499be215 Warn when no hardware decoding is available 2018-07-26 12:13:38 -07:00
Cameron Gutman 42988e0dbf Limit log file sizes to 10k lines 2018-07-26 00:21:26 -07:00
Cameron Gutman b16aac0c06 Fix priority and formatting on many debug messages 2018-07-25 23:47:32 -07:00
Cameron Gutman 7c74cdc50b Add enhanced logging support, including log to file for release builds 2018-07-25 23:25:17 -07:00
Cameron Gutman 26ee8564f8 Include VC redistributable in the bundle 2018-07-25 19:52:58 -07:00
Cameron Gutman 718a575478 Reorganize WiX sources 2018-07-25 19:33:09 -07:00
Cameron Gutman 1f314b839e Various installer fixes 2018-07-25 19:16:06 -07:00
Cameron Gutman 34494e4c89 Add initial WiX installer for Windows 2018-07-25 02:53:51 -07:00
Cameron Gutman 03dc563b32 Create Moonlight png for WiX bootstrapper 2018-07-24 21:11:48 -07:00
Cameron Gutman 5e4182f0a0 Add Moonlight.ico for Windows and script to generate it 2018-07-24 20:07:10 -07:00
Cameron Gutman 010475e8a2 Use per-display undefined window positions 2018-07-22 18:40:15 -07:00
Cameron Gutman bd170c4bd6 Always use the current display mode and just let the renderers scale the output 2018-07-22 18:28:17 -07:00
Cameron Gutman 386e463942 Also use the SDL icon for Linux 2018-07-22 17:42:31 -07:00
Cameron Gutman 9d840afdfb Add an SDL window icon for Windows 2018-07-22 17:07:45 -07:00
Cameron Gutman 83b81aad4b Don't capture the mouse initially on debug builds 2018-07-22 16:21:15 -07:00
Cameron Gutman 4caa7ec749 Enable LC_DEBUG for debug builds 2018-07-22 16:05:42 -07:00
Cameron Gutman cf3cbd627d Use full-screen windowed mode to avoid having to enable V-Sync on DXVA2 2018-07-22 15:42:17 -07:00
Cameron Gutman 3bb62a82e1 Avoid doing a display mode change on Linux when entering full-screen 2018-07-22 14:03:47 -07:00
Cameron Gutman a06a625d48 Rework the logo SVG to look better as an app icon, by Jorys Paulin 2018-07-22 03:21:19 -07:00
Cameron Gutman 13d686b6f8 Rename output binary to moonlight 2018-07-22 03:16:53 -07:00
Cameron Gutman 75c7b2828f Remove unneccessary FFmpeg files 2018-07-22 02:47:59 -07:00
Cameron Gutman 18c5e19ac9 Add files for Flatpak deployment 2018-07-22 01:51:05 -07:00
Cameron Gutman 06635d9f9a Update common-c submodule 2018-07-21 20:30:53 -07:00
Cameron Gutman ad57a55d12 Add (untested) Steam Link video decoding/rendering 2018-07-21 20:29:05 -07:00
Cameron Gutman a97e4babf9 Fix build on GCC 4.x and lower 2018-07-21 19:34:13 -07:00
Cameron Gutman 1117c49867 Fix another brown-paper-bag bug in the build system 2018-07-21 19:26:24 -07:00
Cameron Gutman dc723a8da1 Fix strict aliasing violation 2018-07-21 19:16:08 -07:00
Cameron Gutman 27239ff320 Fix typo in ARM configuration 2018-07-21 19:15:16 -07:00
Cameron Gutman b073c90f0f Fix build on OpenSSL 1.0.1 2018-07-21 19:02:12 -07:00
Cameron Gutman 519626a6d5 Fix compilation with Qt 5.9 2018-07-21 18:47:41 -07:00
Cameron Gutman 71c11cacd9 Update opus project for ARM 2018-07-21 18:30:12 -07:00
Cameron Gutman b7b452875d Add a missing HAVE_FFMPEG guard 2018-07-21 17:32:00 -07:00
Cameron Gutman eb536c2273 Overhaul platform and decoder/renderer detection 2018-07-21 17:00:09 -07:00
R. Aidan Campbell c816a6198c fix macos build: for macos, Q_OS_UNIX is also defined 2018-07-21 14:31:37 -07:00
Cameron Gutman 399154f5f5 Implement VAAPI rendering for X11 2018-07-21 00:16:03 -07:00
Cameron Gutman 64a839c2f9 Create the window after starting streaming to avoid a mouse capture bug in SDL on Windows 2018-07-20 19:55:07 -07:00
Cameron Gutman 20288210be Fix VT video centering after transition from windowed to full screen 2018-07-20 19:37:54 -07:00
Cameron Gutman 7b235743cb Count the window chrome size in our placement decision and fix sizing after full-screen toggle 2018-07-20 19:18:55 -07:00
Cameron Gutman 4c507f1179 Move SDL subsystem init into appropriate components to fix gamepad detection issue 2018-07-20 18:15:46 -07:00
Cameron Gutman e516861366 Set window dimensions properly when toggling full-screen 2018-07-20 16:01:22 -07:00
R. Aidan Campbell 48c2a8c5b0 Merge branch 'master' of github.com:cgutman/moonlight-qt 2018-07-20 15:47:57 -07:00
R. Aidan Campbell b41e8c07d2 Switched settings page to two-pane layout 2018-07-20 15:47:50 -07:00
Cameron Gutman 10b5245919 Reset the decoder when D3D state is lost 2018-07-20 15:31:57 -07:00
R. Aidan Campbell 86874a2e1c minor wording change in settings 2018-07-20 14:36:39 -07:00
R. Aidan Campbell f951a01a68 changed audio configuration to a dropdown, allowing auto/stereo/surround 2018-07-20 14:35:47 -07:00
R. Aidan Campbell d12fed3e7f remove unused settings 2018-07-20 14:24:27 -07:00
R. Aidan Campbell 4566139c75 now with video codec selection 2018-07-20 14:22:22 -07:00
R. Aidan Campbell 38df63b962 now with video decoder selection 2018-07-20 14:14:38 -07:00
Cameron Gutman faaf9dfa07 Fix crashes when restarting streaming with DXVA2 renderer due to leaked surface references 2018-07-20 13:10:54 -07:00
Cameron Gutman 9c2befc386 Only require OpenSSL 1.1 on Apple platforms where SecureTransport requires keys from PEM_write_bio_PrivateKey_traditional() 2018-07-19 23:19:00 -07:00
Cameron Gutman e85ca2a6c9 Reduce VideoToolbox renderer video latency 2018-07-18 22:25:46 -07:00
Cameron Gutman e32aace443 Draw a black background behind the rendering 2018-07-18 22:07:43 -07:00
Cameron Gutman bd8e4a4bce Fix DXVA video centering 2018-07-18 21:48:46 -07:00
Cameron Gutman 5ee1358712 Implement a proper destructor for ComputerManager to prevent polling threads from living beyond QGuiApplication 2018-07-18 21:27:43 -07:00
Cameron Gutman 06501bd4b7 Fix video scaling on DXVA2 2018-07-18 19:10:14 -07:00
Cameron Gutman a4ad58d9ec Fix some Clang static analysis warnings 2018-07-18 18:39:33 -07:00
Cameron Gutman 76d99cd60e Raise combo keys for all special combos, not just quit 2018-07-18 00:14:12 -07:00
Cameron Gutman 1b85dcc829 Improve frame pacing on VideoToolbox renderer 2018-07-18 00:11:17 -07:00
Cameron Gutman c97e298b80 Use the queueFrame() helper 2018-07-17 20:05:59 -07:00
Cameron Gutman a89cadc520 Separate FFmpeg decoder from the Session class (#4) 2018-07-17 20:00:16 -07:00
R. Aidan Campbell ec68f2ae89 logo tweaks: border sizing and shadow 2018-07-17 19:40:08 -07:00
R. Aidan Campbell 2be5040c24 Now with surround-sound checkbox support 2018-07-17 19:39:23 -07:00
R. Aidan Campbell c23b1a31be Now with default bitrate suggestions per resolution and framerate 2018-07-17 18:52:06 -07:00
Cameron Gutman d3f7204cff Set the main thread to high priority since it's used for rendering 2018-07-16 21:25:59 -07:00
Cameron Gutman 20495c3752 Reorganize SSE compiler commands to match Qt's default compiler 2018-07-16 20:55:36 -07:00
Cameron Gutman 68fe901832 Fix Opus build on Clang 2018-07-16 20:47:28 -07:00
Cameron Gutman d3de2a6a7f Fix Opus build on MSVC 2018-07-16 20:36:30 -07:00
Cameron Gutman 1d0755cac0 Update libopus, switch to floating point mode, and use SSE optimizations 2018-07-16 20:12:49 -07:00
Cameron Gutman ca20d28a24 Fix SDL renderer scaling at non-native resolution 2018-07-16 02:07:32 -07:00
Cameron Gutman 998d837ff4 Optimize resolution and window size selection 2018-07-16 01:55:36 -07:00
Cameron Gutman 641b50b7ee Use larger packets when streaming to local PCs 2018-07-16 01:12:53 -07:00
Cameron Gutman 12432ef945 Update common-c with syscall optimization 2018-07-16 00:55:08 -07:00
Cameron Gutman 68bbeafab3 Adapt the audio latency mitigation to WASAPI quirks and add a "stop the world" mode for quick resync 2018-07-15 21:43:43 -07:00
Cameron Gutman 7f8d4c88c1 Implement audio latency mitigations 2018-07-15 20:17:08 -07:00
R. Aidan Campbell 8c65ee8bc5 Now with using, saving, and loading of the resolution and FPS settings 2018-07-15 18:27:41 -07:00
Cameron Gutman a6ac893e1e Implement VideoToolbox rendering 2018-07-15 18:11:57 -07:00
R. Aidan Campbell 3a4da50bbb now with a swanky svg icon replacing a 128px png 2018-07-15 14:59:26 -07:00
Cameron Gutman 9f605230e5 Allow building on XCode 8 2018-07-15 14:03:41 -07:00
R. Aidan Campbell 565b61c470 Merge branch 'master' of github.com:cgutman/moonlight-qt 2018-07-15 13:09:22 -07:00
R. Aidan Campbell d1d40421eb replaced png icons with svgs 2018-07-15 13:09:16 -07:00
Cameron Gutman 5787deeee1 Basic VT decoding without rendering 2018-07-15 12:48:17 -07:00
Cameron Gutman babbae87d3 Stub out VideoToolbox renderer 2018-07-15 11:53:55 -07:00
Cameron Gutman cb154ad3d4 Fix tearing with DXVA2 in full screen mode 2018-07-15 00:43:10 -07:00
Cameron Gutman af503a9147 Fix spurious "Failed to connect to PC" dialogs for mDNS-discovered hosts 2018-07-13 22:38:58 -07:00
Cameron Gutman 611b504bf9 Minor DXVA2 logging fixes 2018-07-13 20:49:51 -07:00
Cameron Gutman 08bc4770cd Fix key repeating 2018-07-13 20:30:07 -07:00
Cameron Gutman f9ef0a99d6 Fix DX threading violation by setting D3DCREATE_MULTITHREADED 2018-07-13 20:20:30 -07:00
Cameron Gutman 89e332048e Ensure the DXVA2 device is actually hardware with YUV2RGB conversion ability before using it 2018-07-13 20:19:32 -07:00
Cameron Gutman c62fff8fc4 Fix uninitialized variables found by Valgrind 2018-07-13 02:50:02 -07:00
Cameron Gutman 1cae5f83e5 DXVA2 Hardware Decoding (#3) 2018-07-13 02:31:21 -07:00
Cameron Gutman 86f843464c Hide the toolbar when the StreamSegue page is visible 2018-07-09 00:12:27 -07:00
Cameron Gutman e8e9e17e63 Improve UI responsiveness when stopping a stream 2018-07-09 00:09:06 -07:00
Cameron Gutman 908850cc5d Add the smooth grid scaling for PCs too 2018-07-08 23:37:00 -07:00
Cameron Gutman 644c3c0c24 Cache app grid items to smooth out jank during scrolling and resizing 2018-07-08 23:34:30 -07:00
Cameron Gutman a56d27e3f2 Move the PC SVGs back where they belong 2018-07-08 23:27:20 -07:00
Cameron Gutman 98b76d3203 Fix Material theme 2018-07-08 23:24:26 -07:00
Cameron Gutman c35d07c961 Add scroll bars to the computer grid and app grid 2018-07-08 23:05:36 -07:00
Cameron Gutman c4a1f74b02 Hook up a few of the preferences 2018-07-08 22:56:38 -07:00
Cameron Gutman 62cf95d55e Prevent multiple instances of the same page on the StackView and stub out GamepadMapper 2018-07-08 22:37:29 -07:00
Cameron Gutman a47f59d1a4 Properly manage the lifetime of polling in the AppView and PcView 2018-07-08 22:07:20 -07:00
Cameron Gutman 83ca211d75 Add a segue to the streaming window 2018-07-08 22:06:52 -07:00
Cameron Gutman 5a04a256e0 Add additional serverinfo attributes and check for 4K compatibility 2018-07-08 20:53:24 -07:00
Cameron Gutman d0375a458a Bound thread count at 4 (same as max slices) and don't use HEVC with the software decoder due to lack of slicing support in common-c 2018-07-08 17:50:42 -07:00
Cameron Gutman 7023bcf504 Make StreamingPreferences accessible from QML for Settings integration 2018-07-08 17:33:47 -07:00
R. Aidan Campbell 67eb09d753 Merge branch 'master' of github.com:cgutman/moonlight-qt 2018-07-08 11:38:07 -07:00
R. Aidan Campbell c2966a5c66 Now with an application icon for MacOS 2018-07-08 11:38:01 -07:00
MINICOM\mrb11 640f47300c Make settings page scrollable and match the app color scheme 2018-07-08 11:20:56 -07:00
MINICOM\mrb11 33a0188fea Fill out remainder of dummy settings 2018-07-08 11:12:22 -07:00
Michelle Bergeron 8ebb594089 Beginnings of settings page (#2)
* Make Moonlight icon the window icon for all windows

* Add dummy settings

* Add slider

* FIx comments
2018-07-08 10:19:08 -07:00
R. Aidan Campbell 7bc139c50d Now with identification of the currently running app 2018-07-08 08:44:09 -07:00
R. Aidan Campbell c27711582a now with smooth window scaling for app listing 2018-07-08 08:28:28 -07:00
Cameron Gutman d7f09382e0 Use a less recent version of QtQuick.Layouts to support Fedora 28 2018-07-07 22:59:05 -07:00
Cameron Gutman 968f5942de Add ffmpeg libraries for macOS 2018-07-07 22:43:35 -07:00
Cameron Gutman d9301fc06d Fix build on Linux 2018-07-07 22:41:32 -07:00
Cameron Gutman 272aa6896e Fix unused member warning on Clang 2018-07-07 22:26:12 -07:00
Cameron Gutman ac22ab26ab Add OpenSSL 1.0.2o DLLs for x86 and x64 from https://indy.fulgan.com/SSL/ 2018-07-07 22:18:39 -07:00
Michelle Bergeron b630c07653 Add navigation toolbar (#1)
* Add preferences view skeleton

* Add toolbar & help button

* Add working back button

* Title of page in toolbar

* Remove unused imports

* Make comments better!

* Remove unused drawer element

* Remove superfluous > 1 check

* Use point size font instead of pixel size

* Add AppView page title
2018-07-07 22:15:02 -07:00
Cameron Gutman 1bfec3a032 Add ffmpeg libraries for Windows x86 2018-07-07 21:57:09 -07:00
Cameron Gutman 826fe4cd03 Implemented software video decoding and special key combos 2018-07-07 21:52:20 -07:00
Cameron Gutman 02f4f193a9 Add ffmpeg libraries for Windows x64 2018-07-07 20:45:54 -07:00
Cameron Gutman bf671752df UI polish 2018-07-07 16:49:13 -07:00
Cameron Gutman 997fdc1ef6 Fix linking on Windows 2018-07-07 16:37:11 -07:00
Cameron Gutman 60ad95bb7b Start work on launching a stream from QML and rip out remaining QtWidgets 2018-07-07 16:30:26 -07:00
Cameron Gutman d5cc07f107 Remove unused enum value to fix GCC warnings 2018-07-07 15:26:20 -07:00
Cameron Gutman 0444ec192a Add license and readme 2018-07-07 14:59:48 -07:00
Cameron Gutman 78746824e2 Fix inconsistent ComputerModel view of the ComputerManager's state after new PC is added 2018-07-06 00:42:07 -07:00
Cameron Gutman ecebf75b88 Implement manually adding PCs 2018-07-06 00:34:16 -07:00
Cameron Gutman 6687936e2f Implement pairing via GUI 2018-07-05 23:12:55 -07:00
Cameron Gutman 1b1ad86271 Keep a singleton ComputerManager outside of the Models 2018-07-05 22:08:55 -07:00
R. Aidan Campbell 0d26ef7e5c Now with pin generation for pairing 2018-07-05 21:16:32 -07:00
Cameron Gutman bd986bfb21 Sort the app list in alphabetical order 2018-07-05 20:54:31 -07:00
R. Aidan Campbell 79435b60ff Now with notification dialog for attempts to pair while busy 2018-07-05 20:49:10 -07:00
Cameron Gutman f120197c21 Fix ComputerModel.paired 2018-07-05 20:41:17 -07:00
Cameron Gutman ebf27cdcaf More UI work including hooking up PcView -> AppView transition 2018-07-05 20:37:51 -07:00
Cameron Gutman f83c13ad85 Cleanup ComputerModel and remove root Frame from PcView 2018-07-05 20:11:35 -07:00
Cameron Gutman b0151da455 Add AppModel and AppView for loading apps and modify BoxArtManager to return QUrls for QML 2018-07-05 20:07:05 -07:00
R. Aidan Campbell 95eebdbe66 now with pairing and add-host dialogs 2018-07-04 18:48:09 -07:00
Cameron Gutman 485c014490 Fix crash on the placeholder icon and fix display of multiple PCs 2018-07-04 16:52:16 -07:00
Cameron Gutman 3a7d3c807e WIP Quick GUI work 2018-07-04 16:40:21 -07:00
Cameron Gutman 6a3b95a4b1 Start GUI rewrite in QML 2018-07-04 14:16:25 -07:00
Cameron Gutman 04c9a3a2eb Implement Wake-on-LAN 2018-07-03 22:11:21 -07:00
Cameron Gutman a02931f5fc Cleanup some unused parameter warnings 2018-07-01 11:54:12 -07:00
Cameron Gutman 5729f65138 Implement mDNS PC discovery 2018-06-30 23:07:31 -07:00
Cameron Gutman 7186f20e05 Integrate forked QMdnsEngine with some required fixes for GameStream (submitted upstream) 2018-06-30 21:41:00 -07:00
Cameron Gutman 4c75456aee Fix improper handling of polling thread termination 2018-06-28 03:52:42 -07:00
Cameron Gutman 3d7c8d4bfb Fix some warnings on GCC 2018-06-28 03:13:38 -07:00
Cameron Gutman e5ef1bcfc5 Stub out the error handling when launch/resume fails 2018-06-28 02:10:31 -07:00
Cameron Gutman d1a512538c Fix input bugs from the C++ transistion and implement special key combo stubs 2018-06-28 02:04:51 -07:00
Cameron Gutman 0821c66d8c Rewrite streaming code to C++ and forklift most of the setup out of the GUI code 2018-06-28 01:44:43 -07:00
Cameron Gutman cad95f12f6 More PoC streaming code (closer to final) 2018-06-27 23:54:24 -07:00
Cameron Gutman 94ecc4a1c8 Always return 1 gamepad in single controller mode 2018-06-27 23:53:12 -07:00
Cameron Gutman 7d14b2a2be Fix endianness issue with the RI key IV 2018-06-27 23:52:29 -07:00
Cameron Gutman 6e4104ac15 Add StreamingPreferences class 2018-06-27 23:15:13 -07:00
Cameron Gutman 6fa4faa285 Rename http folder to backend to better align with the classes inside 2018-06-27 22:30:33 -07:00
Cameron Gutman 1b36071e02 Additional work in MainWindow for integration with new classes 2018-06-27 22:16:57 -07:00
Cameron Gutman d7d11635a0 Add BoxArtManager for loading box art with caching 2018-06-27 22:02:29 -07:00
Cameron Gutman 135568b5ee Minor class improvements 2018-06-27 19:55:44 -07:00
Cameron Gutman 36c8b6ce53 Persist host changes after update 2018-06-27 02:08:56 -07:00
Cameron Gutman ce4e469b7b We can't change audio config after sending the launch or resume request, so autodetection will need to happen earlier 2018-06-27 01:39:48 -07:00
Cameron Gutman 0bd2274462 Simplify IdentityManager by using QSettings instead of files 2018-06-27 01:36:56 -07:00
Cameron Gutman a5d1099e26 Add code to serialize and deserialize hosts and applists for persistence 2018-06-27 01:21:55 -07:00
Cameron Gutman d6b820d707 Implement fetching box art 2018-06-26 23:49:44 -07:00
Cameron Gutman 76d39c08da Implement app list parsing 2018-06-26 23:39:28 -07:00
Cameron Gutman 16d7dca784 Fix analog sticks and triggers 2018-06-26 22:58:32 -07:00
Cameron Gutman c6b19826d3 Fix typo causing pairing to break 2018-06-26 22:58:15 -07:00
Cameron Gutman 35c28116f5 Cleanup use of static NvHTTP members 2018-06-26 21:49:33 -07:00
Cameron Gutman fca059522c Implement more of ComputerManager 2018-06-26 21:47:01 -07:00
Cameron Gutman 8ce2b410d2 Ensure the PC that responded is the one we're querying 2018-06-26 19:15:28 -07:00
Cameron Gutman bb95c4db78 Make IdentityManager a singleton 2018-06-26 19:03:55 -07:00
Cameron Gutman 6c8349787a Only emit state changed once per iteration 2018-06-26 18:44:30 -07:00
Cameron Gutman 6a37a9d77a Move resources back to root 2018-06-26 18:43:53 -07:00
Cameron Gutman 5ee52f15c8 Work on Computer Manager 2018-06-24 15:13:37 -07:00
Cameron Gutman cded01187d More streaming code 2018-06-24 00:14:23 -07:00
Cameron Gutman 4fe6c24702 Fix subsequent SSL failures on Windows 2018-06-23 23:46:16 -07:00
Cameron Gutman 416724f843 More SDL work 2018-06-23 22:16:59 -07:00
Cameron Gutman 283327dcce Add SDL2 for Mac and rename OpenSSL libs for unified build 2018-06-23 20:32:29 -07:00
Cameron Gutman e1192d61e1 Windows bringup 2018-06-23 20:08:17 -07:00
Cameron Gutman ce64966843 Reorganize and prepare for SDL integration 2018-06-23 18:46:59 -07:00
Cameron Gutman ea459a0319 Start integration with moonlight-common-c 2018-05-06 02:16:05 -07:00
Cameron Gutman f80450176a Fix SSL on macOS 2018-05-05 21:59:30 -07:00
Cameron Gutman 0357e6865d Upgrade macOS OpenSSL library to 1.1 2018-05-05 21:42:46 -07:00
Cameron Gutman 63b6da601a Reorganize source and add libraries 2018-05-05 18:33:59 -07:00
Cameron Gutman 6adb3f0f45 Replace assert() with Q_ASSERT() 2018-05-05 16:11:48 -07:00
Cameron Gutman 5001733767 Properly fix OpenSSL 1.0.2 and 1.1.0 differences in X509_get0_signature() 2018-05-05 16:09:40 -07:00
Cameron Gutman 4323557a34 Revert "Fix build with Clang"
This reverts commit 9bd804c4c3.
2018-05-05 16:00:12 -07:00
Cameron Gutman b4947f1f81 Fix storage location of config files 2018-05-05 15:57:57 -07:00
Cameron Gutman 351c5c7849 Merge branch 'aidan/dev' 2018-04-30 21:33:54 -07:00
Cameron Gutman d4689b466a Fix PEM reading issues and assert to catch generating corrupt keypairs 2018-04-30 21:33:36 -07:00
R. Aidan Campbell 9b663c95b7 wired up pairing button 2018-04-30 20:33:42 -07:00
R. Aidan Campbell 004e6913fa Fixed menu bar being merged with native in osx 2018-04-30 19:52:59 -07:00
R. Aidan Campbell 69e36050c8 more c++ bug fixes 2018-04-30 19:45:20 -07:00
R. Aidan Campbell 21e0066be0 learning static c++ 2018-04-30 19:09:31 -07:00
R. Aidan Campbell de08b527f8 Merge branch 'master' into aidan/dev 2018-04-30 18:44:41 -07:00
Cameron Gutman 9bd804c4c3 Fix build with Clang 2018-04-29 18:44:34 -07:00
R. Aidan Campbell 05fb400879 Refactored popups into a new class 2018-04-29 08:17:31 -07:00
R. Aidan Campbell 0651062b81 now with a dropdown to select a host, and associated filling logic 2018-04-29 07:55:31 -07:00
R. Aidan Campbell 23b3fb5af0 Merging master 2018-04-29 07:20:47 -07:00
Cameron Gutman a3ef66981c pairing works 2018-04-29 01:48:41 -07:00
Cameron Gutman af607bd8a2 fix XML processing 2018-04-29 00:55:18 -07:00
Cameron Gutman 0249ce7043 working identity 2018-04-28 23:29:45 -07:00
Cameron Gutman a5d50cd4f0 more work 2018-04-28 22:14:27 -07:00
Cameron Gutman a38bef6bc4 pairing stuff 2018-04-28 19:01:00 -07:00
R. Aidan Campbell a2ba98e38e Now with (unused) code for a pin dialog 2018-04-28 18:47:19 -07:00
R. Aidan Campbell 073d965f6d now with pairing button and dialog 2018-04-28 18:18:43 -07:00
R. Aidan Campbell 4d0341fd9a Merge branch 'master' into aidan/dev 2018-04-28 17:22:11 -07:00
R. Aidan Campbell e5c336223c Now with a picture-button that does a thing 2018-04-28 17:21:05 -07:00
Cameron Gutman 3ee554cd91 NvHTTP boilerplate 2018-04-28 17:08:05 -07:00
R. Aidan Campbell 7f6d0c7484 copy over icons from moonlight-chrome 2018-04-28 16:42:20 -07:00
R. Aidan Campbell 10ba3ed78c ignore qt.pro.user files 2018-04-28 16:41:07 -07:00
R. Aidan Campbell 1cc755d1ef now with window closing confirmation 2018-04-28 16:21:30 -07:00
Cameron Gutman 63d1c4abdf Initial work 2018-04-28 15:39:50 -07:00
805 changed files with 183105 additions and 47093 deletions
+5 -2
View File
@@ -1,2 +1,5 @@
**/xcuserdata/
Build
*pro.user
**/.vs/
build/
+9 -3
View File
@@ -1,3 +1,9 @@
[submodule "limelight-common-c"]
path = limelight-common-c
url = git@github.com:limelight-stream/limelight-common-c.git
[submodule "moonlight-common-c/moonlight-common-c"]
path = moonlight-common-c/moonlight-common-c
url = https://github.com/moonlight-stream/moonlight-common-c.git
[submodule "opus/opus"]
path = opus/opus
url = https://github.com/xiph/opus.git
[submodule "qmdnsengine/qmdnsengine"]
path = qmdnsengine/qmdnsengine
url = https://github.com/cgutman/qmdnsengine.git
+40
View File
@@ -0,0 +1,40 @@
language: cpp
git:
depth: 1
matrix:
include:
- os: osx
compiler: clang
- os: linux
sudo: required
dist: xenial
compiler: gcc
addons:
apt:
sources:
- sourceline: 'ppa:beineri/opt-qt596-xenial'
packages:
- qt59base
- qt59quickcontrols2
- qt59svg
- libesd0-dev
- libgl-dev
install:
- '[ "$TRAVIS_OS_NAME" != osx ] || brew install qt5'
- '[ "$TRAVIS_OS_NAME" != osx ] || brew link --force qt5'
- if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then export SDL2_VER=2.0.8 && wget https://www.libsdl.org/release/SDL2-$SDL2_VER.tar.gz && tar -xvf SDL2-$SDL2_VER.tar.gz && cd SDL2-$SDL2_VER && ./configure && make && sudo make install && cd ..; fi
before_script:
- '[ "$TRAVIS_OS_NAME" != "linux" ] || source /opt/qt59/bin/qt59-env.sh'
- qmake -v
- '[[ "$TRAVIS_OS_NAME" != linux || "$CXX" != clang++ ]] || export QMAKESPEC=linux-clang'
- '[[ "$TRAVIS_OS_NAME" != linux || "$CXX" != g++ ]] || export QMAKESPEC=linux-g++'
- '[ "$TRAVIS_OS_NAME" != osx ] || export QMAKESPEC=macx-clang'
script:
- qmake moonlight-qt.pro -spec $QMAKESPEC
- make debug
- make release
-128
View File
@@ -1,128 +0,0 @@
#!/bin/bash
set -e
source config.sh
# Number of CPUs (for make -j)
NCPU=`sysctl -n hw.ncpu`
if test x$NJOB = x; then
NJOB=$NCPU
fi
PLATFORMBASE=$(xcode-select -print-path)"/Platforms"
SCRIPT_DIR=$( (cd -P $(dirname $0) && pwd) )
DIST_DIR_BASE=${DIST_DIR_BASE:="$SCRIPT_DIR/dist"}
if [ ! -d opus ]
then
echo "opus source directory does not exist, run sync.sh"
fi
# PATH=${SCRIPT_DIR}/gas-preprocessor/:$PATH
for ARCH in $ARCHS
do
OPUS_DIR=opus-$ARCH
if [ ! -d $OPUS_DIR ]
then
echo "Directory $OPUS_DIR does not exist, run sync.sh"
exit 1
fi
echo "Compiling source for $ARCH in directory $OPUS_DIR"
cd $OPUS_DIR
DIST_DIR=$DIST_DIR_BASE-$ARCH
mkdir -p $DIST_DIR
CFLAGS_ARCH=$ARCH
case $ARCH in
armv7)
EXTRA_FLAGS="--with-pic --enable-fixed-point"
EXTRA_CFLAGS="-mcpu=cortex-a8 -mfpu=neon"
PLATFORM="${PLATFORMBASE}/iPhoneOS.platform"
IOSSDK=iPhoneOS${IOSSDK_VER}
;;
armv7s)
EXTRA_FLAGS="--with-pic --enable-fixed-point"
EXTRA_CFLAGS="-mcpu=cortex-a9 -mfpu=neon -miphoneos-version-min=6.0"
PLATFORM="${PLATFORMBASE}/iPhoneOS.platform"
IOSSDK=iPhoneOS${IOSSDK_VER}
;;
aarch64)
CFLAGS_ARCH="arm64"
EXTRA_FLAGS="--with-pic --enable-fixed-point"
EXTRA_CFLAGS="-miphoneos-version-min=7.1"
PLATFORM="${PLATFORMBASE}/iPhoneOS.platform"
IOSSDK=iPhoneOS${IOSSDK_VER}
;;
x86_64)
EXTRA_FLAGS="--with-pic"
EXTRA_CFLAGS="-miphoneos-version-min=7.1"
PLATFORM="${PLATFORMBASE}/iPhoneSimulator.platform"
IOSSDK=iPhoneSimulator${IOSSDK_VER}
;;
i386)
EXTRA_FLAGS="--with-pic"
EXTRA_CFLAGS="-miphoneos-version-min=7.1"
PLATFORM="${PLATFORMBASE}/iPhoneSimulator.platform"
IOSSDK=iPhoneSimulator${IOSSDK_VER}
;;
*)
echo "Unsupported architecture ${ARCH}"
exit 1
;;
esac
echo "Configuring opus for $ARCH..."
./autogen.sh
CFLAGS="-g -O2 -pipe -arch ${CFLAGS_ARCH} \
-isysroot ${PLATFORM}/Developer/SDKs/${IOSSDK}.sdk \
-I${PLATFORM}/Developer/SDKs/${IOSSDK}.sdk/usr/include \
${EXTRA_CFLAGS}"
LDFLAGS="-arch ${CFLAGS_ARCH} \
-isysroot ${PLATFORM}/Developer/SDKs/${IOSSDK}.sdk \
-L${PLATFORM}/Developer/SDKs/${IOSSDK}.sdk/usr/lib"
export CFLAGS
export LDFLAGS
export CXXCPP="/usr/bin/cpp"
export CPP="$CXXCPP"
export CXX="/usr/bin/gcc"
export CC="/usr/bin/gcc"
export LD="/usr/bin/ld"
export AR="/usr/bin/ar"
export AS="/usr/bin/ls"
export NM="/usr/bin/nm"
export RANLIB="/usr/bin/ranlib"
export STRIP="/usr/bin/strip"
./configure \
--prefix=$DIST_DIR \
--host=${ARCH}-apple-darwin \
--with-sysroot=${PLATFORM}/Developer/SDKs/${IOSSDK}.sdk \
--enable-static=yes \
--enable-shared=no \
--disable-doc \
${EXTRA_FLAGS}
echo "Installing opus for $ARCH..."
make clean
make -j$NJOB V=1
make install
cd $SCRIPT_DIR
if [ -d $DIST_DIR/bin ]
then
rm -rf $DIST_DIR/bin
fi
if [ -d $DIST_DIR/share ]
then
rm -rf $DIST_DIR/share
fi
done
-51
View File
@@ -1,51 +0,0 @@
#!/bin/bash
set -e
source config.sh
for ARCH in $ARCHS
do
if [ -d dist-$ARCH ]
then
MAIN_ARCH=$ARCH
fi
done
if [ -z "$MAIN_ARCH" ]
then
echo "Please compile an architecture"
exit 1
fi
OUTPUT_DIR="dist-uarch"
rm -rf $OUTPUT_DIR
mkdir -p $OUTPUT_DIR/lib $OUTPUT_DIR/include
for LIB in dist-$MAIN_ARCH/lib/*.a
do
LIB=`basename $LIB`
LIPO_CREATE=""
for ARCH in $ARCHS
do
LIPO_ARCH=$ARCH
if [ "$ARCH" = "aarch64" ];
then
LIPO_ARCH="arm64"
fi
if [ -d dist-$ARCH ]
then
LIPO_CREATE="$LIPO_CREATE-arch $LIPO_ARCH dist-$ARCH/lib/$LIB "
fi
done
OUTPUT="$OUTPUT_DIR/lib/$LIB"
echo "Creating: $OUTPUT"
xcrun -sdk iphoneos lipo -create $LIPO_CREATE -output $OUTPUT
xcrun -sdk iphoneos lipo -info $OUTPUT
done
echo "Copying headers from dist-$MAIN_ARCH..."
cp -R dist-$MAIN_ARCH/include/* $OUTPUT_DIR/include
-36
View File
@@ -1,36 +0,0 @@
#!/bin/bash
OPUS_DIR="opus"
IOSSDK_VER=8.1
ARCHS="armv7 armv7s aarch64 i386 x86_64"
remove_arch() {
OLD_ARCHS="$ARCHS"
NEW_ARCHS=""
REMOVAL="$1"
for ARCH in $OLD_ARCHS; do
if [ "$ARCH" != "$REMOVAL" ] ; then
NEW_ARCHS="$NEW_ARCHS $ARCH"
fi
done
ARCHS=$NEW_ARCHS
}
# armv7s is only supported in iOS 6.0+
CHECK=`echo $IOSSDK_VER '>= 6.0' | bc -l`
if [ "$CHECK" = "0" ] ; then
remove_arch "armv7s"
fi
# armv6 is not supported any more since iOS 6.0
CHECK=`echo $IOSSDK_VER '< 6.0' | bc -l`
if [ "$CHECK" = "0" ] ; then
remove_arch "armv6"
fi
echo 'Architectures to build:' $ARCHS
-21
View File
@@ -1,21 +0,0 @@
#!/bin/sh
set -e
source config.sh
SCRIPT_DIR=$( (cd -P $(dirname $0) && pwd) )
DIST_DIR_BASE=${DIST_DIR_BASE:="$SCRIPT_DIR/dist"}
git submodule update --init opus
cd opus
git checkout master
git pull origin master
cd ..
for ARCH in $ARCHS
do
OPUS_DIR=opus-$ARCH
echo "Syncing source for $ARCH to directory $OPUS_DIR"
rsync opus/ $OPUS_DIR/ --exclude '.*' -a --delete
done
-104
View File
@@ -1,104 +0,0 @@
#!/bin/bash
SYSROOT_iPHONE="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"
SYSROOT_SIMULATOR="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"
CC_IPHONE="xcrun -sdk iphoneos clang"
CC_SIMULATOR="xcrun -sdk iphonesimulator clang"
function build_one {
./configure \
--prefix=$PREFIX \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-armv5te \
--disable-armv6 \
--disable-doc \
--disable-everything \
--disable-debug \
--enable-decoder=h264 \
--enable-avresample \
--enable-cross-compile \
--sysroot=$SYSROOT \
--target-os=darwin \
--cc="$CC" \
--extra-cflags="$CFLAGS" \
--extra-ldflags="$LDFLAGS" \
--enable-pic \
$ADDI_FLAGS
make clean && make -j4 && make install
}
# armv7
function build_armv7 {
PREFIX="armv7"
SYSROOT=$SYSROOT_iPHONE
CC=$CC_IPHONE
CFLAGS="-arch armv7 -mfpu=neon -miphoneos-version-min=7.1 -fpic"
LDFLAGS="-arch armv7 -isysroot $SYSROOT_iPHONE -miphoneos-version-min=7.1"
ADDI_FLAGS="--arch=arm --cpu=cortex-a9"
build_one
}
# armv7s
function build_armv7s {
PREFIX="armv7s"
SYSROOT=$SYSROOT_iPHONE
CC=$CC_IPHONE
CFLAGS="-arch armv7s -mfpu=neon -miphoneos-version-min=7.1"
LDFLAGS="-arch armv7s -isysroot $SYSROOT_iPHONE -miphoneos-version-min=7.1"
ADDI_FLAGS="--arch=arm --cpu=cortex-a9"
build_one
}
# i386
function build_i386 {
PREFIX="i386"
SYSROOT=$SYSROOT_SIMULATOR
CC=$CC_SIMULATOR
CFLAGS="-arch i386"
LDFLAGS="-arch i386 -isysroot $SYSROOT_SIMULATOR -mios-simulator-version-min=7.1"
ADDI_FLAGS="--arch=i386 --cpu=i386 --disable-asm"
build_one
}
# create fat library
function build_universal {
cd armv7/lib
for file in *.a
do
cd ../..
xcrun -sdk iphoneos lipo -output universal/lib/$file -create \
-arch armv7 armv7/lib/$file \
-arch armv7s armv7s/lib/$file \
-arch i386 i386/lib/$file
echo "Universal $file created."
cd -
done
cd ../..
}
echo "FFmpeg directory?"
read SOURCE
cd $SOURCE
if [ "$1" = "clean" ]
then
rm -r armv7 armv7s i386 universal
make clean
exit 0
fi
mkdir armv7
mkdir armv7s
mkdir i386
mkdir -p universal/lib
build_armv7
build_armv7s
build_i386
build_universal
echo "Ouput files in $SOURCE/armv7 $SOURCE/armv7s $SOURCE/i386 $SOURCE/universal"
-124
View File
@@ -1,124 +0,0 @@
#!/bin/bash
# Yay shell scripting! This script builds a static version of
# OpenSSL ${OPENSSL_VERSION} for iOS 7.0 that contains code for
# armv6, armv7, arm7s and i386.
#set -x
# Setup paths to stuff we need
OPENSSL_VERSION="1.0.1h"
DEVELOPER="/Applications/Xcode.app/Contents/Developer"
SDK_VERSION="7.1"
MIN_VERSION="7.1"
IPHONEOS_PLATFORM="${DEVELOPER}/Platforms/iPhoneOS.platform"
IPHONEOS_SDK="${IPHONEOS_PLATFORM}/Developer/SDKs/iPhoneOS.sdk"
IPHONEOS_GCC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
IPHONESIMULATOR_PLATFORM="${DEVELOPER}/Platforms/iPhoneSimulator.platform"
IPHONESIMULATOR_SDK="${IPHONESIMULATOR_PLATFORM}/Developer/SDKs/iPhoneSimulator.sdk"
IPHONESIMULATOR_GCC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
# Make sure things actually exist
if [ ! -d "$IPHONEOS_PLATFORM" ]; then
echo "Cannot find $IPHONEOS_PLATFORM"
exit 1
fi
if [ ! -d "$IPHONEOS_SDK" ]; then
echo "Cannot find $IPHONEOS_SDK"
exit 1
fi
if [ ! -x "$IPHONEOS_GCC" ]; then
echo "Cannot find $IPHONEOS_GCC"
exit 1
fi
if [ ! -d "$IPHONESIMULATOR_PLATFORM" ]; then
echo "Cannot find $IPHONESIMULATOR_PLATFORM"
exit 1
fi
if [ ! -d "$IPHONESIMULATOR_SDK" ]; then
echo "Cannot find $IPHONESIMULATOR_SDK"
exit 1
fi
if [ ! -x "$IPHONESIMULATOR_GCC" ]; then
echo "Cannot find $IPHONESIMULATOR_GCC"
exit 1
fi
# Clean up whatever was left from our previous build
rm -rf include lib
rm -rf /tmp/openssl-${OPENSSL_VERSION}-*
rm -rf /tmp/openssl-${OPENSSL_VERSION}-*.*-log
build()
{
TARGET=$1
ARCH=$2
GCC=$3
SDK=$4
EXTRA=$5
rm -rf "openssl-${OPENSSL_VERSION}"
tar xfz "openssl-${OPENSSL_VERSION}.tar.gz"
pushd .
cd "openssl-${OPENSSL_VERSION}"
./Configure ${TARGET} --openssldir="/tmp/openssl-${OPENSSL_VERSION}-${ARCH}" ${EXTRA} &> "/tmp/openssl-${OPENSSL_VERSION}-${ARCH}.log"
perl -i -pe 's|static volatile sig_atomic_t intr_signal|static volatile int intr_signal|' crypto/ui/ui_openssl.c
perl -i -pe "s|^CC= gcc|CC= ${GCC} -arch ${ARCH} -miphoneos-version-min=${MIN_VERSION}|g" Makefile
perl -i -pe "s|^CFLAG= (.*)|CFLAG= -isysroot ${SDK} \$1|g" Makefile
make &> "/tmp/openssl-${OPENSSL_VERSION}-${ARCH}.build-log"
make install &> "/tmp/openssl-${OPENSSL_VERSION}-${ARCH}.install-log"
popd
rm -rf "openssl-${OPENSSL_VERSION}"
}
mkdir openssl
cd openssl
if [ ! -e ${OPENSSL_VERSION}.tar.gz ]; then
echo "Downloading ${OPENSSL_VERSION}.tar.gz"
curl -O http://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz
else
echo "Using ${OPENSSL_VERSION}.tar.gz"
fi
build "BSD-generic32" "armv7" "${IPHONEOS_GCC}" "${IPHONEOS_SDK}" ""
build "BSD-generic32" "armv7s" "${IPHONEOS_GCC}" "${IPHONEOS_SDK}" ""
build "BSD-generic64" "arm64" "${IPHONEOS_GCC}" "${IPHONEOS_SDK}" ""
build "BSD-generic32" "i386" "${IPHONESIMULATOR_GCC}" "${IPHONESIMULATOR_SDK}" ""
build "BSD-generic64" "x86_64" "${IPHONESIMULATOR_GCC}" "${IPHONESIMULATOR_SDK}" "-DOPENSSL_NO_ASM"
#
mkdir include
cp -r /tmp/openssl-${OPENSSL_VERSION}-i386/include/openssl include/
mkdir lib
lipo \
"/tmp/openssl-${OPENSSL_VERSION}-armv7/lib/libcrypto.a" \
"/tmp/openssl-${OPENSSL_VERSION}-armv7s/lib/libcrypto.a" \
"/tmp/openssl-${OPENSSL_VERSION}-arm64/lib/libcrypto.a" \
"/tmp/openssl-${OPENSSL_VERSION}-i386/lib/libcrypto.a" \
"/tmp/openssl-${OPENSSL_VERSION}-x86_64/lib/libcrypto.a" \
-create -output lib/libcrypto.a
lipo \
"/tmp/openssl-${OPENSSL_VERSION}-armv7/lib/libssl.a" \
"/tmp/openssl-${OPENSSL_VERSION}-armv7s/lib/libssl.a" \
"/tmp/openssl-${OPENSSL_VERSION}-arm64/lib/libssl.a" \
"/tmp/openssl-${OPENSSL_VERSION}-i386/lib/libssl.a" \
"/tmp/openssl-${OPENSSL_VERSION}-x86_64/lib/libssl.a" \
-create -output lib/libssl.a
rm -rf "/tmp/openssl-${OPENSSL_VERSION}-*"
rm -rf "/tmp/openssl-${OPENSSL_VERSION}-*.*-log"
Binary file not shown.
Binary file not shown.
Binary file not shown.
+674
View File
@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
{project} Copyright (C) {year} {fullname}
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
-45
View File
@@ -1,45 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6250" systemVersion="14A388a" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2014 Limelight Stream. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="22" y="439" width="437" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.6705882352941176" green="0.83137254901960789" blue="0.086274509803921567" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<variation key="widthClass=compact">
<fontDescription key="fontDescription" type="system" pointSize="11"/>
</variation>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="store_icon_1024x1024" translatesAutoresizingMaskIntoConstraints="NO" id="tIx-KE-YER">
<rect key="frame" x="127" y="126" width="227" height="227"/>
<constraints>
<constraint firstAttribute="width" constant="227" id="EI7-Sf-3cH"/>
<constraint firstAttribute="height" constant="227" id="b0G-y9-aP0"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="tIx-KE-YER" firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="GN9-Xb-RLD"/>
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Gnz-uJ-CDw"/>
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
<constraint firstAttribute="centerY" secondItem="tIx-KE-YER" secondAttribute="centerY" constant="0.5" id="trN-ZP-0Hg"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="404" y="445"/>
</view>
</objects>
<resources>
<image name="store_icon_1024x1024" width="1024" height="1024"/>
</resources>
</document>
File diff suppressed because it is too large Load Diff
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:Limelight.xcodeproj">
</FileRef>
</Workspace>
@@ -1,53 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDESourceControlProjectFavoriteDictionaryKey</key>
<false/>
<key>IDESourceControlProjectIdentifier</key>
<string>054A62F3-1197-45FB-A607-EA7922396E24</string>
<key>IDESourceControlProjectName</key>
<string>Limelight</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>A4B0849259F9566B0CBA84A6D3D4A0F895C03123</key>
<string>github.com:limelight-stream/limelight-ios.git</string>
<key>EB99D631D5149240E91F8D168F0F298D7A5BAA89</key>
<string>github.com:limelight-stream/limelight-common-c.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>Limelight.xcodeproj</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>A4B0849259F9566B0CBA84A6D3D4A0F895C03123</key>
<string>../..</string>
<key>EB99D631D5149240E91F8D168F0F298D7A5BAA89</key>
<string>../../limelight-common-c</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>github.com:limelight-stream/limelight-ios.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>111</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>A4B0849259F9566B0CBA84A6D3D4A0F895C03123</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>EB99D631D5149240E91F8D168F0F298D7A5BAA89</string>
<key>IDESourceControlWCCName</key>
<string>limelight-common-c</string>
</dict>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>A4B0849259F9566B0CBA84A6D3D4A0F895C03123</string>
<key>IDESourceControlWCCName</key>
<string>limelight-ios</string>
</dict>
</array>
</dict>
</plist>
-17
View File
@@ -1,17 +0,0 @@
//
// App.h
// Limelight
//
// Created by Diego Waxemberg on 10/22/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface App : NSObject
@property NSString* appId;
@property NSString* appName;
@property UIImage* appImage;
@end
-15
View File
@@ -1,15 +0,0 @@
//
// App.m
// Limelight
//
// Created by Diego Waxemberg on 10/22/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import "App.h"
#import "HttpManager.h"
@implementation App
@synthesize appId, appName, appImage;
@end
-23
View File
@@ -1,23 +0,0 @@
//
// AppDelegate.h
// Limelight-iOS
//
// Created by Diego Waxemberg on 1/17/14.
// Copyright (c) 2014 Diego Waxemberg. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;
- (void)saveContext;
- (NSURL *)applicationDocumentsDirectory;
- (NSURL*) getStoreURL;
@end
-150
View File
@@ -1,150 +0,0 @@
//
// AppDelegate.m
// Limelight-iOS
//
// Created by Diego Waxemberg on 1/17/14.
// Copyright (c) 2014 Diego Waxemberg. All rights reserved.
//
#import "AppDelegate.h"
@implementation AppDelegate
@synthesize managedObjectContext = _managedObjectContext;
@synthesize managedObjectModel = _managedObjectModel;
@synthesize persistentStoreCoordinator = _persistentStoreCoordinator;
static NSOperationQueue* mainQueue;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Saves changes in the application's managed object context before the application terminates.
[self saveContext];
}
- (void)saveContext
{
NSError *error = nil;
NSManagedObjectContext *managedObjectContext = self.managedObjectContext;
if (managedObjectContext != nil) {
if ([managedObjectContext hasChanges] && ![managedObjectContext save:&error]) {
// Replace this implementation with code to handle the error appropriately.
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
}
}
#pragma mark - Core Data stack
// Returns the managed object context for the application.
// If the context doesn't already exist, it is created and bound to the persistent store coordinator for the application.
- (NSManagedObjectContext *)managedObjectContext
{
if (_managedObjectContext != nil) {
return _managedObjectContext;
}
NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator];
if (coordinator != nil) {
_managedObjectContext = [[NSManagedObjectContext alloc] init];
[_managedObjectContext setPersistentStoreCoordinator:coordinator];
}
return _managedObjectContext;
}
// Returns the managed object model for the application.
// If the model doesn't already exist, it is created from the application's model.
- (NSManagedObjectModel *)managedObjectModel
{
if (_managedObjectModel != nil) {
return _managedObjectModel;
}
_managedObjectModel = [NSManagedObjectModel mergedModelFromBundles:nil];
return _managedObjectModel;
}
// Returns the persistent store coordinator for the application.
// If the coordinator doesn't already exist, it is created and the application's store added to it.
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{
if (_persistentStoreCoordinator != nil) {
return _persistentStoreCoordinator;
}
NSURL *storeURL = [self getStoreURL];
NSError *error = nil;
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) {
/*
Replace this implementation with code to handle the error appropriately.
abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
Typical reasons for an error here include:
* The persistent store is not accessible;
* The schema for the persistent store is incompatible with current managed object model.
Check the error message to determine what the actual problem was.
If the persistent store is not accessible, there is typically something wrong with the file path. Often, a file URL is pointing into the application's resources directory instead of a writeable directory.
If you encounter schema incompatibility errors during development, you can reduce their frequency by:
* Simply deleting the existing store:
[[NSFileManager defaultManager] removeItemAtURL:storeURL error:nil]
* Performing automatic lightweight migration by passing the following dictionary as the options parameter:
@{NSMigratePersistentStoresAutomaticallyOption:@YES, NSInferMappingModelAutomaticallyOption:@YES}
Lightweight migration will only work for a limited set of schema changes; consult "Core Data Model Versioning and Data Migration Programming Guide" for details.
*/
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
return _persistentStoreCoordinator;
}
#pragma mark - Application's Documents directory
// Returns the URL to the application's Documents directory.
- (NSURL *)applicationDocumentsDirectory
{
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
}
- (NSURL*) getStoreURL {
return [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"Limelight_iOS.sqlite"];
}
@end
-27
View File
@@ -1,27 +0,0 @@
//
// CryptoManager.h
// Limelight
//
// Created by Diego Waxemberg on 10/14/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface CryptoManager : NSObject
+ (void) generateKeyPairUsingSSl;
+ (NSString*) getUniqueID;
+ (NSData*) readCertFromFile;
+ (NSData*) readKeyFromFile;
+ (NSData*) readP12FromFile;
+ (NSData*) getSignatureFromCert:(NSData*)cert;
- (NSData*) createAESKeyFromSalt:(NSData*)saltedPIN;
- (NSData*) SHA1HashData:(NSData*)data;
- (NSData*) aesEncrypt:(NSData*)data withKey:(NSData*)key;
- (NSData*) aesDecrypt:(NSData*)data withKey:(NSData*)key;
- (bool) verifySignature:(NSData *)data withSignature:(NSData*)signature andCert:(NSData*)cert;
- (NSData*) signData:(NSData*)data withKey:(NSData*)key;
@end
-236
View File
@@ -1,236 +0,0 @@
//
// CryptoManager.m
// Limelight
//
// Created by Diego Waxemberg on 10/14/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import "CryptoManager.h"
#import "mkcert.h"
#import <AdSupport/ASIdentifierManager.h>
#include <openssl/aes.h>
#include <openssl/sha.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
#include <openssl/evp.h>
@implementation CryptoManager
static const int SHA1_DIGEST_LENGTH = 20;
static NSData* key = nil;
static NSData* cert = nil;
static NSData* p12 = nil;
- (NSData*) createAESKeyFromSalt:(NSData*)saltedPIN {
return [[self SHA1HashData:saltedPIN] subdataWithRange:NSMakeRange(0, 16)];
}
- (NSData*) SHA1HashData:(NSData*)data {
unsigned char sha1[SHA1_DIGEST_LENGTH];
SHA1([data bytes], [data length], sha1);
NSData* bytes = [NSData dataWithBytes:sha1 length:20];
return bytes;
}
- (NSData*) aesEncrypt:(NSData*)data withKey:(NSData*)key {
AES_KEY aesKey;
AES_set_encrypt_key([key bytes], 128, &aesKey);
int size = [self getEncryptSize:data];
unsigned char* buffer = malloc(size);
unsigned char* blockRoundedBuffer = calloc(1, size);
memcpy(blockRoundedBuffer, [data bytes], [data length]);
// AES_encrypt only encrypts the first 16 bytes so iterate the entire buffer
int blockOffset = 0;
while (blockOffset < size) {
AES_encrypt(blockRoundedBuffer + blockOffset, buffer + blockOffset, &aesKey);
blockOffset += 16;
}
NSData* encryptedData = [NSData dataWithBytes:buffer length:size];
free(buffer);
free(blockRoundedBuffer);
return encryptedData;
}
- (NSData*) aesDecrypt:(NSData*)data withKey:(NSData*)key {
AES_KEY aesKey;
AES_set_decrypt_key([key bytes], 128, &aesKey);
unsigned char* buffer = malloc([data length]);
// AES_decrypt only decrypts the first 16 bytes so iterate the entire buffer
int blockOffset = 0;
while (blockOffset < [data length]) {
AES_decrypt([data bytes] + blockOffset, buffer + blockOffset, &aesKey);
blockOffset += 16;
}
NSData* decryptedData = [NSData dataWithBytes:buffer length:[data length]];
free(buffer);
return decryptedData;
}
- (int) getEncryptSize:(NSData*)data {
// the size is the length of the data ceiling to the nearest 16 bytes
return (((int)[data length] + 15) / 16) * 16;
}
- (bool) verifySignature:(NSData *)data withSignature:(NSData*)signature andCert:(NSData*)cert {
const char* buffer = [cert bytes];
X509* x509;
BIO* bio = BIO_new(BIO_s_mem());
BIO_puts(bio, buffer);
x509 = PEM_read_bio_X509(bio, NULL, NULL, NULL);
BIO_free(bio);
if (!x509) {
fprintf(stderr, "unable to parse certificate in memory\n");
return NULL;
}
EVP_PKEY* pubKey = X509_get_pubkey(x509);
EVP_MD_CTX *mdctx = NULL;
mdctx = EVP_MD_CTX_create();
EVP_DigestVerifyInit(mdctx, NULL, EVP_sha256(), NULL, pubKey);
EVP_DigestVerifyUpdate(mdctx, [data bytes], [data length]);
int result = EVP_DigestVerifyFinal(mdctx, (unsigned char*)[signature bytes], [signature length]);
X509_free(x509);
EVP_PKEY_free(pubKey);
EVP_MD_CTX_destroy(mdctx);
return result > 0;
}
- (NSData *)signData:(NSData *)data withKey:(NSData *)key {
const char* buffer = [key bytes];
BIO* bio = BIO_new(BIO_s_mem());
BIO_puts(bio, buffer);
EVP_PKEY* pkey;
pkey = PEM_read_bio_PrivateKey(bio, NULL, NULL, NULL);
BIO_free(bio);
if (!pkey) {
fprintf(stderr, "unable to parse private key in memory\n");
return NULL;
}
EVP_MD_CTX *mdctx = NULL;
mdctx = EVP_MD_CTX_create();
EVP_DigestSignInit(mdctx, NULL, EVP_sha256(), NULL, pkey);
EVP_DigestSignUpdate(mdctx, [data bytes], [data length]);
size_t slen;
EVP_DigestSignFinal(mdctx, NULL, &slen);
unsigned char* signature = malloc(slen);
int result = EVP_DigestSignFinal(mdctx, signature, &slen);
EVP_PKEY_free(pkey);
EVP_MD_CTX_destroy(mdctx);
if (result <= 0) {
free(signature);
return NULL;
}
NSData* signedData = [NSData dataWithBytes:signature length:slen];
free(signature);
return signedData;
}
// TODO: these three methods are almost identical, fix the copy-pasta
+ (NSData*) readCertFromFile {
if (cert == nil) {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *certFile = [documentsDirectory stringByAppendingPathComponent:@"client.crt"];
cert = [NSData dataWithContentsOfFile:certFile];
}
return cert;
}
+ (NSData*) readP12FromFile {
if (p12 == nil) {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *p12File = [documentsDirectory stringByAppendingPathComponent:@"client.p12"];
p12 = [NSData dataWithContentsOfFile:p12File];
}
return p12;
}
+ (NSData*) readKeyFromFile {
if (key == nil) {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *keyFile = [documentsDirectory stringByAppendingPathComponent:@"client.key"];
key = [NSData dataWithContentsOfFile:keyFile];
}
return key;
}
+ (bool) keyPairExists {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *keyFile = [documentsDirectory stringByAppendingPathComponent:@"client.key"];
NSString *p12File = [documentsDirectory stringByAppendingPathComponent:@"client.p12"];
NSString *certFile = [documentsDirectory stringByAppendingPathComponent:@"client.crt"];
bool keyFileExists = [[NSFileManager defaultManager] fileExistsAtPath:keyFile];
bool p12FileExists = [[NSFileManager defaultManager] fileExistsAtPath:p12File];
bool certFileExists = [[NSFileManager defaultManager] fileExistsAtPath:certFile];
return keyFileExists && p12FileExists && certFileExists;
}
+ (NSData *)getSignatureFromCert:(NSData *)cert {
const char* buffer = [cert bytes];
X509* x509;
BIO* bio = BIO_new(BIO_s_mem());
BIO_puts(bio, buffer);
x509 = PEM_read_bio_X509(bio, NULL, NULL, NULL);
if (!x509) {
fprintf(stderr, "unable to parse certificate in memory\n");
return NULL;
}
return [NSData dataWithBytes:x509->signature->data length:x509->signature->length];
}
+ (void) generateKeyPairUsingSSl {
if (![CryptoManager keyPairExists]) {
NSLog(@"Generating Certificate... ");
CertKeyPair certKeyPair = generateCertKeyPair();
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString* documentsDirectory = [paths objectAtIndex:0];
NSString* certFile = [documentsDirectory stringByAppendingPathComponent:@"client.crt"];
NSString* keyPairFile = [documentsDirectory stringByAppendingPathComponent:@"client.key"];
NSString* p12File = [documentsDirectory stringByAppendingPathComponent:@"client.p12"];
//NSLog(@"Writing cert and key to: \n%@\n%@", certFile, keyPairFile);
saveCertKeyPair([certFile UTF8String], [p12File UTF8String], [keyPairFile UTF8String], certKeyPair);
freeCertKeyPair(certKeyPair);
}
}
+ (NSString*) getUniqueID {
// generate a UUID
NSUUID* uuid = [ASIdentifierManager sharedManager].advertisingIdentifier;
NSString* idString = [NSString stringWithString:[uuid UUIDString]];
// we need a 16byte hex-string so we take the last 17 characters
// and remove the '-' to get a 16 character string
NSMutableString* uniqueId = [NSMutableString stringWithString:[idString substringFromIndex:19]];
[uniqueId deleteCharactersInRange:NSMakeRange(4, 1)];
//NSLog(@"Unique ID: %@", uniqueId);
return [NSString stringWithString:uniqueId];
}
@end
-169
View File
@@ -1,169 +0,0 @@
#include "mkcert.h"
#include <stdio.h>
#include <stdlib.h>
#include <openssl/pem.h>
#include <openssl/conf.h>
#include <openssl/pkcs12.h>
#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
#endif
static const int NUM_BITS = 2048;
static const int SERIAL = 0;
static const int NUM_YEARS = 10;
int mkcert(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int years);
int add_ext(X509 *cert, int nid, char *value);
struct CertKeyPair generateCertKeyPair() {
BIO *bio_err;
X509 *x509 = NULL;
EVP_PKEY *pkey = NULL;
PKCS12 *p12 = NULL;
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
SSLeay_add_all_algorithms();
ERR_load_crypto_strings();
mkcert(&x509, &pkey, NUM_BITS, SERIAL, NUM_YEARS);
p12 = PKCS12_create("limelight", "GameStream", pkey, x509, NULL, 0, 0, 0, 0, 0);
if (p12 == NULL) {
printf("Error generating a valid PKCS12 certificate.\n");
}
// Debug Print statements
//RSA_print_fp(stdout, pkey->pkey.rsa, 0);
//X509_print_fp(stdout, x509);
//PEM_write_PUBKEY(stdout, pkey);
//PEM_write_PrivateKey(stdout, pkey, NULL, NULL, 0, NULL, NULL);
//PEM_write_X509(stdout, x509);
#ifndef OPENSSL_NO_ENGINE
ENGINE_cleanup();
#endif
CRYPTO_cleanup_all_ex_data();
CRYPTO_mem_leaks(bio_err);
BIO_free(bio_err);
return (CertKeyPair){x509, pkey, p12};
}
void freeCertKeyPair(struct CertKeyPair certKeyPair) {
X509_free(certKeyPair.x509);
EVP_PKEY_free(certKeyPair.pkey);
PKCS12_free(certKeyPair.p12);
}
void saveCertKeyPair(const char* certFile, const char* p12File, const char* keyPairFile, CertKeyPair certKeyPair) {
FILE* certFilePtr = fopen(certFile, "w");
FILE* keyPairFilePtr = fopen(keyPairFile, "w");
FILE* p12FilePtr = fopen(p12File, "wb");
//TODO: error check
PEM_write_PrivateKey(keyPairFilePtr, certKeyPair.pkey, NULL, NULL, 0, NULL, NULL);
PEM_write_X509(certFilePtr, certKeyPair.x509);
i2d_PKCS12_fp(p12FilePtr, certKeyPair.p12);
fclose(p12FilePtr);
fclose(certFilePtr);
fclose(keyPairFilePtr);
}
int mkcert(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int years) {
X509 *x;
EVP_PKEY *pk;
RSA *rsa;
X509_NAME *name = NULL;
if (*pkeyp == NULL) {
if ((pk=EVP_PKEY_new()) == NULL) {
abort();
return(0);
}
} else {
pk = *pkeyp;
}
if (*x509p == NULL) {
if ((x = X509_new()) == NULL) {
goto err;
}
} else {
x = *x509p;
}
rsa = RSA_generate_key(bits, RSA_F4, NULL, NULL);
if (!EVP_PKEY_assign_RSA(pk, rsa)) {
abort();
goto err;
}
X509_set_version(x, 2);
ASN1_INTEGER_set(X509_get_serialNumber(x), serial);
X509_gmtime_adj(X509_get_notBefore(x), 0);
X509_gmtime_adj(X509_get_notAfter(x), (long)60*60*24*365*years);
X509_set_pubkey(x, pk);
name = X509_get_subject_name(x);
/* This function creates and adds the entry, working out the
* correct string type and performing checks on its length.
*/
X509_NAME_add_entry_by_txt(name,"CN", MBSTRING_ASC, (unsigned char*)"NVIDIA GameStream Client", -1, -1, 0);
/* Its self signed so set the issuer name to be the same as the
* subject.
*/
X509_set_issuer_name(x, name);
/* Add various extensions: standard extensions */
add_ext(x, NID_basic_constraints, "critical,CA:TRUE");
add_ext(x, NID_key_usage, "critical,keyCertSign,cRLSign");
add_ext(x, NID_subject_key_identifier, "hash");
if (!X509_sign(x, pk, EVP_sha1())) {
goto err;
}
*x509p = x;
*pkeyp = pk;
return(1);
err:
return(0);
}
/* Add extension using V3 code: we can set the config file as NULL
* because we wont reference any other sections.
*/
int add_ext(X509 *cert, int nid, char *value)
{
X509_EXTENSION *ex;
X509V3_CTX ctx;
/* This sets the 'context' of the extensions. */
/* No configuration database */
X509V3_set_ctx_nodb(&ctx);
/* Issuer and subject certs: both the target since it is self signed,
* no request and no CRL
*/
X509V3_set_ctx(&ctx, cert, cert, NULL, NULL, 0);
ex = X509V3_EXT_conf_nid(NULL, &ctx, nid, value);
if (!ex) {
return 0;
}
X509_add_ext(cert, ex, -1);
X509_EXTENSION_free(ex);
return 1;
}
-25
View File
@@ -1,25 +0,0 @@
//
// mkcert.h
// Limelight
//
// Created by Diego Waxemberg on 10/16/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#ifndef Limelight_mkcert_h
#define Limelight_mkcert_h
#include <openssl/x509v3.h>
#include <openssl/pkcs12.h>
typedef struct CertKeyPair {
X509 *x509;
EVP_PKEY *pkey;
PKCS12 *p12;
} CertKeyPair;
struct CertKeyPair generateCertKeyPair();
void freeCertKeyPair(CertKeyPair);
void saveCertKeyPair(const char* certFile, const char* p12File, const char* keyPairFile, CertKeyPair certKeyPair);
#endif
-24
View File
@@ -1,24 +0,0 @@
//
// DataManager.h
// Limelight
//
// Created by Diego Waxemberg on 10/28/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Settings.h"
#import "AppDelegate.h"
#import "Host.h"
@interface DataManager : NSObject
@property (strong, nonatomic) AppDelegate* appDelegate;
- (void) saveSettingsWithBitrate:(NSInteger)bitrate framerate:(NSInteger)framerate height:(NSInteger)height width:(NSInteger)width;
- (Settings*) retrieveSettings;
- (NSArray*) retrieveHosts;
- (void) saveHosts;
- (Host*) createHost:(NSString*)name hostname:(NSString*)address;
@end
-90
View File
@@ -1,90 +0,0 @@
//
// DataManager.m
// Limelight
//
// Created by Diego Waxemberg on 10/28/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import "DataManager.h"
@implementation DataManager
static NSInteger DEFAULT_BITRATE = 10000;
static NSInteger DEFAULT_FRAMERATE = 60;
static NSInteger DEFAULT_HEIGHT = 720;
static NSInteger DEFAULT_WIDTH = 1280;
- (id) init {
self = [super init];
self.appDelegate = [[UIApplication sharedApplication] delegate];
return self;
}
- (void) saveSettingsWithBitrate:(NSInteger)bitrate framerate:(NSInteger)framerate height:(NSInteger)height width:(NSInteger)width {
Settings* settingsToSave = [self retrieveSettings];
settingsToSave.framerate = [NSNumber numberWithInteger:framerate];
settingsToSave.bitrate = [NSNumber numberWithInteger:bitrate];
settingsToSave.height = [NSNumber numberWithInteger:height];
settingsToSave.width = [NSNumber numberWithInteger:width];
NSError* error;
if (![[self.appDelegate managedObjectContext] save:&error]) {
NSLog(@"ERROR: Unable to save settings to database");
}
[self.appDelegate saveContext];
}
- (Settings*) retrieveSettings {
NSArray* fetchedRecords = [self fetchRecords:@"Settings"];
if (fetchedRecords.count == 0) {
// create a new settings object with the default values
NSEntityDescription* entity = [NSEntityDescription entityForName:@"Settings" inManagedObjectContext:[self.appDelegate managedObjectContext]];
Settings* settings = [[Settings alloc] initWithEntity:entity insertIntoManagedObjectContext:[self.appDelegate managedObjectContext]];
settings.framerate = [NSNumber numberWithInteger:DEFAULT_FRAMERATE];
settings.bitrate = [NSNumber numberWithInteger:DEFAULT_BITRATE];
settings.height = [NSNumber numberWithInteger:DEFAULT_HEIGHT];
settings.width = [NSNumber numberWithInteger:DEFAULT_WIDTH];
return settings;
} else {
// we should only ever have 1 settings object stored
return [fetchedRecords objectAtIndex:0];
}
}
- (Host*) createHost:(NSString*)name hostname:(NSString*)address {
NSEntityDescription* entity = [NSEntityDescription entityForName:@"Host" inManagedObjectContext:[self.appDelegate managedObjectContext]];
Host* host = [[Host alloc] initWithEntity:entity insertIntoManagedObjectContext:[self.appDelegate managedObjectContext]];
host.name = name;
host.address = address;
return host;
}
- (void) saveHosts {
NSError* error;
if (![[self.appDelegate managedObjectContext] save:&error]) {
NSLog(@"ERROR: Unable to save hosts to database");
}
[self.appDelegate saveContext];
}
- (NSArray*) retrieveHosts {
return [self fetchRecords:@"Host"];
}
- (NSArray*) fetchRecords:(NSString*)entityName {
NSFetchRequest* fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription* entity = [NSEntityDescription entityForName:entityName inManagedObjectContext:[self.appDelegate managedObjectContext]];
[fetchRequest setEntity:entity];
[fetchRequest setAffectedStores:[NSArray arrayWithObjects:[[self.appDelegate persistentStoreCoordinator] persistentStoreForURL:[self.appDelegate getStoreURL]], nil]];
NSError* error;
NSArray* fetchedRecords = [[self.appDelegate managedObjectContext] executeFetchRequest:fetchRequest error:&error];
//TODO: handle errors
return fetchedRecords;
}
@end
-18
View File
@@ -1,18 +0,0 @@
//
// Host.h
// Limelight
//
// Created by Diego Waxemberg on 10/28/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@interface Host : NSManagedObject
@property (nonatomic, retain) NSString * address;
@property (nonatomic, retain) NSString * name;
@end
-17
View File
@@ -1,17 +0,0 @@
//
// Host.m
// Limelight
//
// Created by Diego Waxemberg on 10/28/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import "Host.h"
@implementation Host
@dynamic address;
@dynamic name;
@end
-20
View File
@@ -1,20 +0,0 @@
//
// Settings.h
// Limelight
//
// Created by Diego Waxemberg on 10/28/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@interface Settings : NSManagedObject
@property (nonatomic, retain) NSNumber * bitrate;
@property (nonatomic, retain) NSNumber * framerate;
@property (nonatomic, retain) NSNumber * height;
@property (nonatomic, retain) NSNumber * width;
@end
-19
View File
@@ -1,19 +0,0 @@
//
// Settings.m
// Limelight
//
// Created by Diego Waxemberg on 10/28/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import "Settings.h"
@implementation Settings
@dynamic bitrate;
@dynamic framerate;
@dynamic height;
@dynamic width;
@end
@@ -1,23 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "limelight_computer_add_icon_1x.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "limelight_computer_add_icon_2x.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "limelight_computer_add_icon_3x.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

@@ -1,68 +0,0 @@
{
"images" : [
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "app_icon_58x58_2x-1.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "app_icon_80x80_2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "app_icon_120x120_2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "app_icon_180x180_3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "app_icon_29x29_1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "app_icon_58x58_2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "app_icon_40x40_1x.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "app_icon_80x80_2x-1.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "app_icon_76x76_1x.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "app_icon_152x152_2x.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

@@ -1,23 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "limelight_computer_1x.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "limelight_computer_2x.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "limelight_computer_3x.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

@@ -1,51 +0,0 @@
{
"images" : [
{
"orientation" : "portrait",
"idiom" : "iphone",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"subtype" : "retina4",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -1,23 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "limelight_no_app_image_1x.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "limelight_no_app_image_2x.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "limelight_no_app_image_3x.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

@@ -1,23 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "settings_1x.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "settings_2x.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "settings_3x.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

@@ -1,21 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "store_icon_1024x1024.png"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 627 KiB

-20
View File
@@ -1,20 +0,0 @@
//
// ControllerSupport.h
// Limelight
//
// Created by Cameron Gutman on 10/20/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ControllerSupport : NSObject
-(id) init;
-(void) cleanup;
@property (nonatomic, strong) id connectObserver;
@property (nonatomic, strong) id disconnectObserver;
@end
-134
View File
@@ -1,134 +0,0 @@
//
// ControllerSupport.m
// Limelight
//
// Created by Cameron Gutman on 10/20/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import "ControllerSupport.h"
#include "Limelight.h"
@import GameController;
@implementation ControllerSupport
// UPDATE_BUTTON(flag, pressed)
#define UPDATE_BUTTON(x, y) (buttonFlags = \
(y) ? (buttonFlags | (x)) : (buttonFlags & ~(x)))
static NSLock *controllerStreamLock;
+(void) registerControllerCallbacks
{
for (int i = 0; i < [[GCController controllers] count]; i++) {
GCController *controller = [GCController controllers][i];
if (controller != NULL) {
printf("Controller connected!\n");
controller.controllerPausedHandler = ^(GCController *controller) {
// We call LiSendControllerEvent while holding a lock to prevent
// multiple simultaneous calls since this function isn't thread safe.
[controllerStreamLock lock];
LiSendControllerEvent(PLAY_FLAG, 0, 0, 0, 0, 0, 0);
// Pause for 100 ms
usleep(100 * 1000);
LiSendControllerEvent(0, 0, 0, 0, 0, 0, 0);
[controllerStreamLock unlock];
};
if (controller.extendedGamepad != NULL) {
controller.extendedGamepad.valueChangedHandler = ^(GCExtendedGamepad *gamepad, GCControllerElement *element) {
short buttonFlags = 0;
short leftStickX, leftStickY;
short rightStickX, rightStickY;
char leftTrigger, rightTrigger;
UPDATE_BUTTON(A_FLAG, gamepad.buttonA.pressed);
UPDATE_BUTTON(B_FLAG, gamepad.buttonB.pressed);
UPDATE_BUTTON(X_FLAG, gamepad.buttonX.pressed);
UPDATE_BUTTON(Y_FLAG, gamepad.buttonY.pressed);
UPDATE_BUTTON(UP_FLAG, gamepad.dpad.up.pressed);
UPDATE_BUTTON(DOWN_FLAG, gamepad.dpad.down.pressed);
UPDATE_BUTTON(LEFT_FLAG, gamepad.dpad.left.pressed);
UPDATE_BUTTON(RIGHT_FLAG, gamepad.dpad.right.pressed);
UPDATE_BUTTON(LB_FLAG, gamepad.leftShoulder.pressed);
UPDATE_BUTTON(RB_FLAG, gamepad.rightShoulder.pressed);
leftStickX = gamepad.leftThumbstick.xAxis.value * 0x7FFE;
leftStickY = gamepad.leftThumbstick.yAxis.value * 0x7FFE;
rightStickX = gamepad.rightThumbstick.xAxis.value * 0x7FFE;
rightStickY = gamepad.rightThumbstick.yAxis.value * 0x7FFE;
leftTrigger = gamepad.leftTrigger.value * 0xFF;
rightTrigger = gamepad.rightTrigger.value * 0xFF;
// We call LiSendControllerEvent while holding a lock to prevent
// multiple simultaneous calls since this function isn't thread safe.
[controllerStreamLock lock];
LiSendControllerEvent(buttonFlags, leftTrigger, rightTrigger,
leftStickX, leftStickY, rightStickX, rightStickY);
[controllerStreamLock unlock];
};
}
else if (controller.gamepad != NULL) {
controller.gamepad.valueChangedHandler = ^(GCGamepad *gamepad, GCControllerElement *element) {
short buttonFlags = 0;
UPDATE_BUTTON(A_FLAG, gamepad.buttonA.pressed);
UPDATE_BUTTON(B_FLAG, gamepad.buttonB.pressed);
UPDATE_BUTTON(X_FLAG, gamepad.buttonX.pressed);
UPDATE_BUTTON(Y_FLAG, gamepad.buttonY.pressed);
UPDATE_BUTTON(UP_FLAG, gamepad.dpad.up.pressed);
UPDATE_BUTTON(DOWN_FLAG, gamepad.dpad.down.pressed);
UPDATE_BUTTON(LEFT_FLAG, gamepad.dpad.left.pressed);
UPDATE_BUTTON(RIGHT_FLAG, gamepad.dpad.right.pressed);
UPDATE_BUTTON(LB_FLAG, gamepad.leftShoulder.pressed);
UPDATE_BUTTON(RB_FLAG, gamepad.rightShoulder.pressed);
// We call LiSendControllerEvent while holding a lock to prevent
// multiple simultaneous calls since this function isn't thread safe.
[controllerStreamLock lock];
LiSendControllerEvent(buttonFlags, 0, 0, 0, 0, 0, 0);
[controllerStreamLock unlock];
};
}
}
}
}
-(id) init
{
self = [super init];
if (controllerStreamLock == NULL) {
controllerStreamLock = [[NSLock alloc] init];
}
self.connectObserver = [[NSNotificationCenter defaultCenter] addObserverForName:GCControllerDidConnectNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
[ControllerSupport registerControllerCallbacks];
}];
self.disconnectObserver = [[NSNotificationCenter defaultCenter] addObserverForName:GCControllerDidDisconnectNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
printf("Controller disconnected!\n");
}];
[ControllerSupport registerControllerCallbacks];
return self;
}
-(void) cleanup
{
[[NSNotificationCenter defaultCenter] removeObserver:self.connectObserver];
[[NSNotificationCenter defaultCenter] removeObserver:self.disconnectObserver];
}
@end
-13
View File
@@ -1,13 +0,0 @@
//
// StreamView.h
// Limelight
//
// Created by Cameron Gutman on 10/19/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface StreamView : UIView
@end
-59
View File
@@ -1,59 +0,0 @@
//
// StreamView.m
// Limelight
//
// Created by Cameron Gutman on 10/19/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import "StreamView.h"
#include <Limelight.h>
@implementation StreamView {
CGPoint touchLocation;
BOOL touchMoved;
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
touchLocation = [touch locationInView:self];
touchMoved = false;
printf("Touch down\n");
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint currentLocation = [touch locationInView:self];
if (touchLocation.x != currentLocation.x ||
touchLocation.y != currentLocation.y)
{
LiSendMouseMoveEvent(currentLocation.x - touchLocation.x,
currentLocation.y - touchLocation.y );
touchMoved = true;
touchLocation = currentLocation;
}
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
printf("Touch up\n");
if (!touchMoved) {
printf("Sending left mouse button press\n");
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_LEFT);
// Wait 100 ms to simulate a real button press
usleep(100 * 1000);
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT);
}
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
}
@end
-54
View File
@@ -1,54 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.limelight-stream.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.2.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.games</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>Launch Screen</string>
<key>UIMainStoryboardFile</key>
<string>iPhone</string>
<key>UIMainStoryboardFile~ipad</key>
<string>iPad</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UIStatusBarHidden</key>
<true/>
<key>UIStatusBarHidden~ipad</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
-17
View File
@@ -1,17 +0,0 @@
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//
#import <Availability.h>
#ifndef __IPHONE_3_0
#warning "This project uses features only available in iOS SDK 3.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#endif
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>_XCCurrentVersionName</key>
<string>Limelight.xcdatamodel</string>
</dict>
</plist>
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="6252" systemVersion="14C68k" minimumToolsVersion="Automatic" macOSVersion="Automatic" iOSVersion="Automatic">
<entity name="Host" representedClassName="Host" syncable="YES">
<attribute name="address" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="name" optional="YES" attributeType="String" syncable="YES"/>
</entity>
<entity name="Settings" representedClassName="Settings" syncable="YES">
<attribute name="bitrate" optional="YES" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
<attribute name="framerate" optional="YES" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
<attribute name="height" optional="YES" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
<attribute name="width" optional="YES" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
</entity>
<elements>
<element name="Host" positionX="0" positionY="0" width="0" height="0"/>
<element name="Settings" positionX="0" positionY="0" width="0" height="0"/>
</elements>
</model>
-23
View File
@@ -1,23 +0,0 @@
//
// AppManager.h
// Limelight
//
// Created by Diego Waxemberg on 10/25/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "App.h"
#import "HttpManager.h"
@protocol AppAssetCallback <NSObject>
- (void) receivedAssetForApp:(App*)app;
@end
@interface AppManager : NSObject
+ (void) retrieveAppAssets:(NSArray*)apps withManager:(HttpManager*)hMan andCallback:(id<AppAssetCallback>)callback;
@end
-45
View File
@@ -1,45 +0,0 @@
//
// AppManager.m
// Limelight
//
// Created by Diego Waxemberg on 10/25/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import "AppManager.h"
@implementation AppManager {
App* _app;
HttpManager* _hMan;
id<AppAssetCallback> _callback;
}
+ (void) retrieveAppAssets:(NSArray*)apps withManager:(HttpManager*)hMan andCallback:(id<AppAssetCallback>)callback {
for (App* app in apps) {
AppManager* manager = [[AppManager alloc] initWithApp:app httpManager:hMan andCallback:callback];
[manager retrieveAsset];
}
}
- (id) initWithApp:(App*)app httpManager:(HttpManager*)hMan andCallback:(id<AppAssetCallback>)callback {
self = [super init];
_app = app;
_hMan = hMan;
_callback = callback;
return self;
}
- (void) retrieveAsset {
NSData* appAsset = [_hMan executeRequestSynchronously:[_hMan newAppAssetRequestWithAppId:_app.appId]];
UIImage* appImage = [UIImage imageWithData:appAsset];
_app.appImage = appImage;
NSLog(@"App Name: %@ id:%@ image: %@", _app.appName, _app.appId, _app.appImage);
[self performSelectorOnMainThread:@selector(sendCallBack) withObject:self waitUntilDone:NO];
}
- (void) sendCallBack {
[_callback receivedAssetForApp:_app];
}
@end
-32
View File
@@ -1,32 +0,0 @@
//
// HttpManager.h
// Limelight
//
// Created by Diego Waxemberg on 10/16/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface HttpManager : NSObject <NSURLConnectionDelegate, NSURLConnectionDataDelegate>
+ (NSArray*) getAppListFromXML:(NSData*)xml;
+ (NSString*) getStringFromXML:(NSData*)xml tag:(NSString*)tag;
+ (NSString*) getStatusStringFromXML:(NSData*)xml;
- (id) initWithHost:(NSString*) host uniqueId:(NSString*) uniqueId deviceName:(NSString*) deviceName cert:(NSData*) cert;
- (NSURLRequest*) newPairRequest:(NSData*)salt;
- (NSURLRequest*) newUnpairRequest;
- (NSURLRequest*) newChallengeRequest:(NSData*)challenge;
- (NSURLRequest*) newChallengeRespRequest:(NSData*)challengeResp;
- (NSURLRequest*) newClientSecretRespRequest:(NSString*)clientPairSecret;
- (NSURLRequest*) newPairChallenge;
- (NSURLRequest*) newAppListRequest;
- (NSURLRequest*) newServerInfoRequest;
- (NSURLRequest*) newLaunchRequest:(NSString*)appId width:(int)width height:(int)height refreshRate:(int)refreshRate rikey:(NSString*)rikey rikeyid:(int)rikeyid;
- (NSURLRequest*) newResumeRequestWithRiKey:(NSString*)riKey riKeyId:(int)riKeyId;
- (NSURLRequest*) newAppAssetRequestWithAppId:(NSString*)appId;
- (NSData*) executeRequestSynchronously:(NSURLRequest*)request;
@end
-338
View File
@@ -1,338 +0,0 @@
//
// HttpManager.m
// Limelight
//
// Created by Diego Waxemberg on 10/16/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import "HttpManager.h"
#import "CryptoManager.h"
#import "App.h"
#include <libxml2/libxml/xmlreader.h>
#include <string.h>
@implementation HttpManager {
NSString* _baseURL;
NSString* _host;
NSString* _uniqueId;
NSString* _deviceName;
NSData* _cert;
NSMutableData* _respData;
NSData* _requestResp;
dispatch_semaphore_t _requestLock;
}
static const NSString* PORT = @"47984";
+ (NSArray*) getAppListFromXML:(NSData*)xml {
xmlDocPtr docPtr = xmlParseMemory([xml bytes], (int)[xml length]);
if (docPtr == NULL) {
NSLog(@"ERROR: An error occured trying to parse xml.");
return NULL;
}
xmlNodePtr node;
xmlNodePtr rootNode = node = xmlDocGetRootElement(docPtr);
// Check root status_code
if (![HttpManager verifyStatus: rootNode]) {
NSLog(@"ERROR: Request returned with failure status");
return NULL;
}
// Skip the root node
node = node->children;
NSMutableArray* appList = [[NSMutableArray alloc] init];
while (node != NULL) {
NSLog(@"node: %s", node->name);
if (!xmlStrcmp(node->name, (const xmlChar*)"App")) {
xmlNodePtr appInfoNode = node->xmlChildrenNode;
NSString* appName;
NSString* appId;
while (appInfoNode != NULL) {
NSLog(@"appInfoNode: %s", appInfoNode->name);
if (!xmlStrcmp(appInfoNode->name, (const xmlChar*)"AppTitle")) {
xmlChar* nodeVal = xmlNodeListGetString(docPtr, appInfoNode->xmlChildrenNode, 1);
appName = [[NSString alloc] initWithCString:(const char*)nodeVal encoding:NSUTF8StringEncoding];
xmlFree(nodeVal);
} else if (!xmlStrcmp(appInfoNode->name, (const xmlChar*)"ID")) {
xmlChar* nodeVal = xmlNodeListGetString(docPtr, appInfoNode->xmlChildrenNode, 1);
appId = [[NSString alloc] initWithCString:(const char*)nodeVal encoding:NSUTF8StringEncoding];
xmlFree(nodeVal);
}
appInfoNode = appInfoNode->next;
}
App* app = [[App alloc] init];
app.appName = appName;
app.appId = appId;
[appList addObject:app];
}
node = node->next;
}
xmlFree(rootNode);
xmlFree(docPtr);
return appList;
}
+ (NSString*) getStatusStringFromXML:(NSData*)xml {
xmlDocPtr docPtr = xmlParseMemory([xml bytes], (int)[xml length]);
if (docPtr == NULL) {
NSLog(@"ERROR: An error occured trying to parse xml.");
return NULL;
}
NSString* string;
xmlNodePtr rootNode = xmlDocGetRootElement(docPtr);
string = [HttpManager getStatusMessage: rootNode];
xmlFree(rootNode);
xmlFree(docPtr);
return string;
}
+ (NSString*) getStringFromXML:(NSData*)xml tag:(NSString*)tag {
xmlDocPtr docPtr = xmlParseMemory([xml bytes], (int)[xml length]);
if (docPtr == NULL) {
NSLog(@"ERROR: An error occured trying to parse xml.");
return NULL;
}
NSString* value;
xmlNodePtr node;
xmlNodePtr rootNode = node = xmlDocGetRootElement(docPtr);
// Check root status_code
if (![HttpManager verifyStatus: rootNode]) {
NSLog(@"ERROR: Request returned with failure status");
return NULL;
}
// Skip the root node
node = node->children;
while (node != NULL) {
//NSLog(@"node: %s", node->name);
if (!xmlStrcmp(node->name, (const xmlChar*)[tag UTF8String])) {
xmlChar* nodeVal = xmlNodeListGetString(docPtr, node->xmlChildrenNode, 1);
value = [[NSString alloc] initWithCString:(const char*)nodeVal encoding:NSUTF8StringEncoding];
xmlFree(nodeVal);
}
node = node->next;
}
//NSLog(@"xmlValue: %@", value);
xmlFree(rootNode);
xmlFree(docPtr);
return value;
}
+ (NSString*) getStatusMessage:(xmlNodePtr)docRoot {
xmlChar* statusMsgXml = xmlGetProp(docRoot, (const xmlChar*)"status_message");
NSString* statusMsg = [NSString stringWithUTF8String:(const char*)statusMsgXml];
xmlFree(statusMsgXml);
return statusMsg;
}
+ (bool) verifyStatus:(xmlNodePtr)docRoot {
xmlChar* statusStr = xmlGetProp(docRoot, (const xmlChar*)"status_code");
NSLog(@"status: %s", statusStr);
int status = [[NSString stringWithUTF8String:(const char*)statusStr] intValue];
xmlFree(statusStr);
return status == 200;
}
+ (NSData*) fixXmlVersion:(NSData*) xmlData {
NSString* dataString = [[NSString alloc] initWithData:xmlData encoding:NSUTF8StringEncoding];
NSString* xmlString = [dataString stringByReplacingOccurrencesOfString:@"UTF-16" withString:@"UTF-8" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [dataString length])];
return [xmlString dataUsingEncoding:NSUTF8StringEncoding];
}
- (id) initWithHost:(NSString*) host uniqueId:(NSString*) uniqueId deviceName:(NSString*) deviceName cert:(NSData*) cert {
self = [super init];
_host = host;
_uniqueId = uniqueId;
_deviceName = deviceName;
_cert = cert;
_baseURL = [[NSString stringWithFormat:@"https://%@:%@", host, PORT]
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
_requestLock = dispatch_semaphore_create(0);
_respData = [[NSMutableData alloc] init];
return self;
}
- (NSData*) executeRequestSynchronously:(NSURLRequest*)request {
NSLog(@"Making Request: %@", request);
[_respData setLength:0];
dispatch_sync(dispatch_get_main_queue(), ^{
[NSURLConnection connectionWithRequest:request delegate:self];
});
dispatch_semaphore_wait(_requestLock, DISPATCH_TIME_FOREVER);
return _requestResp;
}
- (void) executeRequest:(NSURLRequest*)request {
[NSURLConnection connectionWithRequest:request delegate:self];
}
- (NSURLRequest*) createRequestFromString:(NSString*) urlString enableTimeout:(BOOL)normalTimeout {
NSString* escapedUrl = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL* url = [[NSURL alloc] initWithString:escapedUrl];
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:url];
if (normalTimeout) {
// Timeout the request after 5 seconds
[request setTimeoutInterval:5];
}
else {
// Timeout the request after 60 seconds
[request setTimeoutInterval:60];
}
return request;
}
- (NSURLRequest*) newPairRequest:(NSData*)salt {
NSString* urlString = [NSString stringWithFormat:@"%@/pair?uniqueid=%@&devicename=%@&updateState=1&phrase=getservercert&salt=%@&clientcert=%@",
_baseURL, _uniqueId, _deviceName, [self bytesToHex:salt], [self bytesToHex:_cert]];
// This call blocks while waiting for the user to input the PIN on the PC
return [self createRequestFromString:urlString enableTimeout:FALSE];
}
- (NSURLRequest*) newUnpairRequest {
NSString* urlString = [NSString stringWithFormat:@"%@/unpair?uniqueid=%@", _baseURL, _uniqueId];
return [self createRequestFromString:urlString enableTimeout:TRUE];
}
- (NSURLRequest*) newChallengeRequest:(NSData*)challenge {
NSString* urlString = [NSString stringWithFormat:@"%@/pair?uniqueid=%@&devicename=%@&updateState=1&clientchallenge=%@",
_baseURL, _uniqueId, _deviceName, [self bytesToHex:challenge]];
return [self createRequestFromString:urlString enableTimeout:TRUE];
}
- (NSURLRequest*) newChallengeRespRequest:(NSData*)challengeResp {
NSString* urlString = [NSString stringWithFormat:@"%@/pair?uniqueid=%@&devicename=%@&updateState=1&serverchallengeresp=%@",
_baseURL, _uniqueId, _deviceName, [self bytesToHex:challengeResp]];
return [self createRequestFromString:urlString enableTimeout:TRUE];
}
- (NSURLRequest*) newClientSecretRespRequest:(NSString*)clientPairSecret {
NSString* urlString = [NSString stringWithFormat:@"%@/pair?uniqueid=%@&devicename=%@&updateState=1&clientpairingsecret=%@", _baseURL, _uniqueId, _deviceName, clientPairSecret];
return [self createRequestFromString:urlString enableTimeout:TRUE];
}
- (NSURLRequest*) newPairChallenge {
NSString* urlString = [NSString stringWithFormat:@"%@/pair?uniqueid=%@&devicename=%@&updateState=1&phrase=pairchallenge", _baseURL, _uniqueId, _deviceName];
return [self createRequestFromString:urlString enableTimeout:TRUE];
}
- (NSURLRequest *)newAppListRequest {
NSString* urlString = [NSString stringWithFormat:@"%@/applist?uniqueid=%@", _baseURL, _uniqueId];
return [self createRequestFromString:urlString enableTimeout:TRUE];
}
- (NSURLRequest *)newServerInfoRequest {
NSString* urlString = [NSString stringWithFormat:@"%@/serverinfo?uniqueid=%@", _baseURL, _uniqueId];
return [self createRequestFromString:urlString enableTimeout:TRUE];
}
- (NSURLRequest*) newLaunchRequest:(NSString*)appId width:(int)width height:(int)height refreshRate:(int)refreshRate rikey:(NSString*)rikey rikeyid:(int)rikeyid {
NSString* urlString = [NSString stringWithFormat:@"%@/launch?uniqueid=%@&appid=%@&mode=%dx%dx%d&additionalStates=1&sops=1&rikey=%@&rikeyid=%d", _baseURL, _uniqueId, appId, width, height, refreshRate, rikey, rikeyid];
// This blocks while the app is launching
return [self createRequestFromString:urlString enableTimeout:FALSE];
}
- (NSURLRequest*) newResumeRequestWithRiKey:(NSString*)riKey riKeyId:(int)riKeyId {
NSString* urlString = [NSString stringWithFormat:@"%@/resume?uniqueid=%@&rikey=%@&rikeyid=%d", _baseURL, _uniqueId, riKey, riKeyId];
// This blocks while the app is resuming
return [self createRequestFromString:urlString enableTimeout:FALSE];
}
- (NSURLRequest*) newAppAssetRequestWithAppId:(NSString *)appId {
NSString* urlString = [NSString stringWithFormat:@"%@/appasset?uniqueid=%@&appid=%@&AssetType=2&AssetIdx=0", _baseURL, _uniqueId, appId];
return [self createRequestFromString:urlString enableTimeout:FALSE];
}
- (NSString*) bytesToHex:(NSData*)data {
const unsigned char* bytes = [data bytes];
NSMutableString *hex = [[NSMutableString alloc] init];
for (int i = 0; i < [data length]; i++) {
[hex appendFormat:@"%02X" , bytes[i]];
}
return hex;
}
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
NSLog(@"Received response: %@", response);
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
NSLog(@"\n\nReceived data: %@\n\n", [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);
[_respData appendData:data];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
if ([[NSString alloc] initWithData:_respData encoding:NSUTF8StringEncoding] != nil) {
_requestResp = [HttpManager fixXmlVersion:_respData];
} else {
_requestResp = _respData;
}
dispatch_semaphore_signal(_requestLock);
}
- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
SecIdentityRef identity = [self getClientCertificate];
NSArray *certArray = [self getCertificate:identity];
NSURLCredential *newCredential = [NSURLCredential credentialWithIdentity:identity certificates:certArray persistence:NSURLCredentialPersistencePermanent];
[challenge.sender useCredential:newCredential forAuthenticationChallenge:challenge];
}
// Returns an array containing the certificate
- (NSArray*)getCertificate:(SecIdentityRef) identity {
SecCertificateRef certificate = nil;
SecIdentityCopyCertificate(identity, &certificate);
return [[NSArray alloc] initWithObjects:(__bridge id)certificate, nil];
}
// Returns the identity
- (SecIdentityRef)getClientCertificate {
SecIdentityRef identityApp = nil;
CFDataRef p12Data = (__bridge CFDataRef)[CryptoManager readP12FromFile];
CFStringRef password = CFSTR("limelight");
const void *keys[] = { kSecImportExportPassphrase };
const void *values[] = { password };
CFDictionaryRef options = CFDictionaryCreate(NULL, keys, values, 1, NULL, NULL);
CFArrayRef items = CFArrayCreate(NULL, 0, 0, NULL);
OSStatus securityError = SecPKCS12Import(p12Data, options, &items);
if (securityError == errSecSuccess) {
//NSLog(@"Success opening p12 certificate. Items: %ld", CFArrayGetCount(items));
CFDictionaryRef identityDict = CFArrayGetValueAtIndex(items, 0);
identityApp = (SecIdentityRef)CFDictionaryGetValue(identityDict, kSecImportItemIdentity);
} else {
NSLog(@"Error opening Certificate.");
}
CFRelease(options);
CFRelease(password);
return identityApp;
}
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
NSLog(@"connection error: %@", error);
dispatch_semaphore_signal(_requestLock);
}
@end
-28
View File
@@ -1,28 +0,0 @@
//
// MDNSManager.h
// Limelight
//
// Created by Diego Waxemberg on 10/14/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol MDNSCallback <NSObject>
- (void) updateHosts:(NSArray*)hosts;
@end
@interface MDNSManager : NSObject <NSNetServiceBrowserDelegate, NSNetServiceDelegate>
@property id<MDNSCallback> callback;
- (id) initWithCallback:(id<MDNSCallback>) callback;
- (void) searchForHosts;
- (void) stopSearching;
@end
-125
View File
@@ -1,125 +0,0 @@
//
// MDNSManager.m
// Limelight
//
// Created by Diego Waxemberg on 10/14/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import "MDNSManager.h"
#import "Computer.h"
@implementation MDNSManager {
NSNetServiceBrowser* mDNSBrowser;
NSMutableArray* domains;
NSMutableArray* services;
BOOL scanActive;
}
static NSString* NV_SERVICE_TYPE = @"_nvstream._tcp";
- (id) initWithCallback:(id<MDNSCallback>)callback {
self = [super init];
self.callback = callback;
mDNSBrowser = [[NSNetServiceBrowser alloc] init];
[mDNSBrowser setDelegate:self];
domains = [[NSMutableArray alloc] init];
services = [[NSMutableArray alloc] init];
return self;
}
- (void) searchForHosts {
NSLog(@"Starting mDNS discovery");
scanActive = TRUE;
[mDNSBrowser searchForServicesOfType:NV_SERVICE_TYPE inDomain:@""];
}
- (void) stopSearching {
NSLog(@"Stopping mDNS discovery");
scanActive = FALSE;
[mDNSBrowser stop];
}
- (NSArray*) getFoundHosts {
NSMutableArray* hosts = [[NSMutableArray alloc] init];
for (NSNetService* service in services) {
if (service.hostName != nil) {
[hosts addObject:[[Computer alloc] initWithHost:service]];
}
}
return hosts;
}
- (void)netServiceDidResolveAddress:(NSNetService *)service {
NSLog(@"Resolved address: %@ -> %@", service, service.hostName);
[self.callback updateHosts:[self getFoundHosts]];
}
- (void)netService:(NSNetService *)sender didNotResolve:(NSDictionary *)errorDict {
NSLog(@"Did not resolve address for: %@\n%@", sender, [errorDict description]);
// Schedule a retry in 2 seconds
[NSTimer scheduledTimerWithTimeInterval:2.0
target:self
selector:@selector(retryResolveTimerCallback:)
userInfo:nil
repeats:NO];
}
- (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didFindService:(NSNetService *)aNetService moreComing:(BOOL)moreComing {
NSLog(@"Found service: %@", aNetService);
[aNetService setDelegate:self];
[aNetService resolveWithTimeout:5];
[services removeObject:aNetService];
[services addObject:aNetService];
}
- (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didRemoveService:(NSNetService *)aNetService moreComing:(BOOL)moreComing {
NSLog(@"Removing service: %@", aNetService);
[services removeObject:aNetService];
}
- (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didNotSearch:(NSDictionary *)errorDict {
NSLog(@"Did not perform search");
NSLog(@"%@", [errorDict description]);
// Schedule a retry in 2 seconds
[NSTimer scheduledTimerWithTimeInterval:2.0
target:self
selector:@selector(retrySearchTimerCallback:)
userInfo:nil
repeats:NO];
}
- (void)retrySearchTimerCallback:(NSTimer *)timer {
// Check if we've been stopped since this was queued
if (!scanActive) {
return;
}
NSLog(@"Retrying mDNS search");
[mDNSBrowser stop];
[mDNSBrowser searchForServicesOfType:NV_SERVICE_TYPE inDomain:@""];
}
- (void)retryResolveTimerCallback:(NSTimer *)timer {
// Check if we've been stopped since this was queued
if (!scanActive) {
return;
}
NSLog(@"Retrying mDNS resolution");
for (NSNetService* service in services) {
if (service.hostName == nil) {
[service setDelegate:self];
[service resolveWithTimeout:5];
}
}
}
@end
-27
View File
@@ -1,27 +0,0 @@
//
// PairManager.h
// Limelight
//
// Created by Diego Waxemberg on 10/19/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "HttpManager.h"
@protocol PairCallback <NSObject>
- (void) showPIN:(NSString*)PIN;
- (void) pairSuccessful;
- (void) pairFailed:(NSString*)message;
- (void) alreadyPaired;
@end
@interface PairManager : NSOperation
- (id) initWithManager:(HttpManager*)httpManager andCert:(NSData*)cert callback:(id<PairCallback>)callback;
- (NSString*) generatePIN;
- (NSData*) saltPIN:(NSString*)PIN;
- (void) initiatePair;
@end
-150
View File
@@ -1,150 +0,0 @@
//
// PairManager.m
// Limelight
//
// Created by Diego Waxemberg on 10/19/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import "PairManager.h"
#import "CryptoManager.h"
#import "Utils.h"
#include <dispatch/dispatch.h>
@implementation PairManager {
HttpManager* _httpManager;
NSData* _cert;
id<PairCallback> _callback;
}
- (id) initWithManager:(HttpManager*)httpManager andCert:(NSData*)cert callback:(id<PairCallback>)callback {
self = [super init];
_httpManager = httpManager;
_cert = cert;
_callback = callback;
return self;
}
- (void) main {
NSData* serverInfo = [_httpManager executeRequestSynchronously:[_httpManager newServerInfoRequest]];
if (serverInfo == NULL) {
[_callback pairFailed:@"Unable to connect to PC"];
return;
}
if (![[HttpManager getStringFromXML:serverInfo tag:@"currentgame"] isEqual:@"0"]) {
[_callback pairFailed:@"You must stop streaming before attempting to pair."];
}
else if (![[HttpManager getStringFromXML:serverInfo tag:@"PairStatus"] isEqual:@"1"]) {
[self initiatePair];
} else {
[_callback alreadyPaired];
}
}
- (void) initiatePair {
NSString* PIN = [self generatePIN];
NSData* salt = [self saltPIN:PIN];
NSLog(@"PIN: %@, saltedPIN: %@", PIN, salt);
[_callback showPIN:PIN];
NSData* pairResp = [_httpManager executeRequestSynchronously:[_httpManager newPairRequest:salt]];
NSString* pairedString;
pairedString = [HttpManager getStringFromXML:pairResp tag:@"paired"];
if (pairedString == NULL || ![pairedString isEqualToString:@"1"]) {
[_httpManager executeRequestSynchronously:[_httpManager newUnpairRequest]];
[_callback pairFailed:@"Pairing was declined by the target."];
return;
}
NSString* plainCert = [HttpManager getStringFromXML:pairResp tag:@"plaincert"];
CryptoManager* cryptoMan = [[CryptoManager alloc] init];
NSData* aesKey = [cryptoMan createAESKeyFromSalt:salt];
NSData* randomChallenge = [Utils randomBytes:16];
NSData* encryptedChallenge = [cryptoMan aesEncrypt:randomChallenge withKey:aesKey];
NSData* challengeResp = [_httpManager executeRequestSynchronously:[_httpManager newChallengeRequest:encryptedChallenge]];
pairedString = [HttpManager getStringFromXML:challengeResp tag:@"paired"];
if (pairedString == NULL || ![pairedString isEqualToString:@"1"]) {
[_httpManager executeRequestSynchronously:[_httpManager newUnpairRequest]];
[_callback pairFailed:@"Pairing stage #2 failed"];
return;
}
NSData* encServerChallengeResp = [Utils hexToBytes:[HttpManager getStringFromXML:challengeResp tag:@"challengeresponse"]];
NSData* decServerChallengeResp = [cryptoMan aesDecrypt:encServerChallengeResp withKey:aesKey];
NSData* serverResponse = [decServerChallengeResp subdataWithRange:NSMakeRange(0, 20)];
NSData* serverChallenge = [decServerChallengeResp subdataWithRange:NSMakeRange(20, 16)];
NSData* clientSecret = [Utils randomBytes:16];
NSData* challengeRespHash = [cryptoMan SHA1HashData:[self concatData:[self concatData:serverChallenge with:[CryptoManager getSignatureFromCert:_cert]] with:clientSecret]];
NSData* challengeRespEncrypted = [cryptoMan aesEncrypt:challengeRespHash withKey:aesKey];
NSData* secretResp = [_httpManager executeRequestSynchronously:[_httpManager newChallengeRespRequest:challengeRespEncrypted]];
pairedString = [HttpManager getStringFromXML:secretResp tag:@"paired"];
if (pairedString == NULL || ![pairedString isEqualToString:@"1"]) {
[_httpManager executeRequestSynchronously:[_httpManager newUnpairRequest]];
[_callback pairFailed:@"Pairing stage #3 failed"];
return;
}
NSData* serverSecretResp = [Utils hexToBytes:[HttpManager getStringFromXML:secretResp tag:@"pairingsecret"]];
NSData* serverSecret = [serverSecretResp subdataWithRange:NSMakeRange(0, 16)];
NSData* serverSignature = [serverSecretResp subdataWithRange:NSMakeRange(16, 256)];
if (![cryptoMan verifySignature:serverSecret withSignature:serverSignature andCert:[Utils hexToBytes:plainCert]]) {
[_httpManager executeRequestSynchronously:[_httpManager newUnpairRequest]];
[_callback pairFailed:@"Server certificate invalid"];
return;
}
NSData* serverChallengeRespHash = [cryptoMan SHA1HashData:[self concatData:[self concatData:randomChallenge with:[CryptoManager getSignatureFromCert:[Utils hexToBytes:plainCert]]] with:serverSecret]];
if (![serverChallengeRespHash isEqual:serverResponse]) {
[_httpManager executeRequestSynchronously:[_httpManager newUnpairRequest]];
[_callback pairFailed:@"Incorrect PIN"];
return;
}
NSData* clientPairingSecret = [self concatData:clientSecret with:[cryptoMan signData:clientSecret withKey:[CryptoManager readKeyFromFile]]];
NSData* clientSecretResp = [_httpManager executeRequestSynchronously:[_httpManager newClientSecretRespRequest:[Utils bytesToHex:clientPairingSecret]]];
pairedString = [HttpManager getStringFromXML:clientSecretResp tag:@"paired"];
if (pairedString == NULL || ![pairedString isEqualToString:@"1"]) {
[_httpManager executeRequestSynchronously:[_httpManager newUnpairRequest]];
[_callback pairFailed:@"Pairing stage #4 failed"];
return;
}
NSData* clientPairChallenge = [_httpManager executeRequestSynchronously:[_httpManager newPairChallenge]];
pairedString = [HttpManager getStringFromXML:clientPairChallenge tag:@"paired"];
if (pairedString == NULL || ![pairedString isEqualToString:@"1"]) {
[_httpManager executeRequestSynchronously:[_httpManager newUnpairRequest]];
[_callback pairFailed:@"Pairing stage #5 failed"];
return;
}
[_callback pairSuccessful];
}
- (NSData*) concatData:(NSData*)data with:(NSData*)moreData {
NSMutableData* concatData = [[NSMutableData alloc] initWithData:data];
[concatData appendData:moreData];
return concatData;
}
- (NSString*) generatePIN {
NSString* PIN = [NSString stringWithFormat:@"%d%d%d%d",
arc4random() % 10, arc4random() % 10,
arc4random() % 10, arc4random() % 10];
return PIN;
}
- (NSData*) saltPIN:(NSString*)PIN {
NSMutableData* saltedPIN = [[NSMutableData alloc] initWithCapacity:20];
[saltedPIN appendData:[Utils randomBytes:16]];
[saltedPIN appendBytes:[PIN UTF8String] length:4];
return saltedPIN;
}
@end
-32
View File
@@ -1,32 +0,0 @@
//
// Connection.h
// Limelight-iOS
//
// Created by Diego Waxemberg on 1/19/14.
// Copyright (c) 2014 Diego Waxemberg. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "VideoDecoderRenderer.h"
#import "StreamConfiguration.h"
@protocol ConnectionCallbacks <NSObject>
- (void) connectionStarted;
- (void) connectionTerminated:(long)errorCode;
- (void) stageStarting:(char*)stageName;
- (void) stageComplete:(char*)stageName;
- (void) stageFailed:(char*)stageName withError:(long)errorCode;
- (void) launchFailed:(NSString*)message;
- (void) displayMessage:(char*)message;
- (void) displayTransientMessage:(char*)message;
@end
@interface Connection : NSOperation <NSStreamDelegate>
-(id) initWithConfig:(StreamConfiguration*)config renderer:(VideoDecoderRenderer*)myRenderer connectionCallbacks:(id<ConnectionCallbacks>)callbacks;
-(void) terminate;
-(void) main;
@end
-428
View File
@@ -1,428 +0,0 @@
//
// Connection.m
// Limelight-iOS
//
// Created by Diego Waxemberg on 1/19/14.
// Copyright (c) 2014 Diego Waxemberg. All rights reserved.
//
#import "Connection.h"
#import <AudioUnit/AudioUnit.h>
#import <AVFoundation/AVFoundation.h>
#include "Limelight.h"
#include "opus.h"
@implementation Connection {
IP_ADDRESS _host;
STREAM_CONFIGURATION _streamConfig;
CONNECTION_LISTENER_CALLBACKS _clCallbacks;
DECODER_RENDERER_CALLBACKS _drCallbacks;
AUDIO_RENDERER_CALLBACKS _arCallbacks;
}
static OpusDecoder *opusDecoder;
static id<ConnectionCallbacks> _callbacks;
#define PCM_BUFFER_SIZE 1024
#define OUTPUT_BUS 0
struct AUDIO_BUFFER_QUEUE_ENTRY {
struct AUDIO_BUFFER_QUEUE_ENTRY *next;
int length;
int offset;
char data[0];
};
#define MAX_QUEUE_ENTRIES 10
static short decodedPcmBuffer[512];
static NSLock *audioLock;
static struct AUDIO_BUFFER_QUEUE_ENTRY *audioBufferQueue;
static int audioBufferQueueLength;
static AudioComponentInstance audioUnit;
static VideoDecoderRenderer* renderer;
void DrSetup(int width, int height, int fps, void* context, int drFlags)
{
}
void DrSubmitDecodeUnit(PDECODE_UNIT decodeUnit)
{
unsigned char* data = (unsigned char*) malloc(decodeUnit->fullLength);
if (data != NULL) {
int offset = 0;
PLENTRY entry = decodeUnit->bufferList;
while (entry != NULL) {
memcpy(&data[offset], entry->data, entry->length);
offset += entry->length;
entry = entry->next;
}
// This function will take our buffer
[renderer submitDecodeBuffer:data length:decodeUnit->fullLength];
}
}
void DrStart(void)
{
}
void DrStop(void)
{
}
void DrRelease(void)
{
}
void ArInit(void)
{
int err;
opusDecoder = opus_decoder_create(48000, 2, &err);
audioLock = [[NSLock alloc] init];
// Configure the audio session for our app
NSError *audioSessionError = nil;
AVAudioSession* audioSession = [AVAudioSession sharedInstance];
[audioSession setPreferredSampleRate:48000.0 error:&audioSessionError];
[audioSession setCategory: AVAudioSessionCategoryPlayback error: &audioSessionError];
[audioSession setPreferredOutputNumberOfChannels:2 error:&audioSessionError];
[audioSession setPreferredIOBufferDuration:0.005 error:&audioSessionError];
[audioSession setActive: YES error: &audioSessionError];
OSStatus status;
AudioComponentDescription audioDesc;
audioDesc.componentType = kAudioUnitType_Output;
audioDesc.componentSubType = kAudioUnitSubType_RemoteIO;
audioDesc.componentFlags = 0;
audioDesc.componentFlagsMask = 0;
audioDesc.componentManufacturer = kAudioUnitManufacturer_Apple;
status = AudioComponentInstanceNew(AudioComponentFindNext(NULL, &audioDesc), &audioUnit);
if (status) {
printf("Unable to instantiate new AudioComponent: %d\n", (int32_t)status);
}
AudioStreamBasicDescription audioFormat = {0};
audioFormat.mSampleRate = 48000;
audioFormat.mBitsPerChannel = 16;
audioFormat.mFormatID = kAudioFormatLinearPCM;
audioFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
audioFormat.mChannelsPerFrame = 2;
audioFormat.mBytesPerFrame = audioFormat.mChannelsPerFrame * (audioFormat.mBitsPerChannel / 8);
audioFormat.mBytesPerPacket = audioFormat.mBytesPerFrame;
audioFormat.mFramesPerPacket = audioFormat.mBytesPerPacket / audioFormat.mBytesPerFrame;
audioFormat.mReserved = 0;
status = AudioUnitSetProperty(audioUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input,
OUTPUT_BUS,
&audioFormat,
sizeof(audioFormat));
if (status) {
printf("Unable to set audio unit to input: %d\n", (int32_t)status);
}
AURenderCallbackStruct callbackStruct = {0};
callbackStruct.inputProc = playbackCallback;
callbackStruct.inputProcRefCon = NULL;
status = AudioUnitSetProperty(audioUnit,
kAudioUnitProperty_SetRenderCallback,
kAudioUnitScope_Input,
OUTPUT_BUS,
&callbackStruct,
sizeof(callbackStruct));
if (status) {
printf("Unable to set audio unit callback: %d\n", (int32_t)status);
}
status = AudioUnitInitialize(audioUnit);
if (status) {
printf("Unable to initialize audioUnit: %d\n", (int32_t)status);
}
}
void ArRelease(void)
{
if (opusDecoder != NULL) {
opus_decoder_destroy(opusDecoder);
opusDecoder = NULL;
}
OSStatus status = AudioUnitUninitialize(audioUnit);
if (status) {
printf("Unable to uninitialize audioUnit: %d\n", (int32_t)status);
}
// Audio session is now inactive
AVAudioSession* audioSession = [AVAudioSession sharedInstance];
[audioSession setActive: YES error: nil];
// This is safe because we're guaranteed that nobody
// is touching this list now
struct AUDIO_BUFFER_QUEUE_ENTRY *entry;
while (audioBufferQueue != NULL) {
entry = audioBufferQueue;
audioBufferQueue = entry->next;
audioBufferQueueLength--;
free(entry);
}
}
void ArStart(void)
{
OSStatus status = AudioOutputUnitStart(audioUnit);
if (status) {
printf("Unable to start audioUnit: %d\n", (int32_t)status);
}
}
void ArStop(void)
{
OSStatus status = AudioOutputUnitStop(audioUnit);
if (status) {
printf("Unable to stop audioUnit: %d\n", (int32_t)status);
}
}
void ArDecodeAndPlaySample(char* sampleData, int sampleLength)
{
int decodedLength = opus_decode(opusDecoder, (unsigned char*)sampleData, sampleLength, decodedPcmBuffer, PCM_BUFFER_SIZE / 2, 0);
if (decodedLength > 0) {
// Return of opus_decode is samples per channel
decodedLength *= 4;
struct AUDIO_BUFFER_QUEUE_ENTRY *newEntry = malloc(sizeof(*newEntry) + decodedLength);
if (newEntry != NULL) {
newEntry->next = NULL;
newEntry->length = decodedLength;
newEntry->offset = 0;
memcpy(newEntry->data, decodedPcmBuffer, decodedLength);
[audioLock lock];
if (audioBufferQueueLength > MAX_QUEUE_ENTRIES) {
printf("Audio player too slow. Dropping all decoded samples!\n");
// Clear all values from the buffer queue
struct AUDIO_BUFFER_QUEUE_ENTRY *entry;
while (audioBufferQueue != NULL) {
entry = audioBufferQueue;
audioBufferQueue = entry->next;
audioBufferQueueLength--;
free(entry);
}
}
if (audioBufferQueue == NULL) {
audioBufferQueue = newEntry;
}
else {
struct AUDIO_BUFFER_QUEUE_ENTRY *lastEntry = audioBufferQueue;
while (lastEntry->next != NULL) {
lastEntry = lastEntry->next;
}
lastEntry->next = newEntry;
}
audioBufferQueueLength++;
[audioLock unlock];
}
}
}
void ClStageStarting(int stage)
{
[_callbacks stageStarting:(char*)LiGetStageName(stage)];
}
void ClStageComplete(int stage)
{
[_callbacks stageComplete:(char*)LiGetStageName(stage)];
}
void ClStageFailed(int stage, long errorCode)
{
[_callbacks stageFailed:(char*)LiGetStageName(stage) withError:errorCode];
}
void ClConnectionStarted(void)
{
[_callbacks connectionStarted];
}
void ClConnectionTerminated(long errorCode)
{
[_callbacks connectionTerminated: errorCode];
}
void ClDisplayMessage(char* message)
{
[_callbacks displayMessage: message];
}
void ClDisplayTransientMessage(char* message)
{
[_callbacks displayTransientMessage: message];
}
-(void) terminate
{
// We dispatch this async to get out because this can be invoked
// on a thread inside common and we don't want to deadlock
dispatch_async(dispatch_get_main_queue(), ^{
// This is safe to call even before LiStartConnection
LiStopConnection();
});
}
-(id) initWithConfig:(StreamConfiguration*)config renderer:(VideoDecoderRenderer*)myRenderer connectionCallbacks:(id<ConnectionCallbacks>)callbacks
{
self = [super init];
_host = config.hostAddr;
renderer = myRenderer;
_callbacks = callbacks;
_streamConfig.width = config.width;
_streamConfig.height = config.height;
_streamConfig.fps = config.frameRate;
_streamConfig.bitrate = config.bitRate;
_streamConfig.packetSize = 1024;
memcpy(_streamConfig.remoteInputAesKey, [config.riKey bytes], [config.riKey length]);
memset(_streamConfig.remoteInputAesIv, 0, 16);
int riKeyId = htonl(config.riKeyId);
memcpy(_streamConfig.remoteInputAesIv, &riKeyId, sizeof(riKeyId));
_drCallbacks.setup = DrSetup;
_drCallbacks.start = DrStart;
_drCallbacks.stop = DrStop;
_drCallbacks.release = DrRelease;
_drCallbacks.submitDecodeUnit = DrSubmitDecodeUnit;
_arCallbacks.init = ArInit;
_arCallbacks.start = ArStart;
_arCallbacks.stop = ArStop;
_arCallbacks.release = ArRelease;
_arCallbacks.decodeAndPlaySample = ArDecodeAndPlaySample;
_clCallbacks.stageStarting = ClStageStarting;
_clCallbacks.stageComplete = ClStageComplete;
_clCallbacks.stageFailed = ClStageFailed;
_clCallbacks.connectionStarted = ClConnectionStarted;
_clCallbacks.connectionTerminated = ClConnectionTerminated;
_clCallbacks.displayMessage = ClDisplayMessage;
_clCallbacks.displayTransientMessage = ClDisplayTransientMessage;
return self;
}
static OSStatus playbackCallback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData) {
// Notes: ioData contains buffers (may be more than one!)
// Fill them up as much as you can. Remember to set the size value in each buffer to match how
// much data is in the buffer.
bool ranOutOfData = false;
for (int i = 0; i < ioData->mNumberBuffers; i++) {
ioData->mBuffers[i].mNumberChannels = 2;
if (ranOutOfData) {
ioData->mBuffers[i].mDataByteSize = 0;
continue;
}
if (ioData->mBuffers[i].mDataByteSize != 0) {
int thisBufferOffset = 0;
FillBufferAgain:
// Make sure there's data to write
if (ioData->mBuffers[i].mDataByteSize - thisBufferOffset == 0) {
continue;
}
struct AUDIO_BUFFER_QUEUE_ENTRY *audioEntry = NULL;
[audioLock lock];
if (audioBufferQueue != NULL) {
// Dequeue this entry temporarily
audioEntry = audioBufferQueue;
audioBufferQueue = audioBufferQueue->next;
audioBufferQueueLength--;
}
[audioLock unlock];
if (audioEntry == NULL) {
// No data left
ranOutOfData = true;
ioData->mBuffers[i].mDataByteSize = thisBufferOffset;
continue;
}
// Figure out how much data we can write
int min = MIN(ioData->mBuffers[i].mDataByteSize - thisBufferOffset, audioEntry->length);
// Copy data to the audio buffer
memcpy(&ioData->mBuffers[i].mData[thisBufferOffset], &audioEntry->data[audioEntry->offset], min);
thisBufferOffset += min;
if (min < audioEntry->length) {
// This entry still has unused data
audioEntry->length -= min;
audioEntry->offset += min;
// Requeue the entry
[audioLock lock];
audioEntry->next = audioBufferQueue;
audioBufferQueue = audioEntry;
audioBufferQueueLength++;
[audioLock unlock];
}
else {
// This entry is fully depleted so free it
free(audioEntry);
// Try to grab another sample to fill this buffer with
goto FillBufferAgain;
}
ioData->mBuffers[i].mDataByteSize = thisBufferOffset;
}
}
return noErr;
}
-(void) main
{
PLATFORM_CALLBACKS dummyPlCallbacks;
// Only used on Windows
dummyPlCallbacks.threadStart = NULL;
dummyPlCallbacks.debugPrint = NULL;
LiStartConnection(_host,
&_streamConfig,
&_clCallbacks,
&_drCallbacks,
&_arCallbacks,
&dummyPlCallbacks,
NULL, 0);
}
@end
-23
View File
@@ -1,23 +0,0 @@
//
// StreamConfiguration.h
// Limelight
//
// Created by Diego Waxemberg on 10/20/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface StreamConfiguration : NSObject
@property NSString* host;
@property NSString* appID;
@property int hostAddr;
@property int width;
@property int height;
@property int frameRate;
@property int bitRate;
@property int riKeyId;
@property NSData* riKey;
@end
-13
View File
@@ -1,13 +0,0 @@
//
// StreamConfiguration.m
// Limelight
//
// Created by Diego Waxemberg on 10/20/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import "StreamConfiguration.h"
@implementation StreamConfiguration
@synthesize host, appID, hostAddr, width, height, frameRate, bitRate, riKeyId, riKey;
@end
-18
View File
@@ -1,18 +0,0 @@
//
// StreamManager.h
// Limelight
//
// Created by Diego Waxemberg on 10/20/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "StreamConfiguration.h"
#import "Connection.h"
@interface StreamManager : NSOperation
- (id) initWithConfig:(StreamConfiguration*)config renderView:(UIView*)view connectionCallbacks:(id<ConnectionCallbacks>)callback;
- (void) stopStream;
@end
-122
View File
@@ -1,122 +0,0 @@
//
// StreamManager.m
// Limelight
//
// Created by Diego Waxemberg on 10/20/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import "StreamManager.h"
#import "CryptoManager.h"
#import "HttpManager.h"
#import "Utils.h"
@implementation StreamManager {
StreamConfiguration* _config;
UIView* _renderView;
id<ConnectionCallbacks> _callbacks;
Connection* _connection;
}
- (id) initWithConfig:(StreamConfiguration*)config renderView:(UIView*)view connectionCallbacks:(id<ConnectionCallbacks>)callbacks {
self = [super init];
_config = config;
_renderView = view;
_callbacks = callbacks;
_config.riKey = [Utils randomBytes:16];
_config.riKeyId = arc4random();
return self;
}
- (void)main {
[CryptoManager generateKeyPairUsingSSl];
NSString* uniqueId = [CryptoManager getUniqueID];
NSData* cert = [CryptoManager readCertFromFile];
HttpManager* hMan = [[HttpManager alloc] initWithHost:_config.host
uniqueId:uniqueId
deviceName:@"roth"
cert:cert];
NSData* serverInfoResp = [hMan executeRequestSynchronously:[hMan newServerInfoRequest]];
NSString* currentGame = [HttpManager getStringFromXML:serverInfoResp tag:@"currentgame"];
NSString* pairStatus = [HttpManager getStringFromXML:serverInfoResp tag:@"PairStatus"];
NSString* currentClient = [HttpManager getStringFromXML:serverInfoResp tag:@"CurrentClient"];
if (currentGame == NULL || pairStatus == NULL) {
[_callbacks launchFailed:@"Failed to connect to PC"];
return;
}
if (![pairStatus isEqualToString:@"1"]) {
// Not paired
[_callbacks launchFailed:@"Device not paired to PC"];
return;
}
// resumeApp and launchApp handle calling launchFailed
if (![currentGame isEqualToString:@"0"]) {
if (![currentClient isEqualToString:@"1"]) {
// The server is streaming to someone else
[_callbacks launchFailed:@"There is another stream in progress"];
return;
}
// App already running, resume it
if (![self resumeApp:hMan]) {
return;
}
} else {
// Start app
if (![self launchApp:hMan]) {
return;
}
}
VideoDecoderRenderer* renderer = [[VideoDecoderRenderer alloc]initWithView:_renderView];
_connection = [[Connection alloc] initWithConfig:_config renderer:renderer connectionCallbacks:_callbacks];
NSOperationQueue* opQueue = [[NSOperationQueue alloc] init];
[opQueue addOperation:_connection];
}
- (void) stopStream
{
[_connection terminate];
}
- (BOOL) launchApp:(HttpManager*)hMan {
NSData* launchResp = [hMan executeRequestSynchronously:
[hMan newLaunchRequest:_config.appID
width:_config.width
height:_config.height
refreshRate:_config.frameRate
rikey:[Utils bytesToHex:_config.riKey]
rikeyid:_config.riKeyId]];
NSString *gameSession = [HttpManager getStringFromXML:launchResp tag:@"gamesession"];
if (launchResp == NULL) {
[_callbacks launchFailed:@"Failed to launch app"];
return FALSE;
} else if (gameSession == NULL || [gameSession isEqualToString:@"0"]) {
[_callbacks launchFailed:[HttpManager getStatusStringFromXML:launchResp]];
return FALSE;
}
return TRUE;
}
- (BOOL) resumeApp:(HttpManager*)hMan {
NSData* resumeResp = [hMan executeRequestSynchronously:
[hMan newResumeRequestWithRiKey:[Utils bytesToHex:_config.riKey]
riKeyId:_config.riKeyId]];
NSString *resume = [HttpManager getStringFromXML:resumeResp tag:@"resume"];
if (resumeResp == NULL) {
[_callbacks launchFailed:@"Failed to resume app"];
return FALSE;
} else if (resume == NULL || [resume isEqualToString:@"0"]) {
[_callbacks launchFailed:[HttpManager getStatusStringFromXML:resumeResp]];
return FALSE;
}
return TRUE;
}
@end
-21
View File
@@ -1,21 +0,0 @@
//
// VideoDecoderRenderer.h
// Limelight
//
// Created by Cameron Gutman on 10/18/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
@import AVFoundation;
@interface VideoDecoderRenderer : NSObject
- (id)initWithView:(UIView*)view;
- (void)updateBufferForRange:(CMBlockBufferRef)existingBuffer data:(unsigned char *)data offset:(int)offset length:(int)nalLength;
- (void)submitDecodeBuffer:(unsigned char *)data length:(int)length;
@end
-236
View File
@@ -1,236 +0,0 @@
//
// VideoDecoderRenderer.m
// Limelight
//
// Created by Cameron Gutman on 10/18/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import "VideoDecoderRenderer.h"
@implementation VideoDecoderRenderer {
AVSampleBufferDisplayLayer* displayLayer;
Boolean waitingForSps, waitingForPps;
NSData *spsData, *ppsData;
CMVideoFormatDescriptionRef formatDesc;
}
- (id)initWithView:(UIView*)view
{
self = [super init];
displayLayer = [[AVSampleBufferDisplayLayer alloc] init];
displayLayer.bounds = view.bounds;
displayLayer.backgroundColor = [UIColor blackColor].CGColor;
displayLayer.position = CGPointMake(CGRectGetMidX(view.bounds), CGRectGetMidY(view.bounds));
displayLayer.videoGravity = AVLayerVideoGravityResizeAspect;
[view.layer addSublayer:displayLayer];
// We need some parameter sets before we can properly start decoding frames
waitingForSps = true;
waitingForPps = true;
return self;
}
#define FRAME_START_PREFIX_SIZE 4
#define NALU_START_PREFIX_SIZE 3
#define NAL_LENGTH_PREFIX_SIZE 4
- (void)updateBufferForRange:(CMBlockBufferRef)existingBuffer data:(unsigned char *)data offset:(int)offset length:(int)nalLength
{
OSStatus status;
size_t oldOffset = CMBlockBufferGetDataLength(existingBuffer);
// If we're at index 1 (first NALU in frame), enqueue this buffer to the memory block
// so it can handle freeing it when the block buffer is destroyed
if (offset == 1) {
int dataLength = nalLength - NALU_START_PREFIX_SIZE;
// Pass the real buffer pointer directly (no offset)
// This will give it to the block buffer to free when it's released.
// All further calls to CMBlockBufferAppendMemoryBlock will do so
// at an offset and will not be asking the buffer to be freed.
status = CMBlockBufferAppendMemoryBlock(existingBuffer, data,
nalLength + 1, // Add 1 for the offset we decremented
kCFAllocatorDefault,
NULL, 0, nalLength + 1, 0);
if (status != noErr) {
printf("CMBlockBufferReplaceDataBytes failed: %d\n", (int)status);
return;
}
// Write the length prefix to existing buffer
const uint8_t lengthBytes[] = {(uint8_t)(dataLength >> 24), (uint8_t)(dataLength >> 16),
(uint8_t)(dataLength >> 8), (uint8_t)dataLength};
status = CMBlockBufferReplaceDataBytes(lengthBytes, existingBuffer,
oldOffset, NAL_LENGTH_PREFIX_SIZE);
if (status != noErr) {
printf("CMBlockBufferReplaceDataBytes failed: %d\n", (int)status);
return;
}
}
else {
// Append a 4 byte buffer to this block for the length prefix
status = CMBlockBufferAppendMemoryBlock(existingBuffer, NULL,
NAL_LENGTH_PREFIX_SIZE,
kCFAllocatorDefault, NULL, 0,
NAL_LENGTH_PREFIX_SIZE, 0);
if (status != noErr) {
printf("CMBlockBufferAppendMemoryBlock failed: %d\n", (int)status);
return;
}
// Write the length prefix to the new buffer
int dataLength = nalLength - NALU_START_PREFIX_SIZE;
const uint8_t lengthBytes[] = {(uint8_t)(dataLength >> 24), (uint8_t)(dataLength >> 16),
(uint8_t)(dataLength >> 8), (uint8_t)dataLength};
status = CMBlockBufferReplaceDataBytes(lengthBytes, existingBuffer,
oldOffset, NAL_LENGTH_PREFIX_SIZE);
if (status != noErr) {
printf("CMBlockBufferReplaceDataBytes failed: %d\n", (int)status);
return;
}
// Attach the buffer by reference to the block buffer
status = CMBlockBufferAppendMemoryBlock(existingBuffer, &data[offset+NALU_START_PREFIX_SIZE],
dataLength,
kCFAllocatorNull, // Don't deallocate data on free
NULL, 0, dataLength, 0);
if (status != noErr) {
printf("CMBlockBufferReplaceDataBytes failed: %d\n", (int)status);
return;
}
}
}
// This function must free data
- (void)submitDecodeBuffer:(unsigned char *)data length:(int)length
{
unsigned char nalType = data[FRAME_START_PREFIX_SIZE] & 0x1F;
OSStatus status;
if (nalType == 0x7 || nalType == 0x8) {
if (nalType == 0x7) {
printf("Got SPS\n");
spsData = [NSData dataWithBytes:&data[FRAME_START_PREFIX_SIZE] length:length - FRAME_START_PREFIX_SIZE];
waitingForSps = false;
// We got a new SPS so wait for a new PPS to match it
waitingForPps = true;
}
else if (nalType == 0x8) {
printf("Got PPS\n");
ppsData = [NSData dataWithBytes:&data[FRAME_START_PREFIX_SIZE] length:length - FRAME_START_PREFIX_SIZE];
waitingForPps = false;
}
// See if we've got all the parameter sets we need
if (!waitingForSps && !waitingForPps) {
const uint8_t* const parameterSetPointers[] = { [spsData bytes], [ppsData bytes] };
const size_t parameterSetSizes[] = { [spsData length], [ppsData length] };
printf("Constructing new format description\n");
status = CMVideoFormatDescriptionCreateFromH264ParameterSets(kCFAllocatorDefault,
2, /* count of parameter sets */
parameterSetPointers,
parameterSetSizes,
NAL_LENGTH_PREFIX_SIZE,
&formatDesc);
if (status != noErr) {
printf("Failed to create format description: %d\n", (int)status);
formatDesc = NULL;
}
}
// Free the data buffer
free(data);
// No frame data to submit for these NALUs
return;
}
if (formatDesc == NULL) {
// Can't decode if we haven't gotten our parameter sets yet
free(data);
return;
}
if (nalType != 0x1 && nalType != 0x5) {
// Don't submit parameter set data
free(data);
return;
}
// Now we're decoding actual frame data here
CMBlockBufferRef blockBuffer;
status = CMBlockBufferCreateEmpty(NULL, 0, 0, &blockBuffer);
if (status != noErr) {
printf("CMBlockBufferCreateEmpty failed: %d\n", (int)status);
free(data);
return;
}
int lastOffset = -1;
for (int i = 0; i < length - FRAME_START_PREFIX_SIZE; i++) {
// Search for a NALU
if (data[i] == 0 && data[i+1] == 0 && data[i+2] == 1) {
// It's the start of a new NALU
if (lastOffset != -1) {
// We've seen a start before this so enqueue that NALU
[self updateBufferForRange:blockBuffer data:data offset:lastOffset length:i - lastOffset];
}
lastOffset = i;
}
}
if (lastOffset != -1) {
// Enqueue the remaining data
[self updateBufferForRange:blockBuffer data:data offset:lastOffset length:length - lastOffset];
}
// From now on, CMBlockBuffer owns the data pointer and will free it when it's dereferenced
CMSampleBufferRef sampleBuffer;
status = CMSampleBufferCreate(kCFAllocatorDefault,
blockBuffer,
true, NULL,
NULL, formatDesc, 1, 0,
NULL, 0, NULL,
&sampleBuffer);
if (status != noErr) {
printf("CMSampleBufferCreate failed: %d\n", (int)status);
CFRelease(blockBuffer);
return;
}
CFArrayRef attachments = CMSampleBufferGetSampleAttachmentsArray(sampleBuffer, YES);
CFMutableDictionaryRef dict = (CFMutableDictionaryRef)CFArrayGetValueAtIndex(attachments, 0);
CFDictionarySetValue(dict, kCMSampleAttachmentKey_DisplayImmediately, kCFBooleanTrue);
CFDictionarySetValue(dict, kCMSampleAttachmentKey_IsDependedOnByOthers, kCFBooleanTrue);
if (nalType == 1) {
// P-frame
CFDictionarySetValue(dict, kCMSampleAttachmentKey_NotSync, kCFBooleanTrue);
CFDictionarySetValue(dict, kCMSampleAttachmentKey_DependsOnOthers, kCFBooleanTrue);
}
else {
// I-frame
CFDictionarySetValue(dict, kCMSampleAttachmentKey_NotSync, kCFBooleanFalse);
CFDictionarySetValue(dict, kCMSampleAttachmentKey_DependsOnOthers, kCFBooleanFalse);
}
[displayLayer enqueueSampleBuffer:sampleBuffer];
// Dereference the buffers
CFRelease(blockBuffer);
CFRelease(sampleBuffer);
}
@end
-23
View File
@@ -1,23 +0,0 @@
//
// UIAppView.h
// Limelight
//
// Created by Diego Waxemberg on 10/22/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "App.h"
@protocol AppCallback <NSObject>
- (void) appClicked:(App*) app;
@end
@interface UIAppView : UIView
- (id) initWithApp:(App*)app andCallback:(id<AppCallback>)callback;
- (void) updateAppImage;
@end
-72
View File
@@ -1,72 +0,0 @@
//
// UIAppView.m
// Limelight
//
// Created by Diego Waxemberg on 10/22/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import "UIAppView.h"
@implementation UIAppView {
App* _app;
UIButton* _appButton;
UILabel* _appLabel;
id<AppCallback> _callback;
}
static int LABEL_DY = 20;
- (id) initWithApp:(App*)app andCallback:(id<AppCallback>)callback {
self = [super init];
_app = app;
_callback = callback;
_appButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_appButton setContentEdgeInsets:UIEdgeInsetsMake(0, 4, 0, 4)];
[_appButton setBackgroundImage:[UIImage imageNamed:@"NoAppImage"] forState:UIControlStateNormal];
[_appButton sizeToFit];
[_appButton addTarget:self action:@selector(appClicked) forControlEvents:UIControlEventTouchUpInside];
_appButton.layer.shadowColor = [[UIColor blackColor] CGColor];
_appButton.layer.shadowOffset = CGSizeMake(5,8);
_appButton.layer.shadowOpacity = 0.7;
_appLabel = [[UILabel alloc] init];
[_appLabel setText:_app.appName];
[_appLabel sizeToFit];
_appLabel.center = CGPointMake(_appButton.bounds.origin.x + (_appButton.bounds.size.width / 2), _appButton.bounds.origin.y + _appButton.bounds.size.height + LABEL_DY);
[self updateBounds];
[self addSubview:_appButton];
[self addSubview:_appLabel];
return self;
}
- (void) updateBounds {
float x = _appButton.frame.origin.x < _appLabel.frame.origin.x ? _appButton.frame.origin.x : _appLabel.frame.origin.x;
float y = _appButton.frame.origin.y < _appLabel.frame.origin.y ? _appButton.frame.origin.y : _appLabel.frame.origin.y;
self.bounds = CGRectMake(x , y, _appButton.frame.size.width > _appLabel.frame.size.width ? _appButton.frame.size.width : _appLabel.frame.size.width, _appButton.frame.size.height + _appLabel.frame.size.height + LABEL_DY / 2);
self.frame = CGRectMake(x , y, _appButton.frame.size.width > _appLabel.frame.size.width ? _appButton.frame.size.width : _appLabel.frame.size.width, _appButton.frame.size.height + _appLabel.frame.size.height + LABEL_DY / 2);
}
- (void) appClicked {
[_callback appClicked:_app];
}
- (void) updateAppImage {
if (_app.appImage != nil) {
[_appButton setBackgroundImage:_app.appImage forState:UIControlStateNormal];
[self setNeedsDisplay];
}
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
-24
View File
@@ -1,24 +0,0 @@
//
// UIComputerView.h
// Limelight
//
// Created by Diego Waxemberg on 10/22/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "Computer.h"
@protocol HostCallback <NSObject>
- (void) hostClicked:(Computer*)computer;
- (void) addHostClicked;
@end
@interface UIComputerView : UIView
- (id) initWithComputer:(Computer*)computer andCallback:(id<HostCallback>)callback;
- (id) initForAddWithCallback:(id<HostCallback>)callback;
@end
-99
View File
@@ -1,99 +0,0 @@
//
// UIComputerView.m
// Limelight
//
// Created by Diego Waxemberg on 10/22/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import "UIComputerView.h"
@implementation UIComputerView {
Computer* _computer;
UIButton* _hostButton;
UILabel* _hostLabel;
id<HostCallback> _callback;
CGSize _labelSize;
}
static int LABEL_DY = 20;
- (id) init {
self = [super init];
_hostButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_hostButton setContentEdgeInsets:UIEdgeInsetsMake(0, 4, 0, 4)];
[_hostButton setBackgroundImage:[UIImage imageNamed:@"Computer"] forState:UIControlStateNormal];
[_hostButton sizeToFit];
_hostButton.layer.shadowColor = [[UIColor blackColor] CGColor];
_hostButton.layer.shadowOffset = CGSizeMake(5,8);
_hostButton.layer.shadowOpacity = 0.7;
_hostLabel = [[UILabel alloc] init];
return self;
}
- (id) initWithComputer:(Computer*)computer andCallback:(id<HostCallback>)callback {
self = [self init];
_computer = computer;
_callback = callback;
[_hostLabel setText:[_computer displayName]];
[_hostLabel sizeToFit];
[_hostButton addTarget:self action:@selector(hostClicked) forControlEvents:UIControlEventTouchUpInside];
_hostLabel.center = CGPointMake(_hostButton.frame.origin.x + (_hostButton.frame.size.width / 2), _hostButton.frame.origin.y + _hostButton.frame.size.height + LABEL_DY);
[self updateBounds];
[self addSubview:_hostButton];
[self addSubview:_hostLabel];
return self;
}
- (void) updateBounds {
float x = _hostButton.frame.origin.x < _hostLabel.frame.origin.x ? _hostButton.frame.origin.x : _hostLabel.frame.origin.x;
float y = _hostButton.frame.origin.y < _hostLabel.frame.origin.y ? _hostButton.frame.origin.y : _hostLabel.frame.origin.y;
self.bounds = CGRectMake(x , y, _hostButton.frame.size.width > _hostLabel.frame.size.width ? _hostButton.frame.size.width : _hostLabel.frame.size.width, _hostButton.frame.size.height + _hostLabel.frame.size.height + LABEL_DY / 2);
self.frame = CGRectMake(x , y, _hostButton.frame.size.width > _hostLabel.frame.size.width ? _hostButton.frame.size.width : _hostLabel.frame.size.width, _hostButton.frame.size.height + _hostLabel.frame.size.height + LABEL_DY / 2);
}
- (id) initForAddWithCallback:(id<HostCallback>)callback {
self = [self init];
_callback = callback;
[_hostButton setBackgroundImage:[UIImage imageNamed:@"Computer"] forState:UIControlStateNormal];
[_hostButton sizeToFit];
[_hostButton addTarget:self action:@selector(addClicked) forControlEvents:UIControlEventTouchUpInside];
[_hostLabel setText:@"Add Host"];
[_hostLabel sizeToFit];
_hostLabel.center = CGPointMake(_hostButton.frame.origin.x + (_hostButton.frame.size.width / 2), _hostButton.frame.origin.y + _hostButton.frame.size.height + LABEL_DY);
UIImageView* addIcon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"AddComputerIcon"]];
[addIcon sizeToFit];
addIcon.center = CGPointMake(_hostButton.frame.origin.x + _hostButton.frame.size.width, _hostButton.frame.origin.y);
[self updateBounds];
[self addSubview:_hostButton];
[self addSubview:_hostLabel];
[self addSubview:addIcon];
return self;
}
- (void) hostClicked {
[_callback hostClicked:_computer];
}
- (void) addClicked {
[_callback addHostClicked];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
-19
View File
@@ -1,19 +0,0 @@
//
// Computer.h
// Limelight
//
// Created by Diego Waxemberg on 10/14/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface Computer : NSObject
@property NSString* displayName;
@property NSString* hostName;
@property BOOL paired;
- (id) initWithHost:(NSNetService*)host;
- (id) initWithIp:(NSString*)host;
@end
-31
View File
@@ -1,31 +0,0 @@
//
// Computer.m
// Limelight
//
// Created by Diego Waxemberg on 10/14/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import "Computer.h"
@implementation Computer
- (id) initWithHost:(NSNetService *)host {
self = [super init];
self.hostName = [host hostName];
self.displayName = [host name];
return self;
}
- (id) initWithIp:(NSString*)host {
self = [super init];
self.hostName = host;
self.displayName = host;
return self;
}
@end
-18
View File
@@ -1,18 +0,0 @@
//
// Utils.h
// Limelight
//
// Created by Diego Waxemberg on 10/20/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface Utils : NSObject
+ (NSData*) randomBytes:(NSInteger)length;
+ (NSString*) bytesToHex:(NSData*)data;
+ (NSData*) hexToBytes:(NSString*) hex;
+ (int) resolveHost:(NSString*)host;
@end
-76
View File
@@ -1,76 +0,0 @@
//
// Utils.m
// Limelight
//
// Created by Diego Waxemberg on 10/20/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import "Utils.h"
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netdb.h>
@implementation Utils
+ (NSData*) randomBytes:(NSInteger)length {
char* bytes = malloc(length);
arc4random_buf(bytes, length);
NSData* randomData = [NSData dataWithBytes:bytes length:length];
free(bytes);
return randomData;
}
+ (NSData*) hexToBytes:(NSString*) hex {
unsigned long len = [hex length];
NSMutableData* data = [NSMutableData dataWithCapacity:len / 2];
char byteChars[3] = {'\0','\0','\0'};
unsigned long wholeByte;
const char *chars = [hex UTF8String];
int i = 0;
while (i < len) {
byteChars[0] = chars[i++];
byteChars[1] = chars[i++];
wholeByte = strtoul(byteChars, NULL, 16);
[data appendBytes:&wholeByte length:1];
}
return data;
}
+ (NSString*) bytesToHex:(NSData*)data {
const unsigned char* bytes = [data bytes];
NSMutableString *hex = [[NSMutableString alloc] init];
for (int i = 0; i < [data length]; i++) {
[hex appendFormat:@"%02X" , bytes[i]];
}
return hex;
}
+ (int) resolveHost:(NSString*)host {
struct hostent *hostent;
if (inet_addr([host UTF8String]) != INADDR_NONE) {
// Already an IP address
int addr = inet_addr([host UTF8String]);
NSLog(@"host address: %d", addr);
return addr;
} else {
hostent = gethostbyname([host UTF8String]);
if (hostent != NULL) {
char* ipstr = inet_ntoa(*(struct in_addr*)hostent->h_addr_list[0]);
NSLog(@"Resolved %@ -> %s", host, ipstr);
int addr = inet_addr(ipstr);
NSLog(@"host address: %d", addr);
return addr;
} else {
NSLog(@"Failed to resolve host: %d", h_errno);
return 0;
}
}
}
@end
@@ -1,23 +0,0 @@
//
// MainFrameViewController.h
// Limelight-iOS
//
// Created by Diego Waxemberg on 1/17/14.
// Copyright (c) 2014 Diego Waxemberg. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "MDNSManager.h"
#import "PairManager.h"
#import "StreamConfiguration.h"
#import "UIComputerView.h"
#import "UIAppView.h"
#import "AppManager.h"
#import "SWRevealViewController.h"
@interface MainFrameViewController : UIViewController <MDNSCallback, PairCallback, HostCallback, AppCallback, AppAssetCallback, NSURLConnectionDelegate, SWRevealViewControllerDelegate>
@property (strong, nonatomic) IBOutlet UIBarButtonItem *settingsSidebarButton;
+ (StreamConfiguration*) getStreamConfiguration;
@end
@@ -1,314 +0,0 @@
// MainFrameViewController.m
// Limelight-iOS
//
// Created by Diego Waxemberg on 1/17/14.
// Copyright (c) 2014 Diego Waxemberg. All rights reserved.
//
#import "MainFrameViewController.h"
#import "Computer.h"
#import "CryptoManager.h"
#import "HttpManager.h"
#import "Connection.h"
#import "VideoDecoderRenderer.h"
#import "StreamManager.h"
#import "Utils.h"
#import "UIComputerView.h"
#import "UIAppView.h"
#import "App.h"
#import "SettingsViewController.h"
#import "DataManager.h"
#import "Settings.h"
@implementation MainFrameViewController {
NSOperationQueue* _opQueue;
MDNSManager* _mDNSManager;
Computer* _selectedHost;
NSString* _uniqueId;
NSData* _cert;
UIAlertView* _pairAlert;
UIScrollView* hostScrollView;
UIScrollView* appScrollView;
}
static NSString* deviceName = @"roth";
static NSMutableSet* hostList;
static StreamConfiguration* streamConfig;
+ (StreamConfiguration*) getStreamConfiguration {
return streamConfig;
}
- (void)showPIN:(NSString *)PIN {
dispatch_sync(dispatch_get_main_queue(), ^{
_pairAlert = [[UIAlertView alloc] initWithTitle:@"Pairing" message:[NSString stringWithFormat:@"Enter the following PIN on the host machine: %@", PIN]delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
[_pairAlert show];
});
}
- (void)pairFailed:(NSString *)message {
dispatch_sync(dispatch_get_main_queue(), ^{
[_pairAlert dismissWithClickedButtonIndex:0 animated:NO];
_pairAlert = [[UIAlertView alloc] initWithTitle:@"Pairing Failed" message:message delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
[_pairAlert show];
});
}
- (void)pairSuccessful {
dispatch_sync(dispatch_get_main_queue(), ^{
[_pairAlert dismissWithClickedButtonIndex:0 animated:NO];
_pairAlert = [[UIAlertView alloc] initWithTitle:@"Pairing Succesful" message:@"Successfully paired to host" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
[_pairAlert show];
});
}
- (void)alreadyPaired {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
HttpManager* hMan = [[HttpManager alloc] initWithHost:_selectedHost.hostName uniqueId:_uniqueId deviceName:deviceName cert:_cert];
NSData* appListResp = [hMan executeRequestSynchronously:[hMan newAppListRequest]];
NSArray* appList = [HttpManager getAppListFromXML:appListResp];
dispatch_async(dispatch_get_main_queue(), ^{
[self updateApps:appList];
});
[AppManager retrieveAppAssets:appList withManager:hMan andCallback:self];
});
}
- (void) receivedAssetForApp:(App*)app {
NSArray* subviews = [appScrollView subviews];
for (UIAppView* appView in subviews) {
[appView updateAppImage];
}
}
- (void)displayDnsFailedDialog {
UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Network Error"
message:@"Failed to resolve host."
preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDestructive handler:nil]];
[self presentViewController:alert animated:YES completion:nil];
}
- (void) hostClicked:(Computer *)computer {
NSLog(@"Clicked host: %@", computer.displayName);
_selectedHost = computer;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
HttpManager* hMan = [[HttpManager alloc] initWithHost:computer.hostName uniqueId:_uniqueId deviceName:deviceName cert:_cert];
NSData* serverInfoResp = [hMan executeRequestSynchronously:[hMan newServerInfoRequest]];
if ([[HttpManager getStringFromXML:serverInfoResp tag:@"PairStatus"] isEqualToString:@"1"]) {
NSLog(@"Already Paired");
[self alreadyPaired];
} else {
NSLog(@"Trying to pair");
PairManager* pMan = [[PairManager alloc] initWithManager:hMan andCert:_cert callback:self];
[_opQueue addOperation:pMan];
}
});
}
- (void) addHostClicked {
NSLog(@"Clicked add host");
UIAlertController* alertController = [UIAlertController alertControllerWithTitle:@"Host Address" message:@"Please enter a hostname or IP address" preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]];
[alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){
NSString* host = ((UITextField*)[[alertController textFields] objectAtIndex:0]).text;
Computer* newHost = [[Computer alloc] initWithIp:host];
[hostList addObject:newHost];
[self updateHosts:[hostList allObjects]];
DataManager* dataMan = [[DataManager alloc] init];
[dataMan createHost:newHost.displayName hostname:newHost.hostName];
[dataMan saveHosts];
//TODO: get pair state
}]];
[alertController addTextFieldWithConfigurationHandler:nil];
[self presentViewController:alertController animated:YES completion:nil];
}
- (void) appClicked:(App *)app {
NSLog(@"Clicked app: %@", app.appName);
streamConfig = [[StreamConfiguration alloc] init];
streamConfig.host = _selectedHost.hostName;
streamConfig.hostAddr = [Utils resolveHost:_selectedHost.hostName];
streamConfig.appID = app.appId;
if (streamConfig.hostAddr == 0) {
[self displayDnsFailedDialog];
return;
}
DataManager* dataMan = [[DataManager alloc] init];
Settings* streamSettings = [dataMan retrieveSettings];
streamConfig.frameRate = [streamSettings.framerate intValue];
streamConfig.bitRate = [streamSettings.bitrate intValue];
streamConfig.height = [streamSettings.height intValue];
streamConfig.width = [streamSettings.width intValue];
[self performSegueWithIdentifier:@"createStreamFrame" sender:nil];
}
- (void)revealController:(SWRevealViewController *)revealController didMoveToPosition:(FrontViewPosition)position {
// If we moved back to the center position, we should save the settings
if (position == FrontViewPositionLeft) {
[(SettingsViewController*)[revealController rearViewController] saveSettings];
}
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Change button color
_settingsSidebarButton.tintColor = [UIColor colorWithRed:.2 green:.9 blue:0.f alpha:1.f];
// Set the side bar button action. When it's tapped, it'll show up the sidebar.
_settingsSidebarButton.target = self.revealViewController;
_settingsSidebarButton.action = @selector(revealToggle:);
// Set the gesture
[self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer];
[self.revealViewController setDelegate:self];
//NSArray* streamConfigVals = [[NSArray alloc] initWithObjects:@"1280x720 (30Hz)", @"1280x720 (60Hz)", @"1920x1080 (30Hz)", @"1920x1080 (60Hz)",nil];
_opQueue = [[NSOperationQueue alloc] init];
[CryptoManager generateKeyPairUsingSSl];
_uniqueId = [CryptoManager getUniqueID];
_cert = [CryptoManager readCertFromFile];
// Only initialize the host picker list once
if (hostList == nil) {
hostList = [[NSMutableSet alloc] init];
}
[self setAutomaticallyAdjustsScrollViewInsets:NO];
hostScrollView = [[UIScrollView alloc] init];
hostScrollView.frame = CGRectMake(0, self.navigationController.navigationBar.frame.origin.y + self.navigationController.navigationBar.frame.size.height, self.view.frame.size.width, self.view.frame.size.height / 2);
[hostScrollView setShowsHorizontalScrollIndicator:NO];
appScrollView = [[UIScrollView alloc] init];
appScrollView.frame = CGRectMake(0, hostScrollView.frame.size.height, self.view.frame.size.width, self.view.frame.size.height / 2);
[appScrollView setShowsHorizontalScrollIndicator:NO];
[self retrieveSavedHosts];
[self updateHosts:[hostList allObjects]];
[self.view addSubview:hostScrollView];
[self.view addSubview:appScrollView];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
_mDNSManager = [[MDNSManager alloc] initWithCallback:self];
[_mDNSManager searchForHosts];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
[_mDNSManager stopSearching];
}
- (void) retrieveSavedHosts {
//TODO: Get rid of Computer and only use Host
DataManager* dataMan = [[DataManager alloc] init];
NSArray* hosts = [dataMan retrieveHosts];
for (Host* host in hosts) {
Computer* comp = [[Computer alloc] initWithIp:host.address];
comp.displayName = host.name;
[hostList addObject:comp];
}
}
- (void)updateHosts:(NSArray *)hosts {
[hostList addObjectsFromArray:hosts];
[[hostScrollView subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];
UIComputerView* addComp = [[UIComputerView alloc] initForAddWithCallback:self];
UIComputerView* compView;
float prevEdge = -1;
for (Computer* comp in hostList) {
compView = [[UIComputerView alloc] initWithComputer:comp andCallback:self];
compView.center = CGPointMake([self getCompViewX:compView addComp:addComp prevEdge:prevEdge], hostScrollView.frame.size.height / 2);
prevEdge = compView.frame.origin.x + compView.frame.size.width;
[hostScrollView addSubview:compView];
}
prevEdge = [self getCompViewX:addComp addComp:addComp prevEdge:prevEdge];
addComp.center = CGPointMake(prevEdge, hostScrollView.frame.size.height / 2);
[hostScrollView addSubview:addComp];
[hostScrollView setContentSize:CGSizeMake(prevEdge + addComp.frame.size.width, hostScrollView.frame.size.height)];
}
- (float) getCompViewX:(UIComputerView*)comp addComp:(UIComputerView*)addComp prevEdge:(float)prevEdge {
if (prevEdge == -1) {
return hostScrollView.frame.origin.x + comp.frame.size.width / 2 + addComp.frame.size.width / 2;
} else {
return prevEdge + addComp.frame.size.width / 2 + comp.frame.size.width / 2;
}
}
- (void) updateApps:(NSArray*)apps {
[[appScrollView subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];
App* fakeApp = [[App alloc] init];
fakeApp.appName = @"No App Name";
UIAppView* noAppImage = [[UIAppView alloc] initWithApp:fakeApp andCallback:nil];
float prevEdge = -1;
UIAppView* appView;
for (App* app in apps) {
appView = [[UIAppView alloc] initWithApp:app andCallback:self];
prevEdge = [self getAppViewX:appView noApp:noAppImage prevEdge:prevEdge];
appView.center = CGPointMake(prevEdge, appScrollView.frame.size.height / 2);
prevEdge = appView.frame.origin.x + appView.frame.size.width;
[appScrollView addSubview:appView];
}
[appScrollView setContentSize:CGSizeMake(prevEdge + noAppImage.frame.size.width, appScrollView.frame.size.height)];
}
- (float) getAppViewX:(UIAppView*)app noApp:(UIAppView*)noAppImage prevEdge:(float)prevEdge {
if (prevEdge == -1) {
return appScrollView.frame.origin.x + app.frame.size.width / 2 + noAppImage.frame.size.width / 2;
} else {
return prevEdge + app.frame.size.width / 2 + noAppImage.frame.size.width / 2;
}
}
- (BOOL)validatePcSelected {
if (_selectedHost == NULL) {
UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"No PC Selected"
message:@"You must select a PC to continue."
preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDestructive handler:nil]];
[self presentViewController:alert animated:YES completion:nil];
return FALSE;
}
return TRUE;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[self.view endEditing:YES];
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
[textField resignFirstResponder];
return YES;
}
- (BOOL)shouldAutorotate {
return YES;
}
@end
@@ -1,418 +0,0 @@
/*
Copyright (c) 2013 Joan Lluch <joan.lluch@sweetwilliamsl.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Early code inspired on a similar class by Philip Kluz (Philip.Kluz@zuui.org)
*/
/*
RELEASE NOTES
Version 2.3.0 (Current Version)
- StoryBoard initializing bug fix
- Minor Code refactoring
Version 2.2.0
- State Restoration support.
- Reverted panGestureRecognizer implementation to before v2.1.0 (works better).
- New properties 'toggleAnimationType', 'springDampingRatio'. Default reveal animation is 'Spring'
- New property 'frontViewShadowColor'
- New properties 'clipsViewsToBounds' and '_extendedPointInsideHit'
- New delegate methods for finer control of front view location in the overdraw area, as long as deprecation note on former delegate methods
- Other minor changes that should not affect current implementations
Version 2.1.0
- Removed SWDirectionPanGestureRecognizer. Horizontal panning is filtered on the shouldBegin delegate. This is cleaner, I hope it does not break previous funcionality
- Took a cleaner approach to storyboard support. SWRevealViewControllerSegue is now deprecated and you should use SWRevealViewControllerSegueSetController and SWRevealViewControllerSeguePushController instead.
- A minor change on the autoresizingMask of the internal views to fix a glitch on iOS8. This should not affect iOS7
Version 2.0.2
- Added new delegates for better control of gesture recognizers
Version 2.0.1
- Fix: draggableBorderWidth now correctly handles the cases where one of the rear controllers is not provided
- Fix: the shadow related properties are now granted at any time after view load, not just after initialization.
Version 2.0.0
- Dropped support for iOS6 and earlier. This version will only work on iOS7
- The method setFrontViewController:animated: does not longer perform a full reveal animation. Instead it just replaces the frontViewController in
its current position. Use the new pushFrontViewController:animated: method to perform a replacement of the front controlles with reveal animation
as in the previous version
IMPORTANT: You must replace all calls to setFrontViewController:animated by calls to pushFrontViewController:animated to prevent breaking
functionality on existing projects.
- Added support for animated replacement of child controllers: setRearViewController, setFrontViewController, setRightViewController now have animated versions.
- The new 'replaceViewAnimationDuration' property sets the default duration of child viewController replacement.
- Added the following new delegate methods
revealController:willAddViewController:forOperation:animated:
revealController:didAddViewController:forOperation:animated:
- The class also supports custom UIViewControllerAnimatedTransitioning related with the replacement of child viewControllers.
You can implement the following new delegate method: revealController:animationControllerForOperation:fromViewController:toViewController:
and provide an object conforming to UIViewControllerAnimatedTransitioning to implement custom animations.
Version 1.1.3
- Reverted the supportedInterfaceOrientations to the default behavior. This is consistent with Apple provided controllers
- The presentFrontViewHierarchically now dynamically takes into account the smaller header height of bars on iPhone landscape orientation
Version 1.1.2
- The status bar style and appearance are now handled in sync with the class animations.
You can implement the methods preferredStatusBarStyle and prefersStatusBarHidden on your child controllers to define the desired appearance
- The loadView method now calls a method, loadStoryboardControllers, just for the purpose of loading child controllers from a storyboard.
You can override this method and remove the @try @catch statements if you want the debugger not to stop at them in case you have set an exception breakpoint.
Version 1.1.1
- You can now get a tapGestureRecognizer from the class. See the tapGestureRecognizer method for more information.
- Both the panGestureRecognizer and the tapGestureRecognizer are now attached to the revealViewController's front content view
by default, so they will start working just by calling their access methods even if you do not attach them to any of your views.
This enables you to dissable interactions on your views -for example based on position- without breaking normal gesture behavior.
- Corrected a bug that caused a crash on iOS6 and earlier.
Version 1.1.0
- The method setFrontViewController:animated now performs the correct animations both for left and right controllers.
- The class now automatically handles the status bar appearance depending on the currently shown child controller.
Version 1.0.8
- Support for constant width frontView by setting a negative value to reveal widths. See properties rearViewRevealWidth and rightViewRevealWidth
- Support for draggableBorderWidth. See property of the same name.
- The Pan gesture recongnizer can be disabled by implementing the following delegate method and returning NO
revealControllerPanGestureShouldBegin:
- Added the ability to track pan gesture reveal progress through the following new delegate methods
revealController:panGestureBeganFromLocation:progress:
revealController:panGestureMovedToLocation:progress:
revealController:panGestureEndedToLocation:progress:
Previous Versions
- No release notes were updated for previous versions.
*/
#import <UIKit/UIKit.h>
@class SWRevealViewController;
@protocol SWRevealViewControllerDelegate;
#pragma mark - SWRevealViewController Class
// Enum values for setFrontViewPosition:animated:
typedef NS_ENUM( NSInteger, FrontViewPosition)
{
// Front controller is removed from view. Animated transitioning from this state will cause the same
// effect than animating from FrontViewPositionLeftSideMost. Use this instead of FrontViewPositionLeftSideMost when
// you want to remove the front view controller view from the view hierarchy.
FrontViewPositionLeftSideMostRemoved,
// Left most position, front view is presented left-offseted by rightViewRevealWidth+rigthViewRevealOverdraw
FrontViewPositionLeftSideMost,
// Left position, front view is presented left-offseted by rightViewRevealWidth
FrontViewPositionLeftSide,
// Center position, rear view is hidden behind front controller
FrontViewPositionLeft,
// Right possition, front view is presented right-offseted by rearViewRevealWidth
FrontViewPositionRight,
// Right most possition, front view is presented right-offseted by rearViewRevealWidth+rearViewRevealOverdraw
FrontViewPositionRightMost,
// Front controller is removed from view. Animated transitioning from this state will cause the same
// effect than animating from FrontViewPositionRightMost. Use this instead of FrontViewPositionRightMost when
// you intent to remove the front controller view from the view hierarchy.
FrontViewPositionRightMostRemoved,
};
// Enum values for toggleAnimationType
typedef NS_ENUM(NSInteger, SWRevealToggleAnimationType)
{
SWRevealToggleAnimationTypeSpring, // <- produces a spring based animation
SWRevealToggleAnimationTypeEaseOut, // <- produces an ease out curve animation
};
@interface SWRevealViewController : UIViewController
/* Basic API */
// Object instance init and rear view setting
- (id)initWithRearViewController:(UIViewController *)rearViewController frontViewController:(UIViewController *)frontViewController;
// Rear view controller, can be nil if not used
@property (nonatomic) UIViewController *rearViewController;
- (void)setRearViewController:(UIViewController *)rearViewController animated:(BOOL)animated;
// Optional right view controller, can be nil if not used
@property (nonatomic) UIViewController *rightViewController;
- (void)setRightViewController:(UIViewController *)rightViewController animated:(BOOL)animated;
// Front view controller, can be nil on initialization but must be supplied by the time the view is loaded
@property (nonatomic) UIViewController *frontViewController;
- (void)setFrontViewController:(UIViewController *)frontViewController animated:(BOOL)animated;
// Sets the frontViewController using a default set of chained animations consisting on moving the
// presented frontViewController to the right most possition, replacing it, and moving it back to the left position
- (void)pushFrontViewController:(UIViewController *)frontViewController animated:(BOOL)animated;
// Sets the frontViewController position. You can call the animated version several times with different
// positions to obtain a set of animations that will be performed in order one after the other.
@property (nonatomic) FrontViewPosition frontViewPosition;
- (void)setFrontViewPosition:(FrontViewPosition)frontViewPosition animated:(BOOL)animated;
// The following methods are meant to be directly connected to the action method of a button
// to perform user triggered postion change of the controller views. This is ussually added to a
// button on top left or right of the frontViewController
- (IBAction)revealToggle:(id)sender;
- (IBAction)rightRevealToggle:(id)sender; // <-- simetric implementation of the above for the rightViewController
// Toogles the current state of the front controller between Left or Right and fully visible
// Use setFrontViewPosition to set a particular position
- (void)revealToggleAnimated:(BOOL)animated;
- (void)rightRevealToggleAnimated:(BOOL)animated; // <-- simetric implementation of the above for the rightViewController
// The following method will provide a panGestureRecognizer suitable to be added to any view
// in order to perform usual drag and swipe gestures to reveal the rear views. This is usually added to the top bar
// of a front controller, but it can be added to your frontViewController view or to the reveal controller view to provide full screen panning.
// By default, the panGestureRecognizer is added to the view containing the front controller view. To keep this default behavior
// you still need to call this method, just don't add it to any of your views. The default setup allows you to dissable
// user interactions on your controller views without affecting the recognizer.
- (UIPanGestureRecognizer*)panGestureRecognizer;
// The following method will provide a tapGestureRecognizer suitable to be added to any view on the frontController
// for concealing the rear views. By default no tap recognizer is created or added to any view, however if you call this method after
// the controller's view has been loaded the recognizer is added to the reveal controller's front container view.
// Thus, you can disable user interactions on your frontViewController view without affecting the tap recognizer.
- (UITapGestureRecognizer*)tapGestureRecognizer;
/* The following properties are provided for further customization, they are set to default values on initialization,
you do not generally have to set them */
// Defines how much of the rear or right view is shown, default is 260.
// Negative values indicate that the reveal width should be computed by substracting the full front view width,
// so the revealed frontView width is kept constant when bounds change as opposed to the rear or right width.
@property (nonatomic) CGFloat rearViewRevealWidth;
@property (nonatomic) CGFloat rightViewRevealWidth; // <-- simetric implementation of the above for the rightViewController
// Defines how much of an overdraw can occur when dragging further than 'rearViewRevealWidth', default is 60.
@property (nonatomic) CGFloat rearViewRevealOverdraw;
@property (nonatomic) CGFloat rightViewRevealOverdraw; // <-- simetric implementation of the above for the rightViewController
// Defines how much displacement is applied to the rear view when animating or dragging the front view, default is 40.
@property (nonatomic) CGFloat rearViewRevealDisplacement;
@property (nonatomic) CGFloat rightViewRevealDisplacement; // <-- simetric implementation of the above for the rightViewController
// Defines a width on the border of the view attached to the panGesturRecognizer where the gesture is allowed,
// default is 0 which means no restriction.
@property (nonatomic) CGFloat draggableBorderWidth;
// If YES (the default) the controller will bounce to the Left position when dragging further than 'rearViewRevealWidth'
@property (nonatomic) BOOL bounceBackOnOverdraw;
@property (nonatomic) BOOL bounceBackOnLeftOverdraw; // <-- simetric implementation of the above for the rightViewController
// If YES (default is NO) the controller will allow permanent dragging up to the rightMostPosition
@property (nonatomic) BOOL stableDragOnOverdraw;
@property (nonatomic) BOOL stableDragOnLeftOverdraw; // <-- simetric implementation of the above for the rightViewController
// If YES (default is NO) the front view controller will be ofsseted vertically by the height of a navigation bar.
// Use this on iOS7 when you add an instance of RevealViewController as a child of a UINavigationController (or another SWRevealViewController)
// and you want the front view controller to be presented below the navigation bar of its UINavigationController grand parent.
// The rearViewController will still appear full size and blurred behind the navigation bar of its UINavigationController grand parent
@property (nonatomic) BOOL presentFrontViewHierarchically;
// Velocity required for the controller to toggle its state based on a swipe movement, default is 250
@property (nonatomic) CGFloat quickFlickVelocity;
// Duration for the revealToggle animation, default is 0.25
@property (nonatomic) NSTimeInterval toggleAnimationDuration;
// Animation type, default is SWRevealToggleAnimationTypeSpring
@property (nonatomic) SWRevealToggleAnimationType toggleAnimationType;
// When animation type is SWRevealToggleAnimationTypeSpring determines the damping ratio, default is 1
@property (nonatomic) CGFloat springDampingRatio;
// Duration for animated replacement of view controllers
@property (nonatomic) NSTimeInterval replaceViewAnimationDuration;
// Defines the radius of the front view's shadow, default is 2.5f
@property (nonatomic) CGFloat frontViewShadowRadius;
// Defines the radius of the front view's shadow offset default is {0.0f,2.5f}
@property (nonatomic) CGSize frontViewShadowOffset;
// Defines the front view's shadow opacity, default is 1.0f
@property (nonatomic) CGFloat frontViewShadowOpacity;
// Defines the front view's shadow color, default is blackColor
@property (nonatomic) UIColor *frontViewShadowColor;
// Defines whether the controller should clip subviews to its view bounds. Default is NO.
// Set this to YES when you are presenting this controller as a non full-screen child of a
// custom container controller which does not explicitly clips its subviews.
@property (nonatomic) BOOL clipsViewsToBounds;
// Defines whether your views clicable area extends beyond the bounds of this controller. Default is NO.
// Set this to YES if you are presenting this controller as a non full-screen child of a custom container and you are not
// clipping your front view to this controller bounds.
@property (nonatomic) BOOL extendsPointInsideHit;
/* The class properly handles all the relevant calls to appearance methods on the contained controllers.
Moreover you can assign a delegate to let the class inform you on positions and animation activity */
// Delegate
@property (nonatomic,weak) id<SWRevealViewControllerDelegate> delegate;
@end
#pragma mark - SWRevealViewControllerDelegate Protocol
typedef enum
{
SWRevealControllerOperationNone,
SWRevealControllerOperationReplaceRearController,
SWRevealControllerOperationReplaceFrontController,
SWRevealControllerOperationReplaceRightController,
} SWRevealControllerOperation;
@protocol SWRevealViewControllerDelegate<NSObject>
@optional
// The following delegate methods will be called before and after the front view moves to a position
- (void)revealController:(SWRevealViewController *)revealController willMoveToPosition:(FrontViewPosition)position;
- (void)revealController:(SWRevealViewController *)revealController didMoveToPosition:(FrontViewPosition)position;
// This will be called inside the reveal animation, thus you can use it to place your own code that will be animated in sync
- (void)revealController:(SWRevealViewController *)revealController animateToPosition:(FrontViewPosition)position;
// Implement this to return NO when you want the pan gesture recognizer to be ignored
- (BOOL)revealControllerPanGestureShouldBegin:(SWRevealViewController *)revealController;
// Implement this to return NO when you want the tap gesture recognizer to be ignored
- (BOOL)revealControllerTapGestureShouldBegin:(SWRevealViewController *)revealController;
// Implement this to return YES if you want other gesture recognizer to share touch events with the pan gesture
- (BOOL)revealController:(SWRevealViewController *)revealController
panGestureRecognizerShouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer;
// Implement this to return YES if you want other gesture recognizer to share touch events with the tap gesture
- (BOOL)revealController:(SWRevealViewController *)revealController
tapGestureRecognizerShouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer;
// Called when the gestureRecognizer began and ended
- (void)revealControllerPanGestureBegan:(SWRevealViewController *)revealController;
- (void)revealControllerPanGestureEnded:(SWRevealViewController *)revealController;
// The following methods provide a means to track the evolution of the gesture recognizer.
// The 'location' parameter is the X origin coordinate of the front view as the user drags it
// The 'progress' parameter is a number ranging from 0 to 1 indicating the front view location relative to the
// rearRevealWidth or rightRevealWidth. 1 is fully revealed, dragging ocurring in the overDraw region will result in values above 1.
// The 'overProgress' parameter is a number ranging from 0 to 1 indicating the front view location relative to the
// overdraw region. 0 is fully revealed, 1 is fully overdrawn. Negative values occur inside the normal reveal region
- (void)revealController:(SWRevealViewController *)revealController panGestureBeganFromLocation:(CGFloat)location progress:(CGFloat)progress overProgress:(CGFloat)overProgress;
- (void)revealController:(SWRevealViewController *)revealController panGestureMovedToLocation:(CGFloat)location progress:(CGFloat)progress overProgress:(CGFloat)overProgress;
- (void)revealController:(SWRevealViewController *)revealController panGestureEndedToLocation:(CGFloat)location progress:(CGFloat)progress overProgress:(CGFloat)overProgress;
// Notification of child controller replacement
- (void)revealController:(SWRevealViewController *)revealController willAddViewController:(UIViewController *)viewController
forOperation:(SWRevealControllerOperation)operation animated:(BOOL)animated;
- (void)revealController:(SWRevealViewController *)revealController didAddViewController:(UIViewController *)viewController
forOperation:(SWRevealControllerOperation)operation animated:(BOOL)animated;
// Support for custom transition animations while replacing child controllers. If implemented, it will be fired in response
// to calls to 'setXXViewController' methods
- (id<UIViewControllerAnimatedTransitioning>)revealController:(SWRevealViewController *)revealController
animationControllerForOperation:(SWRevealControllerOperation)operation fromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC;
// DEPRECATED - The following delegate methods will be removed some time in the future
- (void)revealController:(SWRevealViewController *)revealController panGestureBeganFromLocation:(CGFloat)location progress:(CGFloat)progress; // (DEPRECATED)
- (void)revealController:(SWRevealViewController *)revealController panGestureMovedToLocation:(CGFloat)location progress:(CGFloat)progress; // (DEPRECATED)
- (void)revealController:(SWRevealViewController *)revealController panGestureEndedToLocation:(CGFloat)location progress:(CGFloat)progress; // (DEPRECATED)
@end
#pragma mark - UIViewController(SWRevealViewController) Category
// A category of UIViewController to let childViewControllers easily access their parent SWRevealViewController
@interface UIViewController(SWRevealViewController)
- (SWRevealViewController*)revealViewController;
@end
#pragma mark - StoryBoard support Classes
/* StoryBoard support */
// String identifiers to be applied to segues on a storyboard
extern NSString* const SWSegueRearIdentifier; // this is @"sw_rear"
extern NSString* const SWSegueFrontIdentifier; // this is @"sw_front"
extern NSString* const SWSegueRightIdentifier; // this is @"sw_right"
/* This will allow the class to be defined on a storyboard */
// Use this along with one of the above segue identifiers to segue to the initial state
@interface SWRevealViewControllerSegueSetController : UIStoryboardSegue
@end
// Use this to push a view controller
@interface SWRevealViewControllerSeguePushController : UIStoryboardSegue
@end
//#pragma mark - SWRevealViewControllerSegue (DEPRECATED)
//
//@interface SWRevealViewControllerSegue : UIStoryboardSegue // DEPRECATED: USE SWRevealViewControllerSegueSetController instead
//@property (nonatomic, strong) void(^performBlock)( SWRevealViewControllerSegue* segue, UIViewController* svc, UIViewController* dvc );
//@end
File diff suppressed because it is too large Load Diff
@@ -1,20 +0,0 @@
//
// SettingsViewController.h
// Limelight
//
// Created by Diego Waxemberg on 10/27/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
@interface SettingsViewController : UIViewController
@property (strong, nonatomic) IBOutlet UILabel *bitrateLabel;
@property (strong, nonatomic) IBOutlet UISlider *bitrateSlider;
@property (strong, nonatomic) IBOutlet UISegmentedControl *framerateSelector;
@property (strong, nonatomic) IBOutlet UISegmentedControl *resolutionSelector;
- (void) saveSettings;
@end
@@ -1,64 +0,0 @@
//
// SettingsViewController.m
// Limelight
//
// Created by Diego Waxemberg on 10/27/14.
// Copyright (c) 2014 Limelight Stream. All rights reserved.
//
#import "SettingsViewController.h"
#import "Settings.h"
#import "DataManager.h"
#define BITRATE_INTERVAL 100
@implementation SettingsViewController {
NSInteger _bitrate;
}
static NSString* bitrateFormat = @"Bitrate: %d kbps";
- (void)viewDidLoad {
[super viewDidLoad];
DataManager* dataMan = [[DataManager alloc] init];
Settings* currentSettings = [dataMan retrieveSettings];
_bitrate = [currentSettings.bitrate integerValue];
NSInteger framerate = [currentSettings.framerate integerValue] == 30 ? 0 : 1;
NSInteger resolution = [currentSettings.height integerValue] == 720 ? 0 : 1;
[self.resolutionSelector setSelectedSegmentIndex:resolution];
[self.framerateSelector setSelectedSegmentIndex:framerate];
[self.bitrateSlider setValue:_bitrate animated:YES];
[self.bitrateSlider addTarget:self action:@selector(bitrateSliderMoved) forControlEvents:UIControlEventValueChanged];
[self.bitrateLabel setText:[NSString stringWithFormat:bitrateFormat, (int)_bitrate]];
}
- (void) bitrateSliderMoved {
_bitrate = BITRATE_INTERVAL * floor((self.bitrateSlider.value/BITRATE_INTERVAL)+0.5);
[self.bitrateLabel setText:[NSString stringWithFormat:bitrateFormat, (int)_bitrate]];
}
- (void) saveSettings {
DataManager* dataMan = [[DataManager alloc] init];
NSInteger framerate = [self.framerateSelector selectedSegmentIndex] == 0 ? 30 : 60;
NSInteger height = [self.resolutionSelector selectedSegmentIndex] == 0 ? 720 : 1080;
NSInteger width = height == 720 ? 1280 : 1920;
[dataMan saveSettingsWithBitrate:_bitrate framerate:framerate height:height width:width];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
}
@end
@@ -1,17 +0,0 @@
//
// StreamFrameViewController.h
// Limelight-iOS
//
// Created by Diego Waxemberg on 1/18/14.
// Copyright (c) 2014 Diego Waxemberg. All rights reserved.
//
#import "Connection.h"
#import <UIKit/UIKit.h>
@interface StreamFrameViewController : UIViewController <ConnectionCallbacks>
@property (strong, nonatomic) IBOutlet UILabel *stageLabel;
@property (strong, nonatomic) IBOutlet UIActivityIndicatorView *spinner;
@end

Some files were not shown because too many files have changed in this diff Show More