]> git.sesse.net Git - vlc/blob - src/interface/interaction.c
82bd8ca429fca9f2121a54e1010960a35da33da9
[vlc] / src / interface / interaction.c
1 /*****************************************************************************
2  * interaction.c: User interaction functions
3  *****************************************************************************
4  * Copyright © 2005-2008 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Clément Stenac <zorglub@videolan.org>
8  *          Felix Kühne <fkuehne@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 /**
26  *   \file
27  *   This file contains functions related to user interaction management
28  */
29
30 /*****************************************************************************
31  * Preamble
32  *****************************************************************************/
33
34 #ifdef HAVE_CONFIG_H
35 # include "config.h"
36 #endif
37
38 #include <vlc_common.h>
39
40 #include <vlc_interface.h>
41 #include "interface.h"
42 #include "libvlc.h"
43
44 #include <assert.h>
45
46 /*****************************************************************************
47  * Local prototypes
48  *****************************************************************************/
49
50 /**
51  * This structure contains the active interaction dialogs, and is
52  * used by the manager
53  */
54 struct interaction_t
55 {
56     VLC_COMMON_MEMBERS
57
58     vlc_thread_t thread;
59     vlc_cond_t wait;
60
61     int                         i_dialogs;      ///< Number of dialogs
62     interaction_dialog_t      **pp_dialogs;     ///< Dialogs
63     intf_thread_t              *p_intf;         ///< Interface to use
64     int                         i_last_id;      ///< Last attributed ID
65 };
66
67 static interaction_t *          InteractionGet( vlc_object_t * );
68 static intf_thread_t *          SearchInterface( interaction_t * );
69 static void*                    InteractionLoop( void * );
70 static void                     InteractionManage( interaction_t * );
71
72 static interaction_dialog_t    *DialogGetById( interaction_t* , int );
73 static void                     DialogDestroy( interaction_dialog_t * );
74 static int DialogSend( vlc_object_t *, interaction_dialog_t * );
75
76 #define DIALOG_INIT( type ) \
77         interaction_dialog_t* p_new = calloc( 1, sizeof( interaction_dialog_t ) ); \
78         if( !p_new ) return VLC_EGENERIC;               \
79         p_new->b_cancelled = false;                     \
80         p_new->i_status = NEW_DIALOG;                   \
81         p_new->i_flags = 0;                             \
82         p_new->i_type = INTERACT_DIALOG_##type;         \
83         p_new->psz_returned[0] = NULL;                  \
84         p_new->psz_returned[1] = NULL
85
86 #define FORMAT_DESC \
87         va_start( args, psz_format ); \
88         if( vasprintf( &p_new->psz_description, psz_format, args ) == -1 ) \
89             return VLC_EGENERIC; \
90         va_end( args )
91
92 /**
93  * Send an error message, both in a blocking and non-blocking way
94  *
95  * \param p_this     Parent vlc_object
96  * \param b_blocking Is this dialog blocking or not?
97  * \param psz_title  Title for the dialog
98  * \param psz_format The message to display
99  * \return           VLC_SUCCESS or VLC_EGENERIC
100  */
101 int __intf_UserFatal( vlc_object_t *p_this, bool b_blocking,
102                        const char *psz_title,
103                        const char *psz_format, ... )
104 {
105     va_list args;
106     DIALOG_INIT( ONEWAY );
107
108     p_new->psz_title = strdup( psz_title );
109     FORMAT_DESC;
110
111     if( b_blocking )
112         p_new->i_flags = DIALOG_BLOCKING_ERROR;
113     else
114         p_new->i_flags = DIALOG_NONBLOCKING_ERROR;
115
116     return DialogSend( p_this, p_new );
117 }
118
119 /**
120  * Helper function to send a warning, which is always shown non-blocking
121  *
122  * \param p_this     Parent vlc_object
123  * \param psz_title  Title for the dialog
124  * \param psz_format The message to display
125  * \return           VLC_SUCCESS or VLC_EGENERIC
126  */
127 int __intf_UserWarn( vlc_object_t *p_this,
128                      const char *psz_title,
129                      const char *psz_format, ... )
130 {
131     va_list args;
132     DIALOG_INIT( ONEWAY );
133
134     p_new->psz_title = strdup( psz_title );
135     FORMAT_DESC;
136
137     p_new->i_flags = DIALOG_WARNING;
138
139     return DialogSend( p_this, p_new );
140 }
141
142 /**
143  * Helper function to ask a yes-no-cancel question
144  *
145  * \param p_this           Parent vlc_object
146  * \param psz_title        Title for the dialog
147  * \param psz_description  A description
148  * \param psz_default      caption for the default button
149  * \param psz_alternate    caption for the alternate button
150  * \param psz_other        caption for the optional 3rd button (== cancel)
151  * \return                 Clicked button code
152  */
153 int __intf_UserYesNo( vlc_object_t *p_this,
154                       const char *psz_title,
155                       const char *psz_description,
156                       const char *psz_default,
157                       const char *psz_alternate,
158                       const char *psz_other )
159 {
160     DIALOG_INIT( TWOWAY );
161
162     p_new->psz_title = strdup( psz_title );
163     p_new->psz_description = strdup( psz_description );
164     p_new->i_flags = DIALOG_YES_NO_CANCEL;
165     p_new->psz_default_button = strdup( psz_default );
166     p_new->psz_alternate_button = strdup( psz_alternate );
167     if( psz_other )
168         p_new->psz_other_button = strdup( psz_other );
169
170     return DialogSend( p_this, p_new );
171 }
172
173 /**
174  * Helper function to create a dialogue showing a progress-bar with some info
175  *
176  * \param p_this           Parent vlc_object
177  * \param psz_title        Title for the dialog (NULL implies main intf )
178  * \param psz_status       Current status
179  * \param f_position       Current position (0.0->100.0)
180  * \param i_timeToGo       Time (in sec) to go until process is finished
181  * \return                 Dialog id, to give to UserProgressUpdate
182  */
183 int __intf_Progress( vlc_object_t *p_this, const char *psz_title,
184                      const char *psz_status, float f_pos, int i_time )
185 {
186     DIALOG_INIT( ONEWAY );
187     p_new->psz_description = strdup( psz_status );
188     p_new->val.f_float = f_pos;
189     p_new->i_timeToGo = i_time;
190     p_new->psz_alternate_button = strdup( _( "Cancel" ) );
191
192     if( psz_title )
193     {
194         p_new->psz_title = strdup( psz_title );
195         p_new->i_flags = DIALOG_USER_PROGRESS;
196     }
197     else
198         p_new->i_flags = DIALOG_INTF_PROGRESS;
199
200     DialogSend( p_this, p_new );
201     return p_new->i_id;
202 }
203
204 /**
205  * Update a progress bar in a dialogue
206  *
207  * \param p_this           Parent vlc_object
208  * \param i_id             Identifier of the dialog
209  * \param psz_status       New status
210  * \param f_position       New position (0.0->100.0)
211  * \param i_timeToGo       Time (in sec) to go until process is finished
212  * \return                 nothing
213  */
214 void __intf_ProgressUpdate( vlc_object_t *p_this, int i_id,
215                             const char *psz_status, float f_pos, int i_time )
216 {
217     interaction_t *p_interaction = InteractionGet( p_this );
218     interaction_dialog_t *p_dialog;
219
220     if( !p_interaction ) return;
221
222     vlc_object_lock( p_interaction );
223     p_dialog  =  DialogGetById( p_interaction, i_id );
224
225     if( !p_dialog )
226     {
227         vlc_object_unlock( p_interaction );
228         vlc_object_release( p_interaction );
229         return;
230     }
231
232     free( p_dialog->psz_description );
233     p_dialog->psz_description = strdup( psz_status );
234
235     p_dialog->val.f_float = f_pos;
236     p_dialog->i_timeToGo = i_time;
237
238     p_dialog->i_status = UPDATED_DIALOG;
239
240     vlc_cond_signal( &p_interaction->wait );
241     vlc_object_unlock( p_interaction );
242     vlc_object_release( p_interaction );
243 }
244
245 /**
246  * Helper function to communicate dialogue cancellations between the
247  * interface module and the caller
248  *
249  * \param p_this           Parent vlc_object
250  * \param i_id             Identifier of the dialogue
251  * \return                 Either true or false
252  */
253 bool __intf_UserProgressIsCancelled( vlc_object_t *p_this, int i_id )
254 {
255     interaction_t *p_interaction = InteractionGet( p_this );
256     interaction_dialog_t *p_dialog;
257     bool b_cancel;
258
259     if( !p_interaction ) return true;
260
261     vlc_object_lock( p_interaction );
262     p_dialog  =  DialogGetById( p_interaction, i_id );
263     if( !p_dialog )
264     {
265         vlc_object_unlock( p_interaction ) ;
266         vlc_object_release( p_interaction );
267         return true;
268     }
269
270     b_cancel = p_dialog->b_cancelled;
271     vlc_object_unlock( p_interaction );
272     vlc_object_release( p_interaction );
273     return b_cancel;
274 }
275
276 /**
277  * Helper function to make a login/password dialogue
278  *
279  * \param p_this           Parent vlc_object
280  * \param psz_title        Title for the dialog
281  * \param psz_description  A description
282  * \param ppsz_login       Returned login
283  * \param ppsz_password    Returned password
284  * \return                 Clicked button code
285  */
286 int __intf_UserLoginPassword( vlc_object_t *p_this,
287         const char *psz_title,
288         const char *psz_description,
289         char **ppsz_login,
290         char **ppsz_password )
291 {
292     int i_ret;
293     DIALOG_INIT( TWOWAY );
294     p_new->i_type = INTERACT_DIALOG_TWOWAY;
295     p_new->psz_title = strdup( psz_title );
296     p_new->psz_description = strdup( psz_description );
297     p_new->psz_default_button = strdup( _("OK" ) );
298     p_new->psz_alternate_button = strdup( _("Cancel" ) );
299
300     p_new->i_flags = DIALOG_LOGIN_PW_OK_CANCEL;
301
302     i_ret = DialogSend( p_this, p_new );
303
304     if( i_ret != DIALOG_CANCELLED && i_ret != VLC_EGENERIC )
305     {
306         *ppsz_login = p_new->psz_returned[0]?
307             strdup( p_new->psz_returned[0] ) : NULL;
308         *ppsz_password = p_new->psz_returned[1]?
309             strdup( p_new->psz_returned[1] ) : NULL;
310     }
311     return i_ret;
312 }
313
314 /**
315  * Helper function to make a dialogue asking the user for !password string
316  *
317  * \param p_this           Parent vlc_object
318  * \param psz_title        Title for the dialog
319  * \param psz_description  A description
320  * \param ppsz_usersString Returned login
321  * \return                 Clicked button code
322  */
323 int __intf_UserStringInput( vlc_object_t *p_this,
324         const char *psz_title,
325         const char *psz_description,
326         char **ppsz_usersString )
327 {
328     int i_ret;
329     DIALOG_INIT( TWOWAY );
330     p_new->i_type = INTERACT_DIALOG_TWOWAY;
331     p_new->psz_title = strdup( psz_title );
332     p_new->psz_description = strdup( psz_description );
333
334     p_new->i_flags = DIALOG_PSZ_INPUT_OK_CANCEL;
335
336     i_ret = DialogSend( p_this, p_new );
337
338     if( i_ret != DIALOG_CANCELLED )
339     {
340         *ppsz_usersString = p_new->psz_returned[0]?
341             strdup( p_new->psz_returned[0] ) : NULL;
342     }
343     return i_ret;
344 }
345
346 /**
347  * Hide an interaction dialog
348  *
349  * \param p_this the parent vlc object
350  * \param i_id the id of the item to hide
351  * \return nothing
352  */
353 void __intf_UserHide( vlc_object_t *p_this, int i_id )
354 {
355     interaction_t *p_interaction = InteractionGet( p_this );
356     interaction_dialog_t *p_dialog;
357
358     if( !p_interaction ) return;
359
360     vlc_object_lock( p_interaction );
361     p_dialog = DialogGetById( p_interaction, i_id );
362
363     if( p_dialog )
364     {
365         p_dialog->i_status = ANSWERED_DIALOG;
366         vlc_cond_signal( &p_interaction->wait );
367     }
368
369     vlc_object_unlock( p_interaction );
370     vlc_object_release( p_interaction );
371 }
372
373 /**
374  * Create the initial interaction object
375  * (should only be used in libvlc_InternalInit, LibVLC private)
376  *
377  * \return a vlc_object_t that should be freed when done.
378  */
379 interaction_t * interaction_Init( libvlc_int_t *p_libvlc )
380 {
381     interaction_t *p_interaction;
382
383     /* Make sure we haven't yet created an interaction object */
384     assert( libvlc_priv(p_libvlc)->p_interaction == NULL );
385
386     p_interaction = vlc_custom_create( VLC_OBJECT(p_libvlc),
387                                        sizeof( *p_interaction ),
388                                        VLC_OBJECT_GENERIC, "interaction" );
389     if( !p_interaction )
390         return NULL;
391
392     vlc_object_attach( p_interaction, p_libvlc );
393     p_interaction->i_dialogs = 0;
394     p_interaction->pp_dialogs = NULL;
395     p_interaction->p_intf = NULL;
396     p_interaction->i_last_id = 0;
397
398     vlc_cond_init( &p_interaction->wait );
399
400     if( vlc_clone( &p_interaction->thread, InteractionLoop, p_interaction,
401                    VLC_THREAD_PRIORITY_LOW ) )
402     {
403         msg_Err( p_interaction, "Interaction control thread creation failed, "
404                  "interaction will not be displayed" );
405         vlc_object_detach( p_interaction );
406         vlc_object_release( p_interaction );
407         return NULL;
408     }
409
410     return p_interaction;
411 }
412
413 void interaction_Destroy( interaction_t *p_interaction )
414 {
415     if( !p_interaction )
416         return;
417
418     vlc_cancel( p_interaction->thread );
419     vlc_join( p_interaction->thread, NULL );
420     vlc_cond_destroy( &p_interaction->wait );
421
422     /* Remove all dialogs - Interfaces must be able to clean up their data */
423     for( int i = p_interaction->i_dialogs -1 ; i >= 0; i-- )
424     {
425         interaction_dialog_t * p_dialog = p_interaction->pp_dialogs[i];
426         DialogDestroy( p_dialog );
427         REMOVE_ELEM( p_interaction->pp_dialogs, p_interaction->i_dialogs, i );
428     }
429     vlc_object_release( p_interaction );
430 }
431
432 static vlc_mutex_t intf_lock = VLC_STATIC_MUTEX;
433
434 int interaction_Register( intf_thread_t *intf )
435 {
436     libvlc_priv_t *priv = libvlc_priv( intf->p_libvlc );
437     int ret = VLC_EGENERIC;
438
439     vlc_mutex_lock( &intf_lock );
440     if( priv->p_interaction_intf == NULL )
441     {   /* Since the interface is responsible for unregistering itself before
442          * it terminates, an object reference is not needed. */
443         priv->p_interaction_intf = intf;
444         ret = VLC_SUCCESS;
445     }
446     vlc_mutex_unlock( &intf_lock );
447     return ret;
448 }
449
450 int interaction_Unregister( intf_thread_t *intf )
451 {
452     libvlc_priv_t *priv = libvlc_priv( intf->p_libvlc );
453     int ret = VLC_EGENERIC;
454
455     vlc_mutex_lock( &intf_lock );
456     if( priv->p_interaction_intf == intf )
457     {
458         priv->p_interaction_intf = NULL;
459         ret = VLC_SUCCESS;
460     }
461     vlc_mutex_unlock( &intf_lock );
462     return ret;
463 }
464
465 /**********************************************************************
466  * The following functions are local
467  **********************************************************************/
468
469 /* Get the interaction object. Create it if needed */
470 static interaction_t * InteractionGet( vlc_object_t *p_this )
471 {
472     interaction_t *obj = libvlc_priv(p_this->p_libvlc)->p_interaction;
473     if( obj )
474         vlc_object_hold( obj );
475     return obj;
476 }
477
478
479 /* Look for an interface suitable for interaction, and hold it. */
480 static intf_thread_t *SearchInterface( interaction_t *p_interaction )
481 {
482     libvlc_priv_t *priv = libvlc_priv( p_interaction->p_libvlc );
483     intf_thread_t *intf;
484
485     vlc_mutex_lock( &intf_lock );
486     intf = priv->p_interaction_intf;
487     if( intf != NULL )
488         vlc_object_hold( intf );
489     vlc_mutex_unlock( &intf_lock );
490
491     return intf;
492 }
493
494 /* Find an interaction dialog by its id */
495 static interaction_dialog_t *DialogGetById( interaction_t *p_interaction,
496                                             int i_id )
497 {
498     int i;
499     for( i = 0 ; i< p_interaction->i_dialogs; i++ )
500     {
501         if( p_interaction->pp_dialogs[i]->i_id == i_id )
502             return p_interaction->pp_dialogs[i];
503     }
504     return NULL;
505 }
506
507 /* Destroy a dialog */
508 static void DialogDestroy( interaction_dialog_t *p_dialog )
509 {
510     free( p_dialog->psz_title );
511     free( p_dialog->psz_description );
512     free( p_dialog->psz_default_button );
513     free( p_dialog->psz_alternate_button );
514     free( p_dialog->psz_other_button );
515     free( p_dialog );
516 }
517
518 /* Ask for the dialog to be sent to the user. Wait for answer
519  * if required */
520 static int DialogSend( vlc_object_t *p_this, interaction_dialog_t *p_dialog )
521 {
522     interaction_t *p_interaction = InteractionGet( p_this );
523
524     if( !p_interaction )
525         return VLC_EGENERIC;
526
527     /* Get an id, if we don't already have one */
528     vlc_object_lock( p_interaction );
529     if( p_dialog->i_id == 0 )
530         p_dialog->i_id = ++p_interaction->i_last_id;
531     vlc_object_unlock( p_interaction );
532
533     if( p_this->i_flags & OBJECT_FLAGS_NOINTERACT )
534     {
535         vlc_object_release( p_interaction );
536         return VLC_EGENERIC;
537     }
538
539     if( config_GetInt( p_this, "interact" ) ||
540         p_dialog->i_flags & DIALOG_BLOCKING_ERROR ||
541         p_dialog->i_flags & DIALOG_NONBLOCKING_ERROR )
542     {
543         bool b_found = false;
544         int i;
545         p_dialog->p_interaction = p_interaction;
546         p_dialog->p_parent = p_this;
547
548         /* Check if we have already added this dialog */
549         vlc_object_lock( p_interaction );
550         for( i = 0 ; i< p_interaction->i_dialogs; i++ )
551         {
552             if( p_interaction->pp_dialogs[i]->i_id == p_dialog->i_id )
553                 b_found = true;
554         }
555         /* Add it to the queue, the main loop will send the orders to the
556          * interface */
557         if( ! b_found )
558         {
559             INSERT_ELEM( p_interaction->pp_dialogs,
560                          p_interaction->i_dialogs,
561                          p_interaction->i_dialogs,
562                          p_dialog );
563         }
564         else
565             p_dialog->i_status = UPDATED_DIALOG;
566
567         if( p_dialog->i_type == INTERACT_DIALOG_TWOWAY ) /* Wait for answer */
568         {
569             vlc_cond_signal( &p_interaction->wait );
570             while( p_dialog->i_status != ANSWERED_DIALOG &&
571                    p_dialog->i_status != HIDING_DIALOG &&
572                    p_dialog->i_status != HIDDEN_DIALOG &&
573                    !p_dialog->p_parent->b_die )
574             {
575                 vlc_object_unlock( p_interaction );
576                 msleep( 100000 );
577                 vlc_object_lock( p_interaction );
578             }
579             if( p_dialog->p_parent->b_die )
580             {
581                 p_dialog->i_return = DIALOG_CANCELLED;
582                 p_dialog->i_status = ANSWERED_DIALOG;
583             }
584             p_dialog->i_flags |= DIALOG_GOT_ANSWER;
585             vlc_cond_signal( &p_interaction->wait );
586             vlc_object_unlock( p_interaction );
587             vlc_object_release( p_interaction );
588             return p_dialog->i_return;
589         }
590         else
591         {
592             /* Pretend we already retrieved the "answer" */
593             p_dialog->i_flags |=  DIALOG_GOT_ANSWER;
594             vlc_cond_signal( &p_interaction->wait );
595             vlc_object_unlock( p_interaction );
596             vlc_object_release( p_interaction );
597             return VLC_SUCCESS;
598         }
599     }
600     else
601     {
602         vlc_object_release( p_interaction );
603         return VLC_EGENERIC;
604     }
605 }
606
607 static void* InteractionLoop( void *p_this )
608 {
609     interaction_t *p_interaction = p_this;
610
611     vlc_object_lock( p_interaction );
612     mutex_cleanup_push( &(vlc_internals(p_interaction)->lock) );
613     for( ;; )
614     {
615         int canc = vlc_savecancel();
616         InteractionManage( p_interaction );
617         vlc_restorecancel( canc );
618
619         vlc_cond_wait( &p_interaction->wait, &(vlc_internals(p_interaction)->lock) );
620     }
621     vlc_cleanup_pop( );
622     assert( 0 );
623 }
624
625 /**
626  * The main interaction processing loop
627  *
628  * \param p_interaction the interaction object
629  * \return nothing
630  */
631
632 static void InteractionManage( interaction_t *p_interaction )
633 {
634     vlc_value_t val;
635     int i_index;
636
637     /* Nothing to do */
638     if( p_interaction->i_dialogs == 0 ) return;
639
640     p_interaction->p_intf = SearchInterface( p_interaction );
641     if( !p_interaction->p_intf )
642     {
643         /* We mark all dialogs as answered with their "default" answer */
644         for( i_index = 0 ; i_index < p_interaction->i_dialogs; i_index ++ )
645         {
646             interaction_dialog_t *p_dialog = p_interaction->pp_dialogs[i_index];
647             p_dialog->i_return = DIALOG_DEFAULT; /* Give default answer */
648
649             /* Pretend we have hidden and destroyed it */
650             if( p_dialog->i_status == HIDDEN_DIALOG )
651                 p_dialog->i_status = DESTROYED_DIALOG;
652             else
653                 p_dialog->i_status = HIDING_DIALOG;
654         }
655     }
656
657     for( i_index = 0 ; i_index < p_interaction->i_dialogs; i_index ++ )
658     {
659         interaction_dialog_t *p_dialog = p_interaction->pp_dialogs[i_index];
660         switch( p_dialog->i_status )
661         {
662         case ANSWERED_DIALOG:
663             /* Ask interface to hide it */
664             p_dialog->i_action = INTERACT_HIDE;
665             val.p_address = p_dialog;
666             if( p_interaction->p_intf )
667                 var_Set( p_interaction->p_intf, "interaction", val );
668             p_dialog->i_status = HIDING_DIALOG;
669             break;
670         case UPDATED_DIALOG:
671             p_dialog->i_action = INTERACT_UPDATE;
672             val.p_address = p_dialog;
673             if( p_interaction->p_intf )
674                 var_Set( p_interaction->p_intf, "interaction", val );
675             p_dialog->i_status = SENT_DIALOG;
676             break;
677         case HIDDEN_DIALOG:
678             if( !(p_dialog->i_flags & DIALOG_GOT_ANSWER) ) break;
679             p_dialog->i_action = INTERACT_DESTROY;
680             val.p_address = p_dialog;
681             if( p_interaction->p_intf )
682                 var_Set( p_interaction->p_intf, "interaction", val );
683             break;
684         case DESTROYED_DIALOG:
685             /* Interface has now destroyed it, remove it */
686             REMOVE_ELEM( p_interaction->pp_dialogs, p_interaction->i_dialogs,
687                          i_index);
688             i_index--;
689             DialogDestroy( p_dialog );
690             break;
691         case NEW_DIALOG:
692             /* This is truly a new dialog, send it. */
693
694             p_dialog->i_action = INTERACT_NEW;
695             val.p_address = p_dialog;
696             if( p_interaction->p_intf )
697                 var_Set( p_interaction->p_intf, "interaction", val );
698             p_dialog->i_status = SENT_DIALOG;
699             break;
700         }
701     }
702
703     if( p_interaction->p_intf )
704         vlc_object_release( p_interaction->p_intf );
705 }