File: wavsplit.h

package info (click to toggle)
wavsplit 1.1.0-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 168 kB
  • ctags: 90
  • sloc: ansic: 687; makefile: 62; sh: 14
file content (143 lines) | stat: -rw-r--r-- 3,063 bytes parent folder | download
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#ifndef WAVSPLIT_H
#define WAVSPLIT_H

#include <stdio.h>

#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>

#include <stdlib.h>
#include <errno.h>
#include <getopt.h>
#include <math.h>
#include <string.h>
#include <assert.h>

#define VERSION "1.1.0"
#define MAX_PATH 255
#define BUFFERSIZE 65536
#define PCM_WAVE_FORMAT  1
#define DEFAULT_VERBOSE 1
#define DEFAULT_TEST 0
#define DEFAULT_HOURS 0
#define DEFAULT_FRAMES 0
#define DEFAULT_FPS 25
#define DEFAULT_SECONDS 0
#define OPF_QUIET 'q'
#define OPF_HELP 'h'
#define OPF_HOURS 'H'
#define OPF_FRAMES 'f'
#define OPF_SECONDS 's'
#define OPF_QUIET_LONG "quiet"
#define OPF_HELP_LONG "help"
#define OPF_HOURS_LONG "Hours"
#define OPF_FRAMES_LONG "frames"
#define OPF_SECONDS_LONG "seconds"


typedef enum {
  USE_HOURS,
  USE_FRAMES,
  USE_SECONDS
} TIMEFORMAT;

typedef struct {
  u_long dwSize;
  u_short wFormatTag;
  u_short wChannels;
  u_long dwSamplesPerSec;
  u_long dwAvgBytesPerSec;
  u_short wBlockAlign;
  u_short wBitsPerSample;
} WAVEFORMAT;

typedef struct {
  char RiffID[4];
  u_long RiffSize;
  char WaveID[4];
  char FmtID[4];
  u_long FmtSize;
  u_short wFormatTag;
  u_short nChannels;
  u_long nSamplesPerSec;
  u_long nAvgBytesPerSec;
  u_short nBlockAlign;
  u_short wBitsPerSample;
  char DataID[4];
  u_long nDataBytes;
} WAVE_HEADER;

typedef struct {
  int hr;
  int min;
  double sek;                   /* APF allow decimal point in seconds */
  int seki;                     /* integer seconds for use with frames */
  double frames;                /* specify in frames - default 25fps */
} timepos;


static WAVE_HEADER waveheader = {
  {'R', 'I', 'F', 'F'},
  0,
  {'W', 'A', 'V', 'E'},
  {'f', 'm', 't', ' '},
  16,
/* FmtSize*/
  PCM_WAVE_FORMAT,
/* wFormatTag*/
  0,
/* nChannels*/
  0,
  0,
  0,
  0,
  {'d', 'a', 't', 'a'},
  0
};                              /* waveheader */

#ifdef __powerpc__

static __inline__ long _LE_long (unsigned char *lp)
{
  return (lp[3] << 24 | lp[2] << 16 | lp[1] << 8 | lp[0]);
}

static __inline__ short _LE_short (unsigned char *lp)
{
  return (lp[1] << 8 | lp[0]);
}

#endif

char *findchunk ();
int readheader ();
void Report(const char * Message, const char * Severity, int Verbose);
int TokenOK (const char *Message, char **strPtr);
int checkfps (unsigned int fps);
int split (unsigned int UseHours, unsigned int UseFrames,
           unsigned int fps,
           int splits, timepos * splitpos);
long calcsplit (unsigned int UseHours, unsigned int UseFrames,
                unsigned int fps,
                int splitnr, timepos * split);
int createout ();
int closeout ();
void display (unsigned char avgleft, unsigned char avgright,
              unsigned char avgloud);
void usage ();
long stdread (char *buf, long nchars);
#ifdef __powerpc__
static _ConvertHeaderFromNative (WAVE_HEADER * hdr);
static _ConvertHeaderToNative (WAVE_HEADER * hdr);
#endif

char *ptr;
WAVEFORMAT waveformat;
u_long databytes, b;
int ifd, ofd;
int verbose;
char basename[MAX_PATH + 1], ifile[MAX_PATH + 1];

#endif