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
df1c5ce3
Commit
df1c5ce3
authored
Apr 23, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcm_export: add _frame_size()
Move code from the ALSA output plugin.
parent
a0e4b6e2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
3 deletions
+30
-3
alsa_output_plugin.c
src/output/alsa_output_plugin.c
+1
-3
pcm_export.c
src/pcm_export.c
+21
-0
pcm_export.h
src/pcm_export.h
+8
-0
No files found.
src/output/alsa_output_plugin.c
View file @
df1c5ce3
...
...
@@ -674,9 +674,7 @@ alsa_open(struct audio_output *ao, struct audio_format *audio_format, GError **e
}
ad
->
in_frame_size
=
audio_format_frame_size
(
audio_format
);
ad
->
out_frame_size
=
ad
->
export
.
pack24
?
(
size_t
)(
audio_format
->
channels
*
3
)
:
ad
->
in_frame_size
;
ad
->
out_frame_size
=
pcm_export_frame_size
(
&
ad
->
export
,
audio_format
);
return
true
;
}
...
...
src/pcm_export.c
View file @
df1c5ce3
...
...
@@ -70,6 +70,27 @@ pcm_export_open(struct pcm_export_state *state,
}
}
size_t
pcm_export_frame_size
(
const
struct
pcm_export_state
*
state
,
const
struct
audio_format
*
audio_format
)
{
assert
(
state
!=
NULL
);
assert
(
audio_format
!=
NULL
);
if
(
state
->
pack24
)
/* packed 24 bit samples (3 bytes per sample) */
return
audio_format
->
channels
*
3
;
if
(
state
->
dsd_usb
)
/* the DSD-over-USB draft says that DSD 1-bit samples
are enclosed within 24 bit samples, and MPD's
representation of 24 bit is padded to 32 bit (4
bytes per sample) */
return
audio_format
->
channels
*
4
;
return
audio_format_frame_size
(
audio_format
);
}
const
void
*
pcm_export
(
struct
pcm_export_state
*
state
,
const
void
*
data
,
size_t
size
,
size_t
*
dest_size_r
)
...
...
src/pcm_export.h
View file @
df1c5ce3
...
...
@@ -115,6 +115,14 @@ pcm_export_open(struct pcm_export_state *state,
bool
dsd_usb
,
bool
shift8
,
bool
pack
,
bool
reverse_endian
);
/**
* Calculate the size of one output frame.
*/
G_GNUC_PURE
size_t
pcm_export_frame_size
(
const
struct
pcm_export_state
*
state
,
const
struct
audio_format
*
audio_format
);
/**
* Export a PCM buffer.
*
* @param state an initialized and open pcm_export_state object
...
...
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