Mon Mar 12 2012 21:38:32

Asterisk developer's documentation


console_video.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

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

Defines

#define CONSOLE_VIDEO_CMDS   "console {device}"
#define MAX_VIDEO_SOURCES   9
#define SRC_WIN_H   60
#define SRC_WIN_W   80

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
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
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
int reset_board (struct board *b)
 reset the board to blank

Variables

struct grab_descconsole_grabbers []
int console_video_formats

Define 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

Definition at line 47 of file console_video.h.

Referenced by handle_mousedown(), and sdl_setup().

#define SRC_WIN_W   80

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.

                 {   /* which window are we dragging */
   DRAG_NONE,
   DRAG_LOCAL, /* local video */
   DRAG_REMOTE,   /* remote video */
   DRAG_DIALED,   /* dialed number */
   DRAG_INPUT, /* input window */
   DRAG_MESSAGE,  /* message window */
   DRAG_PIP,   /* picture in picture */
};
enum kb_output
Enumerator:
KO_NONE 
KO_INPUT 
KO_DIALED 
KO_MESSAGE 

Definition at line 105 of file console_video.h.

               {
   KO_NONE,
   KO_INPUT,   /* the local input window */
   KO_DIALED,  /* the 'dialed number' window */
   KO_MESSAGE, /* the 'message' window */
};

Function Documentation

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

Definition at line 121 of file console_video.c.

Referenced by console_cmd().

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

Definition at line 126 of file console_video.c.

Referenced by store_config_core().

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

Definition at line 131 of file console_video.c.

References ast_log(), and LOG_NOTICE.

Referenced by oss_new(), and store_config().

{
   ast_log(LOG_NOTICE, "voice only, console video support not present\n");
}
void console_video_uninit ( struct video_desc *  env)

Definition at line 136 of file console_video.c.

Referenced by oss_hangup().

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

Definition at line 116 of file console_video.c.

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

deallocates memory space for a board

Definition at line 320 of file console_board.c.

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

Referenced by cleanup_sdl().

{
   if (b) {
      /* deletes the text */
      if (b->text)
         ast_free (b->text);
      /* deallocates the blank surface */
      SDL_FreeSurface(b->blank);
      /* deallocates the board */
      ast_free(b);
   }
}
void fbuf_free ( struct fbuf_t )

Referenced by dec_uninit().

int get_gui_startup ( struct video_desc *  env)

Definition at line 140 of file console_video.c.

Referenced by store_config().

{
   return 0; /* no gui here */
}
struct video_desc* get_video_desc ( struct ast_channel c) [read]

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().

{
   struct chan_oss_pvt *o = c ? c->tech_pvt : find_desc(oss_active);
   return o ? o->env : NULL;
}
void move_message_board ( struct board b,
int  dy 
)

Definition at line 198 of file console_board.c.

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

Referenced by eventhandler().

{
   int cur = b->cur_line + dy;
   if (cur < 0)
      cur = 0;
   else if (cur >= b->v_h - b->p_h)
      cur = b->v_h - b->p_h - 1;
   b->cur_line = cur;
   render_board(b);
}
int print_message ( struct board b,
const char *  s 
)

Definition at line 227 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().

{
   int i, l, row, col;
   char *dst;

   if (ast_strlen_zero(s))
      return 0;

   l = strlen(s);
   row = 0;
   col = b->cur_col;
   /* First, only check how much space we need.
    * Starting from the current print position, we move
    * it forward and down (if necessary) according to input
    * characters (including newlines, tabs, backspaces...).
    * At the end, row tells us how many rows to scroll, and
    * col (ignored) is the final print position.
    */
   for (i = 0; i < l; i++) {
      switch (s[i]) {
      case '\r':
         col = 0;
         break;
      case '\n':
         col = 0;
         row++;
         break;
      case '\b':
         if (col > 0)
            col--;
         break;
      default:
         if (s[i] < 32) /* signed, so take up to 127 */
            break;
         col++;
         if (col >= b->v_w) {
            col -= b->v_w;
            row++;
         }
         break;
      }
   }
   /* scroll the text window */
   if (row > 0) { /* need to scroll by 'row' rows */
      memcpy(b->text, b->text + row * b->v_w, b->v_w * (b->v_h - row));
      /* clean the destination area */
      dst = b->text + b->v_w * (b->v_h - row - 1) + b->cur_col;
      memset(dst, ' ', b->v_w - b->cur_col + b->v_w * row);
   }
   /* now do the actual printing. The print position is 'row' lines up
    * from the bottom of the buffer, start at the same 'cur_col' as before.
    * dst points to the beginning of the current line.
    */
   dst = b->text + b->v_w * (b->v_h - row - 1); /* start of current line */
   col = b->cur_col;
   for (i = 0; i < l; i++) {
      switch (s[i]) {
      case '\r':
         col = 0;
         break;
      case '\n':  /* move to beginning of next line */
         dst[col] = '\0'; /* mark the rest of the line as empty */
         col = 0;
         dst += b->v_w;
         break;
      case '\b':  /* one char back */
         if (col > 0)
            col--;
         dst[col] = ' '; /* delete current char */
         break;
      default:
         if (s[i] < 32) /* signed, so take up to 127 */
            break;   /* non printable */
         dst[col] = s[i];  /* store character */
         col++;
         if (col >= b->v_w) {
            col -= b->v_w;
            dst += b->v_w;
         }
         break;
      }
   }
   dst[col] = '\0'; /* the current position is empty */
   b->cur_col = col;
   /* everything is printed now, must do the rendering */
   render_board(b);
   return 1;
}
const char* read_message ( const struct board b)

return the whole text from a board

Definition at line 210 of file console_board.c.

References board::text.

Referenced by keypad_pick_up().

{
   return b->text;
}
int reset_board ( struct board b)

reset the board to blank

Definition at line 215 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().

{
   memset(b->text, ' ', b->v_w * b->v_h); /* fill with spaces */
   b->cur_col = 0;
   b->cur_line = 0;
   render_board(b);
   return 0;
}

Variable Documentation

Referenced by turn_on_off().

Definition at line 145 of file console_video.c.

Referenced by load_module(), and oss_new().