summaryrefslogtreecommitdiffstats
path: root/parecord/audio_types.h
blob: e924cf4ee6d5c139bfeb72281b4aa395c4ab79db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef PAR_AUDIOTYPES_H
#define PAR_AUDIOTYPES_H

#include <stdint.h>
#include <sys/types.h>
#include <pulse/sample.h>

#include "wav_header.h"

#define MAX_AUDIO_TYPE_LEN 5
#define MAX_AUDIO_FORMAT_LEN 11

enum audio_types {
	AUDIO_TYPE_WAVE,
	AUDIO_TYPE_MAX,
	AUDIO_TYPE_NONE = -1
};

struct audio_types_info {
	const char name[MAX_AUDIO_TYPE_LEN];
	off_t rsv_bytes;
};

enum audio_formats {
	AUDIO_FORMAT_U8 = PA_SAMPLE_U8,
	AUDIO_FORMAT_ALAW = PA_SAMPLE_ALAW,
	AUDIO_FORMAT_ULAW = PA_SAMPLE_ULAW,
	AUDIO_FORMAT_S16LE = PA_SAMPLE_S16LE,
	AUDIO_FORMAT_S16BE = PA_SAMPLE_S16BE,
	AUDIO_FORMAT_FLOAT32LE = PA_SAMPLE_FLOAT32LE,
	AUDIO_FORMAT_FLOAT32BE = PA_SAMPLE_FLOAT32BE,
	AUDIO_FORMAT_S32LE = PA_SAMPLE_S32LE,
	AUDIO_FORMAT_S32BE = PA_SAMPLE_S32BE,
	AUDIO_FORMAT_S24LE = PA_SAMPLE_S24LE,
	AUDIO_FORMAT_S24BE = PA_SAMPLE_S24BE,
	AUDIO_FORMAT_S24_32LE = PA_SAMPLE_S24_32LE,
	AUDIO_FORMAT_S24_32BE = PA_SAMPLE_S24_32BE,
	AUDIO_FORMAT_MAX = 13,
	AUDIO_FORMAT_NONE = -1
};

struct wav_header *init_wav_header(struct wav_header *header,
	uint32_t size, uint16_t audioFormat, uint16_t numChannels,
	uint32_t sampleRate, uint32_t bitsPerSample);
int checkAudioType(char *source);
char *getAllAudioTypes();
off_t getOffset(int format);
int checkAudioFormat(char *source);
char *getAllAudioFormats();

#endif /* AT_AUDIOTYPES_H */