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
15ff7c4c
Commit
15ff7c4c
authored
Sep 20, 2022
by
Max Kellermann
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix-oggflac-serial' of
https://github.com/anthonyde/MPD
into v0.23.x
parents
88d92ace
9ab9b97f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
NEWS
NEWS
+2
-0
FlacEncoderPlugin.cxx
src/encoder/plugins/FlacEncoderPlugin.cxx
+7
-5
No files found.
NEWS
View file @
15ff7c4c
ver 0.23.10 (not yet released)
ver 0.23.10 (not yet released)
* encoder
- flac: fix failure when libFLAC is built without Ogg support
* Windows
* Windows
- log to stdout by default, don't require "log_file" setting
- log to stdout by default, don't require "log_file" setting
...
...
src/encoder/plugins/FlacEncoderPlugin.cxx
View file @
15ff7c4c
...
@@ -38,6 +38,7 @@ class FlacEncoder final : public Encoder {
...
@@ -38,6 +38,7 @@ class FlacEncoder final : public Encoder {
FLAC__StreamEncoder
*
const
fse
;
FLAC__StreamEncoder
*
const
fse
;
const
unsigned
compression
;
const
unsigned
compression
;
const
bool
oggflac
;
PcmBuffer
expand_buffer
;
PcmBuffer
expand_buffer
;
...
@@ -122,7 +123,7 @@ flac_encoder_init(const ConfigBlock &block)
...
@@ -122,7 +123,7 @@ flac_encoder_init(const ConfigBlock &block)
}
}
static
void
static
void
flac_encoder_setup
(
FLAC__StreamEncoder
*
fse
,
unsigned
compression
,
flac_encoder_setup
(
FLAC__StreamEncoder
*
fse
,
unsigned
compression
,
bool
oggflac
,
const
AudioFormat
&
audio_format
)
const
AudioFormat
&
audio_format
)
{
{
unsigned
bits_per_sample
;
unsigned
bits_per_sample
;
...
@@ -157,7 +158,7 @@ flac_encoder_setup(FLAC__StreamEncoder *fse, unsigned compression,
...
@@ -157,7 +158,7 @@ flac_encoder_setup(FLAC__StreamEncoder *fse, unsigned compression,
throw
FormatRuntimeError
(
"error setting flac sample rate to %d"
,
throw
FormatRuntimeError
(
"error setting flac sample rate to %d"
,
audio_format
.
sample_rate
);
audio_format
.
sample_rate
);
if
(
!
FLAC__stream_encoder_set_ogg_serial_number
(
fse
,
if
(
oggflac
&&
!
FLAC__stream_encoder_set_ogg_serial_number
(
fse
,
GenerateSerial
()))
GenerateSerial
()))
throw
FormatRuntimeError
(
"error setting ogg serial number"
);
throw
FormatRuntimeError
(
"error setting ogg serial number"
);
}
}
...
@@ -166,11 +167,12 @@ FlacEncoder::FlacEncoder(AudioFormat _audio_format, FLAC__StreamEncoder *_fse, u
...
@@ -166,11 +167,12 @@ FlacEncoder::FlacEncoder(AudioFormat _audio_format, FLAC__StreamEncoder *_fse, u
:
Encoder
(
_oggchaining
),
:
Encoder
(
_oggchaining
),
audio_format
(
_audio_format
),
fse
(
_fse
),
audio_format
(
_audio_format
),
fse
(
_fse
),
compression
(
_compression
),
compression
(
_compression
),
oggflac
(
_oggflac
),
output_buffer
(
8192
)
output_buffer
(
8192
)
{
{
/* this immediately outputs data through callback */
/* this immediately outputs data through callback */
auto
init_status
=
_
oggflac
?
auto
init_status
=
oggflac
?
FLAC__stream_encoder_init_ogg_stream
(
fse
,
FLAC__stream_encoder_init_ogg_stream
(
fse
,
nullptr
,
WriteCallback
,
nullptr
,
WriteCallback
,
nullptr
,
nullptr
,
nullptr
,
nullptr
,
nullptr
,
nullptr
,
...
@@ -209,7 +211,7 @@ PreparedFlacEncoder::Open(AudioFormat &audio_format)
...
@@ -209,7 +211,7 @@ PreparedFlacEncoder::Open(AudioFormat &audio_format)
throw
std
::
runtime_error
(
"FLAC__stream_encoder_new() failed"
);
throw
std
::
runtime_error
(
"FLAC__stream_encoder_new() failed"
);
try
{
try
{
flac_encoder_setup
(
fse
,
compression
,
audio_format
);
flac_encoder_setup
(
fse
,
compression
,
oggflac
,
audio_format
);
}
catch
(...)
{
}
catch
(...)
{
FLAC__stream_encoder_delete
(
fse
);
FLAC__stream_encoder_delete
(
fse
);
throw
;
throw
;
...
@@ -222,7 +224,7 @@ void
...
@@ -222,7 +224,7 @@ void
FlacEncoder
::
SendTag
(
const
Tag
&
tag
)
FlacEncoder
::
SendTag
(
const
Tag
&
tag
)
{
{
/* re-initialize encoder since flac_encoder_finish resets everything */
/* re-initialize encoder since flac_encoder_finish resets everything */
flac_encoder_setup
(
fse
,
compression
,
audio_format
);
flac_encoder_setup
(
fse
,
compression
,
oggflac
,
audio_format
);
FLAC__StreamMetadata
*
metadata
=
FLAC__metadata_object_new
(
FLAC__METADATA_TYPE_VORBIS_COMMENT
);
FLAC__StreamMetadata
*
metadata
=
FLAC__metadata_object_new
(
FLAC__METADATA_TYPE_VORBIS_COMMENT
);
FLAC__StreamMetadata_VorbisComment_Entry
entry
;
FLAC__StreamMetadata_VorbisComment_Entry
entry
;
...
...
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