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
3130ea01
Commit
3130ea01
authored
Mar 20, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git-svn-id:
https://svn.musicpd.org/mpd/trunk@326
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
cf2986c6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
mp4_decode.c
src/mp4_decode.c
+12
-6
No files found.
src/mp4_decode.c
View file @
3130ea01
...
...
@@ -98,7 +98,7 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
long
seekTableEnd
=
-
1
;
int
seekPositionFound
=
0
;
long
offset
;
mpd_uint16
bitRate
;
mpd_uint16
bitRate
=
0
;
fh
=
fopen
(
dc
->
file
,
"r"
);
if
(
!
fh
)
{
...
...
@@ -156,7 +156,6 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
af
->
sampleRate
=
sampleRate
;
af
->
channels
=
channels
;
time
=
mp4ff_get_track_duration_use_offsets
(
mp4fh
,
track
);
bitRate
=
mp4ff_get_avg_bitrate
(
mp4fh
,
track
);
scale
=
mp4ff_time_scale
(
mp4fh
,
track
);
if
(
mp4Buffer
)
free
(
mp4Buffer
);
...
...
@@ -229,14 +228,21 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
break
;
}
if
(
dur
+
offset
>
frameInfo
.
samples
)
{
if
(
channels
*
(
dur
+
offset
)
>
frameInfo
.
samples
)
{
dur
=
frameInfo
.
samples
;
offset
=
0
;
}
sampleCount
=
(
unsigned
long
)(
dur
*
channels
);
if
(
sampleCount
>
0
)
initial
=
0
;
if
(
sampleCount
>
0
)
{
initial
=
0
;
bitRate
=
frameInfo
.
bytesconsumed
*
8
.
0
*
frameInfo
.
channels
*
scale
/
frameInfo
.
samples
/
1024
+
0
.
5
;
}
sampleBufferLen
=
sampleCount
*
2
;
sampleBuffer
+=
offset
*
channels
*
2
;
...
...
@@ -262,7 +268,7 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
memcpy
(
cb
->
chunks
+
cb
->
end
*
CHUNK_SIZE
+
chunkLen
,
sampleBuffer
,
size
);
cb
->
times
[
cb
->
end
]
=
time
;
cb
->
bitRate
[
cb
->
end
]
=
bitRate
/
1024
;
cb
->
bitRate
[
cb
->
end
]
=
bitRate
;
sampleBuffer
+=
size
;
chunkLen
+=
size
;
if
(
chunkLen
>=
CHUNK_SIZE
)
{
...
...
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