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
7c2b5533
Commit
7c2b5533
authored
Aug 05, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playlist/EmbbeddedCue: convert to class
parent
409fc837
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
27 deletions
+41
-27
EmbeddedCuePlaylistPlugin.cxx
src/playlist/EmbeddedCuePlaylistPlugin.cxx
+41
-27
No files found.
src/playlist/EmbeddedCuePlaylistPlugin.cxx
View file @
7c2b5533
...
...
@@ -41,7 +41,7 @@
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "cue"
struct
embcue_p
laylist
{
struct
EmbeddedCueP
laylist
{
struct
playlist_provider
base
;
/**
...
...
@@ -62,12 +62,25 @@ struct embcue_playlist {
char
*
next
;
CueParser
*
parser
;
EmbeddedCuePlaylist
()
:
filename
(
nullptr
),
cuesheet
(
nullptr
),
parser
(
nullptr
)
{
playlist_provider_init
(
&
base
,
&
embcue_playlist_plugin
);
}
~
EmbeddedCuePlaylist
()
{
delete
parser
;
g_free
(
cuesheet
);
g_free
(
filename
);
}
Song
*
Read
();
};
static
void
embcue_tag_pair
(
const
char
*
name
,
const
char
*
value
,
void
*
ctx
)
{
struct
embcue_playlist
*
playlist
=
(
struct
embcue_p
laylist
*
)
ctx
;
EmbeddedCuePlaylist
*
playlist
=
(
EmbeddedCueP
laylist
*
)
ctx
;
if
(
playlist
->
cuesheet
==
NULL
&&
g_ascii_strcasecmp
(
name
,
"cuesheet"
)
==
0
)
...
...
@@ -89,9 +102,7 @@ embcue_playlist_open_uri(const char *uri,
/* only local files supported */
return
NULL
;
struct
embcue_playlist
*
playlist
=
g_new
(
struct
embcue_playlist
,
1
);
playlist_provider_init
(
&
playlist
->
base
,
&
embcue_playlist_plugin
);
playlist
->
cuesheet
=
NULL
;
const
auto
playlist
=
new
EmbeddedCuePlaylist
();
tag_file_scan
(
uri
,
&
embcue_tag_handler
,
playlist
);
if
(
playlist
->
cuesheet
==
NULL
)
{
...
...
@@ -102,7 +113,7 @@ embcue_playlist_open_uri(const char *uri,
if
(
playlist
->
cuesheet
==
NULL
)
{
/* no "CUESHEET" tag found */
g_free
(
playlist
)
;
delete
playlist
;
return
NULL
;
}
...
...
@@ -117,48 +128,51 @@ embcue_playlist_open_uri(const char *uri,
static
void
embcue_playlist_close
(
struct
playlist_provider
*
_playlist
)
{
struct
embcue_playlist
*
playlist
=
(
struct
embcue_p
laylist
*
)
_playlist
;
EmbeddedCuePlaylist
*
playlist
=
(
EmbeddedCueP
laylist
*
)
_playlist
;
delete
playlist
->
parser
;
g_free
(
playlist
->
cuesheet
);
g_free
(
playlist
->
filename
);
g_free
(
playlist
);
delete
playlist
;
}
static
Song
*
embcue_playlist_read
(
struct
playlist_provider
*
_playlist
)
inline
Song
*
EmbeddedCuePlaylist
::
Read
(
)
{
struct
embcue_playlist
*
playlist
=
(
struct
embcue_playlist
*
)
_playlist
;
Song
*
song
=
playlist
->
parser
->
Get
();
Song
*
song
=
parser
->
Get
();
if
(
song
!=
NULL
)
return
song
;
while
(
*
playlist
->
next
!=
0
)
{
const
char
*
line
=
playlist
->
next
;
char
*
eol
=
strpbrk
(
playlist
->
next
,
"
\r\n
"
);
while
(
*
next
!=
0
)
{
const
char
*
line
=
next
;
char
*
eol
=
strpbrk
(
next
,
"
\r\n
"
);
if
(
eol
!=
NULL
)
{
/* null-terminate the line */
*
eol
=
0
;
playlist
->
next
=
eol
+
1
;
next
=
eol
+
1
;
}
else
/* last line; put the "next" pointer to the
end of the buffer */
playlist
->
next
+=
strlen
(
line
);
next
+=
strlen
(
line
);
p
laylist
->
p
arser
->
Feed
(
line
);
song
=
p
laylist
->
p
arser
->
Get
();
parser
->
Feed
(
line
);
song
=
parser
->
Get
();
if
(
song
!=
NULL
)
return
song
->
ReplaceURI
(
playlist
->
filename
);
return
song
->
ReplaceURI
(
filename
);
}
p
laylist
->
p
arser
->
Finish
();
song
=
p
laylist
->
p
arser
->
Get
();
parser
->
Finish
();
song
=
parser
->
Get
();
if
(
song
!=
NULL
)
song
=
song
->
ReplaceURI
(
playlist
->
filename
);
song
=
song
->
ReplaceURI
(
filename
);
return
song
;
}
static
Song
*
embcue_playlist_read
(
struct
playlist_provider
*
_playlist
)
{
EmbeddedCuePlaylist
*
playlist
=
(
EmbeddedCuePlaylist
*
)
_playlist
;
return
playlist
->
Read
();
}
static
const
char
*
const
embcue_playlist_suffixes
[]
=
{
/* a few codecs that are known to be supported; there are
probably many more */
...
...
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