├── .gitignore ├── CMakeLists.txt ├── README.txt ├── main.cpp ├── spike_code ├── AndroidUsbCamera.cpp ├── AndroidUsbCamera.h ├── databridge.cpp └── databridge.h ├── src ├── CMakeLists.txt ├── androidusbcamera.cpp ├── androidusbcamera.h ├── frame.cpp ├── frame.h ├── framesconverter.cpp ├── framesconverter.h ├── framescreator.cpp ├── framescreator.h ├── framesdataextractor.cpp ├── framesdataextractor.h ├── framesfactory.cpp ├── framesfactory.h ├── qtInterfaces │ ├── CMakeLists.txt │ ├── socketinterface.cpp │ └── socketinterface.h ├── socketconnector.cpp └── socketconnector.h └── test ├── CMakeLists.txt ├── android_usb_camera_test_base.h ├── framescreatortest.cpp ├── framescreatortest.h ├── framesdataextractortest.cpp ├── framesdataextractortest.h ├── framesfactorytest.cpp ├── framesfactorytest.h ├── socketconnectortest.cpp └── socketconnectortest.h /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | build 3 | *kdev4* 4 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(AndroidUsbCamera) 2 | cmake_minimum_required(VERSION 2.6) 3 | find_package(Qt4 REQUIRED) 4 | add_subdirectory(src) 5 | 6 | include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} src) 7 | 8 | set(AndroidUsbCamera_SRCS main.cpp ) 9 | qt4_automoc(${AndroidUsbCamera_SRCS}) 10 | add_executable(AndroidUsbCamera ${AndroidUsbCamera_SRCS}) 11 | target_link_libraries(AndroidUsbCamera AndroidUsbCameraStaticLib ${QT_QTCORE_LIBRARY} ) 12 | 13 | if( "x${CMAKE_BUILD_TYPE}" STREQUAL "xdebug") 14 | ENABLE_TESTING() 15 | add_subdirectory(test) 16 | ADD_TEST("SocketConnectorTest" "${CMAKE_CURRENT_BINARY_DIR}/test/SocketConnectorTest") 17 | ADD_TEST("FramesDataExtractorTest" "${CMAKE_CURRENT_BINARY_DIR}/test/FramesDataExtractorTest") 18 | ADD_TEST("FramesCreatorTest" "${CMAKE_CURRENT_BINARY_DIR}/test/FramesCreatorTest") 19 | ADD_TEST("FramesFactoryTest" "${CMAKE_CURRENT_BINARY_DIR}/test/FramesFactoryTest") 20 | endif() -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | Prerequisites: 2 | - git 3 | - QT framework (any version above 4.2 should work) 4 | Only for unit testing(developers): 5 | - google mock framework: http://code.google.com/p/googlemock/ 6 | 7 | Build instructions: 8 | - Checkout project 9 | -- git clone git://github.com/marcogulino/AndroidUsbCamera.git 10 | OR 11 | -- git clone http://github.com/marcogulino/AndroidUsbCamera.git 12 | 13 | - create a build directory (can be in any place, let's assume it's in 14 | AndroidUsbCamera/build): 15 | -- cd AndroidUsbCamera; mkdir build 16 | 17 | - configure the project with cmake: 18 | -- cd build; cmake ../ 19 | - build the project: 20 | -- make 21 | Optional: 22 | - Run the tests (build only if CMAKE_BUILD_TYPE is debug): 23 | -- make test (or just type ctest) 24 | 25 | to have a better output with failing tests, setting the environment variable: 26 | - CTEST_OUTPUT_ON_FAILURE=1 27 | can greatly help. 28 | 29 | Usage: 30 | - first of all, start USB Webcamera application on your phone 31 | - forward tcp connections with adb: 32 | -- adb forward tcp:8080 tcp:8080 33 | 34 | - Load vloopback module (sources and instructions: http://www.lavrsen.dk/twiki/bin/view/Motion/VideoFourLinuxLoopbackDevice) 35 | -- modprobe vloopback 36 | - Find the video output device 37 | -- dmesg | grep vloopback 38 | -- look for a string like "[vloopback_init] : Loopback 0 registered, input: video0, output: video1 39 | -- in this case, /dev/video0 is your video output device 40 | - load AndroidUsbCamera application: 41 | -- AndroidUsbCamera /dev/video0 42 | 43 | 44 | -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "androidusbcamera.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | int main(int argc, char** argv) 9 | { 10 | QCoreApplication app(argc, argv); 11 | app.setApplicationName("AndroidUsbCamera"); 12 | QString filename=app.arguments().first(); 13 | if( app.arguments().size() != 2 || ! QFileInfo(app.arguments()[1]).isWritable()) { 14 | QTextStream(stdout) << "Usage: " << app.applicationName() << "