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
9bdb0b0d
Commit
9bdb0b0d
authored
Dec 23, 2006
by
J. Alexander Treuman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding support for seeking HTTP streams.
git-svn-id:
https://svn.musicpd.org/mpd/trunk@5159
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
202ae227
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
16 deletions
+25
-16
decode.c
src/decode.c
+3
-1
inputStream_http.c
src/inputStream_http.c
+22
-15
No files found.
src/decode.c
View file @
9bdb0b0d
...
@@ -285,7 +285,6 @@ static void decodeStart(PlayerControl * pc, OutputBuffer * cb,
...
@@ -285,7 +285,6 @@ static void decodeStart(PlayerControl * pc, OutputBuffer * cb,
return
;
return
;
}
}
dc
->
seekable
=
inStream
.
seekable
;
dc
->
state
=
DECODE_STATE_START
;
dc
->
state
=
DECODE_STATE_START
;
dc
->
start
=
0
;
dc
->
start
=
0
;
...
@@ -295,6 +294,9 @@ static void decodeStart(PlayerControl * pc, OutputBuffer * cb,
...
@@ -295,6 +294,9 @@ static void decodeStart(PlayerControl * pc, OutputBuffer * cb,
my_usleep
(
1000
);
my_usleep
(
1000
);
}
}
/* for http streams, seekable is determined in bufferInputStream */
dc
->
seekable
=
inStream
.
seekable
;
if
(
dc
->
stop
)
{
if
(
dc
->
stop
)
{
dc
->
state
=
DECODE_STATE_STOP
;
dc
->
state
=
DECODE_STATE_STOP
;
dc
->
stop
=
0
;
dc
->
stop
=
0
;
...
...
src/inputStream_http.c
View file @
9bdb0b0d
...
@@ -480,11 +480,11 @@ static int finishHTTPInit(InputStream * inStream)
...
@@ -480,11 +480,11 @@ static int finishHTTPInit(InputStream * inStream)
snprintf
(
request
,
2048
,
"GET %s HTTP/1.0
\r\n
"
"Host: %s
\r\n
"
snprintf
(
request
,
2048
,
"GET %s HTTP/1.0
\r\n
"
"Host: %s
\r\n
"
/*"Connection: close\r\n" */
/*"Connection: close\r\n" */
"User-Agent: %s/%s
\r\n
"
"User-Agent: %s/%s
\r\n
"
/*"Range: bytes=%ld-\r\n" */
"Range: bytes=%ld-
\r\n
"
"%s"
/* authorization */
"%s"
/* authorization */
"Icy-Metadata:1
\r\n
"
"Icy-Metadata:1
\r\n
"
"
\r\n
"
,
data
->
path
,
data
->
host
,
PACKAGE_NAME
,
PACKAGE_VERSION
,
"
\r\n
"
,
data
->
path
,
data
->
host
,
PACKAGE_NAME
,
PACKAGE_VERSION
,
/*inStream->offset, */
inStream
->
offset
,
data
->
proxyAuth
?
data
->
proxyAuth
:
data
->
proxyAuth
?
data
->
proxyAuth
:
(
data
->
httpAuth
?
data
->
httpAuth
:
""
)
(
data
->
httpAuth
?
data
->
httpAuth
:
""
)
);
);
...
@@ -681,9 +681,6 @@ static int getHTTPHello(InputStream * inStream)
...
@@ -681,9 +681,6 @@ static int getHTTPHello(InputStream * inStream)
data
->
prebuffer
=
1
;
data
->
prebuffer
=
1
;
/*mark as unseekable till we actually implement seeking */
inStream
->
seekable
=
0
;
return
0
;
return
0
;
}
}
...
@@ -714,21 +711,31 @@ int inputStream_httpOpen(InputStream * inStream, char *url)
...
@@ -714,21 +711,31 @@ int inputStream_httpOpen(InputStream * inStream, char *url)
int
inputStream_httpSeek
(
InputStream
*
inStream
,
long
offset
,
int
whence
)
int
inputStream_httpSeek
(
InputStream
*
inStream
,
long
offset
,
int
whence
)
{
{
/* hack to reopen an HTTP stream if we're trying to seek to
if
(
!
inStream
->
seekable
)
* the beginning */
return
-
1
;
if
((
whence
==
SEEK_SET
)
&&
(
offset
==
0
))
{
InputStreamHTTPData
*
data
;
switch
(
whence
)
{
case
SEEK_SET
:
inStream
->
offset
=
offset
;
break
;
case
SEEK_CUR
:
inStream
->
offset
+=
offset
;
break
;
case
SEEK_END
:
inStream
->
offset
=
inStream
->
size
+
offset
;
break
;
default:
return
-
1
;
}
data
=
(
InputStreamHTTPData
*
)
inStream
->
data
;
InputStreamHTTPData
*
data
=
(
InputStreamHTTPData
*
)
inStream
->
data
;
close
(
data
->
sock
);
close
(
data
->
sock
);
data
->
connState
=
HTTP_CONN_STATE_REOPEN
;
data
->
connState
=
HTTP_CONN_STATE_REOPEN
;
data
->
buflen
=
0
;
data
->
buflen
=
0
;
inStream
->
offset
=
0
;
return
0
;
}
/* otherwise, we don't know how to seek in HTTP yet */
inputStream_httpBuffer
(
inStream
);
return
-
1
;
return
0
;
}
}
static
void
parseIcyMetadata
(
InputStream
*
inStream
,
char
*
metadata
,
int
size
)
static
void
parseIcyMetadata
(
InputStream
*
inStream
,
char
*
metadata
,
int
size
)
...
...
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