VLC_EXPORT( picture_t *, vout_CreatePicture, ( vout_thread_t *, vlc_bool_t, vlc_bool_t, unsigned int ) );
VLC_EXPORT( void, vout_InitFormat, ( video_frame_format_t *, uint32_t, int, int, int ) );
-VLC_EXPORT( void, vout_InitPicture, ( vlc_object_t *, picture_t *, uint32_t, int, int, int ) );
-VLC_EXPORT( void, vout_AllocatePicture,( vlc_object_t *, picture_t *, uint32_t, int, int, int ) );
VLC_EXPORT( void, vout_DestroyPicture, ( vout_thread_t *, picture_t * ) );
VLC_EXPORT( void, vout_DisplayPicture, ( vout_thread_t *, picture_t * ) );
VLC_EXPORT( void, vout_DatePicture, ( vout_thread_t *, picture_t *, mtime_t ) );
* \param i_aspect_x the decoded x-axis portion of i_aspect. This is set.
* \param i_aspect_y the decoded y-axis portion of i_aspect This is set.
*/
-VLC_EXPORT( void, vout_AspectRatio, ( unsigned int i_aspect, unsigned int *i_aspect_x, unsigned int *i_aspect_y ) );
+VLC_EXPORT( void, vout_AspectRatio, ( unsigned int i_aspect, unsigned int *i_aspect_x, unsigned int *i_aspect_y ) );
+
+/**
+ * vout_CopyPicture
+ *
+ * Copy the source picture onto the destination picture.
+ * \param p_this a vlc object
+ * \param p_dst pointer to the destination picture.
+ * \param p_src pointer to the source picture.
+ */
+#define vout_CopyPicture(a,b,c) __vout_CopyPicture(VLC_OBJECT(a),b,c)
+VLC_EXPORT( void, __vout_CopyPicture, ( vlc_object_t *p_this, picture_t *p_dst, picture_t *p_src ) );
+
+/**
+ * vout_InitPicture
+ *
+ * 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 ) );
+
+/**
+ * vout_AllocatePicture
+ *
+ * Initialise different fields of a picture_t and allocates the picture buffer.
+ * \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_AllocatePicture(a,b,c,d,e,f) \
+ __vout_AllocatePicture(VLC_OBJECT(a),b,c,d,e,f)
+VLC_EXPORT( int, __vout_AllocatePicture,( vlc_object_t *p_this, picture_t *p_pic, uint32_t i_chroma, int i_width, int i_height, int i_aspect ) );
/**@}*/
#include "vout_pictures.h"
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-static void CopyPicture( vout_thread_t *, picture_t *, picture_t * );
-
/**
* Display a picture
*
/* We have subtitles. First copy the picture to
* the spare direct buffer, then render the
* subtitles. */
- CopyPicture( p_vout, p_pic, PP_OUTPUTPICTURE[0] );
+ vout_CopyPicture( p_vout, PP_OUTPUTPICTURE[0], p_pic );
vout_RenderSubPictures( p_vout, PP_OUTPUTPICTURE[0],
p_pic , p_subpic );
return NULL;
}
- CopyPicture( p_vout, p_pic, PP_OUTPUTPICTURE[0] );
+ vout_CopyPicture( p_vout, PP_OUTPUTPICTURE[0], p_pic );
vout_RenderSubPictures( p_vout, PP_OUTPUTPICTURE[0], p_pic, p_subpic );
if( PP_OUTPUTPICTURE[0]->pf_unlock )
if( p_vout->p_picture[0].pf_lock( p_vout, &p_vout->p_picture[0] ) )
return NULL;
- CopyPicture( p_vout, p_tmp_pic, &p_vout->p_picture[0] );
+ vout_CopyPicture( p_vout, &p_vout->p_picture[0], p_tmp_pic );
}
else
{
* used exactly like a video buffer. The video output thread then manages
* how it gets displayed.
*/
-void 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 )
+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 )
{
int i_bytes, i_index, i_width_aligned, i_height_aligned;
i_width_aligned = (i_width + 15) >> 4 << 4;
i_height_aligned = (i_height + 15) >> 4 << 4;
- vout_InitPicture( p_this, p_pic, i_chroma,
- i_width, i_height, i_aspect );
+ if( vout_InitPicture( p_this, p_pic, i_chroma,
+ i_width, i_height, i_aspect ) != VLC_SUCCESS )
+ {
+ p_pic->i_planes = 0;
+ return VLC_EGENERIC;
+ }
/* Calculate how big the new image should be */
i_bytes = p_pic->format.i_bits_per_pixel *
if( p_pic->p_data == NULL )
{
p_pic->i_planes = 0;
- return;
+ return VLC_EGENERIC;
}
/* Fill the p_pixels field for each plane */
p_pic->p[i_index].p_pixels = p_pic->p[i_index-1].p_pixels +
p_pic->p[i_index-1].i_lines * p_pic->p[i_index-1].i_pitch;
}
+
+ return VLC_SUCCESS;
}
/**
* \param i_height The height of the picture
* \param i_aspect The aspect ratio of the picture
*/
-void vout_InitPicture( vlc_object_t *p_this, picture_t *p_pic,
- vlc_fourcc_t i_chroma,
- int i_width, int i_height, int i_aspect )
+int __vout_InitPicture( vlc_object_t *p_this, picture_t *p_pic,
+ vlc_fourcc_t i_chroma,
+ int i_width, int i_height, int i_aspect )
{
int i_index, i_width_aligned, i_height_aligned;
msg_Err( p_this, "unknown chroma type 0x%.8x (%4.4s)",
i_chroma, (char*)&i_chroma );
p_pic->i_planes = 0;
- return;
+ return VLC_EGENERIC;
}
+
+ return VLC_SUCCESS;
}
/**
}
}
-/* Following functions are local */
-
/*****************************************************************************
- * CopyPicture: copy a picture to another one
+ * vout_CopyPicture: copy a picture to another one
*****************************************************************************
* This function takes advantage of the image format, and reduces the
* number of calls to memcpy() to the minimum. Source and destination
* images must have same width (hence i_visible_pitch), height, and chroma.
*****************************************************************************/
-static void CopyPicture( vout_thread_t * p_vout,
- picture_t *p_src, picture_t *p_dest )
+void __vout_CopyPicture( vlc_object_t *p_this,
+ picture_t *p_dest, picture_t *p_src )
{
int i;
if( p_src->p[i].i_pitch == p_dest->p[i].i_pitch )
{
/* There are margins, but with the same width : perfect ! */
- p_vout->p_vlc->pf_memcpy(
+ p_this->p_vlc->pf_memcpy(
p_dest->p[i].p_pixels, p_src->p[i].p_pixels,
p_src->p[i].i_pitch * p_src->p[i].i_visible_lines );
}
for( i_line = p_src->p[i].i_visible_lines; i_line--; )
{
- p_vout->p_vlc->pf_memcpy( p_out, p_in,
+ p_this->p_vlc->pf_memcpy( p_out, p_in,
p_src->p[i].i_visible_pitch );
p_in += p_src->p[i].i_pitch;
p_out += p_dest->p[i].i_pitch;
}
}
}
+
p_dest->date = p_src->date;
}