Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
e7815d90
Commit
e7815d90
authored
Aug 19, 2007
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Preliminary album art support code for the HTTP interface.
parent
4f1617cb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
99 additions
and
1 deletion
+99
-1
modules/control/http/http.c
modules/control/http/http.c
+86
-0
share/http/dialogs/main
share/http/dialogs/main
+1
-0
share/http/js/functions.js
share/http/js/functions.js
+12
-1
No files found.
modules/control/http/http.c
View file @
e7815d90
...
...
@@ -82,6 +82,12 @@ vlc_module_end();
* Local prototypes
*****************************************************************************/
static
void
Run
(
intf_thread_t
*
p_intf
);
int
E_
(
ArtCallback
)(
httpd_handler_sys_t
*
p_args
,
httpd_handler_t
*
p_handler
,
char
*
_p_url
,
uint8_t
*
_p_request
,
int
i_type
,
uint8_t
*
_p_in
,
int
i_in
,
char
*
psz_remote_addr
,
char
*
psz_remote_host
,
uint8_t
**
pp_data
,
int
*
pi_data
);
/*****************************************************************************
* Local functions
...
...
@@ -338,6 +344,21 @@ static int Open( vlc_object_t *p_this )
E_
(
ParseDirectory
)(
p_intf
,
psz_src
,
psz_src
);
/* FIXME: we're leaking h */
httpd_handler_sys_t
*
h
=
malloc
(
sizeof
(
httpd_handler_sys_t
)
);
if
(
!
h
)
{
msg_Err
(
p_intf
,
"not enough memory to allocate album art handler"
);
goto
failed
;
}
h
->
file
.
p_intf
=
p_intf
;
h
->
file
.
file
=
NULL
;
h
->
file
.
name
=
NULL
;
/* TODO: use ACL and login/password stuff here too */
h
->
p_handler
=
httpd_HandlerNew
(
p_sys
->
p_httpd_host
,
"/art"
,
NULL
,
NULL
,
NULL
,
E_
(
ArtCallback
),
h
);
TAB_APPEND
(
p_sys
->
i_handlers
,
p_sys
->
pp_handlers
,
h
->
p_handler
);
if
(
p_sys
->
i_files
<=
0
)
{
...
...
@@ -892,3 +913,68 @@ int E_(HandlerCallback)( httpd_handler_sys_t *p_args,
return
VLC_SUCCESS
;
}
int
E_
(
ArtCallback
)(
httpd_handler_sys_t
*
p_args
,
httpd_handler_t
*
p_handler
,
char
*
_p_url
,
uint8_t
*
_p_request
,
int
i_type
,
uint8_t
*
_p_in
,
int
i_in
,
char
*
psz_remote_addr
,
char
*
psz_remote_host
,
uint8_t
**
pp_data
,
int
*
pi_data
)
{
uint8_t
*
p_data
=
NULL
;
int
i_data
=
0
;
char
*
psz_art
=
NULL
;
intf_thread_t
*
p_intf
=
p_args
->
file
.
p_intf
;
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
if
(
p_sys
->
p_input
)
{
psz_art
=
input_item_GetArtURL
(
input_GetItem
(
p_sys
->
p_input
)
);
}
if
(
psz_art
&&
!
strncmp
(
psz_art
,
"file://"
,
strlen
(
"file://"
)
)
)
{
FILE
*
f
;
char
*
psz_ext
;
char
*
psz_header
;
int
i_header_size
;
if
(
(
f
=
utf8_fopen
(
psz_art
+
strlen
(
"file://"
),
"r"
)
)
==
NULL
)
{
msg_Dbg
(
p_intf
,
"Couldn't open album art file %s"
,
psz_art
+
strlen
(
"file://"
)
);
Callback404
(
&
p_args
->
file
,
(
char
**
)
pp_data
,
pi_data
);
free
(
psz_art
);
return
VLC_SUCCESS
;
}
E_
(
FileLoad
)(
f
,
&
p_data
,
&
i_data
);
fclose
(
f
);
psz_ext
=
strrchr
(
psz_art
,
'.'
);
if
(
psz_ext
)
psz_ext
++
;
#define HEADER "Content-Type: image/%s\n" \
"Content-Length: %d\n" \
"\n"
i_header_size
=
asprintf
(
&
psz_header
,
HEADER
,
psz_ext
,
i_data
);
#undef HEADER
*
pi_data
=
i_header_size
+
i_data
;
*
pp_data
=
(
uint8_t
*
)
malloc
(
*
pi_data
);
memcpy
(
*
pp_data
,
psz_header
,
i_header_size
);
memcpy
(
*
pp_data
+
i_header_size
,
p_data
,
i_data
);
free
(
psz_header
);
free
(
p_data
);
}
else
{
msg_Dbg
(
p_intf
,
"No album art found"
);
Callback404
(
&
p_args
->
file
,
(
char
**
)
pp_data
,
pi_data
);
}
free
(
psz_art
);
return
VLC_SUCCESS
;
}
share/http/dialogs/main
View file @
e7815d90
...
...
@@ -106,6 +106,7 @@ sout and playlist .
<img
src=
"images/slider_left.png"
alt=
"slider left"
/><span
id=
"progressbar"
style=
"background-image: url( 'images/slider_bar.png' ); width: 408px; height:16px; position:absolute;"
onclick=
"slider_seek( event, this );"
onmousemove=
"slider_move( event, this );"
><img
src=
"images/slider_point.png"
alt=
"slider point"
style=
"position:relative; left:0px;"
id=
"main_slider_point"
onmousedown=
"slider_down( event, this );"
onmouseup=
"slider_up( event, this.parentNode );"
onmouseout=
"slider_up( event, this.parentNode );"
/></span><img
src=
"images/slider_right.png"
alt=
"slider right"
style=
"position:relative;left:408px;"
/>
<br/>
<span
id=
"nowplaying"
>
(?)
</span>
<img
id=
"albumart"
alt=
"Album art"
src=
"/art"
style=
"float: right"
onclick=
"refresh_albumart();"
/>
</div>
</div>
...
...
share/http/js/functions.js
View file @
e7815d90
...
...
@@ -1039,7 +1039,12 @@ function browse_path( p )
hide
(
'
browse
'
);
document
.
getElementById
(
value
(
'
browse_dest
'
)
).
focus
();
}
function
refresh_albumart
()
{
var
now
=
new
Date
();
var
albumart
=
document
.
getElementById
(
'
albumart
'
);
albumart
.
src
=
'
/art?timestamp=
'
+
now
.
getTime
();
}
/**********************************************************************
* Periodically update stuff in the interface
*********************************************************************/
...
...
@@ -1053,9 +1058,15 @@ function loop_refresh_playlist()
/* setTimeout( 'loop_refresh_playlist()', 10000 ); */
update_playlist
();
}
function
loop_refresh_albumart
()
{
setTimeout
(
'
loop_refresh_albumart()
'
,
10000
);
refresh_albumart
();
}
function
loop_refresh
()
{
setTimeout
(
'
loop_refresh_status()
'
,
1
);
setTimeout
(
'
loop_refresh_playlist()
'
,
1
);
setTimeout
(
'
loop_refresh_albumart()
'
,
1
);
}
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