1 /*
2 mediastreamer2 library - modular sound and video processing and streaming
3 Copyright (C) 2014  Belledonne Communications SARL http://www.belledonne-communications.com
4 
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9 
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.
14 
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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18 */
19 
20 #ifndef msformats_h
21 #define msformats_h
22 
23 #ifdef __cplusplus
24 extern "C"{
25 #endif
26 
27 /**
28  * Simple enum to indicate whether a format is audio or video.
29 **/
30 typedef enum _MSFormatType{
31 	MSAudio,
32 	MSVideo,
33 	MSText,
34 	MSUnknownMedia
35 }MSFormatType;
36 
37 /**
38  * to string from enum.
39 **/
40 MS2_PUBLIC const char* ms_format_type_to_string(MSFormatType type);
41 
42 
43 
44 /* those structs are part of the ABI: don't change their size otherwise binary plugins will be broken*/
45 
46 typedef struct MSVideoSize{
47 	int width,height;
48 } MSVideoSize;
49 
50 
51 /**
52  * Structure describing fully a media format.
53 **/
54 struct _MSFmtDescriptor{
55 	MSFormatType type; /**<format type, audio or video*/
56 	char *encoding; /**<the name of the encoding: for example pcmu, H264, opus*/
57 	int nchannels; /**<number of channels, relevant for audio only*/
58 	int rate; /**<Samplerate for audio, clockrate for video*/
59 	char *fmtp; /**<fmtp*/
60 	MSVideoSize vsize; /**<video size*/
61 	float fps; /**<average framerate*/
62 	char *text; /**<do not use directly, use ms_fmt_descriptor_to_string() instead*/
63 };
64 
65 typedef struct _MSFmtDescriptor MSFmtDescriptor;
66 
67 MS2_PUBLIC const char *ms_fmt_descriptor_to_string(const MSFmtDescriptor *orig);
68 
69 MS2_PUBLIC bool_t ms_fmt_descriptor_equals(const MSFmtDescriptor *fmt1, const MSFmtDescriptor *fmt2);
70 
71 
72 #ifdef __cplusplus
73 }
74 #endif
75 
76 #endif
77