From c1ba1b4951fe13f7b0138e54cc11df555c20252b Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Mon, 17 Dec 2001 03:38:22 +0000 Subject: [PATCH] * CPU detection under BeOS. * Fixed XVideo port selection. * New stupid plugin: "--filter wall" for split-image playback :-) (will evolve into a real image wall plugin when I have time) --- Makefile | 1 + configure | 2 +- configure.in | 2 +- plugins/filter/Makefile | 13 +- plugins/filter/wall.c | 404 ++++++++++++++++++++++++++++++++++++++ plugins/x11/vout_xvideo.c | 150 +++++++------- src/interface/main.c | 80 ++++---- 7 files changed, 536 insertions(+), 116 deletions(-) create mode 100644 plugins/filter/wall.c diff --git a/Makefile b/Makefile index 3b0c362100..c378c0910a 100644 --- a/Makefile +++ b/Makefile @@ -66,6 +66,7 @@ PLUGINS_TARGETS := ac3_adec/ac3_adec \ fb/fb \ filter/filter_bob \ filter/filter_invert \ + filter/filter_wall \ ggi/ggi \ glide/glide \ gtk/gnome \ diff --git a/configure b/configure index 066b59669c..b982064975 100755 --- a/configure +++ b/configure @@ -5488,7 +5488,7 @@ fi ARCH=${target_cpu} BUILTINS="${BUILTINS} mpeg_es mpeg_ps mpeg_ts memcpy idct idctclassic motion imdct downmix mpeg_adec lpcm_adec ac3_adec mpeg_vdec" -PLUGINS="${PLUGINS} ac3_spdif spudec chroma_yv12_rgb8 filter_bob filter_invert" +PLUGINS="${PLUGINS} ac3_spdif spudec chroma_yv12_rgb8 filter_bob filter_invert filter_wall" MMX_MODULES="memcpymmx idctmmx motionmmx" MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext" diff --git a/configure.in b/configure.in index c9bc9d3b66..c9ae161ebd 100644 --- a/configure.in +++ b/configure.in @@ -310,7 +310,7 @@ dnl dnl default modules dnl BUILTINS="${BUILTINS} mpeg_es mpeg_ps mpeg_ts memcpy idct idctclassic motion imdct downmix mpeg_adec lpcm_adec ac3_adec mpeg_vdec" -PLUGINS="${PLUGINS} ac3_spdif spudec chroma_yv12_rgb8 filter_bob filter_invert" +PLUGINS="${PLUGINS} ac3_spdif spudec chroma_yv12_rgb8 filter_bob filter_invert filter_wall" dnl dnl Accelerated modules diff --git a/plugins/filter/Makefile b/plugins/filter/Makefile index 5c8cae513b..1cf8a723ea 100644 --- a/plugins/filter/Makefile +++ b/plugins/filter/Makefile @@ -9,12 +9,14 @@ PLUGIN_BOB = bob.o PLUGIN_INVERT = invert.o +PLUGIN_WALL = wall.o BUILTIN_BOB = $(PLUGIN_BOB:%.o=BUILTIN_%.o) BUILTIN_INVERT = $(PLUGIN_INVERT:%.o=BUILTIN_%.o) +BUILTIN_WALL = $(PLUGIN_WALL:%.o=BUILTIN_%.o) -PLUGIN_C = $(PLUGIN_BOB) $(PLUGIN_INVERT) -BUILTIN_C = $(BUILTIN_BOB) $(BUILTIN_INVERT) +PLUGIN_C = $(PLUGIN_BOB) $(PLUGIN_INVERT) $(PLUGIN_WALL) +BUILTIN_C = $(BUILTIN_BOB) $(BUILTIN_INVERT) $(BUILTIN_WALL) ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C) # @@ -41,3 +43,10 @@ include ../../Makefile.modules ar r $@ $^ $(RANLIB) $@ +../filter_wall.so: $(PLUGIN_WALL) + $(CC) -o $@ $^ $(PLCFLAGS) + +../filter_wall.a: $(BUILTIN_WALL) + ar r $@ $^ + $(RANLIB) $@ + diff --git a/plugins/filter/wall.c b/plugins/filter/wall.c new file mode 100644 index 0000000000..95f8a4f351 --- /dev/null +++ b/plugins/filter/wall.c @@ -0,0 +1,404 @@ +/***************************************************************************** + * wall.c : Wall video plugin for vlc + ***************************************************************************** + * Copyright (C) 2000, 2001 VideoLAN + * $Id: wall.c,v 1.1 2001/12/17 03:38:21 sam Exp $ + * + * Authors: Samuel Hocevar + * + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + *****************************************************************************/ + +#define MODULE_NAME filter_wall +#include "modules_inner.h" + +/***************************************************************************** + * Preamble + *****************************************************************************/ +#include "defs.h" + +#include +#include /* malloc(), free() */ +#include + +#include "common.h" /* boolean_t, byte_t */ +#include "intf_msg.h" +#include "threads.h" +#include "mtime.h" +#include "tests.h" + +#include "video.h" +#include "video_output.h" + +#include "modules.h" +#include "modules_export.h" + +#define WALL_MAX_DIRECTBUFFERS 8 + +/***************************************************************************** + * Capabilities defined in the other files. + *****************************************************************************/ +static void vout_getfunctions( function_list_t * p_function_list ); + +/***************************************************************************** + * Build configuration tree. + *****************************************************************************/ +MODULE_CONFIG_START +ADD_WINDOW( "Configuration for Wall module" ) + ADD_COMMENT( "Ha, ha -- nothing to configure yet" ) +MODULE_CONFIG_STOP + +MODULE_INIT_START + p_module->i_capabilities = MODULE_CAPABILITY_NULL + | MODULE_CAPABILITY_VOUT; + p_module->psz_longname = "image wall video module"; +MODULE_INIT_STOP + +MODULE_ACTIVATE_START + vout_getfunctions( &p_module->p_functions->vout ); +MODULE_ACTIVATE_STOP + +MODULE_DEACTIVATE_START +MODULE_DEACTIVATE_STOP + +/***************************************************************************** + * vout_sys_t: Wall video output method descriptor + ***************************************************************************** + * This structure is part of the video output thread descriptor. + * It describes the Wall specific properties of an output thread. + *****************************************************************************/ +typedef struct vout_sys_s +{ + struct vout_thread_s *p_vout_top; + struct vout_thread_s *p_vout_bottom; + +} vout_sys_t; + +/***************************************************************************** + * Local prototypes + *****************************************************************************/ +static int vout_Probe ( probedata_t *p_data ); +static int vout_Create ( struct vout_thread_s * ); +static int vout_Init ( struct vout_thread_s * ); +static void vout_End ( struct vout_thread_s * ); +static void vout_Destroy ( struct vout_thread_s * ); +static int vout_Manage ( struct vout_thread_s * ); +static void vout_Display ( struct vout_thread_s *, struct picture_s * ); + +static int WallNewPicture ( struct vout_thread_s *, struct picture_s * ); + +/***************************************************************************** + * Functions exported as capabilities. They are declared as static so that + * we don't pollute the namespace too much. + *****************************************************************************/ +static void vout_getfunctions( function_list_t * p_function_list ) +{ + p_function_list->pf_probe = vout_Probe; + p_function_list->functions.vout.pf_create = vout_Create; + p_function_list->functions.vout.pf_init = vout_Init; + p_function_list->functions.vout.pf_end = vout_End; + p_function_list->functions.vout.pf_destroy = vout_Destroy; + p_function_list->functions.vout.pf_manage = vout_Manage; + p_function_list->functions.vout.pf_display = vout_Display; + p_function_list->functions.vout.pf_setpalette = NULL; +} + +/***************************************************************************** + * intf_Probe: return a score + *****************************************************************************/ +static int vout_Probe( probedata_t *p_data ) +{ + if( TestMethod( VOUT_FILTER_VAR, "wall" ) ) + { + return( 999 ); + } + + /* If we weren't asked to filter, don't filter. */ + return( 0 ); +} + +/***************************************************************************** + * vout_Create: allocates Wall video thread output method + ***************************************************************************** + * This function allocates and initializes a Wall vout method. + *****************************************************************************/ +static int vout_Create( vout_thread_t *p_vout ) +{ + /* Allocate structure */ + p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); + if( p_vout->p_sys == NULL ) + { + intf_ErrMsg("error: %s", strerror(ENOMEM) ); + return( 1 ); + } + + return( 0 ); +} + +/***************************************************************************** + * vout_Init: initialize Wall video thread output method + *****************************************************************************/ +static int vout_Init( vout_thread_t *p_vout ) +{ + int i_index; + char *psz_filter; + picture_t *p_pic; + + I_OUTPUTPICTURES = 0; + + /* Try to open the real video output */ + psz_filter = main_GetPszVariable( VOUT_FILTER_VAR, "" ); + main_PutPszVariable( VOUT_FILTER_VAR, "" ); + + intf_WarnMsg( 1, "filter: spawning the real video outputs" ); + + p_vout->p_sys->p_vout_top = + vout_CreateThread( NULL, + p_vout->render.i_width, p_vout->render.i_height / 2, + p_vout->render.i_chroma, p_vout->render.i_aspect * 2); + + /* Everything failed */ + if( p_vout->p_sys->p_vout_top == NULL ) + { + intf_ErrMsg( "filter error: can't open top vout, aborting" ); + + return( 0 ); + } + + p_vout->p_sys->p_vout_bottom = + vout_CreateThread( NULL, + p_vout->render.i_width, p_vout->render.i_height / 2, + p_vout->render.i_chroma, p_vout->render.i_aspect * 2 ); + + /* Everything failed */ + if( p_vout->p_sys->p_vout_bottom == NULL ) + { + intf_ErrMsg( "filter error: can't open bottom vout, aborting" ); + vout_DestroyThread( p_vout->p_sys->p_vout_top, NULL ); + + return( 0 ); + } + + main_PutPszVariable( VOUT_FILTER_VAR, psz_filter ); + + /* Initialize the output structure */ + switch( p_vout->render.i_chroma ) + { + case YUV_420_PICTURE: + p_vout->output.i_chroma = p_vout->render.i_chroma; + p_vout->output.i_width = p_vout->render.i_width; + p_vout->output.i_height = p_vout->render.i_height; + p_vout->output.i_aspect = p_vout->render.i_aspect; + break; + + default: + p_vout->output.i_chroma = EMPTY_PICTURE; /* unknown chroma */ + break; + } + + /* Try to initialize WALL_MAX_DIRECTBUFFERS direct buffers */ + while( I_OUTPUTPICTURES < WALL_MAX_DIRECTBUFFERS ) + { + p_pic = NULL; + + /* Find an empty picture slot */ + for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ ) + { + if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE ) + { + p_pic = p_vout->p_picture + i_index; + break; + } + } + + /* Allocate the picture */ + if( WallNewPicture( p_vout, p_pic ) ) + { + break; + } + + p_pic->i_status = DESTROYED_PICTURE; + p_pic->i_type = DIRECT_PICTURE; + + p_pic->i_left_margin = + p_pic->i_right_margin = + p_pic->i_top_margin = + p_pic->i_bottom_margin = 0; + + PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic; + + I_OUTPUTPICTURES++; + } + + return( 0 ); +} + +/***************************************************************************** + * vout_End: terminate Wall video thread output method + *****************************************************************************/ +static void vout_End( vout_thread_t *p_vout ) +{ + int i_index; + + /* Free the fake output buffers we allocated */ + for( i_index = I_OUTPUTPICTURES ; i_index ; ) + { + i_index--; + free( PP_OUTPUTPICTURE[ i_index ]->planes[ 0 ].p_data ); + } +} + +/***************************************************************************** + * vout_Destroy: destroy Wall video thread output method + ***************************************************************************** + * Terminate an output method created by WallCreateOutputMethod + *****************************************************************************/ +static void vout_Destroy( vout_thread_t *p_vout ) +{ + vout_DestroyThread( p_vout->p_sys->p_vout_top, NULL ); + vout_DestroyThread( p_vout->p_sys->p_vout_bottom, NULL ); + + free( p_vout->p_sys ); +} + +/***************************************************************************** + * vout_Manage: handle Wall events + ***************************************************************************** + * This function should be called regularly by video output thread. It manages + * console events. It returns a non null value on error. + *****************************************************************************/ +static int vout_Manage( vout_thread_t *p_vout ) +{ + return( 0 ); +} + +/***************************************************************************** + * vout_Display: displays previously rendered output + ***************************************************************************** + * This function send the currently rendered image to Wall image, waits + * until it is displayed and switch the two rendering buffers, preparing next + * frame. + *****************************************************************************/ +static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) +{ + picture_t *p_outpic_top, *p_outpic_bottom; + int i_index; + mtime_t i_date = mdate() + 50000; + + while( ( p_outpic_top + = vout_CreatePicture( p_vout->p_sys->p_vout_top, 0, 0, 0 ) ) + == NULL ) + { + if( p_vout->b_die || p_vout->b_error ) + { + return; + } + msleep( VOUT_OUTMEM_SLEEP ); + } + + while( ( p_outpic_bottom + = vout_CreatePicture( p_vout->p_sys->p_vout_bottom, 0, 0, 0 ) ) + == NULL ) + { + if( p_vout->b_die || p_vout->b_error ) + { + vout_DestroyPicture( p_vout->p_sys->p_vout_top, p_outpic_top ); + return; + } + msleep( VOUT_OUTMEM_SLEEP ); + } + + vout_DatePicture( p_vout->p_sys->p_vout_top, p_outpic_top, i_date ); + vout_DatePicture( p_vout->p_sys->p_vout_bottom, p_outpic_bottom, i_date ); + + vout_LinkPicture( p_vout->p_sys->p_vout_top, p_outpic_top ); + vout_LinkPicture( p_vout->p_sys->p_vout_bottom, p_outpic_bottom ); + + for( i_index = 0 ; i_index < p_pic->i_planes ; i_index++ ) + { + p_main->fast_memcpy( p_outpic_top->planes[ i_index ].p_data, + p_pic->planes[ i_index ].p_data, + p_pic->planes[ i_index ].i_bytes / 2 ); + + p_main->fast_memcpy( p_outpic_bottom->planes[ i_index ].p_data, + p_pic->planes[ i_index ].p_data + + p_pic->planes[ i_index ].i_bytes / 2, + p_pic->planes[ i_index ].i_bytes / 2 ); + } + + vout_UnlinkPicture( p_vout->p_sys->p_vout_top, p_outpic_top ); + vout_UnlinkPicture( p_vout->p_sys->p_vout_bottom, p_outpic_bottom ); + + vout_DisplayPicture( p_vout->p_sys->p_vout_top, p_outpic_top ); + vout_DisplayPicture( p_vout->p_sys->p_vout_bottom, p_outpic_bottom ); +} + + +/***************************************************************************** + * WallNewPicture: allocate a picture + ***************************************************************************** + * Returns 0 on success, -1 otherwise + *****************************************************************************/ +static int WallNewPicture( vout_thread_t *p_vout, picture_t *p_pic ) +{ + int i_luma_bytes, i_chroma_bytes; + + int i_width = p_vout->output.i_width; + int i_height = p_vout->output.i_height; + + switch( p_vout->output.i_chroma ) + { + /* We know this chroma, allocate a buffer which will be used + * directly by the decoder */ + case YUV_420_PICTURE: + + /* Precalculate some values */ + p_pic->i_size = i_width * i_height; + p_pic->i_chroma_width = i_width / 2; + p_pic->i_chroma_size = i_height * ( i_width / 2 ); + + /* Allocate the memory buffer */ + i_luma_bytes = p_pic->i_size * sizeof(pixel_data_t); + i_chroma_bytes = p_pic->i_chroma_size * sizeof(pixel_data_t); + + /* Y buffer */ + p_pic->planes[ Y_PLANE ].p_data = malloc( i_luma_bytes + 2 * i_chroma_bytes ); + p_pic->planes[ Y_PLANE ].i_bytes = i_luma_bytes; + p_pic->planes[ Y_PLANE ].i_line_bytes = i_width * sizeof(pixel_data_t); + + /* U buffer */ + p_pic->planes[ U_PLANE ].p_data = p_pic->planes[ Y_PLANE ].p_data + i_height * i_width; + p_pic->planes[ U_PLANE ].i_bytes = i_chroma_bytes / 2; + p_pic->planes[ U_PLANE ].i_line_bytes = p_pic->i_chroma_width * sizeof(pixel_data_t); + + /* V buffer */ + p_pic->planes[ V_PLANE ].p_data = p_pic->planes[ U_PLANE ].p_data + i_height * p_pic->i_chroma_width; + p_pic->planes[ V_PLANE ].i_bytes = i_chroma_bytes / 2; + p_pic->planes[ V_PLANE ].i_line_bytes = p_pic->i_chroma_width * sizeof(pixel_data_t); + + /* We allocated 3 planes */ + p_pic->i_planes = 3; + + return( 0 ); + break; + + /* Unknown chroma, do nothing */ + default: + + return( 0 ); + break; + } +} + diff --git a/plugins/x11/vout_xvideo.c b/plugins/x11/vout_xvideo.c index cda741edec..0f2a1ad924 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-2001 VideoLAN - * $Id: vout_xvideo.c,v 1.39 2001/12/16 16:18:36 sam Exp $ + * $Id: vout_xvideo.c,v 1.40 2001/12/17 03:38:21 sam Exp $ * * Authors: Shane Harper * Vincent Seguin @@ -609,6 +609,8 @@ static int GetXVideoPort( Display *dpy ) /* No special xv port has been requested so try all of them */ for( i_adaptor = 0; i_adaptor < i_num_adaptors; ++i_adaptor ) { + XvImageFormatValues *p_formats; + int i_format, i_num_formats; int i_port; /* If we requested an adaptor and it's not this one, we aren't @@ -625,94 +627,100 @@ static int GetXVideoPort( Display *dpy ) continue; } - for( i_port = p_adaptor[i_adaptor].base_id; - i_port < p_adaptor[i_adaptor].base_id - + p_adaptor[i_adaptor].num_ports; - i_port++ ) + /* Check that port supports YUV12 planar format... */ + p_formats = XvListImageFormats( dpy, p_adaptor[i_adaptor].base_id, + &i_num_formats ); + + for( i_format = 0; i_format < i_num_formats; i_format++ ) { - XvImageFormatValues *p_formats; - int i_format, i_num_formats; + XvEncodingInfo *p_enc; + int i_enc, i_num_encodings; + XvAttribute *p_attr; + int i_attr, i_num_attributes; - /* If we already found a port, we aren't interested */ - if( i_selected_port != -1 ) + /* If this is not the format we want, forget it */ + if( p_formats[ i_format ].id != GUID_YUV12_PLANAR ) { continue; } - /* Check that port supports YUV12 planar format... */ - p_formats = XvListImageFormats( dpy, i_port, &i_num_formats ); - - for( i_format = 0; i_format < i_num_formats; i_format++ ) + /* Look for the first available port supporting this format */ + for( i_port = p_adaptor[i_adaptor].base_id; + ( i_port < p_adaptor[i_adaptor].base_id + + p_adaptor[i_adaptor].num_ports ) + && ( i_selected_port == -1 ); + i_port++ ) { - XvEncodingInfo *p_enc; - int i_enc, i_num_encodings; - XvAttribute *p_attr; - int i_attr, i_num_attributes; - - if( p_formats[ i_format ].id != GUID_YUV12_PLANAR ) + if( XvGrabPort( dpy, i_port, CurrentTime ) == Success ) { - continue; + i_selected_port = i_port; } + } - /* Found a matching port, print a description of this port */ - i_selected_port = i_port; + /* If no free port was found, forget it */ + if( i_selected_port == -1 ) + { + continue; + } - intf_WarnMsg( 3, "vout: GetXVideoPort found adaptor %i port %i", - i_adaptor, i_port); - intf_WarnMsg( 3, " image format 0x%x (%4.4s) %s supported", - p_formats[ i_format ].id, - (char *)&p_formats[ i_format ].id, - ( p_formats[ i_format ].format - == XvPacked ) ? "packed" : "planar" ); + /* If we found a port, print information about it */ + intf_WarnMsg( 3, "vout: GetXVideoPort found adaptor %i, port %i", + i_adaptor, i_selected_port ); + intf_WarnMsg( 3, " image format 0x%x (%4.4s) %s supported", + p_formats[ i_format ].id, + (char *)&p_formats[ i_format ].id, + ( p_formats[ i_format ].format + == XvPacked ) ? "packed" : "planar" ); - intf_WarnMsg( 4, " encoding list:" ); + intf_WarnMsg( 4, " encoding list:" ); - if( XvQueryEncodings( dpy, i_port, &i_num_encodings, &p_enc ) - != Success ) - { - intf_WarnMsg( 4, " XvQueryEncodings failed" ); - continue; - } - - for( i_enc = 0; i_enc < i_num_encodings; i_enc++ ) - { - intf_WarnMsg( 4, " id=%ld, name=%s, size=%ldx%ld," - " numerator=%d, denominator=%d", - p_enc[i_enc].encoding_id, p_enc[i_enc].name, - p_enc[i_enc].width, p_enc[i_enc].height, - p_enc[i_enc].rate.numerator, - p_enc[i_enc].rate.denominator ); - } + if( XvQueryEncodings( dpy, i_selected_port, + &i_num_encodings, &p_enc ) + != Success ) + { + intf_WarnMsg( 4, " XvQueryEncodings failed" ); + continue; + } - if( p_enc != NULL ) - { - XvFreeEncodingInfo( p_enc ); - } + for( i_enc = 0; i_enc < i_num_encodings; i_enc++ ) + { + intf_WarnMsg( 4, " id=%ld, name=%s, size=%ldx%ld," + " numerator=%d, denominator=%d", + p_enc[i_enc].encoding_id, p_enc[i_enc].name, + p_enc[i_enc].width, p_enc[i_enc].height, + p_enc[i_enc].rate.numerator, + p_enc[i_enc].rate.denominator ); + } - intf_WarnMsg( 4, " attribute list:" ); - p_attr = XvQueryPortAttributes( dpy, i_port, - &i_num_attributes ); - for( i_attr = 0; i_attr < i_num_attributes; i_attr++ ) - { - intf_WarnMsg( 4, - " name=%s, flags=[%s%s ], min=%i, max=%i", - p_attr[i_attr].name, - (p_attr[i_attr].flags & XvGettable) ? " get" : "", - (p_attr[i_attr].flags & XvSettable) ? " set" : "", - p_attr[i_attr].min_value, p_attr[i_attr].max_value ); - } + if( p_enc != NULL ) + { + XvFreeEncodingInfo( p_enc ); + } - if( p_attr != NULL ) - { - XFree( p_attr ); - } + intf_WarnMsg( 4, " attribute list:" ); + p_attr = XvQueryPortAttributes( dpy, i_selected_port, + &i_num_attributes ); + for( i_attr = 0; i_attr < i_num_attributes; i_attr++ ) + { + intf_WarnMsg( 4, + " name=%s, flags=[%s%s ], min=%i, max=%i", + p_attr[i_attr].name, + (p_attr[i_attr].flags & XvGettable) ? " get" : "", + (p_attr[i_attr].flags & XvSettable) ? " set" : "", + p_attr[i_attr].min_value, p_attr[i_attr].max_value ); } - if( p_formats != NULL ) + if( p_attr != NULL ) { - XFree( p_formats ); + XFree( p_attr ); } } + + if( p_formats != NULL ) + { + XFree( p_formats ); + } + } if( i_num_adaptors > 0 ) @@ -724,12 +732,12 @@ static int GetXVideoPort( Display *dpy ) { if( i_requested_adaptor == -1 ) { - intf_WarnMsg( 3, "vout: no XVideo port found supporting YUV12" ); + intf_WarnMsg( 3, "vout: no free XVideo port found for YV12" ); } else { - intf_WarnMsg( 3, "vout: XVideo adaptor %i does not support YUV12", - i_requested_adaptor ); + intf_WarnMsg( 3, "vout: XVideo adaptor %i does not have a free " + "XVideo port for YV12", i_requested_adaptor ); } } diff --git a/src/interface/main.c b/src/interface/main.c index 6ede2858f2..8c041df51d 100644 --- a/src/interface/main.c +++ b/src/interface/main.c @@ -4,7 +4,7 @@ * and spawn threads. ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: main.c,v 1.138 2001/12/16 16:18:36 sam Exp $ + * $Id: main.c,v 1.139 2001/12/17 03:38:21 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -155,16 +155,6 @@ #define SHORT_HELP 1 #define LONG_HELP 2 -/* Needed for x86 CPU capabilities detection */ -#define cpuid( a ) \ - asm volatile ( "cpuid" \ - : "=a" ( i_eax ), \ - "=b" ( i_ebx ), \ - "=c" ( i_ecx ), \ - "=d" ( i_edx ) \ - : "a" ( a ) \ - : "cc" ); - /* Long options */ static const struct option longopts[] = { @@ -218,7 +208,7 @@ static const struct option longopts[] = { "dvdsubtitle", 1, 0, 's' }, { "dvdcss-method", 1, 0, OPT_DVDCSS_METHOD }, { "dvdcss-verbose", 1, 0, OPT_DVDCSS_VERBOSE }, - + /* Input options */ { "input", 1, 0, OPT_INPUT }, { "channels", 0, 0, OPT_CHANNELS }, @@ -289,7 +279,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) p_vout_bank = &vout_bank; #ifdef ENABLE_NLS - /* + /* * Support for getext */ #if defined( HAVE_LOCALE_H ) && defined( HAVE_LC_MESSAGES ) @@ -307,17 +297,17 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) textdomain( PACKAGE ); #endif - + /* * Initialize threads system */ vlc_threads_init( ); /* - * Test if our code is likely to run on this CPU + * Test if our code is likely to run on this CPU */ p_main->i_cpu_capabilities = CPUCapabilities(); - + /* * System specific initialization code */ @@ -856,13 +846,13 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) break; /* Misc options */ - case OPT_SYNCHRO: + case OPT_SYNCHRO: main_PutPszVariable( VPAR_SYNCHRO_VAR, optarg ); break; - case OPT_MEMCPY: + case OPT_MEMCPY: main_PutPszVariable( MEMCPY_METHOD_VAR, optarg ); break; - + /* Decoder options */ case OPT_MPEG_ADEC: main_PutPszVariable( ADEC_MPEG_VAR, optarg ); @@ -1144,7 +1134,7 @@ static void InstructionSignalHandler( int i_signal ) /* Acknowledge the signal received */ i_illegal = 1; - + #ifdef HAVE_SIGRELSE sigrelse( i_signal ); #endif @@ -1160,15 +1150,7 @@ static int CPUCapabilities( void ) { volatile int i_capabilities = CPU_CAPABILITY_NONE; -#if defined( SYS_BEOS ) - i_capabilities |= CPU_CAPABILITY_FPU - | CPU_CAPABILITY_486 - | CPU_CAPABILITY_586 - | CPU_CAPABILITY_MMX; - - return( i_capabilities ); - -#elif defined( SYS_DARWIN ) +#if defined( SYS_DARWIN ) struct host_basic_info hi; kern_return_t ret; host_name_port_t host; @@ -1204,27 +1186,43 @@ static int CPUCapabilities( void ) volatile unsigned int i_eax, i_ebx, i_ecx, i_edx; volatile boolean_t b_amd; + /* Needed for x86 CPU capabilities detection */ +# define cpuid( a ) \ + asm volatile ( "pushl %%ebx\n\t" \ + "cpuid\n\t" \ + "movl %%ebx,%1\n\t" \ + "popl %%ebx\n\t" \ + : "=a" ( i_eax ), \ + "=r" ( i_ebx ), \ + "=c" ( i_ecx ), \ + "=d" ( i_edx ) \ + : "a" ( a ) \ + : "cc" ); + i_capabilities |= CPU_CAPABILITY_FPU; signal( SIGILL, InstructionSignalHandler ); - + /* test for a 486 CPU */ - asm volatile ( "pushfl\n\t" + asm volatile ( "pushl %%ebx\n\t" + "pushfl\n\t" "popl %%eax\n\t" "movl %%eax, %%ebx\n\t" "xorl $0x200000, %%eax\n\t" "pushl %%eax\n\t" "popfl\n\t" "pushfl\n\t" - "popl %%eax" + "popl %%eax\n\t" + "movl %%ebx,%1\n\t" + "popl %%ebx\n\t" : "=a" ( i_eax ), - "=b" ( i_ebx ) + "=r" ( i_ebx ) : : "cc" ); if( i_eax == i_ebx ) { - signal( SIGILL, NULL ); + signal( SIGILL, NULL ); return( i_capabilities ); } @@ -1235,7 +1233,7 @@ static int CPUCapabilities( void ) if( !i_eax ) { - signal( SIGILL, NULL ); + signal( SIGILL, NULL ); return( i_capabilities ); } @@ -1251,7 +1249,7 @@ static int CPUCapabilities( void ) if( ! (i_edx & 0x00800000) ) { - signal( SIGILL, NULL ); + signal( SIGILL, NULL ); return( i_capabilities ); } @@ -1285,13 +1283,13 @@ static int CPUCapabilities( void ) } #endif } - + /* test for additional capabilities */ cpuid( 0x80000000 ); if( i_eax < 0x80000001 ) { - signal( SIGILL, NULL ); + signal( SIGILL, NULL ); return( i_capabilities ); } @@ -1308,7 +1306,7 @@ static int CPUCapabilities( void ) __asm__ __volatile__ ( "pfadd %%mm0,%%mm0\n" "femms\n" : : ); } - if( i_illegal == 0 ) + if( i_illegal == 0 ) { i_capabilities |= CPU_CAPABILITY_3DNOW; } @@ -1320,7 +1318,7 @@ static int CPUCapabilities( void ) i_capabilities |= CPU_CAPABILITY_MMXEXT; } - signal( SIGILL, NULL ); + signal( SIGILL, NULL ); return( i_capabilities ); #elif defined( __powerpc__ ) @@ -1346,7 +1344,7 @@ static int CPUCapabilities( void ) } #endif - signal( SIGILL, NULL ); + signal( SIGILL, NULL ); return( i_capabilities ); #else -- GitLab