JMF + fobs4jmf extra subproces in my aplication

Hi,

I'm developing a multimedia aplication and have the isue, that most programers have. When I closed the player, after stoped it and remove his visula component, etc... The list of subproces don't decrease.

In my code after this I start other player whit and other source. And the result is I have two new proces for every file I play.

In order to find a solution I create a class that is at the same time JInternar frame in order to show the video and implements thread and it's method run create,realized, start, sleep the duration of the media, stop, and close the player. Whit this the palyer is in a separeted thread and when the thread die all resources will be clear(It's I like :P)

This class it's added a JFrame and after this I started the thread, and when it finished the thread dies and all is fine. But the 2 procces extra appear.

The fobs prints that the AVCODEC, after close the player, create and close render; by his own way. I think that it is the isue. Tomorrow I wil paste the print and the code of my class(excuse me all of it's at my work )

I have tried many solutions, but I obtain the same "two extra subprocces" I'm working of this for 2 mounth.

Excuse me my English is too bad and I can't explain this in many lines.

Any help will be apreciate.

[1335 byte] By [almarco_esa] at [2007-11-27 11:45:02]
# 1

This is te class:

public class ContenedorVideoThread extends JInternalFrame implements Runnable{

private Thread hilo = null;

...

public void start()

{

if(hilo == null) {

hilo = new Thread(this);

hilo.start();

}

}

public boolean isAlive()

{

boolean alive=false;

if(hilo != null) {

alive=hilo.isAlive();

}

return alive;

}

public void interrupt()

{

if(hilo != null) {

hilo.interrupt();

}

}

public void run()

{

MediaPlayer player=new MediaPlayer();

try{

MediaLocator locator=new MediaLocator(this.archivo.toURL());

long espera;

player.setMediaLocator(locator);

player.realize();

player.waitForState(MediaPlayer.Realized);

this.add(player.getVisualComponent(),BorderLayout.CENTER);

espera=(player.getDuration().getNanoseconds())/1000000;

player.setPlaybackLoop(false);

player.start();

player.waitForState(MediaPlayer.Started);

this.validate();

this.setVisible(true);

try{

Thread.sleep(espera);

}catch(InterruptedException e){;}

}catch(Exception e){;}

this.remove(player.getVisualComponent());

player.removeAll();

player.stop();

player.waitForState(MediaPlayer.Prefetched);

player.deallocate();

player.waitForState(MediaPlayer.Realized);

player.close();

player=null;

}

}

In the JFrame:

...

this.contenedorVideoThread=new ContenedorVideoThread(...arguments..);

...

Container container=this.getContentPane();

container.add(this.contenedorVideoThread);

this.contenedorVideoThread.start();

//Show the frame and all works fine

//wait during the thread is alive using and other thread

class TiempoEspera extends Thread {

public void run() {

//System.out.println("--> Lanzado thread a "+espera+" segundos");

try

{

while(!interrumpido && !interrupted() && contenedorVideoThread.isAlive())

{

Thread.sleep(100);

}

getContentPane().remove(contenedorVideoThread);

if(!interrumpido) {

Siguiente();

}

}

catch (InterruptedException exception) {

getContentPane().remove(contenedorVideoThread);

}

}

}

The print form AVCODEC:

OpenError: File open error

->MediLocatorSet

AVCODEC: Constructor

->Before realize

AVCODEC: setInputFormat

AVCODEC: setInputFormat >other inputFormat?

AVCODEC: getMatchingOutputFormats

Fobs Java2DRenderer: setInputFormat

AVCODEC: getMatchingOutputFormats

Fobs Java2DRenderer: setInputFormat -->and other time?

AVCODEC: setInputFormat

AVCODEC: getMatchingOutputFormats

AVCODEC: open

AVCODEC: init_decoding

->After realize

Fobs Java2DRenderer: start

->After start

Fobs Java2DRenderer: stop

-> After stop

->Before close

AVCODEC: reset

AVCODEC: close

AVCODEC: open->open and decoding

AVCODEC: init_decoding ->why?what?

AVCODEC: close

->After close

The next time the frame call the method start(), using other file there are 2 new subprocess (making ctrl+alt+sup on window) and 4 o 6 Mb of ram used. The result is after a time(3h aprox) the video apear freeze or the JVM crass.

The solution could be that I created the libraries using JMStudio. I added the fobs jmf.jar and jmf.configuration to the JMStudio path after I added the jffmpeg-1.1.0.jar and follow all the steps to add new formats. Whit all new jars and properties and fobs dll I create the proyect jar seting all in his correct position(if it was wrong the video don't show ;)

I'm lost.

Can any body help?

almarco_esa at 2007-7-29 17:59:29 > top of Java-index,Security,Cryptography...