summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Ciccani <klan@users.sourceforge.net>2006-06-30 06:51:41 +0000
committerClaudio Ciccani <klan@users.sourceforge.net>2006-06-30 06:51:41 +0000
commitd6a5b459f3a42e7239cac996a7258d0406c1e1f5 (patch)
treedcc25105befc89c70b672349c714866803a0839d
parentc3431270d9ba579e4ce1298ea6f0c0f913dcf20f (diff)
downloadxine-lib-d6a5b459f3a42e7239cac996a7258d0406c1e1f5.tar.gz
xine-lib-d6a5b459f3a42e7239cac996a7258d0406c1e1f5.tar.bz2
Added support for other types of subpicture layers (e.g. Matrox CRTC2's subpicture).
CVS patchset: 8082 CVS date: 2006/06/30 06:51:41
-rw-r--r--src/video_out/video_out_directfb.c62
1 files changed, 55 insertions, 7 deletions
diff --git a/src/video_out/video_out_directfb.c b/src/video_out/video_out_directfb.c
index e58f71f7d..50a2b94ab 100644
--- a/src/video_out/video_out_directfb.c
+++ b/src/video_out/video_out_directfb.c
@@ -1356,6 +1356,21 @@ static DFBEnumerationResult find_underlay (DFBDisplayLayerID id,
return DFENUM_OK;
}
+static DFBEnumerationResult find_subpicture (DFBDisplayLayerID id,
+ DFBDisplayLayerDescription dsc, void *ctx) {
+ DFBDisplayLayerID *ret_id = (DFBDisplayLayerID *) ctx;
+
+ if (id != DLID_PRIMARY &&
+ dsc.caps & DLCAPS_SURFACE &&
+ dsc.caps & DLCAPS_ALPHACHANNEL) {
+ lprintf ("subpicture's id = %d.\n", id);
+ *ret_id = id;
+ return DFENUM_CANCEL;
+ }
+
+ return DFENUM_OK;
+}
+
static void init_subpicture (directfb_driver_t *this) {
DFBResult ret;
@@ -1367,9 +1382,6 @@ static void init_subpicture (directfb_driver_t *this) {
if (dsc.caps & DLCAPS_ALPHACHANNEL) {
DFBDisplayLayerConfig config;
- /* put overlay under underlay */
- this->layer->SetLevel (this->layer, -1);
-
/* enable alphachannel on the underlay */
config.flags = DLCONF_PIXELFORMAT | DLCONF_OPTIONS;
config.pixelformat = DSPF_ARGB;
@@ -1378,14 +1390,50 @@ static void init_subpicture (directfb_driver_t *this) {
if (ret == DFB_OK) {
this->underlay->AddRef (this->underlay);
this->spic_layer = this->underlay;
+ /* put overlay under underlay */
+ this->layer->SetLevel (this->layer, -1);
+ }
+ }
+ }
+
+ /* most common type of supicture layer */
+ if (!this->spic_layer) {
+ IDirectFBScreen *screen;
+ DFBDisplayLayerID video_id, id = -1;
+
+ this->layer->GetID (this->layer, &video_id);
+
+ if (this->layer->GetScreen (this->layer, &screen) == DFB_OK) {
+ screen->EnumDisplayLayers (screen, find_subpicture, (void *)&id);
+ screen->Release (screen);
+ }
+
+ if (id != -1 && id != video_id) {
+ ret = this->dfb->GetDisplayLayer (this->dfb, id, &this->spic_layer);
+ if (ret == DFB_OK) {
+ DFBDisplayLayerConfig config;
+
+ this->spic_layer->GetConfiguration (this->spic_layer, &config);
+
+ config.flags = DLCONF_OPTIONS;
+ config.options = DLOP_ALPHACHANNEL;
+ if (!DFB_PIXELFORMAT_HAS_ALPHA(config.pixelformat)) {
+ config.flags |= DLCONF_PIXELFORMAT;
+ config.pixelformat = DSPF_ALUT44;
+ }
+
+ ret = this->spic_layer->SetConfiguration (this->spic_layer, &config);
+ if (ret) {
+ lprintf ("failed to set subpicture layer configuration!\n");
+ this->spic_layer->Release (this->spic_layer);
+ this->spic_layer = NULL;
+ }
}
else {
- this->layer->SetLevel (this->layer, 1);
+ DirectFBError ("IDirectFB::GetDisplayLayer()", ret);
}
}
}
-
- /* TODO: add support for different types of subpicture layers. */
if (this->spic_layer) {
ret = this->spic_layer->GetSurface (this->spic_layer, &this->spic_surface);
@@ -1538,7 +1586,7 @@ static DFBResult init_device (directfb_driver_t *this) {
this->layer->GetScreen (this->layer, &screen);
if (screen) {
- screen->EnumDisplayLayers (screen, find_underlay, (void*)&id);
+ screen->EnumDisplayLayers (screen, find_underlay, (void *)&id);
screen->Release (screen);
}