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
b73ecbb0
Commit
b73ecbb0
authored
Oct 17, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input: declare struct input_stream
Provide a struct type which can be forward-declared. The typedef InputStream is deprecated now.
parent
bae98f77
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
43 deletions
+50
-43
decoder_api.c
src/decoder_api.c
+5
-3
decoder_api.h
src/decoder_api.h
+7
-6
decoder_thread.c
src/decoder_thread.c
+1
-1
inputStream.c
src/inputStream.c
+7
-7
inputStream.h
src/inputStream.h
+14
-14
inputStream_file.c
src/inputStream_file.c
+8
-6
inputStream_file.h
src/inputStream_file.h
+8
-6
No files found.
src/decoder_api.c
View file @
b73ecbb0
...
...
@@ -99,7 +99,7 @@ void decoder_seek_error(struct decoder * decoder)
}
size_t
decoder_read
(
struct
decoder
*
decoder
,
InputS
tream
*
inStream
,
struct
input_s
tream
*
inStream
,
void
*
buffer
,
size_t
length
)
{
size_t
nbytes
;
...
...
@@ -130,7 +130,8 @@ size_t decoder_read(struct decoder *decoder,
* one.
*/
static
enum
decoder_command
need_chunks
(
struct
decoder
*
decoder
,
InputStream
*
inStream
,
int
seekable
)
need_chunks
(
struct
decoder
*
decoder
,
struct
input_stream
*
inStream
,
int
seekable
)
{
if
(
dc
.
command
==
DECODE_COMMAND_STOP
)
return
DECODE_COMMAND_STOP
;
...
...
@@ -153,7 +154,8 @@ need_chunks(struct decoder *decoder, InputStream * inStream, int seekable)
}
enum
decoder_command
decoder_data
(
struct
decoder
*
decoder
,
InputStream
*
inStream
,
int
seekable
,
decoder_data
(
struct
decoder
*
decoder
,
struct
input_stream
*
inStream
,
int
seekable
,
void
*
dataIn
,
size_t
dataInLen
,
float
data_time
,
uint16_t
bitRate
,
ReplayGainInfo
*
replayGainInfo
)
...
...
src/decoder_api.h
View file @
b73ecbb0
...
...
@@ -66,10 +66,10 @@ struct decoder_plugin {
void
(
*
finish
)(
void
);
/**
* returns true if the
InputS
tream is decodable by the
*
InputP
lugin, false if not
* returns true if the
input s
tream is decodable by the
*
decoder p
lugin, false if not
*/
bool
(
*
try_decode
)(
InputS
tream
*
);
bool
(
*
try_decode
)(
struct
input_s
tream
*
);
/**
* this will be used to decode InputStreams, and is
...
...
@@ -77,7 +77,7 @@ struct decoder_plugin {
*
* returns -1 on error, 0 on success
*/
int
(
*
stream_decode
)(
struct
decoder
*
,
InputS
tream
*
);
int
(
*
stream_decode
)(
struct
decoder
*
,
struct
input_s
tream
*
);
/**
* use this if and only if your InputPlugin can only be passed
...
...
@@ -143,7 +143,7 @@ void decoder_seek_error(struct decoder * decoder);
* command (like SEEK or STOP).
*/
size_t
decoder_read
(
struct
decoder
*
decoder
,
InputS
tream
*
inStream
,
struct
input_s
tream
*
inStream
,
void
*
buffer
,
size_t
length
);
/**
...
...
@@ -154,7 +154,8 @@ size_t decoder_read(struct decoder *decoder,
* send the next chunk
*/
enum
decoder_command
decoder_data
(
struct
decoder
*
decoder
,
InputStream
*
inStream
,
int
seekable
,
decoder_data
(
struct
decoder
*
decoder
,
struct
input_stream
*
inStream
,
int
seekable
,
void
*
data
,
size_t
datalen
,
float
data_time
,
uint16_t
bitRate
,
ReplayGainInfo
*
replayGainInfo
);
...
...
src/decoder_thread.c
View file @
b73ecbb0
...
...
@@ -33,7 +33,7 @@ static void decodeStart(void)
struct
decoder
decoder
;
int
ret
;
bool
close_instream
=
true
;
InputS
tream
inStream
;
struct
input_s
tream
inStream
;
struct
decoder_plugin
*
plugin
=
NULL
;
char
path_max_fs
[
MPD_PATH_MAX
];
...
...
src/inputStream.c
View file @
b73ecbb0
...
...
@@ -29,7 +29,7 @@ void initInputStream(void)
inputStream_initHttp
();
}
int
openInputStream
(
InputStream
*
inStream
,
char
*
url
)
int
openInputStream
(
struct
input_stream
*
inStream
,
char
*
url
)
{
inStream
->
ready
=
0
;
inStream
->
offset
=
0
;
...
...
@@ -48,18 +48,18 @@ int openInputStream(InputStream * inStream, char *url)
return
-
1
;
}
int
seekInputStream
(
InputStream
*
inStream
,
long
offset
,
int
whence
)
int
seekInputStream
(
struct
input_stream
*
inStream
,
long
offset
,
int
whence
)
{
return
inStream
->
seekFunc
(
inStream
,
offset
,
whence
);
}
size_t
readFromInputStream
(
InputStream
*
inStream
,
void
*
ptr
,
size_t
size
,
size_t
nmemb
)
size_t
readFromInputStream
(
struct
input_stream
*
inStream
,
void
*
ptr
,
size_t
size
,
size_t
nmemb
)
{
return
inStream
->
readFunc
(
inStream
,
ptr
,
size
,
nmemb
);
}
int
closeInputStream
(
InputStream
*
inStream
)
int
closeInputStream
(
struct
input_stream
*
inStream
)
{
if
(
inStream
->
mime
)
free
(
inStream
->
mime
);
...
...
@@ -71,12 +71,12 @@ int closeInputStream(InputStream * inStream)
return
inStream
->
closeFunc
(
inStream
);
}
int
inputStreamAtEOF
(
InputStream
*
inStream
)
int
inputStreamAtEOF
(
struct
input_stream
*
inStream
)
{
return
inStream
->
atEOFFunc
(
inStream
);
}
int
bufferInputStream
(
InputStream
*
inStream
)
int
bufferInputStream
(
struct
input_stream
*
inStream
)
{
return
inStream
->
bufferFunc
(
inStream
);
}
src/inputStream.h
View file @
b73ecbb0
...
...
@@ -21,17 +21,17 @@
#include <stddef.h>
typedef
struct
_InputS
tream
InputStream
;
typedef
struct
input_s
tream
InputStream
;
typedef
int
(
*
InputStreamSeekFunc
)
(
InputStream
*
inStream
,
long
offset
,
typedef
int
(
*
InputStreamSeekFunc
)
(
struct
input_stream
*
inStream
,
long
offset
,
int
whence
);
typedef
size_t
(
*
InputStreamReadFunc
)
(
InputStream
*
inStream
,
void
*
ptr
,
typedef
size_t
(
*
InputStreamReadFunc
)
(
struct
input_stream
*
inStream
,
void
*
ptr
,
size_t
size
,
size_t
nmemb
);
typedef
int
(
*
InputStreamCloseFunc
)
(
InputStream
*
inStream
);
typedef
int
(
*
InputStreamAtEOFFunc
)
(
InputStream
*
inStream
);
typedef
int
(
*
InputStreamBufferFunc
)
(
InputStream
*
inStream
);
typedef
int
(
*
InputStreamCloseFunc
)
(
struct
input_stream
*
inStream
);
typedef
int
(
*
InputStreamAtEOFFunc
)
(
struct
input_stream
*
inStream
);
typedef
int
(
*
InputStreamBufferFunc
)
(
struct
input_stream
*
inStream
);
struct
_InputS
tream
{
struct
input_s
tream
{
int
ready
;
int
error
;
...
...
@@ -57,16 +57,16 @@ int isUrlSaneForInputStream(char *url);
/* if an error occurs for these 3 functions, then -1 is returned and errno
for the input stream is set */
int
openInputStream
(
InputStream
*
inStream
,
char
*
url
);
int
seekInputStream
(
InputStream
*
inStream
,
long
offset
,
int
whence
);
int
closeInputStream
(
InputStream
*
inStream
);
int
inputStreamAtEOF
(
InputStream
*
inStream
);
int
openInputStream
(
struct
input_stream
*
inStream
,
char
*
url
);
int
seekInputStream
(
struct
input_stream
*
inStream
,
long
offset
,
int
whence
);
int
closeInputStream
(
struct
input_stream
*
inStream
);
int
inputStreamAtEOF
(
struct
input_stream
*
inStream
);
/* return value: -1 is error, 1 inidicates stuff was buffered, 0 means nothing
was buffered */
int
bufferInputStream
(
InputStream
*
inStream
);
int
bufferInputStream
(
struct
input_stream
*
inStream
);
size_t
readFromInputStream
(
InputStream
*
inStream
,
void
*
ptr
,
size_t
size
,
size_t
nmemb
);
size_t
readFromInputStream
(
struct
input_stream
*
inStream
,
void
*
ptr
,
size_t
size
,
size_t
nmemb
);
#endif
src/inputStream_file.c
View file @
b73ecbb0
...
...
@@ -25,7 +25,7 @@ void inputStream_initFile(void)
{
}
int
inputStream_fileOpen
(
InputStream
*
inStream
,
char
*
filename
)
int
inputStream_fileOpen
(
struct
input_stream
*
inStream
,
char
*
filename
)
{
FILE
*
fp
;
...
...
@@ -57,7 +57,8 @@ int inputStream_fileOpen(InputStream * inStream, char *filename)
return
0
;
}
int
inputStream_fileSeek
(
InputStream
*
inStream
,
long
offset
,
int
whence
)
int
inputStream_fileSeek
(
struct
input_stream
*
inStream
,
long
offset
,
int
whence
)
{
if
(
fseek
((
FILE
*
)
inStream
->
data
,
offset
,
whence
)
==
0
)
{
inStream
->
offset
=
ftell
((
FILE
*
)
inStream
->
data
);
...
...
@@ -69,7 +70,8 @@ int inputStream_fileSeek(InputStream * inStream, long offset, int whence)
return
0
;
}
size_t
inputStream_fileRead
(
InputStream
*
inStream
,
void
*
ptr
,
size_t
size
,
size_t
inputStream_fileRead
(
struct
input_stream
*
inStream
,
void
*
ptr
,
size_t
size
,
size_t
nmemb
)
{
size_t
readSize
;
...
...
@@ -86,7 +88,7 @@ size_t inputStream_fileRead(InputStream * inStream, void *ptr, size_t size,
return
readSize
;
}
int
inputStream_fileClose
(
InputStream
*
inStream
)
int
inputStream_fileClose
(
struct
input_stream
*
inStream
)
{
if
(
fclose
((
FILE
*
)
inStream
->
data
)
<
0
)
{
inStream
->
error
=
errno
;
...
...
@@ -96,7 +98,7 @@ int inputStream_fileClose(InputStream * inStream)
return
0
;
}
int
inputStream_fileAtEOF
(
InputStream
*
inStream
)
int
inputStream_fileAtEOF
(
struct
input_stream
*
inStream
)
{
if
(
feof
((
FILE
*
)
inStream
->
data
))
return
1
;
...
...
@@ -108,7 +110,7 @@ int inputStream_fileAtEOF(InputStream * inStream)
return
0
;
}
int
inputStream_fileBuffer
(
mpd_unused
InputStream
*
inStream
)
int
inputStream_fileBuffer
(
mpd_unused
struct
input_stream
*
inStream
)
{
return
0
;
}
src/inputStream_file.h
View file @
b73ecbb0
...
...
@@ -23,17 +23,19 @@
void
inputStream_initFile
(
void
);
int
inputStream_fileOpen
(
InputStream
*
inStream
,
char
*
filename
);
int
inputStream_fileOpen
(
struct
input_stream
*
inStream
,
char
*
filename
);
int
inputStream_fileSeek
(
InputStream
*
inStream
,
long
offset
,
int
whence
);
int
inputStream_fileSeek
(
struct
input_stream
*
inStream
,
long
offset
,
int
whence
);
size_t
inputStream_fileRead
(
InputStream
*
inStream
,
void
*
ptr
,
size_t
size
,
size_t
inputStream_fileRead
(
struct
input_stream
*
inStream
,
void
*
ptr
,
size_t
size
,
size_t
nmemb
);
int
inputStream_fileClose
(
InputStream
*
inStream
);
int
inputStream_fileClose
(
struct
input_stream
*
inStream
);
int
inputStream_fileAtEOF
(
InputStream
*
inStream
);
int
inputStream_fileAtEOF
(
struct
input_stream
*
inStream
);
int
inputStream_fileBuffer
(
InputStream
*
inStream
);
int
inputStream_fileBuffer
(
struct
input_stream
*
inStream
);
#endif
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