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
975deca8
Commit
975deca8
authored
Jan 02, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
{decoder,player}_thread: convert to C++
parent
3bbb5023
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
54 deletions
+52
-54
Makefile.am
Makefile.am
+2
-4
DecoderThread.cxx
src/DecoderThread.cxx
+11
-19
DecoderThread.hxx
src/DecoderThread.hxx
+3
-3
Main.cxx
src/Main.cxx
+1
-1
PlayerThread.cxx
src/PlayerThread.cxx
+25
-24
PlayerThread.hxx
src/PlayerThread.hxx
+3
-3
decoder_internal.h
src/decoder_internal.h
+7
-0
No files found.
Makefile.am
View file @
975deca8
...
...
@@ -72,7 +72,6 @@ mpd_headers = \
src/cmdline.h
\
src/conf.h
\
src/crossfade.h
\
src/decoder_thread.h
\
src/decoder_control.h
\
src/decoder_plugin.h
\
src/decoder_command.h
\
...
...
@@ -137,7 +136,6 @@ mpd_headers = \
src/output/httpd_internal.h
\
src/page.h
\
src/permission.h
\
src/player_thread.h
\
src/player_control.h
\
src/playlist.h
\
src/playlist_error.h
\
...
...
@@ -224,7 +222,7 @@ src_mpd_SOURCES = \
src/crossfade.c
\
src/cue/cue_parser.c src/cue/cue_parser.h
\
src/decoder_error.h
\
src/
decoder_thread.c
\
src/
DecoderThread.cxx src/DecoderThread.hxx
\
src/decoder_control.c
\
src/decoder_api.c
\
src/decoder_internal.c
\
...
...
@@ -291,7 +289,7 @@ src_mpd_SOURCES = \
src/mapper.c
\
src/page.c
\
src/permission.c
\
src/
player_thread.c
\
src/
PlayerThread.cxx src/PlayerThread.hxx
\
src/player_control.c
\
src/playlist.c
\
src/playlist_global.c
\
...
...
src/
decoder_thread.c
→
src/
DecoderThread.cxx
View file @
975deca8
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -18,22 +18,23 @@
*/
#include "config.h"
#include "
decoder_thread.h
"
#include "
DecoderThread.hxx
"
#include "decoder_error.h"
#include "decoder_plugin.h"
#include "song.h"
#include "mpd_error.h"
extern
"C"
{
#include "decoder_control.h"
#include "decoder_internal.h"
#include "decoder_list.h"
#include "decoder_plugin.h"
#include "decoder_api.h"
#include "replay_gain_ape.h"
#include "input_stream.h"
#include "pipe.h"
#include "song.h"
#include "tag.h"
#include "mapper.h"
#include "path.h"
#include "uri.h"
#include "mpd_error.h"
}
#include <glib.h>
...
...
@@ -183,12 +184,7 @@ decoder_file_decode(const struct decoder_plugin *plugin,
static
inline
gpointer
deconst_plugin
(
const
struct
decoder_plugin
*
plugin
)
{
union
{
const
struct
decoder_plugin
*
in
;
gpointer
out
;
}
u
=
{
.
in
=
plugin
};
return
u
.
out
;
return
const_cast
<
struct
decoder_plugin
*>
(
plugin
);
}
/**
...
...
@@ -384,11 +380,7 @@ static void
decoder_run_song
(
struct
decoder_control
*
dc
,
const
struct
song
*
song
,
const
char
*
uri
)
{
struct
decoder
decoder
=
{
.
dc
=
dc
,
.
initial_seek_pending
=
dc
->
start_ms
>
0
,
.
initial_seek_running
=
false
,
};
decoder
decoder
(
dc
,
dc
->
start_ms
>
0
);
int
ret
;
decoder
.
timestamp
=
0.0
;
...
...
@@ -477,7 +469,7 @@ decoder_run(struct decoder_control *dc)
static
gpointer
decoder_task
(
gpointer
arg
)
{
struct
decoder_control
*
dc
=
arg
;
struct
decoder_control
*
dc
=
(
struct
decoder_control
*
)
arg
;
decoder_lock
(
dc
);
...
...
src/
decoder_thread.h
→
src/
DecoderThread.hxx
View file @
975deca8
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_DECODER_THREAD_H
#define MPD_DECODER_THREAD_H
#ifndef MPD_DECODER_THREAD_H
XX
#define MPD_DECODER_THREAD_H
XX
struct
decoder_control
;
...
...
src/Main.cxx
View file @
975deca8
...
...
@@ -23,6 +23,7 @@
#include "UpdateGlue.hxx"
#include "chunk.h"
#include "StateFile.hxx"
#include "PlayerThread.hxx"
extern
"C"
{
#include "daemon.h"
...
...
@@ -33,7 +34,6 @@ extern "C" {
#include "AllCommands.h"
#include "playlist.h"
#include "database.h"
#include "player_thread.h"
#include "listen.h"
#include "cmdline.h"
#include "conf.h"
...
...
src/
player_thread.c
→
src/
PlayerThread.cxx
View file @
975deca8
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -18,23 +18,24 @@
*/
#include "config.h"
#include "player_thread.h"
#include "PlayerThread.hxx"
#include "DecoderThread.hxx"
#include "song.h"
#include "Main.hxx"
#include "mpd_error.h"
extern
"C"
{
#include "player_control.h"
#include "decoder_control.h"
#include "decoder_thread.h"
#include "output_all.h"
#include "pcm_volume.h"
#include "path.h"
#include "event_pipe.h"
#include "crossfade.h"
#include "song.h"
#include "tag.h"
#include "pipe.h"
#include "chunk.h"
#include "idle.h"
#include "Main.hxx"
#include "buffer.h"
#include "mpd_error.h"
}
#include <glib.h>
...
...
@@ -123,6 +124,20 @@ struct player {
* precisely.
*/
float
elapsed_time
;
player
(
player_control
*
_pc
,
decoder_control
*
_dc
)
:
pc
(
_pc
),
dc
(
_dc
),
buffering
(
false
),
decoder_starting
(
false
),
paused
(
false
),
queued
(
true
),
output_open
(
false
),
song
(
NULL
),
xfade
(
XFADE_UNKNOWN
),
cross_fading
(
false
),
cross_fade_chunks
(
0
),
cross_fade_tag
(
NULL
),
elapsed_time
(
0.0
)
{}
};
static
struct
music_buffer
*
player_buffer
;
...
...
@@ -882,21 +897,7 @@ player_song_border(struct player *player)
*/
static
void
do_play
(
struct
player_control
*
pc
,
struct
decoder_control
*
dc
)
{
struct
player
player
=
{
.
pc
=
pc
,
.
dc
=
dc
,
.
buffering
=
true
,
.
decoder_starting
=
false
,
.
paused
=
false
,
.
queued
=
true
,
.
output_open
=
false
,
.
song
=
NULL
,
.
xfade
=
XFADE_UNKNOWN
,
.
cross_fading
=
false
,
.
cross_fade_chunks
=
0
,
.
cross_fade_tag
=
NULL
,
.
elapsed_time
=
0
.
0
,
};
player
player
(
pc
,
dc
);
player_unlock
(
pc
);
...
...
@@ -1094,7 +1095,7 @@ static void do_play(struct player_control *pc, struct decoder_control *dc)
static
gpointer
player_task
(
gpointer
arg
)
{
struct
player_control
*
pc
=
arg
;
struct
player_control
*
pc
=
(
struct
player_control
*
)
arg
;
struct
decoder_control
*
dc
=
dc_new
(
pc
->
cond
);
decoder_thread_start
(
dc
);
...
...
src/
player_thread.h
→
src/
PlayerThread.hxx
View file @
975deca8
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -34,8 +34,8 @@
* #music_chunk instances around in #music_pipe objects.
*/
#ifndef MPD_PLAYER_THREAD_H
#define MPD_PLAYER_THREAD_H
#ifndef MPD_PLAYER_THREAD_H
XX
#define MPD_PLAYER_THREAD_H
XX
struct
player_control
;
...
...
src/decoder_internal.h
View file @
975deca8
...
...
@@ -80,6 +80,13 @@ struct decoder {
* has changed since the last check.
*/
unsigned
replay_gain_serial
;
#ifdef __cplusplus
decoder
(
decoder_control
*
_dc
,
bool
_initial_seek_pending
)
:
dc
(
_dc
),
initial_seek_pending
(
_initial_seek_pending
),
initial_seek_running
(
false
)
{}
#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