1
/* $Id: signatures.h 3664 2011-07-19 03:42:28Z nanang $ */
3
* Copyright (C) 2011-2011 Teluu Inc. (http://www.teluu.com)
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
#ifndef __PJMEDIA_SIGNATURES_H__
20
#define __PJMEDIA_SIGNATURES_H__
23
* @file pjmedia/signatures.h
24
* @brief Standard PJMEDIA object signatures
26
#include <pjmedia/types.h>
31
* @defgroup PJMEDIA_SIG Object Signatures
32
* @ingroup PJMEDIA_BASE
33
* @brief Standard PJMEDIA object signatures
36
* Object signature is a 32-bit integral value similar to FOURCC to help
37
* identify PJMEDIA objects such as media ports, transports, codecs, etc.
38
* There are several uses of this signature, for example a media port can
39
* use the port object signature to verify that the given port instance
40
* is the one that it created, and a receiver of \ref PJMEDIA_EVENT can
41
* use the signature of the publisher to know which object emitted the
44
* The 32-bit value of an object signature is generated by the following
48
#define PJMEDIA_SIGNATURE(a,b,c,d) (a<<24 | b<<16 | c<<8 | d)
51
* The following convention is used to maintain order to the signature
52
* values so that application can make use of it more effectively, and to
53
* avoid conflict between the values themselves. For each object type or
54
* class, a specific prefix will be assigned as signature, and a macro
55
* is created to build a signature for such object:
58
Class Signature Signature creation and test macros
59
---------------------------------------------------------------
60
Codec Cxxx PJMEDIA_SIG_CLASS_CODEC(b,c,d)
61
PJMEDIA_SIG_IS_CLASS_CODEC(sig)
63
Audio codec CAxx PJMEDIA_SIG_CLASS_AUD_CODEC(c,d)
64
PJMEDIA_SIG_IS_CLASS_AUD_CODEC(sig)
66
Video codec CVxx PJMEDIA_SIG_CLASS_VID_CODEC(c,d)
67
PJMEDIA_SIG_IS_CLASS_VID_CODEC(sig)
69
Media port Pxxx PJMEDIA_SIG_CLASS_PORT(b,c,d)
70
PJMEDIA_SIG_IS_CLASS_PORT(sig)
72
Audio media port PAxx PJMEDIA_SIG_CLASS_PORT_AUD(c,d)
73
PJMEDIA_SIG_IS_CLASS_PORT_AUD(sig)
75
Video media port PVxx PJMEDIA_SIG_CLASS_PORT_VID(c,d)
76
PJMEDIA_SIG_IS_CLASS_PORT_VID(sig)
78
Video device VDxx PJMEDIA_SIG_CLASS_VID_DEV(c,d)
79
PJMEDIA_SIG_IS_CLASS_VID_DEV(sig)
81
Video other VOxx PJMEDIA_SIG_CLASS_VID_OTHER(c,d)
82
PJMEDIA_SIG_IS_CLASS_VID_OTHER(sig)
84
Application object Axxx PJMEDIA_SIG_CLASS_APP(b,c,d)
85
PJMEDIA_SIG_IS_CLASS_APP(sig)
89
* In addition, signatures created in application code should have lowercase
90
* letters to avoid conflict with built-in objects.
94
* Type to store object signature.
96
typedef pj_uint32_t pjmedia_obj_sig;
99
* A utility function to convert signature to four letters string.
101
* @param sig The signature value.
102
* @param buf Buffer to store the string, which MUST be at least
105
* @return The string.
107
PJ_INLINE(const char*) pjmedia_sig_name(pjmedia_obj_sig sig, char buf[])
109
return pjmedia_fourcc_name(sig, buf);
113
* Macro to generate signature from four ASCII letters.
115
#define PJMEDIA_SIGNATURE(a,b,c,d) PJMEDIA_FOURCC(a,b,c,d)
117
/*************************************************************************
118
* Codec signature ('Cxxx'). Please keep the constant names sorted.
120
#define PJMEDIA_SIG_CLASS_CODEC(b,c,d) PJMEDIA_SIGNATURE('C',b,c,d)
121
#define PJMEDIA_SIG_IS_CLASS_CODEC(sig) ((sig) >> 24 == 'C')
123
/*************************************************************************
124
* Audio codec signatures ('CAxx'). Please keep the constant names sorted.
126
#define PJMEDIA_SIG_CLASS_AUD_CODEC(c,d) PJMEDIA_SIG_CLASS_CODEC('A',c,d)
127
#define PJMEDIA_SIG_IS_CLASS_AUD_CODEC(s) ((s)>>24=='C' && (s)>>16=='A')
129
/*************************************************************************
130
* Video codec signatures ('CVxx'). Please keep the constant names sorted.
132
#define PJMEDIA_SIG_CLASS_VID_CODEC(c,d) PJMEDIA_SIG_CLASS_CODEC('V',c,d)
133
#define PJMEDIA_SIG_IS_CLASS_VID_CODEC(sig) ((s)>>24=='C' && (s)>>16=='V')
135
#define PJMEDIA_SIG_VID_CODEC_FFMPEG PJMEDIA_SIG_CLASS_VID_CODEC('F','F')
137
/*************************************************************************
138
* Port signatures ('Pxxx'). Please keep the constant names sorted.
140
#define PJMEDIA_SIG_CLASS_PORT(b,c,d) PJMEDIA_SIGNATURE('P',b,c,d)
141
#define PJMEDIA_SIG_IS_CLASS_PORT(sig) ((sig) >> 24 == 'P')
143
/*************************************************************************
144
* Audio ports signatures ('PAxx'). Please keep the constant names sorted.
146
#define PJMEDIA_SIG_CLASS_PORT_AUD(c,d) PJMEDIA_SIG_CLASS_PORT('A',c,d)
147
#define PJMEDIA_SIG_IS_CLASS_PORT_AUD(s) ((s)>>24=='P' && (s)>>16=='A')
149
#define PJMEDIA_SIG_PORT_BIDIR PJMEDIA_SIG_CLASS_PORT_AUD('B','D')
150
#define PJMEDIA_SIG_PORT_CONF PJMEDIA_SIG_CLASS_PORT_AUD('C','F')
151
#define PJMEDIA_SIG_PORT_CONF_PASV PJMEDIA_SIG_CLASS_PORT_AUD('C','P')
152
#define PJMEDIA_SIG_PORT_CONF_SWITCH PJMEDIA_SIG_CLASS_PORT_AUD('C','S')
153
#define PJMEDIA_SIG_PORT_ECHO PJMEDIA_SIG_CLASS_PORT_AUD('E','C')
154
#define PJMEDIA_SIG_PORT_MEM_CAPTURE PJMEDIA_SIG_CLASS_PORT_AUD('M','C')
155
#define PJMEDIA_SIG_PORT_MEM_PLAYER PJMEDIA_SIG_CLASS_PORT_AUD('M','P')
156
#define PJMEDIA_SIG_PORT_NULL PJMEDIA_SIG_CLASS_PORT_AUD('N','U')
157
#define PJMEDIA_SIG_PORT_RESAMPLE PJMEDIA_SIG_CLASS_PORT_AUD('R','E')
158
#define PJMEDIA_SIG_PORT_SPLIT_COMB PJMEDIA_SIG_CLASS_PORT_AUD('S','C')
159
#define PJMEDIA_SIG_PORT_SPLIT_COMB_P PJMEDIA_SIG_CLASS_PORT_AUD('S','P')
160
#define PJMEDIA_SIG_PORT_STEREO PJMEDIA_SIG_CLASS_PORT_AUD('S','R')
161
#define PJMEDIA_SIG_PORT_STREAM PJMEDIA_SIG_CLASS_PORT_AUD('S','T')
162
#define PJMEDIA_SIG_PORT_TONEGEN PJMEDIA_SIG_CLASS_PORT_AUD('T','O')
163
#define PJMEDIA_SIG_PORT_WAV_PLAYER PJMEDIA_SIG_CLASS_PORT_AUD('W','P')
164
#define PJMEDIA_SIG_PORT_WAV_PLAYLIST PJMEDIA_SIG_CLASS_PORT_AUD('W','Y')
165
#define PJMEDIA_SIG_PORT_WAV_WRITER PJMEDIA_SIG_CLASS_PORT_AUD('W','W')
168
/*************************************************************************
169
* Video ports signatures ('PVxx'). Please keep the constant names sorted.
171
#define PJMEDIA_SIG_CLASS_PORT_VID(c,d) PJMEDIA_SIG_CLASS_PORT('V',c,d)
172
#define PJMEDIA_SIG_IS_CLASS_PORT_VID(s) ((s)>>24=='P' && (s)>>16=='V')
174
/** AVI player signature. */
175
#define PJMEDIA_SIG_PORT_VID_AVI_PLAYER PJMEDIA_SIG_CLASS_PORT_VID('A','V')
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')
180
/**************************************************************************
181
* Video device signatures ('VDxx'). Please keep the constant names sorted.
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=='D')
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')
194
/*********************************************************************
195
* Other video objects ('VOxx'). Please keep the constant names sorted.
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=='O')
200
#define PJMEDIA_SIG_VID_PORT PJMEDIA_SIG_CLASS_VID_OTHER('P','O')
203
/*********************************************************************
204
* Application class ('Axxx').
206
#define PJMEDIA_SIG_CLASS_APP(b,c,d) PJMEDIA_SIGNATURE('A',b,c,d)
207
#define PJMEDIA_SIG_IS_CLASS_APP(s) ((s)>>24=='A')
217
#endif /* __PJMEDIA_SIGNATURES_H__ */