-
Notifications
You must be signed in to change notification settings - Fork 12
/
olympusdvr.h
104 lines (92 loc) · 3.37 KB
/
olympusdvr.h
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/* olympusdvr.h: Olympus DVR library
*
* Copyright (C) 2007-2008 Tristan Willy <tristan.willy at gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OLYMPUSDVR_H
#define OLYMPUSDVR_H
#include <stdint.h>
/* odvr_open flags */
#define ODVR_TRACE 1
/* misc defined */
#define ODVR_FOLDER_A 1
#define ODVR_FOLDER_B 2
#define ODVR_FOLDER_C 3
#define ODVR_FOLDER_D 4
#define ODVR_FOLDER_S 4
#define ODVR_NUM_FOLDERS 4
#define ODVR_QUALITY_HQ 2
#define ODVR_QUALITY_SP 0
#define ODVR_QUALITY_LP 1
#define ODVR_QUALITY_NEW_SP 5
#define ODVR_QUALITY_NEW_LP 6
#define ODVR_QUALITY_NEW_HQ 7
#define ODVR_QUALITY_XHQ 8
#define ODVR_QUALITY_NUM 9 /* Number of quality settings */
typedef struct odvr * odvr;
typedef struct filestat {
uint8_t folder;
uint8_t slot;
uint16_t id;
uint16_t size;
uint8_t month;
uint8_t day;
uint8_t year; /* year = 2000 + filestat.year */
uint8_t hour;
uint8_t min;
uint8_t sec;
uint8_t quality;
} filestat_t;
/* open and close interfaces */
odvr odvr_open(int);
void odvr_close(odvr);
/* resets the DVR and reconnects to it */
int odvr_reset(odvr, int);
/* return a string describing an error */
const char *odvr_error(odvr);
/* Turn on/off tracing */
int odvr_enable_trace(odvr);
int odvr_disable_trace(odvr);
/* return specific model (multiple models per product ID) */
const char *odvr_model(odvr);
/* returns the number of used slots in a folder */
int odvr_filecount(odvr, uint8_t folder);
/* returns the number of folders in the device */
int odvr_foldercount(odvr);
/* returns folder code for ASCII character name */
uint8_t odvr_foldercode(odvr, const char);
/* returns folder ASCII character name for a given folder code */
char odvr_foldername(odvr, const uint8_t);
/* get folder/slot metadata, like quality and recording date */
int odvr_filestat(odvr, uint8_t folder, uint8_t slot, filestat_t *);
/* file size to length convert */
float odvr_length(filestat_t *);
/* file size to wav file size convert */
uint32_t odvr_wavfilesize(filestat_t *stat);
/* returns a description of a quality level */
const char *odvr_quality_name(uint8_t quality);
/* open a folder/slot for reading */
int odvr_open_file(odvr, uint8_t folder, uint8_t slot);
/* returns minimum block size */
int odvr_block_size(odvr);
/* read a block of signed PCM 16 */
int odvr_read_block(odvr, void *block, int maxbytes, uint8_t quality);
/* open, read, and save a WAV file */
int odvr_save_wav(odvr, uint8_t folder, uint8_t slot, int fd);
/* open, read, and save a raw data file */
int odvr_save_raw(odvr, uint8_t folder, uint8_t slot, int fd);
/* delete a whole folder */
int odvr_clear_folder(odvr, uint8_t folder);
#endif /* OLYMPUSDVR_H */