⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 apollo-client.c

📁 可以播放MP3,wma等文件格式的播放器
💻 C
📖 第 1 页 / 共 3 页
字号:
	else		vl = vr = v;	remote_set_volume(session, vl, vr);}gchar *remote_get_skin(gint session){	return remote_get_string(session, CMD_GET_SKIN);}void remote_set_skin(gint session, gchar * skinfile){	remote_send_string(session, CMD_SET_SKIN, skinfile);}gchar *remote_get_playlist_file(gint session, gint pos){	return remote_get_string_pos(session, CMD_GET_PLAYLIST_FILE, pos);}gchar *remote_get_playlist_title(gint session, gint pos){	return remote_get_string_pos(session, CMD_GET_PLAYLIST_TITLE, pos);}gint remote_get_playlist_time(gint session, gint pos){	ServerPktHeader pkt_hdr;	gpointer data;	gint fd, ret = 0;	guint32 p = pos;	if ((fd = connect_to_session(session)) == -1)		return ret;	remote_send_packet(fd, CMD_GET_PLAYLIST_TIME, &p, sizeof (guint32));	data = remote_read_packet(fd, &pkt_hdr);	if (data)	{		ret = *((gint *) data);		free(data);	}	remote_read_ack(fd);	close(fd);	return ret;}void remote_get_info(gint session, gint * rate, gint * freq, gint * nch){	ServerPktHeader pkt_hdr;	gint fd;	gpointer data;	if ((fd = connect_to_session(session)) == -1)		return;	remote_send_packet(fd, CMD_GET_INFO, NULL, 0);	data = remote_read_packet(fd, &pkt_hdr);	if (data)	{		*rate = ((guint32 *) data)[0];		*freq = ((guint32 *) data)[1];		*nch = ((guint32 *) data)[2];		free(data);	}	remote_read_ack(fd);	close(fd);}void remote_get_eq_data(gint session){	/* write me! */}void remote_set_eq_data(gint session){	/* write me! */}void remote_pl_win_toggle(gint session, gboolean show){	remote_send_boolean(session, CMD_PL_WIN_TOGGLE, show);}void remote_eq_win_toggle(gint session, gboolean show){	remote_send_boolean(session, CMD_EQ_WIN_TOGGLE, show);}void remote_main_win_toggle(gint session, gboolean show){	remote_send_boolean(session, CMD_MAIN_WIN_TOGGLE, show);}gboolean remote_is_main_win(gint session){	return remote_get_gboolean(session, CMD_IS_MAIN_WIN);}gboolean remote_is_pl_win(gint session){	return remote_get_gboolean(session, CMD_IS_PL_WIN);}gboolean remote_is_eq_win(gint session){	return remote_get_gboolean(session, CMD_IS_EQ_WIN);}void remote_show_prefs_box(gint session){	remote_cmd(session, CMD_SHOW_PREFS_BOX);}void remote_toggle_aot(gint session, gboolean ontop){	remote_send_boolean(session, CMD_TOGGLE_AOT, ontop);}void remote_show_about_box(gint session){	remote_cmd(session, CMD_SHOW_ABOUT_BOX);}void remote_playlist_prev(gint session){	remote_cmd(session, CMD_PLAYLIST_PREV);}void remote_playlist_next(gint session){	remote_cmd(session, CMD_PLAYLIST_NEXT);}void remote_playlist_add_url_string(gint session, gchar * string){	remote_send_string(session, CMD_PLAYLIST_ADD_URL_STRING, string);}gboolean remote_is_running(gint session){	return remote_cmd(session, CMD_PING);}void remote_toggle_repeat(gint session){	remote_cmd(session, CMD_TOGGLE_REPEAT);}void remote_toggle_shuffle(gint session){	remote_cmd(session, CMD_TOGGLE_SHUFFLE);}gboolean remote_is_repeat(gint session){	return remote_get_gboolean(session, CMD_IS_REPEAT);}gboolean remote_is_shuffle(gint session){	return remote_get_gboolean(session, CMD_IS_SHUFFLE);}void remote_get_eq(gint session, gfloat *preamp, gfloat **bands){	ServerPktHeader pkt_hdr;	gint fd;	gpointer data;	if (preamp)		*preamp = 0.0;	if (bands)		*bands = NULL;	if ((fd = connect_to_session(session)) == -1)		return;	remote_send_packet(fd, CMD_GET_EQ, NULL, 0);	data = remote_read_packet(fd, &pkt_hdr);	if (data)	{		if (pkt_hdr.data_length >= 11 * sizeof(gfloat))		{			if (preamp)				*preamp = *((gfloat *) data);			if (bands)				*bands = (gfloat *) g_memdup((gfloat *)data + 1, 10 * sizeof(gfloat));		}		free(data);	}	remote_read_ack(fd);	close(fd);}gfloat remote_get_eq_preamp(gint session){	return remote_get_gfloat(session, CMD_GET_EQ_PREAMP);}gfloat remote_get_eq_band(gint session, gint band){	ServerPktHeader pkt_hdr;	gint fd;	gpointer data;	gfloat val = 0.0;	if ((fd = connect_to_session(session)) == -1)		return val;	remote_send_packet(fd, CMD_GET_EQ_BAND, &band, sizeof(band));	data = remote_read_packet(fd, &pkt_hdr);	if (data) {		val = *((gfloat *) data);		free(data);	}	remote_read_ack(fd);	close(fd);	return val;}void remote_set_eq(gint session, gfloat preamp, gfloat *bands){	gint fd, i;	gfloat data[11];	if ((fd = connect_to_session(session)) == -1)		return;	data[0] = preamp;	for(i = 0; i < 10; i++)		data[i + 1] = bands[i];	remote_send_packet(fd, CMD_SET_EQ, data, sizeof(data));	remote_read_ack(fd);	close(fd);}void remote_set_eq_preamp(gint session, gfloat preamp){	remote_send_gfloat(session, CMD_SET_EQ_PREAMP, preamp);}void remote_set_eq_band(gint session, gint band, gfloat value){	gint fd;	gchar data[sizeof(gint) + sizeof(gfloat)];	if ((fd = connect_to_session(session)) == -1)		return;	*((gint *) data) = band;	*((gfloat *) (data + sizeof(gint))) = value;	remote_send_packet(fd, CMD_SET_EQ_BAND, data, sizeof(data));	remote_read_ack(fd);	close(fd);}void remote_quit(gint session){	gint fd;	if ((fd = connect_to_session(session)) == -1)		return;	remote_send_packet(fd, CMD_QUIT, NULL, 0);	remote_read_ack(fd);	close(fd);}void remote_eject(gint session){	remote_cmd(session, CMD_EJECT);}gint remote_get_version(gint session){	return remote_get_gint(session, CMD_GET_VERSION);}/******************************************************************************************************* end of functions from xmms ********************************************************************************************************************************************//* returns true if xmms is playing a stream */static gboolean is_stream_playing(gint);/* simple commands, argument is the session number */static void print_current_title(gint); /* print the title of the current playing song */ static void print_playlist(gint);      /* print all titles in the play list */static void print_playfiles(gint);     /* print all files in the play list */static void remove_from_playlist(gint);/* removes mp3 from playlist currently playing  */static void print_current(gint);       /* print the current playing song */static void print_help(gint);          /* print help   */static void print_volume(gint);        /* print volume */static void print_time(gint);          /* print played time */static void print_current_pos(gint);   /* print current song position in the play list */static void play_prev(gint);           /* play the previous track wrapping to the last from the first *//* commands needing an argument, arguments are session number and the read string argument */static void set_track(gint, char*);    /* set the current playing song */static void set_vol(gint, char*);      /* set the volume */static void set_time(gint, char*);     /* set time position */static void set_dir(gint, char*);      /* set playing list to directory/file/device *//* commands using the rest of argv (as file names) */static void add_to_playlist(gint session, gint from_arg_no, int argc, char *argv[]); static void add_to_playfirst(gint session, gint from_arg_no, int argc, char *argv[]); static void add_to_playlist_and_playfirst(gint session, gint from_arg_no, int argc, char *argv[]); /* type for simple commands */typedef struct {	const char *name;               /* command line argument function */	void (*command)(gint);          /* xmms API function to use       */	const char *help;               /* help for this command          */} Command;/* simple command list */Command com[]={	{		"cur", 		print_current,		"print the current mp3 song file"	},	{		"eject",		remote_eject,		"open xmms \"Load file(s)\" dialog window"	},	{		"getpos", 		print_current_pos,		"print the current mp3 song position in the play list"	},	{		"gettime",		print_time,		"print the current song's playback time in seconds"	},	{		"getvol",		print_volume,		"print the master volume value"	},	{		"help",		print_help,		"print this help message"	},	{		"next", 		remote_playlist_next,		"xmms next song command, go to the next song"	},	{		"pause",		remote_pause,		"xmms pause command, pause the playing song"	},	{		"play",		remote_play,		"xmms play command, play the current song"	},	{		"playlist",		print_playlist,		"print the play list songs"	},	{		"playfiles",		print_playfiles,		"print the play list files"	},	{		"pref",		remote_show_prefs_box,		"open xmms preference window (as Ctrl-P)"	},	{		"prev",		remote_playlist_prev,		"xmms previous song command, go to the previous song"	},	{		"previous",		play_prev,		"go to the previous song and wrap round to last if position is first"	},	{		"remove",		remove_from_playlist,		"removes mp3 currently playing from playlist"	},	{		"clear",		remote_playlist_clear,		"clears the playlist"	},	{		"repeat", 		remote_toggle_repeat,		"toggle xmms repeat flag"	},	{		"shuffle", 		remote_toggle_shuffle,		"toggle xmms shuffle flag"	},	{		"stop",		remote_stop,		"xmms stop command, stop playing"	},	{		"title",		print_current_title,		"print the current mp3 song title"	},	{		"quit", 		remote_quit,		"terminate xmms"	},	{		"--help",		print_help,		"print this help message"	}};/* type for test commands */typedef struct {	const char *name;	gboolean (*test)(gint);	const char *help;} Test;/* test command list */Test test[]={	{		"paused", 		remote_is_paused,		"returns OK if xmms is paused"	},	{		"playing", 		remote_is_playing,		"returns OK if xmms is playing a song"	},	{		"is_equalizer", 		remote_is_eq_win,		"returns OK if xmms has its equalizer window open"	},	{		"is_main", 		remote_is_main_win,		"returns OK if xmms has its main window open"	},	{		"is_play_list", 		remote_is_pl_win,		"returns OK if xmms has its playing list window open"	},	{		"is_stream",		is_stream_playing,		"returns OK if xmms is playing a stream (http://somewhere)"	},	{		"running", 		remote_is_running,		"returns OK if xmms is running"	}};/* type for toggle commands */typedef struct {	const char *name;	void (*command)(gint,gboolean);	const char *help;} ToggleCommand;/* toggle command list */ToggleCommand toggle[]={	{		"equalizer",		remote_eq_win_toggle,		"hide/show xmms equalizer window"	},	{		"main", 		remote_main_win_toggle,		"hide/show xmms main window"	},	{		"play_list", 		remote_pl_win_toggle,		"hide/show xmms playing list window"	}};/* type for commands wanting an argument */typedef struct {	const char *name;	void (*command)(gint, char*);	const char *help;} ArgCommand;/* one-argument-command list */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -