* vout_dummy.c: Dummy video output display method for testing purposes
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
- * $Id: vout_dummy.c,v 1.12 2001/12/16 16:18:36 sam Exp $
+ * $Id: vout_dummy.c,v 1.15 2002/01/04 14:01:34 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
-#define MODULE_NAME dummy
-#include "modules_inner.h"
-
/*****************************************************************************
* Preamble
*****************************************************************************/
-#include "defs.h"
-
#include <errno.h> /* ENOMEM */
#include <stdlib.h> /* free() */
#include <string.h> /* strerror() */
-#include "common.h"
-#include "intf_msg.h"
-#include "threads.h"
-#include "mtime.h"
-#include "tests.h"
+#include <videolan/vlc.h>
#include "video.h"
#include "video_output.h"
-#include "modules.h"
-#include "modules_export.h"
-
#define DUMMY_WIDTH 16
#define DUMMY_HEIGHT 16
#define DUMMY_MAX_DIRECTBUFFERS 5
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_Render ( struct vout_thread_s *, struct picture_s * );
static void vout_Display ( struct vout_thread_s *, struct picture_s * );
static int DummyNewPicture( struct vout_thread_s *, struct picture_s * );
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_render = vout_Render;
p_function_list->functions.vout.pf_display = vout_Display;
p_function_list->functions.vout.pf_setpalette = NULL;
}
*****************************************************************************/
static int vout_Probe( probedata_t *p_data )
{
- if( TestMethod( VOUT_METHOD_VAR, "dummy" ) )
- {
- return( 999 );
- }
-
return( 1 );
}
/* Initialize the output structure */
switch( p_vout->render.i_chroma )
{
- case YUV_420_PICTURE:
+ case FOURCC_I420:
+ case FOURCC_IYUV:
+ case FOURCC_YV12:
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;
break;
default:
- p_vout->output.i_chroma = RGB_16BPP_PICTURE;
+ p_vout->output.i_chroma = FOURCC_RV16;
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;
}
/* Allocate the picture */
- if( DummyNewPicture( p_vout, p_pic ) )
+ if( p_pic == NULL || DummyNewPicture( 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;
+ p_pic->i_status = DESTROYED_PICTURE;
+ p_pic->i_type = DIRECT_PICTURE;
PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic;
for( i_index = I_OUTPUTPICTURES ; i_index ; )
{
i_index--;
- free( PP_OUTPUTPICTURE[ i_index ]->planes[ 0 ].p_data );
+ free( PP_OUTPUTPICTURE[ i_index ]->p_data );
}
}
return( 0 );
}
+/*****************************************************************************
+ * vout_Render: render previously calculated output
+ *****************************************************************************/
+static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic )
+{
+ /* No need to do anything, the fake direct buffers stay as they are */
+}
+
/*****************************************************************************
* vout_Display: displays previously rendered output
- *****************************************************************************
- * This function send the currently rendered image to dummy 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 )
{
/* No need to do anything, the fake direct buffers stay as they are */
}
-
/*****************************************************************************
* DummyNewPicture: allocate a picture
*****************************************************************************
*****************************************************************************/
static int DummyNewPicture( 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;
{
/* 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_width * ( i_height / 2 );
+ case FOURCC_I420:
+ case FOURCC_IYUV:
+ case FOURCC_YV12:
/* 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);
+ p_pic->p_data = memalign( 16, i_width * i_height * 3 / 2 );
/* 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);
+ p_pic->Y_PIXELS = p_pic->p_data;
+ p_pic->p[Y_PLANE].i_lines = i_height;
+ p_pic->p[Y_PLANE].i_pitch = i_width;
+ p_pic->p[Y_PLANE].i_pixel_bytes = 1;
+ p_pic->p[Y_PLANE].b_margin = 0;
/* 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);
+ p_pic->U_PIXELS = p_pic->Y_PIXELS + i_height * i_width;
+ p_pic->p[U_PLANE].i_lines = i_height / 2;
+ p_pic->p[U_PLANE].i_pitch = i_width / 2;
+ p_pic->p[U_PLANE].i_pixel_bytes = 1;
+ p_pic->p[U_PLANE].b_margin = 0;
/* 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);
+ p_pic->V_PIXELS = p_pic->U_PIXELS + i_height * i_width / 4;
+ p_pic->p[V_PLANE].i_lines = i_height / 2;
+ p_pic->p[V_PLANE].i_pitch = i_width / 2;
+ p_pic->p[V_PLANE].i_pixel_bytes = 1;
+ p_pic->p[V_PLANE].b_margin = 0;
/* We allocated 3 planes */
p_pic->i_planes = 3;
/* Unknown chroma, allocate an RGB buffer, the video output's job
* will be to do the chroma->RGB conversion */
- default:
-
- /* Precalculate some values */
- i_luma_bytes = sizeof(u16) * i_width * i_height;
+ case FOURCC_RV16:
/* Allocate the memory buffer */
- p_pic->planes[ RGB_PLANE ].p_data = malloc( i_luma_bytes );
- p_pic->planes[ RGB_PLANE ].i_bytes = i_luma_bytes;
+ p_pic->p_data = memalign( 16, i_width * i_height * 2 );
+
+ /* Fill important structures */
+ p_pic->p->p_pixels = p_pic->p_data;
+ p_pic->p->i_lines = i_height;
+ p_pic->p->i_pitch = i_width;
+ p_pic->p->i_pixel_bytes = 2;
+ p_pic->p->b_margin = 0;
+ p_pic->p->i_red_mask = 0xf800;
+ p_pic->p->i_green_mask = 0x07e0;
+ p_pic->p->i_blue_mask = 0x001f;
/* We allocated 1 plane */
p_pic->i_planes = 1;
return( 0 );
break;
+
+ default:
+ p_pic->i_planes = 0;
+ return( 0 );
+ break;
}
}