forked from thesofproject/sof
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfile.h
More file actions
60 lines (51 loc) · 1.27 KB
/
file.h
File metadata and controls
60 lines (51 loc) · 1.27 KB
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
52
53
54
55
56
57
58
59
60
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2018 Intel Corporation. All rights reserved.
*
* Author: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
* Liam Girdwood <liam.r.girdwood@linux.intel.com>
* Keyon Jie <yang.jie@linux.intel.com>
* Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
*/
#ifndef _FILE_H
#define _FILE_H
#include <stdint.h>
/**< Convert with right shift a bytes count to samples count */
#define FILE_BYTES_TO_S16_SAMPLES(s) ((s) >> 1)
#define FILE_BYTES_TO_S32_SAMPLES(s) ((s) >> 2)
/* file component modes */
enum file_mode {
FILE_READ = 0,
FILE_WRITE,
FILE_DUPLEX,
};
enum file_format {
FILE_TEXT = 0,
FILE_RAW,
};
/* file component state */
struct file_state {
uint64_t cycles_count;
FILE *rfh, *wfh; /* read/write file handle */
char *fn;
int copy_count;
int n;
enum file_mode mode;
enum file_format f_format;
bool reached_eof;
bool write_failed;
};
/* file comp data */
struct file_comp_data {
struct file_state fs;
enum sof_ipc_frame frame_fmt;
uint32_t channels;
uint32_t rate;
int sample_container_bytes;
int (*file_func)(struct comp_dev *dev, struct audio_stream *sink,
struct audio_stream *source, uint32_t frames);
/* maximum limits */
int max_samples;
int max_copies;
};
#endif