[vlc-devel] libvlc_MediaInstanceReachedEnd called twice

Pierre d'Herbemont pdherbemont at free.fr
Thu Feb 28 00:24:38 CET 2008


Hi Jacques,

On Feb 27, 2008, at 8:41 PM, jboileau wrote:

> Hum... Looking at the code in media_instance.c in the function
> input_state_changed where the event is sent from, I can see that the u
> member of the event struct is left uninitialized (I think it should at
> least get initialized to 0). It is then not a good idea to rely on an
> uninitialized variable to discern between the two times the event is
> triggered.

The u member is an union meant to be used along with u.event_type if  
defined. There is no u.media_instance_reached_end so this field is not  
meant to be used with libvlc_MediaInstanceReachedEnd.

Of course that's not a bad idea though to initialize its value...

> The best I can do is ignore every other
> libvlc_MediaInstanceReachedEnd event. Something like:
>
> static bool ReceivedFirst = false;
> if (!ReceivedFirst)
> {
>    ReceivedFirst = true;
>    // *** Do my stuff here ****
> }
> else
> {
>    ReceivedFirst = false;
> }

I would rather try to find why this is getting send two times... But  
this is a nice work around that work in some case!

The problem arise from the fact that the media_instance is listening  
to multiple variable to track input_state_change. I'll fix that ASAP.

>
> (I can see I am mostly talking to myself in this thread :-) but hey it
> might serve somebody else, who knows. Anyway most of my colleague's
> wouldn't find it to abnormal for me to be talking to myself! It ain't
> the worst I have done!)

Do you have a sample test app that show what is wrong? I could merge  
it into control/testapi.c. (I'll write one eventually).

Thanks,

Pierre.




More information about the vlc-devel mailing list