From ab318aeea84f51fa0adcfb09a8a43abc67dae1cd Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 1 Feb 2016 21:32:01 +0100 Subject: audio/video: merge decoder return values Will be helpful for the coming filter support. I planned on merging audio/video decoding, but this will have to wait a bit longer, so only remove the duplicate status codes. --- audio/decode/dec_audio.c | 22 +++++++++++----------- audio/decode/dec_audio.h | 5 ----- 2 files changed, 11 insertions(+), 16 deletions(-) (limited to 'audio') diff --git a/audio/decode/dec_audio.c b/audio/decode/dec_audio.c index 9e136f2e3b..fede4ae2d7 100644 --- a/audio/decode/dec_audio.c +++ b/audio/decode/dec_audio.c @@ -201,7 +201,7 @@ void audio_work(struct dec_audio *da) return; if (!da->packet && demux_read_packet_async(da->header, &da->packet) == 0) { - da->current_state = AUDIO_WAIT; + da->current_state = DATA_WAIT; return; } @@ -218,30 +218,30 @@ void audio_work(struct dec_audio *da) da->current_frame = NULL; } - da->current_state = AUDIO_OK; + da->current_state = DATA_OK; if (!da->current_frame) { - da->current_state = AUDIO_EOF; + da->current_state = DATA_EOF; if (had_packet) - da->current_state = AUDIO_SKIP; + da->current_state = DATA_AGAIN; } fix_audio_pts(da); } // Fetch an audio frame decoded with audio_work(). Returns one of: -// AUDIO_OK: *out_frame is set to a new image -// AUDIO_WAIT: waiting for demuxer; will receive a wakeup signal -// AUDIO_EOF: end of file, no more frames to be expected -// AUDIO_SKIP: dropped frame or something similar +// DATA_OK: *out_frame is set to a new image +// DATA_WAIT: waiting for demuxer; will receive a wakeup signal +// DATA_EOF: end of file, no more frames to be expected +// DATA_AGAIN: dropped frame or something similar int audio_get_frame(struct dec_audio *da, struct mp_audio **out_frame) { *out_frame = NULL; if (da->current_frame) { *out_frame = da->current_frame; da->current_frame = NULL; - return AUDIO_OK; + return DATA_OK; } - if (da->current_state == AUDIO_OK) - return AUDIO_SKIP; + if (da->current_state == DATA_OK) + return DATA_AGAIN; return da->current_state; } diff --git a/audio/decode/dec_audio.h b/audio/decode/dec_audio.h index 90451ef787..a7f878bee7 100644 --- a/audio/decode/dec_audio.h +++ b/audio/decode/dec_audio.h @@ -52,11 +52,6 @@ int audio_init_best_codec(struct dec_audio *d_audio); void audio_uninit(struct dec_audio *d_audio); void audio_work(struct dec_audio *d_audio); - -#define AUDIO_OK 1 -#define AUDIO_WAIT 0 -#define AUDIO_EOF -1 -#define AUDIO_SKIP -2 int audio_get_frame(struct dec_audio *d_audio, struct mp_audio **out_frame); void audio_reset_decoding(struct dec_audio *d_audio); -- cgit v1.2.3