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
3ae0d6f4
Commit
3ae0d6f4
authored
Sep 22, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DecoderBuffer: export the struct
Eliminates the functions _new() and _free().
parent
13b66a77
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
58 deletions
+28
-58
DecoderBuffer.cxx
src/decoder/DecoderBuffer.cxx
+0
-29
DecoderBuffer.hxx
src/decoder/DecoderBuffer.hxx
+22
-23
FaadDecoderPlugin.cxx
src/decoder/plugins/FaadDecoderPlugin.cxx
+6
-6
No files found.
src/decoder/DecoderBuffer.cxx
View file @
3ae0d6f4
...
...
@@ -21,38 +21,9 @@
#include "DecoderBuffer.hxx"
#include "DecoderAPI.hxx"
#include "util/ConstBuffer.hxx"
#include "util/DynamicFifoBuffer.hxx"
#include <assert.h>
struct
DecoderBuffer
{
Decoder
*
const
decoder
;
InputStream
&
is
;
DynamicFifoBuffer
<
uint8_t
>
buffer
;
DecoderBuffer
(
Decoder
*
_decoder
,
InputStream
&
_is
,
size_t
_size
)
:
decoder
(
_decoder
),
is
(
_is
),
buffer
(
_size
)
{}
};
DecoderBuffer
*
decoder_buffer_new
(
Decoder
*
decoder
,
InputStream
&
is
,
size_t
size
)
{
assert
(
size
>
0
);
return
new
DecoderBuffer
(
decoder
,
is
,
size
);
}
void
decoder_buffer_free
(
DecoderBuffer
*
buffer
)
{
assert
(
buffer
!=
nullptr
);
delete
buffer
;
}
const
InputStream
&
decoder_buffer_get_stream
(
const
DecoderBuffer
*
buffer
)
{
...
...
src/decoder/DecoderBuffer.hxx
View file @
3ae0d6f4
...
...
@@ -21,38 +21,37 @@
#define MPD_DECODER_BUFFER_HXX
#include "Compiler.h"
#include "util/DynamicFifoBuffer.hxx"
#include <stddef.h>
/**
* This objects handles buffered reads in decoder plugins easily. You
* create a buffer object, and use its high-level methods to fill and
* read it. It will automatically handle shifting the buffer.
*/
struct
DecoderBuffer
;
struct
Decoder
;
class
InputStream
;
template
<
typename
T
>
struct
ConstBuffer
;
/**
* Creates a new buffer.
*
* @param decoder the decoder object, used for decoder_read(), may be nullptr
* @param is the input stream object where we should read from
* @param size the maximum size of the buffer
* @return the new decoder_buffer object
*/
DecoderBuffer
*
decoder_buffer_new
(
Decoder
*
decoder
,
InputStream
&
is
,
size_t
size
);
/**
* Frees resources used by the decoder_buffer object.
* This objects handles buffered reads in decoder plugins easily. You
* create a buffer object, and use its high-level methods to fill and
* read it. It will automatically handle shifting the buffer.
*/
void
decoder_buffer_free
(
DecoderBuffer
*
buffer
);
struct
DecoderBuffer
{
Decoder
*
const
decoder
;
InputStream
&
is
;
DynamicFifoBuffer
<
uint8_t
>
buffer
;
/**
* Creates a new buffer.
*
* @param _decoder the decoder object, used for decoder_read(),
* may be nullptr
* @param _is the input stream object where we should read from
* @param _size the maximum size of the buffer
*/
DecoderBuffer
(
Decoder
*
_decoder
,
InputStream
&
_is
,
size_t
_size
)
:
decoder
(
_decoder
),
is
(
_is
),
buffer
(
_size
)
{}
};
gcc_pure
const
InputStream
&
...
...
src/decoder/plugins/FaadDecoderPlugin.cxx
View file @
3ae0d6f4
...
...
@@ -308,8 +308,8 @@ static std::pair<bool, SignedSongTime>
faad_get_file_time
(
InputStream
&
is
)
{
DecoderBuffer
*
buffer
=
decoder_buffer_new
(
nullptr
,
is
,
FAAD_MIN_STREAMSIZE
*
MAX_CHANNELS
);
new
DecoderBuffer
(
nullptr
,
is
,
FAAD_MIN_STREAMSIZE
*
MAX_CHANNELS
);
auto
duration
=
faad_song_duration
(
buffer
,
is
);
bool
recognized
=
!
duration
.
IsNegative
();
...
...
@@ -326,7 +326,7 @@ faad_get_file_time(InputStream &is)
NeAACDecClose
(
decoder
);
}
de
coder_buffer_free
(
buffer
)
;
de
lete
buffer
;
return
std
::
make_pair
(
recognized
,
duration
);
}
...
...
@@ -415,8 +415,8 @@ static void
faad_stream_decode
(
Decoder
&
mpd_decoder
,
InputStream
&
is
)
{
DecoderBuffer
*
buffer
=
decoder_buffer_new
(
&
mpd_decoder
,
is
,
FAAD_MIN_STREAMSIZE
*
MAX_CHANNELS
);
new
DecoderBuffer
(
&
mpd_decoder
,
is
,
FAAD_MIN_STREAMSIZE
*
MAX_CHANNELS
);
/* create the libfaad decoder */
...
...
@@ -427,7 +427,7 @@ faad_stream_decode(Decoder &mpd_decoder, InputStream &is)
/* cleanup */
NeAACDecClose
(
decoder
);
de
coder_buffer_free
(
buffer
)
;
de
lete
buffer
;
}
static
bool
...
...
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