/* * Asterisk -- An open source telephony toolkit. * * Copyright (C) 1999 - 2006, Digium, Inc. * * Mark Spencer * * 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. */ /*! \file * \brief General Asterisk PBX capability definitions. * \par See also: * \arg \ref Def_Channel * \arg \ref channel_drivers */ #ifndef _ASTERISK_CAPABILITY_H #define _ASTERISK_CAPABILITY_H #include "asterisk/abstract_jb.h" #include #ifdef POLLCOMPAT #include "asterisk/poll-compat.h" #else #include #endif #if defined(__cplusplus) || defined(c_plusplus) extern "C" { #endif #include "asterisk/compat.h" #include "asterisk/frame.h" #include "asterisk/config.h" #include "asterisk/utils.h" #include "asterisk/compiler.h" /* Defines */ #define AST_VIDEO_SQCIF (0) #define AST_VIDEO_QSIF (1) #define AST_VIDEO_QCIF (2) #define AST_VIDEO_QVGA (3) #define AST_VIDEO_SIF (4) #define AST_VIDEO_CIF (5) #define AST_VIDEO_VGA (6) #define AST_VIDEO_CIF4 (7) #define AST_VIDEO_SVGA (8) #define AST_VIDEO_XGA (9) #define AST_VIDEO_CIF16 (10) #define AST_VIDEO_LEVEL_BASELINE (1 << 0) #define AST_VIDEO_LEVEL_MAIN (1 << 1) #define AST_VIDEO_LEVEL_EXTENDED (1 << 2) #define MAX_VIDEO_SIZES 11 #define DEFAULT_MAX_CALL_BITRATE (384000) /*!< Max bitrate for video */ // The profile level is the profile (eg 1.1 x 10) typedef enum { level_1 = 10, // 0x0A level_1_1 = 11, // 0x0B level_1_2 = 12, // 0x0C level_1_3 = 13, // 0x0D level_2 = 20, // 0x14 level_2_1 = 21, // 0x15 level_2_2 = 22, // 0x16 level_3 = 30, // 0x1E level_3_1 = 31, // 0x1F level_3_2 = 32, // 0x20 level_4 = 40, // 0x28 level_4_1 = 41, // 0x29 level_4_2 = 42, // 0x2A level_5 = 50, // 0x32 level_5_1 = 51, // 0x33 } ast_h264_profile_level; /* The following array defines the video sizes we know about */ struct videoSize{ char* type; unsigned int num_mbs; unsigned int maxframerate; }; extern struct videoSize videoSizes[]; extern struct ast_capabilities ast_default_caps; /*! \brief ast_video_cap: Struct holding video capabilities */ struct ast_h2613_video_cap { int valid; /*!< 1 = This codec is specified, 0 = not specified */ unsigned int annexes; /*!< Video annexes - stored as bitfield 2^(annex-ascii(A))*/ unsigned int maxfr[MAX_VIDEO_SIZES]; /*!< Maximum framerate (framerate = 30/mpi) */ unsigned int maxbr; /*!< Maximum supported bitrate for this capability */ }; /*! \brief ast_h264_video_cap: Struct holding video capabilities */ struct ast_h264_video_cap { unsigned char valid; /*!< 1 = This codec is specified, 0 = not specified */ unsigned char rtpnum; /*!< The rtp number used in this cap */ unsigned char profile; /*!< Video flags */ unsigned char level; /*!< Profile level */ unsigned char constraint; /*!< Constraint flags */ unsigned int maxmbps; /*!< Maximum number of macroblocks per second */ unsigned int packet_mode; /*!< Packetisation mode */ unsigned int maxbr; /*!< Maximum supported bitrate for this capability */ }; /*! \brief ast_video_capabilities: Struct holding all video capabilities */ struct ast_capabilities { unsigned int maxcallbitrate; /*!< Max allowed bitrate for this channel */ unsigned int maxvideobitrate; /*!< Max video bitrate */ unsigned char prefs[32]; /*!< List of preferences */ struct ast_h2613_video_cap h261; /*!< H261 video capabilities */ struct ast_h2613_video_cap h263; /*!< H263 video capabilities */ struct ast_h264_video_cap h264; /*!< H264 video capabilities */ }; /*! \brief Set video capabilities of a channel * \note When videp caps need to be relayed to another part of call * \param chan channel to change the indication * \param capabilities * \return Returns 0 on success, -1 on failure */ int ast_set_capabilities(struct ast_channel *chan, struct ast_capabilities *chancaps); struct ast_capabilities *ast_alloc_capabilities(void); void ast_dump_caps(struct ast_capabilities *caps); void ast_dump_h2613_video_cap(struct ast_h2613_video_cap *vidcap); void ast_dump_h264_video_cap(struct ast_h264_video_cap *vidcap); void ast_resolve_h2613_video_cap(struct ast_h2613_video_cap *dstcap, struct ast_h2613_video_cap *s1cap, struct ast_h2613_video_cap *s2cap); void ast_resolve_h264_video_cap(struct ast_h264_video_cap *dstcap, struct ast_h264_video_cap *s1cap, struct ast_h264_video_cap *s2cap); int ast_copy_capabilities(struct ast_capabilities *dstcap, struct ast_capabilities *srccap); int ast_resolve_capabilities(struct ast_capabilities *dst, struct ast_capabilities *s1caps, struct ast_capabilities *s2caps, int debug); int ast_are_caps_zero(struct ast_capabilities *caps); int ast_set_capabilities_from_int(struct ast_capabilities *caps, int simplecap); int check_set_video_bitrates(struct ast_capabilities *caps, int debug); int parse_h2613_conf_line(const char *fmtstr, struct ast_h2613_video_cap *vidcap, unsigned int framerate); int parse_h264_conf_line(const char *fmtstr, struct ast_h264_video_cap *vidcap, int framerate); #if defined(__cplusplus) || defined(c_plusplus) } #endif #endif /* _ASTERISK_CAPABILITY_H */