AlsaPlayer  0.99.82
input_plugin.h
Go to the documentation of this file.
1 /* input_plugin.h - Use this to write input plugins
2  * Copyright (C) 1999-2002 Andy Lo A Foe <andy@alsaplayer.org>
3  *
4  * This file is part of AlsaPlayer.
5  *
6  * AlsaPlayer is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * AlsaPlayer is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 #ifndef __input_plugin_h__
22 #define __input_plugin_h__
23 
24 #include "stream_info.h"
25 
26 #include <pthread.h>
27 
31 #define P_SEEK 1
32 
36 #define P_PERFECTSEEK 2
37 
41 #define P_REENTRANT 4
42 
46 #define P_FILEBASED 8
47 
51 #define P_STREAMBASED 16
52 
56 #define P_BUFFERING 32
57 
58 /*
59  * Format of version number is 0x1000 + version
60  * So 0x1001 is *binary* format version 1
61  * THE VERSION NUMBER IS *NOT* A USER SERVICABLE PART!
62  */
63 
67 #define INPUT_PLUGIN_BASE_VERSION 0x1000
68 
74 #define INPUT_PLUGIN_VERSION (INPUT_PLUGIN_BASE_VERSION + 16)
75 
81 typedef struct _input_object
82 {
87  int ready;
92  int flags;
97  int nr_blocks;
116  void *local_data;
120  char* path;
125  pthread_mutex_t object_mutex;
126 } input_object;
127 
128 
132 typedef int input_version_type;
133 
137 typedef int input_flags_type;
138 
142 typedef int(*input_init_type)(void);
143 
147 typedef void(*input_shutdown_type)(void);
148 
153 
162 typedef float(*input_can_handle_type)(const char *path);
163 
169 typedef int(*input_open_type)(input_object *obj, const char *path);
170 
175 typedef void(*input_close_type)(input_object *obj);
176 
185 typedef int(*input_play_block_type)(input_object *obj, short *buffer);
186 
193 typedef int(*input_block_seek_type)(input_object *obj, int block);
194 
201 
206 typedef int(*input_nr_blocks_type)(input_object *obj);
207 
213 typedef int64_t (*input_frame_count_type)(input_object *obj);
214 
222 typedef long(*input_block_to_sec_type)(input_object *obj ,int block);
223 
230 
236 typedef int(*input_channels_type)(input_object *obj);
237 
245 typedef int(*input_stream_info_type)(input_object *obj,stream_info *info);
246 
251 typedef int(*input_nr_tracks_type)(input_object *obj);
252 
253 /* @param obj input object
254  * @param track track to seek to
255  *
256  * Seek to a track. Optional
257  */
258 typedef int(*input_track_seek_type)(input_object *obj, int track);
259 
260 
261 typedef struct _input_plugin
262 {
274  const char *name;
279  const char *author;
283  void *handle;
301 } input_plugin;
302 
310 typedef input_plugin*(*input_plugin_info_type)(void);
311 
312 #ifdef __cplusplus
313 extern "C"
314 #endif
316 
317 #endif
input_can_handle_type can_handle
Definition: input_plugin.h:287
long(* input_block_to_sec_type)(input_object *obj, int block)
Definition: input_plugin.h:222
int(* input_stream_info_type)(input_object *obj, stream_info *info)
Definition: input_plugin.h:245
int(* input_block_seek_type)(input_object *obj, int block)
Definition: input_plugin.h:193
input_stream_info_type stream_info
Definition: input_plugin.h:298
int(* input_nr_blocks_type)(input_object *obj)
Definition: input_plugin.h:206
int(* input_track_seek_type)(input_object *obj, int track)
Definition: input_plugin.h:258
input_track_seek_type track_seek
Definition: input_plugin.h:300
Definition: input_plugin.h:261
input_block_seek_type block_seek
Definition: input_plugin.h:291
input_flags_type flags
Definition: input_plugin.h:270
int(* input_init_type)(void)
Definition: input_plugin.h:142
input_nr_tracks_type nr_tracks
Definition: input_plugin.h:299
float(* input_can_handle_type)(const char *path)
Definition: input_plugin.h:162
int input_version_type
Definition: input_plugin.h:132
int nr_blocks
Definition: input_plugin.h:97
pthread_mutex_t object_mutex
Definition: input_plugin.h:125
char * path
Definition: input_plugin.h:120
struct _input_plugin input_plugin
input_plugin * input_plugin_info(void)
int(* input_block_size_type)(input_object *obj)
Definition: input_plugin.h:200
input_shutdown_type shutdown
Definition: input_plugin.h:285
input_block_size_type block_size
Definition: input_plugin.h:292
int block_size
Definition: input_plugin.h:112
int nr_channels
Definition: input_plugin.h:107
int nr_tracks
Definition: input_plugin.h:102
void * input_plugin_handle_type
Definition: input_plugin.h:152
struct _input_object input_object
input_open_type open
Definition: input_plugin.h:288
input_close_type close
Definition: input_plugin.h:289
input_frame_count_type frame_count
Definition: input_plugin.h:294
input_plugin_handle_type plugin_handle
Definition: input_plugin.h:286
input_init_type init
Definition: input_plugin.h:284
input_nr_blocks_type nr_blocks
Definition: input_plugin.h:293
input_version_type version
Definition: input_plugin.h:266
int(* input_play_block_type)(input_object *obj, short *buffer)
Definition: input_plugin.h:185
void * local_data
Definition: input_plugin.h:116
int64_t(* input_frame_count_type)(input_object *obj)
Definition: input_plugin.h:213
void(* input_shutdown_type)(void)
Definition: input_plugin.h:147
Definition: input_plugin.h:81
int(* input_channels_type)(input_object *obj)
Definition: input_plugin.h:236
int input_flags_type
Definition: input_plugin.h:137
int flags
Definition: input_plugin.h:92
int(* input_sample_rate_type)(input_object *obj)
Definition: input_plugin.h:229
input_channels_type channels
Definition: input_plugin.h:297
void * handle
Definition: input_plugin.h:283
int(* input_open_type)(input_object *obj, const char *path)
Definition: input_plugin.h:169
void(* input_close_type)(input_object *obj)
Definition: input_plugin.h:175
int(* input_nr_tracks_type)(input_object *obj)
Definition: input_plugin.h:251
const char * name
Definition: input_plugin.h:274
input_sample_rate_type sample_rate
Definition: input_plugin.h:296
input_block_to_sec_type block_to_sec
Definition: input_plugin.h:295
input_play_block_type play_block
Definition: input_plugin.h:290
int ready
Definition: input_plugin.h:87
const char * author
Definition: input_plugin.h:279