diff options
author | John Crispin <blogic@openwrt.org> | 2007-08-27 20:10:35 +0000 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2007-08-27 20:10:35 +0000 |
commit | a2c409cda27b6aaae7dc34759ba2c8285ddd01d3 (patch) | |
tree | e77ccd710367d8139ccc8be6145e15c42600060e /package/fonera-mp3/src/lib/mp3_playtime.c | |
parent | 37266a51f1289f940d571c0871d17dfbe76f7aed (diff) | |
download | master-187ad058-a2c409cda27b6aaae7dc34759ba2c8285ddd01d3.tar.gz master-187ad058-a2c409cda27b6aaae7dc34759ba2c8285ddd01d3.tar.bz2 master-187ad058-a2c409cda27b6aaae7dc34759ba2c8285ddd01d3.zip |
added libjson-c. added driver, webinterface and userspace daemon for the
fonera mp3-hack
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@8509 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/fonera-mp3/src/lib/mp3_playtime.c')
-rw-r--r-- | package/fonera-mp3/src/lib/mp3_playtime.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/package/fonera-mp3/src/lib/mp3_playtime.c b/package/fonera-mp3/src/lib/mp3_playtime.c new file mode 100644 index 0000000000..89325943ff --- /dev/null +++ b/package/fonera-mp3/src/lib/mp3_playtime.c @@ -0,0 +1,61 @@ +/* +* FOXMP3 +* Copyright (c) 2006 acmesystems.it - john@acmesystems.it +* +* 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 2 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, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA +* +* Feedback, Bugs... info@acmesystems.it +* +*/ + + +#include <unistd.h> +#include <signal.h> +#include <stdio.h> +#include "mp3.h" + + +static MP3_PLAYTIME *mp3_playtime; + +void sig_alarm_handler(int sig){ + alarm(1); + mp3_playtime->playtime++; + mp3_playtime->playtime_secs++; + if(mp3_playtime->playtime_secs > 59){ + mp3_playtime->playtime_mins++; + mp3_playtime->playtime_secs = 0; + } + state_generic_event(MP3_EVENT_GENERIC_PLAYTIME, 0, NULL); +}; + +void mp3_playtime_init(MP3_PLAYTIME *playtime){ + mp3_playtime = playtime; + signal(SIGALRM, sig_alarm_handler); +}; + +void mp3_playtime_start(void){ + mp3_playtime->playtime = 0; + mp3_playtime->playtime_secs = 0; + mp3_playtime->playtime_mins = 0; + alarm(1); + state_generic_event(MP3_EVENT_GENERIC_PLAYTIME, 0, NULL); +}; + +void mp3_playtime_stop(void){ + alarm(0); + mp3_playtime->playtime = 0; + mp3_playtime->playtime_secs = 0; + mp3_playtime->playtime_mins = 0; +}; |