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
430b5b04
Commit
430b5b04
authored
Aug 30, 2009
by
Mike Dawson
Committed by
Max Kellermann
Aug 30, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/sidplay: support seeking
parent
cde9408b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
3 deletions
+35
-3
NEWS
NEWS
+1
-0
sidplay_plugin.cxx
src/decoder/sidplay_plugin.cxx
+34
-3
No files found.
NEWS
View file @
430b5b04
...
...
@@ -17,6 +17,7 @@ ver 0.16 (20??/??/??)
- mpg123: new decoder plugin based on libmpg123
- sidplay: support sub-tunes
- sidplay: implemented songlength database
- sidplay: support seeking
* encoders:
- twolame: new encoder plugin based on libtwolame
* output:
...
...
src/decoder/sidplay_plugin.cxx
View file @
430b5b04
...
...
@@ -198,6 +198,9 @@ sidplay_file_decode(struct decoder *decoder, const char *path_fs)
int
song_num
=
get_song_num
(
path_fs
);
tune
.
selectSong
(
song_num
);
int
song_len
=
get_song_length
(
path_fs
);
if
(
song_len
==-
1
)
song_len
=
default_songlength
;
/* initialize the player */
sidplay2
player
;
...
...
@@ -259,10 +262,12 @@ sidplay_file_decode(struct decoder *decoder, const char *path_fs)
struct
audio_format
audio_format
;
audio_format_init
(
&
audio_format
,
48000
,
16
,
2
);
decoder_initialized
(
decoder
,
&
audio_format
,
false
,
-
1
);
decoder_initialized
(
decoder
,
&
audio_format
,
true
,
(
float
)
song_len
);
/* .. and play */
float
data_time
=
0
;
int
timebase
=
player
.
timebase
();
enum
decoder_command
cmd
;
do
{
char
buffer
[
4096
];
...
...
@@ -273,8 +278,34 @@ sidplay_file_decode(struct decoder *decoder, const char *path_fs)
break
;
cmd
=
decoder_data
(
decoder
,
NULL
,
buffer
,
nbytes
,
0
,
0
,
NULL
);
}
while
(
cmd
==
DECODE_COMMAND_NONE
);
data_time
,
0
,
NULL
);
data_time
=
player
.
time
()
/
timebase
;
if
(
cmd
==
DECODE_COMMAND_SEEK
)
{
int
target_time
=
decoder_seek_where
(
decoder
);
/* can't rewind so return to zero and seek forward */
if
(
target_time
<
data_time
)
{
player
.
stop
();
data_time
=
0
;
}
/* ignore data until target time is reached */
while
(
data_time
<
target_time
)
{
nbytes
=
player
.
play
(
buffer
,
sizeof
(
buffer
));
if
(
nbytes
==
0
)
break
;
data_time
=
player
.
time
()
/
timebase
;
}
decoder_command_finished
(
decoder
);
}
if
(
song_len
&&
data_time
>=
(
float
)
song_len
)
break
;
}
while
(
cmd
!=
DECODE_COMMAND_STOP
);
}
static
struct
tag
*
...
...
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