I want to open a named pipe using Java and extract the content of that archive (rar / zip /etc..) to a named pipe, then run Mplayer with the location of that pipe and play the movie.
I tried to open 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 waits for a connection and send the video file content as raw data, but I don't 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
This is what I am trying now, to use sockets but the java server socket accept the connection only after mplayer fails 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();
}