diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-04-13 01:16:03 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-04-13 01:16:03 +0000 |
commit | dec6b1612e953c6029d963ff55d2b4a669b60f43 (patch) | |
tree | a1138cb07f67c821ee5000618302d21367ab2245 /src/inputPlugins/mp4_plugin.c | |
parent | 98acfa8ac5bac09ca49a7c21938b5a5801e01ca5 (diff) | |
download | mpd-dec6b1612e953c6029d963ff55d2b4a669b60f43.tar.gz mpd-dec6b1612e953c6029d963ff55d2b4a669b60f43.tar.xz mpd-dec6b1612e953c6029d963ff55d2b4a669b60f43.zip |
Stop passing our single DecoderControl object everywhere
This at least makes the argument list to a lot of our plugin
functions shorter and removes a good amount of line nois^W^Wcode,
hopefully making things easier to read and follow.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7353 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/inputPlugins/mp4_plugin.c')
-rw-r--r-- | src/inputPlugins/mp4_plugin.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/src/inputPlugins/mp4_plugin.c b/src/inputPlugins/mp4_plugin.c index 1e755b95c..fb8c71020 100644 --- a/src/inputPlugins/mp4_plugin.c +++ b/src/inputPlugins/mp4_plugin.c @@ -84,8 +84,7 @@ static uint32_t mp4_inputStreamSeekCallback(void *inStream, uint64_t position) return seekInputStream((InputStream *) inStream, position, SEEK_SET); } -static int mp4_decode(OutputBuffer * cb, DecoderControl * dc, - InputStream * inStream) +static int mp4_decode(OutputBuffer * cb, InputStream * inStream) { mp4ff_t *mp4fh; mp4ff_callback_t *mp4cb; @@ -146,7 +145,7 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc, #endif faacDecSetConfiguration(decoder, config); - dc->audioFormat.bits = 16; + dc.audioFormat.bits = 16; mp4Buffer = NULL; mp4BufferSize = 0; @@ -161,8 +160,8 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc, return -1; } - dc->audioFormat.sampleRate = sampleRate; - dc->audioFormat.channels = channels; + dc.audioFormat.sampleRate = sampleRate; + dc.audioFormat.channels = channels; file_time = mp4ff_get_track_duration_use_offsets(mp4fh, track); scale = mp4ff_time_scale(mp4fh, track); @@ -176,7 +175,7 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc, free(mp4cb); return -1; } - dc->totalTime = ((float)file_time) / scale; + dc.totalTime = ((float)file_time) / scale; numSamples = mp4ff_num_samples(mp4fh, track); @@ -185,13 +184,13 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc, seekTable = xmalloc(sizeof(float) * numSamples); for (sampleId = 0; sampleId < numSamples && !eof; sampleId++) { - if (dc->seek) + if (dc.seek) seeking = 1; if (seeking && seekTableEnd > 1 && - seekTable[seekTableEnd] >= dc->seekWhere) { + seekTable[seekTableEnd] >= dc.seekWhere) { int i = 2; - while (seekTable[i] < dc->seekWhere) + while (seekTable[i] < dc.seekWhere) i++; sampleId = i - 1; file_time = seekTable[sampleId]; @@ -213,14 +212,14 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc, dur -= offset; file_time += ((float)dur) / scale; - if (seeking && file_time > dc->seekWhere) + if (seeking && file_time > dc.seekWhere) seekPositionFound = 1; if (seeking && seekPositionFound) { seekPositionFound = 0; clearOutputBuffer(cb); seeking = 0; - dc->seek = 0; + dc.seek = 0; decoder_wakeup_player(); } @@ -248,16 +247,16 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc, break; } - if (dc->state != DECODE_STATE_DECODE) { + if (dc.state != DECODE_STATE_DECODE) { channels = frameInfo.channels; #ifdef HAVE_FAACDECFRAMEINFO_SAMPLERATE scale = frameInfo.samplerate; #endif - dc->audioFormat.sampleRate = scale; - dc->audioFormat.channels = frameInfo.channels; - getOutputAudioFormat(&(dc->audioFormat), + dc.audioFormat.sampleRate = scale; + dc.audioFormat.channels = frameInfo.channels; + getOutputAudioFormat(&(dc.audioFormat), &(cb->audioFormat)); - dc->state = DECODE_STATE_DECODE; + dc.state = DECODE_STATE_DECODE; } if (channels * (unsigned long)(dur + offset) > frameInfo.samples) { @@ -278,10 +277,10 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc, sampleBuffer += offset * channels * 2; - sendDataToOutputBuffer(cb, inStream, dc, 1, sampleBuffer, + sendDataToOutputBuffer(cb, inStream, 1, sampleBuffer, sampleBufferLen, file_time, bitRate, NULL); - if (dc->stop) { + if (dc.stop) { eof = 1; break; } @@ -292,12 +291,12 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc, mp4ff_close(mp4fh); free(mp4cb); - if (dc->state != DECODE_STATE_DECODE) + if (dc.state != DECODE_STATE_DECODE) return -1; - if (dc->seek && seeking) { + if (dc.seek && seeking) { clearOutputBuffer(cb); - dc->seek = 0; + dc.seek = 0; decoder_wakeup_player(); } flushOutputBuffer(cb); |