Wed Jan 8 2020 09:50:10

Asterisk developer's documentation


console_video.h File Reference

Go to the source code of this file.

Data Structures

struct  drag_info
 support for drag actions More...
 
struct  fbuf_t
 
struct  grab_desc
 

Macros

#define CONSOLE_VIDEO_CMDS   "console {device}"
 
#define MAX_VIDEO_SOURCES   9
 
#define SRC_WIN_H   60 /* height of video thumbnails */
 
#define SRC_WIN_W   80 /* width of video thumbnails */
 

Enumerations

enum  drag_window {
  DRAG_NONE, DRAG_LOCAL, DRAG_REMOTE, DRAG_DIALED,
  DRAG_INPUT, DRAG_MESSAGE, DRAG_PIP
}
 
enum  kb_output { KO_NONE, KO_INPUT, KO_DIALED, KO_MESSAGE }
 

Functions

int console_video_cli (struct video_desc *env, const char *var, int fd)
 
int console_video_config (struct video_desc **penv, const char *var, const char *val)
 
void console_video_start (struct video_desc *env, struct ast_channel *owner)
 
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 More...
 
void fbuf_free (struct fbuf_t *)
 
int get_gui_startup (struct video_desc *env)
 
struct video_desc * get_video_desc (struct ast_channel *c)
 return the pointer to the video descriptor More...
 
void move_message_board (struct board *b, int dy)
 
int print_message (struct board *b, const char *s)
 
const char * read_message (const struct board *b)
 return the whole text from a board More...
 
int reset_board (struct board *b)
 reset the board to blank More...
 

Variables

struct grab_descconsole_grabbers []
 
int console_video_formats
 

Macro Definition Documentation

#define CONSOLE_VIDEO_CMDS   "console {device}"

Definition at line 27 of file console_video.h.

Referenced by console_cmd().

#define MAX_VIDEO_SOURCES   9

Definition at line 51 of file console_video.h.

#define SRC_WIN_H   60 /* height of video thumbnails */

Definition at line 47 of file console_video.h.

Referenced by handle_mousedown(), and sdl_setup().

#define SRC_WIN_W   80 /* width of video thumbnails */

Definition at line 46 of file console_video.h.

Referenced by handle_mousedown(), and sdl_setup().

Enumeration Type Documentation

Enumerator
DRAG_NONE 
DRAG_LOCAL 
DRAG_REMOTE 
DRAG_DIALED 
DRAG_INPUT 
DRAG_MESSAGE 
DRAG_PIP 

Definition at line 112 of file console_video.h.

112  { /* which window are we dragging */
113  DRAG_NONE,
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 };
enum kb_output
Enumerator
KO_NONE 
KO_INPUT 
KO_DIALED 
KO_MESSAGE 

Definition at line 105 of file console_video.h.

105  {
106  KO_NONE,
107  KO_INPUT, /* the local input window */
108  KO_DIALED, /* the 'dialed number' window */
109  KO_MESSAGE, /* the 'message' window */
110 };

Function Documentation

int console_video_cli ( struct video_desc *  env,
const char *  var,
int  fd 
)

Definition at line 125 of file console_video.c.

Referenced by console_cmd().

126 {
127  return 1; /* nothing matched */
128 }
int console_video_config ( struct video_desc **  penv,
const char *  var,
const char *  val 
)

Definition at line 130 of file console_video.c.

Referenced by store_config_core().

131 {
132  return 1; /* no configuration */
133 }
void console_video_start ( struct video_desc *  env,
struct ast_channel owner 
)

Definition at line 135 of file console_video.c.

References ast_log(), and LOG_NOTICE.

Referenced by oss_new(), and store_config().

136 {
137  ast_log(LOG_NOTICE, "voice only, console video support not present\n");
138 }
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
Definition: logger.c:1207
#define LOG_NOTICE
Definition: logger.h:133
void console_video_uninit ( struct video_desc *  env)

Definition at line 140 of file console_video.c.

Referenced by oss_hangup().

141 {
142 }
int console_write_video ( struct ast_channel chan,
struct ast_frame f 
)

Definition at line 120 of file console_video.c.

121 {
122  return 0; /* writing video not supported */
123 }
void delete_board ( struct board b)

deallocates memory space for a board

Definition at line 324 of file console_board.c.

References ast_free, board::blank, and board::text.

Referenced by cleanup_sdl().

325 {
326  if (b) {
327  /* deletes the text */
328  if (b->text)
329  ast_free (b->text);
330  /* deallocates the blank surface */
331  SDL_FreeSurface(b->blank);
332  /* deallocates the board */
333  ast_free(b);
334  }
335 }
SDL_Surface * blank
Definition: console_board.c:61
char * text
Definition: console_board.c:77
#define ast_free(a)
Definition: astmm.h:97
void fbuf_free ( struct fbuf_t )

Referenced by dec_uninit().

int get_gui_startup ( struct video_desc *  env)

Definition at line 144 of file console_video.c.

Referenced by store_config().

145 {
146  return 0; /* no gui here */
147 }
struct video_desc* get_video_desc ( struct ast_channel c)

return the pointer to the video descriptor

Definition at line 309 of file chan_oss.c.

References chan_oss_pvt::env, find_desc(), and ast_channel::tech_pvt.

Referenced by oss_new().

310 {
311  struct chan_oss_pvt *o = c ? c->tech_pvt : find_desc(oss_active);
312  return o ? o->env : NULL;
313 }
void * tech_pvt
Definition: channel.h:744
static char * oss_active
Definition: chan_oss.c:306
descriptor for one of our channels.
Definition: chan_oss.c:247
static struct chan_oss_pvt * find_desc(const char *dev)
returns a pointer to the descriptor with the given name
Definition: chan_oss.c:367
struct video_desc * env
Definition: chan_oss.c:283
void move_message_board ( struct board b,
int  dy 
)

Definition at line 202 of file console_board.c.

References board::cur_line, board::p_h, render_board(), and board::v_h.

Referenced by eventhandler().

203 {
204  int cur = b->cur_line + dy;
205  if (cur < 0)
206  cur = 0;
207  else if (cur >= b->v_h - b->p_h)
208  cur = b->v_h - b->p_h - 1;
209  b->cur_line = cur;
210  render_board(b);
211 }
int p_h
Definition: console_board.c:65
int cur_line
Definition: console_board.c:71
static void render_board(struct board *b)
int v_h
Definition: console_board.c:63
int print_message ( struct board b,
const char *  s 
)

Definition at line 231 of file console_board.c.

References ast_strlen_zero(), board::cur_col, render_board(), board::text, board::v_h, and board::v_w.

Referenced by handle_keyboard_input(), handle_mousedown(), keypad_digit(), keypad_pick_up(), and update_device_info().

232 {
233  int i, l, row, col;
234  char *dst;
235 
236  if (ast_strlen_zero(s))
237  return 0;
238 
239  l = strlen(s);
240  row = 0;
241  col = b->cur_col;
242  /* First, only check how much space we need.
243  * Starting from the current print position, we move
244  * it forward and down (if necessary) according to input
245  * characters (including newlines, tabs, backspaces...).
246  * At the end, row tells us how many rows to scroll, and
247  * col (ignored) is the final print position.
248  */
249  for (i = 0; i < l; i++) {
250  switch (s[i]) {
251  case '\r':
252  col = 0;
253  break;
254  case '\n':
255  col = 0;
256  row++;
257  break;
258  case '\b':
259  if (col > 0)
260  col--;
261  break;
262  default:
263  if (s[i] < 32) /* signed, so take up to 127 */
264  break;
265  col++;
266  if (col >= b->v_w) {
267  col -= b->v_w;
268  row++;
269  }
270  break;
271  }
272  }
273  /* scroll the text window */
274  if (row > 0) { /* need to scroll by 'row' rows */
275  memcpy(b->text, b->text + row * b->v_w, b->v_w * (b->v_h - row));
276  /* clean the destination area */
277  dst = b->text + b->v_w * (b->v_h - row - 1) + b->cur_col;
278  memset(dst, ' ', b->v_w - b->cur_col + b->v_w * row);
279  }
280  /* now do the actual printing. The print position is 'row' lines up
281  * from the bottom of the buffer, start at the same 'cur_col' as before.
282  * dst points to the beginning of the current line.
283  */
284  dst = b->text + b->v_w * (b->v_h - row - 1); /* start of current line */
285  col = b->cur_col;
286  for (i = 0; i < l; i++) {
287  switch (s[i]) {
288  case '\r':
289  col = 0;
290  break;
291  case '\n': /* move to beginning of next line */
292  dst[col] = '\0'; /* mark the rest of the line as empty */
293  col = 0;
294  dst += b->v_w;
295  break;
296  case '\b': /* one char back */
297  if (col > 0)
298  col--;
299  dst[col] = ' '; /* delete current char */
300  break;
301  default:
302  if (s[i] < 32) /* signed, so take up to 127 */
303  break; /* non printable */
304  dst[col] = s[i]; /* store character */
305  col++;
306  if (col >= b->v_w) {
307  col -= b->v_w;
308  dst += b->v_w;
309  }
310  break;
311  }
312  }
313  dst[col] = '\0'; /* the current position is empty */
314  b->cur_col = col;
315  /* everything is printed now, must do the rendering */
316  render_board(b);
317  return 1;
318 }
int cur_col
Definition: console_board.c:70
char * text
Definition: console_board.c:77
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:63
static void render_board(struct board *b)
int v_h
Definition: console_board.c:63
int v_w
Definition: console_board.c:64
const char* read_message ( const struct board b)

return the whole text from a board

Definition at line 214 of file console_board.c.

References board::text.

Referenced by keypad_pick_up().

215 {
216  return b->text;
217 }
char * text
Definition: console_board.c:77
int reset_board ( struct board b)

reset the board to blank

Definition at line 219 of file console_board.c.

References board::cur_col, board::cur_line, render_board(), board::text, board::v_h, and board::v_w.

Referenced by keypad_pick_up(), and update_device_info().

220 {
221  memset(b->text, ' ', b->v_w * b->v_h); /* fill with spaces */
222  b->cur_col = 0;
223  b->cur_line = 0;
224  render_board(b);
225  return 0;
226 }
int cur_col
Definition: console_board.c:70
int cur_line
Definition: console_board.c:71
char * text
Definition: console_board.c:77
static void render_board(struct board *b)
int v_h
Definition: console_board.c:63
int v_w
Definition: console_board.c:64

Variable Documentation

struct grab_desc* console_grabbers[]

Referenced by turn_on_off().

int console_video_formats

Definition at line 149 of file console_video.c.

Referenced by load_module(), and oss_new().