Commit f82f7f25 authored by Sam Hocevar's avatar Sam Hocevar

  * Made the remote command plugin usable even with no stream.
  * Fixed a deadlock in the remote command plugin.
  * Fixed a deadlock in the SPU decoder.
parent e57dfae1
......@@ -66,6 +66,8 @@ typedef struct intf_sys_s
} intf_sys_t;
#define MAX_LINE_LENGTH 256
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
......@@ -138,7 +140,7 @@ static void intf_Close( intf_thread_t *p_intf )
*****************************************************************************/
static void intf_Run( intf_thread_t *p_intf )
{
char p_cmd[ 32 ];
char p_cmd[ MAX_LINE_LENGTH + 1 ];
int i_cmd_pos;
boolean_t b_complete = 0;
......@@ -153,10 +155,10 @@ static void intf_Run( intf_thread_t *p_intf )
while( !p_intf->b_die )
{
#define S p_intf->p_input->stream
if( p_intf->p_input != NULL )
{
/* Get position */
#define S p_intf->p_input->stream
if( S.i_mux_rate )
{
f_ratio = 1.0 / ( 50 * S.i_mux_rate );
......@@ -170,83 +172,93 @@ static void intf_Run( intf_thread_t *p_intf )
S.p_selected_area->i_size ) );
}
}
}
#undef S
b_complete = 0;
i_cmd_pos = 0;
b_complete = 0;
i_cmd_pos = 0;
/* Check stdin */
tv.tv_sec = 0;
tv.tv_usec = 50000;
FD_ZERO( &fds );
FD_SET( STDIN_FILENO, &fds );
/* Check stdin */
tv.tv_sec = 0;
tv.tv_usec = 50000;
FD_ZERO( &fds );
FD_SET( STDIN_FILENO, &fds );
if( select( 32, &fds, NULL, NULL, &tv ) )
if( select( 32, &fds, NULL, NULL, &tv ) )
{
while( !p_intf->b_die
&& i_cmd_pos < MAX_LINE_LENGTH
&& read( STDIN_FILENO, p_cmd + i_cmd_pos, 1 ) > 0
&& p_cmd[ i_cmd_pos ] != '\r'
&& p_cmd[ i_cmd_pos ] != '\n' )
{
while( i_cmd_pos < 32
&& read( STDIN_FILENO, p_cmd + i_cmd_pos, 1 ) > 0
&& p_cmd[ i_cmd_pos ] != '\r'
&& p_cmd[ i_cmd_pos ] != '\n' )
{
i_cmd_pos++;
}
i_cmd_pos++;
}
if( i_cmd_pos == 31 || p_cmd[ i_cmd_pos ] == '\r'
|| p_cmd[ i_cmd_pos ] == '\n' )
{
p_cmd[ i_cmd_pos ] = 0;
b_complete = 1;
}
if( i_cmd_pos == MAX_LINE_LENGTH
|| p_cmd[ i_cmd_pos ] == '\r'
|| p_cmd[ i_cmd_pos ] == '\n' )
{
p_cmd[ i_cmd_pos ] = 0;
b_complete = 1;
}
}
/* Is there something to do? */
if( b_complete == 1 )
/* Is there something to do? */
if( b_complete == 1 )
{
switch( p_cmd[ 0 ] )
{
switch( p_cmd[ 0 ] )
case 'p':
case 'P':
if( p_intf->p_input != NULL )
{
case 'p':
case 'P':
input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
break;
}
break;
case 'f':
case 'F':
vlc_mutex_lock( &p_vout_bank->lock );
/* XXX: only fullscreen the first video output */
if( p_vout_bank->i_count )
{
p_vout_bank->pp_vout[0]->i_changes
|= VOUT_FULLSCREEN_CHANGE;
}
vlc_mutex_unlock( &p_vout_bank->lock );
break;
case 'f':
case 'F':
vlc_mutex_lock( &p_vout_bank->lock );
/* XXX: only fullscreen the first video output */
if( p_vout_bank->i_count )
{
p_vout_bank->pp_vout[0]->i_changes
|= VOUT_FULLSCREEN_CHANGE;
}
vlc_mutex_unlock( &p_vout_bank->lock );
break;
case 'm':
case 'M':
case 'm':
case 'M':
#if 0
double picratio = p_intf->p_input->p_default_vout->i_width
/ p_intf->p_input->p_default_vout->i_height;
if (picratio
p_intf->p_input->p_default_vout->i_width=800
p_intf->p_input->p_default_vout->i_changes |=
VOUT_FULLSCREEN_CHANGE;
double picratio = p_intf->p_input->p_default_vout->i_width
/ p_intf->p_input->p_default_vout->i_height;
if (picratio
p_intf->p_input->p_default_vout->i_width=800
p_intf->p_input->p_default_vout->i_changes |=
VOUT_FULLSCREEN_CHANGE;
#endif
break;
case 's':
case 'S':
;
break;
case 'q':
case 'Q':
p_intf->b_die = 1;
break;
case 'r':
case 'R':
for( i_dummy = 1; i_dummy < 32 && p_cmd[ i_dummy ] >= '0'
&& p_cmd[ i_dummy ] <= '9'; ++i_dummy )
break;
case 's':
case 'S':
;
break;
case 'q':
case 'Q':
p_intf->b_die = 1;
break;
case 'r':
case 'R':
if( p_intf->p_input != NULL )
{
for( i_dummy = 1;
i_dummy < MAX_LINE_LENGTH && p_cmd[ i_dummy ] >= '0'
&& p_cmd[ i_dummy ] <= '9';
i_dummy++ )
{
;
}
......@@ -255,12 +267,12 @@ static void intf_Run( intf_thread_t *p_intf )
f_cpos = atof( p_cmd + 1 );
input_Seek( p_intf->p_input, (off_t) (f_cpos / f_ratio) );
/* rcreseek(f_cpos); */
break;
default:
intf_Msg( "rc: unknown command: %s", p_cmd );
break;
}
break;
default:
intf_Msg( "rc: unknown command `%s'", p_cmd );
break;
}
}
......
......@@ -2,7 +2,7 @@
* spu_decoder.c : spu decoder thread
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: spu_decoder.c,v 1.47 2001/06/02 01:09:03 sam Exp $
* $Id: spu_decoder.c,v 1.48 2001/08/06 13:13:06 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -319,6 +319,7 @@ static void ParsePacket( spudec_thread_t *p_spudec )
{
GetChunk( &p_spudec->bit_stream, p_src + i_offset, SPU_CHUNK_SIZE );
/* Abort subtitle parsing if we were requested to stop */
if( p_spudec->p_fifo->b_die )
{
free( p_src );
......@@ -336,7 +337,7 @@ static void ParsePacket( spudec_thread_t *p_spudec )
#endif
/* Getting the control part */
if( p_spudec->p_fifo->b_die || ParseControlSequences( p_spudec, p_spu ) )
if( ParseControlSequences( p_spudec, p_spu ) )
{
/* There was a parse error, delete the subpicture */
free( p_src );
......@@ -344,6 +345,10 @@ static void ParsePacket( spudec_thread_t *p_spudec )
return;
}
/* At this point, no more GetBit() command is needed, so we have all
* the data we need to tell whether the subtitle is valid. Thus we
* try to display it and we ignore b_die. */
if( ParseRLE( p_spudec, p_spu, p_src ) )
{
/* There was a parse error, delete the subpicture */
......@@ -489,6 +494,12 @@ static int ParseControlSequences( spudec_thread_t *p_spudec,
return( 1 );
}
/* We need to check for quit commands here */
if( p_spudec->p_fifo->b_die )
{
return( 1 );
}
} while( i_command != SPU_CMD_END );
} while( i_index == i_next_seq );
......@@ -534,7 +545,7 @@ static int ParseControlSequences( spudec_thread_t *p_spudec,
* we can deal with it */
default:
intf_WarnMsg( 2, "spudec warning: %i padding bytes, we usually "
"get 1 or none",
"get 0 or 1 of them",
p_spudec->i_spu_size - i_index );
while( i_index < p_spudec->i_spu_size )
......@@ -632,7 +643,7 @@ static int ParseRLE( spudec_thread_t *p_spudec,
{
intf_ErrMsg( "spudec error: out of bounds, %i at (%i,%i) is "
"out of %ix%i",
i_code >> 2, i_x, i_y, i_width, i_height);
i_code >> 2, i_x, i_y, i_width, i_height );
return( 1 );
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment