ogg_plugin cleanup
git-svn-id: https://svn.musicpd.org/mpd/trunk@1278 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
199ad37e22
commit
187eba5754
@ -170,6 +170,16 @@ int ogg_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
|
|||||||
OggVorbis_File vf;
|
OggVorbis_File vf;
|
||||||
ov_callbacks callbacks;
|
ov_callbacks callbacks;
|
||||||
OggCallbackData data;
|
OggCallbackData data;
|
||||||
|
int current_section;
|
||||||
|
int eof = 0;
|
||||||
|
long ret;
|
||||||
|
#define OGG_CHUNK_SIZE 4096
|
||||||
|
char chunk[OGG_CHUNK_SIZE];
|
||||||
|
int chunkpos = 0;
|
||||||
|
long bitRate = 0;
|
||||||
|
long test;
|
||||||
|
float replayGainScale;
|
||||||
|
char ** comments;
|
||||||
|
|
||||||
data.inStream = inStream;
|
data.inStream = inStream;
|
||||||
data.dc = dc;
|
data.dc = dc;
|
||||||
@ -202,19 +212,12 @@ int ogg_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
|
|||||||
|
|
||||||
dc->totalTime = ov_time_total(&vf,-1);
|
dc->totalTime = ov_time_total(&vf,-1);
|
||||||
if(dc->totalTime < 0) dc->totalTime = 0;
|
if(dc->totalTime < 0) dc->totalTime = 0;
|
||||||
|
|
||||||
|
comments = ov_comment(&vf, -1)->user_comments;
|
||||||
|
|
||||||
dc->state = DECODE_STATE_DECODE;
|
dc->state = DECODE_STATE_DECODE;
|
||||||
|
|
||||||
{
|
replayGainScale = ogg_getReplayGainScale(comments);
|
||||||
int current_section;
|
|
||||||
int eof = 0;
|
|
||||||
long ret;
|
|
||||||
#define OGG_CHUNK_SIZE 4096
|
|
||||||
char chunk[OGG_CHUNK_SIZE];
|
|
||||||
int chunkpos = 0;
|
|
||||||
long bitRate = 0;
|
|
||||||
long test;
|
|
||||||
float replayGainScale = ogg_getReplayGainScale(
|
|
||||||
ov_comment(&vf,-1)->user_comments);
|
|
||||||
|
|
||||||
while(!eof) {
|
while(!eof) {
|
||||||
if(dc->seek) {
|
if(dc->seek) {
|
||||||
@ -245,15 +248,19 @@ int ogg_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
|
|||||||
doReplayGain(chunk,ret,&(dc->audioFormat),
|
doReplayGain(chunk,ret,&(dc->audioFormat),
|
||||||
replayGainScale);
|
replayGainScale);
|
||||||
sendDataToOutputBuffer(cb, inStream, dc,
|
sendDataToOutputBuffer(cb, inStream, dc,
|
||||||
inStream->seekable, chunk, chunkpos,
|
inStream->seekable,
|
||||||
ov_time_tell(&vf), bitRate);
|
chunk, chunkpos,
|
||||||
|
ov_time_tell(&vf),
|
||||||
|
bitRate);
|
||||||
|
|
||||||
if(dc->stop) break;
|
if(dc->stop) break;
|
||||||
chunkpos = 0;
|
chunkpos = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!dc->stop && chunkpos > 0) {
|
if(!dc->stop && chunkpos > 0) {
|
||||||
sendDataToOutputBuffer(cb, NULL, dc, inStream->seekable, chunk, chunkpos,
|
sendDataToOutputBuffer(cb, NULL, dc, inStream->seekable,
|
||||||
|
chunk, chunkpos,
|
||||||
ov_time_tell(&vf), bitRate);
|
ov_time_tell(&vf), bitRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,17 +268,11 @@ int ogg_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
|
|||||||
|
|
||||||
flushOutputBuffer(cb);
|
flushOutputBuffer(cb);
|
||||||
|
|
||||||
/*if(dc->seek) {
|
|
||||||
dc->seekError = 1;
|
|
||||||
dc->seek = 0;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if(dc->stop) {
|
if(dc->stop) {
|
||||||
dc->state = DECODE_STATE_STOP;
|
dc->state = DECODE_STATE_STOP;
|
||||||
dc->stop = 0;
|
dc->stop = 0;
|
||||||
}
|
}
|
||||||
else dc->state = DECODE_STATE_STOP;
|
else dc->state = DECODE_STATE_STOP;
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user