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
2e1347ab
Commit
2e1347ab
authored
Jul 10, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/audiofile: split audiofile_get_duration()
parent
9ddb5931
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
AudiofileDecoderPlugin.cxx
src/decoder/plugins/AudiofileDecoderPlugin.cxx
+11
-4
No files found.
src/decoder/plugins/AudiofileDecoderPlugin.cxx
View file @
2e1347ab
...
...
@@ -54,17 +54,24 @@ struct AudioFileInputStream {
};
gcc_pure
static
double
audiofile_get_duration
(
AFfilehandle
fh
)
{
double
frame_count
=
afGetFrameCount
(
fh
,
AF_DEFAULT_TRACK
);
double
rate
=
afGetRate
(
fh
,
AF_DEFAULT_TRACK
);
return
frame_count
/
rate
;
}
gcc_pure
static
int
audiofile_get_duration
(
Path
path_fs
)
{
int
total_time
;
AFfilehandle
af_fp
=
afOpenFile
(
path_fs
.
c_str
(),
"r"
,
nullptr
);
if
(
af_fp
==
AF_NULL_FILEHANDLE
)
{
return
-
1
;
}
total_time
=
(
int
)
((
double
)
afGetFrameCount
(
af_fp
,
AF_DEFAULT_TRACK
)
/
afGetRate
(
af_fp
,
AF_DEFAULT_TRACK
));
int
total_time
=
int
(
audiofile_get_duration
(
af_fp
));
afCloseFile
(
af_fp
);
return
total_time
;
}
...
...
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