Mon Oct 8 12:39:21 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 125 of file console_video.c.

Referenced by console_cmd().

00126 {
00127    return 1;   /* nothing matched */
00128 }

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

00131 {
00132    return 1;   /* no configuration */
00133 }

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

00136 {
00137    ast_log(LOG_NOTICE, "voice only, console video support not present\n");
00138 }

void console_video_uninit ( struct video_desc *  env  ) 

Definition at line 140 of file console_video.c.

Referenced by oss_hangup().

00141 {
00142 }

int console_write_video ( struct ast_channel chan,
struct ast_frame f 
)

Definition at line 120 of file console_video.c.

00121 {
00122    return 0;   /* writing video not supported */
00123 }

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

00325 {
00326    if (b) {
00327       /* deletes the text */
00328       if (b->text)
00329          ast_free (b->text);
00330       /* deallocates the blank surface */
00331       SDL_FreeSurface(b->blank);
00332       /* deallocates the board */
00333       ast_free(b);
00334    }
00335 }

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.

00145 {
00146    return 0; /* no gui here */
00147 }

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 202 of file console_board.c.

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

Referenced by eventhandler().

00203 {
00204    int cur = b->cur_line + dy;
00205    if (cur < 0)
00206       cur = 0;
00207    else if (cur >= b->v_h - b->p_h)
00208       cur = b->v_h - b->p_h - 1;
00209    b->cur_line = cur;
00210    render_board(b);
00211 }

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

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

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

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

00215 {
00216    return b->text;
00217 }

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

00220 {
00221    memset(b->text, ' ', b->v_w * b->v_h); /* fill with spaces */
00222    b->cur_col = 0;
00223    b->cur_line = 0;
00224    render_board(b);
00225    return 0;
00226 }


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


Generated on Mon Oct 8 12:39:21 2012 for Asterisk - The Open Source Telephony Project by  doxygen 1.4.7