Blame
Date:
Sat May 14 18:54:20 2022 UTC
Message:
amused monitor: allow to pass a list of event as filter it's easier / simpler for scripts to do $ amused monitor next,prev,jump rather than $ amused monitor | egrep --line-buffered 'next|prev|jump'
001
2022-02-16
op
/*
002
2022-02-16
op
* Copyright (c) 2022 Omar Polo <op@openbsd.org>
003
2022-02-16
op
*
004
2022-02-16
op
* Permission to use, copy, modify, and distribute this software for any
005
2022-02-16
op
* purpose with or without fee is hereby granted, provided that the above
006
2022-02-16
op
* copyright notice and this permission notice appear in all copies.
007
2022-02-16
op
*
008
2022-02-16
op
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
009
2022-02-16
op
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
010
2022-02-16
op
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
011
2022-02-16
op
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
012
2022-02-16
op
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
013
2022-02-16
op
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
014
2022-02-16
op
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
015
2022-02-16
op
*/
016
2022-02-16
op
017
2022-02-16
op
#ifndef AMUSED_H
018
2022-02-16
op
#define AMUSED_H
019
2022-02-16
op
020
2022-02-16
op
extern char *csock;
021
2022-02-16
op
extern int debug;
022
2022-02-16
op
extern int verbose;
023
2022-02-16
op
extern int playing;
024
2022-02-16
op
extern struct imsgev *iev_player;
025
2022-02-16
op
026
2022-02-16
op
#define IMSG_DATA_SIZE(imsg) ((imsg).hdr.len - IMSG_HEADER_SIZE)
027
2022-02-16
op
028
2022-02-16
op
enum imsg_type {
029
2022-02-16
op
IMSG_PLAY, /* fd + filename */
030
2022-02-16
op
IMSG_RESUME,
031
2022-02-16
op
IMSG_PAUSE,
032
2022-02-16
op
IMSG_STOP,
033
2022-02-16
op
IMSG_EOF,
034
2022-02-16
op
IMSG_ERR,
035
2022-02-16
op
036
2022-02-17
op
IMSG_CTL_PLAY, /* with optional filename */
037
2022-02-16
op
IMSG_CTL_TOGGLE_PLAY,
038
2022-02-16
op
IMSG_CTL_PAUSE,
039
2022-02-16
op
IMSG_CTL_STOP,
040
2022-02-16
op
IMSG_CTL_RESTART,
041
2022-02-16
op
IMSG_CTL_FLUSH,
042
2022-02-16
op
IMSG_CTL_SHOW,
043
2022-02-16
op
IMSG_CTL_STATUS,
044
2022-02-17
op
IMSG_CTL_NEXT,
045
2022-02-17
op
IMSG_CTL_PREV,
046
2022-02-17
op
IMSG_CTL_JUMP,
047
2022-02-19
op
IMSG_CTL_REPEAT, /* struct player_repeat */
048
2022-02-16
op
049
2022-02-17
op
IMSG_CTL_BEGIN,
050
2022-02-17
op
IMSG_CTL_ADD, /* path to a file */
051
2022-03-02
op
IMSG_CTL_COMMIT, /* offset of the track to jump to */
052
2022-02-17
op
053
2022-02-21
op
IMSG_CTL_MONITOR,
054
2022-02-21
op
055
2022-02-16
op
IMSG_CTL_ERR,
056
2022-05-14
op
IMSG__LAST,
057
2022-02-16
op
};
058
2022-02-16
op
059
2022-02-16
op
struct imsgev {
060
2022-02-16
op
struct imsgbuf ibuf;
061
2022-02-16
op
void (*handler)(int, short, void *);
062
2022-02-16
op
struct event ev;
063
2022-02-16
op
short events;
064
2022-02-16
op
};
065
2022-02-16
op
066
2022-02-16
op
enum actions {
067
2022-02-16
op
NONE,
068
2022-02-16
op
PLAY,
069
2022-02-16
op
PAUSE,
070
2022-02-16
op
TOGGLE,
071
2022-02-16
op
STOP,
072
2022-02-16
op
RESTART,
073
2022-02-16
op
ADD,
074
2022-02-16
op
FLUSH,
075
2022-02-16
op
SHOW,
076
2022-02-16
op
STATUS,
077
2022-02-17
op
PREV,
078
2022-02-17
op
NEXT,
079
2022-02-17
op
LOAD,
080
2022-02-17
op
JUMP,
081
2022-02-19
op
REPEAT,
082
2022-02-21
op
MONITOR,
083
2022-02-16
op
};
084
2022-02-16
op
085
2022-02-16
op
struct ctl_command;
086
2022-02-16
op
087
2022-02-19
op
struct player_repeat {
088
2022-02-19
op
int repeat_one;
089
2022-02-19
op
int repeat_all;
090
2022-02-19
op
};
091
2022-02-19
op
092
2022-02-19
op
struct player_status {
093
2022-02-19
op
char path[PATH_MAX];
094
2022-02-19
op
int status;
095
2022-02-19
op
struct player_repeat rp;
096
2022-02-19
op
};
097
2022-02-19
op
098
2022-02-16
op
struct parse_result {
099
2022-02-16
op
enum actions action;
100
2022-02-16
op
char **files;
101
2022-02-17
op
const char *file;
102
2022-02-17
op
int pretty;
103
2022-05-14
op
int monitor[IMSG__LAST];
104
2022-02-19
op
struct player_repeat rep;
105
2022-02-16
op
struct ctl_command *ctl;
106
2022-02-16
op
};
107
2022-02-16
op
108
2022-02-16
op
struct ctl_command {
109
2022-02-16
op
const char *name;
110
2022-02-16
op
enum actions action;
111
2022-02-16
op
int (*main)(struct parse_result *, int, char **);
112
2022-02-16
op
const char *usage;
113
2022-02-16
op
int has_pledge;
114
2022-02-16
op
};
115
2022-02-16
op
116
2022-02-17
op
struct playlist;
117
2022-02-17
op
118
2022-02-16
op
/* amused.c */
119
2022-02-16
op
void spawn_daemon(void);
120
2022-02-16
op
void imsg_event_add(struct imsgev *iev);
121
2022-02-16
op
int imsg_compose_event(struct imsgev *, uint16_t, uint32_t,
122
2022-02-16
op
pid_t, int, const void *, uint16_t);
123
2022-05-10
op
int main_send_player(uint16_t, int);
124
2022-02-19
op
int main_play_song(const char *);
125
2022-02-17
op
void main_playlist_jump(struct imsgev *, struct imsg *);
126
2022-02-17
op
void main_playlist_resume(void);
127
2022-02-16
op
void main_playlist_advance(void);
128
2022-02-17
op
void main_playlist_previous(void);
129
2022-02-16
op
void main_restart_track(void);
130
2022-02-17
op
void main_senderr(struct imsgev *, const char *);
131
2022-02-17
op
void main_enqueue(int, struct playlist *, struct imsgev *, struct imsg *);
132
2022-02-16
op
void main_send_playlist(struct imsgev *);
133
2022-02-16
op
void main_send_status(struct imsgev *);
134
2022-02-16
op
135
2022-02-16
op
/* ctl.c */
136
2022-02-16
op
__dead void usage(void);
137
2022-02-16
op
__dead void ctl(int, char **);
138
2022-02-16
op
139
2022-02-16
op
/* player.c */
140
2022-02-21
op
int player_setup(int, int, int);
141
2022-03-09
op
int play(const void *, size_t);
142
2022-02-16
op
int player(int, int);
143
2022-02-16
op
144
2022-03-09
op
int play_oggvorbis(int fd);
145
2022-03-09
op
int play_mp3(int fd);
146
2022-03-09
op
int play_flac(int fd);
147
2022-03-09
op
int play_opus(int fd);
148
2022-02-16
op
149
2022-02-16
op
#endif
Omar Polo