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
c17be5af
Commit
c17be5af
authored
May 04, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test/run_encoder: use std::unique_ptr
parent
b376536a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
run_encoder.cxx
test/run_encoder.cxx
+4
-5
test_vorbis_encoder.cxx
test/test_vorbis_encoder.cxx
+6
-5
No files found.
test/run_encoder.cxx
View file @
c17be5af
...
...
@@ -29,6 +29,8 @@
#include "util/Error.hxx"
#include "Log.hxx"
#include <memory>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
...
...
@@ -65,7 +67,7 @@ int main(int argc, char **argv)
try
{
Error
error
;
const
auto
p_encoder
=
encoder_init
(
*
plugin
,
block
,
error
);
std
::
unique_ptr
<
PreparedEncoder
>
p_encoder
(
encoder_init
(
*
plugin
,
block
,
error
)
);
if
(
p_encoder
==
nullptr
)
{
LogError
(
error
,
"Failed to initialize encoder"
);
return
EXIT_FAILURE
;
...
...
@@ -81,7 +83,7 @@ int main(int argc, char **argv)
}
}
auto
*
encoder
=
p_encoder
->
Open
(
audio_format
,
error
);
std
::
unique_ptr
<
Encoder
>
encoder
(
p_encoder
->
Open
(
audio_format
,
error
)
);
if
(
encoder
==
nullptr
)
{
LogError
(
error
,
"Failed to open encoder"
);
return
EXIT_FAILURE
;
...
...
@@ -110,9 +112,6 @@ int main(int argc, char **argv)
EncoderToOutputStream
(
os
,
*
encoder
);
delete
encoder
;
delete
p_encoder
;
return
EXIT_SUCCESS
;
}
catch
(
const
std
::
exception
&
e
)
{
LogError
(
e
);
...
...
test/test_vorbis_encoder.cxx
View file @
c17be5af
...
...
@@ -30,6 +30,8 @@
#include "util/Error.hxx"
#include "Log.hxx"
#include <memory>
#include <stddef.h>
#include <unistd.h>
...
...
@@ -48,14 +50,16 @@ main(gcc_unused int argc, gcc_unused char **argv)
ConfigBlock
block
;
block
.
AddBlockParam
(
"quality"
,
"5.0"
,
-
1
);
const
auto
p_encoder
=
encoder_init
(
*
plugin
,
block
,
IgnoreError
());
std
::
unique_ptr
<
PreparedEncoder
>
p_encoder
(
encoder_init
(
*
plugin
,
block
,
IgnoreError
()));
assert
(
p_encoder
!=
nullptr
);
try
{
/* open the encoder */
AudioFormat
audio_format
(
44100
,
SampleFormat
::
S16
,
2
);
auto
encoder
=
p_encoder
->
Open
(
audio_format
,
IgnoreError
());
std
::
unique_ptr
<
Encoder
>
encoder
(
p_encoder
->
Open
(
audio_format
,
IgnoreError
()));
assert
(
encoder
!=
nullptr
);
StdioOutputStream
os
(
stdout
);
...
...
@@ -102,9 +106,6 @@ main(gcc_unused int argc, gcc_unused char **argv)
EncoderToOutputStream
(
os
,
*
encoder
);
delete
encoder
;
delete
p_encoder
;
return
EXIT_SUCCESS
;
}
catch
(
const
std
::
exception
&
e
)
{
LogError
(
e
);
...
...
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