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
c2e4fe98
Commit
c2e4fe98
authored
Aug 09, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Song: add function song_equals()
decoder_is_current_song() now recognizes different instances of the same physical song.
parent
81e89837
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
1 deletion
+37
-1
Song.cxx
src/Song.cxx
+27
-0
decoder_control.c
src/decoder_control.c
+2
-1
song.h
src/song.h
+8
-0
No files found.
src/Song.cxx
View file @
c2e4fe98
...
...
@@ -84,6 +84,33 @@ song_free(struct song *song)
g_free
(
song
);
}
gcc_pure
static
inline
bool
directory_equals
(
const
struct
directory
&
a
,
const
struct
directory
&
b
)
{
return
strcmp
(
a
.
path
,
b
.
path
)
==
0
;
}
gcc_pure
static
inline
bool
directory_is_same
(
const
struct
directory
*
a
,
const
struct
directory
*
b
)
{
return
a
==
b
||
(
a
!=
nullptr
&&
b
!=
nullptr
&&
directory_equals
(
*
a
,
*
b
));
}
bool
song_equals
(
const
struct
song
*
a
,
const
struct
song
*
b
)
{
assert
(
a
!=
nullptr
);
assert
(
b
!=
nullptr
);
return
directory_is_same
(
a
->
parent
,
b
->
parent
)
&&
strcmp
(
a
->
uri
,
b
->
uri
)
==
0
;
}
char
*
song_get_uri
(
const
struct
song
*
song
)
{
...
...
src/decoder_control.c
View file @
c2e4fe98
...
...
@@ -20,6 +20,7 @@
#include "config.h"
#include "decoder_control.h"
#include "pipe.h"
#include "song.h"
#include <assert.h>
...
...
@@ -111,7 +112,7 @@ decoder_is_current_song(const struct decoder_control *dc,
case
DECODE_STATE_START
:
case
DECODE_STATE_DECODE
:
return
dc
->
song
==
song
;
return
song_equals
(
dc
->
song
,
song
)
;
}
assert
(
false
);
...
...
src/song.h
View file @
c2e4fe98
...
...
@@ -21,6 +21,7 @@
#define MPD_SONG_H
#include "util/list.h"
#include "gcc.h"
#include <stddef.h>
#include <stdbool.h>
...
...
@@ -100,6 +101,13 @@ song_is_file(const struct song *song)
return
song_in_database
(
song
)
||
song
->
uri
[
0
]
==
'/'
;
}
/**
* Returns true if both objects refer to the same physical song.
*/
gcc_pure
bool
song_equals
(
const
struct
song
*
a
,
const
struct
song
*
b
);
bool
song_file_update
(
struct
song
*
song
);
...
...
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