mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -05:00
pw-cat: handle midi EOF better
Return 0 when there are no more events, 1 when we have an event and < 0 for errors. Use this to correctly push the last set of events on EOS and then return 0 and stop without an error.
This commit is contained in:
parent
d8bac82e72
commit
8b874a9514
2 changed files with 9 additions and 4 deletions
|
|
@ -124,7 +124,7 @@ static int peek_event(struct midi_file *mf, struct midi_track *tr, struct midi_e
|
|||
int res;
|
||||
|
||||
if (tr_avail(tr) == 0)
|
||||
return -EIO;
|
||||
return 0;
|
||||
|
||||
save = tr->p;
|
||||
status = *tr->p;
|
||||
|
|
@ -182,7 +182,7 @@ static int peek_event(struct midi_file *mf, struct midi_track *tr, struct midi_e
|
|||
tr->p = save;
|
||||
|
||||
event->size = size;
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int midi_file_add_track(struct midi_file *mf, struct midi_track *track)
|
||||
|
|
@ -213,7 +213,7 @@ int midi_file_peek_event(struct midi_file *mf, struct midi_event *event)
|
|||
found = tr;
|
||||
}
|
||||
if (found == NULL)
|
||||
return -EIO;
|
||||
return 0;
|
||||
|
||||
return peek_event(mf, found, event);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue