1 /*****************************************************************************
2 * cddax.c : CD digital audio input module for vlc using libcdio
3 *****************************************************************************
4 * Copyright (C) 2000,2003 VideoLAN
5 * $Id: cdda.c,v 1.1 2003/11/26 01:32:52 rocky Exp $
7 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8 * Gildas Bazin <gbazin@netcourrier.com>
9 * Rocky Bernstein <rocky@panix.com>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
24 *****************************************************************************/
26 /*****************************************************************************
28 *****************************************************************************/
34 #include <vlc/input.h>
35 #include <sys/types.h>
36 #include <cdio/cdio.h>
37 #include <cdio/cd_types.h>
48 #include "../vcdx/cdrom.h"
50 /* how many blocks E_(Open) will read in each loop */
51 #define CDDA_BLOCKS_ONCE 1
52 #define CDDA_DATA_ONCE (CDDA_BLOCKS_ONCE * CDIO_CD_FRAMESIZE_RAW)
54 /*****************************************************************************
55 * cdda_data_t: CD audio information
56 *****************************************************************************/
57 typedef struct cdda_data_s
59 cddev_t *p_cddev; /* CD device descriptor */
60 int i_nb_tracks; /* Nb of tracks (titles) */
61 int i_track; /* Current track */
62 lsn_t i_sector; /* Current Sector */
63 lsn_t * p_sectors; /* Track sectors */
64 vlc_bool_t b_end_of_track; /* If the end of track was reached */
65 int i_debug; /* Debugging mask */
66 intf_thread_t *p_intf;
70 /*****************************************************************************
72 *****************************************************************************/
73 #define INPUT_DBG_MRL 1
74 #define INPUT_DBG_EVENT 2 /* Trace keyboard events */
75 #define INPUT_DBG_EXT 4 /* Calls from external routines */
76 #define INPUT_DBG_CALL 8 /* all calls */
77 #define INPUT_DBG_LSN 16 /* LSN changes */
78 #define INPUT_DBG_CDIO 32 /* Debugging from CDIO */
79 #define INPUT_DBG_SEEK 64 /* Seeks to set location */
81 #define DEBUG_TEXT N_("set debug mask for additional debugging.")
82 #define DEBUG_LONGTEXT N_( \
83 "This integer when viewed in binary is a debugging mask\n" \
92 #define DEV_TEXT N_("CD-ROM device name")
93 #define DEV_LONGTEXT N_( \
94 "Specify the name of the CD-ROM device that will be used by default. " \
95 "If you don't specify anything, we'll scan for a suitable CD-ROM device.")
99 #define dbg_print(mask, s, args...) \
100 if (p_cdda->i_debug & mask) \
101 msg_Dbg(p_input, "%s: "s, __func__ , ##args)
103 #define dbg_print(mask, s, args...)
106 /*****************************************************************************
107 * intf_sys_t: description and status of interface
108 *****************************************************************************/
111 input_thread_t * p_input;
112 cdda_data_t * p_cdda;
113 vlc_bool_t b_click, b_move, b_key_pressed;
116 /* FIXME: This variable is a hack. Would be nice to eliminate. */
117 static input_thread_t *p_cdda_input = NULL;
119 /*****************************************************************************
121 *****************************************************************************/
122 static int E_(Open) ( vlc_object_t * );
123 static void E_(Close) ( vlc_object_t * );
124 static int E_(OpenIntf) ( vlc_object_t * );
125 static void E_(CloseIntf) ( vlc_object_t * );
127 static int CDDARead ( input_thread_t *, byte_t *, size_t );
128 static void CDDASeek ( input_thread_t *, off_t );
129 static int CDDASetArea ( input_thread_t *, input_area_t * );
130 static int CDDAPlay ( input_thread_t *, int );
131 static int CDDASetProgram ( input_thread_t *, pgrm_descriptor_t * );
133 static int InitThread ( intf_thread_t *p_intf );
134 static int KeyEvent ( vlc_object_t *, char const *,
135 vlc_value_t, vlc_value_t, void * );
137 static void RunIntf ( intf_thread_t *p_intf );
139 static int E_(DebugCallback) ( vlc_object_t *p_this, const char *psz_name,
140 vlc_value_t oldval, vlc_value_t val,
143 /*****************************************************************************
145 *****************************************************************************/
147 static int DemuxOpen ( vlc_object_t * );
148 static void DemuxClose ( vlc_object_t * );
150 #define CACHING_TEXT N_("Caching value in ms")
151 #define CACHING_LONGTEXT N_( \
152 "Allows you to modify the default caching value for cdda streams. This " \
153 "value should be set in miliseconds units." )
156 add_usage_hint( N_("cddax://[device-or-file][@num]") );
157 set_description( _("Compact Disc Digital Audio (CD-DA) input") );
158 set_capability( "access", 75 /* slightly higher than cdda */ );
159 add_integer( "cddax-caching", DEFAULT_PTS_DELAY / 1000, NULL, CACHING_TEXT, CACHING_LONGTEXT, VLC_TRUE );
160 set_callbacks( E_(Open), E_(Close) );
161 add_shortcut( "cdda" );
162 add_shortcut( "cddax" );
164 /* Configuration options */
165 add_category_hint( N_("CDX"), NULL, VLC_TRUE );
166 add_integer ( MODULE_STRING "-debug", 0, E_(DebugCallback), DEBUG_TEXT,
167 DEBUG_LONGTEXT, VLC_TRUE );
168 add_string( MODULE_STRING "-device", "", NULL, DEV_TEXT,
169 DEV_LONGTEXT, VLC_TRUE );
172 set_description( _("CD Audio demux") );
173 set_capability( "demux", 0 );
174 set_callbacks( DemuxOpen, DemuxClose );
175 add_shortcut( "cdda" );
178 set_capability( "interface", 0 );
179 set_callbacks( E_(OpenIntf), E_(CloseIntf) );
183 /****************************************************************************
185 ****************************************************************************/
188 E_(DebugCallback) ( vlc_object_t *p_this, const char *psz_name,
189 vlc_value_t oldval, vlc_value_t val, void *p_data )
193 if (NULL == p_cdda_input) return VLC_EGENERIC;
195 p_cdda = (cdda_data_t *)p_cdda_input->p_access_data;
197 if (p_cdda->i_debug & (INPUT_DBG_CALL|INPUT_DBG_EXT)) {
198 msg_Dbg( p_cdda_input, "Old debug (x%0x) %d, new debug (x%0x) %d",
199 p_cdda->i_debug, p_cdda->i_debug, val.i_int, val.i_int);
201 p_cdda->i_debug = val.i_int;
205 /* process messages that originate from libcdio. */
207 cdio_log_handler (cdio_log_level_t level, const char message[])
209 cdda_data_t *p_cdda = (cdda_data_t *)p_cdda_input->p_access_data;
213 if (p_cdda->i_debug & INPUT_DBG_CDIO)
214 msg_Dbg( p_cdda_input, message);
217 msg_Warn( p_cdda_input, message);
220 case CDIO_LOG_ASSERT:
221 msg_Err( p_cdda_input, message);
224 msg_Warn( p_cdda_input, message,
225 _("The above message had unknown vcdimager log level"),
232 /*****************************************************************************
233 * E_(Open): open cdda
234 *****************************************************************************/
235 static int E_(Open)( vlc_object_t *p_this )
237 input_thread_t * p_input = (input_thread_t *)p_this;
241 cdda_data_t * p_cdda;
246 /* Set where to log errors messages from libcdio. */
247 p_cdda_input = (input_thread_t *)p_this;
249 /* parse the options passed in command line : */
250 psz_orig = psz_parser = psz_source = strdup( p_input->psz_name );
257 while( *psz_parser && *psz_parser != '@' )
262 if( *psz_parser == '@' )
268 if ('T' == *psz_parser || 't' == *psz_parser )
271 i_title = (int)strtol( psz_parser, NULL, 10 );
272 i_title = i_title ? i_title : 1;
276 /* No source specified, so figure it out. */
277 if( !p_input->psz_access ) {
281 psz_source = config_GetPsz( p_input, MODULE_STRING "-device" );
283 if( !psz_source || 0==strlen(psz_source) ) {
284 /* Scan for a CD-ROM drive with a CD-DA in it. */
286 cdio_get_devices_with_cap(NULL, CDIO_FS_AUDIO, false);
287 if (NULL == cd_drives) return -1;
288 if (cd_drives[0] == NULL) {
289 cdio_free_device_list(cd_drives);
292 psz_source = strdup(cd_drives[0]);
293 cdio_free_device_list(cd_drives);
298 cdio_log_set_handler ( cdio_log_handler );
300 if( !(p_cddev = ioctl_Open( p_this, psz_source )) )
302 msg_Warn( p_input, "could not open %s", psz_source );
308 p_cdda = malloc( sizeof(cdda_data_t) );
311 msg_Err( p_input, "out of memory" );
316 p_cdda->p_cddev = p_cddev;
317 p_cdda->i_debug = config_GetInt( p_this, MODULE_STRING "-debug" );
318 p_input->p_access_data = (void *)p_cdda;
320 dbg_print( (INPUT_DBG_CALL|INPUT_DBG_EXT), "%s", psz_source );
322 p_input->i_mtu = CDDA_DATA_ONCE;
324 /* We read the Table Of Content information */
325 p_cdda->i_nb_tracks = ioctl_GetTracksMap( VLC_OBJECT(p_input),
326 p_cdda->p_cddev->cdio, &p_cdda->p_sectors );
327 if( p_cdda->i_nb_tracks < 0 )
328 msg_Err( p_input, "unable to count tracks" );
329 else if( p_cdda->i_nb_tracks <= 0 )
330 msg_Err( p_input, "no audio tracks found" );
332 if( p_cdda->i_nb_tracks <= 1)
334 ioctl_Close( p_cdda->p_cddev );
339 if( i_title >= p_cdda->i_nb_tracks || i_title < 1 )
342 /* Set stream and area data */
343 vlc_mutex_lock( &p_input->stream.stream_lock );
345 /* Initialize ES structures */
346 input_InitStream( p_input, 0 );
348 /* cdda input method */
349 p_input->stream.i_method = INPUT_METHOD_CDDA;
351 p_input->stream.b_pace_control = 1;
352 p_input->stream.b_seekable = 1;
353 p_input->stream.i_mux_rate = 44100 * 4 / 50;
355 #define area p_input->stream.pp_areas
356 for( i = 1 ; i <= p_cdda->i_nb_tracks ; i++ )
358 input_AddArea( p_input, i, 1 );
360 /* Absolute start offset and size */
362 (off_t)p_cdda->p_sectors[i-1] * (off_t)CDIO_CD_FRAMESIZE_RAW;
364 (off_t)(p_cdda->p_sectors[i] - p_cdda->p_sectors[i-1])
365 * (off_t)CDIO_CD_FRAMESIZE_RAW;
369 CDDAPlay( p_input, i_title);
371 vlc_mutex_unlock( &p_input->stream.stream_lock );
373 if( !p_input->psz_demux || !*p_input->psz_demux )
375 p_input->psz_demux = "cdda";
378 p_input->pf_read = CDDARead;
379 p_input->pf_seek = CDDASeek;
380 p_input->pf_set_area = CDDASetArea;
381 p_input->pf_set_program = CDDASetProgram;
383 /* Update default_pts to a suitable value for cdda access */
384 p_input->i_pts_delay = config_GetInt( p_input,
385 MODULE_STRING "-caching" ) * 1000;
387 p_cdda->p_intf = intf_Create( p_input, "cddax" );
388 intf_RunThread( p_cdda->p_intf );
393 /*****************************************************************************
394 * CDDAPlay: Arrange things play track
395 *****************************************************************************/
397 CDDAPlay( input_thread_t *p_input, int i_track )
399 cdda_data_t *p_cdda = (cdda_data_t *) p_input->p_access_data;
401 if( i_track >= p_cdda->i_nb_tracks || i_track < 1 )
404 CDDASetArea( p_input, p_input->stream.pp_areas[i_track] );
408 /*****************************************************************************
409 * E_(Close): closes cdda
410 *****************************************************************************/
412 E_(Close)( vlc_object_t *p_this )
414 input_thread_t * p_input = (input_thread_t *)p_this;
415 cdda_data_t *p_cdda = (cdda_data_t *)p_input->p_access_data;
417 dbg_print( (INPUT_DBG_CALL|INPUT_DBG_EXT), "" );
418 ioctl_Close( p_cdda->p_cddev );
423 /*****************************************************************************
424 * CDDARead: reads from the CDDA into PES packets.
425 *****************************************************************************
426 * Returns -1 in case of error, 0 in case of EOF, otherwise the number of
428 *****************************************************************************/
429 static int CDDARead( input_thread_t * p_input, byte_t * p_buffer,
432 cdda_data_t * p_cdda;
437 p_cdda = (cdda_data_t *)p_input->p_access_data;
441 /* Compute the number of blocks we have to read */
443 i_blocks = i_len / CDIO_CD_FRAMESIZE_RAW;
445 for ( i_index = 0; i_index < i_blocks; i_index++ )
448 if (cdio_read_audio_sector(p_cdda->p_cddev->cdio, p_buffer,
449 p_cdda->i_sector) != 0)
451 msg_Err( p_input, "could not read sector %d", p_cdda->i_sector );
456 if ( p_cdda->i_sector == p_cdda->p_sectors[p_cdda->i_track + 1] )
458 input_area_t *p_area;
460 dbg_print( (INPUT_DBG_LSN|INPUT_DBG_CALL),
461 "end of track, cur: %u", p_cdda->i_sector );
463 if ( p_cdda->i_track >= p_cdda->i_nb_tracks - 1 )
466 vlc_mutex_lock( &p_input->stream.stream_lock );
467 p_area = p_input->stream.pp_areas[
468 p_input->stream.p_selected_area->i_id + 1 ];
471 CDDASetArea( p_input, p_area );
472 vlc_mutex_unlock( &p_input->stream.stream_lock );
474 i_read += CDIO_CD_FRAMESIZE_RAW;
477 if ( i_len % CDIO_CD_FRAMESIZE_RAW ) /* this should not happen */
479 msg_Err( p_input, "must read full sectors" );
485 /*****************************************************************************
486 * CDDASetProgram: Does nothing since a CDDA is mono_program
487 *****************************************************************************/
488 static int CDDASetProgram( input_thread_t * p_input,
489 pgrm_descriptor_t * p_program)
491 cdda_data_t * p_cdda= (cdda_data_t *) p_input->p_access_data;
492 dbg_print( (INPUT_DBG_CALL|INPUT_DBG_EXT), "" );
496 /*****************************************************************************
497 * CDDASetArea: initialize input data for title x.
498 * It should be called for each user navigation request.
499 ****************************************************************************/
500 static int CDDASetArea( input_thread_t * p_input, input_area_t * p_area )
502 cdda_data_t *p_cdda = (cdda_data_t*) p_input->p_access_data;
505 dbg_print( (INPUT_DBG_CALL|INPUT_DBG_EXT), "");
507 /* we can't use the interface slider until initilization is complete */
508 p_input->stream.b_seekable = 0;
510 if( p_area != p_input->stream.p_selected_area )
512 /* Change the default area */
513 p_input->stream.p_selected_area = p_area;
515 /* Change the current track */
516 p_cdda->i_track = p_area->i_id - 1;
517 p_cdda->i_sector = p_cdda->p_sectors[p_cdda->i_track];
519 /* Update the navigation variables without triggering a callback */
520 val.i_int = p_area->i_id;
521 var_Change( p_input, "title", VLC_VAR_SETVALUE, &val, NULL );
524 p_cdda->i_sector = p_cdda->p_sectors[p_cdda->i_track];
526 p_input->stream.p_selected_area->i_tell =
527 (off_t)p_cdda->i_sector * (off_t)CDIO_CD_FRAMESIZE_RAW
528 - p_input->stream.p_selected_area->i_start;
530 /* warn interface that something has changed */
531 p_input->stream.b_seekable = 1;
532 p_input->stream.b_changed = 1;
537 /****************************************************************************
539 ****************************************************************************/
540 static void CDDASeek( input_thread_t * p_input, off_t i_off )
542 cdda_data_t * p_cdda;
544 p_cdda = (cdda_data_t *) p_input->p_access_data;
546 p_cdda->i_sector = p_cdda->p_sectors[p_cdda->i_track]
547 + i_off / (off_t)CDIO_CD_FRAMESIZE_RAW;
549 vlc_mutex_lock( &p_input->stream.stream_lock );
550 p_input->stream.p_selected_area->i_tell =
551 (off_t)p_cdda->i_sector * (off_t)CDIO_CD_FRAMESIZE_RAW
552 - p_input->stream.p_selected_area->i_start;
554 vlc_mutex_unlock( &p_input->stream.stream_lock );
556 dbg_print( (INPUT_DBG_CALL|INPUT_DBG_EXT|INPUT_DBG_SEEK),
557 "sector %ud, offset: %lld, i_tell: %lld", p_cdda->i_sector, i_off,
558 p_input->stream.p_selected_area->i_tell );
562 /*****************************************************************************
563 * Demux: local prototypes
564 *****************************************************************************/
571 static int Demux ( input_thread_t * p_input );
573 /****************************************************************************
575 ****************************************************************************/
576 static int DemuxOpen ( vlc_object_t * p_this)
578 input_thread_t *p_input = (input_thread_t *)p_this;
583 if( p_input->stream.i_method != INPUT_METHOD_CDDA )
588 p_input->pf_demux = Demux;
589 p_input->pf_rewind = NULL;
590 p_input->pf_demux_control = demux_vaControlDefault;
591 p_input->p_demux_data = p_sys = malloc( sizeof( es_descriptor_t ) );
594 vlc_mutex_lock( &p_input->stream.stream_lock );
595 if( input_InitStream( p_input, 0 ) == -1)
597 vlc_mutex_unlock( &p_input->stream.stream_lock );
598 msg_Err( p_input, "cannot init stream" );
602 p_input->stream.i_mux_rate = 4 * 44100 / 50;
603 vlc_mutex_unlock( &p_input->stream.stream_lock );
605 es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC( 'a', 'r', 'a', 'w' ) );
606 fmt.audio.i_channels = 2;
607 fmt.audio.i_rate = 44100;
608 fmt.audio.i_bitspersample = 16;
609 fmt.audio.i_blockalign = 4;
610 fmt.i_bitrate = 4 * 44100 * 8;
612 p_sys->p_es = es_out_Add( p_input->p_es_out, &fmt );
617 /****************************************************************************
619 ****************************************************************************/
620 static void DemuxClose( vlc_object_t * p_this)
622 input_thread_t *p_input = (input_thread_t*)p_this;
623 demux_sys_t *p_sys = (demux_sys_t*)p_input->p_demux_data;
629 /****************************************************************************
631 ****************************************************************************/
632 static int Demux( input_thread_t * p_input )
634 demux_sys_t *p_sys = (demux_sys_t*)p_input->p_demux_data;
638 input_ClockManageRef( p_input,
639 p_input->stream.p_selected_program,
642 if( ( p_block = stream_Block( p_input->s, CDIO_CD_FRAMESIZE_RAW ) ) == NULL )
648 p_block->i_pts = input_ClockGetTS( p_input,
649 p_input->stream.p_selected_program,
651 p_block->i_length = (mtime_t)90000 * (mtime_t)p_block->i_buffer/44100/4;
653 p_sys->i_pts += p_block->i_length;
655 es_out_Send( p_input->p_es_out, p_sys->p_es, p_block );
660 /*****************************************************************************
661 * OpenIntf: initialize dummy interface
662 *****************************************************************************/
663 int E_(OpenIntf) ( vlc_object_t *p_this )
665 intf_thread_t *p_intf = (intf_thread_t *)p_this;
667 /* Allocate instance and initialize some members */
668 p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
669 if( p_intf->p_sys == NULL )
674 p_intf->pf_run = RunIntf;
676 var_AddCallback( p_intf->p_vlc, "key-pressed", KeyEvent, p_intf );
681 /*****************************************************************************
682 * CloseIntf: destroy dummy interface
683 *****************************************************************************/
684 void E_(CloseIntf) ( vlc_object_t *p_this )
686 intf_thread_t *p_intf = (intf_thread_t *)p_this;
688 /* Destroy structure */
689 free( p_intf->p_sys );
693 /*****************************************************************************
695 *****************************************************************************/
696 static void RunIntf( intf_thread_t *p_intf )
698 vlc_object_t * p_vout = NULL;
699 cdda_data_t * p_cdda;
700 input_thread_t * p_input;
702 /* What you add to the last input number entry. It accumulates all of
703 the 10_ADD keypresses */
704 int number_addend = 0;
706 if( InitThread( p_intf ) < 0 )
708 msg_Err( p_intf, "can't initialize intf" );
712 p_input = p_intf->p_sys->p_input;
713 p_cdda = p_intf->p_sys->p_cdda =
714 (cdda_data_t *) p_input->p_access_data;
716 dbg_print( INPUT_DBG_CALL, "intf initialized" );
719 while( !p_intf->b_die )
721 vlc_mutex_lock( &p_intf->change_lock );
726 if( p_vout && p_intf->p_sys->b_key_pressed )
729 int i, i_action = -1;
730 struct hotkey *p_hotkeys = p_intf->p_vlc->p_hotkeys;
732 p_intf->p_sys->b_key_pressed = VLC_FALSE;
734 /* Find action triggered by hotkey (if any) */
735 var_Get( p_intf->p_vlc, "key-pressed", &val );
737 dbg_print( INPUT_DBG_EVENT, "Key pressed %d", val.i_int );
739 for( i = 0; p_hotkeys[i].psz_action != NULL; i++ )
741 if( p_hotkeys[i].i_key == val.i_int )
743 i_action = p_hotkeys[i].i_action;
747 if( i_action != -1) {
750 case ACTIONID_NAV_LEFT:
751 dbg_print( INPUT_DBG_EVENT, "ACTIONID_NAV_LEFT (%d)",
754 if ( CDDAPlay( p_input, p_cdda->i_track-1 ) ) {
759 } while (number_addend-- > 0);
762 case ACTIONID_NAV_RIGHT:
763 dbg_print( INPUT_DBG_EVENT, "ACTIONID_NAV_RIGHT (%d)",
766 if ( CDDAPlay( p_input, p_cdda->i_track+1 ) ) {
771 } while (number_addend-- > 0);
774 case ACTIONID_NAV_UP:
775 dbg_print( INPUT_DBG_EVENT, "ACTIONID_NAV_UP" );
778 } while (number_addend-- > 0);
781 case ACTIONID_NAV_DOWN:
782 dbg_print( INPUT_DBG_EVENT, "ACTIONID_NAV_DOWN" );
785 case ACTIONID_NAV_ACTIVATE:
787 dbg_print( INPUT_DBG_EVENT, "ACTIONID_NAV_ACTIVATE" );
788 if ( CDDAPlay( p_input, number_addend ) ) {
789 p_cdda->i_track = number_addend;
798 unsigned int digit_entered=0;
822 number_addend += digit_entered;
823 dbg_print( INPUT_DBG_EVENT,
824 "Added %d. Number is now: %d\n",
825 digit_entered, number_addend);
833 vlc_mutex_unlock( &p_intf->change_lock );
837 p_vout = vlc_object_find( p_intf->p_sys->p_input,
838 VLC_OBJECT_VOUT, FIND_ANYWHERE );
841 var_AddCallback( p_vout, "key-pressed", KeyEvent, p_intf );
847 msleep( INTF_IDLE_SLEEP );
852 var_DelCallback( p_vout, "key-pressed", KeyEvent, p_intf );
853 vlc_object_release( p_vout );
856 vlc_object_release( p_intf->p_sys->p_input );
859 /*****************************************************************************
861 *****************************************************************************/
862 static int InitThread( intf_thread_t * p_intf )
864 /* We might need some locking here */
867 input_thread_t * p_input;
869 p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_PARENT );
871 /* Maybe the input just died */
872 if( p_input == NULL )
877 vlc_mutex_lock( &p_intf->change_lock );
879 p_intf->p_sys->p_input = p_input;
881 p_intf->p_sys->b_move = VLC_FALSE;
882 p_intf->p_sys->b_click = VLC_FALSE;
883 p_intf->p_sys->b_key_pressed = VLC_FALSE;
885 vlc_mutex_unlock( &p_intf->change_lock );
895 /*****************************************************************************
896 * KeyEvent: callback for keyboard events
897 *****************************************************************************/
898 static int KeyEvent( vlc_object_t *p_this, char const *psz_var,
899 vlc_value_t oldval, vlc_value_t newval, void *p_data )
901 intf_thread_t *p_intf = (intf_thread_t *)p_data;
902 vlc_mutex_lock( &p_intf->change_lock );
904 p_intf->p_sys->b_key_pressed = VLC_TRUE;
906 vlc_mutex_unlock( &p_intf->change_lock );