AlsaPlayer  0.99.80
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  * $Id: input_plugin.h 1250 2007-07-08 14:17:12Z dominique_libre $
20  *
21  */
22 
23 #ifndef __input_plugin_h__
24 #define __input_plugin_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_frames;
116  void *local_data;
120  char* path;
125  pthread_mutex_t object_mutex;
126 } input_object;
127 
128 
133 typedef struct _stream_info
134 {
139  char stream_type[128];
143  char artist[128];
147  char title[128];
151  char album[128];
155  char genre[128];
159  char year[10];
163  char track[10];
167  char comment[128];
173  char status[32];
177  char path[1024];
181  int channels;
185  int tracks;
197  int bitrate;
198 } stream_info;
199 
203 typedef int input_version_type;
204 
208 typedef int input_flags_type;
209 
213 typedef int(*input_init_type)(void);
214 
218 typedef void(*input_shutdown_type)(void);
219 
224 
233 typedef float(*input_can_handle_type)(const char *path);
234 
240 typedef int(*input_open_type)(input_object *obj, const char *path);
241 
246 typedef void(*input_close_type)(input_object *obj);
247 
256 typedef int(*input_play_frame_type)(input_object *obj, char *buffer);
257 
264 typedef int(*input_frame_seek_type)(input_object *obj, int frame);
265 
272 
277 typedef int(*input_nr_frames_type)(input_object *obj);
278 
286 typedef long(*input_frame_to_sec_type)(input_object *obj ,int frame);
287 
294 
300 typedef int(*input_channels_type)(input_object *obj);
301 
310 
315 typedef int(*input_nr_tracks_type)(input_object *obj);
316 
317 /* @param obj input object
318  * @param track track to seek to
319  *
320  * Seek to a track. Optional
321  */
322 typedef int(*input_track_seek_type)(input_object *obj, int track);
323 
324 
325 typedef struct _input_plugin
326 {
338  char *name;
343  char *author;
347  void *handle;
364 } input_plugin;
365 
373 typedef input_plugin*(*input_plugin_info_type)(void);
374 
375 #endif
input_can_handle_type can_handle
Definition: input_plugin.h:351
int current_track
Definition: input_plugin.h:189
int(* input_channels_type)(input_object *obj)
Definition: input_plugin.h:300
long(* input_frame_to_sec_type)(input_object *obj, int frame)
Definition: input_plugin.h:286
int nr_frames
Definition: input_plugin.h:97
input_frame_to_sec_type frame_to_sec
Definition: input_plugin.h:358
Definition: input_plugin.h:133
input_stream_info_type stream_info
Definition: input_plugin.h:361
int(* input_stream_info_type)(input_object *obj, stream_info *info)
Definition: input_plugin.h:309
input_track_seek_type track_seek
Definition: input_plugin.h:363
Definition: input_plugin.h:325
int(* input_play_frame_type)(input_object *obj, char *buffer)
Definition: input_plugin.h:256
input_flags_type flags
Definition: input_plugin.h:334
input_nr_tracks_type nr_tracks
Definition: input_plugin.h:362
int input_version_type
Definition: input_plugin.h:203
int(* input_nr_tracks_type)(input_object *obj)
Definition: input_plugin.h:315
pthread_mutex_t object_mutex
Definition: input_plugin.h:125
float(* input_can_handle_type)(const char *path)
Definition: input_plugin.h:233
char * author
Definition: input_plugin.h:343
int(* input_open_type)(input_object *obj, const char *path)
Definition: input_plugin.h:240
char * path
Definition: input_plugin.h:120
int frame_size
Definition: input_plugin.h:112
void(* input_shutdown_type)(void)
Definition: input_plugin.h:218
int(* input_track_seek_type)(input_object *obj, int track)
Definition: input_plugin.h:322
char genre[128]
Definition: input_plugin.h:155
char artist[128]
Definition: input_plugin.h:143
int(* input_frame_seek_type)(input_object *obj, int frame)
Definition: input_plugin.h:264
char year[10]
Definition: input_plugin.h:159
struct _input_plugin input_plugin
int sample_rate
Definition: input_plugin.h:193
input_shutdown_type shutdown
Definition: input_plugin.h:349
int(* input_frame_size_type)(input_object *obj)
Definition: input_plugin.h:271
int(* input_init_type)(void)
Definition: input_plugin.h:213
input_nr_frames_type nr_frames
Definition: input_plugin.h:357
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:223
int channels
Definition: input_plugin.h:181
char title[128]
Definition: input_plugin.h:147
struct _input_object input_object
input_open_type open
Definition: input_plugin.h:352
input_close_type close
Definition: input_plugin.h:353
input_plugin_handle_type plugin_handle
Definition: input_plugin.h:350
input_init_type init
Definition: input_plugin.h:348
input_frame_seek_type frame_seek
Definition: input_plugin.h:355
char status[32]
Definition: input_plugin.h:173
input_play_frame_type play_frame
Definition: input_plugin.h:354
input_frame_size_type frame_size
Definition: input_plugin.h:356
char album[128]
Definition: input_plugin.h:151
input_version_type version
Definition: input_plugin.h:330
void * local_data
Definition: input_plugin.h:116
int(* input_sample_rate_type)(input_object *obj)
Definition: input_plugin.h:293
char track[10]
Definition: input_plugin.h:163
char * name
Definition: input_plugin.h:338
int tracks
Definition: input_plugin.h:185
char stream_type[128]
Definition: input_plugin.h:139
Definition: input_plugin.h:81
int bitrate
Definition: input_plugin.h:197
char path[1024]
Definition: input_plugin.h:177
int input_flags_type
Definition: input_plugin.h:208
int flags
Definition: input_plugin.h:92
input_channels_type channels
Definition: input_plugin.h:360
void * handle
Definition: input_plugin.h:347
int(* input_nr_frames_type)(input_object *obj)
Definition: input_plugin.h:277
void(* input_close_type)(input_object *obj)
Definition: input_plugin.h:246
struct _stream_info stream_info
char comment[128]
Definition: input_plugin.h:167
input_sample_rate_type sample_rate
Definition: input_plugin.h:359
int ready
Definition: input_plugin.h:87