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
21b8590b
Commit
21b8590b
authored
Oct 26, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input_stream: removed the InputStream typedef
Everybody should use struct input_stream.
parent
bbaedb17
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
65 additions
and
50 deletions
+65
-50
_flac_common.c
src/decoder/_flac_common.c
+1
-1
_flac_common.h
src/decoder/_flac_common.h
+2
-2
_ogg_common.c
src/decoder/_ogg_common.c
+1
-1
_ogg_common.h
src/decoder/_ogg_common.h
+1
-1
aac_plugin.c
src/decoder/aac_plugin.c
+7
-6
ffmpeg_plugin.c
src/decoder/ffmpeg_plugin.c
+10
-7
flac_plugin.c
src/decoder/flac_plugin.c
+9
-5
mp3_plugin.c
src/decoder/mp3_plugin.c
+9
-7
mp4_plugin.c
src/decoder/mp4_plugin.c
+7
-4
mpc_plugin.c
src/decoder/mpc_plugin.c
+4
-3
oggvorbis_plugin.c
src/decoder/oggvorbis_plugin.c
+6
-4
wavpack_plugin.c
src/decoder/wavpack_plugin.c
+8
-7
input_stream.h
src/input_stream.h
+0
-2
No files found.
src/decoder/_flac_common.c
View file @
21b8590b
...
...
@@ -26,7 +26,7 @@
#include <FLAC/metadata.h>
void
init_FlacData
(
FlacData
*
data
,
struct
decoder
*
decoder
,
InputStream
*
inStream
)
struct
input_stream
*
inStream
)
{
data
->
time
=
0
;
data
->
position
=
0
;
...
...
src/decoder/_flac_common.h
View file @
21b8590b
...
...
@@ -144,14 +144,14 @@ typedef struct {
float
total_time
;
FLAC__uint64
position
;
struct
decoder
*
decoder
;
InputS
tream
*
inStream
;
struct
input_s
tream
*
inStream
;
ReplayGainInfo
*
replayGainInfo
;
struct
tag
*
tag
;
}
FlacData
;
/* initializes a given FlacData struct */
void
init_FlacData
(
FlacData
*
data
,
struct
decoder
*
decoder
,
InputStream
*
inStream
);
struct
input_stream
*
inStream
);
void
flac_metadata_common_cb
(
const
FLAC__StreamMetadata
*
block
,
FlacData
*
data
);
void
flac_error_common_cb
(
const
char
*
plugin
,
...
...
src/decoder/_ogg_common.c
View file @
21b8590b
...
...
@@ -23,7 +23,7 @@
#include "_flac_common.h"
#include "../utils.h"
ogg_stream_type
ogg_stream_type_detect
(
InputStream
*
inStream
)
ogg_stream_type
ogg_stream_type_detect
(
struct
input_stream
*
inStream
)
{
/* oggflac detection based on code in ogg123 and this post
* http://lists.xiph.org/pipermail/flac/2004-December/000393.html
...
...
src/decoder/_ogg_common.h
View file @
21b8590b
...
...
@@ -26,6 +26,6 @@
typedef
enum
_ogg_stream_type
{
VORBIS
,
FLAC
}
ogg_stream_type
;
ogg_stream_type
ogg_stream_type_detect
(
InputStream
*
inStream
);
ogg_stream_type
ogg_stream_type_detect
(
struct
input_stream
*
inStream
);
#endif
/* _OGG_COMMON_H */
src/decoder/aac_plugin.c
View file @
21b8590b
...
...
@@ -29,7 +29,7 @@
/* all code here is either based on or copied from FAAD2's frontend code */
typedef
struct
{
struct
decoder
*
decoder
;
InputS
tream
*
inStream
;
struct
input_s
tream
*
inStream
;
size_t
bytesIntoBuffer
;
size_t
bytesConsumed
;
off_t
fileOffset
;
...
...
@@ -174,8 +174,9 @@ static void adtsParse(AacBuffer * b, float *length)
*
length
=
(
float
)
frames
/
framesPerSec
;
}
static
void
initAacBuffer
(
AacBuffer
*
b
,
struct
decoder
*
decoder
,
InputStream
*
inStream
)
static
void
initAacBuffer
(
AacBuffer
*
b
,
struct
decoder
*
decoder
,
struct
input_stream
*
inStream
)
{
memset
(
b
,
0
,
sizeof
(
AacBuffer
));
...
...
@@ -253,7 +254,7 @@ static float getAacFloatTotalTime(char *file)
faacDecConfigurationPtr
config
;
uint32_t
sample_rate
;
unsigned
char
channels
;
InputS
tream
inStream
;
struct
input_s
tream
inStream
;
long
bread
;
if
(
openInputStream
(
&
inStream
,
file
)
<
0
)
...
...
@@ -301,7 +302,7 @@ static int getAacTotalTime(char *file)
}
static
int
aac_stream_decode
(
struct
decoder
*
mpd_decoder
,
InputS
tream
*
inStream
)
struct
input_s
tream
*
inStream
)
{
float
file_time
;
float
totalTime
=
0
;
...
...
@@ -454,7 +455,7 @@ static int aac_decode(struct decoder * mpd_decoder, char *path)
int seekPositionFound = 0; */
uint16_t
bitRate
=
0
;
AacBuffer
b
;
InputS
tream
inStream
;
struct
input_s
tream
inStream
;
int
initialized
=
0
;
if
((
totalTime
=
getAacFloatTotalTime
(
path
))
<
0
)
...
...
src/decoder/ffmpeg_plugin.c
View file @
21b8590b
...
...
@@ -45,7 +45,7 @@ typedef struct {
AVCodecContext
*
aCodecCtx
;
AVCodec
*
aCodec
;
struct
decoder
*
decoder
;
InputS
tream
*
input
;
struct
input_s
tream
*
input
;
struct
tag
*
tag
;
}
BasePtrs
;
...
...
@@ -54,7 +54,7 @@ typedef struct {
char
url
[
8
];
struct
decoder
*
decoder
;
InputS
tream
*
input
;
struct
input_s
tream
*
input
;
}
FopsHelper
;
/**
...
...
@@ -137,8 +137,9 @@ static int ffmpeg_init(void)
return
0
;
}
static
int
ffmpeg_helper
(
InputStream
*
input
,
int
(
*
callback
)(
BasePtrs
*
ptrs
),
BasePtrs
*
ptrs
)
static
int
ffmpeg_helper
(
struct
input_stream
*
input
,
int
(
*
callback
)(
BasePtrs
*
ptrs
),
BasePtrs
*
ptrs
)
{
AVFormatContext
*
pFormatCtx
;
AVCodecContext
*
aCodecCtx
;
...
...
@@ -211,7 +212,8 @@ static int ffmpeg_helper(InputStream *input, int (*callback)(BasePtrs *ptrs),
return
ret
;
}
static
bool
ffmpeg_try_decode
(
InputStream
*
input
)
static
bool
ffmpeg_try_decode
(
struct
input_stream
*
input
)
{
int
ret
;
if
(
input
->
seekable
)
{
...
...
@@ -320,7 +322,8 @@ static int ffmpeg_decode_internal(BasePtrs *base)
return
0
;
}
static
int
ffmpeg_decode
(
struct
decoder
*
decoder
,
InputStream
*
input
)
static
int
ffmpeg_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
input
)
{
BasePtrs
base
;
int
ret
;
...
...
@@ -352,7 +355,7 @@ static int ffmpeg_tag_internal(BasePtrs *base)
//no tag reading in ffmpeg, check if playable
static
struct
tag
*
ffmpeg_tag
(
char
*
file
)
{
InputS
tream
input
;
struct
input_s
tream
input
;
BasePtrs
base
;
int
ret
;
struct
tag
*
tag
=
NULL
;
...
...
src/decoder/flac_plugin.c
View file @
21b8590b
...
...
@@ -301,8 +301,9 @@ static struct tag *flacTagDup(char *file)
return
ret
;
}
static
int
flac_decode_internal
(
struct
decoder
*
decoder
,
InputStream
*
inStream
,
int
is_ogg
)
static
int
flac_decode_internal
(
struct
decoder
*
decoder
,
struct
input_stream
*
inStream
,
int
is_ogg
)
{
flac_decoder
*
flacDec
;
FlacData
data
;
...
...
@@ -378,7 +379,8 @@ fail:
return
0
;
}
static
int
flac_decode
(
struct
decoder
*
decoder
,
InputStream
*
inStream
)
static
int
flac_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
inStream
)
{
return
flac_decode_internal
(
decoder
,
inStream
,
0
);
}
...
...
@@ -415,12 +417,14 @@ out:
return
ret
;
}
static
int
oggflac_decode
(
struct
decoder
*
decoder
,
InputStream
*
inStream
)
static
int
oggflac_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
inStream
)
{
return
flac_decode_internal
(
decoder
,
inStream
,
1
);
}
static
bool
oggflac_try_decode
(
InputStream
*
inStream
)
static
bool
oggflac_try_decode
(
struct
input_stream
*
inStream
)
{
return
FLAC_API_SUPPORTS_OGG_FLAC
&&
ogg_stream_type_detect
(
inStream
)
==
FLAC
;
...
...
src/decoder/mp3_plugin.c
View file @
21b8590b
...
...
@@ -125,12 +125,12 @@ typedef struct _mp3DecodeData {
int
decodedFirstFrame
;
unsigned
long
bitRate
;
struct
decoder
*
decoder
;
InputS
tream
*
inStream
;
struct
input_s
tream
*
inStream
;
enum
mad_layer
layer
;
}
mp3DecodeData
;
static
void
initMp3DecodeData
(
mp3DecodeData
*
data
,
struct
decoder
*
decoder
,
InputStream
*
inStream
)
struct
input_stream
*
inStream
)
{
data
->
muteFrame
=
MUTEFRAME_NONE
;
data
->
highestFrame
=
0
;
...
...
@@ -753,7 +753,7 @@ static void mp3DecodeDataFinalize(mp3DecodeData * data)
/* this is primarily used for getting total time for tags */
static
int
getMp3TotalTime
(
char
*
file
)
{
InputS
tream
inStream
;
struct
input_s
tream
inStream
;
mp3DecodeData
data
;
int
ret
;
...
...
@@ -770,9 +770,10 @@ static int getMp3TotalTime(char *file)
return
ret
;
}
static
int
openMp3FromInputStream
(
InputStream
*
inStream
,
mp3DecodeData
*
data
,
struct
decoder
*
decoder
,
struct
tag
**
tag
,
ReplayGainInfo
**
replayGainInfo
)
static
int
openMp3FromInputStream
(
struct
input_stream
*
inStream
,
mp3DecodeData
*
data
,
struct
decoder
*
decoder
,
struct
tag
**
tag
,
ReplayGainInfo
**
replayGainInfo
)
{
initMp3DecodeData
(
data
,
decoder
,
inStream
);
*
tag
=
NULL
;
...
...
@@ -988,7 +989,8 @@ static void initAudioFormatFromMp3DecodeData(mp3DecodeData * data,
af
->
channels
=
MAD_NCHANNELS
(
&
(
data
->
frame
).
header
);
}
static
int
mp3_decode
(
struct
decoder
*
decoder
,
InputStream
*
inStream
)
static
int
mp3_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
inStream
)
{
mp3DecodeData
data
;
struct
tag
*
tag
=
NULL
;
...
...
src/decoder/mp4_plugin.c
View file @
21b8590b
...
...
@@ -68,15 +68,18 @@ static int mp4_getAACTrack(mp4ff_t * infile)
static
uint32_t
mp4_inputStreamReadCallback
(
void
*
inStream
,
void
*
buffer
,
uint32_t
length
)
{
return
readFromInputStream
((
InputStream
*
)
inStream
,
buffer
,
length
);
return
readFromInputStream
((
struct
input_stream
*
)
inStream
,
buffer
,
length
);
}
static
uint32_t
mp4_inputStreamSeekCallback
(
void
*
inStream
,
uint64_t
position
)
{
return
seekInputStream
((
InputStream
*
)
inStream
,
position
,
SEEK_SET
);
return
seekInputStream
((
struct
input_stream
*
)
inStream
,
position
,
SEEK_SET
);
}
static
int
mp4_decode
(
struct
decoder
*
mpd_decoder
,
InputStream
*
inStream
)
static
int
mp4_decode
(
struct
decoder
*
mpd_decoder
,
struct
input_stream
*
inStream
)
{
mp4ff_t
*
mp4fh
;
mp4ff_callback_t
*
mp4cb
;
...
...
@@ -304,7 +307,7 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream)
static
struct
tag
*
mp4DataDup
(
char
*
file
,
int
*
mp4MetadataFound
)
{
struct
tag
*
ret
=
NULL
;
InputS
tream
inStream
;
struct
input_s
tream
inStream
;
mp4ff_t
*
mp4fh
;
mp4ff_callback_t
*
callback
;
int32_t
track
;
...
...
src/decoder/mpc_plugin.c
View file @
21b8590b
...
...
@@ -23,7 +23,7 @@
#include <mpcdec/mpcdec.h>
typedef
struct
_MpcCallbackData
{
InputS
tream
*
inStream
;
struct
input_s
tream
*
inStream
;
struct
decoder
*
decoder
;
}
MpcCallbackData
;
...
...
@@ -94,7 +94,8 @@ static inline int16_t convertSample(MPC_SAMPLE_FORMAT sample)
return
val
;
}
static
int
mpc_decode
(
struct
decoder
*
mpd_decoder
,
InputStream
*
inStream
)
static
int
mpc_decode
(
struct
decoder
*
mpd_decoder
,
struct
input_stream
*
inStream
)
{
mpc_decoder
decoder
;
mpc_reader
reader
;
...
...
@@ -240,7 +241,7 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream)
static
float
mpcGetTime
(
char
*
file
)
{
InputS
tream
inStream
;
struct
input_s
tream
inStream
;
float
total_time
=
-
1
;
mpc_reader
reader
;
...
...
src/decoder/oggvorbis_plugin.c
View file @
21b8590b
...
...
@@ -44,7 +44,7 @@
#endif
typedef
struct
_OggCallbackData
{
InputS
tream
*
inStream
;
struct
input_s
tream
*
inStream
;
struct
decoder
*
decoder
;
}
OggCallbackData
;
...
...
@@ -56,7 +56,7 @@ static size_t ogg_read_cb(void *ptr, size_t size, size_t nmemb, void *vdata)
ret
=
decoder_read
(
data
->
decoder
,
data
->
inStream
,
ptr
,
size
*
nmemb
);
errno
=
0
;
/*if(ret<0) errno = ((
InputS
tream *)inStream)->error; */
/*if(ret<0) errno = ((
struct input_s
tream *)inStream)->error; */
return
ret
/
size
;
}
...
...
@@ -200,7 +200,8 @@ static void putOggCommentsIntoOutputBuffer(char *streamName,
}
/* public */
static
int
oggvorbis_decode
(
struct
decoder
*
decoder
,
InputStream
*
inStream
)
static
int
oggvorbis_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
inStream
)
{
OggVorbis_File
vf
;
ov_callbacks
callbacks
;
...
...
@@ -360,7 +361,8 @@ static struct tag *oggvorbis_TagDup(char *file)
return
ret
;
}
static
bool
oggvorbis_try_decode
(
InputStream
*
inStream
)
static
bool
oggvorbis_try_decode
(
struct
input_stream
*
inStream
)
{
if
(
!
inStream
->
seekable
)
/* we cannot seek after the detection, so don't bother
...
...
src/decoder/wavpack_plugin.c
View file @
21b8590b
...
...
@@ -333,13 +333,13 @@ static struct tag *wavpack_tagdup(char *fname)
}
/*
* mpd
InputS
tream <=> WavpackStreamReader wrapper callbacks
* mpd
input_s
tream <=> WavpackStreamReader wrapper callbacks
*/
/* This struct is needed for per-stream last_byte storage. */
typedef
struct
{
struct
decoder
*
decoder
;
InputS
tream
*
is
;
struct
input_s
tream
*
is
;
/* Needed for push_back_byte() */
int
last_byte
;
}
InputStreamPlus
;
...
...
@@ -403,7 +403,7 @@ static WavpackStreamReader mpd_is_reader = {
static
void
initInputStreamPlus
(
InputStreamPlus
*
isp
,
struct
decoder
*
decoder
,
InputS
tream
*
is
)
struct
input_s
tream
*
is
)
{
isp
->
decoder
=
decoder
;
isp
->
is
=
is
;
...
...
@@ -413,7 +413,7 @@ initInputStreamPlus(InputStreamPlus *isp, struct decoder *decoder,
/*
* Tries to decode the specified stream, and gives true if managed to do it.
*/
static
bool
wavpack_trydecode
(
InputS
tream
*
is
)
static
bool
wavpack_trydecode
(
struct
input_s
tream
*
is
)
{
char
error
[
ERRORLEN
];
WavpackContext
*
wpc
;
...
...
@@ -433,7 +433,7 @@ static bool wavpack_trydecode(InputStream *is)
}
static
int
wavpack_open_wvc
(
struct
decoder
*
decoder
,
InputS
tream
*
is_wvc
)
struct
input_s
tream
*
is_wvc
)
{
char
tmp
[
MPD_PATH_MAX
];
const
char
*
utf8url
;
...
...
@@ -498,11 +498,12 @@ static int wavpack_open_wvc(struct decoder *decoder,
/*
* Decodes a stream.
*/
static
int
wavpack_streamdecode
(
struct
decoder
*
decoder
,
InputStream
*
is
)
static
int
wavpack_streamdecode
(
struct
decoder
*
decoder
,
struct
input_stream
*
is
)
{
char
error
[
ERRORLEN
];
WavpackContext
*
wpc
;
InputS
tream
is_wvc
;
struct
input_s
tream
is_wvc
;
int
open_flags
=
OPEN_2CH_MAX
|
OPEN_NORMALIZE
/*| OPEN_STREAMING*/
;
InputStreamPlus
isp
,
isp_wvc
;
...
...
src/input_stream.h
View file @
21b8590b
...
...
@@ -21,8 +21,6 @@
#include <stddef.h>
typedef
struct
input_stream
InputStream
;
struct
input_stream
{
int
ready
;
...
...
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