2 * Copyright 2004 Timo Hirvonen
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 #include "track_info.h"
32 /* system error (error code in errno) */
34 /* function not supported */
35 PLAYER_ERROR_NOT_SUPPORTED
39 PLAYER_STATUS_STOPPED
,
40 PLAYER_STATUS_PLAYING
,
50 struct player_callbacks
{
51 int (*get_next
)(struct track_info
**ti
);
55 pthread_mutex_t mutex
;
58 struct track_info
*ti
;
61 char metadata
[255 * 16 + 1];
64 enum player_status status
;
74 /* display this if not NULL */
77 unsigned int file_changed
: 1;
78 unsigned int metadata_changed
: 1;
79 unsigned int status_changed
: 1;
80 unsigned int position_changed
: 1;
81 unsigned int buffer_fill_changed
: 1;
82 unsigned int vol_changed
: 1;
85 extern struct player_info player_info
;
86 extern int player_cont
;
87 extern enum replaygain replaygain
;
88 extern int replaygain_limit
;
89 extern double replaygain_preamp
;
91 /* defined in output.c */
92 extern int volume_max
;
94 void player_load_plugins(void);
96 void player_init(const struct player_callbacks
*callbacks
);
97 void player_exit(void);
99 /* set current file */
100 void player_set_file(struct track_info
*ti
);
102 /* set current file and start playing */
103 void player_play_file(struct track_info
*ti
);
105 void player_play(void);
106 void player_stop(void);
107 void player_pause(void);
108 void player_seek(double offset
, int relative
);
109 void player_set_op(const char *name
);
110 char *player_get_op(void);
111 void player_set_buffer_chunks(unsigned int nr_chunks
);
112 int player_get_buffer_chunks(void);
113 void player_set_buffer_seconds(unsigned int seconds
);
114 int player_get_fileinfo(const char *filename
, int *duration
, struct keyval
**comments
);
116 int player_get_volume(int *left
, int *right
);
117 int player_set_volume(int left
, int right
);
118 void player_set_soft_vol(int soft
);
119 void player_set_rg(enum replaygain rg
);
120 void player_set_rg_limit(int limit
);
121 void player_set_rg_preamp(double db
);
123 int player_set_op_option(unsigned int id
, const char *val
);
124 int player_get_op_option(unsigned int id
, char **val
);
125 int player_for_each_op_option(void (*callback
)(unsigned int id
, const char *key
));
126 void player_dump_plugins(void);
128 #define player_info_lock() cmus_mutex_lock(&player_info.mutex)
129 #define player_info_unlock() cmus_mutex_unlock(&player_info.mutex)