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
36c9e959
Commit
36c9e959
authored
May 22, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/vorbis: add VorbisInputStream constructor
parent
a3142ee4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
14 deletions
+13
-14
VorbisDecoderPlugin.cxx
src/decoder/plugins/VorbisDecoderPlugin.cxx
+13
-14
No files found.
src/decoder/plugins/VorbisDecoderPlugin.cxx
View file @
36c9e959
...
@@ -49,10 +49,14 @@
...
@@ -49,10 +49,14 @@
#include <errno.h>
#include <errno.h>
struct
VorbisInputStream
{
struct
VorbisInputStream
{
Decoder
*
decoder
;
Decoder
*
const
decoder
;
InputStream
*
input_stream
;
InputStream
*
const
input_stream
;
bool
seekable
;
bool
seekable
;
VorbisInputStream
(
Decoder
*
_decoder
,
InputStream
&
_is
)
:
decoder
(
_decoder
),
input_stream
(
&
_is
),
seekable
(
input_stream
->
CheapSeeking
())
{}
};
};
static
size_t
ogg_read_cb
(
void
*
ptr
,
size_t
size
,
size_t
nmemb
,
void
*
data
)
static
size_t
ogg_read_cb
(
void
*
ptr
,
size_t
size
,
size_t
nmemb
,
void
*
data
)
...
@@ -123,17 +127,12 @@ vorbis_strerror(int code)
...
@@ -123,17 +127,12 @@ vorbis_strerror(int code)
}
}
static
bool
static
bool
vorbis_is_open
(
VorbisInputStream
*
vis
,
OggVorbis_File
*
vf
,
vorbis_is_open
(
VorbisInputStream
*
vis
,
OggVorbis_File
*
vf
)
Decoder
*
decoder
,
InputStream
&
input_stream
)
{
{
vis
->
decoder
=
decoder
;
vis
->
input_stream
=
&
input_stream
;
vis
->
seekable
=
input_stream
.
CheapSeeking
();
int
ret
=
ov_open_callbacks
(
vis
,
vf
,
nullptr
,
0
,
vorbis_is_callbacks
);
int
ret
=
ov_open_callbacks
(
vis
,
vf
,
nullptr
,
0
,
vorbis_is_callbacks
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
if
(
decoder
==
nullptr
||
if
(
vis
->
decoder
==
nullptr
||
decoder_get_command
(
*
decoder
)
==
DecoderCommand
::
NONE
)
decoder_get_command
(
*
vis
->
decoder
)
==
DecoderCommand
::
NONE
)
FormatWarning
(
vorbis_domain
,
FormatWarning
(
vorbis_domain
,
"Failed to open Ogg Vorbis stream: %s"
,
"Failed to open Ogg Vorbis stream: %s"
,
vorbis_strerror
(
ret
));
vorbis_strerror
(
ret
));
...
@@ -192,9 +191,9 @@ vorbis_stream_decode(Decoder &decoder,
...
@@ -192,9 +191,9 @@ vorbis_stream_decode(Decoder &decoder,
moved it */
moved it */
input_stream
.
LockRewind
(
IgnoreError
());
input_stream
.
LockRewind
(
IgnoreError
());
VorbisInputStream
vis
;
VorbisInputStream
vis
(
&
decoder
,
input_stream
)
;
OggVorbis_File
vf
;
OggVorbis_File
vf
;
if
(
!
vorbis_is_open
(
&
vis
,
&
vf
,
&
decoder
,
input_stream
))
if
(
!
vorbis_is_open
(
&
vis
,
&
vf
))
return
;
return
;
const
vorbis_info
*
vi
=
ov_info
(
&
vf
,
-
1
);
const
vorbis_info
*
vi
=
ov_info
(
&
vf
,
-
1
);
...
@@ -313,10 +312,10 @@ static bool
...
@@ -313,10 +312,10 @@ static bool
vorbis_scan_stream
(
InputStream
&
is
,
vorbis_scan_stream
(
InputStream
&
is
,
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
)
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
)
{
{
VorbisInputStream
vis
;
VorbisInputStream
vis
(
nullptr
,
is
)
;
OggVorbis_File
vf
;
OggVorbis_File
vf
;
if
(
!
vorbis_is_open
(
&
vis
,
&
vf
,
nullptr
,
is
))
if
(
!
vorbis_is_open
(
&
vis
,
&
vf
))
return
false
;
return
false
;
tag_handler_invoke_duration
(
handler
,
handler_ctx
,
tag_handler_invoke_duration
(
handler
,
handler_ctx
,
...
...
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