<JSTORM> JMF JSTORM http://wwwjstormpekr
Issued by: < > Revision: <10> <2000/9/1> Document Information Document title: Document file name: Revision number: <10> Issued by: JMF3_ doc Issue Date: <2000/9/1 > Status: < > raica@nownurinet : < > junoyoon@orgionet final Content Information Audience Abstract (JFC) JMF -, Reference Benchmark information JSTORM <2/23>
Issued by: < > Revision: <10> <2000/9/1> Document Approvals Signature date Signature date Revision History Revision Date Author Description of change JSTORM <3/23>
Issued by: < > Revision: <10> <2000/9/1> Table of Contents 5 5 BasicMediaControl 11 SampleControlComponent 14 15 18 18 JMF 20 20 JSTORM <4/23>
Issued by: < > Revision: <10> <2000/9/1> ( ) <1> Internet Broadcasting System( ) ibs IBS JMF,, JMF, JSTORM <5/23>
Issued by: < > Revision: <10> <2000/9/1>,,,, JButton Play ( ) (Winamp) Play, Playerstart(),?,?? () JSTORM <6/23>
Issued by: < > Revision: <10> <2000/9/1> Play Stop Pause FastForward ( FF ) Rewind (RW) PlayStop, Pause < 1> p lay(), stop(), pause(), stop() pause() playerstop() stop() 0 UI UI, UI - UI - UI 11, public interface MediaTimeChangeListener { void mediatimechanged(long mediatime, long duration); Event,, Event MediaTimeChangeListener< 1>(1) BasicMediaControl JSTORM <7/23>
Issued by: < > Revision: <10> <2000/9/1>, (2) firemediatimechange,?, Thread (3), GainControl, public class BasicMediaControl implements Runnable { public static final int FF_RW_PERCENT = 3; private long mediatime = 0; private long duration = 0; private Player player; private GainControl gain; private Vector volumnchangelistenerlist = new Vector(1); private Vector mediatimechangelistenerlist = new Vector(1); public BasicMediaControl (){ /** * Player * Player Realized */ public BasicMediaControl (Player player) { thisplayer = player; gain = (GainControl)playergetControl("javaxmediaGainControl"); duration = playergetduration()getnanoseconds(); public void play() { playerstart(); public void pause() { playerstop(); JSTORM <8/23>
Issued by: < > Revision: <10> <2000/9/1> public void stop() { playerstop(); playersetmediatime(new Time(0)); public void ff(){ long pos = mediatime + (duration/100)*ff_rw_percent; if(pos > duration) pos = duration; thissetmediatime(pos); public void rw(){ long pos = mediatime - (duration/100)*ff_rw_percent; if(pos < 0) pos = 0; thissetmediatime(pos); public long getmediatime() { return mediatime; public void setmediatime(long time){ thismediatime = time; playersetmediatime(new Time(time)); public int getplayerstate(){ return playergetstate(); public long getduration() { return duration; public GainControl getgaincontrol() { return gain; JSTORM <9/23>
Issued by: < > Revision: <10> <2000/9/1> public void setgain(float f){ gainsetlevel(f); public Player getplayer(){ return player; public void addvolumnchangelistener(volumnchangelistener vcl){ <---- (1) volumnchangelistenerlistaddelement(vcl); public void addmediatimechangelistener(mediatimechangelistener mtcl){ mediatimechangelistenerlistaddelement(mtcl); protected void firemediatimechange() { <---- (2) MediaTimeChangeListener mtcl; for(int i=0; i < mediatimechangelistenerlistsize(); i++){ mtcl = (MediaTimeChangeListener) mediatimechangelistenerlistelementat(i); mtclmediatimechanged(mediatime, duration); protected void firegainchange() { VolumnChangeListener vtcl; for(int i=0; i < volumnchangelistenerlistsize(); i++){ vtcl = (VolumnChangeListener) volumnchangelistenerlistelementat(i); vtclvolumnchanged(gaingetlevel()); public void controllerupdate(controllerevent ce) { if (ce instanceof DurationUpdateEvent) { thisduration = ((DurationUpdateEvent)ce)getDuration()getNanoseconds(); /** *, JSTORM <10/23>
Issued by: < > Revision: <10> <2000/9/1> * */ public void run(){ while (true) { if (player!= null) { long newmediatime = playergetmediatime()getnanoseconds(); if(mediatime!= newmediatime) { try { mediatime = newmediatime; firemediatimechange(); <------ (3) ThreadcurrentThread()sleep(500); catch (InterruptedException ie) { BasicMediaControl < 2>< 1> < 2> BasicMediaControl (1) SampleControlComponent VolumnC hangelistenermediatimechangelistenerimplements (3), (4), (2) BasicMediaControl control (5) ActionListener, BasicMediaControl JSTORM <11/23>
Issued by: < > Revision: <10> <2000/9/1> public class SampleControlComponent extends JPanel implements VolumnChangeListener, MediaTimeChangeListener, <----- (1) ActionListener{ public static final String PLAY_BTN_ACTION_COMMAND = "Play"; public static final String PAUSE_BTN_ACTION_COMMAND = "Pause"; public static final String STOP_BTN_ACTION_COMMAND = "Stop"; public static final String FF_BTN_ACTION_COMMAND = "FF"; public static final String RW_RTP_BTN_ACTION_COMMAND = "RW"; JSlider mediatime; JSlider volumn; BasicMediaControl control; Thread controlthread; public SampleControlComponent(Player player){ control = new BasicMediaControl(player); initcomponent(); controladdmediatimechangelistener(this); <------(2) controladdvolumnchangelistener(this); controlthread = new Thread(control); controlthreadstart(); public void initcomponent(){ // (mediatime) mediatime = new JSlider(JSliderHORIZONTAL); mediatimesetpaintticks(false); // mediatimesetmaximum((int)(controlgetduration()/1000000000l)); mediatimesetvalue(0); // mediatimeaddchangelistener(new ChangeListener(){ public void statechanged(changeevent e){ int changedvalue = mediatimegetvalue(); JSTORM <12/23>
Issued by: < > Revision: <10> <2000/9/1> ); int oldvalue = (int)(controlgetmediatime()/1000000000l); if(!(changedvalue > oldvalue -2 && changedvalue < oldvalue + 2)){ controlsetmediatime((long)(changedvalue*1000000000l)); // volumn = new JSlider(JSliderVERTICAL); volumnsetpaintticks(false); volumnsetmaximum(10); volumnsetvalue((int)(controlgetgaincontrol()getlevel()*10)); volumnsetpreferredsize(new Dimension(30, 40)); // volumnaddchangelistener(new ChangeListener(){ ); public void statechanged(changeevent e){ int changedvalue = volumngetvalue(); controlsetgain(((float)changedvalue)/10); public void volumnchanged(float changedvolumn){ <--- (3) volumnsetvalue((int)(changedvolumn*10)); public void mediatimechanged(long mediatime, long duration){ <----(4) int dura = (int)(duration/1000000000l); int mtime = (int)(mediatime/1000000000l); mediatimesetmaximum(dura); mediatimesetvalue(mtime); public void actionperformed(actionevent e){ <----(5) String actioncommand = egetactioncommand(); if (actioncommandequals(play_btn_action_command)) { controlplay(); else if(actioncommandequals(stop_btn_action_command)) { JSTORM <13/23>
Issued by: < > Revision: <10> <2000/9/1> controlstop(); else if(actioncommandequals(pause_btn_action_command)) { controlpause(); else if(actioncommandequals(ff_btn_action_command)) { controlff(); else if(actioncommandequals(rw_rtp_btn_action_command)) { controlrw(); SampleControlComponent MediaPlayer SampleControlCo mponent displayframesetcontrolcomponent( new SampleControlComponent(player)); < 2> JSTORM <14/23>
Issued by: < > Revision: <10> <2000/9/1> JMF, < 3> < 4> IBS IBS JSTORM <15/23>
Issued by: < > Revision: <10> <2000/9/1> (IBS Server) -> Tuner Server (Tuner Client) -> (Tuner Server) (IBS Server) -> Tunser Server (Tuner Client) -> (Tuner Server) (Tunser Client) -> (Tuner Client) -> (Tuner Server) -> (Tuner Client) (Socket) (Protocol), <2>,, ':', ', ' ', ',',, OpCode, 2 TunerProtocol public class TunerProtocol{ public static final String OP_DELIMITER = ":"; public static final String BROADCASTERINFO_DELIMITER = " "; public static final String DESCRIPTION_DELIMITER = ","; JSTORM <16/23>
Issued by: < > Revision: <10> <2000/9/1> // Operation public static String parseopcode(string str){ StringTokenizer st = new StringTokenizer(str, OP_DELIMITER); if(sthasmoreelements()){ return stnexttoken(); return null; // Message // opcode:message public static String parsemessage(string str){ StringTokenizer st = new StringTokenizer(str, OP_DELIMITER); if(sthasmoreelements()){ stnexttoken(); if(sthasmoreelements()){ return ""; return stnexttoken(); // BroadcasterInfo // address,description address,description address,description public static Vector parsebroadcasterinfo(string str){ StringTokenizer mainst = new StringTokenizer(str, BROADCASTERINFO_DELIMITER); Vector result = new Vector(2); BroadcasterInfo binfo; // while(mainsthasmoreelements()){ StringTokenizer subst = new StringTokenizer(mainSTnextToken(), binfo = new BroadcasterInfo(); binfosetaddress(substnexttoken()); binfosetdescription(substnexttoken()); resultaddelement(binfo); return result; DESCRIPTION_DELIMITER); JSTORM <17/23>
Issued by: < > Revision: <10> <2000/9/1> TunerProtocol TunerProtocol, parseopcode() OP OP String message = ""; try{ message = inputreadutf(); catch(exception e){ eprintstacktrace(); String opcode; opcode = TunerProtocolparseOPCode(message); if(opcode!= null){ if(opcodeequals(tunerserverop_add_server)){ addserver(tunerprotocolparsemessage(message)); else if(opcodeequals(tunerserverop_remove_server)){ removeserver(tunerprotocolparsemessage(message)); else if(opcodeequals(tunerserverop_get_server_info)){ getserverinfo();, opensocket(), OP OPCode':' parsemessage() parsebroadcasterinfo() Vector JSTORM <18/23>
Issued by: < > Revision: <10> <2000/9/1> String message = ""; try{ Socket socket = opensocket(); thisinput = new DataInputStream(socketgetInputStream()); thisoutput = new DataOutputStream(socketgetOutputStream()); outputwriteutf(tunerserverop_get_server_info+":"); // message = inputreadutf(); socketclose(); catch(exception e){ eprintstacktrace(); return new Vector(); Vector binfos = TunerProtocolparseBroadcasterInfo( TunerProtocolparseMessage(message)); return binfos; JSTORM <19/23>
Issued by: < > Revision: <10> <2000/9/1> JMF JMF 20 JMF JAVA Sun JMF IBM, JMF JMF 3 JMF JMF JStorm (http://wwwjstormpekr) JSTORM <20/23>
Issued by: < > Revision: <10> <2000/9/1> JSTORM <21/23>
Issued by: < > Revision: <10> <2000/9/1> CaptureDevice CaptureDevice DataSource DataSource CaptureDevice connect() disconnect() getcapturedeviceinfo getformatcontrol start stop CaptureDeviceInfo FormatControl JSTORM <22/23>
Issued by: < > Revision: <10> <2000/9/1> connect(),, disconnect() getformatcontrols() FormatControl, (1 ), connect() start() stop(), DataSourcestart() stop() CaptureDevicestart, DataSourcestart stop JSTORM <23/23>