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
8964c69a
Commit
8964c69a
authored
Nov 02, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
music_pipe: renamed struct output_buffer to struct music_pipe
.. and rename ob_chunk to struct music_chunk.
parent
767b4c95
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
19 deletions
+24
-19
crossfade.c
src/crossfade.c
+2
-1
crossfade.h
src/crossfade.h
+2
-3
pipe.c
src/pipe.c
+8
-6
pipe.h
src/pipe.h
+7
-6
player_thread.c
src/player_thread.c
+5
-3
No files found.
src/crossfade.c
View file @
8964c69a
...
...
@@ -20,6 +20,7 @@
#include "crossfade.h"
#include "audio.h"
#include "pcm_utils.h"
#include "pipe.h"
#include <assert.h>
#include <string.h>
...
...
@@ -48,7 +49,7 @@ unsigned cross_fade_calc(float duration, float total_time,
return
chunks
;
}
void
cross_fade_apply
(
ob_chunk
*
a
,
const
ob_chunk
*
b
,
void
cross_fade_apply
(
struct
music_chunk
*
a
,
const
struct
music_chunk
*
b
,
const
struct
audio_format
*
format
,
unsigned
int
current_chunk
,
unsigned
int
num_chunks
)
{
...
...
src/crossfade.h
View file @
8964c69a
...
...
@@ -20,15 +20,14 @@
#ifndef MPD_CROSSFADE_H
#define MPD_CROSSFADE_H
#include "pipe.h"
struct
audio_format
;
struct
music_chunk
;
unsigned
cross_fade_calc
(
float
duration
,
float
total_time
,
const
struct
audio_format
*
af
,
unsigned
max_chunks
);
void
cross_fade_apply
(
ob_chunk
*
a
,
const
ob_chunk
*
b
,
void
cross_fade_apply
(
struct
music_chunk
*
a
,
const
struct
music_chunk
*
b
,
const
struct
audio_format
*
format
,
unsigned
int
current_chunk
,
unsigned
int
num_chunks
);
...
...
src/pipe.c
View file @
8964c69a
...
...
@@ -23,7 +23,7 @@
#include <assert.h>
#include <string.h>
struct
output_buffer
ob
;
struct
music_pipe
ob
;
void
ob_init
(
unsigned
int
size
,
struct
notify
*
notify
)
...
...
@@ -82,7 +82,7 @@ static void output_buffer_expand(unsigned i)
void
ob_flush
(
void
)
{
ob
_chunk
*
chunk
=
ob_get_chunk
(
ob
.
end
);
struct
music
_chunk
*
chunk
=
ob_get_chunk
(
ob
.
end
);
if
(
chunk
->
chunkSize
>
0
)
{
unsigned
int
next
=
successor
(
ob
.
end
);
...
...
@@ -139,7 +139,8 @@ int ob_absolute(const unsigned relative)
return
(
int
)
i
;
}
ob_chunk
*
ob_get_chunk
(
const
unsigned
i
)
struct
music_chunk
*
ob_get_chunk
(
const
unsigned
i
)
{
assert
(
i
<
ob
.
size
);
...
...
@@ -152,11 +153,12 @@ ob_chunk * ob_get_chunk(const unsigned i)
* @return the chunk which has room for more data; NULL if there is no
* room.
*/
static
ob_chunk
*
tail_chunk
(
float
data_time
,
uint16_t
bitRate
)
static
struct
music_chunk
*
tail_chunk
(
float
data_time
,
uint16_t
bitRate
)
{
const
size_t
frame_size
=
audio_format_frame_size
(
&
ob
.
audioFormat
);
unsigned
int
next
;
ob
_chunk
*
chunk
;
struct
music
_chunk
*
chunk
;
chunk
=
ob_get_chunk
(
ob
.
end
);
assert
(
chunk
->
chunkSize
<=
sizeof
(
chunk
->
data
));
...
...
@@ -189,7 +191,7 @@ size_t ob_append(const void *data0, size_t datalen,
const
unsigned
char
*
data
=
data0
;
const
size_t
frame_size
=
audio_format_frame_size
(
&
ob
.
audioFormat
);
size_t
ret
=
0
,
dataToSend
;
ob
_chunk
*
chunk
=
NULL
;
struct
music
_chunk
*
chunk
=
NULL
;
/* no partial frames allowed */
assert
((
datalen
%
frame_size
)
==
0
);
...
...
src/pipe.h
View file @
8964c69a
...
...
@@ -27,19 +27,19 @@
/* pick 1020 since its devisible for 8,16,24, and 32-bit audio */
#define CHUNK_SIZE 1020
typedef
struct
_OutputBufferC
hunk
{
struct
music_c
hunk
{
uint16_t
chunkSize
;
uint16_t
bitRate
;
float
times
;
char
data
[
CHUNK_SIZE
];
}
ob_chunk
;
};
/**
* A ring set of buffers where the decoder appends data after the end,
* and the player consumes data from the beginning.
*/
struct
output_buffer
{
ob
_chunk
*
chunks
;
struct
music_pipe
{
struct
music
_chunk
*
chunks
;
unsigned
int
size
;
...
...
@@ -58,7 +58,7 @@ struct output_buffer {
struct
notify
*
notify
;
};
extern
struct
output_buffer
ob
;
extern
struct
music_pipe
ob
;
void
ob_init
(
unsigned
int
size
,
struct
notify
*
notify
);
...
...
@@ -100,7 +100,8 @@ unsigned ob_available(void);
*/
int
ob_absolute
(
const
unsigned
relative
);
ob_chunk
*
ob_get_chunk
(
const
unsigned
i
);
struct
music_chunk
*
ob_get_chunk
(
const
unsigned
i
);
/**
* Append a data block to the buffer.
...
...
src/player_thread.c
View file @
8964c69a
...
...
@@ -26,6 +26,7 @@
#include "main_notify.h"
#include "crossfade.h"
#include "song.h"
#include "pipe.h"
enum
xfade_state
{
XFADE_DISABLED
=
-
1
,
...
...
@@ -205,8 +206,9 @@ static void processDecodeInput(struct player *player)
}
}
static
int
playChunk
(
ob_chunk
*
chunk
,
const
struct
audio_format
*
format
,
double
sizeToTime
)
static
int
playChunk
(
struct
music_chunk
*
chunk
,
const
struct
audio_format
*
format
,
double
sizeToTime
)
{
pc
.
elapsedTime
=
chunk
->
times
;
pc
.
bitRate
=
chunk
->
bitRate
;
...
...
@@ -355,7 +357,7 @@ static void do_play(void)
notify_wait
(
&
pc
.
notify
);
else
if
(
!
ob_is_empty
()
&&
(
int
)
ob
.
begin
!=
player
.
next_song_chunk
)
{
ob
_chunk
*
beginChunk
=
ob_get_chunk
(
ob
.
begin
);
struct
music
_chunk
*
beginChunk
=
ob_get_chunk
(
ob
.
begin
);
unsigned
int
fadePosition
;
if
(
player
.
xfade
==
XFADE_ENABLED
&&
player
.
next_song_chunk
>=
0
&&
...
...
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