2009-03-13 18:43:16 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2003-2009 The Music Player Daemon Project
|
|
|
|
* http://www.musicpd.org
|
2008-08-26 08:27:04 +02:00
|
|
|
*
|
|
|
|
* 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.
|
2009-03-13 18:43:16 +01:00
|
|
|
*
|
|
|
|
* 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.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2008-08-26 08:27:04 +02:00
|
|
|
*/
|
|
|
|
|
2008-10-31 09:19:53 +01:00
|
|
|
#ifndef MPD_DECODER_API_H
|
|
|
|
#define MPD_DECODER_API_H
|
2008-08-26 08:27:04 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This is the public API which is used by decoder plugins to
|
|
|
|
* communicate with the mpd core.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2009-02-15 18:33:31 +01:00
|
|
|
#include "decoder_command.h"
|
2009-02-15 17:48:37 +01:00
|
|
|
#include "decoder_plugin.h"
|
2008-10-26 19:38:50 +01:00
|
|
|
#include "input_stream.h"
|
2008-11-11 15:55:34 +01:00
|
|
|
#include "replay_gain.h"
|
2008-08-26 08:27:06 +02:00
|
|
|
#include "tag.h"
|
2008-09-07 19:19:55 +02:00
|
|
|
#include "audio_format.h"
|
2009-02-15 18:34:14 +01:00
|
|
|
#include "conf.h"
|
2008-08-26 08:27:06 +02:00
|
|
|
|
2008-10-08 11:03:39 +02:00
|
|
|
#include <stdbool.h>
|
2008-08-26 08:27:06 +02:00
|
|
|
|
2008-08-26 08:41:05 +02:00
|
|
|
|
2008-08-26 08:27:04 +02:00
|
|
|
/**
|
|
|
|
* Notify the player thread that it has finished initialization and
|
|
|
|
* that it has read the song's meta data.
|
|
|
|
*/
|
2008-08-26 08:27:05 +02:00
|
|
|
void decoder_initialized(struct decoder * decoder,
|
2008-09-07 19:19:55 +02:00
|
|
|
const struct audio_format *audio_format,
|
2008-11-02 17:01:51 +01:00
|
|
|
bool seekable, float total_time);
|
2008-08-26 08:27:04 +02:00
|
|
|
|
2009-01-04 19:09:34 +01:00
|
|
|
/**
|
|
|
|
* Returns the URI of the current song in UTF-8 encoding.
|
|
|
|
*
|
|
|
|
* The return value is allocated on the heap, and must be freed by the
|
|
|
|
* caller.
|
|
|
|
*/
|
|
|
|
char *decoder_get_uri(struct decoder *decoder);
|
2008-08-26 08:27:07 +02:00
|
|
|
|
2008-08-26 08:27:07 +02:00
|
|
|
enum decoder_command decoder_get_command(struct decoder * decoder);
|
|
|
|
|
2008-08-26 08:27:07 +02:00
|
|
|
/**
|
|
|
|
* Called by the decoder when it has performed the requested command
|
|
|
|
* (dc->command). This function resets dc->command and wakes up the
|
|
|
|
* player thread.
|
|
|
|
*/
|
|
|
|
void decoder_command_finished(struct decoder * decoder);
|
|
|
|
|
2008-08-26 08:27:07 +02:00
|
|
|
double decoder_seek_where(struct decoder * decoder);
|
|
|
|
|
|
|
|
void decoder_seek_error(struct decoder * decoder);
|
|
|
|
|
2008-08-26 08:27:14 +02:00
|
|
|
/**
|
|
|
|
* Blocking read from the input stream. Returns the number of bytes
|
|
|
|
* read, or 0 if one of the following occurs: end of file; error;
|
|
|
|
* command (like SEEK or STOP).
|
|
|
|
*/
|
|
|
|
size_t decoder_read(struct decoder *decoder,
|
2008-10-17 17:53:48 +02:00
|
|
|
struct input_stream *inStream,
|
2008-08-26 08:27:14 +02:00
|
|
|
void *buffer, size_t length);
|
|
|
|
|
2008-08-26 08:27:05 +02:00
|
|
|
/**
|
|
|
|
* This function is called by the decoder plugin when it has
|
|
|
|
* successfully decoded block of input data.
|
|
|
|
*
|
|
|
|
* We send inStream for buffering the inputStream while waiting to
|
|
|
|
* send the next chunk
|
|
|
|
*/
|
2008-08-26 08:27:07 +02:00
|
|
|
enum decoder_command
|
2008-10-17 17:53:48 +02:00
|
|
|
decoder_data(struct decoder *decoder,
|
2008-11-02 17:01:51 +01:00
|
|
|
struct input_stream *inStream,
|
2009-01-17 13:23:12 +01:00
|
|
|
const void *data, size_t datalen,
|
|
|
|
float data_time, uint16_t bitRate,
|
2008-11-11 15:55:34 +01:00
|
|
|
struct replay_gain_info *replay_gain_info);
|
2008-08-26 08:27:05 +02:00
|
|
|
|
2008-11-02 17:02:28 +01:00
|
|
|
/**
|
|
|
|
* This function is called by the decoder plugin when it has
|
|
|
|
* successfully decoded a tag.
|
|
|
|
*
|
|
|
|
* @param is an input stream which is buffering while we are waiting
|
|
|
|
* for the player
|
|
|
|
*/
|
|
|
|
enum decoder_command
|
|
|
|
decoder_tag(struct decoder *decoder, struct input_stream *is,
|
|
|
|
const struct tag *tag);
|
|
|
|
|
2008-08-26 08:27:04 +02:00
|
|
|
#endif
|