Skip to content

Commit

Permalink
More process related logging #50
Browse files Browse the repository at this point in the history
  • Loading branch information
subogero committed Jun 12, 2016
1 parent f8dc426 commit 4d14121
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
12 changes: 6 additions & 6 deletions omxd.c
Expand Up @@ -73,8 +73,8 @@ int main(int argc, char *argv[])
status_log();
while (1) {
char line[LINE_LENGTH];
read_fifo(line);
LOG(0, "main: %s\n", line);
if (read_fifo(line))
LOG(0, "main: %s\n", line);
parse(line);
}
return 0;
Expand Down Expand Up @@ -196,16 +196,16 @@ static void player(char *cmd, char **files)
{
SPINLOCK_TAKE
if (strchr(STOP_CMDS, *cmd) != NULL) {
LOG(0, "player: stop all\n");
LOG(1, "player: stop all\n");
stop_playback(&now);
stop_playback(&next);
goto player_end;
}
if (strchr(OMX_CMDS, *cmd) != NULL && now != NULL ) {
if (*cmd == 'p')
LOG(0, "player: play/pause\n")
LOG(1, "player: play/pause\n")
else
LOG(0, "player: send %s\n", cmd)
LOG(1, "player: send %s\n", cmd)
player_cmd(now, cmd);
if (strchr(VOL_CMDS, *cmd) != NULL) {
if (*cmd == '-')
Expand All @@ -225,7 +225,7 @@ static void player(char *cmd, char **files)
if (files[0] != NULL) {
stop_playback(&now);
if (*files[0] != 0) {
LOG(0, "player: start %s\n", files[0]);
LOG(1, "player: start %s\n", files[0]);
if (next != NULL &&
strcmp(files[0], player_file(next)) == 0) {
now = next;
Expand Down
12 changes: 7 additions & 5 deletions player.c
Expand Up @@ -74,7 +74,7 @@ struct player *player_new(char *file, char *out, enum pstate state)
signal(SIGPIPE, SIG_IGN);
strcpy(this->file, file);
scatd(this->logfile, this->pid);
LOG(1, "player_new: PID=%d %s\n", this->pid, file);
LOG(0, "player_new: PID=%d %s\n", this->pid, file);
return this;
} else { /* Child: exec omxplayer */
scatd(this->logfile, getpid());
Expand Down Expand Up @@ -124,15 +124,15 @@ void player_cmd(struct player *this, char *cmd)
else if (*cmd == 'r')
cmd = "\033[D";
writestr(this->wpipe, cmd);
LOG(1, "player_cmd: Send %s to omxplayer PID/fd %d/%d\n",
LOG(0, "player_cmd: Send %s to omxplayer PID/fd %d/%d\n",
cmd, this->pid, this->wpipe);
}

void player_off(struct player *this)
{
if (this == NULL || this->state == P_DEAD)
return;
LOG(1, "player_off: PID %d\n", this->pid);
LOG(0, "player_off: PID %d\n", this->pid);
write(this->wpipe, "q", 1);
player_cleanup(this);
}
Expand Down Expand Up @@ -242,7 +242,9 @@ static void player_quit(int signum)
return;
/* pid -1 error: retry if waitpid interrupted by new signal */
if (pid == -1) {
if (errno == EINTR)
int err = errno;
LOG(0, "player_quit: %s\n", strerror(err));
if (err == EINTR)
continue;
return;
}
Expand All @@ -255,7 +257,7 @@ static void player_quit(int signum)
player_cleanup(this);
quit_callback(this);
}
LOG(1, "player_quit: PID=%d (%d) with %d\n", pid, status);
LOG(0, "player_quit: PID=%d (%d) with %d\n", pid, status);
}
}

Expand Down

0 comments on commit 4d14121

Please sign in to comment.