Skip to content

Commit

Permalink
* Initial support for camera2 API
Browse files Browse the repository at this point in the history
* Remove gst and aal dependency
* Depend on droidmedia
* Split main.qml in different files.
* Add selection of different resolutions. Might not be used for pictures, but we want it later for recording. Just thinking of CPU load when recording with highest resolution.
* Add scene-mode selection

What is working:
* Viewfinder
* Zoom
* Taking pictures

The source is right now a little messy, old code and new code. As we might want to reuse some functions/classes. For example flash is not working because of the backend still WIP
  • Loading branch information
arpio23 committed Jan 26, 2024
1 parent 1566585 commit aeb268a
Show file tree
Hide file tree
Showing 21 changed files with 1,384 additions and 1,234 deletions.
46 changes: 8 additions & 38 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,52 +1,22 @@
cmake_minimum_required(VERSION 3.16)
project (droidian-camera LANGUAGES CXX)
project (droidian-camera LANGUAGES C CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

find_package(Qt5 REQUIRED COMPONENTS Core Widgets Quick Qml Multimedia)

execute_process(COMMAND pkg-config --cflags gstreamer-1.0 OUTPUT_VARIABLE GST_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND pkg-config --libs gstreamer-1.0 OUTPUT_VARIABLE GST_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)

execute_process(COMMAND pkg-config --variable=libdir glib-2.0 OUTPUT_VARIABLE GLIB_LIBDIR OUTPUT_STRIP_TRAILING_WHITESPACE)

set(APP_SOURCES
${CMAKE_SOURCE_DIR}/src/main.cpp
${CMAKE_SOURCE_DIR}/src/thumbnailgenerator.cpp
${CMAKE_SOURCE_DIR}/src/capturefilter.cpp
${CMAKE_SOURCE_DIR}/src/gstdevicerange.cpp
${CMAKE_SOURCE_DIR}/src/flashlightcontroller.cpp
${CMAKE_SOURCE_DIR}/src/filemanager.cpp)

set(APP_HEADERS
${CMAKE_SOURCE_DIR}/src/filemanager.h
${CMAKE_SOURCE_DIR}/src/capturefilter.h
${CMAKE_SOURCE_DIR}/src/gstdevicerange.h
${CMAKE_SOURCE_DIR}/src/flashlightcontroller.h
${CMAKE_SOURCE_DIR}/src/thumbnailgenerator.h)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

qt5_add_resources(APP_RESOURCES
${CMAKE_SOURCE_DIR}/sounds/sounds.qrc
${CMAKE_SOURCE_DIR}/icons/icons.qrc
${CMAKE_SOURCE_DIR}/src/qml/qml.qrc)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick Qml Multimedia)

qt_standard_project_setup()

add_executable(${PROJECT_NAME} ${APP_SOURCES} ${APP_HEADERS} ${APP_RESOURCES})
add_subdirectory(src)

target_include_directories(${PROJECT_NAME} PUBLIC
/usr/include/gstreamer-1.0
/usr/include/glib-2.0
${GLIB_LIBDIR}/glib-2.0/include
)
${CMAKE_CURRENT_SOURCE_DIR}/src)

target_compile_options(${PROJECT_NAME} PUBLIC ${GST_CFLAGS})
target_link_libraries(${PROJECT_NAME} PUBLIC Qt5::Core Qt5::Widgets Qt5::Quick Qt5::Qml Qt5::Multimedia ${GST_LIBS})
target_link_libraries(${PROJECT_NAME} PUBLIC Qt6::Core Qt6::Gui Qt6::Quick Qt6::Qml Qt6::Multimedia droidmedia)

install(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin)
install(FILES ${CMAKE_SOURCE_DIR}/droidian-camera.desktop DESTINATION /usr/share/applications)
install(FILES ${CMAKE_SOURCE_DIR}/camera-app.svg DESTINATION /usr/share/icons)
install(FILES ${CMAKE_SOURCE_DIR}/droidian-camera.conf DESTINATION /etc)
install(FILES ${CMAKE_SOURCE_DIR}/droidian-camera.conf DESTINATION /etc)
36 changes: 14 additions & 22 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ Maintainer: Erik Inkinen <[email protected]>
Alexander Rutz <[email protected]>
Priority: optional
Build-Depends: cmake,
qtbase5-dev,
qtdeclarative5-dev,
libqt5multimedia5-plugins,
qttools5-dev-tools,
libz-dev,
qtmultimedia5-dev,
libgstreamer1.0-dev,
pkgconf
libgles-dev,
qt6-base-dev,
pkg-config,
qt6-declarative-dev,
qt6-multimedia-dev,
libdroidmedia-dev,
Standards-Version: 4.5.1

Package: droidian-camera
Expand All @@ -21,20 +19,14 @@ Multi-Arch: foreign
Pre-Depends: ${misc:Pre-Depends}
Depends: ${misc:Depends},
${shlibs:Depends},
qml-module-qtmultimedia,
libqt5multimedia5-plugins,
qml-module-qtquick2,
qml-module-qtquick-controls2,
qml-module-qtquick-window2,
qt5-cameraplugin-aal,
qml-module-qt-labs-platform,
qml-module-qt-labs-folderlistmodel,
qml-module-qt-labs-settings,
qml-module-qtquick-layouts,
qml-module-qtgraphicaleffects,
libqt5svg5,
libgstreamer1.0-0,
gstreamer1.0-droid
libqt6gui6-gles,
qt6-wayland,
qml6-module-qtquick-layouts,
qml6-module-qtquick-controls,
qml6-module-qtquick,
qml6-module-qtmultimedia,
qml6-module-qtquick-window,
qml6-module-qtqml-workerscript
Provides: pinhole
Conflicts: pinhole
Description: This package contains Droidian's default camera app.
11 changes: 10 additions & 1 deletion debian/rules
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

export QT_SELECT := qt6

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
dh $@
dh $@ --buildsystem=cmake
8 changes: 5 additions & 3 deletions droidian-camera.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[General]
blacklist=""
backend=aal
[BlacklistedCameras]
# In this exaple camera 0 and camera 2 would be blacklisted. The size value is the amount of total blacklisted cameras.
#camera\1\camId=0
#camera\2\camId=2
#camera\size=2
6 changes: 0 additions & 6 deletions icons/icons.qrc

This file was deleted.

5 changes: 0 additions & 5 deletions sounds/sounds.qrc

This file was deleted.

37 changes: 37 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
cmake_minimum_required(VERSION 3.16)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

file(GLOB_RECURSE resources_SRC CONFIGURE_DEPENDS
"qml/*.qml"
"icons/*.svg"
"sounds/*.wav"
)

foreach(path IN LISTS resources_SRC)
list(REMOVE_ITEM resources_SRC ${path})
string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/ "" path ${path})
list(APPEND resources_SRC ${path})
endforeach()

set(APP_SOURCES
main.cpp
droidian-camera.cpp
dc-device.cpp)

set(APP_HEADERS
droidian-camera.h
dc-device.h)

qt_add_executable(${PROJECT_NAME} ${APP_SOURCES} ${APP_HEADERS})

qt_add_qml_module(${PROJECT_NAME}
URI DroidianCamera
VERSION 1.0
DEPENDENCIES QtQuick
)

qt_add_resources(${PROJECT_NAME} "resource"
PREFIX /
FILES
${resources_SRC})
Loading

0 comments on commit aeb268a

Please sign in to comment.