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: 126572 $
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 #define  SRC_WIN_W   80 /* width of video thumbnails */
00047 #define  SRC_WIN_H   60 /* height of video thumbnails */
00048 /* we only support a limited number of video sources in the GUI,
00049  * because we need screen estate to switch between them.
00050  */
00051 #define  MAX_VIDEO_SOURCES 9
00052 
00053 /*
00054  * In many places we use buffers to store the raw frames (but not only),
00055  * so here is a structure to keep all the info. data = NULL means the
00056  * structure is not initialized, so the other fields are invalid.
00057  * size = 0 means the buffer is not malloc'ed so we don't have to free it.
00058  */
00059 struct fbuf_t {      /* frame buffers, dynamically allocated */
00060    uint8_t  *data;   /* memory, malloced if size > 0, just reference
00061           * otherwise */
00062    int   size; /* total size in bytes */
00063    int   used; /* space used so far */
00064    int   ebit; /* bits to ignore at the end */
00065    int   x; /* origin, if necessary */
00066    int   y;
00067    int   w; /* size */ 
00068    int   h;
00069    int   pix_fmt;
00070    /* offsets and size of the copy in Picture-in-Picture mode */
00071    int   win_x;
00072    int   win_y;
00073    int   win_w;
00074    int   win_h;
00075 };
00076 
00077 void fbuf_free(struct fbuf_t *);
00078 
00079 /* descriptor for a grabber */
00080 struct grab_desc {
00081    const char *name;
00082    void *(*open)(const char *name, struct fbuf_t *geom, int fps);
00083    struct fbuf_t *(*read)(void *d);
00084    void (*move)(void *d, int dx, int dy);
00085    void *(*close)(void *d);
00086 };
00087 
00088 extern struct grab_desc *console_grabbers[];
00089 
00090 struct video_desc;      /* opaque type for video support */
00091 struct video_desc *get_video_desc(struct ast_channel *c);
00092 
00093 /* linked by console_video.o */
00094 int console_write_video(struct ast_channel *chan, struct ast_frame *f);
00095 extern int console_video_formats;
00096 int console_video_cli(struct video_desc *env, const char *var, int fd);
00097 int console_video_config(struct video_desc **penv, const char *var, const char *val);
00098 void console_video_uninit(struct video_desc *env);
00099 void console_video_start(struct video_desc *env, struct ast_channel *owner);
00100 int get_gui_startup(struct video_desc* env);
00101 
00102 /* console_board.c */
00103 
00104 /* Where do we send the keyboard/keypad output */
00105 enum kb_output {
00106    KO_NONE,
00107    KO_INPUT,   /* the local input window */
00108    KO_DIALED,  /* the 'dialed number' window */
00109    KO_MESSAGE, /* the 'message' window */
00110 };
00111 
00112 enum drag_window {   /* 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 };
00121 
00122 /*! \brief support for drag actions */
00123 struct drag_info {
00124    int      x_start; /* last known mouse position */
00125    int      y_start;
00126    enum drag_window drag_window;
00127 };
00128 /*! \brief info related to the gui: button status, mouse coords, etc. */
00129 struct board;
00130 /* !\brief print a message on a board */
00131 void move_message_board(struct board *b, int dy);
00132 int print_message(struct board *b, const char *s);
00133 
00134 /*! \brief return the whole text from a board */
00135 const char *read_message(const struct board *b);
00136 
00137 /*! \brief reset the board to blank */
00138 int reset_board(struct board *b);
00139 
00140 /*! \brief deallocates memory space for a board */
00141 void delete_board(struct board *b);
00142 #endif /* CONSOLE_VIDEO_H */
00143 /* end of file */

Generated on Thu Apr 16 06:27:32 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6