summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-02-01 21:32:01 +0100
committerwm4 <wm4@nowhere>2016-02-01 22:03:04 +0100
commitab318aeea84f51fa0adcfb09a8a43abc67dae1cd (patch)
tree1c734ae196b8148f35cb65d30596339cadf8e575 /audio
parent07d8a0e142a6f97c39abbf85acbe4adc90c360b1 (diff)
downloadmpv-ab318aeea84f51fa0adcfb09a8a43abc67dae1cd.tar.bz2
mpv-ab318aeea84f51fa0adcfb09a8a43abc67dae1cd.tar.xz
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.
Diffstat (limited to 'audio')
-rw-r--r--audio/decode/dec_audio.c22
-rw-r--r--audio/decode/dec_audio.h5
2 files changed, 11 insertions, 16 deletions
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);