Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
ff332333
Commit
ff332333
authored
May 07, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement new outputBuffering stuff for rest of decoders
git-svn-id:
https://svn.musicpd.org/mpd/trunk@942
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
c9f0d22f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
106 deletions
+37
-106
aac_decode.c
src/aac_decode.c
+12
-36
audiofile_decode.c
src/audiofile_decode.c
+7
-19
flac_decode.c
src/flac_decode.c
+11
-19
mp4_decode.c
src/mp4_decode.c
+7
-32
No files found.
src/aac_decode.c
View file @
ff332333
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include "audio.h"
#include "audio.h"
#include "log.h"
#include "log.h"
#include "inputStream.h"
#include "inputStream.h"
#include "outputBuffer.h"
#include <stdio.h>
#include <stdio.h>
#include <unistd.h>
#include <unistd.h>
...
@@ -361,45 +362,20 @@ int aac_decode(OutputBuffer * cb, AudioFormat * af, DecoderControl * dc) {
...
@@ -361,45 +362,20 @@ int aac_decode(OutputBuffer * cb, AudioFormat * af, DecoderControl * dc) {
sampleBufferLen
=
sampleCount
*
2
;
sampleBufferLen
=
sampleCount
*
2
;
while
(
sampleBufferLen
>
0
)
{
sendDataToOutputBuffer
(
cb
,
dc
,
sampleBuffer
,
sampleBufferLen
,
size_t
size
=
sampleBufferLen
>
CHUNK_SIZE
-
chunkLen
?
time
,
bitRate
);
CHUNK_SIZE
-
chunkLen
:
if
(
dc
->
seek
)
{
sampleBufferLen
;
dc
->
seekError
=
1
;
while
(
cb
->
begin
==
cb
->
end
&&
cb
->
wrap
&&
dc
->
seek
=
0
;
!
dc
->
stop
&&
!
dc
->
seek
)
}
{
else
if
(
dc
->
stop
)
{
my_usleep
(
10000
);
eof
=
1
;
}
break
;
if
(
dc
->
seek
)
{
dc
->
seekError
=
1
;
dc
->
seek
=
0
;
}
else
if
(
dc
->
stop
)
{
eof
=
1
;
break
;
}
else
{
sampleBufferLen
-=
size
;
memcpy
(
cb
->
chunks
+
cb
->
end
*
CHUNK_SIZE
+
chunkLen
,
sampleBuffer
,
size
);
cb
->
times
[
cb
->
end
]
=
time
;
cb
->
bitRate
[
cb
->
end
]
=
bitRate
;
sampleBuffer
+=
size
;
chunkLen
+=
size
;
if
(
chunkLen
>=
CHUNK_SIZE
)
{
cb
->
chunkSize
[
cb
->
end
]
=
CHUNK_SIZE
;
++
cb
->
end
;
if
(
cb
->
end
>=
buffered_chunks
)
{
cb
->
end
=
0
;
cb
->
wrap
=
1
;
}
chunkLen
=
0
;
}
}
}
}
}
while
(
!
eof
);
}
while
(
!
eof
);
flushOutputBuffer
(
cb
);
faacDecClose
(
decoder
);
faacDecClose
(
decoder
);
closeInputStream
(
b
.
inStream
);
closeInputStream
(
b
.
inStream
);
if
(
b
.
buffer
)
free
(
b
.
buffer
);
if
(
b
.
buffer
)
free
(
b
.
buffer
);
...
...
src/audiofile_decode.c
View file @
ff332333
...
@@ -109,30 +109,18 @@ int audiofile_decode(OutputBuffer * cb, AudioFormat * af, DecoderControl * dc)
...
@@ -109,30 +109,18 @@ int audiofile_decode(OutputBuffer * cb, AudioFormat * af, DecoderControl * dc)
ret
=
afReadFrames
(
af_fp
,
AF_DEFAULT_TRACK
,
chunk
,
CHUNK_SIZE
/
fs
);
ret
=
afReadFrames
(
af_fp
,
AF_DEFAULT_TRACK
,
chunk
,
CHUNK_SIZE
/
fs
);
if
(
ret
<=
0
)
eof
=
1
;
if
(
ret
<=
0
)
eof
=
1
;
else
{
else
{
while
(
cb
->
begin
==
cb
->
end
&&
cb
->
wrap
&&
current
+=
ret
;
!
dc
->
stop
&&
!
dc
->
seek
){
sendDataToOutputBuffer
(
cb
,
dc
,
chunk
,
ret
*
fs
,
my_usleep
(
10000
);
(
float
)
current
/
}
(
float
)
af
->
sampleRate
,
bitRate
);
if
(
dc
->
stop
)
break
;
if
(
dc
->
stop
)
break
;
else
if
(
dc
->
seek
)
continue
;
else
if
(
dc
->
seek
)
continue
;
memcpy
(
cb
->
chunks
+
cb
->
end
*
CHUNK_SIZE
,
chunk
,
CHUNK_SIZE
);
cb
->
chunkSize
[
cb
->
end
]
=
CHUNK_SIZE
;
current
+=
ret
;
cb
->
times
[
cb
->
end
]
=
(
float
)
current
/
(
float
)
af
->
sampleRate
;
cb
->
bitRate
[
cb
->
end
]
=
bitRate
;
++
cb
->
end
;
if
(
cb
->
end
>=
buffered_chunks
)
{
cb
->
end
=
0
;
cb
->
wrap
=
1
;
}
}
}
}
}
flushOutputBuffer
(
cb
);
if
(
dc
->
seek
)
dc
->
seek
=
0
;
if
(
dc
->
seek
)
dc
->
seek
=
0
;
if
(
dc
->
stop
)
{
if
(
dc
->
stop
)
{
...
...
src/flac_decode.c
View file @
ff332333
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include "log.h"
#include "log.h"
#include "pcm_utils.h"
#include "pcm_utils.h"
#include "inputStream.h"
#include "inputStream.h"
#include "outputBuffer.h"
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
...
@@ -159,7 +160,10 @@ void flacPlayFile(char *file, OutputBuffer * cb, AudioFormat * af,
...
@@ -159,7 +160,10 @@ void flacPlayFile(char *file, OutputBuffer * cb, AudioFormat * af,
}
}
FLAC__seekable_stream_decoder_delete
(
flacDec
);
FLAC__seekable_stream_decoder_delete
(
flacDec
);
/* send last little bit */
/* send last little bit */
if
(
data
.
chunk_length
>
0
&&
!
dc
->
stop
)
flacSendChunk
(
&
data
);
if
(
data
.
chunk_length
>
0
&&
!
dc
->
stop
)
{
flacSendChunk
(
&
data
);
flushOutputBuffer
(
data
.
cb
);
}
}
}
FLAC__SeekableStreamDecoderReadStatus
flacRead
(
FLAC__SeekableStreamDecoderReadStatus
flacRead
(
...
@@ -279,25 +283,13 @@ void flacMetadata(const FLAC__SeekableStreamDecoder *dec,
...
@@ -279,25 +283,13 @@ void flacMetadata(const FLAC__SeekableStreamDecoder *dec,
}
}
int
flacSendChunk
(
FlacData
*
data
)
{
int
flacSendChunk
(
FlacData
*
data
)
{
while
(
data
->
cb
->
begin
==
data
->
cb
->
end
&&
data
->
cb
->
wrap
&&
switch
(
sendDataToOutputBuffer
(
data
->
cb
,
data
->
dc
,
data
->
chunk
,
!
data
->
dc
->
stop
&&
!
data
->
dc
->
seek
)
data
->
chunk_length
,
data
->
time
,
data
->
bitRate
))
{
{
my_usleep
(
10000
);
case
OUTPUT_BUFFER_DC_STOP
:
}
return
-
1
;
default:
if
(
data
->
dc
->
stop
)
return
-
1
;
return
0
;
if
(
data
->
dc
->
seek
)
return
0
;
memcpy
(
data
->
cb
->
chunks
+
data
->
cb
->
end
*
CHUNK_SIZE
,
data
->
chunk
,
CHUNK_SIZE
);
data
->
cb
->
chunkSize
[
data
->
cb
->
end
]
=
data
->
chunk_length
;
data
->
cb
->
times
[
data
->
cb
->
end
]
=
data
->
time
;
data
->
cb
->
bitRate
[
data
->
cb
->
end
]
=
data
->
bitRate
;
data
->
cb
->
end
++
;
if
(
data
->
cb
->
end
>=
buffered_chunks
)
{
data
->
cb
->
end
=
0
;
data
->
cb
->
wrap
=
1
;
}
}
return
0
;
return
0
;
...
...
src/mp4_decode.c
View file @
ff332333
...
@@ -280,41 +280,16 @@ int mp4_decode(OutputBuffer * cb, AudioFormat * af, DecoderControl * dc) {
...
@@ -280,41 +280,16 @@ int mp4_decode(OutputBuffer * cb, AudioFormat * af, DecoderControl * dc) {
sampleBuffer
+=
offset
*
channels
*
2
;
sampleBuffer
+=
offset
*
channels
*
2
;
while
(
sampleBufferLen
>
0
&&
!
dc
->
seek
)
{
sendDataToOutputBuffer
(
cb
,
dc
,
sampleBuffer
,
size_t
size
=
sampleBufferLen
>
CHUNK_SIZE
-
chunkLen
?
sampleBufferLen
,
time
,
bitRate
);
CHUNK_SIZE
-
chunkLen
:
if
(
dc
->
stop
)
{
sampleBufferLen
;
eof
=
1
;
while
(
cb
->
begin
==
cb
->
end
&&
cb
->
wrap
&&
break
;
!
dc
->
stop
&&
!
dc
->
seek
)
{
my_usleep
(
10000
);
}
if
(
dc
->
stop
)
{
eof
=
1
;
break
;
}
else
if
(
!
dc
->
seek
)
{
sampleBufferLen
-=
size
;
memcpy
(
cb
->
chunks
+
cb
->
end
*
CHUNK_SIZE
+
chunkLen
,
sampleBuffer
,
size
);
cb
->
times
[
cb
->
end
]
=
time
;
cb
->
bitRate
[
cb
->
end
]
=
bitRate
;
sampleBuffer
+=
size
;
chunkLen
+=
size
;
if
(
chunkLen
>=
CHUNK_SIZE
)
{
cb
->
chunkSize
[
cb
->
end
]
=
CHUNK_SIZE
;
++
cb
->
end
;
if
(
cb
->
end
>=
buffered_chunks
)
{
cb
->
end
=
0
;
cb
->
wrap
=
1
;
}
chunkLen
=
0
;
}
}
}
}
}
}
flushOutputBuffer
(
cb
);
free
(
seekTable
);
free
(
seekTable
);
faacDecClose
(
decoder
);
faacDecClose
(
decoder
);
mp4ff_close
(
mp4fh
);
mp4ff_close
(
mp4fh
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment