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
92c85bd2
Commit
92c85bd2
authored
Oct 24, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/opus: move SeekFindEOS() to OggFind.cxx
parent
f629eb8c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
19 deletions
+31
-19
OggFind.cxx
src/decoder/OggFind.cxx
+19
-0
OggFind.hxx
src/decoder/OggFind.hxx
+11
-0
OpusDecoderPlugin.cxx
src/decoder/OpusDecoderPlugin.cxx
+1
-19
No files found.
src/decoder/OggFind.cxx
View file @
92c85bd2
...
...
@@ -20,6 +20,8 @@
#include "config.h"
#include "OggFind.hxx"
#include "OggSyncState.hxx"
#include "InputStream.hxx"
#include "util/Error.hxx"
bool
OggFindEOS
(
OggSyncState
&
oy
,
ogg_stream_state
&
os
,
ogg_packet
&
packet
)
...
...
@@ -35,3 +37,20 @@ OggFindEOS(OggSyncState &oy, ogg_stream_state &os, ogg_packet &packet)
return
true
;
}
}
bool
OggSeekFindEOS
(
OggSyncState
&
oy
,
ogg_stream_state
&
os
,
ogg_packet
&
packet
,
InputStream
&
is
)
{
if
(
is
.
size
>
0
&&
is
.
size
-
is
.
offset
<
65536
)
return
OggFindEOS
(
oy
,
os
,
packet
);
if
(
!
is
.
CheapSeeking
())
return
false
;
oy
.
Reset
();
return
is
.
LockSeek
(
-
65536
,
SEEK_END
,
IgnoreError
())
&&
oy
.
ExpectPageSeekIn
(
os
)
&&
OggFindEOS
(
oy
,
os
,
packet
);
}
src/decoder/OggFind.hxx
View file @
92c85bd2
...
...
@@ -24,6 +24,7 @@
#include <ogg/ogg.h>
struct
InputStream
;
class
OggSyncState
;
/**
...
...
@@ -35,4 +36,14 @@ class OggSyncState;
bool
OggFindEOS
(
OggSyncState
&
oy
,
ogg_stream_state
&
os
,
ogg_packet
&
packet
);
/**
* Try to find the end-of-stream (EOS) packet. Seek to the end of the
* file if necessary.
*
* @return true if the EOS packet was found
*/
bool
OggSeekFindEOS
(
OggSyncState
&
oy
,
ogg_stream_state
&
os
,
ogg_packet
&
packet
,
InputStream
&
is
);
#endif
src/decoder/OpusDecoderPlugin.cxx
View file @
92c85bd2
...
...
@@ -292,24 +292,6 @@ mpd_opus_stream_decode(Decoder &decoder,
}
static
bool
SeekFindEOS
(
OggSyncState
&
oy
,
ogg_stream_state
&
os
,
ogg_packet
&
packet
,
InputStream
&
is
)
{
if
(
is
.
size
>
0
&&
is
.
size
-
is
.
offset
<
65536
)
return
OggFindEOS
(
oy
,
os
,
packet
);
if
(
!
is
.
CheapSeeking
())
return
false
;
oy
.
Reset
();
Error
error
;
return
is
.
LockSeek
(
-
65536
,
SEEK_END
,
error
)
&&
oy
.
ExpectPageSeekIn
(
os
)
&&
OggFindEOS
(
oy
,
os
,
packet
);
}
static
bool
mpd_opus_scan_stream
(
InputStream
&
is
,
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
)
{
...
...
@@ -367,7 +349,7 @@ mpd_opus_scan_stream(InputStream &is,
}
}
if
(
packet
.
e_o_s
||
SeekFindEOS
(
oy
,
os
,
packet
,
is
))
if
(
packet
.
e_o_s
||
Ogg
SeekFindEOS
(
oy
,
os
,
packet
,
is
))
tag_handler_invoke_duration
(
handler
,
handler_ctx
,
packet
.
granulepos
/
opus_sample_rate
);
...
...
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