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, write to the Free Software 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 */ 24 25static int 26_get_pcmfileinfo(char *filename, struct song_metadata *psong) 27{ 28 struct stat file; 29 uint32_t sec, ms; 30 31 if( stat(filename, &file) != 0 ) 32 { 33 DPRINTF(E_WARN, L_SCANNER, "Could not stat %s\n", filename); 34 return -1; 35 } 36 37 psong->file_size = file.st_size; 38 psong->bitrate = 1411200; 39 psong->samplerate = 44100; 40 psong->channels = 2; 41 sec = psong->file_size / (psong->bitrate / 8); 42 ms = ((psong->file_size % (psong->bitrate / 8)) * 1000) / (psong->bitrate / 8); 43 psong->song_length = (sec * 1000) + ms; 44 psong->lossless = 1; 45 46 asprintf(&(psong->mime), "audio/L16;rate=%d;channels=%d", psong->samplerate, psong->channels); 47 asprintf(&(psong->dlna_pn), "LPCM"); 48 49 return 0; 50} 51