[vlc-commits] commit: Enabled support for video splitter directly at the core. ( Laurent Aimar )
git at videolan.org
git at videolan.org
Sat Apr 17 23:24:00 CEST 2010
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Fri Apr 16 23:39:45 2010 +0200| [5d0b102f906c90ad6a21772d1b6dd712ba403537] | committer: Laurent Aimar
Enabled support for video splitter directly at the core.
It isn't complete yet (no mouse/crop/...).
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5d0b102f906c90ad6a21772d1b6dd712ba403537
---
src/video_output/display.c | 61 +++++++++++++++-----------------------
src/video_output/display.h | 8 +++++
src/video_output/vout_wrapper.c | 6 ++++
3 files changed, 38 insertions(+), 37 deletions(-)
diff --git a/src/video_output/display.c b/src/video_output/display.c
index b910095..2bf5e95 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -1164,17 +1164,11 @@ vout_display_t *vout_NewDisplay(vout_thread_t *vout,
double_click_timeout, hide_timeout, NULL);
}
-static void SplitterClose(vout_display_t *vd)
-{
- VLC_UNUSED(vd);
- assert(0);
-}
-
-#if 0
/*****************************************************************************
*
*****************************************************************************/
struct vout_display_sys_t {
+ picture_pool_t *pool;
video_splitter_t *splitter;
/* */
@@ -1205,7 +1199,7 @@ static void SplitterDelWindow(vout_display_t *vd, vout_window_t *window)
}
static void SplitterEvent(vout_display_t *vd, int event, va_list args)
{
- vout_display_owner_sys_t *osys = vd->owner.sys;
+ //vout_display_owner_sys_t *osys = vd->owner.sys;
switch (event) {
#if 0
@@ -1231,10 +1225,12 @@ static void SplitterEvent(vout_display_t *vd, int event, va_list args)
}
}
-static picture_t *SplitterGet(vout_display_t *vd)
+static picture_pool_t *SplitterPool(vout_display_t *vd, unsigned count)
{
- /* TODO pool ? */
- return picture_NewFromFormat(&vd->fmt);
+ vout_display_sys_t *sys = vd->sys;
+ if (!sys->pool)
+ sys->pool = picture_pool_NewFromFormat(&vd->fmt, count);
+ return sys->pool;
}
static void SplitterPrepare(vout_display_t *vd, picture_t *picture)
{
@@ -1250,27 +1246,10 @@ static void SplitterPrepare(vout_display_t *vd, picture_t *picture)
}
for (int i = 0; i < sys->count; i++) {
- /* */
- /* FIXME now vout_FilterDisplay already return a direct buffer FIXME */
- sys->picture[i] = vout_FilterDisplay(sys->display[i], sys->picture[i]);
- if (!sys->picture[i])
- continue;
-
- /* */
- picture_t *direct = vout_display_Get(sys->display[i]);
- if (!direct) {
- msg_Err(vd, "Failed to get a direct buffer");
- picture_Release(sys->picture[i]);
- sys->picture[i] = NULL;
- continue;
- }
-
- /* FIXME not always needed (easy when there is a osys->filters) */
- picture_Copy(direct, sys->picture[i]);
- picture_Release(sys->picture[i]);
- sys->picture[i] = direct;
-
- vout_display_Prepare(sys->display[i], sys->picture[i]);
+ if (vout_IsDisplayFiltered(sys->display[i]))
+ sys->picture[i] = vout_FilterDisplay(sys->display[i], sys->picture[i]);
+ if (sys->picture[i])
+ vout_display_Prepare(sys->display[i], sys->picture[i]);
}
}
static void SplitterDisplay(vout_display_t *vd, picture_t *picture)
@@ -1292,7 +1271,7 @@ static void SplitterManage(vout_display_t *vd)
vout_display_sys_t *sys = vd->sys;
for (int i = 0; i < sys->count; i++)
- vout_ManageDisplay(sys->display[i]);
+ vout_ManageDisplay(sys->display[i], true);
}
static int SplitterPictureNew(video_splitter_t *splitter, picture_t *picture[])
@@ -1300,8 +1279,13 @@ static int SplitterPictureNew(video_splitter_t *splitter, picture_t *picture[])
vout_display_sys_t *wsys = splitter->p_owner->wrapper->sys;
for (int i = 0; i < wsys->count; i++) {
- /* TODO pool ? */
- picture[i] = picture_NewFromFormat(&wsys->display[i]->source);
+ if (vout_IsDisplayFiltered(wsys->display[i])) {
+ /* TODO use a pool ? */
+ picture[i] = picture_NewFromFormat(&wsys->display[i]->source);
+ } else {
+ picture_pool_t *pool = vout_display_Pool(wsys->display[i], 1);
+ picture[i] = pool ? picture_pool_Get(pool) : NULL;
+ }
if (!picture[i]) {
for (int j = 0; j < i; j++)
picture_Release(picture[j]);
@@ -1326,6 +1310,9 @@ static void SplitterClose(vout_display_t *vd)
free(splitter->p_owner);
video_splitter_Delete(splitter);
+ if (sys->pool)
+ picture_pool_Delete(sys->pool);
+
/* */
for (int i = 0; i < sys->count; i++)
vout_DeleteDisplay(sys->display[i], NULL);
@@ -1363,8 +1350,9 @@ vout_display_t *vout_NewSplitter(vout_thread_t *vout,
if (!sys->picture )
abort();
sys->splitter = splitter;
+ sys->pool = NULL;
- wrapper->get = SplitterGet;
+ wrapper->pool = SplitterPool;
wrapper->prepare = SplitterPrepare;
wrapper->display = SplitterDisplay;
wrapper->control = SplitterControl;
@@ -1414,7 +1402,6 @@ vout_display_t *vout_NewSplitter(vout_thread_t *vout,
return wrapper;
}
-#endif
/*****************************************************************************
* TODO move out
diff --git a/src/video_output/display.h b/src/video_output/display.h
index a6987f6..2763f40 100644
--- a/src/video_output/display.h
+++ b/src/video_output/display.h
@@ -109,6 +109,14 @@ void vout_SetDisplayCrop(vout_display_t *,
#endif
+vout_display_t *vout_NewSplitter(vout_thread_t *vout,
+ const video_format_t *source,
+ const vout_display_state_t *state,
+ const char *module,
+ const char *splitter_module,
+ mtime_t double_click_timeout,
+ mtime_t hide_timeout);
+
/* FIXME should not be there */
void vout_SendDisplayEventMouse(vout_thread_t *, const vlc_mouse_t *);
vout_window_t *vout_NewDisplayWindow(vout_thread_t *, vout_display_t *, const vout_window_cfg_t *);
diff --git a/src/video_output/vout_wrapper.c b/src/video_output/vout_wrapper.c
index 2097070..1bf20f3 100644
--- a/src/video_output/vout_wrapper.c
+++ b/src/video_output/vout_wrapper.c
@@ -35,6 +35,7 @@
#include <vlc_vout.h>
#include <assert.h>
#include "vout_internal.h"
+#include "display.h"
/*****************************************************************************
*
@@ -99,6 +100,11 @@ int vout_OpenWrapper(vout_thread_t *vout, const char *name)
sys->vd = vout_NewDisplay(vout, &source, &state, name ? name : "$vout",
double_click_timeout, hide_timeout);
+ /* If we need to video filter and it fails, then try a splitter
+ * XXX it is a hack for now FIXME */
+ if (name && !sys->vd)
+ sys->vd = vout_NewSplitter(vout, &source, &state, "$vout", name,
+ double_click_timeout, hide_timeout);
if (!sys->vd) {
free(sys->title);
free(sys);
More information about the vlc-commits
mailing list