| 
									
										
										
										
											2007-12-22 18:28:40 +00:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Asterisk -- An open source telephony toolkit. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright (C) 2007 Luigi Rizzo | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * See http://www.asterisk.org for more information about
 | 
					
						
							|  |  |  |  * the Asterisk project. Please do not directly contact | 
					
						
							|  |  |  |  * any of the maintainers of this project for assistance; | 
					
						
							|  |  |  |  * the project provides a web site, mailing lists and IRC | 
					
						
							|  |  |  |  * channels for your use. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is free software, distributed under the terms of | 
					
						
							|  |  |  |  * the GNU General Public License Version 2. See the LICENSE file | 
					
						
							|  |  |  |  * at the top of the source tree. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Common header for console video support | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * $Revision$ | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-26 20:01:16 +00:00
										 |  |  | #ifndef CONSOLE_VIDEO_H
 | 
					
						
							|  |  |  | #define CONSOLE_VIDEO_H
 | 
					
						
							| 
									
										
										
										
											2007-12-22 18:28:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-27 00:21:02 +00:00
										 |  |  | #if !defined(HAVE_VIDEO_CONSOLE) || !defined(HAVE_FFMPEG)
 | 
					
						
							| 
									
										
										
										
											2007-12-26 20:01:16 +00:00
										 |  |  | #define CONSOLE_VIDEO_CMDS					\
 | 
					
						
							|  |  |  | 		"console {device}" | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <ffmpeg/avcodec.h>
 | 
					
						
							|  |  |  | #ifndef OLD_FFMPEG
 | 
					
						
							|  |  |  | #include <ffmpeg/swscale.h>     /* requires a recent ffmpeg */
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-01-09 12:23:18 +00:00
										 |  |  | #define CONSOLE_VIDEO_CMDS			\
 | 
					
						
							|  |  |  | 	"console {videodevice|videocodec"	\ | 
					
						
							|  |  |  | 	"|video_size|bitrate|fps|qmin"		\ | 
					
						
							|  |  |  | 	"|sendvideo|keypad"			\ | 
					
						
							|  |  |  | 	"|sdl_videodriver"			\ | 
					
						
							|  |  |  | 	"|device|startgui|stopgui"		\ | 
					
						
							| 
									
										
										
										
											2007-12-22 18:28:40 +00:00
										 |  |  | 	"}" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-26 20:01:16 +00:00
										 |  |  | #endif	/* HAVE_VIDEO_CONSOLE and others */
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-29 12:59:26 +00:00
										 |  |  | #define	SRC_WIN_W	80	/* width of video thumbnails */
 | 
					
						
							|  |  |  | #define	SRC_WIN_H	60	/* height of video thumbnails */
 | 
					
						
							|  |  |  | /* we only support a limited number of video sources in the GUI,
 | 
					
						
							|  |  |  |  * because we need screen estate to switch between them. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | #define	MAX_VIDEO_SOURCES	9
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-28 22:37:40 +00:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * In many places we use buffers to store the raw frames (but not only), | 
					
						
							|  |  |  |  * so here is a structure to keep all the info. data = NULL means the | 
					
						
							|  |  |  |  * structure is not initialized, so the other fields are invalid. | 
					
						
							|  |  |  |  * size = 0 means the buffer is not malloc'ed so we don't have to free it. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | struct fbuf_t {		/* frame buffers, dynamically allocated */ | 
					
						
							|  |  |  | 	uint8_t	*data;	/* memory, malloced if size > 0, just reference
 | 
					
						
							|  |  |  | 			 * otherwise */ | 
					
						
							|  |  |  | 	int	size;	/* total size in bytes */ | 
					
						
							|  |  |  | 	int	used;	/* space used so far */ | 
					
						
							|  |  |  | 	int	ebit;	/* bits to ignore at the end */ | 
					
						
							|  |  |  | 	int	x;	/* origin, if necessary */ | 
					
						
							|  |  |  | 	int	y; | 
					
						
							| 
									
										
										
										
											2017-12-22 09:23:22 -05:00
										 |  |  | 	int	w;	/* size */ | 
					
						
							| 
									
										
										
										
											2007-12-28 22:37:40 +00:00
										 |  |  | 	int	h; | 
					
						
							|  |  |  | 	int	pix_fmt; | 
					
						
							| 
									
										
										
										
											2008-06-29 12:59:26 +00:00
										 |  |  | 	/* offsets and size of the copy in Picture-in-Picture mode */ | 
					
						
							|  |  |  | 	int	win_x; | 
					
						
							|  |  |  | 	int	win_y; | 
					
						
							|  |  |  | 	int	win_w; | 
					
						
							|  |  |  | 	int	win_h; | 
					
						
							| 
									
										
										
										
											2007-12-28 22:37:40 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-29 02:02:03 +00:00
										 |  |  | void fbuf_free(struct fbuf_t *); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* descriptor for a grabber */ | 
					
						
							|  |  |  | struct grab_desc { | 
					
						
							|  |  |  | 	const char *name; | 
					
						
							|  |  |  | 	void *(*open)(const char *name, struct fbuf_t *geom, int fps); | 
					
						
							|  |  |  | 	struct fbuf_t *(*read)(void *d); | 
					
						
							|  |  |  | 	void (*move)(void *d, int dx, int dy); | 
					
						
							|  |  |  | 	void *(*close)(void *d); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern struct grab_desc *console_grabbers[]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-26 20:01:16 +00:00
										 |  |  | struct video_desc;		/* opaque type for video support */ | 
					
						
							|  |  |  | struct video_desc *get_video_desc(struct ast_channel *c); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* linked by console_video.o */ | 
					
						
							|  |  |  | int console_write_video(struct ast_channel *chan, struct ast_frame *f); | 
					
						
							|  |  |  | extern int console_video_formats; | 
					
						
							|  |  |  | 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_uninit(struct video_desc *env); | 
					
						
							|  |  |  | void console_video_start(struct video_desc *env, struct ast_channel *owner); | 
					
						
							| 
									
										
										
										
											2008-06-30 15:45:15 +00:00
										 |  |  | int get_gui_startup(struct video_desc* env); | 
					
						
							| 
									
										
										
										
											2007-12-22 18:28:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-01-09 16:44:20 +00:00
										 |  |  | /* console_board.c */ | 
					
						
							| 
									
										
										
										
											2008-01-09 18:03:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Where do we send the keyboard/keypad output */ | 
					
						
							|  |  |  | enum kb_output { | 
					
						
							|  |  |  | 	KO_NONE, | 
					
						
							|  |  |  | 	KO_INPUT,	/* the local input window */ | 
					
						
							|  |  |  | 	KO_DIALED,	/* the 'dialed number' window */ | 
					
						
							|  |  |  | 	KO_MESSAGE,	/* the 'message' window */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | enum drag_window {	/* 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 */ | 
					
						
							| 
									
										
										
										
											2008-06-29 12:59:26 +00:00
										 |  |  | 	DRAG_PIP,	/* picture in picture */ | 
					
						
							| 
									
										
										
										
											2008-01-09 18:03:40 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*! \brief support for drag actions */ | 
					
						
							|  |  |  | struct drag_info { | 
					
						
							|  |  |  | 	int		x_start;	/* last known mouse position */ | 
					
						
							|  |  |  | 	int		y_start; | 
					
						
							|  |  |  | 	enum drag_window drag_window; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | /*! \brief info related to the gui: button status, mouse coords, etc. */ | 
					
						
							| 
									
										
										
										
											2008-01-09 16:44:20 +00:00
										 |  |  | struct board; | 
					
						
							|  |  |  | /* !\brief print a message on a board */ | 
					
						
							| 
									
										
										
										
											2008-01-09 18:03:40 +00:00
										 |  |  | void move_message_board(struct board *b, int dy); | 
					
						
							| 
									
										
										
										
											2008-01-09 16:44:20 +00:00
										 |  |  | int print_message(struct board *b, const char *s); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*! \brief return the whole text from a board */ | 
					
						
							|  |  |  | const char *read_message(const struct board *b); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*! \brief reset the board to blank */ | 
					
						
							|  |  |  | int reset_board(struct board *b); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-29 12:59:26 +00:00
										 |  |  | /*! \brief deallocates memory space for a board */ | 
					
						
							|  |  |  | void delete_board(struct board *b); | 
					
						
							| 
									
										
										
										
											2007-12-26 20:01:16 +00:00
										 |  |  | #endif /* CONSOLE_VIDEO_H */
 | 
					
						
							| 
									
										
										
										
											2007-12-22 18:28:40 +00:00
										 |  |  | /* end of file */ |