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 1101 2007-04-02 20:57:43Z peter_lemenkov $ 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; 00120 char* path; 00125 pthread_mutex_t object_mutex; 00126 } input_object; 00127 00128 00133 typedef struct _stream_info 00134 { 00139 char stream_type[128]; 00143 char artist[128]; 00147 char title[128]; 00151 char album[128]; 00155 char genre[128]; 00159 char year[10]; 00163 char track[10]; 00167 char comment[128]; 00173 char status[32]; 00177 char path[1024]; 00181 int channels; 00185 int tracks; 00189 int current_track; 00193 int sample_rate; 00197 int bitrate; 00198 } stream_info; 00199 00203 typedef int input_version_type; 00204 00208 typedef int input_flags_type; 00209 00213 typedef int(*input_init_type)(void); 00214 00218 typedef void(*input_shutdown_type)(void); 00219 00223 typedef void* input_plugin_handle_type; 00224 00233 typedef float(*input_can_handle_type)(const char *path); 00234 00240 typedef int(*input_open_type)(input_object *obj, const char *path); 00241 00246 typedef void(*input_close_type)(input_object *obj); 00247 00256 typedef int(*input_play_frame_type)(input_object *obj, char *buffer); 00257 00264 typedef int(*input_frame_seek_type)(input_object *obj, int frame); 00265 00271 typedef int(*input_frame_size_type)(input_object *obj); 00272 00277 typedef int(*input_nr_frames_type)(input_object *obj); 00278 00286 typedef long(*input_frame_to_sec_type)(input_object *obj ,int frame); 00287 00293 typedef int(*input_sample_rate_type)(input_object *obj); 00294 00300 typedef int(*input_channels_type)(input_object *obj); 00301 00309 typedef int(*input_stream_info_type)(input_object *obj,stream_info *info); 00310 00315 typedef int(*input_nr_tracks_type)(input_object *obj); 00316 00317 /* @param obj input object 00318 * @param track track to seek to 00319 * 00320 * Seek to a track. Optional 00321 */ 00322 typedef int(*input_track_seek_type)(input_object *obj, int track); 00323 00324 00325 typedef struct _input_plugin 00326 { 00330 input_version_type version; 00334 input_flags_type flags; 00338 char *name; 00343 char *author; 00347 void *handle; 00348 input_init_type init; 00349 input_shutdown_type shutdown; 00350 input_plugin_handle_type plugin_handle; 00351 input_can_handle_type can_handle; 00352 input_open_type open; 00353 input_close_type close; 00354 input_play_frame_type play_frame; 00355 input_frame_seek_type frame_seek; 00356 input_frame_size_type frame_size; 00357 input_nr_frames_type nr_frames; 00358 input_frame_to_sec_type frame_to_sec; 00359 input_sample_rate_type sample_rate; 00360 input_channels_type channels; 00361 input_stream_info_type stream_info; 00362 input_nr_tracks_type nr_tracks; 00363 input_track_seek_type track_seek; 00364 } input_plugin; 00365 00373 typedef input_plugin*(*input_plugin_info_type)(void); 00374 00375 #endif