Main Page   Data Structures   File List   Data Fields   Globals  

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.14 2003/04/08 15:14:57 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 
00053 /*
00054  * Format of version number is 0x1000 + version
00055  * So 0x1001 is *binary* format version 1
00056  * THE VERSION NUMBER IS *NOT* A USER SERVICABLE PART!
00057  */
00058 
00062 #define INPUT_PLUGIN_BASE_VERSION       0x1000
00063 
00069 #define INPUT_PLUGIN_VERSION    (INPUT_PLUGIN_BASE_VERSION + 16)
00070 
00076 typedef struct _input_object
00077 {
00082         int ready;
00087         int flags;
00092         int nr_frames;
00097         int nr_tracks;
00102         int nr_channels;
00107         int frame_size;
00111         void *local_data;
00116         pthread_mutex_t object_mutex;
00117 } input_object;
00118 
00119 
00124 typedef struct _stream_info
00125 {
00130         char    stream_type[128];
00134         char    artist[128];
00138         char    title[128];
00142         char    album[128];
00146         char    genre[128];
00150         char    year[10];
00154         char    track[10];
00158         char    comment[128];
00164         char    status[32];
00168         char    path[1024];
00172         int     channels;
00176         int     tracks;
00180         int     current_track;
00184         int     sample_rate;
00188         int     bitrate;
00189 } stream_info;
00190 
00194 typedef int input_version_type;
00195 
00199 typedef int input_flags_type;
00200 
00204 typedef int(*input_init_type)(void);
00205 
00209 typedef void(*input_shutdown_type)(void);
00210 
00214 typedef void* input_plugin_handle_type;
00215 
00224 typedef float(*input_can_handle_type)(const char *path);
00225 
00231 typedef int(*input_open_type)(input_object *obj, const char *path);
00232 
00237 typedef void(*input_close_type)(input_object *obj);
00238 
00247 typedef int(*input_play_frame_type)(input_object *obj, char *buffer);
00248 
00255 typedef int(*input_frame_seek_type)(input_object *obj, int frame);
00256 
00262 typedef int(*input_frame_size_type)(input_object *obj);
00263 
00268 typedef int(*input_nr_frames_type)(input_object *obj);
00269 
00277 typedef  long(*input_frame_to_sec_type)(input_object *obj ,int frame);
00278 
00284 typedef int(*input_sample_rate_type)(input_object *obj);
00285 
00291 typedef int(*input_channels_type)(input_object *obj);
00292 
00300 typedef int(*input_stream_info_type)(input_object *obj,stream_info *info);
00301 
00306 typedef int(*input_nr_tracks_type)(input_object *obj);
00307 
00308 /* @param obj input object
00309  * @param track track to seek to
00310  * 
00311  * Seek to a track. Optional
00312  */
00313 typedef int(*input_track_seek_type)(input_object *obj, int track);
00314 
00315 
00316 typedef struct _input_plugin
00317 {
00321         input_version_type version;
00325         input_flags_type        flags;
00329         char *name;
00334         char *author;
00338         void *handle;
00339         input_init_type init;
00340         input_shutdown_type shutdown;
00341         input_plugin_handle_type plugin_handle;
00342         input_can_handle_type can_handle;
00343         input_open_type open;
00344         input_close_type close;
00345         input_play_frame_type play_frame;
00346         input_frame_seek_type frame_seek;
00347         input_frame_size_type frame_size;
00348         input_nr_frames_type nr_frames;
00349         input_frame_to_sec_type frame_to_sec;
00350         input_sample_rate_type sample_rate;
00351         input_channels_type channels;
00352         input_stream_info_type stream_info;
00353         input_nr_tracks_type nr_tracks;
00354         input_track_seek_type track_seek;
00355 } input_plugin;
00356 
00364 typedef input_plugin*(*input_plugin_info_type)(void);
00365 
00366 #endif

Generated on Fri May 2 06:33:01 2003 for AlsaPlayer by doxygen1.2.18