VLC 에는 web interface 라는 넘이 있는데,
이녀석을 원격지에서 http query를 통해 제어가 가능하다.
윈도우에서 기본설치시
C:\Program Files\VideoLAN\VLC\http\requests 경로에 존재하는 파일을 읽어보면 될 듯 하다.
웹에서 접속시에는
http://localhost:8080/requests/filename.xml?query
식으로 하면된다.
아래는 readme.txt 파일
$Id$
This file describes commands available through the requests/ file:
Lines starting with < describe what the page sends back
Lines starting with > describe what you can send to the page
All parameters need to be URL encoded.
Examples:
# -> %23
% -> %25
+ -> %2B
space -> +
...
status.xml:
===========
< Get VLC status information, current item info and meta.
> add <mrl> to playlist and start playback:
?command=in_play&input=<mrl>
> add <mrl> to playlist:
?command=in_enqueue&input=<mrl>
> play playlist item <id>:
?command=pl_play&id=<id>
> toggle pause. If current state was 'stop', play item <id>:
?command=pl_pause&id=<id>
> stop playback:
?command=pl_stop
> jump to next item:
?command=pl_next
> jump to previous item:
?command=pl_previous
> delete item <id> from playlist:
?command=pl_delete&id=<id>
> empty playlist:
?command=pl_empty
> sort playlist using sort mode <val> and order <id>:
?command=pl_sort&id=<id>&val=<val>
If id=0 then items will be sorted in normal order, if id=1 they will be
sorted in reverse order
A non exhaustive list of sort modes:
0 Id
1 Name
3 Author
5 Random
7 Track number
> toggle random playback:
?command=pl_random
> toggle loop:
?command=pl_loop
> toggle repeat:
?command=pl_repeat
> toggle enable service discovery module <val>:
?command=pl_sd&val=<val>
Typical values are:
sap
shoutcast
podcast
hal
> toggle fullscreen:
?command=fullscreen
> set volume level to <val> (can be absolute integer, percent or +/- relative value):
?command=volume&val=<val>
Allowed values are of the form:
+<int>, -<int>, <int> or <int>%
> seek to <val>:
?command=seek&val=<val>
Allowed values are of the form:
[+ or -][<int><H or h>:][<int><M or m or '>:][<int><nothing or S or s or ">]
or [+ or -]<int>%
(value between [ ] are optional, value between < > are mandatory)
examples:
1000 -> seek to the 1000th second
+1H:2M -> seek 1 hour and 2 minutes forward
-10% -> seek 10% back
playlist.xml:
=============
< get the full playlist tree
browse.xml:
===========
< ?dir=<dir>
> get <dir>'s filelist
vlm.xml:
========
< get the full list of VLM elements
vlm_cmd.xml:
============ < execute VLM command <cmd> ?command=<cmd> > get the error message from <cmd>
원인은 못찾았지만, 커널 옵션에서 quiet 주어도 나오길래, 최소한 커널 오류는 아닌것으로 판단
busybox에서 찾아보니
./shell/ash.c:4849: ash_msg_and_raise_error("cannot open %s: %s", fname, errmsg(errno, "no such file"));
한녀석이 걸려 나온다.
특이한건, 이 소스가 있는 부분은 openredirect라는 함수.
음.. 머하는 녀석일려나?
static int
openredirect(union node *redir)
{
char *fname;
int f;
switch (redir->nfile.type) {
case NFROM:
fname = redir->nfile.expfname;
f = open(fname, O_RDONLY);
if (f < 0)
goto eopen;
break;
case NFROMTO:
fname = redir->nfile.expfname;
f = open(fname, O_RDWR|O_CREAT|O_TRUNC, 0666);
if (f < 0)
goto ecreate;
break;
case NTO:
/* Take care of noclobber mode. */
if (Cflag) {
fname = redir->nfile.expfname;
f = noclobberopen(fname);
if (f < 0)
goto ecreate;
break;
}
/* FALLTHROUGH */
case NCLOBBER:
fname = redir->nfile.expfname;
f = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666);
if (f < 0)
goto ecreate;
break;
case NAPPEND:
fname = redir->nfile.expfname;
f = open(fname, O_WRONLY|O_CREAT|O_APPEND, 0666);
if (f < 0)
goto ecreate;
break;
default:
#if DEBUG
abort();
#endif
/* Fall through to eliminate warning. */
case NTOFD:
case NFROMFD:
f = -1;
break;
case NHERE:
case NXHERE:
f = openhere(redir);
break;
}
return f;
ecreate:
ash_msg_and_raise_error("cannot create %s: %s", fname, errmsg(errno, "nonexistent directory"));
eopen:
ash_msg_and_raise_error("cannot open %s: %s", fname, errmsg(errno, "no such file"));
}
2010.04.21 추가
inittab에 ttyAS1을 초기화 하는 부분이 있었는데, 커널에서(?) 사용하지 않도록 해놔서 계속 에러가 난 모양이다.
아무튼, /bin/sh에 ttyAS1을 열도록 해놓았기 때문에, busybox에서 ash이 sh을 대체하고,
그러다 보니 ash에서 에러발생. 머.. 문제 해결 끝!
$ cat target/etc/inittab # Example Busybox inittab ::sysinit:/etc/init.d/rcS ttyAS0::askfirst:/bin/sh ttyAS1::askfirst:/bin/sh ::ctrlaltdel:/sbin/reboot ::shutdown:/sbin/swapoff -a ::shutdown:/bin/umount -a -r ::restart:/sbin/init
그리고 iconv() 함수는
문자열 변수들은 2중 포인터로 넘겨주고(왜?) inbytesleft는 strlen(*inbuf) 의 값을 outbytesleft는 strlen(*outbuf) 의 값을 넣어주면된다.
물론 변환에 따라서, 길이가 가변적으로 달라질수 있기 때문에 주의해야 한다.
만약, 변환중 메모리가 넘치게 되면 EILSEQ 에러가 발생하게 되며, (물론 넘치기 전에 데이터는 빼낼수 있다.)
변수의 포인터가 2중 포인터가 아니면 "__gconv: Assertion `outbuf != ((void *)0) && *outbuf != ((void *)0)' failed."
이런 에러를 만나게 될 것이다.
iconv는 utf 나 iso8859 등, 여러가지 방법으로
문자열 코딩을 변환해주는 역활을 하는 함수/유틸리티이다.
$ man -k iconv
iconv (1) - Convert encoding of given files from one encoding to another
iconv (1p) - codeset conversion
iconv (3) - perform character set conversion
iconv (3p) - codeset conversion function
iconv.h [iconv] (0p) - codeset conversion facility
iconv_close (3) - deallocate descriptor for character set conversion
iconv_close (3p) - codeset conversion deallocation function
iconv_open (3) - allocate descriptor for character set conversion
iconv_open (3p) - codeset conversion allocation function
아무튼, iconv는 함수(3/3p) 이자 유틸리티(1) 인데
함수의 경우 iconv_open() - iconv() - iconv_close() 를 이용하여 사용한다.
$ iconv --list
The following list contain all the coded character sets known. This
does
not necessarily mean that all combinations of these names can be used
for
the FROM and TO command line parameters. One coded character set can be
listed with several different names (aliases).