Mon Mar 19 11:30:46 2012

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

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

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

enum drag_window

Enumerator:
DRAG_NONE 
DRAG_LOCAL 
DRAG_REMOTE 
DRAG_DIALED 
DRAG_INPUT 
DRAG_MESSAGE 
DRAG_PIP 

Definition at line 112 of file console_video.h.

00112                  {   /* which window are we dragging */
00113    DRAG_NONE,
00114    DRAG_LOCAL, /* local video */
00115    DRAG_REMOTE,   /* remote video */
00116    DRAG_DIALED,   /* dialed number */
00117    DRAG_INPUT, /* input window */
00118    DRAG_MESSAGE,  /* message window */
00119    DRAG_PIP,   /* picture in picture */
00120 };

enum kb_output

Enumerator:
KO_NONE 
KO_INPUT 
KO_DIALED 
KO_MESSAGE 

Definition at line 105 of file console_video.h.

00105                {
00106    KO_NONE,
00107    KO_INPUT,   /* the local input window */
00108    KO_DIALED,  /* the 'dialed number' window */
00109    KO_MESSAGE, /* the 'message' window */
00110 };


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

00122 {
00123    return 1;   /* nothing matched */
00124 }

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

00127 {
00128    return 1;   /* no configuration */
00129 }

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

00132 {
00133    ast_log(LOG_NOTICE, "voice only, console video support not present\n");
00134 }

void console_video_uninit ( struct video_desc *  env  ) 

Definition at line 136 of file console_video.c.

Referenced by oss_hangup().

00137 {
00138 }

int console_write_video ( struct ast_channel chan,
struct ast_frame f 
)

Definition at line 116 of file console_video.c.

00117 {
00118    return 0;   /* writing video not supported */
00119 }

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

00321 {
00322    if (b) {
00323       /* deletes the text */
00324       if (b->text)
00325          ast_free (b->text);
00326       /* deallocates the blank surface */
00327       SDL_FreeSurface(b->blank);
00328       /* deallocates the board */
00329       ast_free(b);
00330    }
00331 }

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.

00141 {
00142    return 0; /* no gui here */
00143 }

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

00310 {
00311    struct chan_oss_pvt *o = c ? c->tech_pvt : find_desc(oss_active);
00312    return o ? o->env : NULL;
00313 }

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

00199 {
00200    int cur = b->cur_line + dy;
00201    if (cur < 0)
00202       cur = 0;
00203    else if (cur >= b->v_h - b->p_h)
00204       cur = b->v_h - b->p_h - 1;
00205    b->cur_line = cur;
00206    render_board(b);
00207 }

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, and board::v_w.

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

00228 {
00229    int i, l, row, col;
00230    char *dst;
00231 
00232    if (ast_strlen_zero(s))
00233       return 0;
00234 
00235    l = strlen(s);
00236    row = 0;
00237    col = b->cur_col;
00238    /* First, only check how much space we need.
00239     * Starting from the current print position, we move
00240     * it forward and down (if necessary) according to input
00241     * characters (including newlines, tabs, backspaces...).
00242     * At the end, row tells us how many rows to scroll, and
00243     * col (ignored) is the final print position.
00244     */
00245    for (i = 0; i < l; i++) {
00246       switch (s[i]) {
00247       case '\r':
00248          col = 0;
00249          break;
00250       case '\n':
00251          col = 0;
00252          row++;
00253          break;
00254       case '\b':
00255          if (col > 0)
00256             col--;
00257          break;
00258       default:
00259          if (s[i] < 32) /* signed, so take up to 127 */
00260             break;
00261          col++;
00262          if (col >= b->v_w) {
00263             col -= b->v_w;
00264             row++;
00265          }
00266          break;
00267       }
00268    }
00269    /* scroll the text window */
00270    if (row > 0) { /* need to scroll by 'row' rows */
00271       memcpy(b->text, b->text + row * b->v_w, b->v_w * (b->v_h - row));
00272       /* clean the destination area */
00273       dst = b->text + b->v_w * (b->v_h - row - 1) + b->cur_col;
00274       memset(dst, ' ', b->v_w - b->cur_col + b->v_w * row);
00275    }
00276    /* now do the actual printing. The print position is 'row' lines up
00277     * from the bottom of the buffer, start at the same 'cur_col' as before.
00278     * dst points to the beginning of the current line.
00279     */
00280    dst = b->text + b->v_w * (b->v_h - row - 1); /* start of current line */
00281    col = b->cur_col;
00282    for (i = 0; i < l; i++) {
00283       switch (s[i]) {
00284       case '\r':
00285          col = 0;
00286          break;
00287       case '\n':  /* move to beginning of next line */
00288          dst[col] = '\0'; /* mark the rest of the line as empty */
00289          col = 0;
00290          dst += b->v_w;
00291          break;
00292       case '\b':  /* one char back */
00293          if (col > 0)
00294             col--;
00295          dst[col] = ' '; /* delete current char */
00296          break;
00297       default:
00298          if (s[i] < 32) /* signed, so take up to 127 */
00299             break;   /* non printable */
00300          dst[col] = s[i];  /* store character */
00301          col++;
00302          if (col >= b->v_w) {
00303             col -= b->v_w;
00304             dst += b->v_w;
00305          }
00306          break;
00307       }
00308    }
00309    dst[col] = '\0'; /* the current position is empty */
00310    b->cur_col = col;
00311    /* everything is printed now, must do the rendering */
00312    render_board(b);
00313    return 1;
00314 }

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

00211 {
00212    return b->text;
00213 }

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

00216 {
00217    memset(b->text, ' ', b->v_w * b->v_h); /* fill with spaces */
00218    b->cur_col = 0;
00219    b->cur_line = 0;
00220    render_board(b);
00221    return 0;
00222 }


Variable Documentation

struct grab_desc* console_grabbers[]

Referenced by turn_on_off().

int console_video_formats

Definition at line 145 of file console_video.c.

Referenced by load_module(), and oss_new().


Generated on Mon Mar 19 11:30:46 2012 for Asterisk - The Open Source Telephony Project by  doxygen 1.4.7