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
b77e6226
Commit
b77e6226
authored
Jan 10, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder_control: replace dc_init() with dc_new()
dc_new() allocates the object and returns it. dc_free() frees it (replaces dc_deinit()).
parent
b6995ca0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
15 deletions
+17
-15
decoder_control.c
src/decoder_control.c
+8
-6
decoder_control.h
src/decoder_control.h
+4
-3
player_thread.c
src/player_thread.c
+5
-6
No files found.
src/decoder_control.c
View file @
b77e6226
...
...
@@ -27,9 +27,11 @@
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "decoder_control"
void
dc_
init
(
struct
decoder_control
*
dc
,
struct
player_control
*
pc
)
struct
decoder_control
*
dc_
new
(
struct
player_control
*
pc
)
{
struct
decoder_control
*
dc
=
g_new
(
struct
decoder_control
,
1
);
dc
->
player_control
=
pc
;
dc
->
thread
=
NULL
;
...
...
@@ -44,19 +46,19 @@ dc_init(struct decoder_control *dc, struct player_control *pc)
dc
->
mixramp_start
=
NULL
;
dc
->
mixramp_end
=
NULL
;
dc
->
mixramp_prev_end
=
NULL
;
return
dc
;
}
void
dc_
deinit
(
struct
decoder_control
*
dc
)
dc_
free
(
struct
decoder_control
*
dc
)
{
g_cond_free
(
dc
->
cond
);
g_mutex_free
(
dc
->
mutex
);
g_free
(
dc
->
mixramp_start
);
g_free
(
dc
->
mixramp_end
);
g_free
(
dc
->
mixramp_prev_end
);
dc
->
mixramp_start
=
NULL
;
dc
->
mixramp_end
=
NULL
;
dc
->
mixramp_prev_end
=
NULL
;
g_free
(
dc
);
}
static
void
...
...
src/decoder_control.h
View file @
b77e6226
...
...
@@ -105,11 +105,12 @@ struct decoder_control {
char
*
mixramp_prev_end
;
};
void
dc_init
(
struct
decoder_control
*
dc
,
struct
player_control
*
pc
);
G_GNUC_MALLOC
struct
decoder_control
*
dc_new
(
struct
player_control
*
pc
);
void
dc_
deinit
(
struct
decoder_control
*
dc
);
dc_
free
(
struct
decoder_control
*
dc
);
/**
* Locks the #decoder_control object.
...
...
src/player_thread.c
View file @
b77e6226
...
...
@@ -1023,10 +1023,9 @@ static gpointer
player_task
(
gpointer
arg
)
{
struct
player_control
*
pc
=
arg
;
struct
decoder_control
dc
;
dc_init
(
&
dc
,
pc
);
decoder_thread_start
(
&
dc
);
struct
decoder_control
*
dc
=
dc_new
(
pc
);
decoder_thread_start
(
dc
);
player_buffer
=
music_buffer_new
(
pc
->
buffer_chunks
);
...
...
@@ -1037,7 +1036,7 @@ player_task(gpointer arg)
case
PLAYER_COMMAND_QUEUE
:
assert
(
pc
->
next_song
!=
NULL
);
do_play
(
pc
,
&
dc
);
do_play
(
pc
,
dc
);
break
;
case
PLAYER_COMMAND_STOP
:
...
...
@@ -1081,8 +1080,8 @@ player_task(gpointer arg)
case
PLAYER_COMMAND_EXIT
:
player_unlock
(
pc
);
dc_quit
(
&
dc
);
dc_
deinit
(
&
dc
);
dc_quit
(
dc
);
dc_
free
(
dc
);
audio_output_all_close
();
music_buffer_free
(
player_buffer
);
...
...
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