/*****************************************************************************
* ncurses.c : NCurses plugin for vlc
*****************************************************************************
- * Copyright (C) 2001 VideoLAN
- * $Id: ncurses.c,v 1.2 2002/08/08 22:28:22 sam Exp $
+ * Copyright (C) 2001, 2002, 2003 VideoLAN
+ * $Id: ncurses.c,v 1.3 2003/01/17 19:36:53 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Local prototypes.
*****************************************************************************/
static int Open ( vlc_object_t * );
-static void Close ( vlc_object_t * );
+static void Close ( vlc_object_t * );
-static void Run ( intf_thread_t * );
+static void Run ( intf_thread_t * );
static void FullScreen ( intf_thread_t * );
static void Play ( intf_thread_t * );
static void Stop ( intf_thread_t * );
* Open: initialize and create window
*****************************************************************************/
static int Open( vlc_object_t *p_this )
-{
+{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
/* Allocate instance and initialize some members */
if( p_intf->p_sys == NULL )
{
msg_Err( p_intf, "out of memory" );
- return( 1 );
+ return VLC_ENOMEM;
}
p_intf->p_sys->p_input = NULL;
clear();
- return( 0 );
+ return VLC_SUCCESS;
}
/*****************************************************************************
* Close: destroy interface window
*****************************************************************************/
static void Close( vlc_object_t *p_this )
-{
+{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
if( p_intf->p_sys->p_input )
{
msleep( INTF_IDLE_SLEEP );
- /* Update the input */
+ /* Update the input */
if( p_intf->p_sys->p_input == NULL )
{
p_intf->p_sys->p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,
vlc_object_release( p_intf->p_sys->p_input );
p_intf->p_sys->p_input = NULL;
}
-
+
while( (i_key = getch()) != -1 )
{
/*
if ( p_buf == NULL )
{
- return ( -1 );
+ return -1;
}
i_len = strlen( p_buf );
vlc_mutex_lock( &p_playlist->object_lock );
if( p_playlist->i_index < 0 )
- {
+ {
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
- return;
+ return;
}
psz_name = p_playlist->pp_items[ p_playlist->i_index ]->psz_name;
static void Next ( intf_thread_t *p_intf )
{
- int i_id;
input_area_t * p_area;
+ int i_id;
- i_id = p_intf->p_sys->p_input->stream.p_selected_area->i_id+1;
+ vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
+ i_id = p_intf->p_sys->p_input->stream.p_selected_area->i_id + 1;
if ( i_id < p_intf->p_sys->p_input->stream.i_area_nb )
{
p_area = p_intf->p_sys->p_input->stream.pp_areas[i_id];
+ vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
- input_ChangeArea( p_intf->p_sys->p_input,
- (input_area_t *) p_area );
-
+ input_ChangeArea( p_intf->p_sys->p_input, p_area );
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
}
+
+ vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
}
static void ManageSlider ( intf_thread_t *p_intf )
input_area_t * p_area;
int i_id;
+ vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
i_id = p_intf->p_sys->p_input->stream.p_selected_area->i_id - 1;
- /* Disallow area 0 since it is used for video_ts.vob */
if ( i_id > 0 )
{
p_area = p_intf->p_sys->p_input->stream.pp_areas[i_id];
- input_ChangeArea( p_intf->p_sys->p_input, (input_area_t*)p_area );
+ vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
+ input_ChangeArea( p_intf->p_sys->p_input, p_area );
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
}
+
+ vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
}
static void NextTitle ( intf_thread_t *p_intf )
input_area_t * p_area;
int i_id;
+ vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
i_id = p_intf->p_sys->p_input->stream.p_selected_area->i_id + 1;
if ( i_id < p_intf->p_sys->p_input->stream.i_area_nb )
{
p_area = p_intf->p_sys->p_input->stream.pp_areas[i_id];
- input_ChangeArea( p_intf->p_sys->p_input, (input_area_t*)p_area );
+ vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
+ input_ChangeArea( p_intf->p_sys->p_input, p_area );
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
}
+
+ vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
}
static void PrevChapter ( intf_thread_t *p_intf )
{
input_area_t * p_area;
+ vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
p_area = p_intf->p_sys->p_input->stream.p_selected_area;
if ( p_area->i_part > 0 )
{
p_area->i_part--;
- input_ChangeArea( p_intf->p_sys->p_input, (input_area_t*)p_area );
+ vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
+ input_ChangeArea( p_intf->p_sys->p_input, p_area );
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
}
+
+ vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
}
static void NextChapter( intf_thread_t *p_intf )
{
input_area_t * p_area;
+ vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
p_area = p_intf->p_sys->p_input->stream.p_selected_area;
if ( p_area->i_part < p_area->i_part_nb )
{
p_area->i_part++;
- input_ChangeArea( p_intf->p_sys->p_input, (input_area_t*)p_area );
+ vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
+ input_ChangeArea( p_intf->p_sys->p_input, p_area );
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
}
+
+ vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
}