diff options
author | Max Kellermann <max@duempel.org> | 2008-11-10 15:02:26 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-11-10 15:02:26 +0100 |
commit | 84b540f435e90fff5b13f295b1a0927cbcb5d744 (patch) | |
tree | 62bea5980c6133b46bebe98ae04874a64386fcf4 /src/decoder_api.c | |
parent | 23a4ce4444e306943031928aa3f8bd2b7f51eb9a (diff) | |
download | mpd-84b540f435e90fff5b13f295b1a0927cbcb5d744.tar.gz mpd-84b540f435e90fff5b13f295b1a0927cbcb5d744.tar.xz mpd-84b540f435e90fff5b13f295b1a0927cbcb5d744.zip |
decoder: added more assertions
Added a lot of assertions checking the state of the decoder plugin.
Diffstat (limited to 'src/decoder_api.c')
-rw-r--r-- | src/decoder_api.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/decoder_api.c b/src/decoder_api.c index e0bdb6eb4..934c7d811 100644 --- a/src/decoder_api.c +++ b/src/decoder_api.c @@ -35,7 +35,11 @@ void decoder_initialized(struct decoder * decoder, bool seekable, float total_time) { assert(dc.state == DECODE_STATE_START); + assert(decoder != NULL); + assert(!decoder->stream_tag_sent); + assert(!decoder->seeking); assert(audio_format != NULL); + assert(audio_format_defined(audio_format)); pcm_convert_init(&decoder->conv_state); @@ -96,6 +100,8 @@ size_t decoder_read(struct decoder *decoder, { size_t nbytes; + assert(dc.state == DECODE_STATE_START || + dc.state == DECODE_STATE_DECODE); assert(is != NULL); assert(buffer != NULL); @@ -175,6 +181,8 @@ decoder_data(struct decoder *decoder, size_t nbytes; char *data; + assert(dc.state == DECODE_STATE_DECODE); + if (is != NULL && !decoder->stream_tag_sent) { const struct tag *src; struct tag *tag1, *tag2; @@ -254,6 +262,8 @@ decoder_tag(mpd_unused struct decoder *decoder, struct input_stream *is, { struct tag *tag2 = is != NULL ? tag_add_stream_tags(tag, is) : NULL; + assert(dc.state == DECODE_STATE_DECODE); + if (tag2 != NULL) tag = tag2; |