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 file is part of AlsaPlayer. 00005 * 00006 * AlsaPlayer is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 3 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * AlsaPlayer is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, see <http://www.gnu.org/licenses/>. 00018 * 00019 * $Id$ 00020 * 00021 */ 00022 00023 #ifndef __input_plugin_h__ 00024 #define __input_plugin_h__ 00025 00026 #include "stream_info.h" 00027 00028 #include <pthread.h> 00029 00033 #define P_SEEK 1 00034 00038 #define P_PERFECTSEEK 2 00039 00043 #define P_REENTRANT 4 00044 00048 #define P_FILEBASED 8 00049 00053 #define P_STREAMBASED 16 00054 00058 #define P_BUFFERING 32 00059 00060 /* 00061 * Format of version number is 0x1000 + version 00062 * So 0x1001 is *binary* format version 1 00063 * THE VERSION NUMBER IS *NOT* A USER SERVICABLE PART! 00064 */ 00065 00069 #define INPUT_PLUGIN_BASE_VERSION 0x1000 00070 00076 #define INPUT_PLUGIN_VERSION (INPUT_PLUGIN_BASE_VERSION + 16) 00077 00083 typedef struct _input_object 00084 { 00089 int ready; 00094 int flags; 00099 int nr_frames; 00104 int nr_tracks; 00109 int nr_channels; 00114 int frame_size; 00118 void *local_data; 00122 char* path; 00127 pthread_mutex_t object_mutex; 00128 } input_object; 00129 00130 00134 typedef int input_version_type; 00135 00139 typedef int input_flags_type; 00140 00144 typedef int(*input_init_type)(void); 00145 00149 typedef void(*input_shutdown_type)(void); 00150 00154 typedef void* input_plugin_handle_type; 00155 00164 typedef float(*input_can_handle_type)(const char *path); 00165 00171 typedef int(*input_open_type)(input_object *obj, const char *path); 00172 00177 typedef void(*input_close_type)(input_object *obj); 00178 00187 typedef int(*input_play_frame_type)(input_object *obj, char *buffer); 00188 00195 typedef int(*input_frame_seek_type)(input_object *obj, int frame); 00196 00202 typedef int(*input_frame_size_type)(input_object *obj); 00203 00208 typedef int(*input_nr_frames_type)(input_object *obj); 00209 00217 typedef long(*input_frame_to_sec_type)(input_object *obj ,int frame); 00218 00224 typedef int(*input_sample_rate_type)(input_object *obj); 00225 00231 typedef int(*input_channels_type)(input_object *obj); 00232 00240 typedef int(*input_stream_info_type)(input_object *obj,stream_info *info); 00241 00246 typedef int(*input_nr_tracks_type)(input_object *obj); 00247 00248 /* @param obj input object 00249 * @param track track to seek to 00250 * 00251 * Seek to a track. Optional 00252 */ 00253 typedef int(*input_track_seek_type)(input_object *obj, int track); 00254 00255 00256 typedef struct _input_plugin 00257 { 00261 input_version_type version; 00265 input_flags_type flags; 00269 char *name; 00274 char *author; 00278 void *handle; 00279 input_init_type init; 00280 input_shutdown_type shutdown; 00281 input_plugin_handle_type plugin_handle; 00282 input_can_handle_type can_handle; 00283 input_open_type open; 00284 input_close_type close; 00285 input_play_frame_type play_frame; 00286 input_frame_seek_type frame_seek; 00287 input_frame_size_type frame_size; 00288 input_nr_frames_type nr_frames; 00289 input_frame_to_sec_type frame_to_sec; 00290 input_sample_rate_type sample_rate; 00291 input_channels_type channels; 00292 input_stream_info_type stream_info; 00293 input_nr_tracks_type nr_tracks; 00294 input_track_seek_type track_seek; 00295 } input_plugin; 00296 00304 typedef input_plugin*(*input_plugin_info_type)(void); 00305 00306 #endif