Commit 0ba8129e authored by Laurent Aimar's avatar Laurent Aimar

Replaced vout_InitPicture/Format with their equivalent.

parent 4179a9e5
...@@ -74,19 +74,6 @@ struct picture_heap_t ...@@ -74,19 +74,6 @@ struct picture_heap_t
* Prototypes * Prototypes
*****************************************************************************/ *****************************************************************************/
/**
* Initialise different fields of a picture_t (but does not allocate memory).
* \param p_this a vlc object
* \param p_pic pointer to the picture structure.
* \param i_chroma the wanted chroma for the picture.
* \param i_width the wanted width for the picture.
* \param i_height the wanted height for the picture.
* \param i_aspect the wanted aspect ratio for the picture.
*/
#define vout_InitPicture(a,b,c,d,e,f) \
__vout_InitPicture(VLC_OBJECT(a),b,c,d,e,f)
VLC_EXPORT( int, __vout_InitPicture, ( vlc_object_t *p_this, picture_t *p_pic, uint32_t i_chroma, int i_width, int i_height, int i_aspect ) );
/** /**
* Initialise different fields of a picture_t and allocates the picture buffer. * Initialise different fields of a picture_t and allocates the picture buffer.
* \param p_this a vlc object * \param p_this a vlc object
...@@ -317,7 +304,6 @@ VLC_EXPORT( int, vout_GetSnapshot, ( vout_thread_t *p_vout, ...@@ -317,7 +304,6 @@ VLC_EXPORT( int, vout_GetSnapshot, ( vout_thread_t *p_vout,
VLC_EXPORT( int, vout_ChromaCmp, ( uint32_t, uint32_t ) ); VLC_EXPORT( int, vout_ChromaCmp, ( uint32_t, uint32_t ) );
VLC_EXPORT( picture_t *, vout_CreatePicture, ( vout_thread_t *, bool, bool, unsigned int ) ); VLC_EXPORT( picture_t *, vout_CreatePicture, ( vout_thread_t *, bool, bool, unsigned int ) );
VLC_EXPORT( void, vout_InitFormat, ( video_frame_format_t *, uint32_t, int, int, int ) );
VLC_EXPORT( void, vout_DestroyPicture, ( vout_thread_t *, picture_t * ) ); VLC_EXPORT( void, vout_DestroyPicture, ( vout_thread_t *, picture_t * ) );
VLC_EXPORT( void, vout_DisplayPicture, ( vout_thread_t *, picture_t * ) ); VLC_EXPORT( void, vout_DisplayPicture, ( vout_thread_t *, picture_t * ) );
VLC_EXPORT( void, vout_LinkPicture, ( vout_thread_t *, picture_t * ) ); VLC_EXPORT( void, vout_LinkPicture, ( vout_thread_t *, picture_t * ) );
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_input.h> #include <vlc_input.h>
#include <vlc_vout.h>
#include <vlc_demux.h> #include <vlc_demux.h>
...@@ -215,7 +214,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -215,7 +214,6 @@ static int Open( vlc_object_t *p_this )
int i; int i;
int i_width; int i_width;
int i_height; int i_height;
int i_aspect;
int result = 0; int result = 0;
if( strncmp(p_demux->psz_access, "dc1394", 6) != 0 ) if( strncmp(p_demux->psz_access, "dc1394", 6) != 0 )
...@@ -477,10 +475,14 @@ static int Open( vlc_object_t *p_this ) ...@@ -477,10 +475,14 @@ static int Open( vlc_object_t *p_this )
i_width = p_sys->camera.frame_width; i_width = p_sys->camera.frame_width;
i_height = p_sys->camera.frame_height; i_height = p_sys->camera.frame_height;
i_aspect = vout_InitPicture( VLC_OBJECT(p_demux), &p_sys->pic, if( picture_Setup( &p_sys->pic, VLC_CODEC_UYVY,
VLC_CODEC_UYVY, i_width, i_height,
i_width, i_height, i_width * VOUT_ASPECT_FACTOR / i_height ) )
i_width * VOUT_ASPECT_FACTOR / i_height ); {
msg_Err( p_demux ,"unknown chroma" );
Close( p_this );
return VLC_EGENERIC;
}
es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_UYVY ); es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_UYVY );
......
...@@ -336,11 +336,11 @@ void RenderCursor( demux_t *p_demux, int i_x, int i_y, ...@@ -336,11 +336,11 @@ void RenderCursor( demux_t *p_demux, int i_x, int i_y,
{ {
demux_sys_t *p_sys = p_demux->p_sys; demux_sys_t *p_sys = p_demux->p_sys;
if( !p_sys->dst.i_planes ) if( !p_sys->dst.i_planes )
vout_InitPicture( p_demux, &p_sys->dst, picture_Setup( &p_sys->dst,
p_sys->fmt.video.i_chroma, p_sys->fmt.video.i_chroma,
p_sys->fmt.video.i_width, p_sys->fmt.video.i_width,
p_sys->fmt.video.i_height, p_sys->fmt.video.i_height,
p_sys->fmt.video.i_aspect ); p_sys->fmt.video.i_aspect );
if( !p_sys->p_blend ) if( !p_sys->p_blend )
{ {
p_sys->p_blend = vlc_object_create( p_demux, sizeof(filter_t) ); p_sys->p_blend = vlc_object_create( p_demux, sizeof(filter_t) );
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include <vlc_input.h> #include <vlc_input.h>
#include <vlc_demux.h> #include <vlc_demux.h>
#include <vlc_access.h> #include <vlc_access.h>
#include <vlc_vout.h> #include <vlc_picture.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/mman.h> #include <sys/mman.h>
...@@ -1072,10 +1072,9 @@ static int OpenVideoDev( demux_t *p_demux, char *psz_device ) ...@@ -1072,10 +1072,9 @@ static int OpenVideoDev( demux_t *p_demux, char *psz_device )
else else
{ {
/* Fill in picture_t fields */ /* Fill in picture_t fields */
vout_InitPicture( VLC_OBJECT(p_demux), &p_sys->pic, p_sys->i_fourcc, if( picture_Setup( &p_sys->pic, p_sys->i_fourcc,
p_sys->i_width, p_sys->i_height, p_sys->i_width * p_sys->i_width, p_sys->i_height, p_sys->i_width *
VOUT_ASPECT_FACTOR / p_sys->i_height ); VOUT_ASPECT_FACTOR / p_sys->i_height ) )
if( !p_sys->pic.i_planes )
{ {
msg_Err( p_demux, "unsupported chroma" ); msg_Err( p_demux, "unsupported chroma" );
goto vdev_failed; goto vdev_failed;
......
...@@ -190,9 +190,9 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -190,9 +190,9 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{ {
msg_Dbg( p_dec, "video size is perhaps %dx%d", i_width, msg_Dbg( p_dec, "video size is perhaps %dx%d", i_width,
i_height); i_height);
vout_InitFormat( &p_dec->fmt_out.video, VLC_CODEC_I420, video_format_Setup( &p_dec->fmt_out.video, VLC_CODEC_I420,
i_width, i_height, i_width, i_height,
VOUT_ASPECT_FACTOR * i_width / i_height ); VOUT_ASPECT_FACTOR * i_width / i_height );
p_sys->b_inited = true; p_sys->b_inited = true;
} }
p_pic = NULL; p_pic = NULL;
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_codec.h> #include <vlc_codec.h>
#include <vlc_vout.h>
/***************************************************************************** /*****************************************************************************
* decoder_sys_t : raw video decoder descriptor * decoder_sys_t : raw video decoder descriptor
...@@ -157,10 +156,10 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -157,10 +156,10 @@ static int OpenDecoder( vlc_object_t *p_this )
} }
/* Find out p_vdec->i_raw_size */ /* Find out p_vdec->i_raw_size */
vout_InitFormat( &p_dec->fmt_out.video, p_dec->fmt_in.i_codec, video_format_Setup( &p_dec->fmt_out.video, p_dec->fmt_in.i_codec,
p_dec->fmt_in.video.i_width, p_dec->fmt_in.video.i_width,
p_dec->fmt_in.video.i_height, p_dec->fmt_in.video.i_height,
p_dec->fmt_in.video.i_aspect ); p_dec->fmt_in.video.i_aspect );
p_sys->i_raw_size = p_dec->fmt_out.video.i_bits_per_pixel * p_sys->i_raw_size = p_dec->fmt_out.video.i_bits_per_pixel *
p_dec->fmt_out.video.i_width * p_dec->fmt_out.video.i_height / 8; p_dec->fmt_out.video.i_width * p_dec->fmt_out.video.i_height / 8;
...@@ -321,9 +320,9 @@ static block_t *SendFrame( decoder_t *p_dec, block_t *p_block ) ...@@ -321,9 +320,9 @@ static block_t *SendFrame( decoder_t *p_dec, block_t *p_block )
int i, j; int i, j;
/* Fill in picture_t fields */ /* Fill in picture_t fields */
vout_InitPicture( VLC_OBJECT(p_dec), &pic, p_dec->fmt_out.i_codec, picture_Setup( &pic, p_dec->fmt_out.i_codec,
p_dec->fmt_out.video.i_width, p_dec->fmt_out.video.i_width,
p_dec->fmt_out.video.i_height, VOUT_ASPECT_FACTOR ); p_dec->fmt_out.video.i_height, VOUT_ASPECT_FACTOR );
if( !pic.i_planes ) if( !pic.i_planes )
{ {
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_demux.h> #include <vlc_demux.h>
#include <vlc_vout.h> /* vout_InitFormat */
#include <assert.h> #include <assert.h>
/***************************************************************************** /*****************************************************************************
...@@ -357,8 +356,8 @@ static int Open( vlc_object_t * p_this ) ...@@ -357,8 +356,8 @@ static int Open( vlc_object_t * p_this )
} }
es_format_Init( &p_sys->fmt_video, VIDEO_ES, i_chroma ); es_format_Init( &p_sys->fmt_video, VIDEO_ES, i_chroma );
vout_InitFormat( &p_sys->fmt_video.video, i_chroma, i_width, i_height, video_format_Setup( &p_sys->fmt_video.video,
i_aspect ); i_chroma, i_width, i_height, i_aspect );
vlc_ureduce( &p_sys->fmt_video.video.i_frame_rate, vlc_ureduce( &p_sys->fmt_video.video.i_frame_rate,
&p_sys->fmt_video.video.i_frame_rate_base, &p_sys->fmt_video.video.i_frame_rate_base,
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_sout.h> #include <vlc_sout.h>
#include <vlc_vout.h>
#include <vlc_avcodec.h> #include <vlc_avcodec.h>
#include <vlc_block.h> #include <vlc_block.h>
...@@ -613,9 +612,13 @@ static int UnpackFromFile( sout_stream_t *p_stream, const char *psz_file, ...@@ -613,9 +612,13 @@ static int UnpackFromFile( sout_stream_t *p_stream, const char *psz_file,
return -1; return -1;
} }
vout_InitPicture( VLC_OBJECT(p_stream), p_pic, VLC_CODEC_I420, if( picture_Setup( p_pic, VLC_CODEC_I420,
i_width, i_height, i_width, i_height,
i_width * VOUT_ASPECT_FACTOR / i_height ); i_width * VOUT_ASPECT_FACTOR / i_height ) )
{
msg_Err( p_stream, "unknown chroma" );
return -1;
}
for ( i = 0; i < p_pic->i_planes; i++ ) for ( i = 0; i < p_pic->i_planes; i++ )
{ {
p_pic->p[i].p_pixels = malloc( p_pic->p[i].i_lines * p_pic->p[i].p_pixels = malloc( p_pic->p[i].i_lines *
......
...@@ -56,8 +56,8 @@ overlay_t *OverlayCreate( void ) ...@@ -56,8 +56,8 @@ overlay_t *OverlayCreate( void )
p_ovl->i_x = p_ovl->i_y = 0; p_ovl->i_x = p_ovl->i_y = 0;
p_ovl->i_alpha = 0xFF; p_ovl->i_alpha = 0xFF;
p_ovl->b_active = false; p_ovl->b_active = false;
vout_InitFormat( &p_ovl->format, VLC_FOURCC( '\0','\0','\0','\0') , 0, 0, video_format_Setup( &p_ovl->format, VLC_FOURCC( '\0','\0','\0','\0') , 0, 0,
VOUT_ASPECT_FACTOR ); VOUT_ASPECT_FACTOR );
p_ovl->p_fontstyle = text_style_New(); p_ovl->p_fontstyle = text_style_New();
p_ovl->data.p_text = NULL; p_ovl->data.p_text = NULL;
...@@ -465,8 +465,8 @@ static int exec_DataSharedMem( filter_t *p_filter, ...@@ -465,8 +465,8 @@ static int exec_DataSharedMem( filter_t *p_filter,
return VLC_ENOMEM; return VLC_ENOMEM;
} }
vout_InitFormat( &p_ovl->format, VLC_CODEC_TEXT, video_format_Setup( &p_ovl->format, VLC_CODEC_TEXT,
0, 0, 0 ); 0, 0, 0 );
p_data = shmat( p_params->i_shmid, NULL, SHM_RDONLY ); p_data = shmat( p_params->i_shmid, NULL, SHM_RDONLY );
if( p_data == NULL ) if( p_data == NULL )
...@@ -489,9 +489,9 @@ static int exec_DataSharedMem( filter_t *p_filter, ...@@ -489,9 +489,9 @@ static int exec_DataSharedMem( filter_t *p_filter,
if( p_ovl->data.p_pic == NULL ) if( p_ovl->data.p_pic == NULL )
return VLC_ENOMEM; return VLC_ENOMEM;
vout_InitFormat( &p_ovl->format, p_params->fourcc, video_format_Setup( &p_ovl->format, p_params->fourcc,
p_params->i_width, p_params->i_height, p_params->i_width, p_params->i_height,
VOUT_ASPECT_FACTOR ); VOUT_ASPECT_FACTOR );
if( vout_AllocatePicture( p_filter, p_ovl->data.p_pic, if( vout_AllocatePicture( p_filter, p_ovl->data.p_pic,
p_ovl->format.i_chroma, p_params->i_width, p_ovl->format.i_chroma, p_params->i_width,
p_params->i_height, p_ovl->format.i_aspect ) ) p_params->i_height, p_ovl->format.i_aspect ) )
......
...@@ -415,9 +415,13 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -415,9 +415,13 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
} }
/* Fill in picture_t fields */ /* Fill in picture_t fields */
vout_InitPicture( VLC_OBJECT(p_vout), p_pic, p_vout->output.i_chroma, if( picture_Setup( p_pic, p_vout->output.i_chroma,
p_vout->output.i_width, p_vout->output.i_height, p_vout->output.i_width, p_vout->output.i_height,
p_vout->output.i_aspect ); p_vout->output.i_aspect ) )
{
free( p_pic );
return VLC_EGENERIC;
}
p_pic->p_sys->p_data = malloc( p_vout->p_sys->i_page_size ); p_pic->p_sys->p_data = malloc( p_vout->p_sys->i_page_size );
if( !p_pic->p_sys->p_data ) if( !p_pic->p_sys->p_data )
......
...@@ -257,9 +257,9 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -257,9 +257,9 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
} }
/* Fill in picture_t fields */ /* Fill in picture_t fields */
vout_InitPicture( VLC_OBJECT(p_vout), p_pic, p_vout->output.i_chroma, picture_Setup( p_pic, p_vout->output.i_chroma,
p_vout->output.i_width, p_vout->output.i_height, p_vout->output.i_width, p_vout->output.i_height,
p_vout->output.i_aspect ); p_vout->output.i_aspect );
p_pic->p_sys->p_image = new CascadeSharedMemZone(); p_pic->p_sys->p_image = new CascadeSharedMemZone();
if( p_pic->p_sys->p_image == NULL ) if( p_pic->p_sys->p_image == NULL )
......
...@@ -231,9 +231,13 @@ static int Init( vout_thread_t *p_vout ) ...@@ -231,9 +231,13 @@ static int Init( vout_thread_t *p_vout )
return VLC_SUCCESS; return VLC_SUCCESS;
} }
vout_InitPicture( VLC_OBJECT(p_vout), p_pic, p_vout->output.i_chroma, if( picture_Setup( p_pic, p_vout->output.i_chroma,
p_vout->output.i_width, p_vout->output.i_height, p_vout->output.i_width, p_vout->output.i_height,
p_vout->output.i_aspect ); p_vout->output.i_aspect ) )
{
free( p_pic );
return VLC_EGENERIC;
}
p_pic->p->i_pitch = i_pitch; p_pic->p->i_pitch = i_pitch;
......
...@@ -1865,9 +1865,10 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1865,9 +1865,10 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
#endif #endif
/* Fill in picture_t fields */ /* Fill in picture_t fields */
vout_InitPicture( VLC_OBJECT(p_vout), p_pic, p_vout->output.i_chroma, if( picture_Setup( p_pic, p_vout->output.i_chroma,
p_vout->output.i_width, p_vout->output.i_height, p_vout->output.i_width, p_vout->output.i_height,
p_vout->output.i_aspect ); p_vout->output.i_aspect ) )
return -1;
#ifdef HAVE_SYS_SHM_H #ifdef HAVE_SYS_SHM_H
if( p_vout->p_sys->i_shm_opcode ) if( p_vout->p_sys->i_shm_opcode )
...@@ -1965,7 +1966,7 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1965,7 +1966,7 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
p_pic->p->i_pitch = p_pic->p_sys->p_image->bytes_per_line; p_pic->p->i_pitch = p_pic->p_sys->p_image->bytes_per_line;
/* p_pic->p->i_pixel_pitch = 4 for RV24 but this should be set /* p_pic->p->i_pixel_pitch = 4 for RV24 but this should be set
* properly by vout_InitPicture() */ * properly by picture_Setup() */
p_pic->p->i_visible_pitch = p_pic->p->i_pixel_pitch p_pic->p->i_visible_pitch = p_pic->p->i_pixel_pitch
* p_pic->p_sys->p_image->width; * p_pic->p_sys->p_image->width;
break; break;
......
...@@ -346,9 +346,9 @@ static int Init (vout_thread_t *vout) ...@@ -346,9 +346,9 @@ static int Init (vout_thread_t *vout)
if (pic->i_status != FREE_PICTURE) if (pic->i_status != FREE_PICTURE)
continue; continue;
vout_InitPicture (vout, pic, vout->output.i_chroma, picture_Setup (pic, vout->output.i_chroma,
vout->output.i_width, vout->output.i_height, vout->output.i_width, vout->output.i_height,
vout->output.i_aspect); vout->output.i_aspect);
if (PictureAlloc (vout, pic, pic->p->i_pitch * pic->p->i_lines, if (PictureAlloc (vout, pic, pic->p->i_pitch * pic->p->i_lines,
p_sys->shm ? p_sys->conn : NULL)) p_sys->shm ? p_sys->conn : NULL))
break; break;
......
...@@ -456,9 +456,9 @@ found_adaptor: ...@@ -456,9 +456,9 @@ found_adaptor:
if (pic->i_status != FREE_PICTURE) if (pic->i_status != FREE_PICTURE)
continue; continue;
vout_InitPicture (vout, pic, vout->output.i_chroma, picture_Setup (pic, vout->output.i_chroma,
att->width, att->height, att->width, att->height,
vout->fmt_in.i_aspect); vout->fmt_in.i_aspect);
if (PictureAlloc (vout, pic, att->data_size, if (PictureAlloc (vout, pic, att->data_size,
p_sys->shm ? p_sys->conn : NULL)) p_sys->shm ? p_sys->conn : NULL))
break; break;
......
...@@ -210,8 +210,8 @@ static void* Thread( vlc_object_t *p_this ) ...@@ -210,8 +210,8 @@ static void* Thread( vlc_object_t *p_this )
vlc_object_attach( p_thread->p_opengl, p_this ); vlc_object_attach( p_thread->p_opengl, p_this );
/* Initialize vout parameters */ /* Initialize vout parameters */
vout_InitFormat( &p_thread->p_opengl->fmt_in, video_format_Setup( &p_thread->p_opengl->fmt_in,
VLC_CODEC_RGB32, p_thread->i_width, p_thread->i_height, 1 ); VLC_CODEC_RGB32, p_thread->i_width, p_thread->i_height, 1 );
p_thread->p_opengl->i_window_width = p_thread->i_width; p_thread->p_opengl->i_window_width = p_thread->i_width;
p_thread->p_opengl->i_window_height = p_thread->i_height; p_thread->p_opengl->i_window_height = p_thread->i_height;
p_thread->p_opengl->render.i_width = p_thread->i_width; p_thread->p_opengl->render.i_width = p_thread->i_width;
......
...@@ -529,8 +529,6 @@ vout_DestroyPicture ...@@ -529,8 +529,6 @@ vout_DestroyPicture
vout_DisplayPicture vout_DisplayPicture
vout_EnableFilter vout_EnableFilter
vout_GetSnapshot vout_GetSnapshot
vout_InitFormat
__vout_InitPicture
vout_LinkPicture vout_LinkPicture
vout_OSDIcon vout_OSDIcon
__vout_OSDMessage __vout_OSDMessage
......
This diff is collapsed.
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