X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=include%2Fvlc_vout.h;h=d3382771abdb0de8d41200fec1a56d4b2b50f9c3;hb=54b65bedc9a2abe2461f650c0d40b387f0839174;hp=fc8306b98ee31c9e693d9a4528ae3b8064a11b03;hpb=fbb8255dcf8ced858d59927cb17c4f577a8d9c15;p=vlc diff --git a/include/vlc_vout.h b/include/vlc_vout.h index fc8306b98e..d3382771ab 100644 --- a/include/vlc_vout.h +++ b/include/vlc_vout.h @@ -115,6 +115,75 @@ struct picture_t struct picture_t *p_next; }; +/** + * This function will create a new picture. + * The picture created will implement a default release management compatible + * with picture_Yield and picture_Release. This default management will release + * picture_sys_t *p_sys field if non NULL. + */ +VLC_EXPORT( picture_t *, picture_New, ( vlc_fourcc_t i_chroma, int i_width, int i_height, int i_aspect ) ); + +/** + * This function will force the destruction a picture. + * The value of the picture reference count should be 0 before entering this + * function. + * Unless used for reimplementing pf_release, you should not use this + * function but picture_Release. + */ +VLC_EXPORT( void, picture_Delete, ( picture_t * ) ); + +/** + * This function will increase the picture reference count. + * It will not have any effect on picture obtained from vout + */ +static inline void picture_Yield( picture_t *p_picture ) +{ + if( p_picture->pf_release ) + p_picture->i_refcount++; +} +/** + * This function will release a picture. + * It will not have any effect on picture obtained from vout + */ +static inline void picture_Release( picture_t *p_picture ) +{ + /* FIXME why do we let pf_release handle the i_refcount ? */ + if( p_picture->pf_release ) + p_picture->pf_release( p_picture ); +} + +/** + * This function will copy all picture dynamic properties. + */ +static inline void picture_CopyProperties( picture_t *p_dst, const picture_t *p_src ) +{ + p_dst->date = p_src->date; + p_dst->b_force = p_src->b_force; + + p_dst->b_progressive = p_src->b_progressive; + p_dst->i_nb_fields = p_src->i_nb_fields; + p_dst->b_top_field_first = p_src->b_top_field_first; +} + +/** + * This function will copy the picture pixels. + * You can safely copy between pictures that do not have the same size, + * only the compatible(smaller) part will be copied. + */ +VLC_EXPORT( void, picture_CopyPixels, ( picture_t *p_dst, const picture_t *p_src ) ); + +/** + * This function will copy both picture dynamic properties and pixels. + * You have to notice that sometime a simple picture_Yield may do what + * you want without the copy overhead. + * Provided for convenience. + */ +static inline void picture_Copy( picture_t *p_dst, const picture_t *p_src ) +{ + picture_CopyPixels( p_dst, p_src ); + picture_CopyProperties( p_dst, p_src ); +} + /** * Video picture heap, either render (to store pictures used * by the decoder) or output (to store pictures displayed by the vout plugin) @@ -282,9 +351,9 @@ struct subpicture_t video_format_t *, picture_t * ); void ( *pf_destroy_region ) ( vlc_object_t *, subpicture_region_t * ); - void ( *pf_pre_render ) ( video_format_t *, spu_t *, subpicture_t *, mtime_t ); - subpicture_region_t * ( *pf_update_regions ) ( video_format_t *, spu_t *, - subpicture_t *, mtime_t ); + void ( *pf_pre_render ) ( video_format_t *, spu_t *, subpicture_t * ); + void ( *pf_update_regions ) ( video_format_t *, spu_t *, + subpicture_t *, mtime_t ); /** Private data - the subtitle plugin might want to put stuff here to * keep track of the subpicture */ @@ -399,8 +468,7 @@ struct vout_thread_t unsigned int i_par_num; /**< monitor pixel aspect-ratio */ unsigned int i_par_den; /**< monitor pixel aspect-ratio */ - intf_thread_t *p_parent_intf; /**< parent interface for embedded - vout (if any) */ + struct vout_window_t *p_window; /**< window for embedded vout (if any) */ /**@}*/ /** \name Plugin used and shortcuts to access its capabilities */ @@ -525,12 +593,65 @@ struct vout_thread_t /***************************************************************************** * Prototypes *****************************************************************************/ + +/** + * This function will + * - returns a suitable vout (if requested by a non NULL p_fmt) + * - recycles an old vout (if given) by either destroying it or by saving it + * for latter usage. + * + * The purpose of this function is to avoid unnecessary creation/destruction of + * vout (and to allow optional vout reusing). + * + * You can call vout_Request on a vout created by vout_Create or by a previous + * call to vout_Request. + * You can release the returned value either by vout_Request or vout_Close() + * followed by a vlc_object_release() or shorter vout_CloseAndRelease() + * + * \param p_this a vlc object + * \param p_vout a vout candidate + * \param p_fmt the video format requested or NULL + * \return a vout if p_fmt is non NULL and the request is successfull, NULL + * otherwise + */ #define vout_Request(a,b,c) __vout_Request(VLC_OBJECT(a),b,c) -VLC_EXPORT( vout_thread_t *, __vout_Request, ( vlc_object_t *, vout_thread_t *, video_format_t * ) ); +VLC_EXPORT( vout_thread_t *, __vout_Request, ( vlc_object_t *p_this, vout_thread_t *p_vout, video_format_t *p_fmt ) ); + +/** + * This function will create a suitable vout for a given p_fmt. It will never + * reuse an already existing unused vout. + * + * You have to call either vout_Close or vout_Request on the returned value + * \param p_this a vlc object to which the returned vout will be attached + * \param p_fmt the video format requested + * \return a vout if the request is successfull, NULL otherwise + */ #define vout_Create(a,b) __vout_Create(VLC_OBJECT(a),b) -VLC_EXPORT( vout_thread_t *, __vout_Create, ( vlc_object_t *, video_format_t * ) ); -VLC_EXPORT( int, vout_VarCallback, ( vlc_object_t *, const char *, vlc_value_t, vlc_value_t, void * ) ); +VLC_EXPORT( vout_thread_t *, __vout_Create, ( vlc_object_t *p_this, video_format_t *p_fmt ) ); +/** + * This function will close a vout created by vout_Create or vout_Request. + * The associated vout module is closed. + * Note: It is not released yet, you'll have to call vlc_object_release() + * or use the convenient vout_CloseAndRelease(). + * + * \param p_vout the vout to close + */ +VLC_EXPORT( void, vout_Close, ( vout_thread_t *p_vout ) ); + +/** + * This function will close a vout created by vout_Create + * and then release it. + * + * \param p_vout the vout to close and release + */ +static inline void vout_CloseAndRelease( vout_thread_t *p_vout ) +{ + vout_Close( p_vout ); + vlc_object_release( p_vout ); +} + +/* */ VLC_EXPORT( int, vout_ChromaCmp, ( uint32_t, uint32_t ) ); VLC_EXPORT( picture_t *, vout_CreatePicture, ( vout_thread_t *, bool, bool, unsigned int ) ); @@ -541,9 +662,14 @@ VLC_EXPORT( void, vout_DatePicture, ( vout_thread_t *, picture_t * VLC_EXPORT( void, vout_LinkPicture, ( vout_thread_t *, picture_t * ) ); VLC_EXPORT( void, vout_UnlinkPicture, ( vout_thread_t *, picture_t * ) ); VLC_EXPORT( void, vout_PlacePicture, ( vout_thread_t *, unsigned int, unsigned int, unsigned int *, unsigned int *, unsigned int *, unsigned int * ) ); + +/* DO NOT use vout_RenderPicture unless you are in src/video_ouput */ picture_t * vout_RenderPicture ( vout_thread_t *, picture_t *, subpicture_t * ); +/* DO NOT use vout_CountPictureAvailable unless your are in src/input/dec.c (no exception) */ +int vout_CountPictureAvailable( vout_thread_t * ); + VLC_EXPORT( int, vout_vaControlDefault, ( vout_thread_t *, int, va_list ) ); VLC_EXPORT( void *, vout_RequestWindow, ( vout_thread_t *, int *, int *, unsigned int *, unsigned int * ) ); VLC_EXPORT( void, vout_ReleaseWindow, ( vout_thread_t *, void * ) );