X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fvideo_output%2Fvout_pictures.c;h=9e57973f7e495b69661dc637ddd4126c56db9aff;hb=2deed367f004bc8db10370bb2f91be477b1d0ad7;hp=c61fe74691cd553d8cb60a5e52c9f6aa435226b0;hpb=ad77d955a5dc051976d94d6e08ee0f717ec3a938;p=vlc diff --git a/src/video_output/vout_pictures.c b/src/video_output/vout_pictures.c index c61fe74691..9e57973f7e 100644 --- a/src/video_output/vout_pictures.c +++ b/src/video_output/vout_pictures.c @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include "vout_pictures.h" #include "vout_internal.h" @@ -333,7 +335,7 @@ static void vout_UnlockPicture( vout_thread_t *p_vout, picture_t *p_picture ) * thread which direct buffer needs to be displayed. */ picture_t *vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, - subpicture_t *p_subpic, bool b_paused ) + subpicture_t *p_subpic, mtime_t render_date ) { if( p_pic == NULL ) return NULL; @@ -354,7 +356,7 @@ picture_t *vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, spu_RenderSubpictures( p_vout->p_spu, PP_OUTPUTPICTURE[0], &p_vout->fmt_out, - p_subpic, &p_vout->fmt_in, b_paused ); + p_subpic, &p_vout->fmt_in, render_date ); vout_UnlockPicture( p_vout, PP_OUTPUTPICTURE[0] ); @@ -381,7 +383,7 @@ picture_t *vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, picture_Copy( PP_OUTPUTPICTURE[0], p_pic ); spu_RenderSubpictures( p_vout->p_spu, PP_OUTPUTPICTURE[0], &p_vout->fmt_out, - p_subpic, &p_vout->fmt_in, b_paused ); + p_subpic, &p_vout->fmt_in, render_date ); vout_UnlockPicture( p_vout, PP_OUTPUTPICTURE[0] ); @@ -417,7 +419,7 @@ picture_t *vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, /* Render subpictures on the first direct buffer */ spu_RenderSubpictures( p_vout->p_spu, p_tmp_pic, &p_vout->fmt_out, - p_subpic, &p_vout->fmt_in, b_paused ); + p_subpic, &p_vout->fmt_in, render_date ); if( vout_LockPicture( p_vout, &p_vout->p_picture[0] ) ) return NULL; @@ -436,7 +438,7 @@ picture_t *vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, /* Render subpictures on the first direct buffer */ spu_RenderSubpictures( p_vout->p_spu, &p_vout->p_picture[0], &p_vout->fmt_out, - p_subpic, &p_vout->fmt_in, b_paused ); + p_subpic, &p_vout->fmt_in, render_date ); } vout_UnlockPicture( p_vout, &p_vout->p_picture[0] ); @@ -552,6 +554,7 @@ int __vout_AllocatePicture( vlc_object_t *p_this, picture_t *p_pic, vlc_fourcc_t i_chroma, int i_width, int i_height, int i_aspect ) { + VLC_UNUSED(p_this); int i_bytes, i_index, i_width_aligned, i_height_aligned; /* Make sure the real dimensions are a multiple of 16 */ @@ -649,6 +652,20 @@ static void PictureReleaseCallback( picture_t *p_picture ) picture_Delete( p_picture ); } +/***************************************************************************** + * + *****************************************************************************/ +void picture_Reset( picture_t *p_picture ) +{ + /* */ + p_picture->date = VLC_TS_INVALID; + p_picture->b_force = false; + p_picture->b_progressive = false; + p_picture->i_nb_fields = 0; + p_picture->b_top_field_first = false; + picture_CleanupQuant( p_picture ); +} + /***************************************************************************** * *****************************************************************************/ @@ -900,25 +917,65 @@ int picture_Setup( picture_t *p_picture, vlc_fourcc_t i_chroma, int i_width, int /***************************************************************************** * *****************************************************************************/ -picture_t *picture_New( vlc_fourcc_t i_chroma, int i_width, int i_height, int i_aspect ) +picture_t *picture_NewFromResource( const video_format_t *p_fmt, const picture_resource_t *p_resource ) { + video_format_t fmt = *p_fmt; + + /* It is needed to be sure all informations are filled */ + video_format_Setup( &fmt, p_fmt->i_chroma, + p_fmt->i_width, p_fmt->i_height, p_fmt->i_aspect ); + + /* */ picture_t *p_picture = calloc( 1, sizeof(*p_picture) ); if( !p_picture ) return NULL; - if( __vout_AllocatePicture( NULL, p_picture, - i_chroma, i_width, i_height, i_aspect ) ) + if( p_resource ) { - free( p_picture ); - return NULL; - } + if( picture_Setup( p_picture, fmt.i_chroma, fmt.i_width, fmt.i_height, fmt.i_aspect ) ) + { + free( p_picture ); + return NULL; + } + p_picture->p_sys = p_resource->p_sys; + for( int i = 0; i < p_picture->i_planes; i++ ) + { + p_picture->p[i].p_pixels = p_resource->p[i].p_pixels; + p_picture->p[i].i_lines = p_resource->p[i].i_lines; + p_picture->p[i].i_pitch = p_resource->p[i].i_pitch; + } + } + else + { + if( __vout_AllocatePicture( NULL, p_picture, + fmt.i_chroma, fmt.i_width, fmt.i_height, fmt.i_aspect ) ) + { + free( p_picture ); + return NULL; + } + } + /* */ + p_picture->format = fmt; p_picture->i_refcount = 1; p_picture->pf_release = PictureReleaseCallback; p_picture->i_status = RESERVED_PICTURE; return p_picture; } +picture_t *picture_NewFromFormat( const video_format_t *p_fmt ) +{ + return picture_NewFromResource( p_fmt, NULL ); +} +picture_t *picture_New( vlc_fourcc_t i_chroma, int i_width, int i_height, int i_aspect ) +{ + video_format_t fmt; + + memset( &fmt, 0, sizeof(fmt) ); + video_format_Setup( &fmt, i_chroma, i_width, i_height, i_aspect ); + + return picture_NewFromFormat( &fmt ); +} /***************************************************************************** * @@ -1053,6 +1110,3 @@ int picture_Export( vlc_object_t *p_obj, return VLC_SUCCESS; } -/***************************************************************************** - * - *****************************************************************************/