1 //=========================================================================
2 // FILENAME : tagutils-pcm.c
3 // DESCRIPTION : Return default PCM values.
4 //=========================================================================
5 // Copyright (c) 2009 NETGEAR, Inc. All Rights Reserved.
6 // based on software from Ron Pedde's FireFly Media Server project
7 //=========================================================================
8
9 /*
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24 static int
_get_pcmfileinfo(char * filename,struct song_metadata * psong)25 _get_pcmfileinfo(char *filename, struct song_metadata *psong)
26 {
27 struct stat file;
28 uint32_t sec, ms;
29
30 if( stat(filename, &file) != 0 )
31 {
32 DPRINTF(E_WARN, L_SCANNER, "Could not stat %s\n", filename);
33 return -1;
34 }
35
36 psong->file_size = file.st_size;
37 psong->bitrate = 1411200;
38 psong->samplerate = 44100;
39 psong->channels = 2;
40 sec = psong->file_size / (psong->bitrate / 8);
41 ms = ((psong->file_size % (psong->bitrate / 8)) * 1000) / (psong->bitrate / 8);
42 psong->song_length = (sec * 1000) + ms;
43 psong->lossless = 1;
44
45 xasprintf(&(psong->mime), "audio/L16;rate=%d;channels=%d", psong->samplerate, psong->channels);
46 xasprintf(&(psong->dlna_pn), "LPCM");
47
48 return 0;
49 }
50