본문 바로가기
IT/linux

mplayer slave mode, 파이프, 커맨드 사용

by 어느해겨울 2022. 1. 20.

mplayer slave mode, 파이프, 커맨드 사용


mplayer slave mode

- pipe를를 통한 command 전달 mode로 동작

ex) mplayer -slave

 

 

1. idle 동작

- mplayer background process로 동작하여 command 전달 시 그에 해당하는 동작 수행.

- idle 동작 시pipe를 반드시 지정해야 함.

ex) mplayer -slave -idle -input file=<pipe 파일>

 

 

2. standalone 동작

- mplayer 실행 시 실행할 파일/URL을 입력받아 동작.

- pipe 지정 시 pipe 를 통한 command 전달 가능.

ex) mplayer -slave -input file=<pipe 파일> <대상 파일/URL>

 

 

3.  비교

- idle 동작 시background로 커맨드만 받아 동작하므로 안정적으로 동작, , 재생 파일의 끝을 알 수 없고, error case의의 condition 을 확인하기가 어려움. (stdout 메시지에 대한 handling 처리가 필요)

- standalone 동작 시 재생 파일의 끝 또는 error case에에 대한 대응이 쉬움. , mplayer의의 잦은 재실행으로 메모리, 캐쉬 등 시스템 문제가 생길 요지가 있음.

 

 

4.  파이프 생성

- 리눅스 명령어 mkfifo를 통해 pipe를 생성.

- 파이프 네임에 대한 생성만 처리.

ex) mkfifo <pipe 파일명>

 

 

5.  Command 전달

- echo 및redirect를 이용하여 command 전달.

- slave command condition link :

http://code.metager.de/source/xref/mplayer/DOCS/tech/slave.txt

ex) echo "loadfile http://live.ytnradio.kr:8000" > mplayer.pipe

 

 

6.  시스템 캐시 초기화

- linux system 특성상process에서 동작되는 메모리를cache에 적재.

- streaming 재생 같은 장시간 재생condition에서는문제 발생 가능.

- cron 또는 주기적 실행 script 동작 처리 가능.

- pagecache, dentries, inodes 모두 해제.

ex) echo 3 > /proc/sys/vm/drop_caches

 

끝.

 

 

댓글