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
8d40e68d
Commit
8d40e68d
authored
5 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test/run_convert: add option --verbose
parent
de0affe1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
2 deletions
+22
-2
run_convert.cxx
test/run_convert.cxx
+22
-2
No files found.
test/run_convert.cxx
View file @
8d40e68d
...
@@ -28,8 +28,11 @@
...
@@ -28,8 +28,11 @@
#include "pcm/Convert.hxx"
#include "pcm/Convert.hxx"
#include "util/ConstBuffer.hxx"
#include "util/ConstBuffer.hxx"
#include "util/StaticFifoBuffer.hxx"
#include "util/StaticFifoBuffer.hxx"
#include "util/OptionDef.hxx"
#include "util/OptionParser.hxx"
#include "util/OptionParser.hxx"
#include "util/PrintException.hxx"
#include "util/PrintException.hxx"
#include "Log.hxx"
#include "LogBackend.hxx"
#include <stdexcept>
#include <stdexcept>
...
@@ -41,6 +44,16 @@
...
@@ -41,6 +44,16 @@
struct
CommandLine
{
struct
CommandLine
{
AudioFormat
in_audio_format
,
out_audio_format
;
AudioFormat
in_audio_format
,
out_audio_format
;
bool
verbose
=
false
;
};
enum
Option
{
OPTION_VERBOSE
,
};
static
constexpr
OptionDef
option_defs
[]
=
{
{
"verbose"
,
'v'
,
false
,
"Verbose logging"
},
};
};
static
CommandLine
static
CommandLine
...
@@ -48,8 +61,13 @@ ParseCommandLine(int argc, char **argv)
...
@@ -48,8 +61,13 @@ ParseCommandLine(int argc, char **argv)
{
{
CommandLine
c
;
CommandLine
c
;
OptionParser
option_parser
(
nullptr
,
argc
,
argv
);
OptionParser
option_parser
(
option_defs
,
argc
,
argv
);
while
(
option_parser
.
Next
())
{
while
(
auto
o
=
option_parser
.
Next
())
{
switch
(
Option
(
o
.
index
))
{
case
OPTION_VERBOSE
:
c
.
verbose
=
true
;
break
;
}
}
}
auto
args
=
option_parser
.
GetRemaining
();
auto
args
=
option_parser
.
GetRemaining
();
...
@@ -66,6 +84,8 @@ main(int argc, char **argv)
...
@@ -66,6 +84,8 @@ main(int argc, char **argv)
try
{
try
{
const
auto
c
=
ParseCommandLine
(
argc
,
argv
);
const
auto
c
=
ParseCommandLine
(
argc
,
argv
);
SetLogThreshold
(
c
.
verbose
?
LogLevel
::
DEBUG
:
LogLevel
::
INFO
);
const
size_t
in_frame_size
=
c
.
in_audio_format
.
GetFrameSize
();
const
size_t
in_frame_size
=
c
.
in_audio_format
.
GetFrameSize
();
PcmConvert
state
(
c
.
in_audio_format
,
c
.
out_audio_format
);
PcmConvert
state
(
c
.
in_audio_format
,
c
.
out_audio_format
);
...
...
This diff is collapsed.
Click to expand it.
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