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
be9212ba
Commit
be9212ba
authored
Sep 09, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
audio: moved cmpAudioFormat() to audio_format.h
Rename it to audio_format_equals() and return "true" if they are equal.
parent
7f1cccb3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
22 deletions
+14
-22
audio.c
src/audio.c
+2
-15
audio.h
src/audio.h
+0
-2
audio_format.h
src/audio_format.h
+8
-0
decoder_api.c
src/decoder_api.c
+1
-1
output_control.c
src/output_control.c
+3
-4
No files found.
src/audio.c
View file @
be9212ba
...
@@ -66,14 +66,6 @@ static unsigned int audio_output_count(void)
...
@@ -66,14 +66,6 @@ static unsigned int audio_output_count(void)
return
nr
;
return
nr
;
}
}
int
cmpAudioFormat
(
const
struct
audio_format
*
f1
,
const
struct
audio_format
*
f2
)
{
if
(
f1
&&
f2
&&
(
f1
->
sampleRate
==
f2
->
sampleRate
)
&&
(
f1
->
bits
==
f2
->
bits
)
&&
(
f1
->
channels
==
f2
->
channels
))
return
0
;
return
1
;
}
/* make sure initPlayerData is called before this function!! */
/* make sure initPlayerData is called before this function!! */
void
initAudioDriver
(
void
)
void
initAudioDriver
(
void
)
{
{
...
@@ -230,13 +222,8 @@ void finishAudioDriver(void)
...
@@ -230,13 +222,8 @@ void finishAudioDriver(void)
int
isCurrentAudioFormat
(
const
struct
audio_format
*
audioFormat
)
int
isCurrentAudioFormat
(
const
struct
audio_format
*
audioFormat
)
{
{
if
(
!
audioFormat
)
return
audioFormat
==
NULL
||
return
1
;
audio_format_equals
(
audioFormat
,
&
audio_format
);
if
(
cmpAudioFormat
(
audioFormat
,
&
audio_format
)
!=
0
)
return
0
;
return
1
;
}
}
static
void
syncAudioDeviceStates
(
void
)
static
void
syncAudioDeviceStates
(
void
)
...
...
src/audio.h
View file @
be9212ba
...
@@ -27,8 +27,6 @@ struct audio_format;
...
@@ -27,8 +27,6 @@ struct audio_format;
struct
tag
;
struct
tag
;
struct
client
;
struct
client
;
int
cmpAudioFormat
(
const
struct
audio_format
*
dest
,
const
struct
audio_format
*
src
);
void
getOutputAudioFormat
(
const
struct
audio_format
*
inFormat
,
void
getOutputAudioFormat
(
const
struct
audio_format
*
inFormat
,
struct
audio_format
*
outFormat
);
struct
audio_format
*
outFormat
);
...
...
src/audio_format.h
View file @
be9212ba
...
@@ -27,6 +27,14 @@ struct audio_format {
...
@@ -27,6 +27,14 @@ struct audio_format {
mpd_sint8
channels
;
mpd_sint8
channels
;
};
};
static
inline
int
audio_format_equals
(
const
struct
audio_format
*
a
,
const
struct
audio_format
*
b
)
{
return
a
->
sampleRate
==
b
->
sampleRate
&&
a
->
bits
==
b
->
bits
&&
a
->
channels
==
b
->
channels
;
}
static
inline
double
audio_format_time_to_size
(
const
struct
audio_format
*
af
)
static
inline
double
audio_format_time_to_size
(
const
struct
audio_format
*
af
)
{
{
return
af
->
sampleRate
*
af
->
bits
*
af
->
channels
/
8
.
0
;
return
af
->
sampleRate
*
af
->
bits
*
af
->
channels
/
8
.
0
;
...
...
src/decoder_api.c
View file @
be9212ba
...
@@ -162,7 +162,7 @@ decoder_data(struct decoder *decoder, InputStream * inStream, int seekable,
...
@@ -162,7 +162,7 @@ decoder_data(struct decoder *decoder, InputStream * inStream, int seekable,
static
size_t
convBufferLen
;
static
size_t
convBufferLen
;
int
ret
;
int
ret
;
if
(
cmpAudioFormat
(
&
(
ob
.
audioFormat
),
&
(
dc
.
audioFormat
))
==
0
)
{
if
(
audio_format_equals
(
&
ob
.
audioFormat
,
&
dc
.
audioFormat
)
)
{
data
=
dataIn
;
data
=
dataIn
;
datalen
=
dataInLen
;
datalen
=
dataInLen
;
}
else
{
}
else
{
...
...
src/output_control.c
View file @
be9212ba
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
#include "output_api.h"
#include "output_api.h"
#include "pcm_utils.h"
#include "pcm_utils.h"
#include "utils.h"
#include "utils.h"
#include "audio.h"
int
audio_output_open
(
struct
audio_output
*
audioOutput
,
int
audio_output_open
(
struct
audio_output
*
audioOutput
,
const
struct
audio_format
*
audioFormat
)
const
struct
audio_format
*
audioFormat
)
...
@@ -28,7 +27,7 @@ int audio_output_open(struct audio_output *audioOutput,
...
@@ -28,7 +27,7 @@ int audio_output_open(struct audio_output *audioOutput,
int
ret
=
0
;
int
ret
=
0
;
if
(
audioOutput
->
open
&&
if
(
audioOutput
->
open
&&
0
==
cmpAudioFormat
(
audioFormat
,
&
audioOutput
->
inAudioFormat
))
{
audio_format_equals
(
audioFormat
,
&
audioOutput
->
inAudioFormat
))
{
return
0
;
return
0
;
}
}
...
@@ -46,8 +45,8 @@ int audio_output_open(struct audio_output *audioOutput,
...
@@ -46,8 +45,8 @@ int audio_output_open(struct audio_output *audioOutput,
ret
=
audioOutput
->
plugin
->
open
(
audioOutput
);
ret
=
audioOutput
->
plugin
->
open
(
audioOutput
);
audioOutput
->
sameInAndOutFormats
=
audioOutput
->
sameInAndOutFormats
=
!
cmpAudioFormat
(
&
audioOutput
->
inAudioFormat
,
audio_format_equals
(
&
audioOutput
->
inAudioFormat
,
&
audioOutput
->
outAudioFormat
);
&
audioOutput
->
outAudioFormat
);
return
ret
;
return
ret
;
}
}
...
...
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