AiCPlayer
Interface of aic vm - for rendering aspect, sensors, video records
Data Structures | Macros | Typedefs | Functions
grabber.h File Reference

grabber records videos or snapshots from ampq messages More...

#include <libavformat/avformat.h>
#include <libavutil/frame.h>
#include <libswscale/swscale.h>
#include <pthread.h>
#include <stdint.h>
#include <X11/Xlib.h>
#include "buffer_sizes.h"
#include "socket.h"
Include dependency graph for grabber.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  read_args
 Shared structure between recv thread and grabber thread. More...
 
struct  thread_args
 Struct holding the state of a recording (filename/lock) More...
 
struct  OutputStream
 A wrapper around a single output AVStream. More...
 

Macros

#define PORT_GRAB   32500
 Port open on the VM. More...
 
#define STREAM_DURATION   60.0
 Frames to record per second. More...
 
#define STREAM_FRAME_RATE   60
 FPS of the stream. More...
 
#define STREAM_PIX_FMT   AV_PIX_FMT_YUV420P
 Pixel format of the stream (yuv420p) More...
 
#define SCALE_FLAGS   SWS_BICUBIC
 
#define CLIP(X)   ((X) > 255 ? 255 : (X) < 0 ? 0 : X)
 
#define RGB2Y(R, G, B)   CLIP(((66 * (R) + 129 * (G) + 25 * (B) + 128) >> 8) + 16)
 
#define RGB2U(R, G, B)   CLIP(((-38 * (R) -74 * (G) + 112 * (B) + 128) >> 8) + 128)
 
#define RGB2V(R, G, B)   CLIP(((112 * (R) -94 * (G) -18 * (B) + 128) >> 8) + 128)
 

Typedefs

typedef struct read_args s_read_args
 Shared structure between recv thread and grabber thread. More...
 
typedef struct thread_args s_thread_args
 Struct holding the state of a recording (filename/lock) More...
 
typedef struct OutputStream OutputStream
 A wrapper around a single output AVStream. More...
 

Functions

void grab_snapshot (char *snap_filename)
 
int ffmpeg_grabber (void *arg)
 Function passed to a thread in order to detect format encoding - encode frame- and write in a file. More...
 
unsigned char * xgrabber ()
 
void * grab_handler_sock ()
 Start/Stop from socket connection via protobuf message. More...
 
void * grab_handler_amqp (void *args)
 
void grabber_set_path_results (char *results)
 Set the static path to the screenshots/movies dir. More...
 
void grabber_set_display (Display *display)
 Set the static X display pointer. More...
 

Detailed Description

grabber records videos or snapshots from ampq messages

Author
Alexandre BRUXELLE for ZENIKA

The ffmpeg part the code is inspired by the libavformat API example.

Definition in file grabber.h.

Macro Definition Documentation

#define CLIP (   X)    ((X) > 255 ? 255 : (X) < 0 ? 0 : X)

Definition at line 34 of file grabber.h.

#define PORT_GRAB   32500

Port open on the VM.

Definition at line 22 of file grabber.h.

#define RGB2U (   R,
  G,
 
)    CLIP(((-38 * (R) -74 * (G) + 112 * (B) + 128) >> 8) + 128)

Definition at line 38 of file grabber.h.

#define RGB2V (   R,
  G,
 
)    CLIP(((112 * (R) -94 * (G) -18 * (B) + 128) >> 8) + 128)

Definition at line 39 of file grabber.h.

#define RGB2Y (   R,
  G,
 
)    CLIP(((66 * (R) + 129 * (G) + 25 * (B) + 128) >> 8) + 16)

Definition at line 37 of file grabber.h.

#define SCALE_FLAGS   SWS_BICUBIC

Definition at line 31 of file grabber.h.

#define STREAM_DURATION   60.0

Frames to record per second.

Definition at line 25 of file grabber.h.

#define STREAM_FRAME_RATE   60

FPS of the stream.

Definition at line 27 of file grabber.h.

#define STREAM_PIX_FMT   AV_PIX_FMT_YUV420P

Pixel format of the stream (yuv420p)

Definition at line 29 of file grabber.h.

Typedef Documentation

typedef struct OutputStream OutputStream

A wrapper around a single output AVStream.

typedef struct read_args s_read_args

Shared structure between recv thread and grabber thread.

typedef struct thread_args s_thread_args

Struct holding the state of a recording (filename/lock)

Function Documentation

int ffmpeg_grabber ( void *  arg)

Function passed to a thread in order to detect format encoding - encode frame- and write in a file.

Parameters
argsparameter for file's name of the video record

Definition at line 420 of file grabber.c.

Here is the caller graph for this function:

void* grab_handler_amqp ( void *  args)

Definition at line 804 of file grabber.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void* grab_handler_sock ( )

Start/Stop from socket connection via protobuf message.

Parameters
data->flagRecordingto protect of recording from amqp messages

Here is the caller graph for this function:

void grab_snapshot ( char *  snap_filename)

Definition at line 584 of file grabber.c.

Here is the caller graph for this function:

void grabber_set_display ( Display *  display)

Set the static X display pointer.

Parameters
displaythe X display pointer

Definition at line 68 of file grabber.c.

void grabber_set_path_results ( char *  results)

Set the static path to the screenshots/movies dir.

Parameters
resultsa pointer to the string

Definition at line 73 of file grabber.c.

Here is the caller graph for this function:

unsigned char* xgrabber ( )

Definition at line 510 of file grabber.c.