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
99949c8f
Commit
99949c8f
authored
Dec 24, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command: new command "seekcur"
For simpler seeking within current song.
parent
78c4351e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
75 additions
and
0 deletions
+75
-0
NEWS
NEWS
+1
-0
protocol.xml
doc/protocol.xml
+17
-0
command.c
src/command.c
+16
-0
ffmpeg_decoder_plugin.c
src/decoder/ffmpeg_decoder_plugin.c
+5
-0
playlist.h
src/playlist.h
+12
-0
playlist_control.c
src/playlist_control.c
+24
-0
No files found.
NEWS
View file @
99949c8f
...
...
@@ -2,6 +2,7 @@ ver 0.17 (2011/??/??)
* protocol:
- support client-to-client communication
- "update" and "rescan" need only "CONTROL" permission
- new command "seekcur" for simpler seeking within current song
* input:
- cdio_paranoia: new input plugin to play audio CDs
- curl: enable CURLOPT_NETRC
...
...
doc/protocol.xml
View file @
99949c8f
...
...
@@ -878,6 +878,23 @@
</para>
</listitem>
</varlistentry>
<varlistentry
id=
"command_seekcur"
>
<term>
<cmdsynopsis>
<command>
seekcur
</command>
<arg
choice=
"req"
><replaceable>
TIME
</replaceable></arg>
</cmdsynopsis>
</term>
<listitem>
<para>
Seeks to the position
<varname>
TIME
</varname>
within the
current song. If prefixed by '+' or '-', then the time
is relative to the current playing position.
</para>
</listitem>
</varlistentry>
<varlistentry
id=
"command_stop"
>
<term>
<cmdsynopsis>
...
...
src/command.c
View file @
99949c8f
...
...
@@ -1532,6 +1532,21 @@ handle_seekid(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
}
static
enum
command_return
handle_seekcur
(
struct
client
*
client
,
G_GNUC_UNUSED
int
argc
,
char
*
argv
[])
{
const
char
*
p
=
argv
[
1
];
bool
relative
=
*
p
==
'+'
||
*
p
==
'-'
;
int
seek_time
;
if
(
!
check_int
(
client
,
&
seek_time
,
p
,
check_integer
,
p
))
return
COMMAND_RETURN_ERROR
;
enum
playlist_result
result
=
playlist_seek_current
(
&
g_playlist
,
client
->
player_control
,
seek_time
,
relative
);
return
print_playlist_result
(
client
,
result
);
}
static
enum
command_return
handle_listallinfo
(
struct
client
*
client
,
G_GNUC_UNUSED
int
argc
,
char
*
argv
[])
{
const
char
*
directory
=
""
;
...
...
@@ -2159,6 +2174,7 @@ static const struct command commands[] = {
{
"save"
,
PERMISSION_CONTROL
,
1
,
1
,
handle_save
},
{
"search"
,
PERMISSION_READ
,
2
,
-
1
,
handle_search
},
{
"seek"
,
PERMISSION_CONTROL
,
2
,
2
,
handle_seek
},
{
"seekcur"
,
PERMISSION_CONTROL
,
1
,
1
,
handle_seekcur
},
{
"seekid"
,
PERMISSION_CONTROL
,
2
,
2
,
handle_seekid
},
{
"sendmessage"
,
PERMISSION_CONTROL
,
2
,
2
,
handle_send_message
},
{
"setvol"
,
PERMISSION_CONTROL
,
1
,
1
,
handle_setvol
},
...
...
src/decoder/ffmpeg_decoder_plugin.c
View file @
99949c8f
...
...
@@ -432,6 +432,11 @@ ffmpeg_decode(struct decoder *decoder, struct input_stream *input)
decoder_initialized
(
decoder
,
&
audio_format
,
input
->
seekable
,
total_time
);
AVDictionaryEntry
*
entry
=
av_dict_get
(
format_context
->
metadata
,
"replaygain_track_gain"
,
NULL
,
0
);
if
(
entry
!=
NULL
)
g_printerr
(
"replaygain_track_gain=%s
\n
"
,
entry
->
value
);
enum
decoder_command
cmd
;
do
{
AVPacket
packet
;
...
...
src/playlist.h
View file @
99949c8f
...
...
@@ -239,6 +239,18 @@ enum playlist_result
playlist_seek_song_id
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
unsigned
id
,
float
seek_time
);
/**
* Seek within the current song. Fails if MPD is not currently
* playing.
*
* @param time the time in seconds
* @param relative if true, then the specified time is relative to the
* current position
*/
enum
playlist_result
playlist_seek_current
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
float
seek_time
,
bool
relative
);
void
playlist_increment_version_all
(
struct
playlist
*
playlist
);
...
...
src/playlist_control.c
View file @
99949c8f
...
...
@@ -262,3 +262,27 @@ playlist_seek_song_id(struct playlist *playlist, struct player_control *pc,
return
playlist_seek_song
(
playlist
,
pc
,
song
,
seek_time
);
}
enum
playlist_result
playlist_seek_current
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
float
seek_time
,
bool
relative
)
{
if
(
!
playlist
->
playing
)
return
PLAYLIST_RESULT_NOT_PLAYING
;
if
(
relative
)
{
struct
player_status
status
;
pc_get_status
(
pc
,
&
status
);
if
(
status
.
state
!=
PLAYER_STATE_PLAY
&&
status
.
state
!=
PLAYER_STATE_PAUSE
)
return
PLAYLIST_RESULT_NOT_PLAYING
;
seek_time
+=
(
int
)
status
.
elapsed_time
;
}
if
(
seek_time
<
0
)
seek_time
=
0
;
return
playlist_seek_song
(
playlist
,
pc
,
playlist
->
current
,
seek_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