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
3bb71183
Commit
3bb71183
authored
Jan 10, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/Curl: require libcurl 7.18
parent
ed8798e8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
25 deletions
+5
-25
configure.ac
configure.ac
+1
-1
CurlInputPlugin.cxx
src/input/CurlInputPlugin.cxx
+4
-24
No files found.
configure.ac
View file @
3bb71183
...
...
@@ -691,7 +691,7 @@ dnl Input Plugins
dnl ---------------------------------------------------------------------------
dnl ----------------------------------- CURL ----------------------------------
MPD_AUTO_PKG(curl, CURL, [libcurl],
MPD_AUTO_PKG(curl, CURL, [libcurl
>= 7.18
],
[libcurl HTTP streaming], [libcurl not found])
if test x$enable_curl = xyes; then
AC_DEFINE(ENABLE_CURL, 1, [Define when libcurl is used for HTTP streaming])
...
...
src/input/CurlInputPlugin.cxx
View file @
3bb71183
...
...
@@ -45,6 +45,10 @@ extern "C" {
#include <curl/curl.h>
#include <glib.h>
#if LIBCURL_VERSION_NUM < 0x071200
#error libcurl is too old
#endif
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "input_curl"
...
...
@@ -99,14 +103,12 @@ struct input_curl {
to, and input_curl_read() reads from them */
GQueue
*
buffers
;
#if LIBCURL_VERSION_NUM >= 0x071200
/**
* Is the connection currently paused? That happens when the
* buffer was getting too large. It will be unpaused when the
* buffer is below the threshold again.
*/
bool
paused
;
#endif
/** error message provided by libcurl */
char
error
[
CURL_ERROR_SIZE
];
...
...
@@ -153,7 +155,6 @@ static struct {
GSList
*
fds
;
#if LIBCURL_VERSION_NUM >= 0x070f04
/**
* Did CURL give us a timeout? If yes, then we need to call
* curl_multi_perform(), even if there was no event on any
...
...
@@ -166,7 +167,6 @@ static struct {
* used in the GSource method check().
*/
gint64
absolute_timeout
;
#endif
}
curl
;
static
inline
GQuark
...
...
@@ -194,8 +194,6 @@ input_curl_find_request(CURL *easy)
return
NULL
;
}
#if LIBCURL_VERSION_NUM >= 0x071200
static
gpointer
input_curl_resume
(
gpointer
data
)
{
...
...
@@ -211,8 +209,6 @@ input_curl_resume(gpointer data)
return
NULL
;
}
#endif
/**
* Calculates the GLib event bit mask for one file descriptor,
* obtained from three #fd_set objects filled by curl_multi_fdset().
...
...
@@ -551,7 +547,6 @@ input_curl_source_prepare(G_GNUC_UNUSED GSource *source, gint *timeout_r)
{
curl_update_fds
();
#if LIBCURL_VERSION_NUM >= 0x070f04
curl
.
timeout
=
false
;
long
timeout2
;
...
...
@@ -574,9 +569,6 @@ input_curl_source_prepare(G_GNUC_UNUSED GSource *source, gint *timeout_r)
}
else
g_warning
(
"curl_multi_timeout() failed: %s
\n
"
,
curl_multi_strerror
(
mcode
));
#else
(
void
)
timeout_r
;
#endif
return
false
;
}
...
...
@@ -587,7 +579,6 @@ input_curl_source_prepare(G_GNUC_UNUSED GSource *source, gint *timeout_r)
static
gboolean
input_curl_source_check
(
G_GNUC_UNUSED
GSource
*
source
)
{
#if LIBCURL_VERSION_NUM >= 0x070f04
if
(
curl
.
timeout
)
{
/* when a timeout has expired, we need to call
curl_multi_perform(), even if there was no file
...
...
@@ -596,7 +587,6 @@ input_curl_source_check(G_GNUC_UNUSED GSource *source)
if
(
g_source_get_time
(
source
)
>=
curl
.
absolute_timeout
)
return
true
;
}
#endif
for
(
GSList
*
i
=
curl
.
fds
;
i
!=
NULL
;
i
=
i
->
next
)
{
GPollFD
*
poll_fd
=
(
GPollFD
*
)
i
->
data
;
...
...
@@ -705,8 +695,6 @@ input_curl_finish(void)
curl_global_cleanup
();
}
#if LIBCURL_VERSION_NUM >= 0x071200
/**
* Determine the total sizes of all buffers, including portions that
* have already been consumed.
...
...
@@ -728,8 +716,6 @@ curl_total_buffer_size(const struct input_curl *c)
return
total
;
}
#endif
static
void
buffer_free_callback
(
gpointer
data
,
G_GNUC_UNUSED
gpointer
user_data
)
{
...
...
@@ -940,13 +926,11 @@ input_curl_read(struct input_stream *is, void *ptr, size_t size,
is
->
offset
+=
(
goffset
)
nbytes
;
#if LIBCURL_VERSION_NUM >= 0x071200
if
(
c
->
paused
&&
curl_total_buffer_size
(
c
)
<
CURL_RESUME_AT
)
{
g_mutex_unlock
(
c
->
base
.
mutex
);
io_thread_call
(
input_curl_resume
,
c
);
g_mutex_lock
(
c
->
base
.
mutex
);
}
#endif
return
nbytes
;
}
...
...
@@ -1064,13 +1048,11 @@ input_curl_writefunction(void *ptr, size_t size, size_t nmemb, void *stream)
g_mutex_lock
(
c
->
base
.
mutex
);
#if LIBCURL_VERSION_NUM >= 0x071200
if
(
curl_total_buffer_size
(
c
)
+
size
>=
CURL_MAX_BUFFERED
)
{
c
->
paused
=
true
;
g_mutex_unlock
(
c
->
base
.
mutex
);
return
CURL_WRITEFUNC_PAUSE
;
}
#endif
struct
buffer
*
buffer
=
(
struct
buffer
*
)
g_malloc
(
sizeof
(
*
buffer
)
-
sizeof
(
buffer
->
data
)
+
size
);
...
...
@@ -1278,9 +1260,7 @@ input_curl_open(const char *url, GMutex *mutex, GCond *cond,
c
->
postponed_error
=
NULL
;
#if LIBCURL_VERSION_NUM >= 0x071200
c
->
paused
=
false
;
#endif
if
(
!
input_curl_easy_init
(
c
,
error_r
))
{
input_curl_free
(
c
);
...
...
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