Thu Jul 9 13:40:33 2009

Asterisk developer's documentation


console_video.h

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 2007 Luigi Rizzo
00005  *
00006  * See http://www.asterisk.org for more information about
00007  * the Asterisk project. Please do not directly contact
00008  * any of the maintainers of this project for assistance;
00009  * the project provides a web site, mailing lists and IRC
00010  * channels for your use.
00011  *
00012  * This program is free software, distributed under the terms of
00013  * the GNU General Public License Version 2. See the LICENSE file
00014  * at the top of the source tree.
00015  */
00016 
00017 /*
00018  * Common header for console video support
00019  *
00020  * $Revision: 97530 $
00021  */
00022 
00023 #ifndef CONSOLE_VIDEO_H
00024 #define CONSOLE_VIDEO_H
00025 
00026 #if !defined(HAVE_VIDEO_CONSOLE) || !defined(HAVE_FFMPEG)
00027 #define CONSOLE_VIDEO_CMDS             \
00028       "console {device}"
00029 #else
00030 
00031 #include <ffmpeg/avcodec.h>
00032 #ifndef OLD_FFMPEG
00033 #include <ffmpeg/swscale.h>     /* requires a recent ffmpeg */
00034 #endif
00035 
00036 #define CONSOLE_VIDEO_CMDS       \
00037    "console {videodevice|videocodec"   \
00038    "|video_size|bitrate|fps|qmin"      \
00039    "|sendvideo|keypad"        \
00040    "|sdl_videodriver"         \
00041    "|device|startgui|stopgui"    \
00042    "}"
00043 
00044 #endif   /* HAVE_VIDEO_CONSOLE and others */
00045 
00046 /*
00047  * In many places we use buffers to store the raw frames (but not only),
00048  * so here is a structure to keep all the info. data = NULL means the
00049  * structure is not initialized, so the other fields are invalid.
00050  * size = 0 means the buffer is not malloc'ed so we don't have to free it.
00051  */
00052 struct fbuf_t {      /* frame buffers, dynamically allocated */
00053    uint8_t  *data;   /* memory, malloced if size > 0, just reference
00054           * otherwise */
00055    int   size; /* total size in bytes */
00056    int   used; /* space used so far */
00057    int   ebit; /* bits to ignore at the end */
00058    int   x; /* origin, if necessary */
00059    int   y;
00060    int   w; /* size */ 
00061    int   h;
00062    int   pix_fmt;
00063 };
00064 
00065 void fbuf_free(struct fbuf_t *);
00066 
00067 /* descriptor for a grabber */
00068 struct grab_desc {
00069    const char *name;
00070    void *(*open)(const char *name, struct fbuf_t *geom, int fps);
00071    struct fbuf_t *(*read)(void *d);
00072    void (*move)(void *d, int dx, int dy);
00073    void *(*close)(void *d);
00074 };
00075 
00076 extern struct grab_desc *console_grabbers[];
00077 
00078 struct video_desc;      /* opaque type for video support */
00079 struct video_desc *get_video_desc(struct ast_channel *c);
00080 
00081 /* linked by console_video.o */
00082 int console_write_video(struct ast_channel *chan, struct ast_frame *f);
00083 extern int console_video_formats;
00084 int console_video_cli(struct video_desc *env, const char *var, int fd);
00085 int console_video_config(struct video_desc **penv, const char *var, const char *val);
00086 void console_video_uninit(struct video_desc *env);
00087 void console_video_start(struct video_desc *env, struct ast_channel *owner);
00088 
00089 /* console_board.c */
00090 
00091 /* Where do we send the keyboard/keypad output */
00092 enum kb_output {
00093    KO_NONE,
00094    KO_INPUT,   /* the local input window */
00095    KO_DIALED,  /* the 'dialed number' window */
00096    KO_MESSAGE, /* the 'message' window */
00097 };
00098 
00099 enum drag_window {   /* which window are we dragging */
00100    DRAG_NONE,
00101    DRAG_LOCAL, /* local video */
00102    DRAG_REMOTE,   /* remote video */
00103    DRAG_DIALED,   /* dialed number */
00104    DRAG_INPUT, /* input window */
00105    DRAG_MESSAGE,  /* message window */
00106 };
00107 
00108 /*! \brief support for drag actions */
00109 struct drag_info {
00110    int      x_start; /* last known mouse position */
00111    int      y_start;
00112    enum drag_window drag_window;
00113 };
00114 /*! \brief info related to the gui: button status, mouse coords, etc. */
00115 struct board;
00116 /* !\brief print a message on a board */
00117 void move_message_board(struct board *b, int dy);
00118 int print_message(struct board *b, const char *s);
00119 
00120 /*! \brief return the whole text from a board */
00121 const char *read_message(const struct board *b);
00122 
00123 /*! \brief reset the board to blank */
00124 int reset_board(struct board *b);
00125 
00126 #endif /* CONSOLE_VIDEO_H */
00127 /* end of file */

Generated on Thu Jul 9 13:40:33 2009 for Asterisk - the Open Source PBX by  doxygen 1.4.7