Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
audiowmark
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
audiowmark
Commits
cad2f6e2
Commit
cad2f6e2
authored
Dec 09, 2019
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Error object as result for SFOutputStream open().
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
b046b704
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
audiowmark.cc
src/audiowmark.cc
+3
-2
sfoutputstream.cc
src/sfoutputstream.cc
+4
-4
sfoutputstream.hh
src/sfoutputstream.hh
+1
-2
No files found.
src/audiowmark.cc
View file @
cad2f6e2
...
...
@@ -1287,9 +1287,10 @@ add_watermark (const string& infile, const string& outfile, const string& bits)
{
SFOutputStream
*
sfostream
=
new
SFOutputStream
();
out_stream
.
reset
(
sfostream
);
if
(
!
sfostream
->
open
(
outfile
,
in_stream
->
n_channels
(),
in_stream
->
sample_rate
(),
out_bit_depth
,
in_stream
->
n_frames
()))
Error
err
=
sfostream
->
open
(
outfile
,
in_stream
->
n_channels
(),
in_stream
->
sample_rate
(),
out_bit_depth
,
in_stream
->
n_frames
());
if
(
err
)
{
error
(
"audiowmark: error writing to %s
\n
"
,
outfile
.
c_str
());
// FIXME, sfostream->error_blurb
());
error
(
"audiowmark: error writing to %s
: %s
\n
"
,
outfile
.
c_str
(),
err
.
message
());
return
1
;
}
}
...
...
src/sfoutputstream.cc
View file @
cad2f6e2
...
...
@@ -12,7 +12,7 @@ SFOutputStream::~SFOutputStream()
close
();
}
bool
Error
SFOutputStream
::
open
(
const
string
&
filename
,
int
n_channels
,
int
sample_rate
,
int
bit_depth
,
size_t
n_frames
)
{
assert
(
m_state
==
State
::
NEW
);
...
...
@@ -39,14 +39,14 @@ SFOutputStream::open (const string& filename, int n_channels, int sample_rate, i
int
error
=
sf_error
(
m_sndfile
);
if
(
error
)
{
m_error_blurb
=
sf_strerror
(
m_sndfile
);
string
msg
=
sf_strerror
(
m_sndfile
);
if
(
m_sndfile
)
sf_close
(
m_sndfile
);
return
false
;
return
Error
(
msg
)
;
}
m_state
=
State
::
OPEN
;
return
true
;
return
Error
::
Code
::
NONE
;
}
void
...
...
src/sfoutputstream.hh
View file @
cad2f6e2
...
...
@@ -10,7 +10,6 @@
class
SFOutputStream
:
public
AudioOutputStream
{
SNDFILE
*
m_sndfile
=
nullptr
;
std
::
string
m_error_blurb
;
int
m_bit_depth
=
0
;
int
m_sample_rate
=
0
;
int
m_n_channels
=
0
;
...
...
@@ -25,7 +24,7 @@ class SFOutputStream : public AudioOutputStream
public
:
~
SFOutputStream
();
bool
open
(
const
std
::
string
&
filename
,
int
n_channels
,
int
sample_rate
,
int
bit_depth
,
size_t
n_frames
);
Error
open
(
const
std
::
string
&
filename
,
int
n_channels
,
int
sample_rate
,
int
bit_depth
,
size_t
n_frames
);
Error
write_frames
(
const
std
::
vector
<
float
>&
frames
)
override
;
void
close
();
int
bit_depth
()
const
override
;
...
...
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