views:

67

answers:

1

hey all , i want to do the following open a Named pipe using java , and extract the content of that archive (rar / zip /etc..) to a named pipe the run mplayer with the location of that pipe and play the movie ,

i tried open the IPC in java using this project CLIPC but , my code is freezing in the fifo.openWriter(); line

 FIFO fifo = new FIFO("jtpc_fifo");
 fifo.create();
 fifo.openWriter();

i tried , to create a small server Socket in java that wait for a connection and send the video file content as raw data , but i dont know how to tell mplayer to get raw data over the network.

i want to use a pipe , cause i think its the best solution no physical and large file to handle ,its volatile and most flexible

thank you

This is what i am trying now , to use sockets but the java server socket accept the connection only after mplayer fail on timeout


mplayer http://localhost:5555/file.raw

 try{


  String file = "D:\\tmp\\lie.to.me.201.the.core.of.it-sitv.mkv";

  ServerSocket socket = new ServerSocket(5555);
  System.out.println("UnrarTest.main() START");
  Socket s = socket.accept();
  System.out.println("UnrarTest.main() ACCEPT");


  final InputStream sin = s.getInputStream();
  new Thread(){
    public void run(){
      try{
        while(true){
          if(sin.available() > 0){
            int read = sin.read();
            System.out.println((char)read);
          }
        }
      }catch(Exception ee){
        ee.printStackTrace();
      }
    }
  }.start();


  final OutputStream sout = s.getOutputStream();
  final FileInputStream fin = new FileInputStream(file);
  new Thread(){
    public void run(){
      try{
        while(fin.available() > 0){
          int in = fin.read();
          System.err.println(in);
          sout.write(in);
        }
      }catch(Exception ee){
        ee.printStackTrace();
      }

    }
  }.start();

}catch(Exception e){
  e.printStackTrace();
}
A: 

I'm not sure how well pipes are supported by CLIPC on Win32 platform (or Win32 itself, for that matter). To save your time use sockets, they are supported on Java/Win32.

Victor Sorokin
i take that in mind as i saied , dont know if mplayer can take raw data from a socket , he needs a familiar protocol for getting data over the network
shay
Sorry, I overlooked that you already have considered sockets. Have you tried something like `mplayer -demuxer rawvideo -rawvideo w=WIDTH:h=HEIGHT http://localhost:port/file.raw`?
Victor Sorokin
this is not working for me ,i update the question with what i am doing now
shay