Understanding the camera roll

The camera roll is a directory on the target where the camera application saves file. When you use a camera roll, it manages the filenames of video files to ensure that they are unique. You call the camera_roll_open_video() to get a unique filename that you pass as an argument when you call the camera_start_video. Each filename uses a date and time stamp to ensure uniqueness and they are written to the directory you specified using -r when the Sensor service was started. The Camera library also manages writing access to the files for you when you use the camera roll to ensure that only one process writes to a file.

It isn't mandatory to use the camera roll. Optionally, you can choose to specify the name of the file to when you call camera_start_video() using the filename argument. If you have a requirement to do this, you are responsible for managing the write-access to file, ensuring that filename is unique, and managing any file descriptors associated with the file.

Here's a code snippet that shows how to use the first camera configured on a system to use a camera roll to start recording a video:
Note: It's presumed that you have connected to the camera, set the viewfinder mode, and started the viewfinder. The example also presumes you have the Screen code in place.
...
...
int main(int argc, char *argv[])
{
    camera_handle_t cameraHandle;
    // Open the first Cameera
    camera_open(CAMERA_UNIT_1, CAMERA_MODE_RW | CAMERA_MODE_ROLL, &cameraHandle);
    camera_set_vf_mode(cameraHandle, CAMERA_VFMODE_VIDEO);
    camera_start_viewfinder(cameraHandle, NULL, NULL, NULL);
    ...
    ...
    //Screen code to handle showing the video on the display
    ...
    ...
    ...
    char* rollFilename = (char*) malloc(sizeof(char) * CAMERA_ROLL_NAMELEN);
    camera_roll_open_video(cameraHandle, &fd, rollFilename,
                           CAMERA_ROLL_NAMELEN, CAMERA_ROLL_VIDEO_FMT_MP4);
    camera_start_video(cameraHandle, rollFilename, NULL, NULL, NULL);
    
    ...
    ...
    
}