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.12 2002/10/18 14:57:17 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 + 15) 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]; 00169 } stream_info; 00170 00174 typedef int input_version_type; 00175 00179 typedef int input_flags_type; 00180 00184 typedef int(*input_init_type)(); 00185 00189 typedef void(*input_shutdown_type)(); 00190 00194 typedef void* input_plugin_handle_type; 00195 00204 typedef float(*input_can_handle_type)(const char *path); 00205 00211 typedef int(*input_open_type)(input_object *obj, const char *path); 00212 00217 typedef void(*input_close_type)(input_object *obj); 00218 00227 typedef int(*input_play_frame_type)(input_object *obj, char *buffer); 00228 00235 typedef int(*input_frame_seek_type)(input_object *obj, int frame); 00236 00242 typedef int(*input_frame_size_type)(input_object *obj); 00243 00248 typedef int(*input_nr_frames_type)(input_object *obj); 00249 00257 typedef long(*input_frame_to_sec_type)(input_object *obj ,int frame); 00258 00264 typedef int(*input_sample_rate_type)(input_object *obj); 00265 00271 typedef int(*input_channels_type)(input_object *obj); 00272 00280 typedef int(*input_stream_info_type)(input_object *obj,stream_info *info); 00281 00286 typedef int(*input_nr_tracks_type)(input_object *obj); 00287 00288 /* @param obj input object 00289 * @param track track to seek to 00290 * 00291 * Seek to a track. Optional 00292 */ 00293 typedef int(*input_track_seek_type)(input_object *obj, int track); 00294 00295 00296 typedef struct _input_plugin 00297 { 00301 input_version_type version; 00305 input_flags_type flags; 00309 char *name; 00314 char *author; 00318 void *handle; 00319 input_init_type init; 00320 input_shutdown_type shutdown; 00321 input_plugin_handle_type plugin_handle; 00322 input_can_handle_type can_handle; 00323 input_open_type open; 00324 input_close_type close; 00325 input_play_frame_type play_frame; 00326 input_frame_seek_type frame_seek; 00327 input_frame_size_type frame_size; 00328 input_nr_frames_type nr_frames; 00329 input_frame_to_sec_type frame_to_sec; 00330 input_sample_rate_type sample_rate; 00331 input_channels_type channels; 00332 input_stream_info_type stream_info; 00333 input_nr_tracks_type nr_tracks; 00334 input_track_seek_type track_seek; 00335 } input_plugin; 00336 00344 typedef input_plugin*(*input_plugin_info_type)(); 00345 00346 #endif