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
77de2331
Commit
77de2331
authored
Feb 07, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Playlist{Any,Registry,Mapper}: move functions to PlaylistStream.cxx
parent
02b67eda
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
145 additions
and
86 deletions
+145
-86
Makefile.am
Makefile.am
+1
-0
PlaylistAny.cxx
src/playlist/PlaylistAny.cxx
+1
-34
PlaylistMapper.cxx
src/playlist/PlaylistMapper.cxx
+1
-10
PlaylistRegistry.cxx
src/playlist/PlaylistRegistry.cxx
+1
-31
PlaylistRegistry.hxx
src/playlist/PlaylistRegistry.hxx
+3
-11
PlaylistStream.cxx
src/playlist/PlaylistStream.cxx
+93
-0
PlaylistStream.hxx
src/playlist/PlaylistStream.hxx
+45
-0
No files found.
Makefile.am
View file @
77de2331
...
@@ -153,6 +153,7 @@ src_mpd_SOURCES = \
...
@@ -153,6 +153,7 @@ src_mpd_SOURCES = \
src/PlaylistTag.cxx
\
src/PlaylistTag.cxx
\
src/PlaylistPrint.cxx src/PlaylistPrint.hxx
\
src/PlaylistPrint.cxx src/PlaylistPrint.hxx
\
src/PlaylistSave.cxx src/PlaylistSave.hxx
\
src/PlaylistSave.cxx src/PlaylistSave.hxx
\
src/playlist/PlaylistStream.cxx src/playlist/PlaylistStream.hxx
\
src/playlist/PlaylistMapper.cxx src/playlist/PlaylistMapper.hxx
\
src/playlist/PlaylistMapper.cxx src/playlist/PlaylistMapper.hxx
\
src/playlist/PlaylistAny.cxx src/playlist/PlaylistAny.hxx
\
src/playlist/PlaylistAny.cxx src/playlist/PlaylistAny.hxx
\
src/playlist/PlaylistSong.cxx src/playlist/PlaylistSong.hxx
\
src/playlist/PlaylistSong.cxx src/playlist/PlaylistSong.hxx
\
...
...
src/playlist/PlaylistAny.cxx
View file @
77de2331
...
@@ -19,42 +19,9 @@
...
@@ -19,42 +19,9 @@
#include "config.h"
#include "config.h"
#include "PlaylistAny.hxx"
#include "PlaylistAny.hxx"
#include "PlaylistStream.hxx"
#include "PlaylistMapper.hxx"
#include "PlaylistMapper.hxx"
#include "PlaylistRegistry.hxx"
#include "CloseSongEnumerator.hxx"
#include "util/UriUtil.hxx"
#include "util/UriUtil.hxx"
#include "util/Error.hxx"
#include "input/InputStream.hxx"
#include "Log.hxx"
#include <assert.h>
static
SongEnumerator
*
playlist_open_remote
(
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
)
{
assert
(
uri_has_scheme
(
uri
));
SongEnumerator
*
playlist
=
playlist_list_open_uri
(
uri
,
mutex
,
cond
);
if
(
playlist
!=
nullptr
)
return
playlist
;
Error
error
;
InputStream
*
is
=
InputStream
::
OpenReady
(
uri
,
mutex
,
cond
,
error
);
if
(
is
==
nullptr
)
{
if
(
error
.
IsDefined
())
FormatError
(
error
,
"Failed to open %s"
,
uri
);
return
nullptr
;
}
playlist
=
playlist_list_open_stream
(
*
is
,
uri
);
if
(
playlist
==
nullptr
)
{
is
->
Close
();
return
nullptr
;
}
return
new
CloseSongEnumerator
(
playlist
,
is
);
}
SongEnumerator
*
SongEnumerator
*
playlist_open_any
(
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
)
playlist_open_any
(
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
)
...
...
src/playlist/PlaylistMapper.cxx
View file @
77de2331
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include "config.h"
#include "config.h"
#include "PlaylistMapper.hxx"
#include "PlaylistMapper.hxx"
#include "PlaylistFile.hxx"
#include "PlaylistFile.hxx"
#include "PlaylistStream.hxx"
#include "PlaylistRegistry.hxx"
#include "PlaylistRegistry.hxx"
#include "Mapper.hxx"
#include "Mapper.hxx"
#include "fs/AllocatedPath.hxx"
#include "fs/AllocatedPath.hxx"
...
@@ -27,16 +28,6 @@
...
@@ -27,16 +28,6 @@
#include <assert.h>
#include <assert.h>
static
SongEnumerator
*
playlist_open_path
(
const
char
*
path_fs
,
Mutex
&
mutex
,
Cond
&
cond
)
{
auto
playlist
=
playlist_list_open_uri
(
path_fs
,
mutex
,
cond
);
if
(
playlist
==
nullptr
)
playlist
=
playlist_list_open_path
(
path_fs
,
mutex
,
cond
);
return
playlist
;
}
/**
/**
* Load a playlist from the configured playlist directory.
* Load a playlist from the configured playlist directory.
*/
*/
...
...
src/playlist/PlaylistRegistry.cxx
View file @
77de2331
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
#include "config.h"
#include "config.h"
#include "PlaylistRegistry.hxx"
#include "PlaylistRegistry.hxx"
#include "PlaylistPlugin.hxx"
#include "PlaylistPlugin.hxx"
#include "CloseSongEnumerator.hxx"
#include "plugins/ExtM3uPlaylistPlugin.hxx"
#include "plugins/ExtM3uPlaylistPlugin.hxx"
#include "plugins/M3uPlaylistPlugin.hxx"
#include "plugins/M3uPlaylistPlugin.hxx"
#include "plugins/XspfPlaylistPlugin.hxx"
#include "plugins/XspfPlaylistPlugin.hxx"
...
@@ -221,7 +220,7 @@ playlist_list_open_stream_mime(InputStream &is, const char *full_mime)
...
@@ -221,7 +220,7 @@ playlist_list_open_stream_mime(InputStream &is, const char *full_mime)
return
playlist_list_open_stream_mime2
(
is
,
mime
.
c_str
());
return
playlist_list_open_stream_mime2
(
is
,
mime
.
c_str
());
}
}
static
SongEnumerator
*
SongEnumerator
*
playlist_list_open_stream_suffix
(
InputStream
&
is
,
const
char
*
suffix
)
playlist_list_open_stream_suffix
(
InputStream
&
is
,
const
char
*
suffix
)
{
{
assert
(
suffix
!=
nullptr
);
assert
(
suffix
!=
nullptr
);
...
@@ -278,32 +277,3 @@ playlist_suffix_supported(const char *suffix)
...
@@ -278,32 +277,3 @@ playlist_suffix_supported(const char *suffix)
return
false
;
return
false
;
}
}
SongEnumerator
*
playlist_list_open_path
(
const
char
*
path_fs
,
Mutex
&
mutex
,
Cond
&
cond
)
{
const
char
*
suffix
;
assert
(
path_fs
!=
nullptr
);
suffix
=
uri_get_suffix
(
path_fs
);
if
(
suffix
==
nullptr
||
!
playlist_suffix_supported
(
suffix
))
return
nullptr
;
Error
error
;
InputStream
*
is
=
InputStream
::
OpenReady
(
path_fs
,
mutex
,
cond
,
error
);
if
(
is
==
nullptr
)
{
if
(
error
.
IsDefined
())
LogError
(
error
);
return
nullptr
;
}
auto
playlist
=
playlist_list_open_stream_suffix
(
*
is
,
suffix
);
if
(
playlist
!=
nullptr
)
playlist
=
new
CloseSongEnumerator
(
playlist
,
is
);
else
is
->
Close
();
return
playlist
;
}
src/playlist/PlaylistRegistry.hxx
View file @
77de2331
...
@@ -51,6 +51,9 @@ playlist_list_global_finish(void);
...
@@ -51,6 +51,9 @@ playlist_list_global_finish(void);
SongEnumerator
*
SongEnumerator
*
playlist_list_open_uri
(
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
);
playlist_list_open_uri
(
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
);
SongEnumerator
*
playlist_list_open_stream_suffix
(
InputStream
&
is
,
const
char
*
suffix
);
/**
/**
* Opens a playlist from an input stream.
* Opens a playlist from an input stream.
*
*
...
@@ -68,15 +71,4 @@ playlist_list_open_stream(InputStream &is, const char *uri);
...
@@ -68,15 +71,4 @@ playlist_list_open_stream(InputStream &is, const char *uri);
bool
bool
playlist_suffix_supported
(
const
char
*
suffix
);
playlist_suffix_supported
(
const
char
*
suffix
);
/**
* Opens a playlist from a local file.
*
* @param path_fs the path of the playlist file
* @param is_r on success, an input_stream object is returned here,
* which must be closed after the playlist_provider object is freed
* @return a playlist, or nullptr on error
*/
SongEnumerator
*
playlist_list_open_path
(
const
char
*
path_fs
,
Mutex
&
mutex
,
Cond
&
cond
);
#endif
#endif
src/playlist/PlaylistStream.cxx
0 → 100644
View file @
77de2331
/*
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "PlaylistStream.hxx"
#include "PlaylistRegistry.hxx"
#include "CloseSongEnumerator.hxx"
#include "util/UriUtil.hxx"
#include "util/Error.hxx"
#include "input/InputStream.hxx"
#include "Log.hxx"
#include <assert.h>
static
SongEnumerator
*
playlist_open_path_suffix
(
const
char
*
path_fs
,
Mutex
&
mutex
,
Cond
&
cond
)
{
assert
(
path_fs
!=
nullptr
);
const
char
*
suffix
=
uri_get_suffix
(
path_fs
);
if
(
suffix
==
nullptr
||
!
playlist_suffix_supported
(
suffix
))
return
nullptr
;
Error
error
;
InputStream
*
is
=
InputStream
::
OpenReady
(
path_fs
,
mutex
,
cond
,
error
);
if
(
is
==
nullptr
)
{
if
(
error
.
IsDefined
())
LogError
(
error
);
return
nullptr
;
}
auto
playlist
=
playlist_list_open_stream_suffix
(
*
is
,
suffix
);
if
(
playlist
!=
nullptr
)
playlist
=
new
CloseSongEnumerator
(
playlist
,
is
);
else
is
->
Close
();
return
playlist
;
}
SongEnumerator
*
playlist_open_path
(
const
char
*
path_fs
,
Mutex
&
mutex
,
Cond
&
cond
)
{
auto
playlist
=
playlist_list_open_uri
(
path_fs
,
mutex
,
cond
);
if
(
playlist
==
nullptr
)
playlist
=
playlist_open_path_suffix
(
path_fs
,
mutex
,
cond
);
return
playlist
;
}
SongEnumerator
*
playlist_open_remote
(
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
)
{
assert
(
uri_has_scheme
(
uri
));
SongEnumerator
*
playlist
=
playlist_list_open_uri
(
uri
,
mutex
,
cond
);
if
(
playlist
!=
nullptr
)
return
playlist
;
Error
error
;
InputStream
*
is
=
InputStream
::
OpenReady
(
uri
,
mutex
,
cond
,
error
);
if
(
is
==
nullptr
)
{
if
(
error
.
IsDefined
())
FormatError
(
error
,
"Failed to open %s"
,
uri
);
return
nullptr
;
}
playlist
=
playlist_list_open_stream
(
*
is
,
uri
);
if
(
playlist
==
nullptr
)
{
is
->
Close
();
return
nullptr
;
}
return
new
CloseSongEnumerator
(
playlist
,
is
);
}
src/playlist/PlaylistStream.hxx
0 → 100644
View file @
77de2331
/*
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_PLAYLIST_STREAM_HXX
#define MPD_PLAYLIST_STREAM_HXX
#include "Compiler.h"
class
Mutex
;
class
Cond
;
class
SongEnumerator
;
/**
* Opens a playlist from a local file.
*
* @param path_fs the path of the playlist file
* @param is_r on success, an input_stream object is returned here,
* which must be closed after the playlist_provider object is freed
* @return a playlist, or nullptr on error
*/
gcc_nonnull_all
SongEnumerator
*
playlist_open_path
(
const
char
*
path_fs
,
Mutex
&
mutex
,
Cond
&
cond
);
gcc_nonnull_all
SongEnumerator
*
playlist_open_remote
(
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
);
#endif
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