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
981bc858
Commit
981bc858
authored
Nov 10, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/shout: relax quality and bitrate checks, forward as-is
parent
015527d8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
41 deletions
+8
-41
ShoutOutputPlugin.cxx
src/output/plugins/ShoutOutputPlugin.cxx
+8
-41
No files found.
src/output/plugins/ShoutOutputPlugin.cxx
View file @
981bc858
...
...
@@ -117,34 +117,6 @@ ShoutOutput::ShoutOutput(const ConfigBlock &block)
const
char
*
user
=
block
.
GetBlockValue
(
"user"
,
"source"
);
float
quality
=
-
2.0
;
int
bitrate
=
-
1
;
const
char
*
value
=
block
.
GetBlockValue
(
"quality"
);
if
(
value
!=
nullptr
)
{
char
*
test
;
quality
=
strtod
(
value
,
&
test
);
if
(
*
test
!=
'\0'
||
quality
<
-
1.0
||
quality
>
10.0
)
throw
FormatRuntimeError
(
"shout quality
\"
%s
\"
is not a number in the "
"range -1 to 10"
,
value
);
if
(
block
.
GetBlockValue
(
"bitrate"
)
!=
nullptr
)
throw
std
::
runtime_error
(
"quality and bitrate are "
"both defined"
);
}
else
{
value
=
block
.
GetBlockValue
(
"bitrate"
);
if
(
value
==
nullptr
)
throw
std
::
runtime_error
(
"neither bitrate nor quality defined"
);
char
*
test
;
bitrate
=
strtol
(
value
,
&
test
,
10
);
if
(
*
test
!=
'\0'
||
bitrate
<=
0
)
throw
std
::
runtime_error
(
"bitrate must be a positive integer"
);
}
const
char
*
const
mime_type
=
prepared_encoder
->
GetMimeType
();
unsigned
shout_format
;
...
...
@@ -154,7 +126,7 @@ ShoutOutput::ShoutOutput(const ConfigBlock &block)
shout_format
=
SHOUT_FORMAT_OGG
;
unsigned
protocol
;
value
=
block
.
GetBlockValue
(
"protocol"
);
const
char
*
value
=
block
.
GetBlockValue
(
"protocol"
);
if
(
value
!=
nullptr
)
{
if
(
0
==
strcmp
(
value
,
"shoutcast"
)
&&
!
StringIsEqual
(
mime_type
,
"audio/mpeg"
))
...
...
@@ -202,18 +174,13 @@ ShoutOutput::ShoutOutput(const ConfigBlock &block)
if
(
value
!=
nullptr
&&
shout_set_url
(
shout_conn
,
value
))
throw
std
::
runtime_error
(
shout_get_error
(
shout_conn
));
{
char
temp
[
11
];
if
(
quality
>=
-
1.0
)
{
snprintf
(
temp
,
sizeof
(
temp
),
"%2.2f"
,
quality
);
shout_set_audio_info
(
shout_conn
,
SHOUT_AI_QUALITY
,
temp
);
}
else
{
snprintf
(
temp
,
sizeof
(
temp
),
"%d"
,
bitrate
);
shout_set_audio_info
(
shout_conn
,
SHOUT_AI_BITRATE
,
temp
);
}
}
value
=
block
.
GetBlockValue
(
"quality"
);
if
(
value
!=
nullptr
)
shout_set_audio_info
(
shout_conn
,
SHOUT_AI_QUALITY
,
value
);
value
=
block
.
GetBlockValue
(
"bitrate"
);
if
(
value
!=
nullptr
)
shout_set_audio_info
(
shout_conn
,
SHOUT_AI_BITRATE
,
value
);
}
ShoutOutput
::~
ShoutOutput
()
...
...
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