프로그램 사용/VLC2010. 4. 21. 15:08
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>



[링크 : http://forum.videolan.org/viewtopic.php?f=16&t=45842]

2009/12/08 - [프로그램 사용/VLC] - VLC 웹 인터페이스 원격지에서 안될경우
2009/11/24 - [프로그램 사용/VLC] - VLC web interface(웹 인터페이스)
Posted by 구차니
프로그램 사용/busybox2010. 4. 20. 20:08
원인은 못찾았지만, 커널 옵션에서 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

'프로그램 사용 > busybox' 카테고리의 다른 글

busybox tftp  (0) 2013.06.18
busybox - setconsole  (0) 2011.10.21
busybox ps는 BSD 스타일?  (0) 2010.01.12
ifup / ifdown 을 통한 static <-> dhcp 변환  (0) 2009.12.29
udhcpd 용 interface 예제  (0) 2009.12.23
Posted by 구차니
iconv_open() 함수는 dest, source 형식으로 인자를 받고
iconv() 함수는 2중 포인터를 사용한다.

#include <iconv.h>

iconv_t iconv_open(const char *tocode, const char *fromcode);
size_t iconv(iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);

iconv_open(TO, FROM);
이므로 반대로 넣으면 이상하게 나온다. 주의요망!

그리고 iconv() 함수는
문자열 변수들은 2중 포인터로 넘겨주고(왜?)
inbytesleft는 strlen(*inbuf) 의 값을
outbytesleft는 strlen(*outbuf) 의 값을 넣어주면된다.

물론 변환에 따라서, 길이가 가변적으로 달라질수 있기 때문에 주의해야 한다.

만약, 변환중 메모리가 넘치게 되면 EILSEQ 에러가 발생하게 되며, (물론 넘치기 전에 데이터는 빼낼수 있다.)
변수의 포인터가 2중 포인터가 아니면
"__gconv: Assertion `outbuf != ((void *)0) && *outbuf != ((void *)0)' failed."
이런 에러를 만나게 될 것이다.


#include "stdio.h"
#include "string.h"
#include "iconv.h"
#include "errno.h"

#define BUFF_SIZE 64

int main()
{
        iconv_t cd = iconv_open("UNICODE", "UTF-8");
        if (cd == (iconv_t)(-1))
        {
                perror("iconv_open");
                return 0;
        }

        char inBuf[BUFF_SIZE] = "Hello world";
        int inBufSize = sizeof(inBuf);

        char outBuf[BUFF_SIZE];
        int outBufSize = sizeof(outBuf);
        memset(outBuf, 0, outBufSize);

        // convert
        size_t readBytes = strlen(inBuf);
        size_t writeBytes = sizeof(outBuf);
        char* in = inBuf;
        char* out = outBuf;

        printf("readBytes:%d writeBytes:%d\n",readBytes,writeBytes);

        if (iconv(cd, &in, &readBytes, &out, &writeBytes) == -1)
        {
                printf("failed to iconv errno:%d EILSEQ:%d\n", errno, EILSEQ);
        }
        else
        {
                int idx;
                printf("in:%x out:%x\n",in,out);
                printf("readBytes:%d writeBytes:%d\n",readBytes,writeBytes);
                for(idx = 0; idx < BUFF_SIZE; idx++)
                {
                        printf("%03d %c %x\t\t", idx, inBuf[idx], inBuf[idx]);
                        printf("%03d %c %x\n", idx, outBuf[idx], outBuf[idx]);
                }
                outBuf[writeBytes] = '\0';
        }

        iconv_close(cd);
        return 0;
}


2010/04/20 - [Linux] - linux iconv 테스트
2010/04/19 - [Linux] - iconv

Posted by 구차니
iconv 유틸리티를 이용해서 일단 변환 테스트.
-f=UTF-8        (UTF-8 문서를)
-t=UNICODE   (유니코드로 변환)
-o result.txt    (result.txt로 출력)

$ cat test.str
Hello world
$ vi test.str
  1 Hello world

$ iconv -f=UTF8 -t=UNICODE test.str -o result.txt

$ cat result.txt
▒▒Hello world
$ vi result.txt
  1 ÿþH^@e^@l^@l^@o^@ ^@w^@o^@r^@l^@d^@
  2 ^@




Posted by 구차니
언어는 &hl
국가는 &gl 로 변수를 넘겨준다.
(웹상에서 언어를 변경할때는 이렇게 되는데 RSS Feed에는 영향을 미치지 못하는 것으로 보인다.)

http://gdata.youtube.com/feeds/api/standardfeeds/regionID/feedID?v=2

http://gdata.youtube.com/feeds/api/standardfeeds/ko/top_rated
위의 주소는, 한국의 top rated를 받아오는 방법이다.

Country Region ID
Australia AU
Brazil BR
Canada CA
Czech Republic CZ
France FR
Germany DE
Great Britain GB
Holland NL
Hong Kong HK
India IN
Ireland IE
Israel IL
Italy IT
Japan JP
Mexico MX
New Zealand NZ
Poland PL
Russia RU
South Korea KR
Spain ES
Sweden SE
Taiwan TW
United States US

[링크 : http://code.google.com/intl/ko-KR/apis/youtube/2.0/reference.html]

http://gdata.youtube.com/schemas/2007/categories.cat?hl=<LANGUAGE>
위의 내용은, 스키마를 언어별로 받아오는 것이다.
간단하게 카테고리별 문자열을 구글에게서 받아올수 있다.(내부적인 번역이 필요없다!)

Language/Locale hl Parameter Value
Chinese (Traditional) zh-TW
Czech cs-CZ
Dutch nl-NL
English (Great Britain, Ireland, Australia and New Zealand) en-GB
English (United States and Canada)
* default value
en-US
French fr-FR
German de-DE
Italian it-IT
Language/Locale hl Parameter Value
Japanese ja-JP
Korean ko-KR
Polish pl-PL
Portuguese (Brazil) pt-BR
Russian ru-RU
Spanish (Spain) es-ES
Spanish (Mexico) es-MX
Swedish sv-SE

[링크 : http://code.google.com/intl/ko-KR/apis/youtube/2.0/reference.html]

Posted by 구차니
http://gdata.youtube.com/feeds/api/
에서 XML 파일을 받으면 기본적으로

<openSearch:startIndex>1</openSearch:startIndex>
<openSearch:itemsPerPage>25</openSearch:itemsPerPage>

첫번째 페이지, 25개 항목을 받아오도록 되어있다.
즉, 인자를 넘겨주면 다른 값을 볼수도 있다는 의미!

<link rel='previous' type='application/atom+xml'
  href='http://gdata.youtube.com/feeds/api/videos?start-index=1&max-results=25...'/>
<link rel='next' type='application/atom+xml'
  href='http://gdata.youtube.com/feeds/api/videos?start-index=51&max-results=25...'/>

[링크 : http://code.google.com/intl/ko-KR/apis/youtube/2.0/reference.html]


2010.05.07 추가
start-index 는 대소문자 구분하며, 1 부터 시작한다.

'프로그램 사용 > 유튜브(youtube)' 카테고리의 다른 글

youtube api 변동으로 인한 content 태그 변경  (0) 2010.05.13
youtube locale 관련  (0) 2010.04.20
youtube html5  (2) 2010.04.17
Percent encoding = URL Encoding  (0) 2010.04.16
유튜브 fmt 와 t 값  (0) 2010.04.15
Posted by 구차니
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() 를 이용하여 사용한다.

#include <iconv.h>
iconv_t iconv_open(const char *tocode, const char *fromcode);

tocode나 fromcode에 들어갈 내용은
명령어로 확인이 가능하다.

$ ldd /usr/bin/iconv
        linux-gate.so.1 =>  (0x005e5000)
        libc.so.6 => /lib/libc.so.6 (0x47ae8000)
        /lib/ld-linux.so.2 (0x47119000)
ldd로 확인해보니, libc만 있으면 실질적으로 구동이 가능한 함수로 보인다.

테스트가 필요한 코드
[링크 : http://kldp.org/node/77391]
[링크 : http://www.korone.net/bbs/board.php?bo_table=etc_misc&wr_id=160&page=2]
Posted by 구차니
IBM 문서인데,
결국 XML 탐색은 tagname이 유일하거나 혹은 name space로 구분함으로서
실질적으로 유일한 tag name을 주어 키워드로 검색하고
그에 따른 child나 parent 이런식으로 검색을 용이하게 하는 것으로 보인다.

결론 : 결국은 범용 XML 리더는 존재하지 않고, 개별 XML 구조에 맞도록 읽어 와야 한다는 것으로 판단됨.

[링크 : http://www.ibm.com/developerworks/kr/library/x-xmlajaxpt1/]
Posted by 구차니
http://www.youtube.com/html5 로 접속하면 html5 베타를 사용하도록 하는 옵션이 존재한다.

YouTube HTML5 동영상 플레이어

YouTube에서 HTML5를 지원하기 위한 선택적 시험 기능입니다. 지원되는 브라우저를 사용 중인 경우 대부분의 동영상에 Flash Player가 아닌 HTML5 플레이어를 사용하도록 선택할 수 있습니다..


지원되는 브라우저

YouTube는 현재 HTML5의 동영상 태그와 h.264 동영상 코덱을 모두 지원하는 브라우저를 지원합니다. 지원되는 브라우저는 다음과 같습니다.


업데이트

  • 2010년 1월 17일: 전체화면 지원 사용(브라우저에서 지원하는 경우).


추가 제한사항(해결 중)

  • 광고가 포함된 동영상은 지원되지 않습니다(Flash Player에서 재생).
  • 전체화면은 지원되지 않습니다.
  • 다른 TestTube 시험기능을 선택하면 HTML5 플레이어를 가져올 수 없습니다(Feather는 지원됨).

그런데.. Firefox 는 아직이구나..OTL 털썩
그래서 일단은 Google Chrome으로 접속!

위는 HTML5에서 동영상 로딩시 나오는 화면
아래는 동영상 우클릭시 나오는 화면(일반 우클릭과 동일함)

화질이라던가 이런건 잘 모르겠고,
솔찍히 Flash와의 차이점은 눈에 띄지는 않는다.(사용자 측면에서 동일하게 동영상은 나오니까.)

크롬 - 플래시

파이어폭스 - 플래시

크롬 - HTML5

후처리 문제인지는 모르겠지만, 360p에서 자막을 알아보기 힘들정도로 HTML5는 조금 안습상황이다.

'프로그램 사용 > 유튜브(youtube)' 카테고리의 다른 글

youtube locale 관련  (0) 2010.04.20
youtube gdata 검색관련  (0) 2010.04.20
Percent encoding = URL Encoding  (0) 2010.04.16
유튜브 fmt 와 t 값  (0) 2010.04.15
VLC에서 youtube 동영상 재생하기  (2) 2010.04.13
Posted by 구차니
공백은 +
isalnum()으로 걸러질넘들은 그대로 출력

그리고 변환시에는 무조건 "%%%02X" 형식으로 출력된다.
즉, encoding이나 decoding 시에 %[0-9a-f][0-9a-f] 인지 확인이 필요할듯 하다.



RFC 3986 section 2.2 Reserved Characters (January 2005)
! * ' ( ) ; : @ & = + $ , / ? % # [ ]

Reserved characters after percent-encoding
! * ' ( ) ; : @ & = + $ , / ? % # [ ]
%21 %2A %27 %28 %29 %3B %3A %40 %26 %3D %2B %24 %2C %2F %3F %25 %23 %5B %5D

Other common characters after percent-encoding
< > ~ . " { } | \ - ` _ ^
%3C %3E %7E %2E %22 %7B %7D %7C %5C %2D %60 %5F %5E

RFC 3986 section 2.3 Unreserved Characters (January 2005)
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
a b c d e f g h i j k l m n o p q r s t u v w x y z
0 1 2 3 4 5 6 7 8 9 - _ . ~

replacing spaces with "+" instead of "%20"

[링크 : http://en.wikipedia.org/wiki/Percent-encoding]


'프로그램 사용 > 유튜브(youtube)' 카테고리의 다른 글

youtube gdata 검색관련  (0) 2010.04.20
youtube html5  (2) 2010.04.17
유튜브 fmt 와 t 값  (0) 2010.04.15
VLC에서 youtube 동영상 재생하기  (2) 2010.04.13
URL encoding / decoding 관련 함수들  (2) 2010.04.13
Posted by 구차니