[Armadeus-commitlog] armadeus branch, master, updated. armadeus-6.0-434-gd951785c0
Brought to you by:
sszy
|
From: Julien B a. A. <ar...@us...> - 2018-07-03 16:18:25
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "armadeus".
The branch, master has been updated
via d951785c0d33b1880da966755ff7c2f6cf26b4d2 (commit)
via 09cabb2d6b8fe2b2b54e8f3e453940c651e479bb (commit)
from 9be0c4371386efa2506dcc316e420491d0d6cbfc (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit d951785c0d33b1880da966755ff7c2f6cf26b4d2
Author: Julien BOIBESSOT <jul...@ar...>
Date: Tue Jul 3 18:17:29 2018 +0200
[DEMOS] capture: fixes YUV420 -> grayscale decoding and fps selection when forcing YUV420 mode
commit 09cabb2d6b8fe2b2b54e8f3e453940c651e479bb
Author: Julien BOIBESSOT <jul...@ar...>
Date: Tue Jul 3 18:05:18 2018 +0200
[DEMOS] capture: allow to pause/restart stream when pressing SPACE key
-----------------------------------------------------------------------
Summary of changes:
target/demos/camera/capture/capture.c | 65 +++++++++++++++++++++++++----------
1 file changed, 46 insertions(+), 19 deletions(-)
diff --git a/target/demos/camera/capture/capture.c b/target/demos/camera/capture/capture.c
index 56ce8a395..dd98045bb 100644
--- a/target/demos/camera/capture/capture.c
+++ b/target/demos/camera/capture/capture.c
@@ -89,6 +89,9 @@ unsigned int capture_mode = 0;
#define FOURCC_TO_STR(fmt) fmt & 0xff, (fmt >> 8) & 0xff, (fmt >> 16) & 0xff, (fmt >> 24) & 0xff
+static void start_capturing(void);
+static void stop_capturing(void);
+
static void errno_exit(const char *s)
{
fprintf(stderr, "%s error %d, %s\n", s, errno, strerror (errno));
@@ -329,15 +332,13 @@ static void yuv420_to_rgb32(void *yuv, int size, void *rgb)
int nbpix = mycamera.width * mycamera.height;
Uint16 *dest16 = (Uint16*) rgb;
Uint32 *dest32 = (Uint32*) rgb;
- Uint32 *src = (Uint32*) yuv;
+ Uint8 *src = (Uint8*) yuv;
nbpix = mycamera.width * mycamera.height;
- for (i=nbpix/4; i; i--) {
- yuv32 = *(src++);
- for (j=0; j<4; j++) {
- R = G = B = (&yuv32)[j];
- *(dest32++) = (R << 16) | (G << 8) | (B);
- }
+ for (i=nbpix; i; i--) {
+ yuv8 = *(src++);
+ R = G = B = yuv8;
+ *(dest32++) = (R << 16) | (G << 8) | (B); /* BGRA */
}
}
@@ -614,7 +615,7 @@ static void mainloop(void)
int ret;
while (go_on) {
- for (;;) {
+ {
fd_set fds;
struct timeval tv;
int r;
@@ -640,11 +641,9 @@ static void mainloop(void)
exit (EXIT_FAILURE);
}
- if (read_frame())
- break;
-
- /* EAGAIN - continue select loop. */
+ read_frame();
}
+
while (SDL_PollEvent(&event)) {
switch (event.type)
{
@@ -662,20 +661,37 @@ static void mainloop(void)
}
case SDL_KEYDOWN:
+ switch (event.key.keysym.sym) {
+ case SDLK_SPACE:
+ pause_capture = pause_capture ? 0 : 1;
+ break;
+ default:
+ break;
+ }
+ break;
+
case SDL_QUIT:
go_on = 0;
break;
}
}
- while (pause_capture)
- SDL_Delay(500);
+
+ if (pause_capture)
+ stop_capturing();
+ else
+ start_capturing();
}
}
+static int stream_on = 0;
+
static void stop_capturing(void)
{
enum v4l2_buf_type type;
+ if (!stream_on)
+ goto stop_end;
+
switch (io) {
case IO_METHOD_READ:
/* Nothing to do. */
@@ -690,6 +706,10 @@ static void stop_capturing(void)
break;
}
+ stream_on = 0;
+
+stop_end:
+ return;
}
static void start_capturing(void)
@@ -697,6 +717,9 @@ static void start_capturing(void)
unsigned int i;
enum v4l2_buf_type type;
+ if (stream_on)
+ goto start_end;
+
switch (io) {
case IO_METHOD_READ:
/* Nothing to do. */
@@ -746,6 +769,11 @@ static void start_capturing(void)
break;
}
+
+ stream_on = 1;
+
+start_end:
+ return;
}
static void uninit_device(void)
@@ -1093,9 +1121,8 @@ static void init_capture_device(unsigned int capt_width, unsigned int capt_heigh
CLEAR(fmt);
- if (!force_yuv420) {
- fmt.fmt.pix.pixelformat = get_a_supported_pix_fmt();
- } else {
+ fmt.fmt.pix.pixelformat = get_a_supported_pix_fmt();
+ if (force_yuv420) {
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV420;
}
if (!fmt.fmt.pix.pixelformat) {
@@ -1231,11 +1258,11 @@ static void signal_handler(int signal)
go_on = 0;
if (signal == SIGUSR1) {
- printf("Starting capture\n");
+ printf("Asked to start capture from external app\n");
pause_capture = 0;
}
if (signal == SIGUSR2) {
- printf("Stopping capture\n");
+ printf("Asked to stop capture from external app\n");
pause_capture = 1;
}
}
hooks/post-receive
--
armadeus
|