blob: a58123b7e4aaca90314dbf41d90b365dc7baf64a (
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/*
* probe_wav.c - WAV probing code using wavlib.
* (C) 2006-2010 - Francesco Romani <fromani -at- gmail -dot- com>
*
* This file is part of transcode, a video stream processing tool.
*
* transcode 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 2 of the License, or
* (at your option) any later version.
*
* transcode 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/>.
*/
#include "transcode.h"
#include "tcinfo.h"
#include "ioaux.h"
#include "tc.h"
#include "avilib/wavlib.h"
#include "libtc/libtc.h"
void probe_wav(info_t *ipipe)
{
WAVError err = 0;
WAV wav = NULL;
int chans = 0;
wav = wav_fdopen(ipipe->fd_in, WAV_READ, &err);
if (!wav) {
tc_log_error(__FILE__, "%s", wav_strerror(err));
ipipe->error = 1;
return;
}
chans = wav_get_channels(wav);
ipipe->probe_info->track[0].chan = chans;
ipipe->probe_info->track[0].samplerate = wav_get_rate(wav);
ipipe->probe_info->track[0].bits = wav_get_bits(wav);
ipipe->probe_info->track[0].bitrate = wav_get_bitrate(wav);
ipipe->probe_info->track[0].format = 0x1; /* XXX */
ipipe->probe_info->magic = TC_MAGIC_WAV;
ipipe->probe_info->codec = TC_CODEC_PCM;
if (ipipe->probe_info->track[0].chan > 0) {
ipipe->probe_info->num_tracks = 1;
}
return;
}
/*************************************************************************/
/*
* Local variables:
* c-file-style: "stroustrup"
* c-file-offsets: ((case-label . *) (statement-case-intro . *))
* indent-tabs-mode: nil
* End:
*
* vim: expandtab shiftwidth=4:
*/
|