48 #define MT9F002_WIDTH 1408
49 #define MT9F002_HEIGHT 2112
50 #define BEBOP_FRONT_CAMERA_WIDTH 272
51 #define BEBOP_FRONT_CAMERA_HEIGHT 272
54 #ifndef BEBOP_FRONT_CAMERA_SHOT_PATH
55 #define BEBOP_FRONT_CAMERA_SHOT_PATH /data/ftp/internal_000/images
84 udp_socket_create(&video_sock, STRINGIFY(BEBOP_FRONT_CAMERA_HOST), BEBOP_FRONT_CAMERA_PORT_OUT, -1,
85 BEBOP_FRONT_CAMERA_BROADCAST);
97 printf(
"[bebop_front_camera-thread] Could not start capture of %s.\n", bebop_front_camera.
dev->
name);
143 printf(
"[bebop_front_camera] Could not initialize the v4l-subdev1 subdevice.\n");
149 if (bebop_front_camera.
dev == NULL) {
150 printf(
"[bebop_front_camera] Could not initialize the /dev/video1 V4L2 device.\n");
157 if (system(save_name) != 0) {
176 printf(
"[vievideo] Could not create streaming thread.\n");
197 printf(
"[bebop_front_camera] Could not stop capture of %s.\n", bebop_front_camera.
dev->
name);
212 if (access(save_name, F_OK) == -1) {
213 FILE *fp = fopen(save_name,
"w");
215 printf(
"[bebop_front_camera-thread] Could not write shot %s.\n", save_name);
218 char pgm_header[] =
"P5\n272 272\n255\n";
219 fwrite(pgm_header,
sizeof(
char), 15, fp);
226 fp = fopen(save_name,
"w");
231 fp = fopen(save_name,
"w");
#define BEBOP_FRONT_CAMERA_SHOT_PATH
uint32_t buf_size
The buffer size.
bool_t v4l2_start_capture(struct v4l2_device *dev)
Start capturing images in streaming mode (Thread safe)
#define BEBOP_FRONT_CAMERA_WIDTH
volatile bool_t is_streaming
When the device is streaming.
void v4l2_image_free(struct v4l2_device *dev, struct image_t *img)
Free the image and enqueue the buffer (Thread safe) This must be done after processing the image...
void v4l2_image_get(struct v4l2_device *dev, struct image_t *img)
Get the latest image buffer and lock it (Thread safe, BLOCKING) This functions blocks until image acc...
Capture images from a V4L2 device (Video for Linux 2)
static void * bebop_front_camera_thread(void *data)
Handles all the video streaming and saving of the image shots This is a sepereate thread...
void image_create(struct image_t *img, uint16_t width, uint16_t height, enum image_type type)
Create a new image.
Easily create and use UDP sockets.
Get live images from a RTP/UDP stream and save pictures on internal memory.
bool_t v4l2_stop_capture(struct v4l2_device *dev)
Stop capturing of the image stream (Thread safe) This function is blocking until capturing thread is ...
void rtp_frame_send(struct UdpSocket *udp, struct image_t *img, uint8_t format_code, uint8_t quality_code, uint8_t has_dri_header, uint32_t delta_t)
Send an RTP frame.
struct bebopfrontcamera_t bebop_front_camera
uint16_t shot_number
The last shot number.
void jpeg_encode_image(struct image_t *in, struct image_t *out, uint32_t quality_factor, bool_t add_dri_header)
Encode an YUV422 image.
void bebop_front_camera_stop(void)
Stops the streaming This could take some time, because the thread is stopped asynchronous.
Image helper functions like resizing, color filter, converters...
void BayerToYUV(struct image_t *Input, struct image_t *out, int RedX, int RedY)
Decode Bayer Pattern.
#define BEBOP_FRONT_CAMERA_HEIGHT
struct v4l2_device * dev
The V4L2 device that is used for the video stream.
void * buf
Image buffer (depending on the image_type)
void bebop_front_camera_periodic(void)
A dummy for now.
volatile bool_t take_shot
Wether to take an image.
void bebop_front_camera_take_shot(bool_t take)
bool_t v4l2_init_subdev(char *subdev_name, uint8_t pad, uint8_t which, uint16_t code, uint16_t width, uint16_t height)
Initialize a V4L2 subdevice.
Encode images with the use of the JPEG encoding.
void bebop_front_camera_init(void)
Initialize the view video.
char * name
The name of the device.
void bebop_front_camera_start(void)
Start with streaming.
static void bebop_front_camera_save_shot(struct image_t *img_color, struct image_t *img_jpeg, struct image_t *raw_img)
int udp_socket_create(struct UdpSocket *sock, char *host, int port_out, int port_in, bool_t broadcast)
Create UDP socket and bind it.
UYVY format (uint16 per pixel)
Encodes a vide stream with RTP (JPEG)
struct v4l2_device * v4l2_init(char *device_name, uint16_t width, uint16_t height, uint8_t buffers_cnt, uint32_t _pixelformat)
Initialize a V4L2(Video for Linux 2) device.
An JPEG encoded image (not per pixel encoded)