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
6a72db22
Commit
6a72db22
authored
Feb 17, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
faad: functions return duration, no float pointer
Instead of writing the song duration into a float pointer, return it from the function.
parent
e30ba2e4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
15 deletions
+18
-15
faad_plugin.c
src/decoder/faad_plugin.c
+18
-15
No files found.
src/decoder/faad_plugin.c
View file @
6a72db22
...
...
@@ -143,8 +143,8 @@ adts_find_frame(struct faad_buffer *b)
return
0
;
}
static
void
adts_song_duration
(
struct
faad_buffer
*
b
,
float
*
length
)
static
float
adts_song_duration
(
struct
faad_buffer
*
b
)
{
unsigned
int
frames
,
frame_length
;
unsigned
sample_rate
=
0
;
...
...
@@ -167,8 +167,10 @@ adts_song_duration(struct faad_buffer *b, float *length)
}
frames_per_second
=
(
float
)
sample_rate
/
1024
.
0
;
if
(
frames_per_second
>
0
)
*
length
=
(
float
)
frames
/
frames_per_second
;
if
(
frames_per_second
<=
0
)
return
-
1
;
return
(
float
)
frames
/
frames_per_second
;
}
static
void
...
...
@@ -181,14 +183,12 @@ faad_buffer_init(struct faad_buffer *buffer, struct decoder *decoder,
buffer
->
is
=
is
;
}
static
void
faad_song_duration
(
struct
faad_buffer
*
b
,
float
*
length
)
static
float
faad_song_duration
(
struct
faad_buffer
*
b
)
{
size_t
fileread
;
size_t
tagsize
;
*
length
=
-
1
;
fileread
=
b
->
is
->
size
>=
0
?
b
->
is
->
size
:
0
;
faad_buffer_fill
(
b
);
...
...
@@ -205,13 +205,15 @@ faad_song_duration(struct faad_buffer *b, float *length)
if
(
b
->
is
->
seekable
&&
b
->
length
>=
2
&&
(
b
->
data
[
0
]
==
0xFF
)
&&
((
b
->
data
[
1
]
&
0xF6
)
==
0xF0
))
{
adts_song_duration
(
b
,
length
);
float
length
=
adts_song_duration
(
b
);
input_stream_seek
(
b
->
is
,
tagsize
,
SEEK_SET
);
b
->
length
=
0
;
b
->
consumed
=
0
;
faad_buffer_fill
(
b
);
return
length
;
}
else
if
(
b
->
length
>=
5
&&
memcmp
(
b
->
data
,
"ADIF"
,
4
)
==
0
)
{
unsigned
bit_rate
;
size_t
skip_size
=
(
b
->
data
[
4
]
&
0x80
)
?
9
:
0
;
...
...
@@ -220,7 +222,7 @@ faad_song_duration(struct faad_buffer *b, float *length)
if
(
8
+
skip_size
>
b
->
length
)
/* not enough data yet; skip parsing this
header */
return
;
return
-
1
;
bit_rate
=
((
unsigned
)(
b
->
data
[
4
+
skip_size
]
&
0x0F
)
<<
19
)
|
((
unsigned
)
b
->
data
[
5
+
skip_size
]
<<
11
)
|
...
...
@@ -228,10 +230,11 @@ faad_song_duration(struct faad_buffer *b, float *length)
((
unsigned
)
b
->
data
[
7
+
skip_size
]
&
0xE0
);
if
(
fileread
!=
0
&&
bit_rate
!=
0
)
*
length
=
fileread
*
8
.
0
/
bit_rate
;
return
fileread
*
8
.
0
/
bit_rate
;
else
*
length
=
fileread
;
}
return
fileread
;
}
else
return
-
1
;
}
static
float
...
...
@@ -258,7 +261,7 @@ faad_get_file_time_float(const char *file)
return
-
1
;
faad_buffer_init
(
&
buffer
,
NULL
,
&
is
);
faad_song_duration
(
&
buffer
,
&
length
);
length
=
faad_song_duration
(
&
buffer
);
if
(
length
<
0
)
{
decoder
=
faacDecOpen
();
...
...
@@ -326,7 +329,7 @@ faad_stream_decode(struct decoder *mpd_decoder, struct input_stream *is)
enum
decoder_command
cmd
;
faad_buffer_init
(
&
buffer
,
mpd_decoder
,
is
);
faad_song_duration
(
&
buffer
,
&
total_time
);
total_time
=
faad_song_duration
(
&
buffer
);
decoder
=
faacDecOpen
();
...
...
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