input_plugin.h

Go to the documentation of this file.
00001 /*  input_plugin.h -  Use this to write input plugins
00002  *  Copyright (C) 1999-2002 Andy Lo A Foe <andy@alsaplayer.org>
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  *
00018  *
00019  *  $Id: input_plugin.h,v 1.15 2003/05/16 19:50:34 adnans Exp $
00020  *  
00021  */ 
00022 
00023 #ifndef __input_plugin_h__
00024 #define __input_plugin_h__
00025 
00026 #include <pthread.h>
00027 
00031 #define P_SEEK          1
00032 
00036 #define P_PERFECTSEEK   2
00037 
00041 #define P_REENTRANT     4
00042 
00046 #define P_FILEBASED     8
00047 
00051 #define P_STREAMBASED   16
00052 
00056 #define P_BUFFERING     32
00057 
00058 /*
00059  * Format of version number is 0x1000 + version
00060  * So 0x1001 is *binary* format version 1
00061  * THE VERSION NUMBER IS *NOT* A USER SERVICABLE PART!
00062  */
00063 
00067 #define INPUT_PLUGIN_BASE_VERSION       0x1000
00068 
00074 #define INPUT_PLUGIN_VERSION    (INPUT_PLUGIN_BASE_VERSION + 16)
00075 
00081 typedef struct _input_object
00082 {
00087         int ready;
00092         int flags;
00097         int nr_frames;
00102         int nr_tracks;
00107         int nr_channels;
00112         int frame_size;
00116         void *local_data;
00121         pthread_mutex_t object_mutex;
00122 } input_object;
00123 
00124 
00129 typedef struct _stream_info
00130 {
00135         char    stream_type[128];
00139         char    artist[128];
00143         char    title[128];
00147         char    album[128];
00151         char    genre[128];
00155         char    year[10];
00159         char    track[10];
00163         char    comment[128];
00169         char    status[32];
00173         char    path[1024];
00177         int     channels;
00181         int     tracks;
00185         int     current_track;
00189         int     sample_rate;
00193         int     bitrate;
00194 } stream_info;
00195 
00199 typedef int input_version_type;
00200 
00204 typedef int input_flags_type;
00205 
00209 typedef int(*input_init_type)(void);
00210 
00214 typedef void(*input_shutdown_type)(void);
00215 
00219 typedef void* input_plugin_handle_type;
00220 
00229 typedef float(*input_can_handle_type)(const char *path);
00230 
00236 typedef int(*input_open_type)(input_object *obj, const char *path);
00237 
00242 typedef void(*input_close_type)(input_object *obj);
00243 
00252 typedef int(*input_play_frame_type)(input_object *obj, char *buffer);
00253 
00260 typedef int(*input_frame_seek_type)(input_object *obj, int frame);
00261 
00267 typedef int(*input_frame_size_type)(input_object *obj);
00268 
00273 typedef int(*input_nr_frames_type)(input_object *obj);
00274 
00282 typedef  long(*input_frame_to_sec_type)(input_object *obj ,int frame);
00283 
00289 typedef int(*input_sample_rate_type)(input_object *obj);
00290 
00296 typedef int(*input_channels_type)(input_object *obj);
00297 
00305 typedef int(*input_stream_info_type)(input_object *obj,stream_info *info);
00306 
00311 typedef int(*input_nr_tracks_type)(input_object *obj);
00312 
00313 /* @param obj input object
00314  * @param track track to seek to
00315  * 
00316  * Seek to a track. Optional
00317  */
00318 typedef int(*input_track_seek_type)(input_object *obj, int track);
00319 
00320 
00321 typedef struct _input_plugin
00322 {
00326         input_version_type version;
00330         input_flags_type        flags;
00334         char *name;
00339         char *author;
00343         void *handle;
00344         input_init_type init;
00345         input_shutdown_type shutdown;
00346         input_plugin_handle_type plugin_handle;
00347         input_can_handle_type can_handle;
00348         input_open_type open;
00349         input_close_type close;
00350         input_play_frame_type play_frame;
00351         input_frame_seek_type frame_seek;
00352         input_frame_size_type frame_size;
00353         input_nr_frames_type nr_frames;
00354         input_frame_to_sec_type frame_to_sec;
00355         input_sample_rate_type sample_rate;
00356         input_channels_type channels;
00357         input_stream_info_type stream_info;
00358         input_nr_tracks_type nr_tracks;
00359         input_track_seek_type track_seek;
00360 } input_plugin;
00361 
00369 typedef input_plugin*(*input_plugin_info_type)(void);
00370 
00371 #endif

Generated on Wed Nov 22 12:31:55 2006 for AlsaPlayer by  doxygen 1.5.1