Skip to content

Commit

Permalink
Rename libcamera-apps to rpicam-apps.
Browse files Browse the repository at this point in the history
This change introduces a global rename of all the application and
library files from libcamera-* to rpicam-*. Symlinks are setup to
allow users to continue using the old names, but they will be deprecated
in the near future, so users are encouraged to adopt the new naming as
soon as possible.

Signed-off-by: Naushir Patuck <[email protected]>
  • Loading branch information
naushir committed Nov 15, 2023
1 parent c9dc0b5 commit 0ca9f41
Show file tree
Hide file tree
Showing 54 changed files with 352 additions and 306 deletions.
10 changes: 5 additions & 5 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ Please use the ``camera-bug-report`` tool to create a bug report, and upload it
The bug report tool uses the following syntax:

```
camera-bug-report -t <timeout in seconds> -o <output file> -c "<libcamera-app command>"
camera-bug-report -t <timeout in seconds> -o <output file> -c "<rpicam-app command>"
```

For example,

```
camera-bug-report -t 5 -o bug.txt -c "libcamera-still -t 1000 -o test.jpg"
camera-bug-report -t 5 -o bug.txt -c "rpicam-still -t 1000 -o test.jpg"
```
will attempt to run libcamera-still and timeout after 5 seconds if the application has stalled. The script will generate a ``bug.txt`` file that captures all the output logs and system state to help us debug the issue.
will attempt to run rpicam-still and timeout after 5 seconds if the application has stalled. The script will generate a ``bug.txt`` file that captures all the output logs and system state to help us debug the issue.

You can also run without a timeout:

```
camera-bug-report -o bug.txt -c "libcamera-vid -t 0 -o test.264"
camera-bug-report -o bug.txt -c "rpicam-vid -t 0 -o test.264"
```
This will run ``libcamera-vid`` indefinitely until either you press ``Ctrl+C`` or the application terminates, after which the necessary output logs and system state will be captured.
This will run ``rpicam-vid`` indefinitely until either you press ``Ctrl+C`` or the application terminates, after which the necessary output logs and system state will be captured.

If you cannot run your application through the ``camera-bug-report`` tool, run it without the ``-c`` command line argument **after running the camera application.** In these cases, please also provide the command line used to run the application, as well as any output generated during the run.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: libcamera-apps style checker
name: rpicam-apps style checker
on:
pull_request:
branches: [ main ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: libcamera-app smoke tests
name: rpicam-app smoke tests

on:
pull_request:
Expand Down Expand Up @@ -101,10 +101,10 @@ jobs:
run: tar -xvf build-artifacts-gcc-release.tar --one-top-level=build

- name: Print version string
run: ${{github.workspace}}/build/apps/libcamera-hello --version
run: ${{github.workspace}}/build/apps/rpicam-hello --version

- name: Print linkage info
run: ldd ${{github.workspace}}/build/apps/libcamera-hello | grep libcamera
run: ldd ${{github.workspace}}/build/apps/rpicam-hello | grep libcamera

- name: Test
run: ${{github.workspace}}/utils/test.py --exe-dir ${{github.workspace}}/build/apps/ --output-dir ${{github.workspace}}/test_output --json-dir ${{github.workspace}}/assets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
path: build-artifacts-libcamera.tar
retention-days: 7

build-libcamera-apps:
build-rpicam-apps:

runs-on: [ self-hosted ]
needs: build-libcamera
Expand Down Expand Up @@ -80,19 +80,19 @@ jobs:
timeout-minutes: 15

- name: Tar files
run: tar -cvf build-artifacts-libcamera-apps.tar -C ${{github.workspace}}/build .
run: tar -cvf build-artifacts-rpicam-apps.tar -C ${{github.workspace}}/build .

- name: Upload build files
uses: actions/upload-artifact@v3
with:
name: build-artifacts-libcamera-apps
path: build-artifacts-libcamera-apps.tar
name: build-artifacts-rpicam-apps
path: build-artifacts-rpicam-apps.tar
retention-days: 7

run-test:

runs-on: ${{matrix.camera}}
needs: build-libcamera-apps
needs: build-rpicam-apps

strategy:
matrix:
Expand All @@ -107,14 +107,14 @@ jobs:
- name: Create test output dir
run: mkdir -p ${{github.workspace}}/test_output

- name: Download libcamera-apps build
- name: Download rpicam-apps build
uses: actions/download-artifact@v3
with:
name: build-artifacts-libcamera-apps
name: build-artifacts-rpicam-apps
path: ${{github.workspace}}

- name: Untar libcamera-apps files
run: tar -xvf build-artifacts-libcamera-apps.tar --one-top-level=build
- name: Untar rpicam-apps files
run: tar -xvf build-artifacts-rpicam-apps.tar --one-top-level=build

- name: Clean libcamera
run: rm -rf ${{env.LIBCAMERA_SRC_DIR}} && mkdir -p ${{env.LIBCAMERA_SRC_DIR}}
Expand All @@ -129,12 +129,12 @@ jobs:
run: tar -xvf build-artifacts-libcamera.tar -C ${{env.LIBCAMERA_SRC_DIR}} --one-top-level=install

- name: Print version string
run: ${{github.workspace}}/build/apps/libcamera-hello --version
run: ${{github.workspace}}/build/apps/rpicam-hello --version

- name: Print linkage info
run: ldd ${{github.workspace}}/build/apps/libcamera-hello | grep libcamera
run: ldd ${{github.workspace}}/build/apps/rpicam-hello | grep libcamera

- name: Test libcamera-apps
- name: Test rpicam-apps
run: ${{github.workspace}}/utils/test.py --exe-dir ${{github.workspace}}/build/apps/ --output-dir ${{github.workspace}}/test_output --json-dir ${{github.workspace}}/assets
timeout-minutes: 15

Expand Down Expand Up @@ -166,7 +166,7 @@ jobs:
run: DISPLAY=:0.0 LD_LIBRARY_PATH=${{env.LIBCAMERA_LD_LIBRARY_DIR}} PYTHONPATH=${{env.LIBCAMERA_LD_LIBRARY_DIR}}/python3.11/site-packages/:${{env.PICAMERA2_SRC_DIR}} ${{env.PICAMERA2_SRC_DIR}}/tools/run_tests.py --picamera2-dir ${{env.PICAMERA2_SRC_DIR}}
timeout-minutes: 15

update-libcamera-base:
update-rpicam-base:

runs-on: ${{matrix.camera}}
needs: run-picamera2-tests
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# libcamera-apps
# rpicam-apps
This is a small suite of libcamera-based applications to drive the cameras on a Raspberry Pi platform.

This is a small suite of libcamera-based apps that aim to copy the functionality of the existing "raspicam" apps.
>[!WARNING]
>These applications and libraries have been renamed from `libcamera-*` to `rpicam-*`. Symbolic links are installed to allow users to keep using the old application names, but these will be deprecated soon. Users are encouraged to adopt the new application and library names as soon as possible.
Build
-----
For usage and build instructions, see the official Raspberry Pi documenation pages [here.](https://www.raspberrypi.com/documentation/computers/camera_software.html#building-libcamera-and-libcamera-apps)
For usage and build instructions, see the official Raspberry Pi documentation pages [here.](https://www.raspberrypi.com/documentation/computers/camera_software.html#building-libcamera-and-rpicam-apps)

License
-------
Expand All @@ -14,4 +16,4 @@ The source code is made available under the simplified [BSD 2-Clause license](ht
Status
------

[![ToT libcamera build/run test](https://github.com/raspberrypi/libcamera-apps/actions/workflows/libcamera-test.yml/badge.svg)](https://github.com/raspberrypi/libcamera-apps/actions/workflows/libcamera-test.yml)
[![ToT libcamera build/run test](https://github.com/raspberrypi/rpicam-apps/actions/workflows/rpicam-test.yml/badge.svg)](https://github.com/raspberrypi/rpicam-apps/actions/workflows/rpicam-test.yml)
93 changes: 59 additions & 34 deletions apps/meson.build
Original file line number Diff line number Diff line change
@@ -1,37 +1,62 @@
libcamera_still = executable('libcamera-still', files('libcamera_still.cpp'),
include_directories : include_directories('..'),
dependencies: [libcamera_dep, boost_dep],
link_with : libcamera_app,
install : true)

libcamera_vid = executable('libcamera-vid', files('libcamera_vid.cpp'),
include_directories : include_directories('..'),
dependencies: [libcamera_dep, boost_dep],
link_with : libcamera_app,
install : true)

libcamera_hello = executable('libcamera-hello', files('libcamera_hello.cpp'),
include_directories : include_directories('..'),
dependencies: libcamera_dep,
link_with : libcamera_app,
install : true)

libcamera_raw = executable('libcamera-raw', files('libcamera_raw.cpp'),
include_directories : include_directories('..'),
dependencies: [libcamera_dep, boost_dep],
link_with : libcamera_app,
install : true)

libcamera_jpeg = executable('libcamera-jpeg', files('libcamera_jpeg.cpp'),
include_directories : include_directories('..'),
dependencies: [libcamera_dep, boost_dep],
link_with : libcamera_app,
install : true)
rpicam_still = executable('rpicam-still', files('rpicam_still.cpp'),
include_directories : include_directories('..'),
dependencies: [libcamera_dep, boost_dep],
link_with : rpicam_app,
install : true)

rpicam_vid = executable('rpicam-vid', files('rpicam_vid.cpp'),
include_directories : include_directories('..'),
dependencies: [libcamera_dep, boost_dep],
link_with : rpicam_app,
install : true)

rpicam_hello = executable('rpicam-hello', files('rpicam_hello.cpp'),
include_directories : include_directories('..'),
dependencies: libcamera_dep,
link_with : rpicam_app,
install : true)

rpicam_raw = executable('rpicam-raw', files('rpicam_raw.cpp'),
include_directories : include_directories('..'),
dependencies: [libcamera_dep, boost_dep],
link_with : rpicam_app,
install : true)

rpicam_jpeg = executable('rpicam-jpeg', files('rpicam_jpeg.cpp'),
include_directories : include_directories('..'),
dependencies: [libcamera_dep, boost_dep],
link_with : rpicam_app,
install : true)

# Install symlinks to the old app names for legacy purposes.
install_symlink('libcamera-still',
install_dir: get_option('bindir'),
pointing_to: 'rpicam-still')

install_symlink('libcamera-vid',
install_dir: get_option('bindir'),
pointing_to: 'rpicam-vid')

install_symlink('libcamera-hello',
install_dir: get_option('bindir'),
pointing_to: 'rpicam-hello')

install_symlink('libcamera-raw',
install_dir: get_option('bindir'),
pointing_to: 'rpicam-raw')

install_symlink('libcamera-jpeg',
install_dir: get_option('bindir'),
pointing_to: 'rpicam-jpeg')

if enable_tflite
libcamera_detect = executable('libcamera-detect', files('libcamera_detect.cpp'),
include_directories : include_directories('..'),
dependencies: [libcamera_dep, boost_dep],
link_with : libcamera_app,
install : true)
rpicam_detect = executable('rpicam-detect', files('rpicam_detect.cpp'),
include_directories : include_directories('..'),
dependencies: [libcamera_dep, boost_dep],
link_with : rpicam_app,
install : true)

install_symlink('libcamera-detect',
install_dir: get_option('bindir'),
pointing_to: 'rpicam-detect')
endif
20 changes: 10 additions & 10 deletions apps/libcamera_detect.cpp → apps/rpicam_detect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
/*
* Copyright (C) 2021, Raspberry Pi (Trading) Ltd.
*
* libcamera_detect.cpp - take pictures when objects are detected
* rpicam_detect.cpp - take pictures when objects are detected
*/

// Example: libcamera-detect --post-process-file object_detect_tf.json --lores-width 400 --lores-height 300 -t 0 --object cat -o cat%03d.jpg
// Example: rpicam-detect --post-process-file object_detect_tf.json --lores-width 400 --lores-height 300 -t 0 --object cat -o cat%03d.jpg

#include <chrono>

#include "core/libcamera_app.hpp"
#include "core/rpicam_app.hpp"
#include "core/still_options.hpp"

#include "image/image.hpp"
Expand Down Expand Up @@ -41,16 +41,16 @@ struct DetectOptions : public StillOptions
}
};

class LibcameraDetectApp : public LibcameraApp
class RPiCamDetectApp : public RPiCamApp
{
public:
LibcameraDetectApp() : LibcameraApp(std::make_unique<DetectOptions>()) {}
RPiCamDetectApp() : RPiCamApp(std::make_unique<DetectOptions>()) {}
DetectOptions *GetOptions() const { return static_cast<DetectOptions *>(options_.get()); }
};

// The main even loop for the application.

static void event_loop(LibcameraDetectApp &app)
static void event_loop(RPiCamDetectApp &app)
{
DetectOptions *options = app.GetOptions();
app.OpenCamera();
Expand All @@ -61,15 +61,15 @@ static void event_loop(LibcameraDetectApp &app)

for (unsigned int count = 0;; count++)
{
LibcameraApp::Msg msg = app.Wait();
if (msg.type == LibcameraApp::MsgType::Timeout)
RPiCamApp::Msg msg = app.Wait();
if (msg.type == RPiCamApp::MsgType::Timeout)
{
LOG_ERROR("ERROR: Device timeout detected, attempting a restart!!!");
app.StopCamera();
app.StartCamera();
continue;
}
if (msg.type == LibcameraApp::MsgType::Quit)
if (msg.type == RPiCamApp::MsgType::Quit)
return;

// In viewfinder mode, simply run until the timeout, but do a capture if the object
Expand Down Expand Up @@ -142,7 +142,7 @@ int main(int argc, char *argv[])
{
try
{
LibcameraDetectApp app;
RPiCamDetectApp app;
DetectOptions *options = app.GetOptions();
if (options->Parse(argc, argv))
{
Expand Down
16 changes: 8 additions & 8 deletions apps/libcamera_hello.cpp → apps/rpicam_hello.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
/*
* Copyright (C) 2020, Raspberry Pi (Trading) Ltd.
*
* libcamera_hello.cpp - libcamera "hello world" app.
* rpicam_hello.cpp - libcamera "hello world" app.
*/

#include <chrono>

#include "core/libcamera_app.hpp"
#include "core/rpicam_app.hpp"
#include "core/options.hpp"

using namespace std::placeholders;

// The main event loop for the application.

static void event_loop(LibcameraApp &app)
static void event_loop(RPiCamApp &app)
{
Options const *options = app.GetOptions();

Expand All @@ -26,17 +26,17 @@ static void event_loop(LibcameraApp &app)

for (unsigned int count = 0; ; count++)
{
LibcameraApp::Msg msg = app.Wait();
if (msg.type == LibcameraApp::MsgType::Timeout)
RPiCamApp::Msg msg = app.Wait();
if (msg.type == RPiCamApp::MsgType::Timeout)
{
LOG_ERROR("ERROR: Device timeout detected, attempting a restart!!!");
app.StopCamera();
app.StartCamera();
continue;
}
if (msg.type == LibcameraApp::MsgType::Quit)
if (msg.type == RPiCamApp::MsgType::Quit)
return;
else if (msg.type != LibcameraApp::MsgType::RequestComplete)
else if (msg.type != RPiCamApp::MsgType::RequestComplete)
throw std::runtime_error("unrecognised message!");

LOG(2, "Viewfinder frame " << count);
Expand All @@ -53,7 +53,7 @@ int main(int argc, char *argv[])
{
try
{
LibcameraApp app;
RPiCamApp app;
Options *options = app.GetOptions();
if (options->Parse(argc, argv))
{
Expand Down
Loading

0 comments on commit 0ca9f41

Please sign in to comment.