[vlc-devel] Re: Multiple instances of vlc have incorrect instance references

Tony Anecito adanecito at yahoo.com
Fri May 11 01:20:26 CEST 2007


Hi Filippo,
   
  Thanks for the suggestions. I already did one when I wrote the response you read.
   
  3. override removeNotify to destroy the libvlc instance.
  Did that already in the code.

  public void removeNotify() {
  if (jvlc != null) {
  if (jvlc.isInputPlaying()) {
  try {
  jvlc.playlist.stop();
  } catch (Exception ex) {
  System.out.println("JVLCCanvas.removeNotify exception:" + ex);
  }
  }
  jvlc.destroy();
  }
  super.removeNotify();
  bRemovedPeer=true;
  System.out.println("removeNotify() on ");
  ///new Exception().printStackTrace(System.out);
  }
   
  1. & 2. Done.
  public void addNotify() {
  super.addNotify();
  Graphics g = getPeer().getGraphics();
  jvlc.video.paint(this, g);
  System.out.println("addNotify() on ");
  }
   
   
  Thanks I just tried it and it does not work.
   
  What I need is the answer to my question:
  > So I was curious where in the code the p_vout->p_libvlc is set since
> that is part of the key for the retrieval of the window handle from
> the var_Get( p_vout->p_libvlc, "drawable", &val ) function. The
> other part of the key for retrieval is the "drawable" string.

  Answer that and I can find out about the mysterious extra instance and give you all feedback.
   
  I am still open to other suggestions.
   
  Regards,
  -Tony

Filippo Carone <filippo at carone.org> wrote:
  Tony Anecito ha scritto:
> ...

Hi Tony,
a workaround for avoiding the removal of the first libvlc instance,
could the use of addNotify() and removeNotify() methods, as Daniel
Kaufmann recently suggested to me. Java awt controls implement these 2
methods, which are invoked when the window peer is created (->
addNotify()) and removed (removeNotify()). A test I ask you to do could
do would be:

1. do not implement natively paint(), but leave the default implementation
2. override addNotify to run the current native code used for paint()
3. override removeNotify to destroy the libvlc instance

this could help avoiding the vout window to be created without a peer. 
The problem you exposed could be a missing delay time between the play() 
command and the peer creation. If the operating system has not created 
the peer window and you run play() on jvlc, it will happen vlc will 
spawn a new window.

> Now I run the same test but with only one child with the libvlc video
> step 7 above has matching libvlc instances so get the correct window
> handle back and the video plays int the canvas as expected.

That's normal.

> So I was curious where in the code the p_vout->p_libvlc is set since
> that is part of the key for the retrieval of the window handle from
> the var_Get( p_vout->p_libvlc, "drawable", &val ) function. The
> other part of the key for retrieval is the "drawable" string.
> 
> Does that help more?

Let me know your thoughts about the above suggestion,
cheers,
Filippo

-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html



       
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
 Check outnew cars at Yahoo! Autos.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20070510/228941f4/attachment.html>


More information about the vlc-devel mailing list