RAPICAM_3-15-2015
RaspiVidYUV.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <sysexits.h>
#include "bcm_host.h"
#include "interface/vcos/vcos.h"
#include "interface/mmal/mmal.h"
#include "interface/mmal/mmal_logging.h"
#include "interface/mmal/mmal_buffer.h"
#include "interface/mmal/util/mmal_util.h"
#include "interface/mmal/util/mmal_util_params.h"
#include "interface/mmal/util/mmal_default_components.h"
#include "interface/mmal/util/mmal_connection.h"
#include "RaspiCamControl.h"
#include "RaspiPreview.h"
#include "RaspiCLI.h"
#include <semaphore.h>

Classes

struct  PORT_USERDATA
 
struct  RASPIVIDYUV_STATE_S
 

Macros

#define _GNU_SOURCE
 
#define VERSION_STRING   "v1.3.12"
 
#define MMAL_CAMERA_PREVIEW_PORT   0
 
#define MMAL_CAMERA_VIDEO_PORT   1
 
#define MMAL_CAMERA_CAPTURE_PORT   2
 
#define VIDEO_FRAME_RATE_NUM   30
 
#define VIDEO_FRAME_RATE_DEN   1
 
#define VIDEO_OUTPUT_BUFFERS_NUM   3
 Video render needs at least 2 buffers.
 
#define WAIT_METHOD_NONE   0
 
#define WAIT_METHOD_TIMED   1
 Cycle between capture and pause for times specified.
 
#define WAIT_METHOD_KEYPRESS   2
 Switch between capture and pause on keypress.
 
#define WAIT_METHOD_SIGNAL   3
 Switch between capture and pause on signal.
 
#define WAIT_METHOD_FOREVER   4
 Run/record forever.
 
#define CommandHelp   0
 Command ID's and Structure defining our command line options.
 
#define CommandWidth   1
 
#define CommandHeight   2
 
#define CommandOutput   3
 
#define CommandVerbose   4
 
#define CommandTimeout   5
 
#define CommandDemoMode   6
 
#define CommandFramerate   7
 
#define CommandTimed   8
 
#define CommandSignal   9
 
#define CommandKeypress   10
 
#define CommandInitialState   11
 
#define CommandCamSelect   12
 
#define CommandSettings   13
 
#define CommandSensorMode   14
 

Typedefs

typedef struct RASPIVIDYUV_STATE_S RASPIVIDYUV_STATE
 

Functions

int mmal_status_to_int (MMAL_STATUS_T status)
 
int main (int argc, const char **argv)
 

Variables

const int ABORT_INTERVAL = 100
 Interval at which we check for an failure abort during capture.
 
FILE * stderr
 
FILE * stdout
 

Detailed Description

Command line program to capture a camera video stream and save file as uncompressed YUV420 data Also optionally display a preview/viewfinder of current camera input.

Date
7th Jan 2014 : James Hughes

Description

2 components are created; camera and preview. Camera component has three ports, preview, video and stills. Preview is connected using standard mmal connections, the video output is written straight to the file in YUV 420 format via the requisite buffer callback. Still port is not used

We use the RaspiCamControl code to handle the specific camera settings. We use the RaspiPreview code to handle the generic preview

Macro Definition Documentation

#define WAIT_METHOD_NONE   0

Capture/Pause switch method Simply capture for time specified

Function Documentation

int main ( int  argc,
const char **  argv 
)

main

int mmal_status_to_int ( MMAL_STATUS_T  status)

Convert a MMAL status return value to a simple boolean of success ALso displays a fault if code is not success

Parameters
statusThe error code to convert
Returns
0 if status is sucess, 1 otherwise