User avatar
Seb.26
Posts: 29
Joined: Mon Jul 07, 2014 12:06 pm

Raspistill -s signal mode

Sat Sep 29, 2018 3:08 pm

Hi world,

I'm trying to use the raspistill signal mode to trigger frame grab from my c++ program.

Question : how could I know that raspistill have finish to grab the frame after sending USR1 signal to it ??
= the jpeg file is ready to be read from my program and raspistill is ready for next USR1 signal.

Thanks.

User avatar
DougieLawson
Posts: 34114
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Raspistill -s signal mode

Sat Sep 29, 2018 4:00 pm

Why not pull the source code for raspistill and add your new function to it rather than trying to write a wrapper?

git clone https://github.com/raspberrypi/userland
cd userland
./buildme


Source code is here: https://github.com/raspberrypi/userland ... spiStill.c
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

User avatar
Seb.26
Posts: 29
Joined: Mon Jul 07, 2014 12:06 pm

Re: Raspistill -s signal mode

Sun Sep 30, 2018 9:33 am

Hello,
thanks for your answer.
DougieLawson wrote:
Sat Sep 29, 2018 4:00 pm
Why not pull the source code for raspistill and add your new function to it rather than trying to write a wrapper?
Mainly because I'm too lazy to start deep study of userland code ... :oops:

But, after quick read, looks like raspistill use temp file name for writting and them renaming the file when donde :

Code: Select all

[u]RaspiStill.c :: 1660[/u]
MMAL_STATUS_T create_filenames(char** finalName, char** tempName, char * pattern, int frame)
{
   *finalName = NULL;
   *tempName = NULL;
   if (0 > asprintf(finalName, pattern, frame) ||
       0 > asprintf(tempName, "%s~", *finalName))
   {
      if (*finalName != NULL)
      {
         free(*finalName);
      }
      return MMAL_ENOMEM;    // It may be some other error, but it is not worth getting it right
   }
   return MMAL_SUCCESS;
}
So when file is here, it must be ready ... :mrgreen:

User avatar
Seb.26
Posts: 29
Joined: Mon Jul 07, 2014 12:06 pm

Re: Raspistill -s signal mode

Tue Oct 16, 2018 12:26 pm

Hello world,
since my last post, I have wrote my program and it works fine, but it's slow to write a file from raspiyuv, then open this file from my program, edit it and write it again ...

It's time to go deeper ... yes DougieLawson : you said it :mrgreen:

I have copy 'userland-master' from GIT onto my PI and launch 'buildme', all looks fine.

Now I want to edit raspistill.c / raspiyuv.c and rebuild them, but how could I compile only modified apps and not all 'userland' project ?

Thanks.

User avatar
DougieLawson
Posts: 34114
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Raspistill -s signal mode

Wed Oct 17, 2018 6:57 pm

I think there's a CMake file in there that generates a Makefile. With that you'll only recompile code that's changed.

Read the buildme script to see what it's doing.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

Return to “C/C++”