Asterisk - The Open Source Telephony Project GIT-master-a358458
console_video.h
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2007 Luigi Rizzo
5 *
6 * See http://www.asterisk.org for more information about
7 * the Asterisk project. Please do not directly contact
8 * any of the maintainers of this project for assistance;
9 * the project provides a web site, mailing lists and IRC
10 * channels for your use.
11 *
12 * This program is free software, distributed under the terms of
13 * the GNU General Public License Version 2. See the LICENSE file
14 * at the top of the source tree.
15 */
16
17/*
18 * Common header for console video support
19 *
20 * $Revision$
21 */
22
23#ifndef CONSOLE_VIDEO_H
24#define CONSOLE_VIDEO_H
25
26#if !defined(HAVE_VIDEO_CONSOLE) || !defined(HAVE_FFMPEG)
27#define CONSOLE_VIDEO_CMDS \
28 "console {device}"
29#else
30
31#include <ffmpeg/avcodec.h>
32#ifndef OLD_FFMPEG
33#include <ffmpeg/swscale.h> /* requires a recent ffmpeg */
34#endif
35
36#define CONSOLE_VIDEO_CMDS \
37 "console {videodevice|videocodec" \
38 "|video_size|bitrate|fps|qmin" \
39 "|sendvideo|keypad" \
40 "|sdl_videodriver" \
41 "|device|startgui|stopgui" \
42 "}"
43
44#endif /* HAVE_VIDEO_CONSOLE and others */
45
46#define SRC_WIN_W 80 /* width of video thumbnails */
47#define SRC_WIN_H 60 /* height of video thumbnails */
48/* we only support a limited number of video sources in the GUI,
49 * because we need screen estate to switch between them.
50 */
51#define MAX_VIDEO_SOURCES 9
52
53/*
54 * In many places we use buffers to store the raw frames (but not only),
55 * so here is a structure to keep all the info. data = NULL means the
56 * structure is not initialized, so the other fields are invalid.
57 * size = 0 means the buffer is not malloc'ed so we don't have to free it.
58 */
59struct fbuf_t { /* frame buffers, dynamically allocated */
60 uint8_t *data; /* memory, malloced if size > 0, just reference
61 * otherwise */
62 int size; /* total size in bytes */
63 int used; /* space used so far */
64 int ebit; /* bits to ignore at the end */
65 int x; /* origin, if necessary */
66 int y;
67 int w; /* size */
68 int h;
70 /* offsets and size of the copy in Picture-in-Picture mode */
71 int win_x;
72 int win_y;
73 int win_w;
74 int win_h;
75};
76
77void fbuf_free(struct fbuf_t *);
78
79/* descriptor for a grabber */
80struct grab_desc {
81 const char *name;
82 void *(*open)(const char *name, struct fbuf_t *geom, int fps);
83 struct fbuf_t *(*read)(void *d);
84 void (*move)(void *d, int dx, int dy);
85 void *(*close)(void *d);
86};
87
88extern struct grab_desc *console_grabbers[];
89
90struct video_desc; /* opaque type for video support */
91struct video_desc *get_video_desc(struct ast_channel *c);
92
93/* linked by console_video.o */
94int console_write_video(struct ast_channel *chan, struct ast_frame *f);
95extern int console_video_formats;
96int console_video_cli(struct video_desc *env, const char *var, int fd);
97int console_video_config(struct video_desc **penv, const char *var, const char *val);
98void console_video_uninit(struct video_desc *env);
99void console_video_start(struct video_desc *env, struct ast_channel *owner);
100int get_gui_startup(struct video_desc* env);
101
102/* console_board.c */
103
104/* Where do we send the keyboard/keypad output */
107 KO_INPUT, /* the local input window */
108 KO_DIALED, /* the 'dialed number' window */
109 KO_MESSAGE, /* the 'message' window */
110};
111
112enum drag_window { /* which window are we dragging */
114 DRAG_LOCAL, /* local video */
115 DRAG_REMOTE, /* remote video */
116 DRAG_DIALED, /* dialed number */
117 DRAG_INPUT, /* input window */
118 DRAG_MESSAGE, /* message window */
119 DRAG_PIP, /* picture in picture */
120};
121
122/*! \brief support for drag actions */
123struct drag_info {
124 int x_start; /* last known mouse position */
127};
128/*! \brief info related to the gui: button status, mouse coords, etc. */
129struct board;
130/* !\brief print a message on a board */
131void move_message_board(struct board *b, int dy);
132int print_message(struct board *b, const char *s);
133
134/*! \brief return the whole text from a board */
135const char *read_message(const struct board *b);
136
137/*! \brief reset the board to blank */
138int reset_board(struct board *b);
139
140/*! \brief deallocates memory space for a board */
141void delete_board(struct board *b);
142#endif /* CONSOLE_VIDEO_H */
143/* end of file */
#define var
Definition: ast_expr2f.c:605
void console_video_start(struct video_desc *env, struct ast_channel *owner)
struct video_desc * get_video_desc(struct ast_channel *c)
void console_video_uninit(struct video_desc *env)
int console_write_video(struct ast_channel *chan, struct ast_frame *f)
void delete_board(struct board *b)
deallocates memory space for a board
struct grab_desc * console_grabbers[]
drag_window
@ DRAG_LOCAL
@ DRAG_INPUT
@ DRAG_PIP
@ DRAG_NONE
@ DRAG_REMOTE
@ DRAG_DIALED
@ DRAG_MESSAGE
kb_output
@ KO_INPUT
@ KO_MESSAGE
@ KO_NONE
@ KO_DIALED
void move_message_board(struct board *b, int dy)
const char * read_message(const struct board *b)
return the whole text from a board
int console_video_cli(struct video_desc *env, const char *var, int fd)
int console_video_formats
void fbuf_free(struct fbuf_t *)
int get_gui_startup(struct video_desc *env)
int console_video_config(struct video_desc **penv, const char *var, const char *val)
int reset_board(struct board *b)
reset the board to blank
int print_message(struct board *b, const char *s)
Definition: cdr/env.py:1
Main Channel structure associated with a channel.
Data structure associated with a single frame of data.
support for drag actions
enum drag_window drag_window
int size
Definition: console_video.h:62
int used
Definition: console_video.h:63
int win_x
Definition: console_video.h:71
int pix_fmt
Definition: console_video.h:69
int win_y
Definition: console_video.h:72
uint8_t * data
Definition: console_video.h:60
int win_h
Definition: console_video.h:74
int win_w
Definition: console_video.h:73
int ebit
Definition: console_video.h:64
void(* move)(void *d, int dx, int dy)
Definition: console_video.h:84
const char * name
Definition: console_video.h:81
Definition: ast_expr2.c:325
static struct test_val b
static struct test_val d
static struct test_val c