Coverage Report

Created: 2026-02-26 06:59

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/pjsip/pjmedia/include/pjmedia/signatures.h
Line
Count
Source
1
/* 
2
 * Copyright (C) 2011-2011 Teluu Inc. (http://www.teluu.com)
3
 *
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 2 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software
16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
17
 */
18
#ifndef __PJMEDIA_SIGNATURES_H__
19
#define __PJMEDIA_SIGNATURES_H__
20
21
/**
22
 * @file pjmedia/signatures.h
23
 * @brief Standard PJMEDIA object signatures
24
 */
25
#include <pjmedia/types.h>
26
27
PJ_BEGIN_DECL
28
29
/**
30
 * @defgroup PJMEDIA_SIG Object Signatures
31
 * @ingroup PJMEDIA_BASE
32
 * @brief Standard PJMEDIA object signatures
33
 * @{
34
 *
35
 * Object signature is a 32-bit integral value similar to FOURCC to help
36
 * identify PJMEDIA objects such as media ports, transports, codecs, etc.
37
 * There are several uses of this signature, for example a media port can
38
 * use the port object signature to verify that the given port instance
39
 * is the one that it created, and a receiver of \ref PJMEDIA_EVENT can
40
 * use the signature of the publisher to know which object emitted the
41
 * event.
42
 *
43
 * The 32-bit value of an object signature is generated by the following
44
 * macro:
45
 *
46
 * \verbatim
47
   #define PJMEDIA_SIGNATURE(a,b,c,d)   (a<<24 | b<<16 | c<<8 | d)
48
 * \endverbatim
49
 *
50
 * The following convention is used to maintain order to the signature
51
 * values so that application can make use of it more effectively, and to
52
 * avoid conflict between the values themselves. For each object type or
53
 * class, a specific prefix will be assigned as signature, and a macro
54
 * is created to build a signature for such object:
55
 *
56
 * \verbatim
57
    Class               Signature  Signature creation and test macros
58
    ---------------------------------------------------------------
59
    Codec               Cxxx       PJMEDIA_SIG_CLASS_CODEC(b,c,d)
60
                                   PJMEDIA_SIG_IS_CLASS_CODEC(sig)
61
62
    Audio codec         CAxx       PJMEDIA_SIG_CLASS_AUD_CODEC(c,d)
63
                                   PJMEDIA_SIG_IS_CLASS_AUD_CODEC(sig)
64
65
    Video codec         CVxx       PJMEDIA_SIG_CLASS_VID_CODEC(c,d)
66
                                   PJMEDIA_SIG_IS_CLASS_VID_CODEC(sig)
67
68
    Media port          Pxxx       PJMEDIA_SIG_CLASS_PORT(b,c,d)
69
                                   PJMEDIA_SIG_IS_CLASS_PORT(sig)
70
71
    Audio media port    PAxx       PJMEDIA_SIG_CLASS_PORT_AUD(c,d)
72
                                   PJMEDIA_SIG_IS_CLASS_PORT_AUD(sig)
73
74
    Video media port    PVxx       PJMEDIA_SIG_CLASS_PORT_VID(c,d)
75
                                   PJMEDIA_SIG_IS_CLASS_PORT_VID(sig)
76
77
    Video device        VDxx       PJMEDIA_SIG_CLASS_VID_DEV(c,d)
78
                                   PJMEDIA_SIG_IS_CLASS_VID_DEV(sig)
79
80
    Video other         VOxx       PJMEDIA_SIG_CLASS_VID_OTHER(c,d)
81
                                   PJMEDIA_SIG_IS_CLASS_VID_OTHER(sig)
82
83
    Application object  Axxx       PJMEDIA_SIG_CLASS_APP(b,c,d)
84
                                   PJMEDIA_SIG_IS_CLASS_APP(sig)
85
86
 * \endverbatim
87
 *
88
 * In addition, signatures created in application code should have lowercase
89
 * letters to avoid conflict with built-in objects.
90
 */
91
92
/**
93
 * Type to store object signature.
94
 */
95
typedef pj_uint32_t pjmedia_obj_sig;
96
97
/**
98
 * A utility function to convert signature to four letters string.
99
 *
100
 * @param sig           The signature value.
101
 * @param buf           Buffer to store the string, which MUST be at least
102
 *                      five bytes long.
103
 *
104
 * @return              The string.
105
 */
106
PJ_INLINE(const char*) pjmedia_sig_name(pjmedia_obj_sig sig, char buf[])
107
0
{
108
0
    return pjmedia_fourcc_name(sig, buf);
109
0
}
Unexecuted instantiation: fuzz-sdp.c:pjmedia_sig_name
Unexecuted instantiation: event.c:pjmedia_sig_name
Unexecuted instantiation: vpx_packetizer.c:pjmedia_sig_name
Unexecuted instantiation: fuzz-rtp.c:pjmedia_sig_name
Unexecuted instantiation: fuzz-rtcp.c:pjmedia_sig_name
Unexecuted instantiation: rtcp.c:pjmedia_sig_name
Unexecuted instantiation: rtcp_fb.c:pjmedia_sig_name
Unexecuted instantiation: vid_codec.c:pjmedia_sig_name
Unexecuted instantiation: codec.c:pjmedia_sig_name
Unexecuted instantiation: endpoint.c:pjmedia_sig_name
Unexecuted instantiation: transport_srtp.c:pjmedia_sig_name
Unexecuted instantiation: fuzz-srtp.c:pjmedia_sig_name
Unexecuted instantiation: transport_loop.c:pjmedia_sig_name
110
111
/**
112
 * Macro to generate signature from four ASCII letters.
113
 */
114
#define PJMEDIA_SIGNATURE(a,b,c,d)      PJMEDIA_FOURCC(d,c,b,a)
115
116
/*************************************************************************
117
 * Codec signature ('Cxxx'). Please keep the constant names sorted.
118
 */
119
#define PJMEDIA_SIG_CLASS_CODEC(b,c,d)  PJMEDIA_SIGNATURE('C',b,c,d)
120
#define PJMEDIA_SIG_IS_CLASS_CODEC(sig) ((sig) >> 24 == 'C')
121
122
/*************************************************************************
123
 * Audio codec signatures ('CAxx'). Please keep the constant names sorted.
124
 */
125
#define PJMEDIA_SIG_CLASS_AUD_CODEC(c,d) PJMEDIA_SIG_CLASS_CODEC('A',c,d)
126
#define PJMEDIA_SIG_IS_CLASS_AUD_CODEC(s) ((s)>>24=='C' && (((s)>>16)&0xff)=='A')
127
128
/*************************************************************************
129
 * Video codec signatures ('CVxx'). Please keep the constant names sorted.
130
 */
131
#define PJMEDIA_SIG_CLASS_VID_CODEC(c,d) PJMEDIA_SIG_CLASS_CODEC('V',c,d)
132
#define PJMEDIA_SIG_IS_CLASS_VID_CODEC(sig) ((s)>>24=='C' && (((s)>>16)&0xff)=='V')
133
134
#define PJMEDIA_SIG_VID_CODEC_FFMPEG    PJMEDIA_SIG_CLASS_VID_CODEC('F','F')
135
136
/*************************************************************************
137
 * Port signatures ('Pxxx'). Please keep the constant names sorted.
138
 */
139
#define PJMEDIA_SIG_CLASS_PORT(b,c,d)   PJMEDIA_SIGNATURE('P',b,c,d)
140
#define PJMEDIA_SIG_IS_CLASS_PORT(sig)  ((sig) >> 24 == 'P')
141
142
/*************************************************************************
143
 * Audio ports signatures ('PAxx'). Please keep the constant names sorted.
144
 */
145
#define PJMEDIA_SIG_CLASS_PORT_AUD(c,d) PJMEDIA_SIG_CLASS_PORT('A',c,d)
146
#define PJMEDIA_SIG_IS_CLASS_PORT_AUD(s) ((s)>>24=='P' && (((s)>>16)&0xff)=='A')
147
148
#define PJMEDIA_SIG_PORT_BIDIR          PJMEDIA_SIG_CLASS_PORT_AUD('B','D')
149
#define PJMEDIA_SIG_PORT_CONF           PJMEDIA_SIG_CLASS_PORT_AUD('C','F')
150
#define PJMEDIA_SIG_PORT_CONF_PASV      PJMEDIA_SIG_CLASS_PORT_AUD('C','P')
151
#define PJMEDIA_SIG_PORT_CONF_SWITCH    PJMEDIA_SIG_CLASS_PORT_AUD('C','S')
152
#define PJMEDIA_SIG_PORT_ECHO           PJMEDIA_SIG_CLASS_PORT_AUD('E','C')
153
#define PJMEDIA_SIG_PORT_MEM_CAPTURE    PJMEDIA_SIG_CLASS_PORT_AUD('M','C')
154
#define PJMEDIA_SIG_PORT_MEM_PLAYER     PJMEDIA_SIG_CLASS_PORT_AUD('M','P')
155
#define PJMEDIA_SIG_PORT_NULL           PJMEDIA_SIG_CLASS_PORT_AUD('N','U')
156
#define PJMEDIA_SIG_PORT_RESAMPLE       PJMEDIA_SIG_CLASS_PORT_AUD('R','E')
157
#define PJMEDIA_SIG_PORT_SPLIT_COMB     PJMEDIA_SIG_CLASS_PORT_AUD('S','C')
158
#define PJMEDIA_SIG_PORT_SPLIT_COMB_P   PJMEDIA_SIG_CLASS_PORT_AUD('S','P')
159
#define PJMEDIA_SIG_PORT_STEREO         PJMEDIA_SIG_CLASS_PORT_AUD('S','R')
160
#define PJMEDIA_SIG_PORT_STREAM         PJMEDIA_SIG_CLASS_PORT_AUD('S','T')
161
#define PJMEDIA_SIG_PORT_TONEGEN        PJMEDIA_SIG_CLASS_PORT_AUD('T','O')
162
#define PJMEDIA_SIG_PORT_WAV_PLAYER     PJMEDIA_SIG_CLASS_PORT_AUD('W','P')
163
#define PJMEDIA_SIG_PORT_WAV_PLAYLIST   PJMEDIA_SIG_CLASS_PORT_AUD('W','Y')
164
#define PJMEDIA_SIG_PORT_WAV_WRITER     PJMEDIA_SIG_CLASS_PORT_AUD('W','W')
165
166
167
/*************************************************************************
168
 * Video ports signatures ('PVxx'). Please keep the constant names sorted.
169
 */
170
#define PJMEDIA_SIG_CLASS_PORT_VID(c,d) PJMEDIA_SIG_CLASS_PORT('V',c,d)
171
#define PJMEDIA_SIG_IS_CLASS_PORT_VID(s) ((s)>>24=='P' && (((s)>>16)&0xff)=='V')
172
173
/** AVI player and writer signature. */
174
#define PJMEDIA_SIG_PORT_VID_AVI_PLAYER PJMEDIA_SIG_CLASS_PORT_VID('A','V')
175
#define PJMEDIA_SIG_PORT_VID_AVI_WRITER PJMEDIA_SIG_CLASS_PORT_VID('A','W')
176
#define PJMEDIA_SIG_PORT_VID_STREAM     PJMEDIA_SIG_CLASS_PORT_VID('S','T')
177
#define PJMEDIA_SIG_PORT_VID_TEE        PJMEDIA_SIG_CLASS_PORT_VID('T','E')
178
179
180
/**************************************************************************
181
 * Video device signatures ('VDxx'). Please keep the constant names sorted.
182
 */
183
#define PJMEDIA_SIG_CLASS_VID_DEV(c,d)  PJMEDIA_SIGNATURE('V','D',c,d)
184
#define PJMEDIA_SIG_IS_CLASS_VID_DEV(s) ((s)>>24=='V' && (((s)>>16)&0xff)=='D')
185
186
#define PJMEDIA_SIG_VID_DEV_COLORBAR    PJMEDIA_SIG_CLASS_VID_DEV('C','B')
187
#define PJMEDIA_SIG_VID_DEV_SDL         PJMEDIA_SIG_CLASS_VID_DEV('S','D')
188
#define PJMEDIA_SIG_VID_DEV_V4L2        PJMEDIA_SIG_CLASS_VID_DEV('V','2')
189
#define PJMEDIA_SIG_VID_DEV_DSHOW       PJMEDIA_SIG_CLASS_VID_DEV('D','S')
190
#define PJMEDIA_SIG_VID_DEV_QT          PJMEDIA_SIG_CLASS_VID_DEV('Q','T')
191
#define PJMEDIA_SIG_VID_DEV_IOS         PJMEDIA_SIG_CLASS_VID_DEV('I','P')
192
193
194
/*********************************************************************
195
 * Other video objects ('VOxx'). Please keep the constant names sorted.
196
 */
197
#define PJMEDIA_SIG_CLASS_VID_OTHER(c,d) PJMEDIA_SIGNATURE('V','O',c,d)
198
#define PJMEDIA_SIG_IS_CLASS_VID_OTHER(s) ((s)>>24=='V' && (((s)>>16)&0xff)=='O')
199
200
#define PJMEDIA_SIG_VID_CONF            PJMEDIA_SIG_CLASS_VID_OTHER('C','F')
201
#define PJMEDIA_SIG_VID_PORT            PJMEDIA_SIG_CLASS_VID_OTHER('P','O')
202
203
204
/*********************************************************************
205
 * Application class ('Axxx').
206
 */
207
#define PJMEDIA_SIG_CLASS_APP(b,c,d)    PJMEDIA_SIGNATURE('A',b,c,d)
208
#define PJMEDIA_SIG_IS_CLASS_APP(s)     ((s)>>24=='A')
209
210
211
/**
212
 * @}  PJSIP_MSG
213
 */
214
215
216
PJ_END_DECL
217
218
#endif  /* __PJMEDIA_SIGNATURES_H__ */