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
071cacc9
Commit
071cacc9
authored
Dec 04, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/sidplay: pass SidTuneMod to get_song_length()
Eliminate duplicate SidTune construction.
parent
33f33323
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
14 deletions
+9
-14
SidplayDecoderPlugin.cxx
src/decoder/plugins/SidplayDecoderPlugin.cxx
+9
-14
No files found.
src/decoder/plugins/SidplayDecoderPlugin.cxx
View file @
071cacc9
...
...
@@ -130,19 +130,12 @@ ParseContainerPath(Path path_fs)
/* get the song length in seconds */
static
SignedSongTime
get_song_length
(
const
SidplayContainerPath
&
container
)
get_song_length
(
SidTuneMod
&
tune
)
{
if
(
songlength_database
==
nullptr
)
return
SignedSongTime
::
Negative
();
assert
(
tune
);
SidTuneMod
tune
(
container
.
path
.
c_str
());
if
(
!
tune
)
{
LogWarning
(
sidplay_domain
,
"failed to load file for calculating md5 sum"
);
if
(
songlength_database
==
nullptr
)
return
SignedSongTime
::
Negative
();
}
tune
.
selectSong
(
container
.
track
);
const
auto
length
=
songlength_database
->
length
(
tune
);
if
(
length
<
0
)
...
...
@@ -159,7 +152,7 @@ sidplay_file_decode(Decoder &decoder, Path path_fs)
/* load the tune */
const
auto
container
=
ParseContainerPath
(
path_fs
);
SidTune
tune
(
container
.
path
.
c_str
(),
nullptr
,
true
);
SidTune
Mod
tune
(
container
.
path
.
c_str
()
);
if
(
!
tune
)
{
LogWarning
(
sidplay_domain
,
"failed to load file"
);
return
;
...
...
@@ -168,7 +161,7 @@ sidplay_file_decode(Decoder &decoder, Path path_fs)
const
int
song_num
=
container
.
track
;
tune
.
selectSong
(
song_num
);
auto
duration
=
get_song_length
(
container
);
auto
duration
=
get_song_length
(
tune
);
if
(
duration
.
IsNegative
()
&&
default_songlength
>
0
)
duration
=
SongTime
::
FromS
(
default_songlength
);
...
...
@@ -298,10 +291,12 @@ sidplay_scan_file(Path path_fs,
const
auto
container
=
ParseContainerPath
(
path_fs
);
const
unsigned
song_num
=
container
.
track
;
SidTune
tune
(
container
.
path
.
c_str
(),
nullptr
,
true
);
SidTune
Mod
tune
(
container
.
path
.
c_str
()
);
if
(
!
tune
)
return
false
;
tune
.
selectSong
(
song_num
);
const
SidTuneInfo
&
info
=
tune
.
getInfo
();
/* title */
...
...
@@ -332,7 +327,7 @@ sidplay_scan_file(Path path_fs,
tag_handler_invoke_tag
(
handler
,
handler_ctx
,
TAG_TRACK
,
track
);
/* time */
const
auto
duration
=
get_song_length
(
container
);
const
auto
duration
=
get_song_length
(
tune
);
if
(
!
duration
.
IsNegative
())
tag_handler_invoke_duration
(
handler
,
handler_ctx
,
SongTime
(
duration
));
...
...
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