2007-05-30 18:52:56 +02:00
|
|
|
/* the Music Player Daemon (MPD)
|
|
|
|
* Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
|
|
|
|
* This project's homepage is: http://www.musicpd.org
|
|
|
|
*
|
|
|
|
* 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, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
2008-09-07 22:41:17 +02:00
|
|
|
#include "../output_api.h"
|
2007-05-30 20:16:35 +02:00
|
|
|
#include "../timer.h"
|
2007-05-30 18:52:56 +02:00
|
|
|
|
2008-08-26 08:27:02 +02:00
|
|
|
static int null_initDriver(AudioOutput *audioOutput,
|
|
|
|
mpd_unused ConfigParam *param)
|
2007-05-30 18:52:56 +02:00
|
|
|
{
|
2007-05-30 20:16:35 +02:00
|
|
|
audioOutput->data = NULL;
|
2007-05-30 18:52:56 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int null_openDevice(AudioOutput *audioOutput)
|
|
|
|
{
|
2007-05-30 20:16:35 +02:00
|
|
|
audioOutput->data = timer_new(&audioOutput->outAudioFormat);
|
2007-05-30 18:52:56 +02:00
|
|
|
audioOutput->open = 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void null_closeDevice(AudioOutput *audioOutput)
|
|
|
|
{
|
2007-05-30 20:16:35 +02:00
|
|
|
if (audioOutput->data) {
|
|
|
|
timer_free(audioOutput->data);
|
|
|
|
audioOutput->data = NULL;
|
|
|
|
}
|
2007-05-30 18:52:56 +02:00
|
|
|
|
|
|
|
audioOutput->open = 0;
|
|
|
|
}
|
|
|
|
|
2008-04-12 06:15:52 +02:00
|
|
|
static int null_playAudio(AudioOutput *audioOutput,
|
2008-08-26 08:27:02 +02:00
|
|
|
mpd_unused const char *playChunk, size_t size)
|
2007-05-30 18:52:56 +02:00
|
|
|
{
|
2007-05-30 20:16:35 +02:00
|
|
|
Timer *timer = audioOutput->data;
|
2007-05-30 18:52:56 +02:00
|
|
|
|
2007-05-30 20:16:35 +02:00
|
|
|
if (!timer->started)
|
|
|
|
timer_start(timer);
|
|
|
|
else
|
|
|
|
timer_sync(timer);
|
2007-05-30 18:52:56 +02:00
|
|
|
|
2007-05-30 20:16:35 +02:00
|
|
|
timer_add(timer, size);
|
2007-05-30 18:52:56 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-05-30 20:16:35 +02:00
|
|
|
static void null_dropBufferedAudio(AudioOutput *audioOutput)
|
|
|
|
{
|
|
|
|
timer_reset(audioOutput->data);
|
|
|
|
}
|
|
|
|
|
2007-05-30 18:52:56 +02:00
|
|
|
AudioOutputPlugin nullPlugin = {
|
|
|
|
"null",
|
|
|
|
NULL,
|
|
|
|
null_initDriver,
|
2007-05-30 20:16:35 +02:00
|
|
|
NULL,
|
2007-05-30 18:52:56 +02:00
|
|
|
null_openDevice,
|
|
|
|
null_playAudio,
|
|
|
|
null_dropBufferedAudio,
|
|
|
|
null_closeDevice,
|
|
|
|
NULL,
|
|
|
|
};
|