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
e565cd44
Commit
e565cd44
authored
Jan 28, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/despotify: add constructor/destructor
parent
5934ccbb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
26 deletions
+33
-26
DespotifyInputPlugin.cxx
src/input/DespotifyInputPlugin.cxx
+33
-26
No files found.
src/input/DespotifyInputPlugin.cxx
View file @
e565cd44
...
@@ -46,6 +46,31 @@ struct DespotifyInputStream {
...
@@ -46,6 +46,31 @@ struct DespotifyInputStream {
struct
ds_pcm_data
pcm
;
struct
ds_pcm_data
pcm
;
size_t
len_available
;
size_t
len_available
;
bool
eof
;
bool
eof
;
DespotifyInputStream
(
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
,
despotify_session
*
_session
,
ds_track
*
_track
)
:
session
(
_session
),
track
(
_track
),
tag
(
mpd_despotify_tag_from_track
(
track
)),
len_available
(
0
),
eof
(
false
)
{
input_stream_init
(
&
base
,
&
input_plugin_despotify
,
uri
,
mutex
,
cond
);
memset
(
&
pcm
,
0
,
sizeof
(
pcm
));
/* Despotify outputs pcm data */
base
.
mime
=
g_strdup
(
"audio/x-mpd-cdda-pcm"
);
base
.
ready
=
true
;
}
~
DespotifyInputStream
()
{
if
(
tag
!=
NULL
)
tag_free
(
tag
);
despotify_free_track
(
track
);
input_stream_deinit
(
&
base
);
}
};
};
static
void
static
void
...
@@ -104,7 +129,6 @@ input_despotify_open(const char *url,
...
@@ -104,7 +129,6 @@ input_despotify_open(const char *url,
Mutex
&
mutex
,
Cond
&
cond
,
Mutex
&
mutex
,
Cond
&
cond
,
G_GNUC_UNUSED
GError
**
error_r
)
G_GNUC_UNUSED
GError
**
error_r
)
{
{
DespotifyInputStream
*
ctx
;
struct
despotify_session
*
session
;
struct
despotify_session
*
session
;
struct
ds_link
*
ds_link
;
struct
ds_link
*
ds_link
;
struct
ds_track
*
track
;
struct
ds_track
*
track
;
...
@@ -126,35 +150,23 @@ input_despotify_open(const char *url,
...
@@ -126,35 +150,23 @@ input_despotify_open(const char *url,
return
NULL
;
return
NULL
;
}
}
ctx
=
g_new
(
DespotifyInputStream
,
1
);
memset
(
ctx
,
0
,
sizeof
(
*
ctx
));
track
=
despotify_link_get_track
(
session
,
ds_link
);
track
=
despotify_link_get_track
(
session
,
ds_link
);
despotify_free_link
(
ds_link
);
despotify_free_link
(
ds_link
);
if
(
!
track
)
{
if
(
!
track
)
g_free
(
ctx
);
return
NULL
;
return
NULL
;
}
input_stream_init
(
&
ctx
->
base
,
&
input_plugin_despotify
,
url
,
DespotifyInputStream
*
ctx
=
mutex
,
cond
);
new
DespotifyInputStream
(
url
,
mutex
,
cond
,
ctx
->
session
=
session
;
session
,
track
);
ctx
->
track
=
track
;
ctx
->
tag
=
mpd_despotify_tag_from_track
(
track
);
ctx
->
eof
=
false
;
/* Despotify outputs pcm data */
ctx
->
base
.
mime
=
g_strdup
(
"audio/x-mpd-cdda-pcm"
);
ctx
->
base
.
ready
=
true
;
if
(
!
mpd_despotify_register_callback
(
callback
,
ctx
))
{
if
(
!
mpd_despotify_register_callback
(
callback
,
ctx
))
{
despotify_free_link
(
ds_link
);
delete
ctx
;
return
NULL
;
return
NULL
;
}
}
if
(
despotify_play
(
ctx
->
session
,
ctx
->
track
,
false
)
==
false
)
{
if
(
despotify_play
(
ctx
->
session
,
ctx
->
track
,
false
)
==
false
)
{
despotify_free_track
(
ctx
->
tr
ack
);
mpd_despotify_unregister_callback
(
callb
ack
);
g_free
(
ctx
)
;
delete
ctx
;
return
NULL
;
return
NULL
;
}
}
...
@@ -186,13 +198,8 @@ input_despotify_close(struct input_stream *is)
...
@@ -186,13 +198,8 @@ input_despotify_close(struct input_stream *is)
{
{
DespotifyInputStream
*
ctx
=
(
DespotifyInputStream
*
)
is
;
DespotifyInputStream
*
ctx
=
(
DespotifyInputStream
*
)
is
;
if
(
ctx
->
tag
!=
NULL
)
tag_free
(
ctx
->
tag
);
mpd_despotify_unregister_callback
(
callback
);
mpd_despotify_unregister_callback
(
callback
);
despotify_free_track
(
ctx
->
track
);
delete
ctx
;
input_stream_deinit
(
&
ctx
->
base
);
g_free
(
ctx
);
}
}
static
bool
static
bool
...
...
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