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
38d587aa
Commit
38d587aa
authored
Sep 09, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/wavpack: wavpack_open_wvc() returns InputStreamPtr
Let std::unique_ptr manage both the InputStream and the WavpackInput.
parent
fe9bafa7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
15 deletions
+7
-15
WavpackDecoderPlugin.cxx
src/decoder/plugins/WavpackDecoderPlugin.cxx
+7
-15
No files found.
src/decoder/plugins/WavpackDecoderPlugin.cxx
View file @
38d587aa
...
@@ -475,7 +475,7 @@ static WavpackStreamReader mpd_is_reader = {
...
@@ -475,7 +475,7 @@ static WavpackStreamReader mpd_is_reader = {
nullptr
/* no need to write edited tags */
nullptr
/* no need to write edited tags */
};
};
static
WavpackInput
*
static
InputStreamPtr
wavpack_open_wvc
(
Decoder
&
decoder
,
const
char
*
uri
)
wavpack_open_wvc
(
Decoder
&
decoder
,
const
char
*
uri
)
{
{
/*
/*
...
@@ -490,11 +490,7 @@ wavpack_open_wvc(Decoder &decoder, const char *uri)
...
@@ -490,11 +490,7 @@ wavpack_open_wvc(Decoder &decoder, const char *uri)
free
(
wvc_url
);
free
(
wvc_url
);
};
};
auto
is_wvc
=
decoder_open_uri
(
decoder
,
uri
,
IgnoreError
());
return
decoder_open_uri
(
decoder
,
uri
,
IgnoreError
());
if
(
is_wvc
==
nullptr
)
return
nullptr
;
return
new
WavpackInput
(
decoder
,
*
is_wvc
.
release
());
}
}
/*
/*
...
@@ -506,18 +502,14 @@ wavpack_streamdecode(Decoder &decoder, InputStream &is)
...
@@ -506,18 +502,14 @@ wavpack_streamdecode(Decoder &decoder, InputStream &is)
int
open_flags
=
OPEN_NORMALIZE
;
int
open_flags
=
OPEN_NORMALIZE
;
bool
can_seek
=
is
.
IsSeekable
();
bool
can_seek
=
is
.
IsSeekable
();
WavpackInput
*
wvc
=
wavpack_open_wvc
(
decoder
,
is
.
GetURI
());
std
::
unique_ptr
<
WavpackInput
>
wvc
;
if
(
wvc
!=
nullptr
)
{
auto
is_wvc
=
wavpack_open_wvc
(
decoder
,
is
.
GetURI
());
if
(
is_wvc
)
{
open_flags
|=
OPEN_WVC
;
open_flags
|=
OPEN_WVC
;
can_seek
&=
wvc
->
is
.
IsSeekable
();
can_seek
&=
wvc
->
is
.
IsSeekable
();
}
AtScopeExit
(
wvc
)
{
wvc
.
reset
(
new
WavpackInput
(
decoder
,
*
is_wvc
));
if
(
wvc
!=
nullptr
)
{
delete
&
wvc
->
is
;
delete
wvc
;
}
}
};
if
(
!
can_seek
)
{
if
(
!
can_seek
)
{
open_flags
|=
OPEN_STREAMING
;
open_flags
|=
OPEN_STREAMING
;
...
@@ -527,7 +519,7 @@ wavpack_streamdecode(Decoder &decoder, InputStream &is)
...
@@ -527,7 +519,7 @@ wavpack_streamdecode(Decoder &decoder, InputStream &is)
char
error
[
ERRORLEN
];
char
error
[
ERRORLEN
];
WavpackContext
*
wpc
=
WavpackContext
*
wpc
=
WavpackOpenFileInputEx
(
&
mpd_is_reader
,
&
isp
,
wvc
,
WavpackOpenFileInputEx
(
&
mpd_is_reader
,
&
isp
,
wvc
.
get
()
,
error
,
open_flags
,
23
);
error
,
open_flags
,
23
);
if
(
wpc
==
nullptr
)
{
if
(
wpc
==
nullptr
)
{
...
...
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