[vlc-devel] libvlc_media_descriptor_... setting mrl question
jboileau at gmail.com
Thu Jan 24 22:14:54 CET 2008
Unfortunatly my plan didn't work as well as I had hoped. Here is in a
nutshell what I do in the callback now:
I create a new media descriptor (libvlc_media_descriptor_new)
I add options (libvlc_media_descriptor_add_option)
I set the descriptor (libvlc_media_instance_set_media_descriptor)
I start the play (libvlc_media_instance_play)
The rest I do once at start up:
I create a media instance (libvlc_media_instance_new_from_media_descriptor)
I get the event manager (libvlc_media_instance_event_manager)
I attach to it (libvlc_event_attach)
Now when I am in the event it hangs in the call to
libvlc_media_instance_set_media_descriptor. This happens independently if I
call from the event or if I post myself a message and do it there!
Strange! In an attempt to figure things out I have added a call to
prior to calling libvlc_media_instance_set_media_descriptor. This makes
things work IF not called directly from the event, otherwise it hangs in
Hopefully I have included enough details to help you out.
On Jan 24, 2008 1:32 PM, jboileau <jboileau at gmail.com> wrote:
> Hi Pierre,
> I just took a closer look at the API and I will try creating a media
> instance that will be used for the life of my application and use
> libvlc_media_instance_set_media_descriptor for each new file I play. That
> way I won't release the media instance from inside my event. This seems like
> a much better idea. I'll let you know how it turns out.
> On Jan 24, 2008 9:04 AM, jboileau <jboileau at gmail.com> wrote:
> > Hi Pierre,
> > Well yes the problem is with the release of the media instance and it
> > probably make sense that it hangs there. But I don't know how to do things
> > diffrently. If I need to create a new media descriptor and then get a new
> > media instance from it, if I don't release the previous one won't I end up
> > with memory leaks? Here is what I do in my event callback. Any suggestions
> > on what to do differently for things to work?
> > I detach from the event manager (libvlc_event_detach)
> > I release the media instance (libvlc_media_instance_release)
> > --> and it hangs right here as expected <---
> > I create a new media descriptor (libvlc_media_descriptor_new)
> > I add options (libvlc_media_descriptor_add_option)
> > I create a media instance (
> > libvlc_media_instance_new_from_media_descriptor)
> > I release the media descriptor (libvlc_media_descriptor_release)
> > I get the new event manager (libvlc_media_instance_event_manager)
> > I attach to it (libvlc_event_attach)
> > I start the play (libvlc_media_instance_play)
> > I hope this helps you figure things out. Let me know if you need more
> > details.
> > As always: thanks for your help it is greatly appreciated!
> > Jacques
> > On Jan 23, 2008 5:58 PM, Pierre d'Herbemont <pdherbemont at free.fr>
> > wrote:
> > >
> > > On Jan 23, 2008, at 10:48 PM, jboileau wrote:
> > >
> > > My reason to do that is to be able to start a new play from inside the
> > > libvlc_MediaInstanceReachedEnd event. I may not be doing things
> > > correctly but presently it simply hangs in my callback. Probably because I
> > > am trying to release something that is probably what is calling me back! :-)
> > > The media descriptor. I have circumvented the problem by posting myself a
> > > message (I am working under Windowzzzz) and this lets me do what I want
> > > since in the handler for this message I am out of the
> > > libvlc_MediaInstanceReachedEnd event callback. But I would rather not have
> > > to resort to this double callback scheme to get things working.
> > >
> > >
> > > This is a bit weird cause you shouldn't get issue when releasing the
> > > media descriptor in the media_instance callback, unless you are releasing
> > > the media instance that currently plays the media descriptor.
> > >
> > > Tell me if you encounters more trouble, I'll have a look over the
> > > weekend.
> > >
> > > Pierre.
> > >
> > > _______________________________________________
> > > vlc-devel mailing list
> > > To unsubscribe or modify your subscription options:
> > > http://mailman.videolan.org/listinfo/vlc-devel
> > >
> > >
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vlc-devel