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
863badd9
Commit
863badd9
authored
Nov 03, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder: no CamelCase
Renamed variables and functions.
parent
b3dfcfef
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
31 deletions
+31
-31
decoder_api.c
src/decoder_api.c
+4
-4
decoder_control.c
src/decoder_control.c
+3
-3
decoder_control.h
src/decoder_control.h
+3
-3
decoder_thread.c
src/decoder_thread.c
+19
-19
player_thread.c
src/player_thread.c
+2
-2
No files found.
src/decoder_api.c
View file @
863badd9
...
@@ -43,7 +43,7 @@ void decoder_initialized(struct decoder * decoder,
...
@@ -43,7 +43,7 @@ void decoder_initialized(struct decoder * decoder,
getOutputAudioFormat
(
audio_format
,
&
dc
.
out_audio_format
);
getOutputAudioFormat
(
audio_format
,
&
dc
.
out_audio_format
);
dc
.
seekable
=
seekable
;
dc
.
seekable
=
seekable
;
dc
.
total
T
ime
=
total_time
;
dc
.
total
_t
ime
=
total_time
;
dc
.
state
=
DECODE_STATE_DECODE
;
dc
.
state
=
DECODE_STATE_DECODE
;
notify_signal
(
&
pc
.
notify
);
notify_signal
(
&
pc
.
notify
);
...
@@ -63,7 +63,7 @@ void decoder_command_finished(mpd_unused struct decoder * decoder)
...
@@ -63,7 +63,7 @@ void decoder_command_finished(mpd_unused struct decoder * decoder)
{
{
assert
(
dc
.
command
!=
DECODE_COMMAND_NONE
);
assert
(
dc
.
command
!=
DECODE_COMMAND_NONE
);
assert
(
dc
.
command
!=
DECODE_COMMAND_SEEK
||
assert
(
dc
.
command
!=
DECODE_COMMAND_SEEK
||
dc
.
seek
E
rror
||
decoder
->
seeking
);
dc
.
seek
_e
rror
||
decoder
->
seeking
);
if
(
dc
.
command
==
DECODE_COMMAND_SEEK
)
if
(
dc
.
command
==
DECODE_COMMAND_SEEK
)
/* delete frames from the old song position */
/* delete frames from the old song position */
...
@@ -79,14 +79,14 @@ double decoder_seek_where(mpd_unused struct decoder * decoder)
...
@@ -79,14 +79,14 @@ double decoder_seek_where(mpd_unused struct decoder * decoder)
decoder
->
seeking
=
true
;
decoder
->
seeking
=
true
;
return
dc
.
seek
W
here
;
return
dc
.
seek
_w
here
;
}
}
void
decoder_seek_error
(
struct
decoder
*
decoder
)
void
decoder_seek_error
(
struct
decoder
*
decoder
)
{
{
assert
(
dc
.
command
==
DECODE_COMMAND_SEEK
);
assert
(
dc
.
command
==
DECODE_COMMAND_SEEK
);
dc
.
seek
E
rror
=
true
;
dc
.
seek
_e
rror
=
true
;
decoder_command_finished
(
decoder
);
decoder_command_finished
(
decoder
);
}
}
...
...
src/decoder_control.c
View file @
863badd9
...
@@ -93,11 +93,11 @@ dc_seek(struct notify *notify, double where)
...
@@ -93,11 +93,11 @@ dc_seek(struct notify *notify, double where)
if
(
dc
.
state
==
DECODE_STATE_STOP
||
!
dc
.
seekable
)
if
(
dc
.
state
==
DECODE_STATE_STOP
||
!
dc
.
seekable
)
return
false
;
return
false
;
dc
.
seek
W
here
=
where
;
dc
.
seek
_w
here
=
where
;
dc
.
seek
E
rror
=
false
;
dc
.
seek
_e
rror
=
false
;
dc_command
(
notify
,
DECODE_COMMAND_SEEK
);
dc_command
(
notify
,
DECODE_COMMAND_SEEK
);
if
(
dc
.
seek
E
rror
)
if
(
dc
.
seek
_e
rror
)
return
false
;
return
false
;
return
true
;
return
true
;
...
...
src/decoder_control.h
View file @
863badd9
...
@@ -44,9 +44,9 @@ struct decoder_control {
...
@@ -44,9 +44,9 @@ struct decoder_control {
volatile
enum
decoder_state
state
;
volatile
enum
decoder_state
state
;
volatile
enum
decoder_command
command
;
volatile
enum
decoder_command
command
;
volatile
uint16_t
error
;
volatile
uint16_t
error
;
bool
seek
E
rror
;
bool
seek
_e
rror
;
bool
seekable
;
bool
seekable
;
volatile
double
seek
W
here
;
volatile
double
seek
_w
here
;
/** the format of the song file */
/** the format of the song file */
struct
audio_format
in_audio_format
;
struct
audio_format
in_audio_format
;
...
@@ -56,7 +56,7 @@ struct decoder_control {
...
@@ -56,7 +56,7 @@ struct decoder_control {
struct
song
*
current_song
;
struct
song
*
current_song
;
struct
song
*
volatile
next_song
;
struct
song
*
volatile
next_song
;
volatile
float
total
T
ime
;
volatile
float
total
_t
ime
;
};
};
extern
struct
decoder_control
dc
;
extern
struct
decoder_control
dc
;
...
...
src/decoder_thread.c
View file @
863badd9
...
@@ -45,7 +45,7 @@ decoder_try_decode(const struct decoder_plugin *plugin,
...
@@ -45,7 +45,7 @@ decoder_try_decode(const struct decoder_plugin *plugin,
return
ret
;
return
ret
;
}
}
static
void
decode
Start
(
void
)
static
void
decode
r_run
(
void
)
{
{
struct
song
*
song
=
dc
.
next_song
;
struct
song
*
song
=
dc
.
next_song
;
char
buffer
[
MPD_PATH_MAX
];
char
buffer
[
MPD_PATH_MAX
];
...
@@ -53,7 +53,7 @@ static void decodeStart(void)
...
@@ -53,7 +53,7 @@ static void decodeStart(void)
struct
decoder
decoder
;
struct
decoder
decoder
;
int
ret
;
int
ret
;
bool
close_instream
=
true
;
bool
close_instream
=
true
;
struct
input_stream
in
S
tream
;
struct
input_stream
in
put_s
tream
;
const
struct
decoder_plugin
*
plugin
;
const
struct
decoder_plugin
*
plugin
;
if
(
song_is_file
(
song
))
if
(
song_is_file
(
song
))
...
@@ -66,7 +66,7 @@ static void decodeStart(void)
...
@@ -66,7 +66,7 @@ static void decodeStart(void)
}
}
dc
.
current_song
=
dc
.
next_song
;
/* NEED LOCK */
dc
.
current_song
=
dc
.
next_song
;
/* NEED LOCK */
if
(
!
input_stream_open
(
&
in
S
tream
,
uri
))
{
if
(
!
input_stream_open
(
&
in
put_s
tream
,
uri
))
{
dc
.
error
=
DECODE_ERROR_FILE
;
dc
.
error
=
DECODE_ERROR_FILE
;
return
;
return
;
}
}
...
@@ -81,21 +81,21 @@ static void decodeStart(void)
...
@@ -81,21 +81,21 @@ static void decodeStart(void)
/* wait for the input stream to become ready; its metadata
/* wait for the input stream to become ready; its metadata
will be available then */
will be available then */
while
(
!
in
S
tream
.
ready
)
{
while
(
!
in
put_s
tream
.
ready
)
{
if
(
dc
.
command
!=
DECODE_COMMAND_NONE
)
{
if
(
dc
.
command
!=
DECODE_COMMAND_NONE
)
{
input_stream_close
(
&
in
S
tream
);
input_stream_close
(
&
in
put_s
tream
);
return
;
return
;
}
}
ret
=
input_stream_buffer
(
&
in
S
tream
);
ret
=
input_stream_buffer
(
&
in
put_s
tream
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
input_stream_close
(
&
in
S
tream
);
input_stream_close
(
&
in
put_s
tream
);
return
;
return
;
}
}
}
}
if
(
dc
.
command
==
DECODE_COMMAND_STOP
)
{
if
(
dc
.
command
==
DECODE_COMMAND_STOP
)
{
input_stream_close
(
&
in
S
tream
);
input_stream_close
(
&
in
put_s
tream
);
return
;
return
;
}
}
...
@@ -104,14 +104,14 @@ static void decodeStart(void)
...
@@ -104,14 +104,14 @@ static void decodeStart(void)
unsigned
int
next
=
0
;
unsigned
int
next
=
0
;
/* first we try mime types: */
/* first we try mime types: */
while
((
plugin
=
decoder_plugin_from_mime_type
(
in
S
tream
.
mime
,
next
++
)))
{
while
((
plugin
=
decoder_plugin_from_mime_type
(
in
put_s
tream
.
mime
,
next
++
)))
{
if
(
plugin
->
stream_decode
==
NULL
)
if
(
plugin
->
stream_decode
==
NULL
)
continue
;
continue
;
if
(
!
(
plugin
->
stream_types
&
INPUT_PLUGIN_STREAM_URL
))
if
(
!
(
plugin
->
stream_types
&
INPUT_PLUGIN_STREAM_URL
))
continue
;
continue
;
if
(
!
decoder_try_decode
(
plugin
,
&
in
S
tream
))
if
(
!
decoder_try_decode
(
plugin
,
&
in
put_s
tream
))
continue
;
continue
;
ret
=
plugin
->
stream_decode
(
&
decoder
,
&
in
S
tream
);
ret
=
plugin
->
stream_decode
(
&
decoder
,
&
in
put_s
tream
);
break
;
break
;
}
}
...
@@ -125,11 +125,11 @@ static void decodeStart(void)
...
@@ -125,11 +125,11 @@ static void decodeStart(void)
if
(
!
(
plugin
->
stream_types
&
if
(
!
(
plugin
->
stream_types
&
INPUT_PLUGIN_STREAM_URL
))
INPUT_PLUGIN_STREAM_URL
))
continue
;
continue
;
if
(
!
decoder_try_decode
(
plugin
,
&
in
S
tream
))
if
(
!
decoder_try_decode
(
plugin
,
&
in
put_s
tream
))
continue
;
continue
;
decoder
.
plugin
=
plugin
;
decoder
.
plugin
=
plugin
;
ret
=
plugin
->
stream_decode
(
&
decoder
,
ret
=
plugin
->
stream_decode
(
&
decoder
,
&
in
S
tream
);
&
in
put_s
tream
);
break
;
break
;
}
}
}
}
...
@@ -142,7 +142,7 @@ static void decodeStart(void)
...
@@ -142,7 +142,7 @@ static void decodeStart(void)
if
((
plugin
=
decoder_plugin_from_name
(
"mp3"
)))
{
if
((
plugin
=
decoder_plugin_from_name
(
"mp3"
)))
{
decoder
.
plugin
=
plugin
;
decoder
.
plugin
=
plugin
;
ret
=
plugin
->
stream_decode
(
&
decoder
,
ret
=
plugin
->
stream_decode
(
&
decoder
,
&
in
S
tream
);
&
in
put_s
tream
);
}
}
}
}
}
else
{
}
else
{
...
@@ -152,11 +152,11 @@ static void decodeStart(void)
...
@@ -152,11 +152,11 @@ static void decodeStart(void)
if
(
!
plugin
->
stream_types
&
INPUT_PLUGIN_STREAM_FILE
)
if
(
!
plugin
->
stream_types
&
INPUT_PLUGIN_STREAM_FILE
)
continue
;
continue
;
if
(
!
decoder_try_decode
(
plugin
,
&
in
S
tream
))
if
(
!
decoder_try_decode
(
plugin
,
&
in
put_s
tream
))
continue
;
continue
;
if
(
plugin
->
file_decode
!=
NULL
)
{
if
(
plugin
->
file_decode
!=
NULL
)
{
input_stream_close
(
&
in
S
tream
);
input_stream_close
(
&
in
put_s
tream
);
close_instream
=
false
;
close_instream
=
false
;
decoder
.
plugin
=
plugin
;
decoder
.
plugin
=
plugin
;
ret
=
plugin
->
file_decode
(
&
decoder
,
uri
);
ret
=
plugin
->
file_decode
(
&
decoder
,
uri
);
...
@@ -164,7 +164,7 @@ static void decodeStart(void)
...
@@ -164,7 +164,7 @@ static void decodeStart(void)
}
else
if
(
plugin
->
stream_decode
!=
NULL
)
{
}
else
if
(
plugin
->
stream_decode
!=
NULL
)
{
decoder
.
plugin
=
plugin
;
decoder
.
plugin
=
plugin
;
ret
=
plugin
->
stream_decode
(
&
decoder
,
ret
=
plugin
->
stream_decode
(
&
decoder
,
&
in
S
tream
);
&
in
put_s
tream
);
break
;
break
;
}
}
}
}
...
@@ -179,7 +179,7 @@ static void decodeStart(void)
...
@@ -179,7 +179,7 @@ static void decodeStart(void)
}
}
if
(
close_instream
)
if
(
close_instream
)
input_stream_close
(
&
in
S
tream
);
input_stream_close
(
&
in
put_s
tream
);
}
}
static
void
*
decoder_task
(
mpd_unused
void
*
arg
)
static
void
*
decoder_task
(
mpd_unused
void
*
arg
)
...
@@ -190,7 +190,7 @@ static void * decoder_task(mpd_unused void *arg)
...
@@ -190,7 +190,7 @@ static void * decoder_task(mpd_unused void *arg)
switch
(
dc
.
command
)
{
switch
(
dc
.
command
)
{
case
DECODE_COMMAND_START
:
case
DECODE_COMMAND_START
:
case
DECODE_COMMAND_SEEK
:
case
DECODE_COMMAND_SEEK
:
decode
Start
();
decode
r_run
();
dc
.
state
=
DECODE_STATE_STOP
;
dc
.
state
=
DECODE_STATE_STOP
;
dc
.
command
=
DECODE_COMMAND_NONE
;
dc
.
command
=
DECODE_COMMAND_NONE
;
...
...
src/player_thread.c
View file @
863badd9
...
@@ -329,7 +329,7 @@ static void do_play(void)
...
@@ -329,7 +329,7 @@ static void do_play(void)
if
(
player
.
paused
)
if
(
player
.
paused
)
closeAudioDevice
();
closeAudioDevice
();
pc
.
totalTime
=
dc
.
total
T
ime
;
pc
.
totalTime
=
dc
.
total
_t
ime
;
pc
.
audio_format
=
dc
.
in_audio_format
;
pc
.
audio_format
=
dc
.
in_audio_format
;
play_audio_format
=
dc
.
out_audio_format
;
play_audio_format
=
dc
.
out_audio_format
;
sizeToTime
=
audioFormatSizeToTime
(
&
dc
.
out_audio_format
);
sizeToTime
=
audioFormatSizeToTime
(
&
dc
.
out_audio_format
);
...
@@ -367,7 +367,7 @@ static void do_play(void)
...
@@ -367,7 +367,7 @@ static void do_play(void)
calculate how many chunks will be required
calculate how many chunks will be required
for it */
for it */
crossFadeChunks
=
crossFadeChunks
=
cross_fade_calc
(
pc
.
crossFade
,
dc
.
total
T
ime
,
cross_fade_calc
(
pc
.
crossFade
,
dc
.
total
_t
ime
,
&
dc
.
out_audio_format
,
&
dc
.
out_audio_format
,
music_pipe_size
()
-
music_pipe_size
()
-
pc
.
buffered_before_play
);
pc
.
buffered_before_play
);
...
...
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