| 1 | === General Data Structure === |
| 2 | |
| 3 | ==== Media Format ==== |
| 4 | |
| 5 | Defined as all information needed to completely describe a media: |
| 6 | {{{ |
| 7 | /** |
| 8 | * This structure contains all the information needed to completely describe |
| 9 | * a media. |
| 10 | */ |
| 11 | typedef struct pjmedia_format |
| 12 | { |
| 13 | /** |
| 14 | * The format id that specifies the audio sample or video pixel format. |
| 15 | * Some well known formats ids are declared in pjmedia_format_id |
| 16 | * enumeration. |
| 17 | * |
| 18 | * @see pjmedia_format_id |
| 19 | */ |
| 20 | pj_uint32_t id; |
| 21 | |
| 22 | /** |
| 23 | * The top-most type of the media, as an information. |
| 24 | */ |
| 25 | pjmedia_type type; |
| 26 | |
| 27 | /** |
| 28 | * The type of detail structure in the \a detail pointer. |
| 29 | */ |
| 30 | pjmedia_format_detail_type detail_type; |
| 31 | |
| 32 | /** |
| 33 | * Detail section to describe the media. |
| 34 | */ |
| 35 | union |
| 36 | { |
| 37 | /** |
| 38 | * Detail section for audio format. |
| 39 | */ |
| 40 | pjmedia_audio_format_detail aud; |
| 41 | |
| 42 | /** |
| 43 | * Detail section for video format. |
| 44 | */ |
| 45 | pjmedia_video_format_detail vid; |
| 46 | |
| 47 | /** |
| 48 | * Reserved area for user-defined format detail. |
| 49 | */ |
| 50 | char user[PJMEDIA_FORMAT_DETAIL_USER_SIZE]; |
| 51 | } det; |
| 52 | |
| 53 | } pjmedia_format; |
| 54 | }}} |
| 55 | |
| 56 | Media format ID: |
| 57 | {{{ |
| 58 | /** |
| 59 | * This enumeration uniquely identify audio sample and/or video pixel formats. |
| 60 | * Some well known formats are listed here. The format ids are built by |
| 61 | * combining four character codes, similar to FOURCC. The format id is |
| 62 | * extensible, as application may define and use format ids not declared |
| 63 | * on this enumeration. |
| 64 | * |
| 65 | * This format id along with other information will fully describe the media |
| 66 | * in #pjmedia_format structure. |
| 67 | */ |
| 68 | typedef enum pjmedia_format_id |
| 69 | { |
| 70 | /* |
| 71 | * Audio formats |
| 72 | */ |
| 73 | |
| 74 | /** 16bit signed integer linear PCM audio */ |
| 75 | PJMEDIA_FORMAT_L16 = 0, |
| 76 | |
| 77 | /** Alias for PJMEDIA_FORMAT_L16 */ |
| 78 | PJMEDIA_FORMAT_PCM = PJMEDIA_FORMAT_L16, |
| 79 | |
| 80 | /** G.711 ALAW */ |
| 81 | PJMEDIA_FORMAT_PCMA = PJMEDIA_FORMAT_PACK('A', 'L', 'A', 'W'), |
| 82 | ... |
| 83 | |
| 84 | /* |
| 85 | * Video formats. |
| 86 | */ |
| 87 | /** |
| 88 | * 24bit RGB |
| 89 | */ |
| 90 | PJMEDIA_FORMAT_RGB24 = PJMEDIA_FORMAT_PACK('R', 'G', 'B', '3'), |
| 91 | |
| 92 | /** |
| 93 | * 32bit RGB with alpha channel |
| 94 | */ |
| 95 | PJMEDIA_FORMAT_RGBA = PJMEDIA_FORMAT_PACK('R', 'G', 'B', 'A'), |
| 96 | PJMEDIA_FORMAT_BGRA = PJMEDIA_FORMAT_PACK('B', 'G', 'R', 'A'), |
| 97 | ... |
| 98 | |
| 99 | /** |
| 100 | * Encoded video formats |
| 101 | */ |
| 102 | |
| 103 | PJMEDIA_FORMAT_H261 = PJMEDIA_FORMAT_PACK('H', '2', '6', '1'), |
| 104 | PJMEDIA_FORMAT_H263 = PJMEDIA_FORMAT_PACK('H', '2', '6', '3'), |
| 105 | PJMEDIA_FORMAT_H263P = PJMEDIA_FORMAT_PACK('P', '2', '6', '3'), |
| 106 | PJMEDIA_FORMAT_H264 = PJMEDIA_FORMAT_PACK('H', '2', '6', '4'), |
| 107 | ... |
| 108 | |
| 109 | } pjmedia_format_id; |
| 110 | }}} |
| 111 | |
| 112 | Format detail types: |
| 113 | {{{ |
| 114 | /** |
| 115 | * This enumeration specifies what type of detail is included in a |
| 116 | * #pjmedia_format structure. |
| 117 | */ |
| 118 | typedef enum pjmedia_format_detail_type |
| 119 | { |
| 120 | /** Format detail is not specified. */ |
| 121 | PJMEDIA_FORMAT_DETAIL_NONE, |
| 122 | |
| 123 | /** Audio format detail. */ |
| 124 | PJMEDIA_FORMAT_DETAIL_AUDIO, |
| 125 | |
| 126 | /** Video format detail. */ |
| 127 | PJMEDIA_FORMAT_DETAIL_VIDEO, |
| 128 | |
| 129 | /** Number of format detail type that has been defined. */ |
| 130 | PJMEDIA_FORMAT_DETAIL_MAX |
| 131 | |
| 132 | } pjmedia_format_detail_type; |
| 133 | }}} |
| 134 | |
| 135 | Audio format detail: |
| 136 | {{{ |
| 137 | /** |
| 138 | * This structure is put in \a detail field of #pjmedia_format to describe |
| 139 | * detail information about an audio media. |
| 140 | */ |
| 141 | typedef struct pjmedia_audio_format_detail |
| 142 | { |
| 143 | unsigned clock_rate; /**< Audio clock rate in samples or Hz. */ |
| 144 | unsigned channel_count; /**< Number of channels. */ |
| 145 | unsigned frame_time_usec;/**< Frame interval, in microseconds. */ |
| 146 | unsigned bits_per_sample;/**< Number of bits per sample. */ |
| 147 | pj_uint32_t avg_bps; /**< Average bitrate */ |
| 148 | pj_uint32_t max_bps; /**< Maximum bitrate */ |
| 149 | } pjmedia_audio_format_detail; |
| 150 | }}} |
| 151 | |
| 152 | Video format detail: |
| 153 | {{{ |
| 154 | /** |
| 155 | * This structure is put in \a detail field of #pjmedia_format to describe |
| 156 | * detail information about a video media. |
| 157 | * |
| 158 | * Additional information about a video format can also be retrieved by |
| 159 | * calling #pjmedia_get_video_format_info(). |
| 160 | */ |
| 161 | typedef struct pjmedia_video_format_detail |
| 162 | { |
| 163 | pjmedia_rect_size size; /**< Video size (width, height) */ |
| 164 | pjmedia_ratio fps; /**< Number of frames per second. */ |
| 165 | pj_uint32_t avg_bps;/**< Average bitrate. */ |
| 166 | pj_uint32_t max_bps;/**< Maximum bitrate. */ |
| 167 | } pjmedia_video_format_detail; |
| 168 | }}} |
| 169 | |
| 170 | '''Should we put video format info to?''' |
| 171 | |
| 172 | ==== Missing samples_per_frame ==== |
| 173 | |
| 174 | Use PJMEDIA_AFD_SAMPLES_PER_FRAME(afd) |
| 175 | |
| 176 | ==== Port info ==== |
| 177 | |
| 178 | Media format description fields have been replaced by {{{pjmedia_format}}}: |
| 179 | {{{ |
| 180 | /** |
| 181 | * Port info. |
| 182 | */ |
| 183 | typedef struct pjmedia_port_info |
| 184 | { |
| 185 | pj_str_t name; /**< Port name. */ |
| 186 | pj_uint32_t signature; /**< Port signature. */ |
| 187 | pjmedia_dir dir; /**< Port direction. */ |
| 188 | pjmedia_format fmt; /**< Format. */ |
| 189 | } pjmedia_port_info; |
| 190 | }}} |
| 191 | |
| 192 | ==== put_frame() callback of pjmedia_port ==== |
| 193 | |
| 194 | Removed const qualifier from the frame argument. |
| 195 | |
| 196 | Sample warnings: |
| 197 | {{{ |
| 198 | ../src/pjmedia/bidirectional.c: In function ‘put_frame’: |
| 199 | ../src/pjmedia/bidirectional.c:39: warning: passing argument 2 of ‘pjmedia_port_put_frame’ discards qualifiers from pointer target type |
| 200 | ../include/pjmedia/port.h:334: note: expected ‘struct pjmedia_frame *’ but argument is of type ‘const struct pjmedia_frame *’ |
| 201 | ../src/pjmedia/bidirectional.c:70: warning: assignment from incompatible pointer type |
| 202 | }}} |
| 203 | |
| 204 | ==== pjsua_call_info ==== |
| 205 | |
| 206 | Array of media info.. |