From 3bc1ec7a6d61407263b5832dda198f47167fd3a7 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 25 Apr 2001 09:31:14 +0000 Subject: [PATCH] * Updated the TODO list. * Fixed benny's latest C++ism. * Fonts not found are no longer fatal to the video output. --- TODO | 12 +++--- configure | 74 ++++++++++++++++++++++++++++----- configure.in | 22 +++++++--- plugins/x11/vout_xvideo.c | 4 +- src/audio_output/aout_s16.c | 14 ++++++- src/interface/intf_msg.c | 25 ++++++----- src/spu_decoder/spu_decoder.c | 25 ++++++----- src/video_output/video_output.c | 9 +--- src/video_output/video_text.c | 21 +++++++++- 9 files changed, 148 insertions(+), 58 deletions(-) diff --git a/TODO b/TODO index 290ba38fd6..9e1512a2c8 100644 --- a/TODO +++ b/TODO @@ -74,7 +74,7 @@ Description: Full DVD navigation Status: Todo Task: 0x56 -Difficulty: Important +Difficulty: Hard Urgency: Normal Description: XVideo video output XVideo is reported to work a bit better than the SDL wrapper on some @@ -141,7 +141,7 @@ Status: Todo Task: 0x4e Difficulty: Hard -Urgency: High +Urgency: Important Description: Write stream zones support For random access we need to know where stream descriptors are valid and reside (essentially DVD plugin). -> Meuuh @@ -516,7 +516,7 @@ Description: Rewrite input for Program Stream files Currently when we read a PS file, it is first translated to TS because we first had only PS support. Now time has come to get rid of this ugly kludge and integrate a proper PS input. -Status: Done because of Input II on 5 Dec 2000 (Meuuh) +Status: Done 5 Dec 2000 (Meuuh) because of Input II Task: 0x1f Difficulty: Hard @@ -625,7 +625,7 @@ Urgency: Wishlist Description: Support MPEG1 timecodes The vlc can parse an MPEG1 system stream, but the parsed PCR values do not seem to be correct. Check what's wrong. -Status: Done because of Input II on 5 Dec 2000 (Meuuh) +Status: Done 5 Dec 2000 (Meuuh) because of Input II Task: 0x12 Difficulty: Medium @@ -745,7 +745,7 @@ Description: Optimize video parser The video parser has some speed issues currently unexplained: even though most functions are inlined, it keeps eating more CPU than it should. This has to be investigated. -Status: Done because of Input II on 5 Dec 2000 (Meuuh) +Status: Done 5 Dec 2000 (Meuuh) because of Input II Task: 0x05 Difficulty: Easy @@ -754,7 +754,7 @@ Description: Backport vlms input The vlc uses the same file input code as the vlms (VideoLAN Mini Server) which has been much improved. Someone should port modifications done to the vlms back to the vlc. -Status: Done because of Input II on 5 Dec 2000 (Meuuh) +Status: Done 5 Dec 2000 (Meuuh) because of Input II Task: 0x04 Difficulty: Medium diff --git a/configure b/configure index b6ff825db2..70bcd8ec97 100755 --- a/configure +++ b/configure @@ -58,7 +58,7 @@ ac_help="$ac_help ac_help="$ac_help --disable-x11 X11 support (default enabled)" ac_help="$ac_help - --enable-xvideo XVideo interface support (default disabled)" + --disable-xvideo XVideo support (default enabled)" ac_help="$ac_help --enable-alsa Alsa sound drivers support (Only for linux) (default disabled)" @@ -3727,29 +3727,81 @@ fi # Check whether --enable-xvideo or --disable-xvideo was given. if test "${enable_xvideo+set}" = set; then enableval="$enable_xvideo" - if test x$enable_xvideo = xyes; then - PLUGINS="${PLUGINS} xvideo" - LIB_XVIDEO="-L/usr/X11R6/lib -lX11 -lXext -lXv" - fi + : +fi + +if test x$enable_xvideo != xno; then + if test x$x_includes = xNONE; then + x_includes=/usr/X11R6/include + fi + if test x$x_libraries = xNONE; then + x_libraries=/usr/X11R6/lib + fi + saved_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I$x_includes" + for ac_hdr in X11/extensions/Xv.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:3747: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3757: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done +fi # Check whether --enable-alsa or --disable-alsa was given. if test "${enable_alsa+set}" = set; then enableval="$enable_alsa" if test x$enable_alsa = xyes; then ac_safe=`echo "sys/asoundlib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/asoundlib.h""... $ac_c" 1>&6 -echo "configure:3743: checking for sys/asoundlib.h" >&5 +echo "configure:3795: checking for sys/asoundlib.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3753: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3805: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3766,7 +3818,7 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for main in -lasound""... $ac_c" 1>&6 -echo "configure:3770: checking for main in -lasound" >&5 +echo "configure:3822: checking for main in -lasound" >&5 ac_lib_var=`echo asound'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3774,14 +3826,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lasound $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3837: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else diff --git a/configure.in b/configure.in index a14389e413..d6f22459b8 100644 --- a/configure.in +++ b/configure.in @@ -407,11 +407,23 @@ dnl dnl XVideo module dnl AC_ARG_ENABLE(xvideo, - [ --enable-xvideo XVideo interface support (default disabled)], - [if test x$enable_xvideo = xyes; then - PLUGINS="${PLUGINS} xvideo" - LIB_XVIDEO="-L/usr/X11R6/lib -lX11 -lXext -lXv" - fi]) + [ --disable-xvideo XVideo support (default enabled)]) +if test x$enable_xvideo != xno; then + if test x$x_includes = xNONE; then + x_includes=/usr/X11R6/include + fi + if test x$x_libraries = xNONE; then + x_libraries=/usr/X11R6/lib + fi + saved_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I$x_includes" + AC_CHECK_HEADERS(X11/extensions/Xv.h, [ + PLUGINS="${PLUGINS} xvideo" + LIB_XVIDEO="-L$x_libraries -lX11 -lXext -lXv" + CFLAGS_X11="-I$x_includes" + ] + CPPFLAGS=$saved_CPPFLAGS) +fi dnl dnl ALSA module diff --git a/plugins/x11/vout_xvideo.c b/plugins/x11/vout_xvideo.c index eb126bc7e9..84d5a7ec45 100644 --- a/plugins/x11/vout_xvideo.c +++ b/plugins/x11/vout_xvideo.c @@ -2,7 +2,7 @@ * vout_xvideo.c: Xvideo video output display method ***************************************************************************** * Copyright (C) 1998, 1999, 2000, 2001 VideoLAN - * $Id: vout_xvideo.c,v 1.9 2001/04/21 22:49:24 sam Exp $ + * $Id: vout_xvideo.c,v 1.10 2001/04/25 09:31:14 sam Exp $ * * Authors: Shane Harper * Vincent Seguin @@ -201,7 +201,7 @@ static int vout_Probe( probedata_t *p_data ) return( 999 ); } - return( 90 ); + return( 110 ); } /***************************************************************************** diff --git a/src/audio_output/aout_s16.c b/src/audio_output/aout_s16.c index f833756bbc..cacfe01308 100644 --- a/src/audio_output/aout_s16.c +++ b/src/audio_output/aout_s16.c @@ -2,7 +2,6 @@ * aout_s16.c: 16 bit signed audio output functions ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: aout_s16.c,v 1.2 2001/03/21 13:42:34 sam Exp $ * * Authors: Michel Kaempf * @@ -86,12 +85,23 @@ void aout_S16StereoThread( aout_thread_t * p_aout ) } l_bytes = p_aout->pf_getbufinfo( p_aout, l_buffer_limit ); + //fprintf(stderr,"l_bytes 1: %li\n",l_bytes); + //fprintf(stderr," playing...\n"); p_aout->date = mdate() + ((((mtime_t)(l_bytes / 4)) * 1000000) / ((mtime_t)p_aout->l_rate)); /* sizeof(s16) << (p_aout->b_stereo) == 4 */ p_aout->pf_play( p_aout, (byte_t *)p_aout->buffer, l_buffer_limit * sizeof(s16) ); + //fprintf(stderr,"l_bytes #: %li\n",p_aout->pf_getbufinfo( p_aout, l_buffer_limit )); if ( l_bytes > (l_buffer_limit * sizeof(s16)) ) { - msleep( p_aout->l_msleep ); + //fprintf(stderr," sleeping...\n"); + msleep( p_aout->l_msleep / 2); + l_bytes = p_aout->pf_getbufinfo( p_aout, l_buffer_limit ); + //fprintf(stderr,"l_bytes *: %li\n",l_bytes); + msleep( p_aout->l_msleep / 2); } + else + //fprintf(stderr," not sleeping.\n"); + l_bytes = p_aout->pf_getbufinfo( p_aout, l_buffer_limit ); + //fprintf(stderr,"l_bytes 2: %li\n\n",l_bytes); } vlc_mutex_lock( &p_aout->fifos_lock ); diff --git a/src/interface/intf_msg.c b/src/interface/intf_msg.c index 9d7539b80e..936f4aae77 100644 --- a/src/interface/intf_msg.c +++ b/src/interface/intf_msg.c @@ -4,7 +4,7 @@ * interface, such as message output. See config.h for output configuration. ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: intf_msg.c,v 1.29 2001/04/25 06:56:47 benny Exp $ + * $Id: intf_msg.c,v 1.30 2001/04/25 09:31:14 sam Exp $ * * Authors: Vincent Seguin * @@ -576,7 +576,17 @@ static void PrintMsg( intf_msg_item_t *p_msg ) { char psz_date[MSTRTIME_MAX_SIZE]; /* formatted time buffer */ int i_msg_len = MSTRTIME_MAX_SIZE + strlen(p_msg->psz_msg) + 200; - char psz_msg[i_msg_len]; /* message buffer */ + char *psz_msg; /* message buffer */ + + psz_msg = malloc( sizeof( char ) * i_msg_len ); + + /* Check if allocation succeeded */ + if( psz_msg == NULL ) + { + fprintf( stderr, "error: not enough memory for message %s\n", + p_msg->psz_msg ); + return; + } /* Format message - the message is formatted here because in case the log * file is used, it avoids another format string parsing */ @@ -606,14 +616,6 @@ static void PrintMsg( intf_msg_item_t *p_msg ) break; } - /* Check if formatting function succeeded */ - if( psz_msg == NULL ) - { - fprintf( stderr, "error: can not format message (%s): %s\n", - strerror( errno ), p_msg->psz_msg ); - return; - } - /* * Print messages */ @@ -642,6 +644,9 @@ static void PrintMsg( intf_msg_item_t *p_msg ) fwrite( "\n", 1, 1, p_main->p_msg->p_log_file ); } #endif + + /* Free the message */ + free( psz_msg ); } #else diff --git a/src/spu_decoder/spu_decoder.c b/src/spu_decoder/spu_decoder.c index ea0656930a..651d04ffc3 100644 --- a/src/spu_decoder/spu_decoder.c +++ b/src/spu_decoder/spu_decoder.c @@ -2,7 +2,7 @@ * spu_decoder.c : spu decoder thread ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: spu_decoder.c,v 1.35 2001/04/06 09:15:48 sam Exp $ + * $Id: spu_decoder.c,v 1.36 2001/04/25 09:31:14 sam Exp $ * * Authors: Samuel Hocevar * @@ -303,7 +303,7 @@ static void ParsePacket( spudec_thread_t *p_spudec ) p_spu->i_width, p_spu->i_height, p_spu->i_x, p_spu->i_y, p_spu->type.spu.i_offset[0], p_spu->type.spu.i_offset[1] ); - /* SPU is finished - we can tell the video output to display it */ + /* SPU is finished - we can ask the video output to display it */ vout_DisplaySubPicture( p_spudec->p_vout, p_spu ); /* Clean up */ @@ -352,11 +352,9 @@ static int ParseControlSequences( spudec_thread_t *p_spudec, case SPU_CMD_FORCE_DISPLAY: /* 00 (force displaying) */ - break; - /* FIXME: here we have to calculate dates. It's around - * i_date * 12000 but I don't know how much exactly. */ + /* Convert the dates in seconds to PTS values */ case SPU_CMD_START_DISPLAY: /* 01 (start displaying) */ @@ -418,12 +416,11 @@ static int ParseControlSequences( spudec_thread_t *p_spudec, case SPU_CMD_END: /* ff (end) */ - break; default: - /* ?? (unknown command) */ + /* xx (unknown command) */ intf_ErrMsg( "spudec error: unknown command 0x%.2x", i_command ); return( 1 ); @@ -466,7 +463,8 @@ static int ParseControlSequences( spudec_thread_t *p_spudec, /* More than one padding byte - this is very strange, but * we can deal with it */ - intf_WarnMsg( 2, "spudec warning: %i padding bytes", + intf_WarnMsg( 2, "spudec warning: %i padding bytes, we usually " + "get 1 or none", p_spudec->i_spu_size - i_index ); while( i_index < p_spudec->i_spu_size ) @@ -501,10 +499,11 @@ static int ParseRLE( u8 *p_src, subpicture_t * p_spu ) u16 *p_dest = (u16 *)p_spu->p_data; /* The subtitles are interlaced, we need two offsets */ - unsigned int pi_table[2]; + unsigned int pi_table[ 2 ]; unsigned int *pi_offset; - pi_table[0] = p_spu->type.spu.i_offset[0] << 1; - pi_table[1] = p_spu->type.spu.i_offset[1] << 1; + + pi_table[ 0 ] = p_spu->type.spu.i_offset[ 0 ] << 1; + pi_table[ 1 ] = p_spu->type.spu.i_offset[ 1 ] << 1; for( i_y = 0 ; i_y < i_height ; i_y++ ) { @@ -537,8 +536,8 @@ static int ParseRLE( u8 *p_src, subpicture_t * p_spu ) else { /* We have a boo boo ! */ - intf_ErrMsg( "spudec error: unknown code %.4x", - i_code ); + intf_ErrMsg( "spudec error: unknown RLE code " + "0x%.4x", i_code ); return( 1 ); } } diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index dab27c8155..0cb64fc8ba 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -5,7 +5,7 @@ * thread, and destroy a previously oppened video output thread. ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: video_output.c,v 1.117 2001/03/21 13:42:34 sam Exp $ + * $Id: video_output.c,v 1.118 2001/04/25 09:31:14 sam Exp $ * * Authors: Vincent Seguin * @@ -228,19 +228,12 @@ vout_thread_t * vout_CreateThread ( int *pi_status ) if( p_vout->p_default_font == NULL ) { intf_ErrMsg( "vout error: could not load default font" ); - p_vout->pf_destroy( p_vout ); - free( p_vout ); - return( NULL ); } p_vout->p_large_font = vout_LoadFont( VOUT_LARGE_FONT ); if( p_vout->p_large_font == NULL ) { intf_ErrMsg( "vout error: could not load large font" ); - vout_UnloadFont( p_vout->p_default_font ); - p_vout->pf_destroy( p_vout ); - free( p_vout ); - return( NULL ); } /* Create thread and set locks */ diff --git a/src/video_output/video_text.c b/src/video_output/video_text.c index 7bf9c6dce5..b785e852cc 100644 --- a/src/video_output/video_text.c +++ b/src/video_output/video_text.c @@ -2,7 +2,7 @@ * video_text.c : text manipulation functions ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: video_text.c,v 1.23 2001/04/12 01:52:45 sam Exp $ + * $Id: video_text.c,v 1.24 2001/04/25 09:31:14 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -376,6 +376,12 @@ vout_font_t *vout_LoadFont( const char *psz_name ) *****************************************************************************/ void vout_UnloadFont( vout_font_t *p_font ) { + /* If no font was loaded, do nothing */ + if( p_font == NULL ) + { + return; + } + intf_DbgMsg( "vout: unloading font %p", p_font ); free( p_font->p_data ); free( p_font ); @@ -389,6 +395,13 @@ void vout_UnloadFont( vout_font_t *p_font ) *****************************************************************************/ void vout_TextSize( vout_font_t *p_font, int i_style, const char *psz_text, int *pi_width, int *pi_height ) { + /* If no font was loaded, do nothing */ + if( p_font == NULL ) + { + *pi_width = *pi_height = 0; + return; + } + switch( p_font->i_type ) { case VOUT_FIXED_FONT: @@ -426,6 +439,12 @@ void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int int i_position, i_end; /* current position */ vout_put_byte_t *p_PutByte; /* PutByte function */ + /* If no font was loaded, do nothing */ + if( p_font == NULL ) + { + return; + } + /* FIXME: background: can be something else that whole byte ?? */ /* Select output function */ -- 2.39.2