inputPlugin.h 2.31 KB
Newer Older
Warren Dukes's avatar
Warren Dukes committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/* the Music Player Daemon (MPD)
 * (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
 * 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
 */

Warren Dukes's avatar
Warren Dukes committed
19 20 21
#ifndef INPUT_PLUGIN_H
#define INPUT_PLUGIN_H

Warren Dukes's avatar
Warren Dukes committed
22
#include "../config.h"
23 24 25 26 27
#include "inputStream.h"
#include "decode.h"
#include "outputBuffer.h"
#include "tag.h"

Warren Dukes's avatar
Warren Dukes committed
28 29 30
#define INPUT_PLUGIN_STREAM_FILE	0x01
#define INPUT_PLUGIN_STREAM_URL		0x02

31 32 33 34
typedef int (* InputPlugin_initFunc) ();

typedef void (* InputPlugin_finishFunc) ();

Warren Dukes's avatar
Warren Dukes committed
35 36 37
typedef int (* InputPlugin_streamDecodeFunc) (OutputBuffer *, DecoderControl *,
		InputStream *);

38 39
typedef int (* InputPlugin_fileDecodeFunc) (OutputBuffer *, DecoderControl *,
		char * path);
Warren Dukes's avatar
Warren Dukes committed
40

41 42
/* file should be the full path! */
typedef MpdTag * (* InputPlugin_tagDupFunc) (char * file);
Warren Dukes's avatar
Warren Dukes committed
43 44

typedef struct _InputPlugin {
Warren Dukes's avatar
Warren Dukes committed
45
	char * name;
46 47
	InputPlugin_initFunc initFunc;
	InputPlugin_finishFunc finishFunc;
Warren Dukes's avatar
Warren Dukes committed
48 49 50 51 52 53 54 55
	InputPlugin_streamDecodeFunc streamDecodeFunc;
	InputPlugin_fileDecodeFunc fileDecodeFunc;
	InputPlugin_tagDupFunc tagDupFunc;
	unsigned char streamTypes;
	char ** suffixes;
	char ** mimeTypes;
} InputPlugin;

56 57 58 59
/* individual functions to load/unload plugins */
void loadInputPlugin(InputPlugin * inputPlugin);
void unloadInputPlugin(InputPlugin * inputPlugin);

Warren Dukes's avatar
Warren Dukes committed
60 61 62 63
/* interface for using plugins */

InputPlugin * getInputPluginFromSuffix(char * suffix);

Warren Dukes's avatar
Warren Dukes committed
64
InputPlugin * getInputPluginFromMimeType(char * mimeType);
Warren Dukes's avatar
Warren Dukes committed
65 66 67

InputPlugin * getInputPluginFromName(char * name);

68 69
void printAllInputPluginSuffixes(FILE * fp);

Warren Dukes's avatar
Warren Dukes committed
70 71 72 73 74 75
/* this is where we "load" all the "plugins" ;-) */
void initInputPlugins();

/* this is where we "unload" all the "plugins" */
void finishInputPlugins();

Warren Dukes's avatar
Warren Dukes committed
76
#endif