Commit c0e40cc1 authored by Laurent Aimar's avatar Laurent Aimar

Updated vout display modules after ::get -> ::pool change.

parent 149587ec
......@@ -98,7 +98,7 @@ vlc_module_begin ()
set_description( N_("Dummy video output function") )
set_section( N_( "Dummy Video output" ), NULL )
set_capability( "vout display", 1 )
set_callbacks( OpenVideo, NULL )
set_callbacks( OpenVideo, CloseVideo )
set_category( CAT_VIDEO )
set_subcategory( SUBCAT_VIDEO_VOUT )
add_category_hint( N_("Video"), NULL, false )
......@@ -108,7 +108,7 @@ vlc_module_begin ()
set_description( N_("Stats video output function") )
set_capability( "vout display", 0 )
add_shortcut( "stats" )
set_callbacks( OpenVideoStat, NULL )
set_callbacks( OpenVideoStat, CloseVideo )
add_submodule ()
set_description( N_("Dummy font renderer function") )
set_capability( "text renderer", 1 )
......
......@@ -40,5 +40,6 @@ int OpenAudio ( vlc_object_t * );
int OpenVideo ( vlc_object_t * );
int OpenVideoStat( vlc_object_t * );
void CloseVideo ( vlc_object_t * );
int OpenRenderer ( vlc_object_t * );
......@@ -36,11 +36,14 @@
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static picture_t *Get(vout_display_t *);
static void Display(vout_display_t *, picture_t *);
static void DisplayStat(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int, va_list);
static void Manage (vout_display_t *);
struct vout_display_sys_t {
picture_pool_t *pool;
};
static picture_pool_t *Pool(vout_display_t *, unsigned count);
static void Display(vout_display_t *, picture_t *);
static void DisplayStat(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int, va_list);
static void Manage (vout_display_t *);
/*****************************************************************************
* OpenVideo: activates dummy vout display method
......@@ -48,6 +51,12 @@ static void Manage (vout_display_t *);
static int OpenVideoCommon(vlc_object_t *object, bool display_stat)
{
vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys;
vd->sys = sys = calloc(1, sizeof(*sys));
if (!sys)
return VLC_EGENERIC;
sys->pool = NULL;
/* p_vd->info is not modified */
......@@ -60,11 +69,11 @@ static int OpenVideoCommon(vlc_object_t *object, bool display_stat)
}
free(chroma);
}
vd->get = Get;
vd->pool = Pool;
vd->prepare = NULL;
vd->display = display_stat ? DisplayStat : Display;
vd->control = Control;
vd->manage = Manage;
vd->manage = Manage;
return VLC_SUCCESS;
}
......@@ -77,10 +86,21 @@ int OpenVideoStat(vlc_object_t *object)
return OpenVideoCommon(object, true);
}
static picture_t *Get(vout_display_t *vd)
void CloseVideo(vlc_object_t *object)
{
VLC_UNUSED(vd);
return picture_NewFromFormat(&vd->fmt);
vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys = vd->sys;
picture_pool_Delete(sys->pool);
free(sys);
}
static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
{
vout_display_sys_t *sys = vd->sys;
if (!sys->pool)
sys->pool = picture_pool_NewFromFormat(&vd->fmt, count);
return sys->pool;
}
static void Display(vout_display_t *vd, picture_t *picture)
......
......@@ -58,10 +58,10 @@ vlc_module_end()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static picture_t *Get (vout_display_t *);
static void Prepare(vout_display_t *, picture_t *);
static void Display(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int, va_list);
static picture_pool_t *Pool (vout_display_t *, unsigned);
static void Prepare(vout_display_t *, picture_t *);
static void Display(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int, va_list);
/* */
static void Manage(vout_display_t *);
......@@ -115,11 +115,11 @@ static int Open(vlc_object_t *object)
vd->fmt = fmt;
vd->info = info;
vd->get = Get;
vd->pool = Pool;
vd->prepare = Prepare;
vd->display = Display;
vd->control = Control;
vd->manage = Manage;
vd->manage = Manage;
/* Inspect initial configuration and send correction events
* FIXME how to handle aspect ratio with aa ? */
......@@ -152,11 +152,12 @@ static void Close(vlc_object_t *object)
}
/**
* Return a direct buffer
* Return a pool of direct buffers
*/
static picture_t *Get(vout_display_t *vd)
static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
{
vout_display_sys_t *sys = vd->sys;
VLC_UNUSED(count);
if (!sys->pool) {
picture_resource_t rsc;
......@@ -171,11 +172,8 @@ static picture_t *Get(vout_display_t *vd)
return NULL;
sys->pool = picture_pool_New(1, &p_picture);
if (!sys->pool)
return NULL;
}
return picture_pool_Get(sys->pool);
return sys->pool;
}
/**
......
......@@ -55,10 +55,10 @@ vlc_module_end()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static picture_t *Get (vout_display_t *);
static void Prepare(vout_display_t *, picture_t *);
static void Display(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int, va_list);
static picture_pool_t *Pool (vout_display_t *, unsigned);
static void Prepare(vout_display_t *, picture_t *);
static void Display(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int, va_list);
/* */
static void Manage(vout_display_t *);
......@@ -164,11 +164,6 @@ static int Open(vlc_object_t *object)
fmt.i_bmask = 0x000000ff;
}
/* */
sys->pool = picture_pool_NewFromFormat(&fmt, 1);
if (!sys->pool)
goto error;
/* TODO */
vout_display_info_t info = vd->info;
......@@ -176,11 +171,11 @@ static int Open(vlc_object_t *object)
vd->fmt = fmt;
vd->info = info;
vd->get = Get;
vd->pool = Pool;
vd->prepare = Prepare;
vd->display = Display;
vd->control = Control;
vd->manage = Manage;
vd->manage = Manage;
/* Fix initial state */
vout_display_SendEventFullscreen(vd, false);
......@@ -215,7 +210,8 @@ static void Close(vlc_object_t *object)
vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys = vd->sys;
picture_pool_Delete(sys->pool);
if (sys->pool)
picture_pool_Delete(sys->pool);
if (sys->dither)
cucul_free_dither(sys->dither);
caca_free_display(sys->dp);
......@@ -229,13 +225,15 @@ static void Close(vlc_object_t *object)
}
/**
* Return a direct buffer
* Return a pool of direct buffers
*/
static picture_t *Get(vout_display_t *vd)
static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
{
vout_display_sys_t *sys = vd->sys;
return picture_pool_Get(sys->pool);
if (!sys->pool)
sys->pool = picture_pool_NewFromFormat(&vd->fmt, count);
return sys->pool;
}
/**
......
......@@ -55,10 +55,10 @@ vlc_module_end()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static picture_t *Get (vout_display_t *);
static void Display(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int, va_list);
static void Manage (vout_display_t *);
static picture_pool_t *Pool (vout_display_t *, unsigned);
static void Display(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int, va_list);
static void Manage (vout_display_t *);
/* */
static int OpenDisplay (vout_display_t *);
......@@ -157,7 +157,7 @@ static int Open(vlc_object_t *object)
/* */
vd->fmt = fmt;
vd->info = info;
vd->get = Get;
vd->pool = Pool;
vd->prepare = NULL;
vd->display = Display;
vd->control = Control;
......@@ -182,16 +182,13 @@ static void Close(vlc_object_t *object)
}
/* */
static picture_t *Get(vout_display_t *vd)
static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
{
vout_display_sys_t *sys = vd->sys;
if (!sys->pool) {
sys->pool = picture_pool_NewFromFormat(&vd->fmt, 1);
if (!sys->pool)
return NULL;
}
return picture_pool_Get(sys->pool);
if (!sys->pool)
sys->pool = picture_pool_NewFromFormat(&vd->fmt, count);
return sys->pool;
}
static void Display(vout_display_t *vd, picture_t *picture)
......
......@@ -98,10 +98,10 @@ vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static picture_t *Get (vout_display_t *);
static void Display(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int, va_list);
static void Manage (vout_display_t *);
static picture_pool_t *Pool (vout_display_t *, unsigned);
static void Display(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int, va_list);
static void Manage (vout_display_t *);
/* */
static int OpenDisplay (vout_display_t *, bool force_resolution);
......@@ -262,7 +262,7 @@ static int Open(vlc_object_t *object)
/* */
vd->fmt = fmt;
vd->info = info;
vd->get = Get;
vd->pool = Pool;
vd->prepare = NULL;
vd->display = Display;
vd->control = Control;
......@@ -296,7 +296,7 @@ static void Close(vlc_object_t *object)
}
/* */
static picture_t *Get(vout_display_t *vd)
static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
{
vout_display_sys_t *sys = vd->sys;
......@@ -322,11 +322,9 @@ static picture_t *Get(vout_display_t *vd)
if (sys->is_hw_accel)
sys->pool = picture_pool_New(1, &sys->picture);
else
sys->pool = picture_pool_NewFromFormat(&vd->fmt, 1);
if (!sys->pool)
return NULL;
sys->pool = picture_pool_NewFromFormat(&vd->fmt, count);
}
return picture_pool_Get(sys->pool);
return sys->pool;
}
static void Display(vout_display_t *vd, picture_t *picture)
{
......
......@@ -97,11 +97,11 @@ struct picture_sys_t
static int Open(vlc_object_t *);
static picture_t *Get (vout_display_t *);
static void Prepare(vout_display_t *, picture_t *);
static void Display(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int, va_list);
static void Manage (vout_display_t *);
static picture_pool_t *Pool (vout_display_t *, unsigned);
static void Prepare(vout_display_t *, picture_t *);
static void Display(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int, va_list);
static void Manage (vout_display_t *);
static int Direct3DCreate (vout_display_t *);
static int Direct3DReset (vout_display_t *);
......@@ -177,7 +177,7 @@ static int Open(vlc_object_t *object)
vd->fmt = fmt;
vd->info = info;
vd->get = Get;
vd->pool = Pool;
vd->prepare = Prepare;
vd->display = Display;
vd->control = Control;
......@@ -231,13 +231,10 @@ static void Close(vlc_object_t *object)
}
/* */
static picture_t *Get(vout_display_t *vd)
static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
{
vout_display_sys_t *sys = vd->sys;
if (!sys->pool)
return NULL;
return picture_pool_Get(sys->pool);
VLC_UNUSED(count);
return vd->sys->pool;
}
static int Direct3DLockSurface(picture_t *);
......
......@@ -74,13 +74,13 @@ vlc_module_end()
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
static picture_t *Get (vout_display_t *);
static void Prepare(vout_display_t *, picture_t *);
static void Display(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int, va_list);
static void Manage (vout_display_t *);
static picture_pool_t *Pool (vout_display_t *, unsigned);
static void Prepare(vout_display_t *, picture_t *);
static void Display(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int, va_list);
static void Manage (vout_display_t *);
static void Swap (vout_opengl_t *);
static void Swap (vout_opengl_t *);
/**
* It creates an OpenGL vout display.
......@@ -140,7 +140,7 @@ static int Open(vlc_object_t *object)
vd->fmt = fmt;
vd->info = info;
vd->get = Get;
vd->pool = Pool;
vd->prepare = Prepare;
vd->display = Display;
vd->control = Control;
......@@ -177,16 +177,14 @@ static void Close(vlc_object_t *object)
}
/* */
static picture_t *Get(vout_display_t *vd)
static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
{
vout_display_sys_t *sys = vd->sys;
VLC_UNUSED(count);
if (!sys->pool) {
if (!sys->pool)
sys->pool = vout_display_opengl_GetPool(&sys->vgl);
if (!sys->pool)
return NULL;
}
return picture_pool_Get(sys->pool);
return sys->pool;
}
static void Prepare(vout_display_t *vd, picture_t *picture)
......
......@@ -77,10 +77,10 @@ vlc_module_end()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static picture_t *Get (vout_display_t *);
static void Display(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int, va_list);
static void Manage(vout_display_t *);
static picture_pool_t *Pool (vout_display_t *, unsigned);
static void Display(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int, va_list);
static void Manage(vout_display_t *);
/* */
static int ConvertKey(SDLKey);
......@@ -337,7 +337,7 @@ static int Open(vlc_object_t *object)
vd->fmt = fmt;
vd->info = info;
vd->get = Get;
vd->pool = Pool;
vd->prepare = NULL;
vd->display = Display;
vd->control = Control;
......@@ -389,11 +389,12 @@ static void Close(vlc_object_t *object)
}
/**
* Return a direct buffer
* Return a pool of direct buffers
*/
static picture_t *Get(vout_display_t *vd)
static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
{
vout_display_sys_t *sys = vd->sys;
VLC_UNUSED(count);
if (!sys->pool) {
picture_resource_t rsc;
......@@ -430,11 +431,9 @@ static picture_t *Get(vout_display_t *vd)
return NULL;
sys->pool = picture_pool_New(1, &picture);
if (!sys->pool)
return NULL;
}
return picture_pool_Get(sys->pool);
return sys->pool;
}
/**
......
......@@ -90,10 +90,10 @@ vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static picture_t *Get (vout_display_t *);
static void Display(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int, va_list);
static void Manage (vout_display_t *);
static picture_pool_t *Pool (vout_display_t *, unsigned);
static void Display(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int, va_list);
static void Manage (vout_display_t *);
typedef struct {
mtime_t date; /* Presentation time */
......@@ -243,7 +243,7 @@ static int Open(vlc_object_t *object)
/* */
vd->fmt = fmt;
vd->info = info;
vd->get = Get;
vd->pool = Pool;
vd->prepare = NULL;
vd->display = Display;
vd->control = Control;
......@@ -281,9 +281,10 @@ static void Close(vlc_object_t *object)
/*****************************************************************************
*
*****************************************************************************/
static picture_t *Get(vout_display_t *vd)
static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
{
return picture_pool_Get(vd->sys->pool);
VLC_UNUSED(count);
return vd->sys->pool;
}
/* Return the position in ms from the start of the movie */
......
......@@ -98,13 +98,13 @@ struct vout_display_sys_t {
picture_pool_t *pool;
};
static picture_t *Get (vout_display_t *);
static void Display(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int, va_list);
static void Manage (vout_display_t *);
static picture_pool_t *Pool (vout_display_t *, unsigned);
static void Display(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int, va_list);
static void Manage (vout_display_t *);
static int Lock(picture_t *);
static void Unlock(picture_t *);
static int Lock(picture_t *);
static void Unlock(picture_t *);
/*****************************************************************************
* Open: allocates video thread
......@@ -228,7 +228,7 @@ static int Open(vlc_object_t *object)
/* */
vd->fmt = fmt;
vd->info = info;
vd->get = Get;
vd->pool = Pool;
vd->prepare = NULL;
vd->display = Display;
vd->control = Control;
......@@ -250,9 +250,10 @@ static void Close(vlc_object_t *object)
}
/* */
static picture_t *Get(vout_display_t *vd)
static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
{
return picture_pool_Get(vd->sys->pool);
VLC_UNUSED(count);
return vd->sys->pool;
}
static void Display(vout_display_t *vd, picture_t *picture)
......
......@@ -301,7 +301,10 @@ static int Init(vout_thread_t *vout)
picture->p_sys = malloc(sizeof(*picture->p_sys));
if (sys->use_dr) {
picture_t *direct = vout_display_Get(vd);
picture_pool_t *pool = vout_display_Pool(vd, picture_max);
if (!pool)
break;
picture_t *direct = picture_pool_Get(pool);
if (!direct)
break;
picture->format = direct->format;
......
......@@ -76,7 +76,7 @@ struct vout_display_sys_t
picture_pool_t *pool; /* picture pool */
};
static picture_t *Get (vout_display_t *);
static picture_pool_t *Pool (vout_display_t *, unsigned);
static void PictureRender (vout_display_t *, picture_t *);
static void PictureDisplay (vout_display_t *, picture_t *);
static int Control (vout_display_t *, int, va_list);
......@@ -375,7 +375,7 @@ static int Open (vlc_object_t *obj)
/* Setup vout_display_t once everything is fine */
vd->info = info;
vd->get = Get;
vd->pool = Pool;
vd->prepare = PictureRender;
vd->display = PictureDisplay;
vd->control = Control;
......@@ -431,17 +431,14 @@ static void SwapBuffers (vout_opengl_t *gl)
/**
* Return a direct buffer
*/
static picture_t *Get (vout_display_t *vd)
static picture_pool_t *Pool (vout_display_t *vd, unsigned requested_count)
{
vout_display_sys_t *sys = vd->sys;
(void)requested_count;
if (!sys->pool)
{
sys->pool = vout_display_opengl_GetPool (&sys->vgl);
if (!sys->pool)
return NULL;
}
return picture_pool_Get (sys->pool);
return sys->pool;
}
static void PictureRender (vout_display_t *vd, picture_t *pic)
......
......@@ -83,7 +83,7 @@ struct vout_display_sys_t
picture_resource_t resource[MAX_PICTURES];
};
static picture_t *Get (vout_display_t *);
static picture_pool_t *Pool (vout_display_t *, unsigned);
static void Display (vout_display_t *, picture_t *);
static int Control (vout_display_t *, int, va_list);
static void Manage (vout_display_t *);
......@@ -281,7 +281,7 @@ static int Open (vlc_object_t *obj)
vd->fmt = fmt_pic;
vd->info = info;
vd->get = Get;
vd->pool = Pool;
vd->prepare = NULL;
vd->display = Display;
vd->control = Control;
......@@ -317,9 +317,10 @@ static void Close (vlc_object_t *obj)
/**
* Return a direct buffer
*/
static picture_t *Get (vout_display_t *vd)
static picture_pool_t *Pool (vout_display_t *vd, unsigned requested_count)
{
vout_display_sys_t *p_sys = vd->sys;
(void)requested_count;
if (!p_sys->pool)
{
......@@ -366,16 +367,11 @@ static picture_t *Get (vout_display_t *vd)
return NULL;
p_sys->pool = picture_pool_New (count, pic_array);
if (!p_sys->pool)
{
/* TODO release picture resources */
return NULL;
}
/* FIXME should also do it in case of error ? */
/* TODO release picture resources if NULL */
xcb_flush (p_sys->conn);
}
return picture_pool_Get (p_sys->pool);
return p_sys->pool;
}