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
7479bfac
Commit
7479bfac
authored
Mar 24, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bitRate support for audiofile
git-svn-id:
https://svn.musicpd.org/mpd/trunk@443
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
9b38a1e6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
audiofile_decode.c
src/audiofile_decode.c
+14
-1
mp3_decode.c
src/mp3_decode.c
+3
-1
No files found.
src/audiofile_decode.c
View file @
7479bfac
...
...
@@ -32,6 +32,9 @@
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <audiofile.h>
int
getAudiofileTotalTime
(
char
*
file
)
...
...
@@ -53,10 +56,17 @@ int audiofile_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
int
fs
,
frame_count
;
AFfilehandle
af_fp
;
int
bits
;
mpd_uint16
bitRate
;
struct
stat
st
;
if
(
stat
(
dc
->
file
,
&
st
)
<
0
)
{
ERROR
(
"failed to stat: %s
\n
"
,
dc
->
file
);
return
-
1
;
}
af_fp
=
afOpenFile
(
dc
->
file
,
"r"
,
NULL
);
if
(
af_fp
==
AF_NULL_FILEHANDLE
)
{
ERROR
(
"failed to open %s
\n
"
,
dc
->
file
);
ERROR
(
"failed to open
:
%s
\n
"
,
dc
->
file
);
return
-
1
;
}
...
...
@@ -69,6 +79,8 @@ int audiofile_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
cb
->
totalTime
=
((
float
)
frame_count
/
(
float
)
af
->
sampleRate
);
bitRate
=
st
.
st_size
*
8
.
0
/
cb
->
totalTime
/
1024
.
0
+
0
.
5
;
if
(
af
->
bits
!=
8
&&
af
->
bits
!=
16
)
{
ERROR
(
"Only 8 and 16-bit files are supported. %s is %i-bit
\n
"
,
dc
->
file
,
af
->
bits
);
...
...
@@ -110,6 +122,7 @@ int audiofile_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
current
+=
ret
;
cb
->
times
[
cb
->
end
]
=
(
float
)
current
/
(
float
)
af
->
sampleRate
;
cb
->
bitRate
[
cb
->
end
]
=
bitRate
;
++
cb
->
end
;
...
...
src/mp3_decode.c
View file @
7479bfac
...
...
@@ -190,7 +190,9 @@ int decodeNextFrameHeader(mp3DecodeData * data) {
}
if
(
mad_header_decode
(
&
data
->
frame
.
header
,
&
data
->
stream
))
{
#ifdef HAVE_ID3TAG
if
((
data
->
stream
).
error
==
MAD_ERROR_LOSTSYNC
)
{
if
((
data
->
stream
).
error
==
MAD_ERROR_LOSTSYNC
&&
(
data
->
stream
).
this_frame
)
{
signed
long
tagsize
=
id3_tag_query
(
(
data
->
stream
).
this_frame
,
(
data
->
stream
).
bufend
-
...
...
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